<?php if (!empty($data['custom_css'])):?>
	<style><?php echo $data['custom_css'];?></style>
<?php endif;?>

<?php wp_enqueue_style( 'ihc-croppic_css', IHC_URL . 'assets/css/croppic.css' );?>
<?php wp_enqueue_script( 'ihc-jquery_mousewheel', IHC_URL . 'assets/js/jquery.mousewheel.min.js', array(), null );?>
<?php wp_enqueue_script( 'ihc-croppic', IHC_URL . 'assets/js/croppic.js', array(), null );?>
<?php wp_enqueue_script( 'ihc-account_page-banner', IHC_URL . 'assets/js/account_page-banner.js', array(), null );?>

<script>
jQuery( document ).ready( function(){
		IhcAccountPageBanner.init({
				triggerId					: 'js_ihc_edit_top_ap_banner',
				saveImageTarget		: '<?php echo IHC_URL . 'public/ajax-upload.php';?>',
				cropImageTarget   : '<?php echo IHC_URL . 'public/ajax-upload.php';?>',
				bannerClass       : 'ihc-user-page-top-ap-background'
		})
})
</script>
<div class="ihc-account-page-wrapp ocean" id="ihc_account_page_wrapp">

	<?php
		$top_style='';
		if (empty($this->settings['ihc_ap_edit_background']) && ($this->settings['ihc_ap_top_template'] == 'ihc-ap-top-theme-2' || $this->settings['ihc_ap_top_template'] == 'ihc-ap-top-theme-3' )){
			$top_style .='style="padding-top:75px;"';
		}

        /* Added check by ocean to restrict user by accessing other tabs before completing his'her profile information */
        
        $flag = false;
		$userData = get_user_meta( $this->current_user->ID);

