<div class="row">
	<?php 
		function hex2rgb($color)
		{
		    list($r, $g, $b) = array($color[0].$color[1],
		                             $color[2].$color[3],
		                             $color[4].$color[5]);
		    $r = hexdec($r); $g = hexdec($g); $b = hexdec($b);
		    return $r.','.$g.','.$b;
		}

	 ?>

	<style>
		.rightSideIcon ul li a, .addFieldHeading h4 {
			color:  #<?= users(auth('username'))['vcard_icon_color'] ?>;
		}
		.rightSideIcon ul li a:hover{
			background: rgba(<?= hex2rgb(users(auth('username'))['vcard_icon_color']) ;?>,.1);
		}
		.mr-2{
			margin-right: 2px !important;
		}
		
		i.fa.fa-close{
			color: red;
		}
		.vcardLayout.top.setting_img.theme_layout{
			height: 120px;
		}
	</style>

	<?php if($active_vcard==1): ?>
		<div class="col-md-6">
			<div class="box box-primary">
				<div class="box-header with-border">
					<h3 class="box-title"><?= !empty(lang('add_information'))?lang('add_information'):"Add Information";?></h3>
				</div>
				<form action="<?= base_url('admin/vcard/add_vcard_icon') ;?>" method="post" class="vcard-form-submit">

					<!-- csrf token -->
						<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">
				<!-- /.box-header -->
					<div class="box-body" >
						<div class="iconBody" id="sortable">
							<div class="input_fields_wrap">
								<?php foreach ($sites as $key => $row): ?>
									<div class="form-group">
										<div class="addField">
											<div class="addFieldHeading">
												<div class="d handle">
													<i class="fa fa-reorder"></i>
													<h4><span class="mr-2"><?= $row['icon'] ;?></span> <?= $row['name'] ;?></h4>
												</div>
												<a href="<?= base_url('delete-item/'.html_escape($row['vsite_id']).'/vcard_social_sites'); ?>" class="action_btn" data-msg="<?= !empty(lang('want_to_delete'))?lang('want_to_delete'):'Want to delete?' ;?>"><i class="fa fa-close"></i></a>
											</div>
											<div class="addFieldDetails">
												<input type="text" name="label[<?= $row['site_id'] ;?>]" class="form-control" value="<?= $row['label'] ;?>">
												<input type="text" name="value[<?= $row['site_id'] ;?>]" class="form-control" value="<?= $row['value'] ;?>">
												<input type="hidden" name="site_id[]" value="<?= $row['site_id'] ;?>">
											</div>
										</div>
									</div>
								<?php endforeach ?>
							</div>

						</div>
					</div><!-- /.box-body -->
					<div class="box-footer text-right">
						<button type="submit" class="btn btn-success c_btn submit_btn"><i class="fa fa-floppy-o"></i>  &nbsp;<?= !empty(lang('save'))?lang('save'):"save" ;?></button>
					</div>
				</form>
			</div>
		</div>
	<?php else: ?>
		<div class="col-md-6">
			<div class="box box-primary">
				<div class="box-header with-border">
					<h3 class="box-title"><?= !empty(lang('add_information'))?lang('add_information'):"Add Information";?></h3>
				</div>
				<form action="<?= base_url('admin/profile/add_vcard_info') ;?>" method="post">

					<!-- csrf token -->
					<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">
					<!-- /.box-header -->
					<div class="box-body" >
						<div class="iconBody">
							<div class="form-group">
								<div class="addField">
									<div class="addFieldHeading">
										<div class="d handle">
											<i class="fa fa-reorder"></i>
											<h4><span class="mr-2"><i class="fa fa-phone"></i> </span><?= lang('phone'); ?></h4>
										</div>
									</div>
									<div class="addFieldDetails">
										<input type="text" name="phone" class="form-control" value="<?= $u_info->phone ;?>">
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="addField">
									<div class="addFieldHeading">
										<div class="d handle">
											<i class="fa fa-reorder"></i>
											<h4><span class="mr-2"><i class="fa fa-whatsapp"></i></span> <?= lang('whatsapp_number'); ?></h4>
										</div>
									</div>
									<div class="addFieldDetails">
										<input type="text" name="whatsapp" class="form-control" value="<?= $u_info->whatsapp ;?>">
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="addField">
									<div class="addFieldHeading">
										<div class="d handle">
											<i class="fa fa-reorder"></i>
											<h4><span class="mr-2"><i class="fa fa-globe"></i></span> <?= lang('website'); ?></h4>
										</div>
									</div>
									<div class="addFieldDetails">
										<input type="text" name="website" class="form-control" value="<?= $u_info->website ;?>">
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="addField">
									<div class="addFieldHeading">
										<div class="d handle">
											<i class="fa fa-reorder"></i>
											<h4><span class="mr-2"><i class="fa fa-envelope-o"></i></span> <?= lang('email'); ?></h4>
										</div>
									</div>
									<div class="addFieldDetails">
										<input type="text" name="email" class="form-control" value="<?= $u_info->email ;?>">
									</div>
								</div>
							</div>

						</div>
					</div><!-- /.box-body -->
					<div class="box-footer text-right">
						<button type="submit" class="btn btn-success c_btn submit_btn"><i class="fa fa-floppy-o"></i> <?= !empty(lang('save'))?lang('save'):"save" ;?></button>
					</div>
				</form>
			</div>
		</div>
	<?php endif; ?>
		<div class="col-md-6">
	<?php if($active_vcard==1): ?>
			<div class="box box-primary">
				<div class="box-header with-border">
					<h3 class="box-title"><?= !empty(lang('add_information'))?lang('add_information'):"Add Information";?></h3>
				</div>
				<!-- /.box-header -->
				<div class="box-body" >
					<div class="rightSideIcon">
						<ul>
							<?php foreach ($social_sites as $key => $value): ?>
								<li><a href="javascript:;" class="add_icon_btn" data-id="<?=  $value['id'];?>" data-field-type="text" data-type="<?= !empty($value['type'])?$value['type']:"others" ;?>" data-placeholder="<?= $value['name'];?>" data-icon='<?= $value['icon'];?>'>
									<?= $value['icon'];?>
									<span><?= $value['name'];?></span>
								</a></li>
							<?php endforeach ?>

						</ul>
					</div>
				</div><!-- /.box-body -->
				
			</div>
		<?php endif; ?>
			<div class="row">
				<div class="col-md-12">
					<div class="box box-primary">
						<div class="box-header with-border">
							<h3 class="box-title"><?= !empty(lang('vcard_cover_photo'))?lang('vcard_cover_photo'):"vCard Cover Photo";?></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/profile/add_card_cover') ?>" method="post" class="" 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="form-group col-md-12">
								        <div class="logo coverImg p-r">
											<img src="<?= !empty($u_info->cover_photo)?base_url($u_info->cover_photo):''; ?>" class="preview_load_image" alt="" id="preview_load_image">
											<?php if(!empty($u_info->cover_photo)): ?>
												<a href="<?= base_url('admin/profile/delete_cover') ;?>" class="delete_cv" title="delete pdf"><i class="fa fa-trash"></i></a>
											<?php endif;?>
										</div>
										 <input type="file" name="file" id="load_image" class="load_image" data-height="0" data-width="0">
								    </div>
								   
								</div>


								<div class="row">
									<div class="form-group col-md-6">
										<label><?= !empty(lang('icon_color_picker'))?lang('icon_color_picker'):"Icon Color Picker" ;?>:</label>

										<div class="color_picker">
											<div class="input-group my-colorpicker2 colorpicker-element">
												<input type="text" class="form-control" name="vcard_icon_color" value="<?= $u_info->vcard_icon_color;?>">

												<div class="input-group-addon">
													<i style="background-color: rgb(0, 0, 0);"></i>
												</div>
											</div>	
										</div>
									</div>

									<div class="form-group col-md-6">
										<label><?= !empty(lang('background_color_picker'))?lang('background_color_picker'):"Background Color Picker" ;?>:</label>

										<div class="color_picker">
											<div class="input-group my-colorpicker2 colorpicker-element">
												<input type="text" class="form-control" name="vcard_bg_color" value="<?= $u_info->vcard_bg_color;?>">

												<div class="input-group-addon">
													<i style="background-color: rgb(0, 0, 0);"></i>
												</div>
											</div>	
										</div>
									</div>
								</div>
								<div class="row <?=  isset($u_info->active_vcard) && $u_info->active_vcard==1?"hidden":"";?>">
									<div class="form-group col-md-12">
										<label><?= !empty(lang('active_drag_drop_vcard'))?lang('active_drag_drop_vcard'):"Active Drag & Drop vCard" ;?>:</label>
										<p class="text-danger"><?= lang('vcard_enable_msg'); ?></p>
										<div class="form-group">
											<select name="active_vcard" id="active_vcard" class="form-control">
												<option value="0" <?=  isset($u_info->active_vcard) && $u_info->active_vcard==0?"selected":"";?>><?= lang('disabled'); ?></option>
												<option value="1" <?=  isset($u_info->active_vcard) && $u_info->active_vcard==1?"selected":"";?>><?= lang('enable'); ?></option>
											</select>
										</div>
									</div>
								</div>
							</div><!-- /.box-body -->
							<div class="box-footer">
					          	<div class="pull-right">
					          		<input type="hidden" name="id" value="<?= isset($u_info->id) && $u_info->id !=0?$u_info->id:0 ?>">
					          		<button type="submit" name="register" class="btn btn-primary btn-block btn-flat c_btn "><?= !empty(lang('submit'))?lang('submit'):"submit";?></button>
					          	</div>
							</div>
						</form>
					</div>
				</div>
				<?php if(get_user_pricing_by_id(auth('id'),'vcard')==1 && is_active(auth('id'),'vcard') ==1): ?>
					<div class="col-md-12" >
						<div class="vcardlayoutArea" style="background:#fff; padding:5px 10px 10px;">
							<h4><?= !empty(lang('vcard_themes'))?lang('vcard_themes'):"Vcard themes" ;?></h4>
							<div class="row" >
								<?php for($i=1; $i<=8; $i++): ?>
								<div class="col-sm-3">
									<label class="layout_label">
										<div class="themes_select">
											<div class="setting_img top theme_layout vcardLayout">
												<img src="<?= base_url('assets/images/vcard/style_'.$i.'.png'); ?>" alt="">
												<label class="custom_radio">
													<input type="radio" name="" class="layout_action vcard_layouts <?= html_escape(check_layouts('vcard_layouts',$i))==1?'active':'';?> none" data-type="vcard_layouts" value="<?=  $i;?>" <?=  html_escape(check_layouts('vcard_layouts',$i))==1?'checked':'';?>>
													<span class="checkmark"></span>
												</label>
											</div>
											<p><?= !empty(lang('style'))?lang('style'):"style" ;?> <?=  $i;?></p>
										</div>
									</label>
								</div>
								<?php endfor; ?>
								
								
								
								<?php $limit = single_select_by_id($u_info->account_type,'features_type') ?>
								<a href="javascript:;" class="vcard_limit" data-limit="<?= $limit['vcard_limit'] ;?>"></a>
								<a href="javascript:;" class="limit_text" data-msg="<?= !empty(lang('field_limit_exists'))?lang('field_limit_exists'):"Limit exceed, please upgrade your membership" ;?>"></a>
							</div>	
						</div>
					</div>
				<?php endif;?>
			</div><!-- row -->
		</div><!-- col-6 -->
	

</div>

