<?
function panel_personal_info($rec,$options=array())
{ ?><div id="panel_personal_info" reffer="<?echo $rec['_reffer']?>"><?
   ?><table class="info">
     <tr><th colspan="2">Личные данные</th></tr>
     <tr><td>ФИО:</td><td><strong id="name"><?echo $rec['obj_name']?></strong></td></tr>
     <tr><td>Пол:</td><td id="pol"><?echo (!$rec['pol'])? 'Мужской':'Женский'?></td></tr>
     <?if ($GLOBALS['LS_person_use_dr']){?><tr><td>Дата рождения:</td><td id="dr"><?echo $rec['dr']?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_dr']){?><tr><td>Возраст:</td><td id="age"><?echo $rec['age']?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_email']){?><tr><td>E-mail:</td><td id="age"><?echo $rec['email']?></td></tr><?}?>
     <tr><th colspan="2">Идентификаторы</th></tr>
     <?if ($GLOBALS['LS_person_use_propusk']){?><tr><td>Пропуск:</td><td id="propusk"><?echo $rec['propusk']?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_driving']){?><tr><td>Водительское удостоверение:</td><td id="driving"><?echo $rec['driving']?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_driving']){?><tr><td>Дата выдачи ВУ:</td><td id="driving" data-testId="drivingDate"><?echo ($rec['driving_date'])?date('d.m.Y',$rec['driving_date']):'';?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_driving']){?><tr><td>Срок действия ВУ:</td><td id="driving" data-testId="drivingValidityPeriod"><?echo ($rec['driving_validity_period'])?date('d.m.Y',$rec['driving_validity_period']):'';?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_tab_number']){?><tr><td>Табельный номер:</td><td id="tab_number"><?echo $rec['tab_number']?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_tab_number']){?><tr><td>СНИЛС:</td><td id="tab_number"><?echo $rec['snils']?></td></tr><?}?>
     <?if ($GLOBALS['LS_person_use_propusk']){?><tr><td>UID ФЛ:</td><td id="uid_fl"><?echo $rec['uid']?></td></tr><?}?>
     <!--<tr><td>HR_ID:</td><td><?if ($rec['HR_ID']) echo $rec['HR_ID'] ;?></td></tr>-->
     <?if ($rec['s_medspravka']) { ?><tr><td>Срок выдачи медсправки:</td><td  id="s_medspravka"><?echo date('d.m.Y',$rec['s_medspravka']) ; ?></td></tr><?}?>
     <?if ($rec['PersonLicense']) { ?><tr><td>Номер лицензии на вид деятельности:</td><td id="PersonLicense"><?echo $rec['PersonLicense'] ; ?></td></tr><?}?>
    </table>
    <div class="buttons sky-form no_box_shadow"><?
        if ($options['button']['med_card']){?><button class="button v1" href="<?echo $rec['__href']?>" id="button_med_card">Медицинская карточка сотрудника</button><?}
        if ($options['button']['pupilometr'] and $rec['_pupilomeria_cnt']){?><button class="button v1"  href="<?echo $rec['__href'].'pp/'; ?>" id="button_pp">Пупиллометрия</button><?}
        if ($rec['enabled'] and $options['button']['change_photo'] and is_member_right('personal_change_photo')) {?><button id=make_photo class="button v2" cmd="webcamera_capture/get_panel_photo_capture" id="button_photo_from_camera">Фото c камеры</button><?}
        if ($rec['enabled'] and $options['button']['change_photo'] and is_member_right('personal_change_photo')) {?><button class="button v2" cmd="aspmo_personal/get_panel_upload_photo" id="button_upload_photo">Загрузить фото</button><?}
        if ($options['button']['change_info'] and is_member_right('personal_change_info')) {?><button class="button v2" cmd="aspmo_personal/get_panel_personal_edit_info"  id="button_edit">Редактировать</button><?}
        if (function_exists('FACEID'))
        { $is_faceid=FACEID()->check_faceid_photo($rec['pkey']) ;
	      if ($GLOBALS['LS_faceid_view_info'] and !$is_faceid) {?><button class="button v2" cmd="faceid/set_faceid" personal_id="<?echo $rec['pkey']?>" id="button_edit">Задать FaceID фото</button><?}
	      if ($GLOBALS['LS_faceid_view_info'] and $is_faceid) {?><button class="button v2" cmd="faceid/clear_faceid" personal_id="<?echo $rec['pkey']?>" id="button_edit">Сбросить FaceID фото</button><?}
        }
   ?><div class="clear"></div></div>
 </div><?
  //damp_array($rec) ;
}

