<?php
$permission  = explode(',',$_SESSION['permission_id']);
if(!in_array(8,$permission) && !in_array(1,$permission) ){

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>
<style >
	tfoot {
    	display: table-header-group !important;
	}

	.dataTable {
        font-size: 12px;
	}

	td {
		padding: 5px 5px !important;
	}

	.thumb img:not(.media-preview) {
    height: 100px;
	}

	td.details-control {
    	
    	cursor: pointer;
	}

	div.tokenfield  {
		border-bottom-color: #ddd !important;
		border-bottom-width: 1px !important;
	}
	

</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>
				

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

						<div class="form-group">


							

							<div class="form-group has-feedback has-feedback-left  col-sm-4">
								<label class="control-label multi_lang">Pharmacy Name</label>
								<input type="text" id="pharmacy_name" name="pharmacy_name" class="form-control multi_lang stop_enter" placeholder="Pharmacy Name" required="required">
								<div class="form-control-feedback">
									<i class="icon-user-tie text-muted"></i>
								</div>
							</div>

							<div class="form-group has-feedback has-feedback-left  col-sm-4">
								<label class="control-label multi_lang">Address</label>
								<input type="text" id="pharmacy_address" name="pharmacy_address" class="form-control multi_lang stop_enter" placeholder="Address">
								<div class="form-control-feedback">
									<i class="icon-hash text-muted"></i>
								</div>
							</div>

							<div class="form-group has-feedback has-feedback-left  col-sm-4">
								<label class="control-label multi_lang">اسم الصيدلي</label>
								<input type="text" id="pharmer_name" name="pharmer_name" class="form-control multi_lang stop_enter" placeholder="اسم الصيدلي" >
								<div class="form-control-feedback">
									<i class="icon-office text-muted"></i>
								</div>
							</div>

							<div class="form-group has-feedback has-feedback-left  col-sm-4">
								<label class="control-label multi_lang">Phone No.</label>
								<input type="text" id="pharmacy_phone" name="pharmacy_phone" class="form-control multi_lang stop_enter" placeholder="Phone No." >
								<div class="form-control-feedback">
									<i class="icon-phone2 text-muted"></i>
								</div>
							</div>

							<div class="form-group has-feedback has-feedback-left  col-sm-4">
								<label class="control-label multi_lang">Pharmacy Type</label>
								<select class="form-control stop_enter" name="pharmacy_type" id="pharmacy_type" required="required" data-width="100%" data-live-search="true" >
									<option selected="selected" value="0">By Hand</option>
									<option value="1">By Doctor</option>
									<option value="2">Mixed</option>
								</select>
							</div>

							
							
							
							<div class="form-group has-feedback has-feedback-left col-sm-4">
								<label class="control-label multi_lang">Note</label>
								<textarea type="text" id="pharmacy_note" name="pharmacy_note" class="form-control " style="height: 38px;"></textarea>
								<div class="form-control-feedback">
									<i class="icon-info22 text-muted"></i>
								</div>
							</div>

							
							

							<div class="form-group has-feedback has-feedback-left   col-sm-4">
								<label class="control-label animate multi_lang">City</label>
								
								<select  class="form-control stop_enter" name="city_id_fk" id="city_id_fk" required="required" data-width="100%" data-live-search="true" >

								</select>
							</div>


							<div class="form-group has-feedback has-feedback-left   col-sm-4">
								<label class="control-label animate multi_lang">Zone</label>
								
								<select class="form-control stop_enter" name="zone_id_fk" id="zone_id_fk"  data-width="100%" data-live-search="true" >

								</select>
							</div>

							<div class="form-group has-feedback has-feedback-left col-sm-4">
								<label class="control-label animate multi_lang">Sub Zone</label>
								
								<select class="form-control stop_enter" name="sub_zone_id_fk" id="sub_zone_id_fk"  data-width="100%" data-live-search="true" >

								</select>
							</div>

							<div class="form-group has-feedback has-feedback-left col-sm-4">
								<label class="control-label animate multi_lang">الحي</label>
								
								<select class="form-control stop_enter" name="quarter_id_fk" id="quarter_id_fk"  data-width="100%" data-live-search="true" >

								</select>
							</div>

							<div class="form-group has-feedback has-feedback-left col-sm-4">
								<label class="control-label animate multi_lang">الشارع</label>
								
								<select class="form-control stop_enter" name="street_id_fk" id="street_id_fk"  data-width="100%" data-live-search="true" >

								</select>
							</div>

							<div class="form-group has-feedback   col-sm-4">
								<label class="control-label animate multi_lang">Doctors</label>
								
								<select multiple="multiple" class="form-control stop_enter" name="doctor_id_fk[]" id="doctor_id_fk"  data-width="100%" data-live-search="true" >
									
								</select>
							</div>
						
							

							<div class="col-md-4">
								<div class="form-group">
									<label class="display-block">تحميل ملف الصيدلية</label>
                    				<input type="file" name="image_path" id="image_path" class="file-styled-primary ">
                    
                  				</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" style="width: 85%;">
			<form class="form-horizontal"  name="edit_form" method="post" id="edit_form" enctype="multipart/form-data">
				

				<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="edit_objid" id="edit_objid" value="">
						<div class="col-sm-12">

							<div class="form-group">


								<div class="form-group has-feedback has-feedback-left  col-sm-4">
									<label class="control-label multi_lang">Pharmacy Name</label>
									<input type="text" id="edit_pharmacy_name" name="edit_pharmacy_name" class="form-control multi_lang stop_enter" placeholder="Pharmacy Name" required="required">
									<div class="form-control-feedback">
										<i class="icon-user-tie text-muted"></i>
									</div>
								</div>

								<div class="form-group has-feedback has-feedback-left   col-sm-4">
									<label class="control-label multi_lang">Address</label>
									<input type="text" id="edit_pharmacy_address" name="edit_pharmacy_address" class="form-control multi_lang stop_enter" placeholder="Address">
									<div class="form-control-feedback">
										<i class="icon-hash text-muted"></i>
									</div>
								</div>

								<div class="form-group has-feedback has-feedback-left   col-sm-4">
									<label class="control-label multi_lang">اسم الصيدلي</label>
									<input type="text" id="edit_pharmer_name" name="edit_pharmer_name" class="form-control multi_lang stop_enter" placeholder="اسم الصيدلي" >
									<div class="form-control-feedback">
										<i class="icon-office text-muted"></i>
									</div>
								</div>

								<div class="form-group has-feedback has-feedback-left   col-sm-4">
									<label class="control-label multi_lang">Phone No.</label>
									<input type="text" id="edit_pharmacy_phone" name="edit_pharmacy_phone" class="form-control multi_lang stop_enter" placeholder="Phone No." >
									<div class="form-control-feedback">
										<i class="icon-phone2 text-muted"></i>
									</div>
								</div>

								<div class="form-group has-feedback has-feedback-left   col-sm-4">
									<label class="control-label multi_lang">Pharmacy Type</label>
									<select class="form-control stop_enter" name="edit_pharmacy_type" id="edit_pharmacy_type" required="required" data-width="100%" data-live-search="true" >
										<option value="0">By Hand</option>
										<option value="1">By Doctor</option>
										<option value="2">Mixed</option>
									</select>
								</div>

								
								
								
								<div class="form-group has-feedback has-feedback-left col-sm-4">
									<label class="control-label multi_lang">Note</label>
									<textarea type="text" id="edit_pharmacy_note" name="edit_pharmacy_note" class="form-control " style="height: 38px;"></textarea>
									<div class="form-control-feedback">
										<i class="icon-info22 text-muted"></i>
									</div>
								</div>

								
								

								<div class="form-group has-feedback has-feedback-left    col-sm-4">
									<label class="control-label animate multi_lang">City</label>
									
									<select  class="form-control stop_enter" name="edit_city_id_fk" id="edit_city_id_fk" required="required" data-width="100%" data-live-search="true" >

									</select>
								</div>


								<div class="form-group has-feedback has-feedback-left    col-sm-4">
									<label class="control-label animate multi_lang">Zone</label>
									
									<select class="form-control stop_enter" name="edit_zone_id_fk" id="edit_zone_id_fk"  data-width="100%" data-live-search="true" >

									</select>
								</div>
								
								<div class="form-group has-feedback has-feedback-left col-sm-3">
									<label class="control-label animate multi_lang">Sub Zone</label>
									
									<select class="form-control stop_enter" name="edit_sub_zone_id_fk" id="edit_sub_zone_id_fk"  data-width="100%" data-live-search="true" >

									</select>
								</div>

								<div class="form-group has-feedback has-feedback-left col-sm-3">
									<label class="control-label animate multi_lang">الحي</label>
									
									<select class="form-control stop_enter" name="edit_quarter_id_fk" id="edit_quarter_id_fk"  data-width="100%" data-live-search="true" >

									</select>
								</div>

								<div class="form-group has-feedback has-feedback-left col-sm-3">
									<label class="control-label animate multi_lang">الشارع</label>
									
									<select class="form-control stop_enter" name="edit_street_id_fk" id="edit_street_id_fk"  data-width="100%" data-live-search="true" >

									</select>
								</div>
								
								
								<div class="form-group has-feedback   col-sm-4">
									<label class="control-label animate multi_lang">Doctors</label>
									
									<select multiple="multiple" class="form-control stop_enter" name="edit_doctor_id_fk[]" id="edit_doctor_id_fk"  data-width="100%" data-live-search="true" >

									</select>
								</div>	
								
								
								<div class="col-md-4">
									<div class="form-group">
										<label class="display-block">تحميل ملف الصيدلية</label>
	                    				<input type="file" name="edit_image_path" id="edit_image_path" class="file-styled-primary ">
	                    
	                  				</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>

	<div id="add_new_category" class="modal fade" >
		<div class="modal-dialog modal-lg">
			<form class="form-horizontal"  name="add_new_category_form" method="post" id="add_new_category_form" enctype="multipart/form-data">
				<input type="hidden" id="access_token" name="access_token"  value="<?php //echo $_SESSION['access_token']; ?>">

				<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">
							<div>
								<div class="col-sm-12">
									<div class="form-group">
										<div class="col-sm-6">
											<div class="input-group">
												<label class="input-group-addon multi_lang">اسم الفئة</label>
												<input type="text" placeholder="اسم الفئة" class="form-control multi_lang" name="objname" id="objname" required="required">
											</div>
										</div>
										<div class="col-sm-6">
											<div class="input-group">
												<label class="input-group-addon multi_lang">الوصف</label>
												<input type="text" placeholder="الوصف" class="form-control multi_lang" name="category_description" id="category_description" required="required">
											</div>
										</div>
									</div>
								</div>
							</div>
					</div>
					<div class="modal-footer">
						<button type="submit" id="submit_add_cat_btn" 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>

	<div id="delete-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="delete_form" enctype="multipart/form-data">
				
				<div class="col-sm-12">
					<div class="alert alert-warning alert-styled-left">
						<button type="button" class="close" data-dismiss="alert"><span>×</span><span class="sr-only">Close</span></button>
						<span class="text-semibold">Warning!</span> 
						سيتم حذف الاطباء وفقا لاختياراتك , هل انت متأكد لانه سوف لن تستطيع استرجاع السجلات المحذوفة!!
				    </div>
				</div>
				<div class="col-sm-12">

					<div class="form-group">



						
						

						<div class="form-group has-feedback has-feedback-left   col-sm-3">
							<label class="control-label animate multi_lang">City</label>
							
							<select class="form-control stop_enter" name="delete_city_id_fk" id="delete_city_id_fk"  data-width="100%" data-live-search="true" >
								<option value="" selected="selected">Select City</option>
							</select>
						</div>


						<div class="form-group has-feedback has-feedback-left col-sm-3">
							<label class="control-label animate multi_lang">Zone</label>
							
							<select class="form-control stop_enter" name="delete_zone_id_fk" id="delete_zone_id_fk"  data-width="100%" data-live-search="true" >
								<option value="" selected="selected">Select Zone</option>
							</select>
						</div>


						<div class="form-group has-feedback has-feedback-left col-sm-3">
							<label class="control-label animate multi_lang">Sub Zone</label>
							
							<select class="form-control stop_enter" name="delete_sub_zone_id_fk" id="delete_sub_zone_id_fk"  data-width="100%" data-live-search="true" >
								<option value="" selected="selected">Select Sub Zone</option>
							</select>
						</div>

						<div class="form-group has-feedback has-feedback-left col-sm-3">
							<label class="control-label animate multi_lang">الحي</label>
							
							<select class="form-control stop_enter" name="delete_quarter_id_fk" id="delete_quarter_id_fk"  data-width="100%" data-live-search="true" >
								<option value="" selected="selected">اختيار الحي</option>

							</select>
						</div>

						<div class="form-group has-feedback has-feedback-left col-sm-3">
							<label class="control-label animate multi_lang">الشارع</label>
							
							<select class="form-control stop_enter" name="delete_street_id_fk" id="delete_street_id_fk"  data-width="100%" data-live-search="true" >
								<option value="" selected="selected">اختيار الشارع</option>

							</select>
						</div>

						
					

					</div>

					

				</div>

				<div class="text-right">
					<button type="submit" id="submit_delete_btn" class="btn btn-primary btn-labeled btn-labeled-left ">
						<span class="multi_lang">حذف</span> <b><i class="icon-trash"></i></b>
					</button>
					<a href="#delete-cont" id="delete_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="print_modal" class="modal fade" >
		<div class="modal-dialog modal-lg">
			<form class="form-horizontal"  name="print_form" method="post" id="print_form" enctype="multipart/form-data">
				
				<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">
							
						<div class="col-sm-12">
							<div class="form-group">
								<div class="col-sm-6">
									<div class="input-group">
										<label class="input-group-addon multi_lang">طباعة حسب الفئة</label>
										<select class="form-control" name="product_category_id_fk" 
										id="product_category_id_fk" data-width="100%" data-live-search="true">

										</select>
									</div>
								</div>

								

								<!-- <div class="col-sm-3">
									<div class="input-group">
										<label class="input-group-addon multi_lang">
										<input type="checkbox" class="" name="kurd_check" 
										id="kurd_check" > اظهار اللغة الكردية
										</label>
									</div>
								</div> -->
							</div>
						</div>
							
					</div>
					<div class="modal-footer">
						<button type="submit" id="print_btn" 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>

	<div id="show_files" class="modal fade" >
			<div class="modal-dialog modal-lg" >

				<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">

								<div class="row" id="file_attach">

								</div>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-labeled btn-labeled-left heading-btn btn-primary"  data-dismiss="modal"> OK
						</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal"> <span class="multi_lang">اغلاق</span>
						</button>
					</div>
				</div>

		</div>
	</div>



	

				<!-- Individual column searching (text inputs) -->
				<div class="panel panel-flat">
					
					<table class="table  datatable-column-search-inputs table-bordered table-hover datatable-highlight datatable-row-full datatable-key-class">
						<thead>
							<tr>
				        		<th >ID</th>
								<th class="multi_lang">اسم الصيدلية</th>
								<th class="multi_lang">العنوان</th>
								<!-- <th class="multi_lang">اسم الصيدلاني</th> -->
								<th class="multi_lang">رقم الهاتف1</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">Sub-Zone</th>
								<th class="multi_lang">Zone</th>
								<th class="multi_lang">City</th>
								<th class="multi_lang">Added By</th>
				        		<th class="multi_lang" width="10%">العمليات</th>
				      		</tr>
						</thead>
						<tbody>
							
						</tbody>
						<tfoot>
							<tr>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td>username</td>
				                <td>full_name</td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				    
				                
				            </tr>
						</tfoot>
					</table>
				</div>
				<!-- /individual column searching (text inputs) -->



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