diff --git a/app/Filament/Resources/DepartmentResource.php b/app/Filament/Resources/DepartmentResource.php new file mode 100644 index 0000000..8bc21f5 --- /dev/null +++ b/app/Filament/Resources/DepartmentResource.php @@ -0,0 +1,93 @@ +schema([ + TextInput::make('guid') + ->required() + ->maxLength(40) + ->default(sprintf('FAC-%s', Uuid::uuid4())), + Toggle::make('is_active') + ->required(), + Select::make('organization_id') + ->relationship('organization', 'name') + ->required(), + TextInput::make('name') + ->required() + ->maxLength(255), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('guid') + ->searchable(), + IconColumn::make('is_active') + ->boolean(), + TextColumn::make('organization.name') + ->numeric() + ->sortable(), + TextColumn::make('name') + ->searchable(), + TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\EditAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListDepartments::route('/'), + 'create' => Pages\CreateDepartment::route('/create'), + 'edit' => Pages\EditDepartment::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Resources/DepartmentResource/Pages/CreateDepartment.php b/app/Filament/Resources/DepartmentResource/Pages/CreateDepartment.php new file mode 100644 index 0000000..f6155fd --- /dev/null +++ b/app/Filament/Resources/DepartmentResource/Pages/CreateDepartment.php @@ -0,0 +1,11 @@ +schema([ + TextInput::make('guid') + ->required() + ->maxLength(40) + ->default(sprintf('INS-%s', Uuid::uuid4())), + TextInput::make('name') + ->required() + ->maxLength(255), + Toggle::make('is_active') + ->required(), + TextInput::make('address') + ->maxLength(255), + TextInput::make('logo_path') + ->maxLength(255), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('guid') + ->searchable(), + TextColumn::make('name') + ->searchable(), + IconColumn::make('is_active') + ->boolean(), + TextColumn::make('address') + ->searchable(), + TextColumn::make('logo_path') + ->searchable(), + TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + ]) + ->filters([ + // + ]) + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListOrganizations::route('/'), + 'create' => Pages\CreateOrganization::route('/create'), + 'edit' => Pages\EditOrganization::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Resources/OrganizationResource/Pages/CreateOrganization.php b/app/Filament/Resources/OrganizationResource/Pages/CreateOrganization.php new file mode 100644 index 0000000..1d2cc01 --- /dev/null +++ b/app/Filament/Resources/OrganizationResource/Pages/CreateOrganization.php @@ -0,0 +1,11 @@ +