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

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

	.dataTable {
        font-size: 13px;
	}
</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">
			<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">
						<label class="control-label multi_lang">اسم المستخدم</label>
						<input type="text" id="username" name="username" class="form-control multi_lang" placeholder="اسم المستخدم" required="required">
						<div class="form-control-feedback">
							<i class="icon-user text-muted"></i>
						</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="full_name" name="full_name" class="form-control multi_lang" placeholder="الاسم الكامل" required="required">
						<div class="form-control-feedback">
							<i class="icon-users2 text-muted"></i>
						</div>
					</div>
				</div>

				<div class="form-group">
					<div class="form-group has-feedback has-feedback-left col-sm-6">
						<label class="control-label multi_lang">البريد الالكتروني</label>
						<input type="email" id="email" name="email" class="form-control multi_lang" placeholder="البريد الالكتروني" required="required">
						<div class="form-control-feedback">
							<i class="icon-envelop5 text-muted"></i>
						</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="phone_number" name="phone_number" class="form-control multi_lang" placeholder="الهاتف" required="required">
						<div class="form-control-feedback">
							<i class="icon-phone-plus text-muted"></i>
						</div>
					</div>

				</div>

				<div class="form-group">
					<div class="form-group has-feedback has-feedback-left col-sm-6">
						<label class="control-label multi_lang">كلمة السر</label>
						<input type="password" id="password" name="password" class="form-control multi_lang" placeholder="كلمة السر" required="required">
						<div class="form-control-feedback">
							<i class="icon-key text-muted"></i>
						</div>
					</div>
					<div class="form-group has-feedback has-feedback-left col-sm-6">
						<label class="control-label multi_lang">اعادة كتابة كلمة السر</label>
						<input type="password" id="repassword" name="repassword" class="form-control multi_lang" placeholder="اعادة كتابة كلمة السر" required="required">
						<div class="form-control-feedback">
							<i class="icon-key text-muted"></i>
						</div>
					</div>
				

					<div class="form-group has-feedback has-feedback-left  col-sm-3">
						<label class="control-label animate multi_lang">Supervisor</label>
						
						<select class="form-control stop_enter" name="supervisor_id_fk" id="supervisor_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">Teamleader</label>
						
						<select class="form-control stop_enter" name="team_leader_id_fk" id="team_leader_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">City</label>
						
						<select class="form-control stop_enter" name="city_id_fk" id="city_id_fk" required="required" multiple="multiple" 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" required="required" multiple="multiple" 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="sub_zone_id_fk" id="sub_zone_id_fk" multiple="multiple"  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="quarter_id_fk" id="quarter_id_fk" multiple="multiple"  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="street_id_fk" id="street_id_fk"  data-width="100%" multiple="multiple" data-live-search="true" >

						</select>
					</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-full">
		<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">
								<label class="control-label multi_lang">اسم المستخدم</label>
								<input type="text" id="edit_username" name="edit_username" class="form-control multi_lang" placeholder="اسم المستخدم" required="required">
								<div class="form-control-feedback">
									<i class="icon-user text-muted"></i>
								</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_full_name" name="edit_full_name" class="form-control multi_lang" placeholder="الاسم الكامل" required="required">
								<div class="form-control-feedback">
									<i class="icon-users2 text-muted"></i>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="form-group has-feedback has-feedback-left  col-sm-6">
								<label class="control-label multi_lang">البريد الالكتروني</label>
								<input type="email" id="edit_email" name="edit_email" class="form-control multi_lang" placeholder="البريد الالكتروني" required="required">
								<div class="form-control-feedback">
									<i class="icon-envelop5 text-muted"></i>
								</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_phone_number" name="edit_phone_number" class="form-control multi_lang" placeholder="الهاتف" required="required">
								<div class="form-control-feedback">
									<i class="icon-phone-plus text-muted"></i>
								</div>
							</div>

							<div class="form-group has-feedback has-feedback-left  col-sm-3">
								<label class="control-label animate multi_lang">Supervisor</label>
								
								<select class="form-control stop_enter" name="edit_supervisor_id_fk" id="edit_supervisor_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">Teamleader</label>
								
								<select class="form-control stop_enter" name="edit_team_leader_id_fk" id="edit_team_leader_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">City</label>
								
								<select class="form-control stop_enter" name="edit_city_id_fk" id="edit_city_id_fk" multiple="multiple" 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" multiple="multiple"  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" multiple="multiple"  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" multiple="multiple"  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" multiple="multiple"  data-width="100%" data-live-search="true" >

								</select>
							</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="edit_form_cont1" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="edit_formPass" method="post" id="edit_formPass" 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_objidPass" value="">
						<div>
							

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

								<div class="form-group">
									
										<div class="form-group has-feedback has-feedback-left col-sm-6">
											<label class="control-label multi_lang">كلمة السر الجديدة</label>
											<input type="password" id="edit_password" name="edit_password" class="form-control multi_lang" placeholder="كلمة السر الجديدة" required="required">
											<div class="form-control-feedback">
												<i class="icon-key2 text-muted"></i>
											</div>
										</div>
									
										<div class="form-group has-feedback has-feedback-left col-sm-6">
											<label class="control-label multi_lang">اعادة كتابة كلمة السر</label>
											<input type="password" id="edit_repassword" name="edit_repassword" class="form-control multi_lang" placeholder="اعادة كتابة كلمة السر" required="required">
											<div class="form-control-feedback">
												<i class="icon-key2 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>


