<?php
include_once("c_esmo_setting_group_of_disease.php");
class c_page_cab_esmo_setting_group_of_disease_rules extends c_page_cab_esmo_setting_group_of_disease
{
 public $h1='Редактирование правил группы по болезни' ;
 public $rec_group ;

 function select_obj_info()
 { parent::select_obj_info() ;
   if ($this->rec_group['pkey']) $this->h1.='" - редактирование правил' ;
 }


 function block_main()
 {   $this->page_title() ;
     ?>
     <h2>Уточнения критериев оценки сотрудника при прохождении МО</h2>
     <p class="strong">Выберите и задайте критерии, которые будет применятся к сотрудникам данной группы</p>
     <?
     $this->panel_rules_edit() ;

 }


function panel_rules_edit($options=array())
{ $rec=$this->rec_group ;
  //damp_array($rec,1,-1) ;
  ?><div id="panel_rules_edit">
    <form>
        <label><input type="hidden" name="rule[ext_info][mo_denited]" value="0"><input type="checkbox" name="rule[ext_info][mo_denited]" value="1" <?if ($rec['_ext_info']['mo_denited']) echo 'checked'?>> <strong>Запрет прохождения МО</strong></label><br>
        <label><input type="hidden" name="rule[ext_info][use_PMO]" value="0"><input type="checkbox" name="rule[ext_info][use_PMO]" value="1" <?if ($rec['_ext_info']['use_PMO']) echo 'checked'?>> <strong>Использовать для ПМО</strong></label><br>
         <table class="basic fz_small auto">
            <tr><th>Параметр</th><th>Использовать</th><th>Минимальное значение для "<?echo $this->rec_group['obj_name']?>"</th><th>Максимальное значение для "<?echo $this->rec_group['obj_name']?>"</th></tr>
            <tr><td class="bold">Давление систолическое</td>
                <td><input type="hidden" name="rule[s]" value="0"><input class="toogle_enabled" type="checkbox" name="rule[s]" value="1" <?if ($rec['s']) echo 'checked'?>></td>
                <td><input type="text" class="s" name="rule[s_min]" value="<?echo $rec['s_min']?>" <?if (!$rec['s']) echo 'disabled'?> data-mask="000" data-mask-selectonfocus="true"></td>
                <td><input type="text" class="s" name="rule[s_max]" value="<?echo $rec['s_max']?>" <?if (!$rec['s']) echo 'disabled'?> data-mask="000" data-mask-selectonfocus="true"></td>
            </tr>
            <tr><td class="bold">Давление диастолическое</td>
                <td><input type="hidden" name="rule[d]" value="0"><input class="toogle_enabled" type="checkbox" name="rule[d]" value="1" <?if ($rec['d']) echo 'checked'?>></td>
                <td><input type="text" class="d" name="rule[d_min]" value="<?echo $rec['d_min']?>" <?if (!$rec['d']) echo 'disabled'?> data-mask="000" data-mask-selectonfocus="true"></td>
                <td><input type="text" class="d" name="rule[d_max]" value="<?echo $rec['d_max']?>" <?if (!$rec['d']) echo 'disabled'?> data-mask="000" data-mask-selectonfocus="true"></td>
            </tr>
            <tr><td class="bold">Пульс</td>
                <td><input type="hidden" name="rule[p]" value="0"><input class="toogle_enabled" type="checkbox" name="rule[p]" value="1" <?if ($rec['p']) echo 'checked'?>></td>
                <td><input type="text" class="p" name="rule[p_min]" value="<?echo $rec['p_min']?>" <?if (!$rec['p']) echo 'disabled'?> data-mask="000" data-mask-selectonfocus="true"></td>
                <td><input type="text" class="p" name="rule[p_max]" value="<?echo $rec['p_max']?>" <?if (!$rec['p']) echo 'disabled'?> data-mask="000" data-mask-selectonfocus="true"></td>
            </tr>

    <?

     ?><tr><td colspan="10" class="buttons"><button class="v2 submit fa fa-floppy-o" group_id="<?echo $rec['id']?>" cmd="esmo_setting/list_rec_group_of_disease_rules_save">Сохранить</button></td></tr>
   </table> </form>
   </div>
   <script type="text/javascript">
       $j(document).ready(function ()
         {  //$j("input.p").mask("99-999");

            $j('input.toogle_enabled').on('click',function()
            { if ($j(this).closest('tr').find('input[type=text]').attr('disabled'))
              { $j(this).closest('tr').find('input[type=text]').attr('disabled',false) ;
                $j(this).closest('tr').find('input[type=text]')[0].focus() ;
              }
              else
              { $j(this).closest('tr').find('input[type=text]').attr('disabled',true) ;
              }
            }
                );
         }) ;</script>
   <?
}

}



?>