<div class="row">
	<?php if(isset($is_add) && $is_add==true): ?>
	<div class="col-md-8">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title"><?= !empty(lang('services'))?lang('services'):"services";?> </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_services') ?>" 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="form-group col-md-12">
					      	<label for="title"><?= !empty(lang('title'))?lang('title'):"title";?> <span class="error">*</span></label>
					        <input type="text" name="title" id="title" class="form-control" required="" placeholder="<?= !empty(lang('title'))?lang('title'):"Title";?> / <?= !empty(lang('service_name'))?lang('service_name'):"service names";?>" value="<?= !empty($data['title'])?html_escape($data['title']):set_value('title'); ?>">
					        <span class="error"><?= form_error('title'); ?></span>
					    </div>
					    <div class="col-md-12">
							<label><?= !empty(lang('overview'))?lang('overview'):"overview";?> <?= !empty(lang('max_120'))?lang('max_120'):"Max 120";?> <span class="error">*</span></label>
							<textarea name="overview" id="" cols="5" rows="5" class="form-control" required><?= !empty($data['overview'])?html_escape($data['overview']):set_value('overview'); ?></textarea>
							<span class="error"><?= form_error('overview'); ?></span>
						</div>

						<div class="col-md-12 mt-15 mb-15">
							<label><?= !empty(lang('details'))?lang('details'):"details";?> <span class="error">*</span></label>
							<textarea name="details" id="" cols="5" rows="5" class="form-control tinymce"><?= !empty($data['details'])?html_escape($data['details']):set_value('details'); ?></textarea>
							<span class="error"><?= form_error('details'); ?></span>
						</div>
					</div>
					<div class="row">
						<div class="form-group col-md-12">
							<label for="title"><?= !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($data['price'])?html_escape($data['price']):set_value('price'); ?>">
							<span class="error"><?= form_error('price'); ?></span>
						</div>
					</div>
					<div class="row mt-15">
						<div class="form-group col-md-12">
							<div class="serviceImg" style="display:<?= isset($data['images']) && !empty($data['images'])?'block':'none'; ?>;">
								<img src="<?= !empty($data['images'])?base_url($data['images']):''; ?>" class="service_icon_preview" alt="">
							</div>

							<ul class="nav nav-tabs">
							  <li class="tab_li <?=!empty($data)?"":"active" ;?> <?= isset($data['service_type']) && $data['service_type']==1?'active':''; ?>" data-value="icon"><a data-toggle="tab" href="#icon"><?= !empty(lang('icon'))?lang('icon'):"icon";?></a></li>
							  <li class="tab_li <?= isset($data['service_type']) && $data['service_type']==2?'active':''; ?>" data-value="image"><a data-toggle="tab" href="#image"><?= !empty(lang('image'))?lang('image'):"image";?></a></li>

							  <li class="tab_li <?= isset($data['service_type']) && $data['service_type']==3?'active':''; ?>" data-value="video"><a data-toggle="tab" href="#videos"><?= !empty(lang('video'))?lang('video'):"video";?></a></li>
							</ul>

							<div class="tab-content">
							  <div id="icon" class="tab-pane <?=!empty($data)?"":"fade in active" ;?> <?= isset($data['service_type']) && $data['service_type']==1?'fade in active':''; ?> mt-15">
							 		<h4 class="iconText"><?= lang('select_icon'); ?></h4>
							  	<div class="iconPickerdiv">
							  		<button class="input-group iconGroup w_100 btn btn-default" data-icon="<?= get_icon(!empty($data['icon'])?$data['icon']:'');?>" role="iconpicker">
							  	</button>

							  	</div>
							  	
							  	<input type="hidden" name="icon" id="icon" class="form-control icon" placeholder="<i class='fa fa-icon'></i>" value='<?= !empty($data['icon'])?$data['icon']:
							  	''; ?>'>
							  </div>


							  <div id="image" class="tab-pane fade <?= isset($data['service_type']) && $data['service_type']==2?'fade in active':''; ?> mt-15">
							    <input type="file" name="images" class="service_img" data-height="0" data-width="0">
							    <span class="img_error"></span>
							  </div>

							   <div id="videos" class="tab-pane fade <?= isset($data['service_type']) && $data['service_type']==3?'fade in active':''; ?> mt-15">
							   	<textarea name="video_link" id="videos" cols="5" rows="5" class="form-control" placeholder=" <iframe src='<?= !empty(lang('add_video_link'))?lang('add_video_link'):"add video link";?>' frameborder='0'></iframe>"><?= !empty( $data['video_link'])?$data['video_link']:"" ;?></textarea>
							  
							  </div>


							</div><!-- tab-content -->
						</div>
					</div>
				    <input type="hidden" name="id" value="<?= isset($data['id']) && $data['id'] !=0?html_escape($data['id']):0 ?>">
				</div><!-- /.box-body -->
				<div class="box-footer">	
						<div class="pull-left">
			          		<a href="<?= base_url('admin/profile/services'); ?>" class="btn btn-default btn-block btn-flat"><?= !empty(lang('cancel'))?lang('cancel'):"cancel";?></a>
			          	</div>
		          	<div class="pull-right">
		          		<input type="hidden" name="service_type" class="service_type" value="<?= isset($data['service_type'])?$data['service_type']:1 ;?>">
		          		<button type="submit" name="register" class="btn btn-primary btn-block btn-flat"><?= !empty(lang('submit'))?lang('submit'):"submit";?></button>
		          	</div>
				</div>
			</form>
		</div>
	</div>
