Kimi chinh sua

This commit is contained in:
2026-04-24 08:58:53 +00:00
parent 91ff4a5e4d
commit 86216ef872
43 changed files with 2868 additions and 597 deletions

View File

@@ -4,16 +4,12 @@ namespace App\Filament\Resources\Customers;
use App\Filament\Resources\Customers\Pages;
use App\Models\Customer;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Customers\Schemas\CustomerForm;
use App\Filament\Resources\Customers\Tables\CustomersTable;
class CustomerResource extends Resource
{
@@ -22,47 +18,17 @@ class CustomerResource extends Resource
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::CUSTOMER->value;
protected static ?int $navigationSort = 3;
protected static ?string $modelLabel = 'Khách hàng';
protected static ?string $pluralModelLabel = 'Khách hàng';
public static function form(Schema $schema): Schema
{
return $schema
->components([
Section::make('Thông tin định danh')
->columns(2)
->schema([
TextInput::make('full_name')->label('Họ và Tên')->required(),
TextInput::make('cmnd_cccd')->label('Số CMND / CCCD')->required()->unique(ignoreRecord: true),
DatePicker::make('dob')->label('Ngày sinh')->displayFormat('d/m/Y'),
]),
Section::make('Thông liên lạc')
->columns(2)
->schema([
TextInput::make('phone')->label('Số điện thoại')->tel()->required(),
TextInput::make('email')->label('Email')->email(),
]),
Section::make('Địa chỉ chi tiết')
->schema([
Fieldset::make('address')
->label('Cấu trúc địa chỉ')->columns(3)
->schema([
TextInput::make('address.street')->label('Số nhà, đường')->columnSpan(3),
TextInput::make('address.ward')->label('Phường / Xã'),
TextInput::make('address.district')->label('Quận / Huyện'),
TextInput::make('address.city')->label('Tỉnh / Thành phố'),
]),
]),
]);
return CustomerForm::configure($schema);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('full_name')->label('Họ Tên')->searchable(),
Tables\Columns\TextColumn::make('cmnd_cccd')->label('CMND/CCCD')->searchable(),
Tables\Columns\TextColumn::make('phone')->label('Điện thoại'),
Tables\Columns\TextColumn::make('address.city')->label('Tỉnh/Thành')->sortable(),
])
->defaultSort('created_at', 'desc');
return CustomersTable::configure($table);
}
public static function getPages(): array