<?php
include_once("c_events_opo_card.php");
class c_page_cab_events_opo_card_edit_step1 extends c_page_cab_events_opo_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()
  { //damp_array($_POST) ;
    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']) ;
  }

  function second_menu_config()
  {  if ($this->rec_event['pkey'])
       { $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/step1/']='Параметры ОПО' ;
         $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/step2/']='Выбор участников' ;
         $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/personals/']='Участники мероприятия' ;
         $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/step4/']='Срок действия ОПО' ;
         $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/step3/']='Выбор документов для ОПО' ;
         $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/step6/']='Email организаций' ;
         $this->second_menu['/window/events_opo/card/'.$this->rec_event['pkey'].'/edit/step7/']='Адреса организаций' ;
         $this->second_menu['/window/events_opo/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-2">
                              <label class="label">Переодичность:</label>
                              <label class="select">
                                  <select name="filter[pmo_len]">
                                      <?if (_sizeof(OPO()->arr_opo_len)) foreach(OPO()->arr_opo_len as $id=>$value){?><option value="<?echo $id?>" <?if ($this->rec_event['_ext_info']['pmo_len']==$id) echo 'selected'?>><?echo $value?></option><?}?>
                                  </select>
                              </label>
                            </section>


                          <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">
                              <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?>">


                       </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>
                       </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>

    <?
  }

}



?>
