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.

BillResource.php 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <?php
  2. namespace App\Filament\Company\Resources\Purchases;
  3. use App\Enums\Accounting\AdjustmentCategory;
  4. use App\Enums\Accounting\AdjustmentStatus;
  5. use App\Enums\Accounting\AdjustmentType;
  6. use App\Enums\Accounting\BillStatus;
  7. use App\Enums\Accounting\DocumentDiscountMethod;
  8. use App\Enums\Accounting\DocumentType;
  9. use App\Enums\Accounting\PaymentMethod;
  10. use App\Filament\Company\Resources\Purchases\BillResource\Pages;
  11. use App\Filament\Company\Resources\Purchases\VendorResource\RelationManagers\BillsRelationManager;
  12. use App\Filament\Forms\Components\CreateAdjustmentSelect;
  13. use App\Filament\Forms\Components\CreateCurrencySelect;
  14. use App\Filament\Forms\Components\DocumentTotals;
  15. use App\Filament\Tables\Actions\ReplicateBulkAction;
  16. use App\Filament\Tables\Columns;
  17. use App\Filament\Tables\Filters\DateRangeFilter;
  18. use App\Models\Accounting\Adjustment;
  19. use App\Models\Accounting\Bill;
  20. use App\Models\Accounting\DocumentLineItem;
  21. use App\Models\Banking\BankAccount;
  22. use App\Models\Common\Offering;
  23. use App\Models\Common\Vendor;
  24. use App\Utilities\Currency\CurrencyAccessor;
  25. use App\Utilities\Currency\CurrencyConverter;
  26. use App\Utilities\RateCalculator;
  27. use Awcodes\TableRepeater\Components\TableRepeater;
  28. use Awcodes\TableRepeater\Header;
  29. use Closure;
  30. use Filament\Forms;
  31. use Filament\Forms\Form;
  32. use Filament\Notifications\Notification;
  33. use Filament\Resources\Resource;
  34. use Filament\Support\Enums\Alignment;
  35. use Filament\Support\Enums\MaxWidth;
  36. use Filament\Tables;
  37. use Filament\Tables\Table;
  38. use Illuminate\Database\Eloquent\Builder;
  39. use Illuminate\Database\Eloquent\Collection;
  40. use Illuminate\Support\Facades\Auth;
  41. class BillResource extends Resource
  42. {
  43. protected static ?string $model = Bill::class;
  44. public static function form(Form $form): Form
  45. {
  46. $company = Auth::user()->currentCompany;
  47. $settings = $company->defaultBill;
  48. return $form
  49. ->schema([
  50. Forms\Components\Section::make('Bill Details')
  51. ->schema([
  52. Forms\Components\Split::make([
  53. Forms\Components\Group::make([
  54. Forms\Components\Select::make('vendor_id')
  55. ->relationship('vendor', 'name')
  56. ->preload()
  57. ->searchable()
  58. ->required()
  59. ->live()
  60. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state) {
  61. if (! $state) {
  62. return;
  63. }
  64. $currencyCode = Vendor::find($state)?->currency_code;
  65. if ($currencyCode) {
  66. $set('currency_code', $currencyCode);
  67. }
  68. }),
  69. CreateCurrencySelect::make('currency_code'),
  70. ]),
  71. Forms\Components\Group::make([
  72. Forms\Components\TextInput::make('bill_number')
  73. ->label('Bill number')
  74. ->default(static fn () => Bill::getNextDocumentNumber())
  75. ->required(),
  76. Forms\Components\TextInput::make('order_number')
  77. ->label('P.O/S.O Number'),
  78. Forms\Components\DatePicker::make('date')
  79. ->label('Bill date')
  80. ->default(now())
  81. ->disabled(function (?Bill $record) {
  82. return $record?->hasPayments();
  83. })
  84. ->required(),
  85. Forms\Components\DatePicker::make('due_date')
  86. ->label('Due date')
  87. ->default(function () use ($company) {
  88. return now()->addDays($company->defaultBill->payment_terms->getDays());
  89. })
  90. ->required(),
  91. Forms\Components\Select::make('discount_method')
  92. ->label('Discount method')
  93. ->options(DocumentDiscountMethod::class)
  94. ->selectablePlaceholder(false)
  95. ->default(DocumentDiscountMethod::PerLineItem)
  96. ->afterStateUpdated(function ($state, Forms\Set $set) {
  97. $discountMethod = DocumentDiscountMethod::parse($state);
  98. if ($discountMethod->isPerDocument()) {
  99. $set('lineItems.*.purchaseDiscounts', []);
  100. }
  101. })
  102. ->live(),
  103. ])->grow(true),
  104. ])->from('md'),
  105. TableRepeater::make('lineItems')
  106. ->relationship()
  107. ->saveRelationshipsUsing(null)
  108. ->dehydrated(true)
  109. ->headers(function (Forms\Get $get) use ($settings) {
  110. $hasDiscounts = DocumentDiscountMethod::parse($get('discount_method'))->isPerLineItem();
  111. $headers = [
  112. Header::make($settings->resolveColumnLabel('item_name', 'Items'))
  113. ->width($hasDiscounts ? '15%' : '20%'),
  114. Header::make('Description')
  115. ->width($hasDiscounts ? '15%' : '20%'),
  116. Header::make($settings->resolveColumnLabel('unit_name', 'Quantity'))
  117. ->width('10%'),
  118. Header::make($settings->resolveColumnLabel('price_name', 'Price'))
  119. ->width('10%'),
  120. Header::make('Taxes')
  121. ->width($hasDiscounts ? '20%' : '30%'),
  122. ];
  123. if ($hasDiscounts) {
  124. $headers[] = Header::make('Discounts')->width('20%');
  125. }
  126. $headers[] = Header::make($settings->resolveColumnLabel('amount_name', 'Amount'))
  127. ->width('10%')
  128. ->align('right');
  129. return $headers;
  130. })
  131. ->schema([
  132. Forms\Components\Select::make('offering_id')
  133. ->label('Item')
  134. ->relationship('purchasableOffering', 'name')
  135. ->preload()
  136. ->searchable()
  137. ->required()
  138. ->live()
  139. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state, ?DocumentLineItem $record) {
  140. $offeringId = $state;
  141. $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
  142. $isPerLineItem = $discountMethod->isPerLineItem();
  143. $existingTaxIds = [];
  144. $existingDiscountIds = [];
  145. if ($record) {
  146. $existingTaxIds = $record->purchaseTaxes()->pluck('adjustments.id')->toArray();
  147. if ($isPerLineItem) {
  148. $existingDiscountIds = $record->purchaseDiscounts()->pluck('adjustments.id')->toArray();
  149. }
  150. }
  151. $with = [
  152. 'purchaseTaxes' => static function ($query) use ($existingTaxIds) {
  153. $query->where(static function ($query) use ($existingTaxIds) {
  154. $query->where('status', AdjustmentStatus::Active)
  155. ->orWhereIn('adjustments.id', $existingTaxIds);
  156. });
  157. },
  158. ];
  159. if ($isPerLineItem) {
  160. $with['purchaseDiscounts'] = static function ($query) use ($existingDiscountIds) {
  161. $query->where(static function ($query) use ($existingDiscountIds) {
  162. $query->where('status', AdjustmentStatus::Active)
  163. ->orWhereIn('adjustments.id', $existingDiscountIds);
  164. });
  165. };
  166. }
  167. $offeringRecord = Offering::with($with)->find($offeringId);
  168. if (! $offeringRecord) {
  169. return;
  170. }
  171. $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
  172. $set('description', $offeringRecord->description);
  173. $set('unit_price', $unitPrice);
  174. $set('purchaseTaxes', $offeringRecord->purchaseTaxes->pluck('id')->toArray());
  175. if ($isPerLineItem) {
  176. $set('purchaseDiscounts', $offeringRecord->purchaseDiscounts->pluck('id')->toArray());
  177. }
  178. }),
  179. Forms\Components\TextInput::make('description'),
  180. Forms\Components\TextInput::make('quantity')
  181. ->required()
  182. ->numeric()
  183. ->live()
  184. ->maxValue(9999999999.99)
  185. ->default(1),
  186. Forms\Components\TextInput::make('unit_price')
  187. ->label('Price')
  188. ->hiddenLabel()
  189. ->numeric()
  190. ->live()
  191. ->maxValue(9999999999.99)
  192. ->default(0),
  193. CreateAdjustmentSelect::make('purchaseTaxes')
  194. ->label('Taxes')
  195. ->category(AdjustmentCategory::Tax)
  196. ->type(AdjustmentType::Purchase)
  197. ->adjustmentsRelationship('purchaseTaxes')
  198. ->saveRelationshipsUsing(null)
  199. ->dehydrated(true)
  200. ->preload()
  201. ->multiple()
  202. ->live()
  203. ->searchable(),
  204. CreateAdjustmentSelect::make('purchaseDiscounts')
  205. ->label('Discounts')
  206. ->category(AdjustmentCategory::Discount)
  207. ->type(AdjustmentType::Purchase)
  208. ->adjustmentsRelationship('purchaseDiscounts')
  209. ->saveRelationshipsUsing(null)
  210. ->dehydrated(true)
  211. ->multiple()
  212. ->live()
  213. ->hidden(function (Forms\Get $get) {
  214. $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
  215. return $discountMethod->isPerDocument();
  216. })
  217. ->searchable(),
  218. Forms\Components\Placeholder::make('total')
  219. ->hiddenLabel()
  220. ->extraAttributes(['class' => 'text-left sm:text-right'])
  221. ->content(function (Forms\Get $get) {
  222. $quantity = max((float) ($get('quantity') ?? 0), 0);
  223. $unitPrice = max((float) ($get('unit_price') ?? 0), 0);
  224. $purchaseTaxes = $get('purchaseTaxes') ?? [];
  225. $purchaseDiscounts = $get('purchaseDiscounts') ?? [];
  226. $currencyCode = $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency();
  227. $subtotal = $quantity * $unitPrice;
  228. $subtotalInCents = CurrencyConverter::convertToCents($subtotal, $currencyCode);
  229. $taxAmountInCents = Adjustment::whereIn('id', $purchaseTaxes)
  230. ->get()
  231. ->sum(function (Adjustment $adjustment) use ($subtotalInCents) {
  232. if ($adjustment->computation->isPercentage()) {
  233. return RateCalculator::calculatePercentage($subtotalInCents, $adjustment->getRawOriginal('rate'));
  234. } else {
  235. return $adjustment->getRawOriginal('rate');
  236. }
  237. });
  238. $discountAmountInCents = Adjustment::whereIn('id', $purchaseDiscounts)
  239. ->get()
  240. ->sum(function (Adjustment $adjustment) use ($subtotalInCents) {
  241. if ($adjustment->computation->isPercentage()) {
  242. return RateCalculator::calculatePercentage($subtotalInCents, $adjustment->getRawOriginal('rate'));
  243. } else {
  244. return $adjustment->getRawOriginal('rate');
  245. }
  246. });
  247. // Final total
  248. $totalInCents = $subtotalInCents + ($taxAmountInCents - $discountAmountInCents);
  249. return CurrencyConverter::formatCentsToMoney($totalInCents, $currencyCode);
  250. }),
  251. ]),
  252. DocumentTotals::make()
  253. ->type(DocumentType::Bill),
  254. ]),
  255. ]);
  256. }
  257. public static function table(Table $table): Table
  258. {
  259. return $table
  260. ->defaultSort('due_date')
  261. ->columns([
  262. Columns::id(),
  263. Tables\Columns\TextColumn::make('status')
  264. ->badge()
  265. ->searchable(),
  266. Tables\Columns\TextColumn::make('due_date')
  267. ->label('Due')
  268. ->asRelativeDay()
  269. ->sortable(),
  270. Tables\Columns\TextColumn::make('date')
  271. ->date()
  272. ->sortable(),
  273. Tables\Columns\TextColumn::make('bill_number')
  274. ->label('Number')
  275. ->searchable()
  276. ->sortable(),
  277. Tables\Columns\TextColumn::make('vendor.name')
  278. ->sortable()
  279. ->searchable()
  280. ->hiddenOn(BillsRelationManager::class),
  281. Tables\Columns\TextColumn::make('total')
  282. ->currencyWithConversion(static fn (Bill $record) => $record->currency_code)
  283. ->sortable()
  284. ->toggleable(),
  285. Tables\Columns\TextColumn::make('amount_paid')
  286. ->label('Amount paid')
  287. ->currencyWithConversion(static fn (Bill $record) => $record->currency_code)
  288. ->sortable()
  289. ->toggleable(),
  290. Tables\Columns\TextColumn::make('amount_due')
  291. ->label('Amount due')
  292. ->currencyWithConversion(static fn (Bill $record) => $record->currency_code)
  293. ->sortable(),
  294. ])
  295. ->filters([
  296. Tables\Filters\SelectFilter::make('vendor')
  297. ->relationship('vendor', 'name')
  298. ->searchable()
  299. ->preload()
  300. ->hiddenOn(BillsRelationManager::class),
  301. Tables\Filters\SelectFilter::make('status')
  302. ->options(BillStatus::class)
  303. ->native(false),
  304. Tables\Filters\TernaryFilter::make('has_payments')
  305. ->label('Has payments')
  306. ->queries(
  307. true: fn (Builder $query) => $query->whereHas('payments'),
  308. false: fn (Builder $query) => $query->whereDoesntHave('payments'),
  309. ),
  310. DateRangeFilter::make('date')
  311. ->fromLabel('From date')
  312. ->untilLabel('To date')
  313. ->indicatorLabel('Date'),
  314. DateRangeFilter::make('due_date')
  315. ->fromLabel('From due date')
  316. ->untilLabel('To due date')
  317. ->indicatorLabel('Due'),
  318. ])
  319. ->actions([
  320. Tables\Actions\ActionGroup::make([
  321. Tables\Actions\ActionGroup::make([
  322. Tables\Actions\EditAction::make(),
  323. Tables\Actions\ViewAction::make(),
  324. Bill::getReplicateAction(Tables\Actions\ReplicateAction::class),
  325. Tables\Actions\Action::make('recordPayment')
  326. ->label('Record payment')
  327. ->stickyModalHeader()
  328. ->stickyModalFooter()
  329. ->modalFooterActionsAlignment(Alignment::End)
  330. ->modalWidth(MaxWidth::TwoExtraLarge)
  331. ->icon('heroicon-o-credit-card')
  332. ->visible(function (Bill $record) {
  333. return $record->canRecordPayment();
  334. })
  335. ->mountUsing(function (Bill $record, Form $form) {
  336. $form->fill([
  337. 'posted_at' => now(),
  338. 'amount' => $record->amount_due,
  339. ]);
  340. })
  341. ->databaseTransaction()
  342. ->successNotificationTitle('Payment recorded')
  343. ->form([
  344. Forms\Components\DatePicker::make('posted_at')
  345. ->label('Date'),
  346. Forms\Components\TextInput::make('amount')
  347. ->label('Amount')
  348. ->required()
  349. ->money(fn (Bill $record) => $record->currency_code)
  350. ->live(onBlur: true)
  351. ->helperText(function (Bill $record, $state) {
  352. $billCurrency = $record->currency_code;
  353. if (! CurrencyConverter::isValidAmount($state, $billCurrency)) {
  354. return null;
  355. }
  356. $amountDue = $record->getRawOriginal('amount_due');
  357. $amount = CurrencyConverter::convertToCents($state, $billCurrency);
  358. if ($amount <= 0) {
  359. return 'Please enter a valid positive amount';
  360. }
  361. $newAmountDue = $amountDue - $amount;
  362. return match (true) {
  363. $newAmountDue > 0 => 'Amount due after payment will be ' . CurrencyConverter::formatCentsToMoney($newAmountDue, $billCurrency),
  364. $newAmountDue === 0 => 'Bill will be fully paid',
  365. default => 'Amount exceeds bill total by ' . CurrencyConverter::formatCentsToMoney(abs($newAmountDue), $billCurrency),
  366. };
  367. })
  368. ->rules([
  369. static fn (Bill $record): Closure => static function (string $attribute, $value, Closure $fail) use ($record) {
  370. if (! CurrencyConverter::isValidAmount($value, $record->currency_code)) {
  371. $fail('Please enter a valid amount');
  372. }
  373. },
  374. ]),
  375. Forms\Components\Select::make('payment_method')
  376. ->label('Payment method')
  377. ->required()
  378. ->options(PaymentMethod::class),
  379. Forms\Components\Select::make('bank_account_id')
  380. ->label('Account')
  381. ->required()
  382. ->options(function () {
  383. return BankAccount::query()
  384. ->join('accounts', 'bank_accounts.account_id', '=', 'accounts.id')
  385. ->select(['bank_accounts.id', 'accounts.name'])
  386. ->pluck('accounts.name', 'bank_accounts.id')
  387. ->toArray();
  388. })
  389. ->searchable(),
  390. Forms\Components\Textarea::make('notes')
  391. ->label('Notes'),
  392. ])
  393. ->action(function (Bill $record, Tables\Actions\Action $action, array $data) {
  394. $record->recordPayment($data);
  395. $action->success();
  396. }),
  397. ])->dropdown(false),
  398. Tables\Actions\DeleteAction::make(),
  399. ]),
  400. ])
  401. ->bulkActions([
  402. Tables\Actions\BulkActionGroup::make([
  403. Tables\Actions\DeleteBulkAction::make(),
  404. ReplicateBulkAction::make()
  405. ->label('Replicate')
  406. ->modalWidth(MaxWidth::Large)
  407. ->modalDescription('Replicating bills will also replicate their line items. Are you sure you want to proceed?')
  408. ->successNotificationTitle('Bills replicated successfully')
  409. ->failureNotificationTitle('Failed to replicate bills')
  410. ->databaseTransaction()
  411. ->deselectRecordsAfterCompletion()
  412. ->excludeAttributes([
  413. 'status',
  414. 'amount_paid',
  415. 'amount_due',
  416. 'created_by',
  417. 'updated_by',
  418. 'created_at',
  419. 'updated_at',
  420. 'bill_number',
  421. 'date',
  422. 'due_date',
  423. 'paid_at',
  424. ])
  425. ->beforeReplicaSaved(function (Bill $replica) {
  426. $replica->status = BillStatus::Open;
  427. $replica->bill_number = Bill::getNextDocumentNumber();
  428. $replica->date = now();
  429. $replica->due_date = now()->addDays($replica->company->defaultBill->payment_terms->getDays());
  430. })
  431. ->withReplicatedRelationships(['lineItems'])
  432. ->withExcludedRelationshipAttributes('lineItems', [
  433. 'subtotal',
  434. 'total',
  435. 'created_by',
  436. 'updated_by',
  437. 'created_at',
  438. 'updated_at',
  439. ]),
  440. Tables\Actions\BulkAction::make('recordPayments')
  441. ->label('Record payments')
  442. ->icon('heroicon-o-credit-card')
  443. ->stickyModalHeader()
  444. ->stickyModalFooter()
  445. ->modalFooterActionsAlignment(Alignment::End)
  446. ->modalWidth(MaxWidth::TwoExtraLarge)
  447. ->databaseTransaction()
  448. ->successNotificationTitle('Payments recorded')
  449. ->failureNotificationTitle('Failed to record payments')
  450. ->deselectRecordsAfterCompletion()
  451. ->beforeFormFilled(function (Collection $records, Tables\Actions\BulkAction $action) {
  452. $isInvalid = $records->contains(fn (Bill $bill) => ! $bill->canRecordPayment());
  453. if ($isInvalid) {
  454. Notification::make()
  455. ->title('Payment recording failed')
  456. ->body('Bills that are either paid, voided, or are in a foreign currency cannot be processed through bulk payments. Please adjust your selection and try again.')
  457. ->persistent()
  458. ->danger()
  459. ->send();
  460. $action->cancel(true);
  461. }
  462. })
  463. ->mountUsing(function (Collection $records, Form $form) {
  464. $totalAmountDue = $records->sum(fn (Bill $bill) => $bill->getRawOriginal('amount_due'));
  465. $form->fill([
  466. 'posted_at' => now(),
  467. 'amount' => CurrencyConverter::convertCentsToFormatSimple($totalAmountDue),
  468. ]);
  469. })
  470. ->form([
  471. Forms\Components\DatePicker::make('posted_at')
  472. ->label('Date'),
  473. Forms\Components\TextInput::make('amount')
  474. ->label('Amount')
  475. ->required()
  476. ->money()
  477. ->rules([
  478. static fn (): Closure => static function (string $attribute, $value, Closure $fail) {
  479. if (! CurrencyConverter::isValidAmount($value)) {
  480. $fail('Please enter a valid amount');
  481. }
  482. },
  483. ]),
  484. Forms\Components\Select::make('payment_method')
  485. ->label('Payment method')
  486. ->required()
  487. ->options(PaymentMethod::class),
  488. Forms\Components\Select::make('bank_account_id')
  489. ->label('Account')
  490. ->required()
  491. ->options(function () {
  492. return BankAccount::query()
  493. ->join('accounts', 'bank_accounts.account_id', '=', 'accounts.id')
  494. ->select(['bank_accounts.id', 'accounts.name'])
  495. ->pluck('accounts.name', 'bank_accounts.id')
  496. ->toArray();
  497. })
  498. ->searchable(),
  499. Forms\Components\Textarea::make('notes')
  500. ->label('Notes'),
  501. ])
  502. ->before(function (Collection $records, Tables\Actions\BulkAction $action, array $data) {
  503. $totalPaymentAmount = CurrencyConverter::convertToCents($data['amount']);
  504. $totalAmountDue = $records->sum(fn (Bill $bill) => $bill->getRawOriginal('amount_due'));
  505. if ($totalPaymentAmount > $totalAmountDue) {
  506. $formattedTotalAmountDue = CurrencyConverter::formatCentsToMoney($totalAmountDue);
  507. Notification::make()
  508. ->title('Excess payment amount')
  509. ->body("The payment amount exceeds the total amount due of {$formattedTotalAmountDue}. Please adjust the payment amount and try again.")
  510. ->persistent()
  511. ->warning()
  512. ->send();
  513. $action->halt(true);
  514. }
  515. })
  516. ->action(function (Collection $records, Tables\Actions\BulkAction $action, array $data) {
  517. $totalPaymentAmount = CurrencyConverter::convertToCents($data['amount']);
  518. $remainingAmount = $totalPaymentAmount;
  519. $records->each(function (Bill $record) use (&$remainingAmount, $data) {
  520. $amountDue = $record->getRawOriginal('amount_due');
  521. if ($amountDue <= 0 || $remainingAmount <= 0) {
  522. return;
  523. }
  524. $paymentAmount = min($amountDue, $remainingAmount);
  525. $data['amount'] = CurrencyConverter::convertCentsToFormatSimple($paymentAmount);
  526. $record->recordPayment($data);
  527. $remainingAmount -= $paymentAmount;
  528. });
  529. $action->success();
  530. }),
  531. ]),
  532. ]);
  533. }
  534. public static function getPages(): array
  535. {
  536. return [
  537. 'index' => Pages\ListBills::route('/'),
  538. 'create' => Pages\CreateBill::route('/create'),
  539. 'view' => Pages\ViewBill::route('/{record}'),
  540. 'edit' => Pages\EditBill::route('/{record}/edit'),
  541. ];
  542. }
  543. public static function getWidgets(): array
  544. {
  545. return [
  546. BillResource\Widgets\BillOverview::class,
  547. ];
  548. }
  549. }