<?php
include_once("c_medical_organizations.php");
class c_page_cab_medical_organizations_card extends c_page_cab_medical_organizations
{
    public $h1='Медицнская организация - редактирование';
    public $rec_medorg ;
    public $setting=[] ;

    function select_obj_info()
     {
       parent::select_obj_info();

       if (_CUR_ID)
       { $this->rec_medorg=ESMO()->get_med_org_by_id(_CUR_ID) ;
         if ($this->rec_medorg['pkey'])
         { $this->h1='Мед.организация "'.$this->rec_medorg['obj_name'].'"' ;

         }
         if (!$this->rec_medorg['pkey']) $this->result=404 ;
       } else $this->result=404 ;

     }

    function second_menu_config()
     {
         $this->second_menu['/cab/medical_organizations/']=array('title'=>'Мед.организации') ;
         if ($this->rec_medorg['pkey']) $this->second_menu['/cab/medical_organizations/card/'.$this->rec_medorg['pkey'].'/']=array('title'=>'Редактирование организации') ;
     }

    function block_main()
    {
        $this->page_title() ;
        ?><div style="width:900px;"><?
        $this->panel_edit() ;
        ?></div><?

    }

    function panel_edit()
    {
        FORM()->form_open() ;
        FORM()->row_open() ;
        FORM()->section_input(['name'=>'uid','title'=>'UID ЭСМО:','col_count'=>'6','value'=>$this->rec_medorg['uid'],'read_only'=>1,'disabled'=>1]) ;
        FORM()->section_input(['name'=>'uid_1c','title'=>'UID 1C:','col_count'=>'6','value'=>$this->rec_medorg['uid_1c'],'read_only'=>0,'disabled'=>0]) ;
        FORM()->section_input(['name'=>'name','title'=>'Краткое наименование организации:','col_count'=>'12','required'=>1,'value'=>$this->rec_medorg['obj_name']]) ;
        FORM()->section_textarea(['name'=>'full_name','title'=>'Полное наименование организации:','col_count'=>'12','required'=>0,'value'=>$this->rec_medorg['full_name']]) ;
        FORM()->section_input(['name'=>'inn','title'=>'ИНН:','col_count'=>'4','required'=>0,'value'=>$this->rec_medorg['inn']]) ;
        FORM()->section_input(['name'=>'kpp','title'=>'КПП:','col_count'=>'4','required'=>0,'value'=>$this->rec_medorg['kpp']]) ;
        FORM()->section_input(['name'=>'ogrn','title'=>'ОГРН:','col_count'=>'4','required'=>0,'value'=>$this->rec_medorg['ogrn']]) ;
        FORM()->section_input(['name'=>'email','title'=>'Эл.почта:','col_count'=>'6','required'=>0,'value'=>$this->rec_medorg['email']]) ;
        FORM()->section_input(['name'=>'phone','title'=>'Телефон:','col_count'=>'6','required'=>0,'value'=>$this->rec_medorg['phone']]) ;
        FORM()->section_textarea(['name'=>'adres1','title'=>'Адрес юридический:','col_count'=>'12','required'=>0,'value'=>$this->rec_medorg['adres1']]) ;
        FORM()->section_textarea(['name'=>'adres2','title'=>'Адрес фактический:','col_count'=>'12','required'=>0,'value'=>$this->rec_medorg['adres2']]) ;
        FORM()->section_input(['name'=>'license_seria','title'=>'Серия лицензии:','col_count'=>'2','required'=>1,'value'=>$this->rec_medorg['license_seria']]) ;
        FORM()->section_input(['name'=>'license_number','title'=>'Номер лицензии:','col_count'=>'2','required'=>1,'value'=>$this->rec_medorg['license_number']]) ;
        FORM()->section_input(['name'=>'license_data_from','type'=>'date','title'=>'Дата начала действия лицензии:','col_count'=>'4','required'=>1,'value'=>($this->rec_medorg['license_data_from'])? date('Y-m-d',$this->rec_medorg['license_data_from']):'']) ;
        FORM()->section_input(['name'=>'license_data_to','type'=>'date','title'=>'Дата окончания действия лицензии:','col_count'=>'4','required'=>1,'value'=>($this->rec_medorg['license_data_to'])? date('Y-m-d',$this->rec_medorg['license_data_to']):'']) ;

        FORM()->row_close() ;
        ?><strong>ДИРЕКТОР МЕДОРГАНИЗАЦИИ</strong><br><br><?
        FORM()->row_open() ;
        FORM()->section_input(['name'=>'director_uid','title'=>'UID ЭСМО:','col_count'=>'6','value'=>$this->rec_medorg['director_uid'],'read_only'=>1,'disabled'=>1]) ;
        FORM()->row_close() ;
        FORM()->row_open() ;
        FORM()->section_input(['name'=>'director_name','title'=>'ФИО:','col_count'=>'6','required'=>0,'value'=>$this->rec_medorg['director_name']]) ;
        FORM()->section_input(['name'=>'director_inn','title'=>'ИНН:','col_count'=>'3','required'=>0,'value'=>$this->rec_medorg['director_inn']]) ;
        FORM()->section_input(['name'=>'director_snils','title'=>'СНИЛС:','col_count'=>'3','required'=>0,'value'=>$this->rec_medorg['director_snils']]) ;
        FORM()->section_input(['name'=>'director_job_title','title'=>'Должность:','col_count'=>'12','required'=>0,'value'=>$this->rec_medorg['director_job_title']]) ;
        //FORM()->section_input(['name'=>'director_date_birth','title'=>'Дата рождения:','col_count'=>'4','required'=>0,'value'=>$this->rec_medorg['director_date_birth']]) ;
        //FORM()->section_input(['name'=>'director_place_birth','title'=>'Место рождения:','col_count'=>'4','required'=>0,'value'=>$this->rec_medorg['director_place_birth']]) ;
        //FORM()->section_select(['name'=>'director_gender','title'=>'Пол:','col_count'=>'4','required'=>0,'recs'=>PERSONAL()->arr_pol_filter,'value'=>$this->rec_medorg['director_gender']]) ;
        FORM()->section_input(['name'=>'director_email','title'=>'Эл.почта:','col_count'=>'6','required'=>0,'value'=>$this->rec_medorg['director_email']]) ;
        FORM()->section_input(['name'=>'director_phone','title'=>'Телефон:','col_count'=>'6','required'=>0,'value'=>$this->rec_medorg['director_phone']]) ;
        FORM()->row_close() ;


        FORM()->button(['title'=>'Удалить','class'=>'left','cmd'=>'medical_organizations/med_org_delete','med_org_id'=>$this->rec_medorg['pkey'],'no_send_form'=>1]);
        FORM()->button(['title'=>'Сохранить','cmd'=>'medical_organizations/med_org_edit_apply','med_org_id'=>$this->rec_medorg['pkey']]);
        FORM()->form_close() ;
    }





}

?>
