	<?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($data['username'])['vcard_icon_color'] ?>;
		}
		.rightSideIcon ul li a:hover{
			background: rgba(<?= hex2rgb(users($data['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;
		}
		.profilePhoto img{
			border: 2px solid rgba(<?= hex2rgb(users($data['username'])['vcard_icon_color']) ;?>,.6);
		}
		.vcard-icon ul li a i{
			background: #<?= users($data['username'])['vcard_icon_color'] ?>;
		}
	</style>
<div class="card">
	<div class="card-body">
		<div class="profileMockup">
			<div class="img_progress ml-0 mt-0">
				<div class="upload_progress" style="display: none;">
					<div class="progress profile">
						<div class="progress-bar progress-bar-success progress-bar-striped myprogress" role="progressbar" style="width:0%">0%</div>
					</div>
				</div>
			</div>
			<div class="coverPhoto vcardCover p-r" style="background: url(<?= base_url(!empty($data['cover_photo'])?$data['cover_photo']:'') ;?>),#<?= users($data['username'])['vcard_bg_color'] ?>;">
				<form action="<?= base_url("admin/vcards/upload_profile_image/{$data['id']}/2"); ?>" class="profileImg_upload" method="post" enctype= "multipart/form-data"> 
					<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">
					<label class="uploadImg_icon">
						<i class="fa fa-camera"></i>
						<input type="file" name="file[]" style="display: none;" accept="image/*">
					</label>
				</form>
			</div>
			<div class="profilePhoto p-r">
				<img src="<?= base_url(!empty($data['thumb'])?$data['thumb']:"assets/images/avatar.png");?>" alt="" class="uploaded_img">
				<form action="<?= base_url("admin/vcards/upload_profile_image/{$data['id']}/1"); ?>" class="profileImg_upload" method="post" enctype= "multipart/form-data"> 
					<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">

					<label class="uploadImg_icon down">
						<i class="fa fa-camera"></i>
						<input type="file" name="file[]" style="display: none;" accept="image/*">
					</label>
				</form>
			</div>
		</div>
		<div class="vcard-body">
			<div class="vcard-user-info mb-20">
				<h4><?= $data['name'];?></h4>
				<p><?= $data['designation'];?></p>
			</div>
			<div class="vcard-icon">
				<ul>
					<?php foreach ($sites as $key => $row): ?>
						<li>
							<a href="<?= redirect_url($row['type'],$row['value'],$data['dial_code']) ;?>">
								<?= $row['icon'] ;?> 
								<div class="vdetails">
									<h4><?= $row['type']=="phone" || $row['type']=="whatsapp"?$data['dial_code']:'' ;?> <?= html_escape($row['value']); ;?></h4>
									<p><?= html_escape($row['label']); ;?></p>
								</div>
							</a>
						</li>
					<?php endforeach; ?>
				</ul>
			</div>
		</div>
		<?php if(isset($_GET['p']) && ($_GET['p']==4)): ?>
		<form action="<?= base_url("admin/vcards/add_vcard_color/{$data['id']}"); ?>" method="post" class="submitForm">
			<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">
			<div class="vcard-body-2">
				
				<div class="vcardlayoutAreas mt-10">
					<h4><?= lang('choose_layouts'); ?></h4>
					<div class="vcardlayoutArea" >
						<?php for($i=1; $i<=10; $i++): ?>
							<div class="vcardThemes_layout">
								<div class="vcardThemes">
									<label class="custom-radio">
										<img src="<?= base_url('assets/images/vcard_layouts/theme_'.$i.'.png'); ?>" alt="">
										<div>
											<input type="radio" value="<?=  $i;?>" name="vcard_layouts" <?=  $data['vcard_layouts']==$i?'checked':'';?>>
											<span class="checkmark"></span>
										</div>
									</label>
								</div>
							</div>
						<?php endfor; ?>
					</div>	
				</div>
				<div class="row">
					<div class="vcard-colors mt-20">
						<div class="col-md-12">
							<label style="margin-left: 15px;"><?= !empty(lang('vcard_menu_style'))?lang('vcard_menu_style'):"vCard Menu Style" ;?></label>
						</div>
						<?php for ($j = 1; $j <= 2 ; $j++) { ?>
							<div class="form-group col-md-6">
								<div class="vcardMenu_layouts">
									<label class="custom-radio">
										<img src="<?= base_url("assets/images/vcard/menu_{$j}.png");?>" alt="">
										<input type="radio" name="vcard_header_style" value="<?=  $j;?>" <?=  $data['vcard_header_style']==$j?'checked':'';?>>
									</label>
								</div>
							</div>
						<?php } ?>
					</div>
				</div>
				<div class="vcard-color mt-10">
					<div class="form-group col-md-6">
						<label><?= lang('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="<?= $data['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><?=lang('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="<?= $data['vcard_bg_color'];?>">

								<div class="input-group-addon">
									<i style="background-color: rgb(0, 0, 0);"></i>
								</div>
							</div>	
						</div>
					</div>
				</div>
			</div>
		<?php endif;?>
	</div>
	<?php if(isset($_GET['p']) && ($_GET['p']==4)): ?>
		<div class="card-footer d-flex space-between">
			<a href="<?= base_url("admin/vcards/?_user_token=".md5($data['id'])."&p=3"); ?>" class="btn btn-default"><i class="icofont-double-left"></i> <?= lang('previous'); ?></a>
			 <button type="submit" class="btn btn-secondary"><i class="fa fa-save"></i> &nbsp;<?= lang('save_and_preview'); ?></button>
		</div>
	<?php endif;?>
	</form>
</div>