<div class="row">
	<div class="col-md-12 col-sm-12 col-xs-12 col-lg-8">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title"><?= !empty(lang('add_package'))?lang('add_package'):"Add Package";?> </h3>
				<div class="box-tools pull-right">
					<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
					<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button>
				</div>
			</div>
			<!-- /.box-header -->
			<form action="<?= base_url('admin/dashboard/add_features_type') ?>" method="post" class="skill_form" enctype= "multipart/form-data">
				<div class="box-body">


					<!-- csrf token -->
					<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">
					<div class="row">
						<div class="col-md-6">
							<div class="form-group col-md-12">
						      	<label for="type_name"><?= !empty(lang('package_name'))?lang('package_name'):"package name";?></label>
						        <input type="text" name="type_name" id="package_name" class="form-control" placeholder="<?= !empty(lang('package_name'))?lang('package_name'):"Package Name";?>" value="<?= !empty($type_data['type_name'])?html_escape($type_data['type_name']):set_value('type_name'); ?>" required>
						    </div>

						    <div class="form-group col-md-12">
						      	<label for="type_name"><?= !empty(lang('slug'))?lang('slug'):"slug";?></label>
						        <input type="text" name="slug" id="slug" class="form-control remove_space" placeholder="<?= !empty(lang('slug'))?lang('slug'):"Slug";?>" value="<?= !empty($type_data['slug'])?html_escape($type_data['slug']):set_value('slug'); ?>" required>
						        <p><b class="text-danger"><?= lang('in_english'); ?></b></p>
						    </div>
						    <div class="form-group col-md-12">
						      	<label><?= !empty(lang('package_type'))?lang('package_type'):"Package type";?> </label>
						        <select name="type" class="form-control account_duration" id="">
						        	<option value="">Select</option>

						        	<option value="trial" <?= isset($type_data['type']) && html_escape($type_data['type'])=='trial'?'selected':'';?>><?= !empty(lang('trial'))?lang('trial'):"Trial for 1 Month";?></option>
						        	

						        	<option value="free" <?= isset($type_data['type']) && html_escape($type_data['type'])=='free'?'selected':'';?>><?= !empty(lang('free'))?lang('free'):"Free";?></option>

						        	<option value="monthly" <?= isset($type_data['type']) && html_escape($type_data['type'])=='monthly'?'selected':'';?>><?= !empty(lang('monthly'))?lang('monthly'):"Monthly";?></option>

						        	<option value="yearly" <?= isset($type_data['type']) && html_escape($type_data['type'])=='yearly'?'selected':'';?>><?= !empty(lang('yearly'))?lang('yearly'):"Yearly";?></option>
						        </select>
						        <div class="trial_text pt-5" style="display: none;">
						        	<h4>* Account will set Free for 1 month.</h4>
						        </div>
						    </div>

						    <div class="form-group col-md-12 feature_price" style="display:<?= isset($type_data['type']) && $type_data['type'] =='free' || isset($type_data['type']) && $type_data['type'] =='trial'?"none":"block"?>">
						      	<label for="price"><?= !empty(lang('price'))?lang('price'):"Price";?></label>
						        <input type="text" name="price" id="price" class="form-control" placeholder="<?= !empty(lang('price'))?lang('price'):"Price";?>" value="<?= !empty($type_data['price'])?html_escape($type_data['price']):set_value('price'); ?>">
						        <span class="error"><?= form_error('price'); ?></span>
						    </div> 

						    <div class="form-group col-md-6 ">
						      	<label ><?= !empty(lang('feature_limit'))?lang('feature_limit'):"Feature Limit";?></label>
						      	<input type="number" min="0" name="type_limit" class="form-control" value="<?= isset($type_data['type_limit'])?html_escape($type_data['type_limit']):0; ?>" required>
						    </div>

						     <div class="form-group col-md-6 ">
						      	<label ><?= !empty(lang('vcard_information_limit'))?lang('vcard_information_limit'):"vCard Information Limit";?></label>
						      	<input type="number" min="0" name="vcard_limit" class="form-control" value="<?= isset($type_data['vcard_limit'])?html_escape($type_data['vcard_limit']):0; ?>" required>
						    </div> 

						    <div class="form-group col-md-6 ">
						      	<label ><?= !empty(lang('vcard_limit'))?lang('vcard_limit'):"vCard Limit";?></label>
						      	<input type="number" min="0" name="card_limit" class="form-control" value="<?= isset($type_data['card_limit'])?html_escape($type_data['card_limit']):1; ?>" required>
						    </div>   
						  <div class="col-md-12">
						  	<div class="form-group">
						  		<small class="text-danger">* <b><?= lang('0_define_as_unlimited'); ?></b> </small>
						  	</div>
						  </div>
						</div> <!-- col-md-6 -->


						<div class="col-md-6">
							<div class="form-group col-md-12">
						      	<label for="price"><?= !empty(lang('features'))?lang('features'):"Features";?></label>
						        <div class="features">
						        	<?php $filter = ['social-site','about','services','resume','review','skills','portfolio','blog','appointment','contacts','teams','facts'] ?>
						        	
						        	<?php $i=1; foreach($features as $row): ?>
							        	<?php if($row['slug']=='home'): ?>
							        		<?php if(isset($type_data['id'])): ?>
							        			<?php $feature_id = get_price_feature_id($row['id'],$type_data['id']); ?>
							        		<?php endif; ?>	
							        		<label class="custom-checkbox"><input type="checkbox" class="is_profile" <?= isset($feature_id['feature_id']) && $feature_id['feature_id']==$row['id']?$checked = "checked":$checked = '' ;?>  name="feature_id[]" value="<?= $row['id']?>"> &nbsp; &nbsp; <?= html_escape($row['features']); ?> </label>
							        	<?php endif;?>
						        	<?php $i++;  endforeach ?>


						        	<div class="profile_features " style="display: <?= isset($checked) && $checked=="checked"?"":"none" ;?>;">
						        		<?php $i=1; foreach($features as $row): ?>
						        		<?php if(in_array($row['slug'],$filter)): ?>

						        			<?php if(isset($type_data['id'])): ?>
						        				<?php $feature_id = get_price_feature_id($row['id'],$type_data['id']); ?>
						        			<?php endif; ?>	
						        			<label class="custom-checkbox"><input type="checkbox" class="" <?= isset($feature_id['feature_id']) && $feature_id['feature_id']==$row['id']?"checked":'' ;?>  name="feature_id[]" value="<?= $row['id']?>"> &nbsp; &nbsp; <?= html_escape($row['features']); ?> </label>
						        		<?php endif;?>
						        		<?php $i++;  endforeach ?>
						        	</div>


						        	<?php $i=1; foreach($features as $row): ?>
							        	<?php if($row['slug']=='qr_code' || $row['slug']=='vcard' || $row['slug']=='pwa'): ?>
							        			<?php if(isset($type_data['id'])): ?>
							        				<?php $feature_id = get_price_feature_id($row['id'],$type_data['id']); ?>
							        			<?php endif; ?>	
							        			<label class="custom-checkbox"><input type="checkbox" class="" <?= isset($feature_id['feature_id']) && $feature_id['feature_id']==$row['id']?"checked":'' ;?>  name="feature_id[]" value="<?= $row['id']?>"> &nbsp; &nbsp; <?= html_escape($row['features']); ?> </label>
							        	<?php endif;?>

						        	<?php $i++;  endforeach ?>
								        
						        	
						        </div>
						    </div>
						</div>

					</div>


				    <input type="hidden" name="id" value="<?= isset($type_data['id']) && $type_data['id'] !=0?$type_data['id']:0 ?>">
				    <input type="hidden" name="is_trial" value="<?= isset($type_data['package_type']) && $type_data['package_type']=='trial'?1:0;?>">
				</div><!-- /.box-body -->
				<div class="box-footer">
					<div class="pull-left">
		          		<a href="<?= base_url('admin/dashboard/packages'); ?>" class="btn btn-default btn-block btn-flat"><?= !empty(lang('cancel'))?lang('cancel'):"cancel";?></a>
		          	</div>
		          	<div class="pull-right">
		          		<button type="submit" name="register" class="btn btn-primary btn-block btn-lg btn-flat"><?= !empty(lang('submit'))?lang('submit'):"submit";?></button>
		          	</div>
				</div>
			</form>
		</div>
		
	</div>
</div>