Init: Hoan thanh kien truc V3 va Filament UI

This commit is contained in:
2026-04-18 02:07:30 +00:00
commit 761b34916b
141 changed files with 15917 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Filament\Resources\Projects;
use App\Filament\Resources\Projects\Pages;
use App\Models\Project;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
class ProjectResource extends Resource
{
protected static ?string $model = Project::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-building-office-2';
protected static string | \UnitEnum | null $navigationGroup = 'Quản lý Dự án';
public static function form(Schema $schema): Schema
{
return $schema
->components([
Section::make('Thông tin Dự án')
->columns(2)
->schema([
TextInput::make('name')->label('Tên Dự án')->required()->maxLength(255),
Select::make('type')->label('Loại hình')->options(['Khu đô thị' => 'Khu đô thị', 'Chung cư' => 'Chung cư', 'Đất nền phân lô' => 'Đất nền phân lô', 'Khu nghỉ dưỡng' => 'Khu nghỉ dưỡng'])->required(),
TextInput::make('address')->label('Địa chỉ chi tiết')->columnSpanFull(),
])
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')->label('Tên Dự án')->searchable()->sortable(),
Tables\Columns\TextColumn::make('type')->label('Loại hình')->badge()->sortable(),
Tables\Columns\TextColumn::make('address')->label('Địa chỉ')->limit(50),
Tables\Columns\TextColumn::make('created_at')->label('Ngày tạo')->dateTime('d/m/Y')->sortable()->toggleable(isToggledHiddenByDefault: true),
])
->defaultSort('created_at', 'desc');
}
public static function getPages(): array
{
return [
'index' => Pages\ListProjects::route('/'),
'create' => Pages\CreateProject::route('/create'),
'edit' => Pages\EditProject::route('/{record}/edit'),
];
}
}