<div id="edit_profile" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="edit_form_profile" method="post" id="edit_form_profile" 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_objidProfile" value="">
							<div class="col-sm-12">
								<div class="form-group">									
									<div class="form-group form-group-material1 col-sm-6">
										<label class="control-label animate multi_lang">تعريف المستخدم</label>
										<select name="profile_type" id="profile_type" class="form-control">
											<option class="multi_lang" value="" selected="selected">اختيار التعريف</option>
											<option class="multi_lang" value="5">Super Admin</option>
											<option class="multi_lang" value="4">Admin</option>
											<option class="multi_lang" value="3">Supervisor</option>
											<option class="multi_lang" value="2">Team Leader</option>
											<option class="multi_lang" value="1">SaleMan</option>
											<option class="multi_lang" value="0">Staff</option>
										</select>
									</div>


									<div class="form-group form-group-material1 col-sm-6">
										<label class="control-label animate multi_lang">Permission Type</label>
										<select name="permission_type" id="permission_type" class="form-control">
											<option class="multi_lang" value="" selected="selected">Select Permission</option>
											
											<option class="multi_lang" value="1">Just View</option>
											<option class="multi_lang" value="0">Can Add, Edit and Delete </option>
										</select>
									</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="edit_role" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="edit_form_role" method="post" id="edit_form_role" 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_objidrole" value="">
							<div class="col-sm-12">
								<div class="form-group">									
									<div class="form-group form-group-material col-sm-12">
										<label class="control-label animate multi_lang">صلاحيات المستخدم</label>
										<select name="user_role" id="user_role" multiple="multiple" class="form-control listbox-no-selection">
											
										</select>
									</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="edit_sub_role" class="modal fade" style="display: none;">
	<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="edit_form_sub_role" method="post" id="edit_form_sub_role" 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="user_id" id="user_id" value="">
					<div class="form-group has-feedback has-feedback-left   col-sm-12">
						<label class="control-label animate multi_lang">Sub-Roles</label>
						
						<select class="form-control stop_enter" name="sub_role_id_fk" id="sub_role_id_fk"  multiple="multiple" data-width="100%" data-live-search="true" >
							<option value="1">تقرير عن المواد في تقارير المندوبين</option>
							<option value="2">تقرير عن العروض المقدمة للاطباء</option>
							<option value="3">تقرير عن الكمية التي تم طلبها لكل مادة</option>
							<option value="4">تقرير عن زيارات المندوبين</option>
							<option value="5">تقرير عن مجمل زيارات كل مندوب</option>
							

						</select>
					</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 width="5%">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">Permission Type</th>
				                <th class="multi_lang">الحالة</th>
				                <th class="multi_lang">City</th>
				                <th class="multi_lang">Zone</th>
				                <th class="multi_lang">Teamleader</th>
				                <th class="multi_lang">Supervisor</th>
				                <th class="text-center multi_lang" width="20%">العمليات</th>
				            </tr>
						</thead>
						<tbody>
							
						</tbody>
						<tfoot>
							<tr>
				                <td></td>
				                <td>username</td>
				                <td>full_name</td>
				                <td>EMail</td>
				                <td>Phone</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/user.js?random=<?php echo uniqid(); ?>"></script>