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

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

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

	td{
	text-align: center !important;
	}
	th{
	text-align: center !important;
	}

	textarea{
	height: 38px !important;
	resize: none;
	}

.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td {
    padding: 10px 5px;

    }

    .badge:empty{
    	display: initial;
    }

    .btn_add_item{
    	padding: 0px 0px;
    }

    .bootstrap-select.btn-group .btn .filter-option{
    	text-align: center;
    }

    input[type="checkbox"] {
    	margin: -8px 0 0;
    	
    	line-height: normal;
	}

	.radio label, .checkbox label {
    	padding-right: 85px;
	}

	.radio label, .checkbox label {
    	min-height: 20px;
    	/*padding-right: 20px;*/
    	margin-bottom: 20px;
    	font-weight: normal;
    	cursor: pointer;
	}

</style>






<div id="add-form-cont"  class="panel-collapse collapse   panel" aria-expanded="false" >
	<div class="panel-body">
		<form class="form-horizontal" method="post" id="add_form" enctype="multipart/form-data">
			
			
			<!-- <input type="hidden" id="invoice_type" name="invoice_type" value="0"> -->
			<input type="hidden" id="total_rows" name="total_rows" value="1">
			<input type="hidden" id="total_rows_doctor" name="total_rows_doctor" value="1">
			
			<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">Report Title</label>
						<input type="text" id="report_title" name="report_title" class="form-control multi_lang stop_enter" placeholder="Report Title" 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-8">
						<label class="control-label multi_lang">Description</label>
						<input type="text" id="report_description" name="report_description" class="form-control multi_lang stop_enter" placeholder="Description" >
						<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-3">
						<label class="control-label multi_lang">Date</label>
							<input type="text" id="report_date" name="report_date" class="form-control multi_lang daterange-single stop_enter" placeholder="Date" required="required"  >
							<div class="form-control-feedback">
								<i class=" icon-calendar52 text-muted"></i>
							</div>
					</div>

					<div class="form-group has-feedback has-feedback-left  col-sm-3">
						<label class="control-label multi_lang">العرض المقدم</label>
						<input type="text" id="doctor_offer" name="doctor_offer" class="form-control multi_lang stop_enter" placeholder="العرض المقدم" >
						<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-3">
						<label class="control-label multi_lang">Offer Money</label>
						<input type="text" id="offer_money" name="offer_money" class="form-control multi_lang stop_enter" placeholder="Offer Money" >
						<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-3">
						<label class="control-label multi_lang">تقييم المندوب للطبيب</label>
						<input type="number" id="rating_doctor" name="rating_doctor" class="form-control multi_lang stop_enter" placeholder="Doctor Rating from 1 to 10" >
						<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-12">
						<label class="control-label multi_lang">Note</label>
						<input type="text" id="report_note" name="report_note" class="form-control multi_lang stop_enter" placeholder="Note" >
						<div class="form-control-feedback">
							<i class="icon-user-tie text-muted"></i>
						</div>
					</div>
					
					<div class="form-group has-feedback   col-sm-3">
						<label class="control-label animate multi_lang">نوع التقرير</label>
						
						<select  class="form-control stop_enter" name="report_type" id="report_type"  data-width="100%" data-live-search="true" >
							<option value="0">مع المواد</option>
							<option value="1">بدون مواد</option>
						</select>
					</div>

					<div class="form-group has-feedback   col-sm-3">
						<label class="control-label animate multi_lang">نوع الزيارة</label>
						
						<select  class="form-control stop_enter" name="visit_type" id="visit_type"  data-width="100%" data-live-search="true" >
							<option value="0">زيارة طبيب</option>
							<option value="1">زيارة صيدلية بدون طبيب</option>
						</select>
					</div>


					
					<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="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-3">
						<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-3">
						<label class="control-label animate multi_lang">Plan</label>
						
						<select  class="form-control stop_enter" name="plan_id_fk" id="plan_id_fk" required="required" data-width="100%" data-live-search="true" >

						</select>
					</div>

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

						</select>
					</div>

					<div id="div_out_doctor" class="form-group has-feedback has-feedback-left col-sm-3" >
						<label class="control-label animate multi_lang">Out Plan Doctor</label>
						
						<select  class="form-control stop_enter" name="out_doctor_id_fk" id="out_doctor_id_fk" data-width="100%" data-live-search="true" >

						</select>
					</div>

					<div id="div_pharmacy" class="form-group has-feedback has-feedback-left col-sm-3" style="display: none;">
						<label class="control-label animate multi_lang">Pharmacy</label>
						
						<select  class="form-control stop_enter" name="pharmacy_id_fk" id="pharmacy_id_fk" data-width="100%" data-live-search="true" >

						</select>
					</div>

					
				</div>

				

				<div class="form-group">
					<div class="table-responsive1">
						<table  class="table col-sm-12 table-bordered .table-sm">
							<thead>
								<tr class="alpha-success ">
									<th>#</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="multi_lang">ملاحظة</th>
									<th></th>
								</tr>
							</thead>
							<tbody id="purchase_item_body" >
								<tr  id="item_row_1" >
									<td width="5%" id="num_1">1</td>

									<td width="10%" id="ttt">
										<select class="form-control multi_lang stop_enter" name="product_id_fk_1" id="product_id_fk_1" data-width="100%"  data-live-search="true"  >

										</select>

									</td>


									<td width="6%">
										<input type="number" id="ordered_quantity_1" name="ordered_quantity_1"  class="form-control text-center multi_lang stop_enter" placeholder="QNTY" value="1">
									</td>

									<td width="9%" >
										<input id="order_sell_price_1" name="order_sell_price_1" type="text" class="form-control multi_lang text-center " placeholder="سعر البيع" >
									</td>

									<td width="10%">
										<input id="rate_percent_1" name="rate_percent_1" type="number" value="" class="form-control text-center text-black text-size-large stop_enter" placeholder="من 1 الى 10">
									</td>

									

									

									<td width="8%">
										<input id="opinion_1" name="opinion_1" type="text" class="form-control multi_lang stop_enter" placeholder="رأي الطبيب">
									</td>

									
									<td width="10%" >
										<select class="form-control multi_lang stop_enter" name="pharmacy_id_fk_1" id="pharmacy_id_fk_1" data-width="100%"  data-live-search="true" >

										</select>

									</td>
									
									<td width="8%">
										<input id="pharmacy_offer_1" name="pharmacy_offer_1" type="text" class="form-control multi_lang stop_enter">
									</td>

									<td width="8%">
										<input id="report_product_notes_1" name="report_product_notes_1" type="text" class="form-control multi_lang stop_enter">
									</td>
									
									
									<td width="6%">
										<button class="btn btn-link btn_add_item" id="" tabindex="">
											<i  class="icon-add text-blue"></i>
										</button>
										
									</td>
								</tr>

								
								

								
								
							</tbody>
							<tfoot>
								
								
								

							</tfoot>
						</table>
					</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: 92%;">
		<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="">
					<input type="hidden" id="edit_total_rows" name="edit_total_rows" value="1">
					<input type="hidden" id="edit_total_rows_doctor" name="edit_total_rows_doctor" value="1">
					<input type="hidden" id="update_type" name="update_type" value="update">

					<div class="form-group">

						
						<div class="form-group has-feedback has-feedback-left  col-sm-4">
							<label class="control-label multi_lang">Report Title</label>
							<input type="text" id="edit_report_title" name="edit_report_title" class="form-control multi_lang stop_enter" placeholder="Report Title" 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-8">
							<label class="control-label multi_lang">Description</label>
							<input type="text" id="edit_report_description" name="edit_report_description" class="form-control multi_lang stop_enter" placeholder="Description" >
							<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-3">
							<label class="control-label multi_lang">Date</label>
								<input type="text" id="edit_report_date" name="edit_report_date" class="form-control multi_lang daterange-single stop_enter" placeholder="Date" required="required"  >
								<div class="form-control-feedback">
									<i class=" icon-calendar52 text-muted"></i>
								</div>
						</div>

						<div class="form-group has-feedback has-feedback-left  col-sm-3">
							<label class="control-label multi_lang">العرض المقدم</label>
							<input type="text" id="edit_doctor_offer" name="edit_doctor_offer" class="form-control multi_lang stop_enter" placeholder="العرض المقدم" >
							<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-3">
							<label class="control-label multi_lang">Offer Money</label>
							<input type="text" id="edit_offer_money" name="edit_offer_money" class="form-control multi_lang stop_enter" placeholder="Offer Money" >
							<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-3">
							<label class="control-label multi_lang">تقييم المندوب للطبيب</label>
							<input type="number" id="edit_rating_doctor" name="edit_rating_doctor" class="form-control multi_lang stop_enter" placeholder="Doctor Rating from 1 to 10" >
							<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-12">
							<label class="control-label multi_lang">Note</label>
							<input type="text" id="edit_report_note" name="edit_report_note" class="form-control multi_lang stop_enter" placeholder="Note" >
							<div class="form-control-feedback">
								<i class="icon-user-tie text-muted"></i>
							</div>
						</div>
						
						<div class="form-group has-feedback   col-sm-3">
							<label class="control-label animate multi_lang">نوع التقرير</label>
							
							<select  class="form-control stop_enter" name="edit_report_type" id="edit_report_type"  data-width="100%" data-live-search="true" >
								<option value="0">مع المواد</option>
								<option value="1">بدون مواد</option>
							</select>
						</div>

						<div class="form-group has-feedback   col-sm-3">
							<label class="control-label animate multi_lang">نوع الزيارة</label>
							
							<select  class="form-control stop_enter" name="edit_visit_type" id="edit_visit_type"  data-width="100%" data-live-search="true" >
								<option value="0">زيارة طبيب</option>
								<option value="1">زيارة صيدلية بدون طبيب</option>
							</select>
						</div>


						
						<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="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-3">
							<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">Plan</label>
							
							<select  class="form-control stop_enter" name="edit_plan_id_fk" id="edit_plan_id_fk" required="required" data-width="100%" data-live-search="true" >

							</select>
						</div>

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

							</select>
						</div>

						<div id="div_out_doctor" class="form-group has-feedback has-feedback-left col-sm-3" >
							<label class="control-label animate multi_lang">Out Plan Doctor</label>
							
							<select  class="form-control stop_enter" name="edit_out_doctor_id_fk" id="edit_out_doctor_id_fk" data-width="100%" data-live-search="true" >

							</select>
						</div>

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

							</select>
						</div>

						
					</div>


					

					
						

					<div id="edited_purchase_contain">


					</div>


					

				</div>
				<div class="modal-footer">
					<button type="submit" id="submit_edit_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">Report No.</th>
								<th class="multi_lang">Title</th>
								<th class="multi_lang">Date</th>
								<th class="multi_lang">Doctor/ Pharmacy</th>
								<th class="multi_lang">Plan No.</th>
								<th class="multi_lang">Product</th>
								<th class="multi_lang">Ordered Qty</th>
								<th class="multi_lang">Pharmacy</th>
								<th class="multi_lang">City</th>
								<th class="multi_lang">Zone</th>
								<th class="multi_lang">Saleman</th>
								<th class="multi_lang">Status</th>
								
			          			<th class="text-center multi_lang">العمليات</th>
				      </tr>
						</thead>
						<tbody>
							
						</tbody>
						<tfoot>
							<tr>
				                <td></td>
				                <td>username</td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></td>
				                <td></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/visit_delivery.js?random=<?php echo uniqid(); ?>"></script>