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

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>
<style >
	tfoot {
    display: table-header-group !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>
			<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  col-sm-6">
							<div class="">
								<label class="control-label multi_lang"> اسم المخزن </label>
								<input type="text" placeholder=" اسم المخزن " class="form-control" name="stock_name" id="stock_name" required="required">
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left  col-sm-6">
							<label class="control-label multi_lang">اختيار الفرع</label>
							
							<select class="form-control multi_lang stop_enter" name="branch_id_fk" id="branch_id_fk" data-width="100%" data-live-search="true" required="required">

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


					</div>

					<div class="form-group" >

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-6">
							<div class="">
								<label class="control-label multi_lang"> الموقع </label>
								<input type="text" placeholder="الموقع " class="form-control" name="location" id="location" >
							</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" id="stock_note" name="stock_note" class="form-control multi_lang" placeholder="الملاحظات" > 
							<div class="form-control-feedback">
								<i class="icon-notebook 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">
			

			<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-6">
									<div class="">
										<label class="control-label multi_lang"> اسم المخزن </label>
										<input type="text" placeholder=" اسم المخزن " class="form-control" name="edit_stock_name" id="edit_stock_name" required="required">
									</div>
								</div>

								<div class="form-group has-feedback has-feedback-left  col-sm-6">
									<label class="control-label multi_lang">اختيار الفرع</label>
									
									<select class="form-control multi_lang stop_enter" name="edit_branch_id_fk" id="edit_branch_id_fk" data-width="100%" data-live-search="true" required="required">

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

								

								

							</div>

							<div class="form-group" >

								<div class="form-group has-feedback has-feedback-left col-sm-6">
									<div class="">
										<label class="control-label multi_lang"> الموقع </label>
										<input type="text" placeholder="الموقع " class="form-control" name="edit_location" id="edit_location" >
									</div>
								</div>
								

								<div class="form-group has-feedback has-feedback-left col-sm-6">
									<label class="control-label multi_lang">الملاحظات</label>
									<input type="text" id="edit_stock_note" name="edit_stock_note" class="form-control multi_lang" placeholder="الملاحظات" >
									<div class="form-control-feedback">
										<i class="icon-notebook 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>


				<!-- 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">الملاحظات</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></td>
				                <td></td>
				                <td></td>
				            </tr>
						</tfoot>
					</table>
				</div>
				<!-- /individual column searching (text inputs) -->



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