187 lines
5.4 KiB
PHP
187 lines
5.4 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class CostAnaliceForm extends WebAppRaiserForm
|
||
|
|
{
|
||
|
|
|
||
|
|
public function __construct($form_id)
|
||
|
|
{
|
||
|
|
parent::__construct($form_id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function form()
|
||
|
|
{
|
||
|
|
$form = parent::form();
|
||
|
|
|
||
|
|
$header = '<div style="border-bottom: 2px solid rgb(67, 160, 71); margin-bottom: 1.5em;"><h3>%s</h3></div>';
|
||
|
|
$label = function($data) {
|
||
|
|
return array('#text' => $data, '#class' => ['label'], '#style' => ['float:none;']);
|
||
|
|
};
|
||
|
|
|
||
|
|
//$form['form_attributes']['enctype'] = 'multipart/form-data';
|
||
|
|
|
||
|
|
$form['form_attributes']['js'][] = 'engine/classes/WebAppRaiser/forms/CostAnaliceForm.js';
|
||
|
|
|
||
|
|
$form['woid'] = array(
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'hidden',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['object_id'] = array(
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'hidden',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
|
||
|
|
// Анализ стоимости
|
||
|
|
$form['markup_cost_analice'] = array(
|
||
|
|
'#prefix' => '<div class="row" id="cost_analice_header"><div class="col col-12">',
|
||
|
|
'inputs' => array(
|
||
|
|
'#type' => 'markup',
|
||
|
|
'#value' => sprintf($header, 'Анализ стоимости квартиры'),
|
||
|
|
),
|
||
|
|
'#suffix' => '</div></div>',
|
||
|
|
);
|
||
|
|
$form['objectType'] = array(
|
||
|
|
//'label'=> $label('Объект оценки'), // Тип объекта оценки
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'hidden',
|
||
|
|
'#value' => 'FLAT',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['address'] = array(
|
||
|
|
'#prefix' => '<div class="row" id="cost_analice_data"><div class="col col-md-7">',
|
||
|
|
'label'=> $label('Адрес объекта'), // Адрес объекта оценки
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'textarea',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['cadNum'] = array(
|
||
|
|
'label'=> $label('Кадастровый номер объекта'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['latitude'] = array(
|
||
|
|
'#prefix' => '<div class="row"><div class="col col-md-5">',
|
||
|
|
'label'=> $label('Широта'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div>',
|
||
|
|
);
|
||
|
|
$form['longitude'] = array(
|
||
|
|
'#prefix' => '<div class="col col-md-6">',
|
||
|
|
'label'=> $label('Долгота'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div></div>',
|
||
|
|
);
|
||
|
|
$form['floor'] = array(
|
||
|
|
'#prefix' => '<div class="row"><div class="col col-md-5">',
|
||
|
|
'label'=> $label('Этаж'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div>',
|
||
|
|
);
|
||
|
|
$form['totalFloors'] = array(
|
||
|
|
'#prefix' => '<div class="col col-md-6">',
|
||
|
|
'label'=> $label('Количество этажей в доме'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div></div>',
|
||
|
|
);
|
||
|
|
$form['square'] = array(
|
||
|
|
'#prefix' => '<div class="row"><div class="col col-md-5">',
|
||
|
|
'label'=> $label('Площадь объекта'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div>',
|
||
|
|
);
|
||
|
|
$form['buildYear'] = array(
|
||
|
|
'#prefix' => '<div class="col col-md-6">',
|
||
|
|
'label'=> $label('Год постройки дома'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> true,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div></div></div>',
|
||
|
|
);
|
||
|
|
$form['buildingStage'] = array(
|
||
|
|
'#prefix' => '<div class="col col-md-5">',
|
||
|
|
'label'=> $label('Стадия строительства'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'select',
|
||
|
|
'#required'=> true,
|
||
|
|
'#options' => WebAppRaiserAPI::getDict('BUILDING_STAGE'),
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['decorationType'] = array(
|
||
|
|
'label'=> $label('Состояние отделки помещения'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'select',
|
||
|
|
'#required'=> true,
|
||
|
|
'#options' => WebAppRaiserAPI::getDict('DECORATION_TYPE'),
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['wallMaterial'] = array(
|
||
|
|
'label'=> $label('Материал стен дома'),
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'select',
|
||
|
|
'#required'=> true,
|
||
|
|
'#options' => WebAppRaiserAPI::getDict('WALL_MATERIAL'),
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
$form['contractCost'] = array(
|
||
|
|
'label'=> $label('Стоимость в договоре'), // Стоимость объекта при покупке
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'text',
|
||
|
|
'#required'=> false,
|
||
|
|
'#inputs_style' => 'float:none; width:90%',
|
||
|
|
),
|
||
|
|
'#suffix' => '</div></div>',
|
||
|
|
);
|
||
|
|
$form['submit'] = array(
|
||
|
|
'inputs' => array(
|
||
|
|
'#type'=> 'submit',
|
||
|
|
'#value'=> 'Рассчитать стоимость',
|
||
|
|
),
|
||
|
|
);
|
||
|
|
return $form;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function validate()
|
||
|
|
{
|
||
|
|
$status = parent::validate();
|
||
|
|
return $status;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function submit($status, &$page, WebAppRaiserAPI $WebAppRaiserAPI)
|
||
|
|
{
|
||
|
|
parent::submit($status, $page, $WebAppRaiserAPI);
|
||
|
|
$page['status'] = $status['code'];
|
||
|
|
$page['msg'] = array_merge($page['msg'], $status['message']);
|
||
|
|
parent::redirect($page);
|
||
|
|
// По сути этот сабмит не работает так как происходит AJAX запрос
|
||
|
|
}
|
||
|
|
}
|