<?php

if(!isset($_GET['typ'])){
?>
<script>
window.location="starter.php";
</script>
<?php
}
if( ($_GET['typ'] !='0' && $_GET['typ']!='1') || $_GET['typ'] ==''){

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>

<?php
$typo = $_GET['typ'];
$permission  = explode(',',$_SESSION['permission_id']);
if( $_GET['typ'] =='0' ){ // plural
	if(!in_array(12,$permission) && !in_array(1,$permission)  ){

?>
	<script>
	window.location="starter.php";
	</script>
<?php
	}
}elseif($_GET['typ'] =='1'  ){
	if(!in_array(27,$permission) && !in_array(1,$permission)  ){
?>
	<script>
	window.location="starter.php";
	</script>
<?php
	}
}else{
?>
	<script>
	window.location="starter.php";
	</script>
<?php
}
?>

<style >
	tfoot {
    display: table-header-group !important;
}

.tokenfield.form-control {
    height: 0px !important;
    padding: 0;
}

</style>

<div id="add-form-cont" class="panel-collapse collapse panel" aria-expanded="false" style="height: 0px; position: relative; top:-3px; width:98%; margin:0px auto;">
	<div class="panel-body">
		<form class="form-horizontal" method="post" id="add_form" enctype="multipart/form-data">
			<div>
			<input type="hidden" id="access_token" name="access_token"  value="">

				<div class="col-sm-12">

					<div class="form-group">
						

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
							<label class="control-label multi_lang">اسم الزبون الكامل</label>
							<input type="text" placeholder="اسم الزبون الكامل" class="form-control multi_lang" name="customer_full_name" id="customer_full_name" required="required">
							<div class="form-control-feedback">
								<i class="icon-profile text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
							<label class="control-label multi_lang">البريد الالكتروني</label>
							<input type="text" placeholder="البريد الالكتروني" class="form-control multi_lang" name="customer_email" id="customer_email" >
							<div class="form-control-feedback">
								<i class="icon-mail5 text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-3">
							<label class="control-label multi_lang">رقم الهاتف</label>
							<input type="text" class="form-control multi_lang" name="customer_phone" id="customer_phone" required="required" placeholder="رقم الهاتف">
							
							<div class="form-control-feedback">
								<i class="icon-phone2 text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-3">
							<label class="control-label multi_lang">الهاتف الثاني</label>
							<input type="text" class="form-control multi_lang" name="customer_phone2" id="customer_phone2"  placeholder="الهاتف الثاني">
							
							<div class="form-control-feedback">
								<i class="icon-phone text-muted"></i>
							</div>
						</div>


						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
							<label class="control-label multi_lang">العنوان</label>
							<input type="text" placeholder="العنوان" class="form-control multi_lang" name="customer_address" id="customer_address" >
							<div class="form-control-feedback">
								<i class="icon-location4 text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
							<label class="control-label multi_lang">المهنة</label>
							<input type="text" placeholder="المهنة" class="form-control multi_lang" name="customer_job_title" id="customer_job_title" >
							<div class="form-control-feedback">
								<i class="icon-briefcase text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
							<label class="control-label multi_lang">نوع الزبون</label>
							<select class="form-control multi_lang"  name="customer_type" id="customer_type" data-width="100%" placeholder="نوع الزبون" required="required">

								
								<option class="multi_lang" value="">النوع</option>
								<option class="multi_lang" value="0">عميل دائم</option>
								<option class="multi_lang" value="1">زبون مفرد</option>
								
							</select>
							<div class="form-control-feedback">
								<i class="icon-users text-muted"></i>
							</div>
						</div>

						
						


					</div>

				</div>
			</div>

			<div class="text-right">
				<button type="submit" id="submit_add_btn" class="btn btn-primary btn-labeled btn-labeled-left">
					<span class="multi_lang">حفظ</span> <b><i class="icon-floppy-disk"></i></b>
				</button>
				<a href="#add-form-cont" id="add_form_cancel" class="btn btn-labeled btn-labeled-left bg-danger heading-btn" data-toggle="collapse">
					<span class="multi_lang">اغلاق</span>  <b><i class="icon-cross"></i></b>
				</a>
			</div>
		</form>
	</div>
</div>

<div id="edit_form_cont" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="edit_form" method="post" id="edit_form" enctype="multipart/form-data">
			<input type="hidden" id="access_token" name="access_token"  value="">

			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><i class="icon-cross"></i></button>
					<h4 class="modal-title multi_lang">تحرير معلومات الزبون</h4>
				</div>

				<div class="modal-body">
						<input type="hidden" name="itemid" id="edit_objid" value="">
						<div>


							<div class="col-sm-12">
								<div class="form-group">
									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
										<label class="control-label multi_lang">اسم الزبون الكامل</label>
										<input type="text" placeholder="اسم الزبون الكامل" class="form-control multi_lang" name="edit_customer_full_name" id="edit_customer_full_name" required="required">
										<div class="form-control-feedback">
											<i class="icon-profile text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
										<label class="control-label multi_lang">البريد الالكتروني</label>
										<input type="text" placeholder="البريد الالكتروني" class="form-control multi_lang" name="edit_customer_email" id="edit_customer_email" >
										<div class="form-control-feedback">
											<i class="icon-mail5 text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-3">
										<label class="control-label multi_lang">الهاتف</label>
										<input type="text" placeholder="الهاتف" class="form-control multi_lang" name="edit_customer_phone" id="edit_customer_phone" required="required">
										<div class="form-control-feedback">
											<i class="icon-phone2 text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-3">
										<label class="control-label multi_lang">الهاتف الثاني</label>
										<input type="text" class="form-control multi_lang" name="edit_customer_phone2" id="edit_customer_phone2"  placeholder="الهاتف الثاني">
										
										<div class="form-control-feedback">
											<i class="icon-phone text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
										<label class="control-label multi_lang">العنوان</label>
										<input type="text" placeholder="العنوان" class="form-control multi_lang" name="edit_customer_address" id="edit_customer_address" >
										<div class="form-control-feedback">
											<i class="icon-location4 text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
										<label class="control-label multi_lang">المهنة</label>
										<input type="text" placeholder="المهنة" class="form-control multi_lang" name="edit_customer_job_title" id="edit_customer_job_title" >
										<div class="form-control-feedback">
											<i class="icon-briefcase text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
										<label class="control-label multi_lang">نوع الزبون</label>
										<select class="form-control multi_lang"  name="edit_customer_type" id="edit_customer_type" data-width="100%" placeholder="نوع الزبون" required="required">
											<option class="multi_lang" value="">النوع</option>
											<option class="multi_lang" value="0">عميل دائم</option>
											<option class="multi_lang" value="1">زبون مفرد</option>
											
										</select>
										<div class="form-control-feedback">
											<i class="icon-users text-muted"></i>
										</div>
									</div>

								</div>
							</div>
						</div>
				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-primary"> <span class="multi_lang">حفظ</span> <b><i class="icon-floppy-disk"></i></b>
					</button>
					<button type="button" class="btn btn-warning" data-dismiss="modal"><span class="multi_lang"> الغاء</span>
					</button>
				</div>
			</div>
		</form>
	</div>
</div>


				<!-- Individual column searching (text inputs) -->
				<div class="panel panel-flat">
					
					<table class="table datatable-column-search-inputs">
						<thead>
							<tr>
				                <th>ID</th>
				                <th class="multi_lang">اسم الزبون</th>
				                <th class="multi_lang">البريد الالكتروني</th>
				                <th class="multi_lang">الهاتف</th>
				                <th class="multi_lang">العنوان</th>
				                <th class="multi_lang">المهنة</th>
				                <th class="multi_lang">نوع الزبون</th>
				                <th class="multi_lang">تاريخ الانشاء</th>
				                <th  class="text-center multi_lang">العمليات</th>
				            </tr>
						</thead>
						<tbody>
							
						</tbody>
						<tfoot>
							<tr>
				                <td>Name</td>
				                <td>Position</td>
				                <td>Start date</td>
				                <td>Salary</td>
				                <td>Salary</td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				            </tr>
						</tfoot>
					</table>
				</div>
				<!-- /individual column searching (text inputs) -->



<script type="text/javascript" src="controllers/customer.js?random=<?php echo uniqid(); ?>"></script>