<?php
include_once('c_rmt_check_s.php') ;
class c_page_cab_rmt_check_s1 extends c_page_cab_rmt_check_s
{
  var $step=1 ;
  public $h1='Подтверждение личности водителя' ;

  function block_main()
  { ?><div id="panel_filter"><form id="sky-form" class="sky-form"><input type="hidden" name="check_id" value="<?echo _CUR_ID?>">
        <table id="panel_check_info">
              <tr><td class="col1"><?$this->panel_driver_photo();
                                     $this->panel_driver_apply() ;
                                   ?>
                  </td>
                  <td class="col2"><?$this->panel_driver_info($this->rec_personal);
                                     $this->panel_car_info($this->rec_car);
                      ?></td>
              </tr>
        </table>
     </form></div>
     <style type="text/css">
       table#panel_check_info{font-size:22px;width:100%;}
       table#panel_check_info table.table_tr_line td:first-child{text-align:left;font-weight:normal;}
       table#panel_check_info table.table_tr_line div.title{font-size:13px;;text-transform:uppercase;color:#555555;margin-bottom:5px;}
       div#panel_driver_photo{text-align:center;}
       div#panel_driver_apply{text-align:center;}
     </style>
   <?
  }
    
  function menu_config()
  {
     $this->menu[_CUR_PAGE_DIR]='Подтверждение личности водителя' ;
     $this->menu['/cab/rmt/']=array('title'=>'Закрыть') ;
  }


 function panel_driver_apply()
 {  if ($this->rec_mo['dopusk']==1)
    {?><div id="panel_driver_apply">
        <label class="ios7-switch" style="font-size: 22px;">
              <input type="hidden" name="aa1" value="0">
              <input type="checkbox" name="aa1" id="aa1" value="1">
              <span></span><br>Личность  подтверждаю
       </label><br><br><br><br>
       <button id=next_step class="button v2" cmd="rmt/save_step_1" disabled style="float:none;margin:0 auto;width:100px;height:50px;font-size:20px;">Далее</button>
          <script type="text/javascript">
              $j('input#aa1').click(function()
                { if (!$j(this).is(':checked')) $j('button#next_step').attr('disabled',true) ;
                  else                $j('button#next_step').attr('disabled',false) ;
                })
          </script>
    </div>
    <?}
 }

function panel_driver_photo()
{  ?><div id="panel_driver_photo"><img class="shadow main" src="<?echo img_clone($this->rec_personal,'200')?>">

      </div>
   <?
}

function panel_driver_info($rec_personal,$options=array())
{ ?><div id="panel_driver_info" reffer="<?echo $rec_personal['_reffer']?>"><!--<h2><i class="fa fa-id-card-o blue" aria-hidden="true"></i> Информация по водителю</h2>--><?
   ?><table class="table_tr_line">
     <tr><td><div class="title">ФИО:</div><?echo $rec_personal['obj_name']?></td></tr>
     <tr><td><div class="title">Дата рождения:</div><?echo $rec_personal['dr']?></td></tr>
     <tr><td><div class="title">Возраст:</div><?echo $rec_personal['age']?></td></tr>
     <tr><td><div class="title">Организация:</div><?echo $rec_personal['_org_name']?></td></tr>
     <tr><td><div class="title">Подразделение:</div><?echo mb_substr(0,100,$rec_personal['_otdel_name'])?></td></tr>
    </table>
    </div><?
}

function panel_car_info($rec_car,$options=array())
{ ?><div id="panel_driver_info" reffer="<?echo $rec_car['_reffer']?>"><!--<h2><i class="fa fa-bus blue" aria-hidden="true"></i> Информация по автомобилю</h2>--><?
   ?><table class="table_tr_line">
     <tr><td><div class="title">Номер автомобиля:</div><?echo $rec_car['obj_name']?></td></tr>
     <tr><td><div class="title">Марка:</div><?echo $rec_car['model']?></td></tr>
     <tr><td><div class="title">Лицензия:</div><?echo $rec_car['permit']?></td></tr>
     <tr><td><div class="title">Срок действия ОСАГО:</div><? if ($rec_car['e_osago']) echo date('d.m.Y',$rec_car['e_osago'])?></td></tr>
     <tr><td><div class="title">Срок действия СТС:</div><? if ($rec_car['e_sts']) echo date('d.m.Y',$rec_car['e_sts'])?></td></tr>
     <tr><td><div class="title">Дата окончания ГТО:</div><? if ($rec_car['e_to']) echo date('d.m.Y',$rec_car['e_to'])?></td></tr>
    </table>
   </div><?
}

function panel_MO_info()
{ ?><div id="panel_MO_info"><h2><i class="fa fa-heartbeat blue" aria-hidden="true"></i> Информация по МО</h2><?
  if ($this->rec_mo['pkey'])
  {?><table class="table_tr_line">
     <tr><td>Дата проведения:</td><td><?echo date('d.m.Y H:i:s',$this->rec_mo['c_data'])?></td></tr>
     <tr><td>ID:</td><td><?echo $this->rec_mo['pkey']?></td></tr>
     <tr><td>Результат МО:</td><td class="status_<?echo $this->rec_mo['dopusk']?>"><?/*if ($this->rec_mo['dopusk']) echo $this->rec_mo['_dopusk_name_full'] ; else echo $this->rec_mo['_comment'] */ echo $this->rec_mo['_dopusk_status']?></td></tr>
     <tr><td>МО пройден на:</td><td><?echo $this->rec_mo['terminal_name']?></td></tr>
     <tr><td>МО провел:</td><td><?echo $this->rec_mo['_doctor_name']?></td></tr>
     <!--<tr><td>Допуск:</td><td><?echo $this->rec_mo['_dopusk_status']?></td></tr>-->
    </table>
    <br>
  <?
    if ($this->rec_mo['dopusk']!=1) {?><div class="alert">Проведение ТО невозможно по результатам МО</div><?}
  } 
  else 
      
      echo '<br><div class="alert_MO">МО не проводился</div><div class="alert_comment">проведение ТО заблокировано</div>' ;
  ?></div>
    <script type="text/javascript">
        $j(document).ready(function()
        { $j('div#panel_MO_info img').hover(panel_image_preview_on,panel_image_preview_off) ;
        }) ;
    </script>


  <?

}

function panel_img_mo_view()
 { $recs_img=execSQL('select alt as id,pkey,tkey,obj_name,file_name from obj_site_personals_image where parent='.$this->rec_personal['pkey']) ;
   ?><table id="panel_img_view" reffer="<?echo $this->rec_to['_reffer']?>"><tr><th>Фото водителя</th><th>Фото машины 1</th><th>Фото машины 2</th><th>Фото машины 3</th></tr>
          <tr>
              <td><? if ($this->rec_personal['_ext_info']['UlrPhotoDriver']) {?><img width=300 src="<?echo img_clone($recs_img['PhotoDriver'])?>"><?}?></td>
              <td><? if ($this->rec_personal['_ext_info']['UlrPhotoCar1']) {?><img width=300 src="<?echo img_clone($recs_img['PhotoCar1'])?>"><?}?></td>
              <td><? if ($this->rec_personal['_ext_info']['UlrPhotoCar2']) {?><img width=300 src="<?echo img_clone($recs_img['PhotoCar2'])?>"><?}?></td>
              <td><? if ($this->rec_personal['_ext_info']['UlrPhotoCar3']) {?><img width=300 src="<?echo img_clone($recs_img['PhotoCar3'])?>"><?}?></td>
       </tr>
      </table>
   <?
 }


}

?>