// 		if(isset($userData['first_name'][0]) && $userData['first_name'][0] != '' &&  isset($userData['last_name'][0]) && $userData['last_name'][0] != '' && isset($userData['driverslicense'][0]) && $userData['driverslicense'][0] != '' && isset($userData['phone'][0]) && $userData['phone'][0] != '' && isset($userData['duidate'][0]) && $userData['duidate'][0] != '' && isset($userData['citation'][0]) && $userData['citation'][0] != '' && isset($userData['hearaboutus'][0]) && $userData['hearaboutus'][0] != '' && isset($userData['courtlocation1'][0]) && $userData['courtlocation1'][0] != '' && isset($userData['dateofbirth'][0]) && $userData['dateofbirth'][0] != ''){
		if(isset($userData['complete_profile'][0]) && $userData['complete_profile'][0] == 1){
		    $flag = true;
		}else{
		    if(isset($userData['first_name'][0]) && $userData['first_name'][0] != '' &&  isset($userData['last_name'][0]) && $userData['last_name'][0] != '' && isset($userData['driverslicense'][0]) && $userData['driverslicense'][0] != '' && isset($userData['phone'][0]) && $userData['phone'][0] != '' && isset($userData['duidate'][0]) && $userData['duidate'][0] != '' && isset($userData['citation'][0]) && $userData['citation'][0] != '' && isset($userData['hearaboutus'][0]) && $userData['hearaboutus'][0] != '' && isset($userData['courtlocation1'][0]) && $userData['courtlocation1'][0] != '' && isset($userData['dateofbirth'][0]) && $userData['dateofbirth'][0] != ''){
		        update_user_meta($this->current_user->ID, 'complete_profile', '1');
		        $flag = true;
		    }else{
		        update_user_meta($this->current_user->ID, 'complete_profile', '0');
		        $flag = false;
		    }
		}
		
        $current_url= $_SERVER['REQUEST_URI'];
        
		if(!$flag && !stripos($current_url,"ihc_ap_menu=profile")){
			wp_safe_redirect(get_home_url()."/arizona-dui-account-page/?ihc_ap_menu=profile");
	        exit;
		}
		
		if(!$flag){ ?>
		    <script>
		    setTimeout(function(){
		        jQuery('.ihc-ap-wrap h2 strong').css('color', '#dd3333');
		    }, 2000);
		        setTimeout(function(){ 
		            jQuery('.ihc-ap-wrap h2 strong').css('color', '#333333');
		        }, 5000);
		    </script>
		<?php }
		
		/* Ocean ends */

	?>

		<div class="ihc-user-page-top-ap-wrapper <?php echo (!empty($this->settings['ihc_ap_top_template']) ? $this->settings['ihc_ap_top_template'] : '');?>" <?php echo $top_style;?> >

		  	<div class="ihc-left-side">
				<div class="ihc-user-page-details">
					<?php if (!empty($data['avatar'])):?>
						<div class="ihc-user-page-avatar"><img src="<?php echo $data['avatar'];?>" class="ihc-member-photo"/></div>
					<?php endif;?>
				</div>
			</div>

			<div class="ihc-middle-side">
				<div class="ihc-account-page-top-mess">
                <?php if ($this->settings['ihc_ap_top_template'] == 'ihc-ap-top-theme-4' ){ ?>
                	<div class="iump-user-page-name"><?php echo $first_name . ' ' . $last_name;?></div>
                <?php } ?>
                   <div class="ihc-account-page-top-extra-mess">
					<?php if (!empty($data['welcome_message'])):?>
						<?php echo do_shortcode($data['welcome_message']);?>
					<?php else:?>
						<div class="iump-user-page-mess"><?php echo __('Welcome', 'ihc');?>,</div>
						<div class="iump-user-page-mess"><?php echo $first_name . ' ' . $last_name;?></div>
						<div class="iump-user-page-email"><?php echo $this->current_user->user_email;?></div>
					<?php endif;?>
                    </div>
				</div>
				<?php if (!empty($data['levels'])):?>
					<div class="ihc-top-levels">
						<?php foreach ($data['levels'] as $lid => $level):?>
							<?php
				    			$time_arr = ihc_get_start_expire_date_for_user_level($this->current_user->ID, $lid);
						    	$is_expired_class = '';
								if (isset($time_arr['expire_time']) && time()>strtotime( $time_arr['expire_time'] ) ){
						    		$is_expired_class = 'ihc-expired-level';
						    	}
							?>
							<?php if (!empty($data['badges_metas']['ihc_badges_on']) && !empty($level['badge_image_url'])):?>
								<div class="iump-badge-wrapper <?php echo $is_expired_class;?>"><img src="<?php echo $level['badge_image_url'];?>" class="iump-badge" title="<?php echo $level['label'];?>" /></div>
							<?php elseif (!empty($level['label'])):?>
								<div class="ihc-top-level-box <?php echo $is_expired_class;?>"><?php echo $level['label'];?></div>
							<?php endif;?>
						<?php endforeach;?>
					</div>
				<?php endif;?>
				<?php if (!empty($data['sm'])):?>
					<div class="ihc-ap-top-sm">
						<?php echo $data['sm'];?>
					</div>
				<?php endif;?>
			</div>

			<div class="ihc-clear"></div>
				<?php
					if (!empty($this->settings['ihc_ap_edit_background'])):
						$bk_style = '';
						$banner = '';
						if (!empty($this->settings['ihc_ap_top_background_image'])):
								$banner = $this->settings['ihc_ap_top_background_image'];
						endif;
						if (!empty($data ['top_banner'])):
							$banner = $data ['top_banner'];
						endif;
						if (!empty($banner)){
								$bk_style = 'style="background-image:url('.$banner.');"';
						}
			 	?>
            <div class="ihc-background-overlay"></div>
				  	<div class="ihc-user-page-top-ap-background" <?php echo $bk_style;?> data-banner="<?php echo $banner;?>" >

						</div>
                    <div class="ihc-edit-top-ap-banner" id="js_ihc_edit_top_ap_banner"></div>
		  <?php endif;?>

		</div>
		<div class="ihc-user-page-content-wrapper  <?php echo @$this->settings['ihc_ap_theme'];?>">

<?php