<?php else: ?>
	<div class="col-md-12">
		<div class="box box-info">
			<div class="box-header with-border">
				<h3 class="box-title"><?= !empty(lang('services'))?lang('services'):"services";?> <a href="<?= base_url('admin/profile/add_new_services'); ?>" class="btn btn-flat btn-primary ml-10"><i class="fa fa-plus"></i> &nbsp;<?= lang('add_new'); ?></a>  <a href="<?= base_url('admin/profile/order_list'); ?>" class="btn btn-primary ml-10"> <i class="fa fa-list"></i>&nbsp; &nbsp;<?= !empty(lang('order_list'))?lang('order_list'):"Order List";?></a></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 -->
			<div class="box-body">
				<div class="upcoming_events">
					<div class="table-responsive">
						<table class="table table-bordered">
							<thead>
								<tr>
									<th ><?= !empty(lang('sl'))?lang('sl'):"sl";?></th>
									<th ><?= !empty(lang('title'))?lang('title'):"title";?></th>
									<th ><?= !empty(lang('username'))?lang('username'):"username";?></th>
									<th><?= !empty(lang('image'))?lang('image'):"image";?> / <?= !empty(lang('icon'))?lang('icon'):"icon";?></th>
									<th><?= !empty(lang('price'))?lang('price'):"price";?></th>
									<th><?= !empty(lang('status'))?lang('status'):"status";?></th>
									<th><?= !empty(lang('action'))?lang('action'):"action";?></th>
								</tr>
							</thead>
							<tbody>
								<?php $i=1; foreach ($services as $row): ?>
									<tr>
										<td><?= $i;?></td>
										<td><?= html_escape($row['title']); ?></td>
										<td><?= html_escape(get_user_info_by_id($row['user_id'])['username']); ?></td>
										<td>
											<?php if($row['service_type']==1): ?>
												<div class="serviceImgs"><?= $row['icon'] ?></div>
											<?php elseif($row['service_type']==2): ?>
												<div class="serviceImgs"><img src='<?= base_url($row['images']);?>' /></div>
											<?php elseif($row['service_type']==3): ?>
												<div class="service_video">
													<div class="videoWrapper">
														<?= $row['video_link'];?>
													</div>
												</div>
											<?php endif; ?>

											</td>
										<td><?= $row['price'] ;?></td>
										<td><a href="javascript:;" data-id="<?= html_escape($row['id']);?>" data-status="<?= html_escape($row['status']);?>" data-table="services" class="label <?= $row['status']==1?'label-success':'label-danger'?> change_status"> <i class="fa <?= $row['status']==1?'fa-check':'fa-close'?>"></i>&nbsp; <?= $row['status']==1?(!empty(lang('live'))?lang('live'):"Live"): (!empty(lang('hide'))?lang('hide'):"Hide");?></a></td>

										<td>

											<a href="<?= base_url('single-service/'.html_escape(auth('username')).'/'.md5($row['id'])); ?>" class="btn btn-primary btn-sm" target="blank"><i class="fa fa-eye"></i> <?= !empty(lang('details'))?lang('details'):"details";?></a>

											<a href="<?= base_url('admin/profile/edit_services/'.html_escape($row['id'])); ?>" class="btn btn-info btn-sm"><i class="fa fa-edit"></i> <?= !empty(lang('edit'))?lang('edit'):"edit";?></a>

										<a href="<?= base_url('delete-item/'.html_escape($row['id']).'/services'); ?>" class="btn btn-danger action_btn btn-sm" data-msg="<?= !empty(lang('want_to_delete'))?lang('want_to_delete'):'Want to delete?' ;?>"><i class="fa fa-trash"></i> <?= !empty(lang('delete'))?lang('delete'):"Delete";?></a>
									</td>
									</tr>
								<?php $i++; endforeach ?>
							</tbody>
						</table>
					</div>
				</div>	
			</div><!-- /.box-body -->
		</div>
	</div>
<?php endif; ?>
	
</div>