function panel_personal_working($rec,$options=array())
{ $work_main=execSQL_van('select * from view_workers where personal_id='.$rec['pkey'].' and is_main=1') ;
  $work_second=execSQL_van('select * from view_workers where personal_id='.$rec['pkey'].' and is_second=1') ;
  if (!_sizeof($work_main)) $work_main=$rec ;
  ?><div id="panel_personal_info" reffer="<?echo $rec['_reffer']?>"><?
   ?><table class="info">
      <tr><th colspan="2">Основное место работы</th></tr>
      <tr><td>Организация:</td><td class="left" id="worker_main_org_name"><?echo $work_main['_org_name']?></td></tr>
      <tr><td>Подразделение:</td><td class="left" id="worker_main_otdel_name"><?echo PERSONAL()->get_full_dep_name_by_dep_levels($work_main) /* $work_main['_otdel_name']*/?></td></tr>
      <tr><td>Должность:</td><td class="left" id="worker_main_work_name"><?echo $work_main['_work_name'] ;?></td></tr>
      <tr><td>Дата начала работы:</td><td class="left"  id="worker_main_job_data"><?echo ($work_main['job_data'])? date('d.m.Y H:i',$work_main['job_data']):date('d.m.Y',$work_main['c_data']) ;?></td></tr>
    <?if ($work_main['fired_data_pause']) {?><tr><td>Отложенное увольнение:</td><td class="left"><span class="back-red"  id="worker_main_fired_data_pause">до <?echo date('d.m.Y  H:i',$work_main['fired_data_pause'])?></span></td></tr><?}
      elseif ($work_main['enabled'] and $work_main['fired_data']>0){?><tr><td>Предстоящее увольнение:</td><td class="left" ><span class="back-red" >с <?echo date('d.m.Y',$work_main['fired_data'])?></span></td></tr><?}
      if (!$work_main['enabled']) {?><tr><td>Уволен:</td><td class="left"><span class="back-red"  id="worker_main_fired_data">c <?echo date('d.m.Y',$work_main['fired_data'])?></span></td></tr><?}?>
      <tr><td>UID СО:</td><td class="left" id="worker_main_UID"><?echo $work_main['uid']?></td></tr>
    <?if ($work_second['pkey']){?>
      <tr><th colspan="2">Совмещение</th></tr>
      <tr><td>Организация:</td><td class="left" id=" id="worker_second_org_name""><?echo $work_second['_org_name']?></td></tr>
      <tr><td>Подразделение:</td><td class="left"  id="worker_second_otdel_name"><?echo $work_second['_otdel_name']?></td></tr>
      <tr><td>Должность:</td><td class="left"  id="worker_second_work_name"><?echo $work_second['_work_name']  ;?></td></tr>
      <tr><td>Дата начала работы:</td><td class="left" id="worker_second_job_data"><?echo ($work_second['job_data'])? date('d.m.Y H:i',$work_second['job_data']):date('d.m.Y',$work_second['c_data']) ;?></td></tr>
    <?if ($work_second['fired_data_pause'] and $work_second['fired_data_pause']>0) {?><tr><td>Отложенное увольнение:</td><td class="left"><span class="back-red" id="worker_second_fired_data_pause">до <?echo date('d.m.Y H:i',$work_second['fired_data_pause'])?></span></td></tr><?}
      elseif ($work_second['enabled'] and $work_second['fired_data']>0){?><div class="personal_fired_pause">Предстоящее увольнение<br><span>с <?echo date('d.m.Y',$work_second['fired_data'])?></span></div><?}
      if (!$work_second['enabled']) {?><tr><td>Уволен:</td><td class="left"><span class="back-red" id="worker_second_fired_data">c <?echo date('d.m.Y',$work_second['fired_data'])?></span></td></tr><?}?>
      <tr><td>UID СО:</td><td class="left"  id="worker_second_UID"><?echo $work_second['uid']?></td></tr>
    <?}?>
      <tr><th colspan="2">Ограничения</th></tr>
      <tr><td>Проход всегда:</td><td id="full_access"><?echo ($rec['full_access'])? 'Да':'-'?></td></tr>
      <tr><td>Без ограничения по МО:</td><td  id="demo_access"><?echo ($rec['demo_access'])? 'Да':'-'?></td></tr>
    </table>
   </div><?
  //damp_array($rec) ;
}

?>
