refactor: enhance user creation form with cheerful notification and improved structure

This commit is contained in:
Yoga Pangestu 2026-04-06 15:12:19 +07:00
parent 10d80e8f8c
commit f2295282e4
2 changed files with 53 additions and 38 deletions

View File

@ -3,12 +3,15 @@
namespace App\Filament\Resources\Master\Users\Schemas;
use App\Enums\RoleEnum;
use App\Filament\Support\CheerfulNotification;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\HtmlString;
class UserForm
{
@ -16,6 +19,13 @@ public static function configure(Schema $schema): Schema
{
return $schema
->components([
Section::make()
->description(function (string $operation) {
return $operation === 'create'
? new HtmlString(CheerfulNotification::getByKey('user.create_form_desc'))
: null;
})
->schema([
TextInput::make('name')
->label('Nama Lengkap')
->placeholder('John Doe')
@ -61,6 +71,7 @@ public static function configure(Schema $schema): Schema
->default(fn (): string => config('auth.password_default'))
->visibleOn('create'),
]),
]),
])
->columns(1);
}

View File

@ -889,6 +889,10 @@
'cheerful' => 'Yuk, buat akun baru biar makin lengkap penggunanya! 💪😊',
'formal' => 'Silakan masukkan detail akun pengguna baru di bawah ini.',
],
'create_form_desc' => [
'cheerful' => 'Pake alamat surel dan nama pengguna ini buat masuk ya. Oh iya, kata sandi awalnya <code class="text-sm bg-gray-100 text-red-400 px-1.5 py-0.5 rounded font-mono">'.config('auth.password_default').'</code> 🥳',
'formal' => 'Gunakan alamat surel dan nama pengguna ini untuk masuk. Kata sandi awalnya adalah <code class="text-sm bg-gray-100 text-red-400 px-1.5 py-0.5 rounded font-mono">'.config('auth.password_default').'</code>.',
],
],
'theme' => [
'create_title' => [