<?php
include_once('c_rmt_check_s.php') ;
class c_page_cab_rmt_check_s2 extends c_page_cab_rmt_check_s
{
  var $step=2 ;
  public $h1='Сделайте фото автомобиля' ;

  function set_head_tags()
  { parent::set_head_tags() ;
    $this->HEAD['js'][]=_PATH_TO_EXT.'/rmt/jquery.webcamera_capture.js' ;
  }


  function block_main()
  { if (!$this->rec_personal['pkey']) return ;
    $this->page_title() ;
    ?><form><input type="hidden" name="check_id" value="<?echo _CUR_ID?>"><?
    $this->panel_photo() ;
    ?></form><?
  }

  function panel_photo()
  { ?><table id="panel_photo">
        <tr><td rowspan="5" class="camera"><?$this->panel_photo_capture(array('save_cmd'=>'rmt/save_step_2','rec'=>$this->rec_car)) ;?></td>
            <td id="img1" class="img"><img src="/<?echo _CLASS_?>/ext/rmt/images/taxi-icon-602136_1280.png"><br>Фото спереди</td></tr>
        <tr><td id="img2" class="img"><img src="/<?echo _CLASS_?>/ext/rmt/images/taxi-icon-602136_1280.png"><br>Фото справа</td></tr>
        <tr><td id="img3" class="img"><img src="/<?echo _CLASS_?>/ext/rmt/images/taxi-icon-602136_1280.png"><br>Фото сзади</td></tr>
        <tr><td id="img4" class="img"><img src="/<?echo _CLASS_?>/ext/rmt/images/taxi-icon-602136_1280.png"><br>Фото слева</td></tr>
        <tr><td id="img5" class="img"><img src="/<?echo _CLASS_?>/ext/rmt/images/taxi-icon-602136_1280.png"><br>Фото салона</td></tr>
    </table><div id=panel_debug></div><?
  }

 // iMac27:         doc: 1536x1220, win: 1536x1220
 // Android планшет doc: 1328x720, win: 1280x720
 // Android телефон doc: 1401x678, win: 980x480
 // iPhone6:        doc: 1392x658, win: 667x375
 function panel_photo_capture($options=array())
   { $rec=$options['rec'] ;
     //echo 'is_mobile='.is_mobile().'<br>' ;
    ?><script type="text/javascript" src="<?echo _PATH_TO_EXT.'/rmt/jquery.webcamera_capture.js'?>"></script>
      <script type="text/javascript" src="<?echo _PATH_TO_EXT.'/jquery/buzz.min.js'?>"></script>
       <div id="panel_photo_capture" <?if ($rec['_reffer']) echo 'reffer="'.$rec['_reffer'].'"'?>>
       <div id="div_capture">
           <div id="capture_area"><video id="video" autoplay=""></video></div>
           <div id="buttons"><button id="snap" save_cmd="<?echo $options['save_cmd']?>" check_id="<?echo _CUR_ID?>"></button></div>
           <div class="clear"></div>
           <div id="preview_area" class="hidden">
               <input type="hidden" id="capture_img_name" name="capture_img_name"><input type="hidden" id="x" name="x"><input type="hidden" id="y" name="y"><input type="hidden" id="w" name="w"><input type="hidden" id="h" name="h">
               <img id="capture_img" src="" class="hidden">
               <!--<img id="capture_img2" src="" class="float_left"><div id="crop_info"></div><div class="clear"></div>-->
               <canvas id="canvas" class="hidden" width="640" height="480"></canvas>
           <div class="buttons">
               <button id="repeat"></button>
               <button id="save" class=v2 cmd="<?echo $options['save_cmd']?>"></button>
           </div>
           </div>
       </div><br><br>
       <div class="center"><button class="v1" href="/cab/rmt/check/<?echo _CUR_ID?>/s3/">Пропустить фото</button></div>
       <script type="text/javascript">
         $j(document).ready(function (){$j('div#panel_photo_capture').webcamera_capture({zerkalo:false,dir_sounds:"<?echo _PATH_TO_EXT.'/rmt/sounds/'?>"}) ;}) ;
       </script>

     </div><?
  }



}

?>