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

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>
<?php
$timezones = array (
'(GMT-11:00) Midway Island' => 'Pacific/Midway',
'(GMT-11:00) Samoa' => 'Pacific/Samoa',
'(GMT-10:00) Hawaii' => 'Pacific/Honolulu',
'(GMT-09:00) Alaska' => 'US/Alaska',
'(GMT-08:00) Pacific Time (US &amp; Canada)' => 'America/Los_Angeles',
'(GMT-08:00) Tijuana' => 'America/Tijuana',
'(GMT-07:00) Arizona' => 'US/Arizona',
'(GMT-07:00) Chihuahua' => 'America/Chihuahua',
'(GMT-07:00) La Paz' => 'America/Chihuahua',
'(GMT-07:00) Mazatlan' => 'America/Mazatlan',
'(GMT-07:00) Mountain Time (US &amp; Canada)' => 'US/Mountain',
'(GMT-06:00) Central America' => 'America/Managua',
'(GMT-06:00) Central Time (US &amp; Canada)' => 'US/Central',
'(GMT-06:00) Guadalajara' => 'America/Mexico_City',
'(GMT-06:00) Mexico City' => 'America/Mexico_City',
'(GMT-06:00) Monterrey' => 'America/Monterrey',
'(GMT-06:00) Saskatchewan' => 'Canada/Saskatchewan',
'(GMT-05:00) Bogota' => 'America/Bogota',
'(GMT-05:00) Eastern Time (US &amp; Canada)' => 'US/Eastern',
'(GMT-05:00) Indiana (East)' => 'US/East-Indiana',
'(GMT-05:00) Lima' => 'America/Lima',
'(GMT-05:00) Quito' => 'America/Bogota',
'(GMT-04:00) Atlantic Time (Canada)' => 'Canada/Atlantic',
'(GMT-04:30) Caracas' => 'America/Caracas',
'(GMT-04:00) La Paz' => 'America/La_Paz',
'(GMT-04:00) Santiago' => 'America/Santiago',
'(GMT-03:30) Newfoundland' => 'Canada/Newfoundland',
'(GMT-03:00) Brasilia' => 'America/Sao_Paulo',
'(GMT-03:00) Buenos Aires' => 'America/Argentina/Buenos_Aires',
'(GMT-03:00) Georgetown' => 'America/Argentina/Buenos_Aires',
'(GMT-03:00) Greenland' => 'America/Godthab',
'(GMT-02:00) Mid-Atlantic' => 'America/Noronha',
'(GMT-01:00) Azores' => 'Atlantic/Azores',
'(GMT-01:00) Cape Verde Is.' => 'Atlantic/Cape_Verde',
'(GMT+00:00) Casablanca' => 'Africa/Casablanca',
'(GMT+00:00) Edinburgh' => 'Europe/London',
'(GMT+00:00) Greenwich Mean Time : Dublin' => 'Etc/Greenwich',
'(GMT+00:00) Lisbon' => 'Europe/Lisbon',
'(GMT+00:00) London' => 'Europe/London',
'(GMT+00:00) Monrovia' => 'Africa/Monrovia',
'(GMT+00:00) UTC' => 'UTC',
'(GMT+01:00) Amsterdam' => 'Europe/Amsterdam',
'(GMT+01:00) Belgrade' => 'Europe/Belgrade',
'(GMT+01:00) Berlin' => 'Europe/Berlin',
'(GMT+01:00) Bern' => 'Europe/Berlin',
'(GMT+01:00) Bratislava' => 'Europe/Bratislava',
'(GMT+01:00) Brussels' => 'Europe/Brussels',
'(GMT+01:00) Budapest' => 'Europe/Budapest',
'(GMT+01:00) Copenhagen' => 'Europe/Copenhagen',
'(GMT+01:00) Ljubljana' => 'Europe/Ljubljana',
'(GMT+01:00) Madrid' => 'Europe/Madrid',
'(GMT+01:00) Paris' => 'Europe/Paris',
'(GMT+01:00) Prague' => 'Europe/Prague',
'(GMT+01:00) Rome' => 'Europe/Rome',
'(GMT+01:00) Sarajevo' => 'Europe/Sarajevo',
'(GMT+01:00) Skopje' => 'Europe/Skopje',
'(GMT+01:00) Stockholm' => 'Europe/Stockholm',
'(GMT+01:00) Vienna' => 'Europe/Vienna',
'(GMT+01:00) Warsaw' => 'Europe/Warsaw',
'(GMT+01:00) West Central Africa' => 'Africa/Lagos',
'(GMT+01:00) Zagreb' => 'Europe/Zagreb',
'(GMT+02:00) Athens' => 'Europe/Athens',
'(GMT+02:00) Bucharest' => 'Europe/Bucharest',
'(GMT+02:00) Cairo' => 'Africa/Cairo',
'(GMT+02:00) Harare' => 'Africa/Harare',
'(GMT+02:00) Helsinki' => 'Europe/Helsinki',
'(GMT+02:00) Istanbul' => 'Europe/Istanbul',
'(GMT+02:00) Jerusalem' => 'Asia/Jerusalem',
'(GMT+02:00) Kyiv' => 'Europe/Helsinki',
'(GMT+02:00) Pretoria' => 'Africa/Johannesburg',
'(GMT+02:00) Riga' => 'Europe/Riga',
'(GMT+02:00) Sofia' => 'Europe/Sofia',
'(GMT+02:00) Tallinn' => 'Europe/Tallinn',
'(GMT+02:00) Vilnius' => 'Europe/Vilnius',
'(GMT+03:00) Baghdad' => 'Asia/Baghdad',
'(GMT+03:00) Kuwait' => 'Asia/Kuwait',
'(GMT+03:00) Minsk' => 'Europe/Minsk',
'(GMT+03:00) Nairobi' => 'Africa/Nairobi',
'(GMT+03:00) Riyadh' => 'Asia/Riyadh',
'(GMT+03:00) Volgograd' => 'Europe/Volgograd',
'(GMT+03:30) Tehran' => 'Asia/Tehran',
'(GMT+04:00) Abu Dhabi' => 'Asia/Muscat',
'(GMT+04:00) Baku' => 'Asia/Baku',
'(GMT+04:00) Moscow' => 'Europe/Moscow',
'(GMT+04:00) Muscat' => 'Asia/Muscat',
'(GMT+04:00) St. Petersburg' => 'Europe/Moscow',
'(GMT+04:00) Tbilisi' => 'Asia/Tbilisi',
'(GMT+04:00) Yerevan' => 'Asia/Yerevan',
'(GMT+04:30) Kabul' => 'Asia/Kabul',
'(GMT+05:00) Islamabad' => 'Asia/Karachi',
'(GMT+05:00) Karachi' => 'Asia/Karachi',
'(GMT+05:00) Tashkent' => 'Asia/Tashkent',
'(GMT+05:30) Chennai' => 'Asia/Calcutta',
'(GMT+05:30) Kolkata' => 'Asia/Kolkata',
'(GMT+05:30) Mumbai' => 'Asia/Calcutta',
'(GMT+05:30) New Delhi' => 'Asia/Calcutta',
'(GMT+05:30) Sri Jayawardenepura' => 'Asia/Calcutta',
'(GMT+05:45) Kathmandu' => 'Asia/Katmandu',
'(GMT+06:00) Almaty' => 'Asia/Almaty',
'(GMT+06:00) Astana' => 'Asia/Dhaka',
'(GMT+06:00) Dhaka' => 'Asia/Dhaka',
'(GMT+06:00) Ekaterinburg' => 'Asia/Yekaterinburg',
'(GMT+06:30) Rangoon' => 'Asia/Rangoon',
'(GMT+07:00) Bangkok' => 'Asia/Bangkok',
'(GMT+07:00) Hanoi' => 'Asia/Bangkok',
'(GMT+07:00) Jakarta' => 'Asia/Jakarta',
'(GMT+07:00) Novosibirsk' => 'Asia/Novosibirsk',
'(GMT+08:00) Beijing' => 'Asia/Hong_Kong',
'(GMT+08:00) Chongqing' => 'Asia/Chongqing',
'(GMT+08:00) Hong Kong' => 'Asia/Hong_Kong',
'(GMT+08:00) Krasnoyarsk' => 'Asia/Krasnoyarsk',
'(GMT+08:00) Kuala Lumpur' => 'Asia/Kuala_Lumpur',
'(GMT+08:00) Perth' => 'Australia/Perth',
'(GMT+08:00) Singapore' => 'Asia/Singapore',
'(GMT+08:00) Taipei' => 'Asia/Taipei',
'(GMT+08:00) Ulaan Bataar' => 'Asia/Ulan_Bator',
'(GMT+08:00) Urumqi' => 'Asia/Urumqi',
'(GMT+09:00) Irkutsk' => 'Asia/Irkutsk',
'(GMT+09:00) Osaka' => 'Asia/Tokyo',
'(GMT+09:00) Sapporo' => 'Asia/Tokyo',
'(GMT+09:00) Seoul' => 'Asia/Seoul',
'(GMT+09:00) Tokyo' => 'Asia/Tokyo',
'(GMT+09:30) Adelaide' => 'Australia/Adelaide',
'(GMT+09:30) Darwin' => 'Australia/Darwin',
'(GMT+10:00) Brisbane' => 'Australia/Brisbane',
'(GMT+10:00) Canberra' => 'Australia/Canberra',
'(GMT+10:00) Guam' => 'Pacific/Guam',
'(GMT+10:00) Hobart' => 'Australia/Hobart',
'(GMT+10:00) Melbourne' => 'Australia/Melbourne',
'(GMT+10:00) Port Moresby' => 'Pacific/Port_Moresby',
'(GMT+10:00) Sydney' => 'Australia/Sydney',
'(GMT+10:00) Yakutsk' => 'Asia/Yakutsk',
'(GMT+11:00) Vladivostok' => 'Asia/Vladivostok',
'(GMT+12:00) Auckland' => 'Pacific/Auckland',
'(GMT+12:00) Fiji' => 'Pacific/Fiji',
'(GMT+12:00) International Date Line West' => 'Pacific/Kwajalein',
'(GMT+12:00) Kamchatka' => 'Asia/Kamchatka',
'(GMT+12:00) Magadan' => 'Asia/Magadan',
'(GMT+12:00) Marshall Is.' => 'Pacific/Fiji',
'(GMT+12:00) New Caledonia' => 'Asia/Magadan',
'(GMT+12:00) Solomon Is.' => 'Asia/Magadan',
'(GMT+12:00) Wellington' => 'Pacific/Auckland',
'(GMT+13:00) Nuku\'alofa' => 'Pacific/Tongatapu'
);

