<? global $vis_language; ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
   <div class="col-sm-6">
      <h3 class="m-b-xs text-black"><? echo $operation['view_title'];?></h3>
      <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
         <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
         <li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS']; ?></a></li>
         <li><a  class="link" href="#/setting/view_staff/<? echo $vis_language['TXTSTAFF'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSTAFF'];?>',{'vis_module':'setting','vis_operation':'view_staff'});" class="link"><? echo $operation['view_title']; ?></a> </li>
         <li class="active"><?echo $vis_language['TXTADDSTAFF'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDSTAFF']; ?></header>
      <form class="form-horizontal" data-validate="parsley" id="vis_staff_form" name="vis_staff_form" method="post" >
         <div class="panel-body">
            <div class="col-md-6">
               <div class="wrapper">
				   <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTINITIALS']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text" name="vis_initials" id="vis_initials" value="">
                     </div>
                  </div>
                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTFIRSTNAME']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text"  name="vis_firstname" id="vis_firstname" >
                     </div>
                  </div>
                   <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTLASTNAME']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text" name="vis_lastname" id="vis_lastname" value="">
                     </div>
                  </div>
                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTGENDER']; ?></label>
                     <div class="col-sm-10">
                        <select name="vis_gender" id="vis_gender" class="form-control input-sm selectpicker">
                           <option value="0"><? echo $vis_language['TXTMALE']; ?></option>
                           <option value="1"><? echo $vis_language['TXTFEMALE']; ?></option>
                        </select>
                     </div>
                  </div>
                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTMOBILENUMBER']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text" name="vis_mobile_number" id="vis_mobile_number" value="">
                     </div>
                  </div>
                  <div class="form-group">
				  <label class="col-sm-2 text-right"><? echo $vis_language['TXTTIMEZONE']; ?></label>
				  <div class="col-sm-10">
				  <span id="vis_staff_timezone_value"><? echo "GMT-12:00"; ?> <span class="vis_button label vh-success-bg m vis-pointer" onclick="$('#vis_staff_timezone_setting').toggle(); $('#vis_staff_timezone_value').toggle(); $('#vis_change_timezone').val(1); "><? echo $vis_language['TXTCHANGE']; ?></span></span><span id="vis_staff_timezone_setting" style="display:none">
					  <select name="vis_timezone" id="vis_timezone" class='form-control input-sm selectpicker' data-live-search="true">
							<option value="-12:00#International Date Line West">(GMT-12:00) International Date Line West</option>
							<option value="-11:00#Apia, Midway, Niue, Pago Pago" <?php ?>>(GMT-11:00) Apia, Midway, Niue, Pago Pago</option>
							<option value="-10:00#Fakaofo, Hawaii Time, Johnston, Rarotonga, Tahiti">(GMT-10:00) Fakaofo, Hawaii Time, Johnston, Rarotonga, Tahiti</option>
							<option value="-9:30#Marquesas, Alaska Time">(GMT-09:30) Marquesas, Alaska Time</option>
							<option value="-9:00#Gambier">(GMT-09:00) Gambier</option>
							<option value="-8:00#Pacific Time, Tijuana, Vancouver, Whitehorse, Pitcairn">(GMT-08:00) Pacific Time, Tijuana, Vancouver, Whitehorse, Pitcairn</option>
							<option value="-7:00#Mountain Time, Arizona, Chihuahua, Mazatlan">(GMT-07:00) Mountain Time, Arizona, Chihuahua, Mazatlan</option>
							<option value="-7:00#Dawson Creek, Edmonton, Hermosillo, Yellowknife">(GMT-07:00) Dawson Creek, Edmonton, Hermosillo, Yellowknife</option>
							<option value="-6:00#Belize, Central Time, Central Time, Mexico City, Regina, Winnipeg">(GMT-06:00) Belize, Central Time, Central Time, Mexico City, Regina, Winnipeg</option>
							<option value="-6:00#Costa Rica, Easter Island, El Salvador, Galapagos, Guatemala, Managua">(GMT-06:00) Costa Rica, Easter Island, El Salvador, Galapagos, Guatemala, Managua</option>
							<option value="-5:00#Bogota, Cayman, Eastern Time, Iqaluit, Montreal, Toronto, Grand Turk">(GMT-05:00) Bogota, Cayman, Eastern Time, Iqaluit, Montreal, Toronto, Grand Turk</option>
							<option value="-5:00#Guayaquil, Havana, Jamaica, Lima, Nassau, Panama, Port-au-Prince">(GMT-05:00) Guayaquil, Havana, Jamaica, Lima, Nassau, Panama, Port-au-Prince</option>
							<option value="-4:30#Caracas, Anguilla">(GMT-04:30) Caracas, Anguilla</option>
							<option value="-4:00#Antigua, Aruba, Asuncion, Atlantic Time - Halifax, Barbados, Bermuda">(GMT-04:00) Antigua, Aruba, Asuncion, Atlantic Time - Halifax, Barbados, Bermuda</option>
							<option value="-4:00#Boa Vista, Campo Grande, Cuiaba, Curacao, Dominica, Grenada, Guadeloupe, Guyana, La Paz, Manaus">(GMT-04:00) Boa Vista, Campo Grande, Cuiaba, Curacao, Dominica, Grenada, Guadeloupe, Guyana, La Paz, Manaus</option>
							<option value="-4:00#Martinique, Montserrat, Palmer, Port of Spain, Porto Velho, Puerto Rico, Rio Branco, Santiago">(GMT-04:00) Martinique, Montserrat, Palmer, Port of Spain, Porto Velho, Puerto Rico, Rio Branco, Santiago</option>
							<option value="-4:00#Santo Domingo, St. Kitts, St. Lucia, St. Thomas, St. Vincent, Stanley, Thule, Tortola">(GMT-04:00) Santo Domingo, St. Kitts, St. Lucia, St. Thomas, St. Vincent, Stanley, Thule, Tortola</option>
							<option value="-3:30#Newfoundland Time - St. Johns, Araguaina">(GMT-03:30) Newfoundland Time - St. Johns, Araguaina</option>
							<option value="-3:00#Belem, Buenos Aires, Cayenne, Fortaleza, Godthab, Maceio">(GMT-03:00) Belem, Buenos Aires, Cayenne, Fortaleza, Godthab, Maceio</option>
							<option value="-3:00#Miquelon, Montevideo, Paramaribo, Recife, Rothera, Salvador, Sao Paulo">(GMT-03:00) Miquelon, Montevideo, Paramaribo, Recife, Rothera, Salvador, Sao Paulo</option>
							<option value="-2:00#Noronha, South Georgia">(GMT-02:00) Noronha, South Georgia</option>
							<option value="-1:00#Azores, Cape Verde, Scoresbysund">(GMT-01:00) Azores, Cape Verde, Scoresbysund</option>
							<option value="+0:00#Abidjan, Accra, Bamako, Banjul, Bissau">(GMT+00:00) Abidjan, Accra, Bamako, Banjul, Bissau</option>
							<option value="+0:00#Canary Islands, Casablanca, Conakry, Dakar, Danmarkshavn, Dublin, El Aaiun, Faeroe, Freetown, Lisbon, Lome">(GMT+00:00) Canary Islands, Casablanca, Conakry, Dakar, Danmarkshavn, Dublin, El Aaiun, Faeroe, Freetown, Lisbon, Lome</option>
							<option value="+0:00#London, Monrovia, Nouakchott, Ouagadougou, Reykjavik, Sao Tome, St Helena">(GMT+00:00) London, Monrovia, Nouakchott, Ouagadougou, Reykjavik, Sao Tome, St Helena</option>
							<option value="+1:00#Algiers, Amsterdam, Andorra, Bangui, Berlin">(GMT+01:00) Algiers, Amsterdam, Andorra, Bangui, Berlin</option>
							<option value="+1:00#Brazzaville, Brussels, Budapest, Central European Time, Central European Time">(GMT+01:00) Brazzaville, Brussels, Budapest, Central European Time, Central European Time</option>
							<option value="+1:00#Ceuta, Copenhagen, Douala, Gibraltar, Kinshasa, Lagos, Libreville, Luanda, Luxembourg">(GMT+01:00) Ceuta, Copenhagen, Douala, Gibraltar, Kinshasa, Lagos, Libreville, Luanda, Luxembourg</option>
							<option value="+1:00#Madrid, Malabo, Malta, Monaco, Ndjamena, Niamey, Oslo, Paris, Porto-Novo, Rome">(GMT+01:00) Madrid, Malabo, Malta, Monaco, Ndjamena, Niamey, Oslo, Paris, Porto-Novo, Rome</option>
							<option value="+1:00#Stockholm, Tirane, Tunis, Vaduz, Vienna, Warsaw, Windhoek, Zurich">(GMT+01:00) Stockholm, Tirane, Tunis, Vaduz, Vienna, Warsaw, Windhoek, Zurich</option>
							<option value="+2:00#Amman, Athens, Beirut, Blantyre, Bucharest, Bujumbura">(GMT+02:00) Amman, Athens, Beirut, Blantyre, Bucharest, Bujumbura</option>
							<option value="+2:00#Cairo, Chisinau, Damascus, Gaborone, Gaza, Harare, Helsinki, Istanbul">(GMT+02:00) Cairo, Chisinau, Damascus, Gaborone, Gaza, Harare, Helsinki, Istanbul</option>
							<option value="+2:00#Jerusalem, Johannesburg, Kiev, Kigali, Lubumbashi, Lusaka, Maputo, Maseru">(GMT+02:00) Jerusalem, Johannesburg, Kiev, Kigali, Lubumbashi, Lusaka, Maputo, Maseru</option>
							<option value="+2:00#Mbabane, Minsk, Moscow-01 - Kaliningrad, Nicosia">(GMT+02:00) Mbabane, Minsk, Moscow-01 - Kaliningrad, Nicosia</option>
							<option value="+2:00#Riga, Sofia, Tallinn, Tripoli, Vilnius">(GMT+02:00) Riga, Sofia, Tallinn, Tripoli, Vilnius</option>
							<option value="+3:00#Addis Ababa, Aden, Antananarivo">(GMT+03:00) Addis Ababa, Aden, Antananarivo</option>
							<option value="+3:00#Asmera, Baghdad, Bahrain, Comoro, Dar es Salaam, Djibouti">(GMT+03:00) Asmera, Baghdad, Bahrain, Comoro, Dar es Salaam, Djibouti</option>
							<option value="+3:00#Kampala, Khartoum, Kuwait, Mayotte, Mogadishu, Moscow+00">(GMT+03:00) Kampala, Khartoum, Kuwait, Mayotte, Mogadishu, Moscow+00</option>
							<option value="+3:00#Nairobi, Qatar, Riyadh, Syowa">(GMT+03:00) Nairobi, Qatar, Riyadh, Syowa</option>
							<option value="+3:30#Tehran">(GMT+03:30) Tehran</option>
							<option value="+4:00#Baku, Dubai, Mahe, Mauritius, Moscow+01 - Samara">(GMT+04:00) Baku, Dubai, Mahe, Mauritius, Moscow+01 - Samara</option>
							<option value="+4:00#Muscat, Reunion, Tbilisi, Yerevan">(GMT+04:00) Muscat, Reunion, Tbilisi, Yerevan</option>
							<option value="+4:30#Kabul">(GMT+04.30) Kabul</option>
							<option value="+5:00#Aqtau, Aqtobe, Ashgabat, Dushanbe">(GMT+05:00) Aqtau, Aqtobe, Ashgabat, Dushanbe</option>
							<option value="+5:00#Karachi, Kerguelen, Maldives, Moscow+02 - Yekaterinburg, Tashkent">(GMT+05:00) Karachi, Kerguelen, Maldives, Moscow+02 - Yekaterinburg, Tashkent</option>
							<option value="+5:30#Colombo, India Standard Time">(GMT+05:30) Colombo, India Standard Time</option>
							<option value="+6:00#Almaty, Bishkek, Chagos, Dhaka, Mawson">(GMT+06:00) Almaty, Bishkek, Chagos, Dhaka, Mawson</option>
							<option value="+6:00#Moscow+03 - Omsk, Novosibirsk, Thimphu, Vostok">(GMT+06:00) Moscow+03 - Omsk, Novosibirsk, Thimphu, Vostok</option>
							<option value="+6:30#Cocos, Rangoon">(GMT+06:30) Cocos, Rangoon</option>
							<option value="+7:00#Bangkok, Christmas, Davis, Hanoi, Hovd, Jakarta">(GMT+07:00) Bangkok, Christmas, Davis, Hanoi, Hovd, Jakarta</option>
							<option value="+7:00#Moscow+04 - Krasnoyarsk, Phnom Penh, Vientiane">(GMT+07:00) Moscow+04 - Krasnoyarsk, Phnom Penh, Vientiane</option>
							<option value="+8:00#Brunei, Casey, China Time - Beijing, Choibalsan">(GMT+08:00) Brunei, Casey, China Time - Beijing, Choibalsan</option>
							<option value="+8:00#Hong Kong, Kuala Lumpur, Macau, Makassar, Manila, Moscow+05 - Irkutsk">(GMT+08:00) Hong Kong, Kuala Lumpur, Macau, Makassar, Manila, Moscow+05 - Irkutsk</option>
							<option value="+8:00#Singapore, Taipei, Ulaanbaatar, Western Time - Perth">(GMT+08:00) Singapore, Taipei, Ulaanbaatar, Western Time - Perth</option>
							<option value="+9:00#Dili, Jayapura, Moscow+06 - Yakutsk, Palau, Pyongyang, Seoul, Tokyo">(GMT+09:00) Dili, Jayapura, Moscow+06 - Yakutsk, Palau, Pyongyang, Seoul, Tokyo</option>
							<option value="+9:30#Central Time - Adelaide, Central Time - Darwin">(GMT+09:30) Central Time - Adelaide, Central Time - Darwin</option>
							<option value="+10:00#Eastern Time, Brisbane, Hobart, Melbourne, Sydney, Guam">(GMT+10:00) Eastern Time, Brisbane, Hobart, Melbourne, Sydney, Guam</option>
							<option value="+10:00#Moscow+07 - Yuzhno-Sakhalinsk, Port Moresby, Saipan, Truk">(GMT+10:00) Moscow+07 - Yuzhno-Sakhalinsk, Port Moresby, Saipan, Truk</option>
							<option value="+11:00#Efate, Guadalcanal, Kosrae, Moscow+08 - Magadan, Noumea, Ponape">(GMT+11:00) Efate, Guadalcanal, Kosrae, Moscow+08 - Magadan, Noumea, Ponape</option>
							<option value="+12:00#Antarctica/McMurdo, Antarctica/South_Pole, Auckland, Fiji">(GMT+12:00) Antarctica/McMurdo, Antarctica/South_Pole, Auckland, Fiji</option>
							<option value="+12:00#Funafuti, Kwajalein, Majuro, Moscow+09 - Petropavlovsk-Kamchatskiy, Nauru, Tarawa, Wake, Wallis">(GMT+12:00) Funafuti, Kwajalein, Majuro, Moscow+09 - Petropavlovsk-Kamchatskiy, Nauru, Tarawa, Wake, Wallis</option><option value="+13:0#Enderbury, Tongatapu">(GMT+13:00) Enderbury, Tongatapu</option>
						</select>
				  </div>
			   </div>	
                  <div class="form-group">
                     <label class="col-sm-5 control-label"><? echo $vis_language['TXTASGNDEPT']; ?></label>
                     <div class="col-sm-14">
                        <div class="radio i-checks m-r-lg pull-left"><label>
                        <input type="radio" name="vis_access" checked="checked" id="vis_access_yes" value="0"/><i></i>
                        <? echo $vis_language['TXTYES']; ?></label></div>
                        <div class="radio i-checks m-r-lg pull-left"><label>
                        <input type="radio" name="vis_access" id="vis_access_no" value="1"/><i></i>
                        <? echo $vis_language['TXTNO']; ?>
                        </label></div>
                     </div>
                  </div>
               </div>
            </div>
            <div class="col-md-6">
               <div class="wrapper">
                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTEMAIL']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text" name="vis_email" id="vis_email" value="" >
                     </div>
                  </div>
                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTUSERNAME']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text" name="vis_username" id="vis_username" value="">
                     </div>
                  </div>

                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTTEAM']; ?></label>
                     <div class="col-sm-10">
                        <select name="vis_group" id="vis_group" class="form-control input-sm selectpicker" <? if(count($staff_group)>10) echo 'data-live-search="true"';?>><?
                           for($i=0;$i<count($staff_group);$i++) echo '<option value="'.$staff_group[$i]['group_id'].'">'.$staff_group[$i]['group_name'].'</option>'; ?>
                        </select>
                     </div>
                  </div>
                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTJOBTITLE']; ?></label>
                     <div class="col-sm-10">
                        <input class="form-control input-sm" type="text" name="vis_job_title" id="vis_job_title" value="">
                     </div>
                  </div>
                   <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><?=$vis_language['TXTSENDLOGINDETAILS']?></label>
                     <div class="col-sm-10">
                        <select name="vis_send_email" class="form-control input-sm selectpicker" <? if(count($email_templates)>10) echo 'data-live-search="true"';?>>
                           <option value="0"><?=$vis_language['TXTDONOTSENDEMAIL']?></option>
                           <?php if($email_templates!=-1) for($i=0;$i<count($email_templates);$i++) echo '<option value="'.$email_templates[$i]['etemplate_id'].'">'.$email_templates[$i]['etemplate_name'].'</option>'; ?>
                        </select>
                     </div>
                  </div>
                  <div class="form-group">
               <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTSTATUS']; ?></label>
               <div class="col-sm-1">
                  <label class="switch">
                  <input type="checkbox" checked="checked" name="vis_status"  id="vis_status">
                  <span ></span>
                  </label>
               </div>
            </div>
               </div>
            </div>
            </div>
				<div id="department_access" >
					  <label class="col-sm-12"><div class="line b-b line-lg pull-in"></div></label>
                     <div class="form-group">
                        <label class="col-sm-2 control-label"><? echo $vis_language['TXTDEPARTMENTACCESS']; ?></label>
                        <div class="col-sm-10">
                           <label class="checkbox-inline i-checks">
                           <input type="checkbox"  value="0" id="vis_department_all" name="vis_department_all"  checked="checked" onchange="toggle_dept_list();" <? if($department_details['department_access']==0) echo ' checked="checked"'; ?>><i></i> <? echo $vis_language['TXTALLDEPARTMENTS']; ?>
                           </label>
                        </div>
                     </div>

					<div id="vis_dept_list_section" class="form-group" style="<?= ($department_details['department_access']==0)?'display:none':'';?>">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-10">
							<div class="dept_access_list">
                           <? $dept_list=array();
                              for($i=0;$i<count($department_details);$i++) { ?>
                           <label class="checkbox-inline i-checks">
                           <input type="checkbox"  value="<? echo $department_details[$i]['department_id']; ?>" id="vis_department" name="vis_department[]" /> <i></i><? echo $department_details[$i]['domain_name'].' :: '.$department_details[$i]['department_name']; ?></label><br/>
                           <?
                              $dept_list[]=$department_details[$i]['department_id'];
                              } ?>
							</div>
                         </div>
                     </div>
                        <div class="form-group">
						   <label class="col-sm-2 control-label"><? echo $vis_language['TXTSCHEDULE']; ?></label>
						   <div class="col-sm-10">
							  <select name="vis_schedule_id" id="vis_schedule_id" class="form-control input-sm selectpicker"  <? if(count($schedule)>10) echo 'data-live-search="true"';?>>
								 <? for($i=0;$i<count($schedule);$i++) echo '<option value="'.$schedule[$i]['schedule_id'].'">'.$schedule[$i]['schedule_name'].'</option>'; ?>
							  </select>
						</div>
            </div>
				</div>
            <input type="hidden" name="vis_department_count" id="vis_department_count" value="<? echo count($department_details); ?>" />
            <input type="hidden" name="vis_group_id" id="vis_group_id" value="<? echo $staffgroup_details['group_id']; ?> " />
            <input type="hidden" name="vis_change_timezone" id="vis_change_timezone" value="1" />
      </form>
      <div class="padder">
		         <div class="line b-b line-lg pull-in"></div>
			<br/>
         <div class="col-sm col-sm-offset-2">
            <button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'add_staff', 'vis_form':'vis_staff_form' })"><? echo $vis_language['TXTADD']; ?></button>
         </div><br/>
      </div>
   </section>
</section>
<script type="text/javascript">
	var tes = '<? echo calulate_timezone($staff['timezone'])."#".$staff['timezone_name']; ?>';
    $("#vis_timezone").val(tes);
   if ($(vis_access_yes).is(":checked"))
   {
    $('#department_access').hide();
   }
    $(document).ready(function () {
     $('#vis_access_yes').click(function () {
     $('#department_access').hide();
     });
     $('#vis_access_no').click(function () {
     $('#department_access').show();
   });
  });
  $(".selectpicker").selectpicker();
   function toggle_dept_list(){
       if($('#vis_department_all').is(":checked")){ $('#vis_dept_list_section').hide();
							}else{ $('#vis_dept_list_section').show();
							$('.dept_access_list').each(function(index) {
        $(this).find('input[type="checkbox"]').removeAttr('checked');
       });
							}
   }
   function toggleType() {
    var obj = document.getElementById('vis_password');
    if (obj.type == 'text') {
        obj.type = 'password';
    } else {
        obj.type = 'text';
    }
}
</script>
