firstPHP/views/admin/index.php
2024-05-24 18:03:12 +03:00

92 lines
2.6 KiB
PHP

<?php
/**
* @var \itguild\forms\ActiveForm $form
* @var \itguild\forms\app\DTO\FormDTO $dto
* @var \itguild\forms\core\cg_view\CgView $cgView
*/
use itguild\forms\ActiveForm;
use itguild\forms\app\models\InputTypeModel;
use itguild\forms\inputs\TextInput;
use itguild\forms\inputs\TextArea;
use itguild\forms\app\controllers\AdminController;
?>
<?php echo $form->beginForm("/admin/save-form/"); ?>
<?php $form->field(TextInput::class, name: "title", params: [
'class' => "form-control",
'placeholder' => 'Название формы',
'value' => $dto->get('title'),
])
->setLabel("Название формы")
->render();
$form->field(TextInput::class, name: "perPage", params: [
'class' => "form-control",
'placeholder' => 'Perpage',
'value' => $dto->get('perPage'),
])
->setLabel("Количество выводимых записей на страницу")
->render();
$form->field(\itguild\forms\inputs\Checkbox::class, name: "actionView", params: [
'value' => 'view',
'checked' => $dto->get('view')
])
->setLabel("Разрешить просмотр")
->render();
$form->field(\itguild\forms\inputs\Checkbox::class, name: "actionEdit", params: [
'value' => 'edit',
'checked' => $dto->get('edit')
])
->setLabel("Разрешить редактирование")
->render();
$form->field(\itguild\forms\inputs\Checkbox::class, name: "actionDelete", params: [
'value' => 'delete',
'checked' => $dto->get('delete')
])
->setLabel("Разрешить удаление")
->render();
$form->field(\itguild\forms\inputs\Select::class, name: "inputType", params: [
'class' => "form-control-sm",
'id' => "selectID",
'placeholder' => 'Параметры',
'options' => \itguild\forms\app\services\InputTypeService::getInputTypes()
])
->setLabel("Добавить поле")
->render();
$form->field(\itguild\forms\inputs\Hidden::class, name: "formId", params: [
"value" => $dto->get('id')
])->render();
if (isset($fields)){
\itguild\forms\widgets\FormFieldBlockWidget::create()->run(['fields' => $fields]);
}
$form->field(\itguild\forms\inputs\Button::class, name: "", params: [
"id" => 'buttonAdd',
"value" => 'Добавить поле',
'style' => "margin-top: 10px",
"class" => "btn btn-success",
"onclick" => "getValueSelect()",
"data-count" => "0"
])->render();
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
'class' => "btn btn-primary ",
'value' => 'Отправить',
'typeInput' => 'submit'
])
->render();
$form->endForm();
?>