Laravel_App/resources/views/user/form.blade.php

83 lines
2.4 KiB
PHP
Raw Normal View History

2025-01-13 15:52:38 +03:00
<?php
/**
* @var User $model
*/
use App\Models\User;
2025-01-20 16:57:48 +03:00
?>
2025-01-13 15:52:38 +03:00
2025-01-20 16:57:48 +03:00
<x-main>
<x-slot:title>
Custom Title
</x-slot>
2025-01-13 15:52:38 +03:00
2025-01-20 16:57:48 +03:00
@php
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/user/edit/" . $model->id : "/admin/user/store", enctype: 'multipart/form-data');
2025-01-13 15:52:38 +03:00
2025-01-20 16:57:48 +03:00
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "username", params: [
'class' => "form-control",
'placeholder' => 'Логин',
'value' => $model->username ?? ''
])
->setLabel("Логин")
->render();
2025-01-13 15:52:38 +03:00
2025-01-20 16:57:48 +03:00
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "password", params: [
'class' => "form-control",
'type' => "password",
])
->setLabel("Пароль")
->render();
2025-01-13 15:52:38 +03:00
2025-01-20 16:57:48 +03:00
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "email", params: [
'class' => "form-control",
'type' => "email",
'placeholder' => 'test@mail.ru',
'value' => $model->email ?? ''
2025-01-13 15:52:38 +03:00
])
2025-01-20 16:57:48 +03:00
->setLabel("Email")
2025-01-13 15:52:38 +03:00
->render();
2025-01-20 16:57:48 +03:00
if (!empty($model->user_photo)){
echo "<div><img src='$model->user_photo' width='200px'></div>";
}
$form->field(class: \itguild\forms\inputs\File::class, name: "user_photo", params: [
'class' => "form-control",
'value' => $model->user_photo ?? ''
2025-01-13 15:52:38 +03:00
])
2025-01-20 16:57:48 +03:00
->setLabel("Фото профиля")
2025-01-13 15:52:38 +03:00
->render();
2025-01-20 16:57:48 +03:00
@endphp
<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();
@endphp
</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();
@endphp
@csrf
@php
$form->endForm();
@endphp
</div>
2025-01-13 15:52:38 +03:00
</div>
2025-01-20 16:57:48 +03:00
</x-main>