<?php
include_once("c_esmo_magnit_pmo_card.php");
class c_page_cab_esmo_magnit_pmo_card_edit_step1 extends c_page_cab_esmo_magnit_pmo_card
{
  public $h1='Редактирование параметров ПМО' ;
  var $after_save_url ;

  function block_main()
  { $this->page_title() ;
    $this->panel_event_params_edit() ;
    //$this->panel_select_personal() ;
  }

  function CMD_save_event()
  { EVENTS()->save_events($this->rec_event['pkey'],$_POST['filter']) ;
    if (!$this->rec_event['enabled']) redirect_301_to($this->rec_event['__href'].'edit/step2/') ;
    else
    { $this->rec_event=EVENTS()->get_event_by_id($this->rec_event['pkey']) ;
      $this->obj_event->rec_event=$this->rec_event ;
      $this->h1=EVENT_PMO()->name.' "'.$this->rec_event['obj_name'].'" - '.$this->h1 ;
    }
  }

  function second_menu_config()
  {  if ($this->rec_event['pkey'])
       { $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/step1/']='Параметры ПМО' ;
         $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/step2/']='Выбор участников' ;
         $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/personals/']='Участники мероприятия' ;
         $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/step3/']='Выбор документов для ПМО' ;
         $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/step4/']='Срок действия ПМО' ;
         $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/step6/']='Email организаций' ;
         $this->second_menu['/window/esmo_magnit_pmo/card/'.$this->rec_event['pkey'].'/edit/step5/']='Загрузка данных' ;
       }
  }



  function panel_event_params_edit($options=array())
  {    ?><div id="panel_filter">
            <form id="sky-form" class="sky-form">
                 <fieldset>
                     <h2>Информация по мероприятию</h2><br>
                     <div class="row event_info">

                           <section class="col col-2">
                             <label class="label">Наименование:</label>
                             <label class="input">
                                 <input type="text" name="filter[name]" placeholder="" value="<?echo addslashes($this->rec_event['obj_name'])?>" data-required>
                             </label>
                            </section>

                              <input type="hidden" name="filter[mode]" value="6">

                          <section class="col col-3">
                           <label class="label">Число дней для прохождения ПМО:</label>
                           <label class="input">
                               <input type="text" name="filter[pmo_before]" placeholder="" value="<?echo addslashes($this->rec_event['_ext_info']['pmo_before'])?>">
                           </label>
                          </section>



                            <!--<section class="col col-2">
                              <br><label class="label">Санкции:</label>
                              <input type="hidden" name="filter[sanction][block_mo]" value="1">
                              <label class="select">
                                <select name="filter[sanction][block_mo]">
                                    <?if (_sizeof($this->arr_sanction)) foreach($this->arr_sanction as $id=>$value){?><option value="<?echo $id?>" <?if ($this->rec_event['_ext_info']['block_mo']==$id) echo 'selected'?>><?echo $value?></option><?}?>
                                </select>
                              </label>
                            </section>-->

                            <input type="hidden" name="filter[type]" value="1">
                            <input type="hidden" name="filter[mode]" value="6">
                            <input type="hidden" name="filter[group_id]" value="<?echo MEMBER()->cur_group_id?>">
                            <input type="hidden" name="filter[sanction][block_mo]" value="1">


                       </div>
                     <!--
                       <div class="row event_info">


                           <section class="col col-2">
                             <label class="label">Срок ожидания<br>получения документов, дней:</label>
                             <label class="input">
                                     <input type="text" name="filter[period_to_status_5]" value="<?echo $this->rec_event['_ext_info']['period_to_status_5']?>"><i></i>
                             </label>
                            </section>


                           <section class="col col-3">
                              <label class="label">Срок ожидания<br>возврата заключения, дней:</label>
                              <label class="input">
                                  <input type="text" name="filter[period_to_status_7]" value="<?echo $this->rec_event['_ext_info']['period_to_status_7']?>"><i></i>
                              </label>
                           </section>

                           <section class="col col-2">
                              <label class="label">Срок начала увемлений<br> о возврате документов, дней:</label>
                              <label class="input">
                                  <input type="text" name="filter[period_to_status_3]" value="<?echo $this->rec_event['_ext_info']['period_to_status_3']?>"><i></i>
                              </label>
                           </section>

                       </div>
                       -->
                       <div class="row event_info">

                            <section class="col col-2">
                                 <label class="label">Первичное направление на ПМО</label>
                                 <label class="radio">
                                     <input type="radio" name="filter[auto_status_2]" value="1" <?if ($this->rec_event['_ext_info']['auto_status_2']!=2) echo 'checked'?>><i></i> Вручную
                                 </label>
                                 <label class="radio">
                                     <input type="radio" name="filter[auto_status_2]" value="2" <?if ($this->rec_event['_ext_info']['auto_status_2']==2) echo 'checked'?>><i></i> Автоматически
                                 </label>
                            </section>

                           <!--<section class="col col-2">
                              <br><label class="label">Этап подготовки документов:</label>
                               <label class="radio">
                                   <input type="radio" name="filter[auto_status_3]" value="1" <?if ($this->rec_event['_ext_info']['auto_status_3']!=2) echo 'checked'?>><i></i> Есть
                               </label>
                               <label class="radio">
                                   <input type="radio" name="filter[auto_status_3]" value="2" <?if ($this->rec_event['_ext_info']['auto_status_3']==2) echo 'checked'?>><i></i> Нет
                               </label>
                           </section>-->
                           <? /*по умолчанию этапов подготовки МО нет*/?>
                           <input type="hidden" name="filter[auto_status_3]" value="2">

                       </div><br>
                     <div class="row event_info">
                        <? /* оставляем только одно сообщение о необходимости пройти ПМО*/?>

                         <section class="col col-4">
                            <label class="label">Уведомление до получения пакета документов</label>
                            <label class="textarea">
                                <textarea type="text" name="filter[message1]"><?echo $this->rec_event['_ext_info']['message1']?></textarea><i></i>
                            </label>
                         </section>
                         <!--<section class="col col-4">
                            <label class="label">Уведомление после получения пакета документов</label>
                            <label class="textarea">
                                <textarea type="text" name="filter[message2]"><?echo $this->rec_event['_ext_info']['message2']?></textarea><i></i>
                            </label>
                         </section>-->
                     </div>
                 </fieldset>
                <div id="panel_buttons"><input type="submit" class="button v1" cmd="save_event" value="Сохранить" validate="form"></div>
             </form>
      </div><br>
    <style>
          div.event_info strong{font-size:18px;font-weight:normal;}
          label.label.info{color:#4CAF50;font-size:12px;line-height:1.2em;margin-top:10px;}
    </style>

    <?
  }

}



?>
