126 lines
3.5 KiB
PHP
Raw Normal View History

2025-01-03 02:11:09 +03:00
<?php
/**
* @var Card $model
*/
use kernel\app_modules\card\models\Card;
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/card/edit/" . $model->id : "/admin/card", 'multipart/form-data');
// Пример формы:
$form->field(class: \itguild\forms\inputs\Select::class, name: "user_id", params: [
'class' => "form-control",
'value' => $model->user_id ?? ''
])
->setLabel("Пользователи")
->setOptions(\kernel\modules\user\service\UserService::createUsernameArr())
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'username', [
'class' => "form-control",
'placeholder' => 'Username',
'value' => $model->username ?? ''
])
->setLabel("Username")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'balance', [
'class' => "form-control",
'placeholder' => 'Баланс',
'value' => $model->balance ?? ''
])
->setLabel("Баланс")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'payment_type', [
'class' => "form-control",
'placeholder' => 'Тип оплаты',
'value' => $model->payment_type ?? ''
])
->setLabel("Тип оплаты")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'bank_id', [
'class' => "form-control",
'placeholder' => 'ID банка',
'value' => $model->bank_id ?? ''
])
->setLabel("ID банка")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'info', [
'class' => "form-control",
'placeholder' => 'Информация',
'value' => $model->info ?? ''
])
->setLabel("Информация")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'program', [
'class' => "form-control",
'placeholder' => 'Программа',
'value' => $model->program ?? ''
])
->setLabel("Программа")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'cvc', [
'class' => "form-control",
'placeholder' => 'CVC',
'value' => $model->cvc ?? ''
])
->setLabel("CVC")
->render();
$form->field(\itguild\forms\inputs\TextInput::class, 'pin', [
'class' => "form-control",
'placeholder' => 'PIN',
'value' => $model->pin ?? ''
])
->setLabel("PIN")
->render();
$form->field(class: \itguild\forms\inputs\Select::class, name: "card_template_id", params: [
'class' => "form-control",
'value' => $model->card_template_id ?? ''
])
->setLabel("Шаблон")
->setOptions(\kernel\app_modules\card\services\CardTemplateService::getTemplatesList())
->render();
$form->field(class: \itguild\forms\inputs\Select::class, name: "status", params: [
'class' => "form-control",
'value' => $model->status ?? ''
])
->setLabel("Статус")
->setOptions(Card::getStatus())
->render();
?>
<div class="row">
<div class="col-sm-2">
<?php
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
'class' => "btn btn-primary ",
'value' => 'Отправить',
'typeInput' => 'submit'
])
->render();
?>
</div>
<div class="col-sm-2">
<?php
$form->field(\itguild\forms\inputs\Button::class, name: "btn-reset", params: [
'class' => "btn btn-warning",
'value' => 'Сбросить',
'typeInput' => 'reset'
])
->render();
?>
</div>
</div>
<?php
$form->endForm();