You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ManageAllocations.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace App\Filament\Company\Resources\Accounting\BudgetResource\Pages;
  3. use App\Filament\Company\Resources\Accounting\BudgetResource;
  4. use Filament\Forms;
  5. use Filament\Forms\Form;
  6. use Filament\Resources\Pages\ManageRelatedRecords;
  7. use Filament\Tables;
  8. use Filament\Tables\Table;
  9. class ManageAllocations extends ManageRelatedRecords
  10. {
  11. protected static string $resource = BudgetResource::class;
  12. protected static string $relationship = 'allocations';
  13. protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
  14. public static function getNavigationLabel(): string
  15. {
  16. return 'Allocations';
  17. }
  18. public function form(Form $form): Form
  19. {
  20. return $form
  21. ->schema([
  22. Forms\Components\TextInput::make('account_id')
  23. ->required()
  24. ->maxLength(255),
  25. ]);
  26. }
  27. public function table(Table $table): Table
  28. {
  29. return $table
  30. ->recordTitleAttribute('account_id')
  31. ->columns([
  32. Tables\Columns\TextColumn::make('budgetItem.account.name')
  33. ->label('Account')
  34. ->sortable()
  35. ->searchable(),
  36. Tables\Columns\TextColumn::make('period')
  37. ->label('Period')
  38. ->sortable(),
  39. Tables\Columns\TextColumn::make('amount')
  40. ->label('Amount')
  41. ->money()
  42. ->sortable(),
  43. ])
  44. ->filters([
  45. //
  46. ])
  47. ->headerActions([
  48. Tables\Actions\CreateAction::make(),
  49. Tables\Actions\AssociateAction::make(),
  50. ])
  51. ->actions([
  52. Tables\Actions\EditAction::make(),
  53. Tables\Actions\DissociateAction::make(),
  54. Tables\Actions\DeleteAction::make(),
  55. ])
  56. ->bulkActions([
  57. Tables\Actions\BulkActionGroup::make([
  58. Tables\Actions\DissociateBulkAction::make(),
  59. Tables\Actions\DeleteBulkAction::make(),
  60. ]),
  61. ]);
  62. }
  63. }