	 <?php $my_info = get_user_info_by_id(auth('id')); ?>
	 <?php $setting = get_setting(); ?>
	 <div class="row">
 	 <?php if ($my_info['is_payment']==0): ?>
 	 	<div class="col-md-4 col-md-offset-4">
 	 		<div class="alert alert-warning alert-dismissible">
 	 			<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
 	 			<h4><i class="icon fa fa-warning"></i> <?= !empty(lang('alert'))?lang('alert'):"Alert"?>!</h4>
 	 			<h4><?= !empty(lang('payment_pending'))?lang('payment_pending'):"Warning!! Your payment is still pending"?></h4>
 	 			<p class="">*<?= !empty(lang('contact_us_alert'))?lang('contact_us_alert'):"Please pay from subscriptions or contact us"?></p>
 	 		</div>
 	 	</div>
   <?php endif ?>
	 </div>
<div class="row">

	<?php if(isset($active_package) && !empty($active_package)): ?>
		<div class="col-md-4 col-lg-3">
			<div class="pricing_3">
				<div class="card">
		          <div class="card-body">
		            <div class="card_top">
		            	<h5 class="card-title text-muted text-uppercase text-center"><?= html_escape($active_package['type_name']);?></h5>
			             <?php if($active_package['type']=='free'): ?>
			             	<h6 class="card-price text-center"><?= !empty(lang('free'))?lang('free'):'Free';?></h6>
			            <?php elseif($active_package['type']=='trial'): ?>
			            	<h6 class="card-price text-center"><?= !empty(lang('free'))?lang('free'):'Free';?><span class="period">/<?= !empty(lang('month'))?lang('month'):'month';?></span></h6>
			               
			            <?php else: ?>
			            	<h6 class="card-price text-center"><?= get_currency('icon');?><?= html_escape($active_package['price']) ;?><span class="period">/<?= !empty(lang(strtolower(get_package_type($active_package['type']))))?lang(strtolower(get_package_type($active_package['type']))):get_package_type($active_package['type']);?></span></h6>
			            <?php endif;?>
			            <h5 class="text-center"> <?= $active_package['type_limit']==0?(!empty(lang('unlimited'))?lang('unlimited'):"Unlimited"):(!empty(lang('only'))?lang('only'):"Only")." ".html_escape($active_package['type_limit']);?></h5>

			            
			            <h5 class="text-center"><?= lang('vcard_limit') ;?> : <?= type_limit($active_package['card_limit']) ;?></h5>
			            <h5 class="text-center"><?= lang('vcard_information_limit') ;?> : <?= type_limit($active_package['vcard_limit']) ;?></h5>
		            </div>
		            <hr>
		            	<div class="list_ul">
		            		<ul class="fa-ul">
				            	<?php foreach ($all_features as $key2 => $feature): ?>
				                  	<?php $feature_id = get_active_package_features($feature['id'],$active_package['id']); ?>
				                  	<?php if(isset($feature_id) && $feature_id==1): ?>
				            		 	<li><span class="list_li"><i class="fas fa-check c_green"></i></span> <?= html_escape($feature['features']);?></li>
				            		<?php else: ?>
				            		 	<li class="text-muted"><span class="list_li"><i class="fas fa-times c_red"></i></span> <?= html_escape($feature['features']);?></li>
				            		<?php endif;?>
				            	<?php endforeach ?>
				            </ul>
		            	</div>
		            	
	            		<div class="active_package_btn">
	            			<a href="javascript:;" class="bg_success"><i class="fas fa-check"></i> &nbsp; <?= !empty(lang('runing_package'))?lang('runing_package'):"Runing Package" ;?></a>
	            			<?php if($active_package['type']=='trial'): ?>
	            			<span><?= !empty(lang('package_expired'))?lang('package_expired'):"Your package will expire after";?>  <?=  day_left(d_time(),$active_package['end_date'])['date'];?> <?= !empty(lang('days'))?lang('days'):"days";?></span>
	            			<?php endif;?> 
	            		</div>		
		            	
		          </div>
		        </div>
			</div>
		</div>
	<?php endif;?>

	<?php foreach ($all_packages as $key => $row): ?>
		<?php if(isset($row['features']) && count($row['features']) > 0): ?>
			<div class="col-md-4 col-lg-3">
				<div class="pricing_3">
					<div class="card">
			          <div class="card-body">
			            <div class="card_top">
			            	<h5 class="card-title text-muted text-uppercase text-center"><?= html_escape($row['type_name']);?></h5>
				             <?php if($row['type']=='free'): ?>
				             	<h6 class="card-price text-center"><?= !empty(lang('free'))?lang('free'):'Free';?></h6>
				            <?php elseif($row['type']=='trial'): ?>
				            	<h6 class="card-price text-center"><?= !empty(lang('free'))?lang('free'):'Free';?><span class="period">/<?= !empty(lang('month'))?lang('month'):'month';?></span></h6>
				               
				            <?php else: ?>
				            	<h6 class="card-price text-center"><?= get_currency('icon');?><?= html_escape($row['price']) ;?><span class="period">/<?= !empty(lang(strtolower(get_package_type($row['type']))))?lang(strtolower(get_package_type($row['type']))):get_package_type($row['type']);?></span></h6>
				            <?php endif;?>
				            <h5 class="text-center"><?= $row['type_limit']==0?(!empty(lang('unlimited'))?lang('unlimited'):"Unlimited"):(!empty(lang('only'))?lang('only'):"Only")." ".html_escape($row['type_limit']);?></h5>
				            
				            <h5 class="text-center"><?= lang('vcard_limit') ;?> : <?= type_limit($row['card_limit']) ;?></h5>
				            <h5 class="text-center"><?= !empty(lang('vcard_information_limit'))?lang('vcard_information_limit'):'vCard Information Limit' ;?> : <?= type_limit($row['vcard_limit']) ;?></h5>
			            </div>
			            <hr>
			            	<div class="list_ul">
			            		<ul class="fa-ul">
					            	<?php foreach ($all_features as $key2 => $feature): ?>
					                  	<?php $feature_id = get_price_feature_id($feature['id'],$row['id']); ?>
					                  	<?php if(isset($feature_id['feature_id']) && $feature_id['feature_id']==$feature['id']): ?>
					            		 	<li><span class="list_li"><i class="fas fa-check c_green"></i></span> <?= html_escape($feature['features']);?></li>
					            		<?php else: ?>
					            		 	<li class="text-muted"><span class="list_li"><i class="fas fa-times c_red"></i></span> <?= html_escape($feature['features']);?></li>
					            		<?php endif;?>
					            	<?php endforeach; ?>
					            </ul>
			            	</div>
			            	<?php if($my_info['account_type'] == $row['id']): ?>

			            		<?php if($my_info['is_expired']==0): ?>

				            		<?php if($my_info['is_payment']==0){ ?>
				            			<div class="active_package_btn">
					            			<a href="<?= base_url('payment-method/'.$my_info['username'].'/'.$row['slug']);?>" class="btn-info"><i class="fas fa-spinner"></i> &nbsp; <?= !empty(lang('pay_now'))?lang('pay_now'):"Pay Now" ;?> </a>
					            			<span>* Your package is not active due to payment. (Pending..)</span>
					            		</div>
				            		<?php }else{ ?>
				            			<div class="active_package_btn">
					            			<a href="javascript:;" class="bg_success"><i class="fas fa-check"></i> &nbsp; <?= !empty(lang('runing_package'))?lang('runing_package'):"Runing Package" ;?></a>
					            			<span><?= !empty(lang('package_expired'))?lang('package_expired'):"Your package will expire after";?> <?=  day_left(d_time(),$my_info['end_date'])['date'];?> <?= !empty(lang('days'))?lang('days'):"days";?></span>
					            		</div>
				            		<?php }; ?>

				            	<?php else: ?><!-- is_expired -->
				            		<div class="active_package_btn">
				            			<a href="<?= base_url('payment-method/'.$my_info['username'].'/'.$row['slug']);?>" class="btn-danger"><i class="fas fa-repeat"></i> &nbsp; <?= !empty(lang('re_active'))?lang('re_active'):"Re-active";?> </a>
				            			<span>* <?= !empty(lang('reactive_msg'))?lang('reactive_msg'):"Your package is expired. you can re-active it again";?> </span>
				            		</div>
				            	<?php endif;?><!-- is_expired -->

			            	<?php else: ?><!-- account_type -->
			            			<div class="active_package_btn">
				            			<a href="<?= base_url('payment-method/'.$my_info['username'].'/'.$row['slug']);?>" class="btn-primary"><i class="fa fa-exchange"></i> &nbsp; <?= !empty(lang('select_package'))?lang('select_package'):"Select Package";?> </a>
				            			<span class="">.</span>
				            		</div>
			            	<?php endif;?><!-- account_type -->
			          </div>
			        </div>
				</div>
			</div>
		<?php endif;?>
	<?php endforeach; ?>
</div>
