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.

ViewBill.php 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace App\Filament\Company\Resources\Purchases\BillResource\Pages;
  3. use App\Filament\Company\Resources\Purchases\BillResource;
  4. use App\Filament\Company\Resources\Purchases\VendorResource;
  5. use App\Models\Accounting\Bill;
  6. use Filament\Actions;
  7. use Filament\Infolists\Components\Section;
  8. use Filament\Infolists\Components\TextEntry;
  9. use Filament\Infolists\Infolist;
  10. use Filament\Resources\Pages\ViewRecord;
  11. use Filament\Support\Enums\FontWeight;
  12. use Filament\Support\Enums\IconPosition;
  13. use Filament\Support\Enums\IconSize;
  14. class ViewBill extends ViewRecord
  15. {
  16. protected static string $resource = BillResource::class;
  17. protected $listeners = [
  18. 'refresh' => '$refresh',
  19. ];
  20. protected function getHeaderActions(): array
  21. {
  22. return [
  23. Actions\EditAction::make()
  24. ->label('Edit bill')
  25. ->outlined(),
  26. Actions\ActionGroup::make([
  27. Actions\ActionGroup::make([
  28. Bill::getReplicateAction(),
  29. ])->dropdown(false),
  30. Actions\DeleteAction::make(),
  31. ])
  32. ->label('Actions')
  33. ->button()
  34. ->outlined()
  35. ->dropdownPlacement('bottom-end')
  36. ->icon('heroicon-m-chevron-down')
  37. ->iconSize(IconSize::Small)
  38. ->iconPosition(IconPosition::After),
  39. ];
  40. }
  41. public function infolist(Infolist $infolist): Infolist
  42. {
  43. return $infolist
  44. ->schema([
  45. Section::make('Bill Details')
  46. ->columns(4)
  47. ->schema([
  48. TextEntry::make('bill_number')
  49. ->label('Invoice #'),
  50. TextEntry::make('status')
  51. ->badge(),
  52. TextEntry::make('vendor.name')
  53. ->label('Vendor')
  54. ->color('primary')
  55. ->weight(FontWeight::SemiBold)
  56. ->url(static fn (Bill $record) => VendorResource::getUrl('view', ['record' => $record->vendor_id])),
  57. TextEntry::make('total')
  58. ->label('Total')
  59. ->currency(fn (Bill $record) => $record->currency_code),
  60. TextEntry::make('amount_due')
  61. ->label('Amount due')
  62. ->currency(fn (Bill $record) => $record->currency_code),
  63. TextEntry::make('date')
  64. ->label('Date')
  65. ->date(),
  66. TextEntry::make('due_date')
  67. ->label('Due')
  68. ->asRelativeDay(),
  69. TextEntry::make('paid_at')
  70. ->label('Paid at')
  71. ->placeholder('Not Paid')
  72. ->date(),
  73. ]),
  74. ]);
  75. }
  76. protected function getAllRelationManagers(): array
  77. {
  78. return [
  79. BillResource\RelationManagers\PaymentsRelationManager::class,
  80. ];
  81. }
  82. }