if(!isset($_SESSION)) 
{ 
session_start(); 
} 
if(!isset($_SESSION['is_login'])){
	header("location: login.php");
?>
<script>
window.location="login.php";
</script>
<?php
}
?>
<style >
.btn-file {
    position: relative;
    overflow: hidden;
}
.btn-file input[type=file] {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 100%;
    min-height: 100%;
    font-size: 100px;
    text-align: right;
    filter: alpha(opacity=0);
    opacity: 0;
    outline: none;
    background: white;
    cursor: inherit;
    display: block;
}

.token-label {
max-width: fit-content !important;
}

</style>
				
			

				<!-- Toolbar -->
				<div class="navbar navbar-default navbar-xs navbar-component no-border-radius-top">
					<ul class="nav navbar-nav visible-xs-block">
						<li class="full-width text-center"><a data-toggle="collapse" data-target="#navbar-filter"><i class="icon-menu7"></i></a></li>
					</ul>

					<div class="navbar-collapse collapse" id="navbar-filter">
						<ul class="nav navbar-nav">
							<li class="active"><a href="#activity" data-toggle="tab"><i class="icon-menu7 position-left"></i> <span class="multi_lang">اعدادت النظام</span></a></li>
							<li><a href="#schedule" data-toggle="tab"><i class="icon-certificate position-left"></i> <span class="multi_lang">معلومات الشركة</span> </a></li>
							
						</ul>

						
					</div>
				</div>
				<!-- /toolbar -->


				<!-- User profile -->
			<div class="tabbable">
				<div class="tab-content">	
					<div class="tab-pane fade active in" id="activity">
						<!-- Share your thoughts -->
						<div class="panel panel-flat">
							<div class="panel-heading">
								<h6 class="panel-title multi_lang">اعدادات عامة</h6>
								
							</div>
							<div class="row">
							<div class="col-md-2">
								<i class="icon-office position-right text-primary" style="font-size: 100px; margin-left: 20px;"></i>
							</div>
								<!-- Advanced login -->
								<div class="col-md-8">
								<form id="system_info_form">

									<input type="hidden" id="userid" name="userid"  value="<?php echo $_SESSION['user_id']; ?>">
									<input type="hidden" id="access_token" name="access_token"  value="<?php echo $_SESSION['access_token']; ?>">

										<div class=" form-group has-feedback has-feedback-left form-group-material ">
											<label class="control-label multi_lang">اسم النظام</label>
											<input type="text" id="system_name" name="system_name" class="form-control multi_lang" placeholder="اسم النظام" value="<?php echo $_SESSION['SYSName']; ?>" readonly>
											<div class="form-control-feedback">
												<i class="icon-credit-card text-muted"></i>
											</div>
										</div>

										<div class=" form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">الاصدار</label>
											<input type="text" id="system_version" name="system_version" class="form-control multi_lang" placeholder="الاصدار" value="<?php echo $_SESSION['SYSVersion']; ?>" readonly>
											<div class="form-control-feedback">
												<i class="icon-versions text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">تاريخ التثبيت</label>
											<input type="text" id="setup_date" name="setup_date" class="form-control multi_lang" placeholder="تاريخ التثبيت" value="<?php echo $_SESSION['SYSSetupDate']; ?>" readonly>
											<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">
											<label class="control-label multi_lang">سعر صرف الدولار بالعملة المحلية (1$)</label>
											<input type="text" id="usd_rate" name="usd_rate" class="form-control multi_lang" placeholder="سعر صرف الدولار بالعملة المحلية (1$)" value="<?php echo $_SESSION['USD_TO_IQD']; ?>" >
											<div class="form-control-feedback">
												<i class=" icon-cash text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">التوقيت الزمني</label>
											<select name="time_zone" id="time_zone" class="form-control" dir="ltr">
												<?php 
													foreach ($timezones as $key => $value){
														echo '<option value="'.$value.'">'.$key.'</option>'; 
													}
												?>
											</select>
											<div class="form-control-feedback">
												<i class="icon-sphere text-muted"></i>
											</div>
										</div>

										<div class="form-group">
											<button type="submit" class="btn btn-primary btn-labeled btn-labeled-right" id="updateprofile"><span class="multi_lang">تحديث</span> <b><i class="icon-circle-right2"></i></b></button>
										</div>
								
								</form>
								<!-- /advanced login -->
								</div>
							</div>
								
						</div>
						<!-- /share your thoughts -->
					</div>

					<div class="tab-pane fade" id="schedule">
						<!-- Share your thoughts -->
						<div class="panel panel-flat">
							<div class="panel-heading">
								<h6 class="panel-title multi_lang">معلومات الشركة</h6>
							</div>
							<div class="row">
								<div class="col-md-2">
									<div class="media-left">
											<form  id="imageUploadFormPic"  enctype="multipart/form-data">
												<input type="hidden" id="type" name="type"  value="update_profile_image">
												<span class="btn btn-default btn-file" style="box-shadow: 0 0 3px rgba(0, 0, 0, 0); background-color: rgba(245, 245, 245, 0);">
													<a href="#" id="profileLink" class="profile-thumb">
													<?php if($_SESSION['profile_image']==null){  ?>
													<img src="image/profile/noimg.jpg" class="img-circle img-xl" alt="">
													<?php }else{ ?>
													<img src="<?php echo $_SESSION['company_logo']; ?>" class="img-circle img-xl" alt="" width="150">
													<?php } ?>
													<input type="file" id="profile_image" name="profile_image" class="bra">
													</a>
											 </span>

										  </form>
								</div>
							</div>
							
								<!-- Advanced login -->
								<div class="col-md-8">
								<form id="company_info_form">

										<input type="hidden" id="userid" name="userid"  value="<?php echo $_SESSION['user_id']; ?>">
										<input type="hidden" id="access_token" name="access_token" value="">

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">اسم الشركة</label>
											<input type="text" id="company_name" name="company_name" class="form-control multi_lang" placeholder="اسم الشركة" value="<?php echo $_SESSION['company_name']; ?>">
											<div class="form-control-feedback">
												<i class="icon-office text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">اسم مدير الشركة باللغة الانكليزية</label>
											<input type="text" id="manger_name_en" name="manger_name_en" class="form-control multi_lang" placeholder="اسم مدير الشركة باللغة الانكليزية" value="<?php echo $_SESSION['company_mngr_en']; ?>">
											<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">
											<label class="control-label multi_lang">اسم مدير الشركة باللغة العربية</label>
											<input type="text" id="manger_name_ar" name="manger_name_ar" class="form-control multi_lang" placeholder="اسم مدير الشركة باللغة العربية" value="<?php echo $_SESSION['company_mngr_ar']; ?>">
											<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">
											<label class="control-label multi_lang">اسم مدير الشركة باللغة الكوردية</label>
											<input type="text" id="manger_name_kr" name="manger_name_kr" class="form-control multi_lang" placeholder="اسم مدير الشركة باللغة الكوردية" value="<?php echo $_SESSION['company_mngr_ku']; ?>">
											<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">
											<label class="control-label multi_lang">عنوان الشركة</label>
											<input type="text" id="company_address" name="company_address" class="form-control multi_lang" placeholder="عنوان الشركة" value="<?php echo $_SESSION['company_address']; ?>">
											<div class="form-control-feedback">
												<i class="icon-location3 text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">الهاتف</label>
											<input type="text" id="company_phone" name="company_phone" class="form-control multi_lang" placeholder="الهاتف" value="<?php echo $_SESSION['company_phone']; ?>" dir="ltr">
											<div class="form-control-feedback">
												<i class=" icon-phone text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">البريد الالكتروني للشركة</label>
											<input type="text" id="company_email" name="company_email" class="form-control multi_lang" placeholder="البريد الالكتروني للشركة" value="<?php echo $_SESSION['company_email']; ?>">
											<div class="form-control-feedback">
												<i class="icon-mail5 text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">البريد الالكتروني للتنبيه</label>
											<input type="text" id="notify_email" name="notify_email" class="form-control tokenfield multi_lang" placeholder="البريد الالكتروني للتنبيه" value="<?php echo $_SESSION['notify_email']; ?>" >
											<div class="form-control-feedback">
												<i class="icon-mail5 text-muted"></i>
											</div>
										</div>
										

										<div class="form-group">
											<button type="submit" class="btn btn-primary btn-labeled btn-labeled-right"><span class="multi_lang">تحديث المعلومات</span> <b><i class="icon-circle-right2"></i></b></button>
										</div>
								
								</form>
								<!-- /advanced login -->
								</div>
							</div>
								
						</div>
						<!-- /share your thoughts -->
					</div>
				</div>	
			</div>
				<!-- /user profile -->
<script type="text/javascript" src="controllers/setting.js?random=<?php echo uniqid(); ?>"></script>

<script >
	$("#time_zone").val('<?php echo $_SESSION['SYSTimezone']; ?>');
</script>