您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ViewBill.php 3.1KB

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