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

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

	.dataTable {
        font-size: 11.5px;
	}

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

</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 animate multi_lang">اسم الزبون</label>
								
								<select name="customer_id_fk" id="customer_id_fk" class="form-control" required="required">
								

								</select>
								<div class="form-control-feedback">
									<i class="icon-user-tie text-muted"></i>
								</div>
							</div>

							<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
								<label class="control-label multi_lang">تاريخ الاتصال</label>
								
								<input type="text" id="call_date" name="call_date" class="form-control daterange-single multi_lang" placeholder="تاريخ الاتصال" 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 form-group-material col-sm-4">
								<label class="control-label multi_lang">مبلغ الدفعة المتوقعه</label>
								<input type="text" id="expect_pay_amount" name="expect_pay_amount" class="form-control multi_lang" placeholder=" مبلغ الدفعة المتوقعه" required="required">
								<div class="form-control-feedback">
									<i class="icon-wallet text-muted"></i>
								</div>
							</div>


							

						</div>

						<div class="form-group">

							

							<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
								<label class="control-label multi_lang">تاريخ الدفع المتوقع</label>
								
								<input type="text" id="expect_pay_date" name="expect_pay_date" class="form-control daterange-single multi_lang" placeholder="تاريخ الدفع المتوقع" 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 form-group-material col-sm-8">
								<label class="control-label multi_lang">الملاحظات</label>
								<input type="text" id="pay_note" name="pay_note" class="form-control multi_lang" placeholder="الملاحظات" >
								<div class="form-control-feedback">
									<i class="icon-info22 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 class="col-sm-12">

								<div class="form-group">


									<div class="form-group has-feedback has-feedback-left  col-sm-4">
										<label class="control-label animate multi_lang">اسم الزبون</label>
										
										<select name="edit_customer_id_fk" id="edit_customer_id_fk" class="form-control" required="required">
										

										</select>
										<div class="form-control-feedback">
											<i class="icon-user-tie text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
										<label class="control-label multi_lang">تاريخ الاتصال</label>
										
										<input type="text" id="edit_call_date" name="edit_call_date" class="form-control daterange-single multi_lang" placeholder="تاريخ الاتصال" 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 form-group-material col-sm-4">
										<label class="control-label multi_lang">مبلغ الدفعة المتوقعه</label>
										<input type="text" id="edit_expect_pay_amount" name="edit_expect_pay_amount" class="form-control multi_lang" placeholder=" مبلغ الدفعة المتوقعه" required="required">
										<div class="form-control-feedback">
											<i class="icon-wallet text-muted"></i>
										</div>
									</div>


									

								</div>

								<div class="form-group">

									

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
										<label class="control-label multi_lang">تاريخ الدفع المتوقع</label>
										
										<input type="text" id="edit_expect_pay_date" name="edit_expect_pay_date" class="form-control daterange-single multi_lang" placeholder="تاريخ الدفع المتوقع" 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 form-group-material col-sm-8">
										<label class="control-label multi_lang">الملاحظات</label>
										<input type="text" id="edit_pay_note" name="edit_pay_note" class="form-control multi_lang" placeholder="الملاحظات" >
										<div class="form-control-feedback">
											<i class="icon-info22 text-muted"></i>
										</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="show_bills_modal" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
			<form class="form-horizontal"  name="show_bills_form" method="post" id="show_bills_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 id="invoce_html_pay">
						<div class="modal-body" >
								<input type="hidden" name="bill_id" id="bill_id">
								<div id="bills_show">
									<!-- Borderless table -->


									<!-- /borderless table -->
								</div>
						</div>
					</div>
					<div class="modal-footer">
						<div id="link_pdf_pay"></div>
						<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-primary" id="pdf_pay"> <span class="multi_lang">توليد  PDF</span>  <b><i class="icon-file-pdf"></i></b>
						</button>
						<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-success" id="print_pay"><span class="multi_lang">طباعة</span>  <b><i class=" icon-printer2"></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="multi_lang">الملاحظات</th>

				        		<th class="multi_lang" width="8%">العمليات</th>
				      </tr>
						</thead>
						<tbody>
							
						</tbody>
						<tfoot>
							<tr>
				                <td></td>
				                <td>username</td>
				                <td>full_name</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/payment_notify.js?random=<?php echo uniqid(); ?>"></script>