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.

EstimateResource.php 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <?php
  2. namespace App\Filament\Company\Resources\Sales;
  3. use App\Enums\Accounting\AdjustmentCategory;
  4. use App\Enums\Accounting\AdjustmentStatus;
  5. use App\Enums\Accounting\AdjustmentType;
  6. use App\Enums\Accounting\DocumentDiscountMethod;
  7. use App\Enums\Accounting\DocumentType;
  8. use App\Enums\Accounting\EstimateStatus;
  9. use App\Enums\Setting\PaymentTerms;
  10. use App\Filament\Company\Resources\Sales\ClientResource\RelationManagers\EstimatesRelationManager;
  11. use App\Filament\Company\Resources\Sales\EstimateResource\Pages;
  12. use App\Filament\Company\Resources\Sales\EstimateResource\Widgets;
  13. use App\Filament\Forms\Components\CreateAdjustmentSelect;
  14. use App\Filament\Forms\Components\CreateClientSelect;
  15. use App\Filament\Forms\Components\CreateCurrencySelect;
  16. use App\Filament\Forms\Components\CreateOfferingSelect;
  17. use App\Filament\Forms\Components\CustomTableRepeater;
  18. use App\Filament\Forms\Components\DocumentFooterSection;
  19. use App\Filament\Forms\Components\DocumentHeaderSection;
  20. use App\Filament\Forms\Components\DocumentTotals;
  21. use App\Filament\Tables\Actions\ReplicateBulkAction;
  22. use App\Filament\Tables\Columns;
  23. use App\Filament\Tables\Filters\DateRangeFilter;
  24. use App\Models\Accounting\Adjustment;
  25. use App\Models\Accounting\DocumentLineItem;
  26. use App\Models\Accounting\Estimate;
  27. use App\Models\Common\Client;
  28. use App\Models\Common\Offering;
  29. use App\Utilities\Currency\CurrencyAccessor;
  30. use App\Utilities\Currency\CurrencyConverter;
  31. use App\Utilities\RateCalculator;
  32. use Awcodes\TableRepeater\Header;
  33. use Filament\Forms;
  34. use Filament\Forms\Form;
  35. use Filament\Notifications\Notification;
  36. use Filament\Resources\Resource;
  37. use Filament\Support\Enums\MaxWidth;
  38. use Filament\Tables;
  39. use Filament\Tables\Table;
  40. use Guava\FilamentClusters\Forms\Cluster;
  41. use Illuminate\Database\Eloquent\Collection;
  42. use Illuminate\Support\Carbon;
  43. use Illuminate\Support\Facades\Auth;
  44. class EstimateResource extends Resource
  45. {
  46. protected static ?string $model = Estimate::class;
  47. public static function form(Form $form): Form
  48. {
  49. $company = Auth::user()->currentCompany;
  50. $settings = $company->defaultEstimate;
  51. return $form
  52. ->schema([
  53. DocumentHeaderSection::make('Estimate Header')
  54. ->defaultHeader($settings->header)
  55. ->defaultSubheader($settings->subheader),
  56. Forms\Components\Section::make('Estimate Details')
  57. ->schema([
  58. Forms\Components\Split::make([
  59. Forms\Components\Group::make([
  60. CreateClientSelect::make('client_id')
  61. ->label('Client')
  62. ->required()
  63. ->live()
  64. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state) {
  65. if (! $state) {
  66. return;
  67. }
  68. $currencyCode = Client::find($state)?->currency_code;
  69. if ($currencyCode) {
  70. $set('currency_code', $currencyCode);
  71. }
  72. }),
  73. CreateCurrencySelect::make('currency_code'),
  74. ]),
  75. Forms\Components\Group::make([
  76. Forms\Components\TextInput::make('estimate_number')
  77. ->label('Estimate number')
  78. ->default(static fn () => Estimate::getNextDocumentNumber()),
  79. Forms\Components\TextInput::make('reference_number')
  80. ->label('Reference number'),
  81. Cluster::make([
  82. Forms\Components\DatePicker::make('date')
  83. ->label('Estimate date')
  84. ->live()
  85. ->default(now())
  86. ->columnSpan(2)
  87. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state) {
  88. $date = $state;
  89. $expirationDate = $get('expiration_date');
  90. if ($date && $expirationDate && $date > $expirationDate) {
  91. $set('expiration_date', $date);
  92. }
  93. $paymentTerms = $get('payment_terms');
  94. if ($date && $paymentTerms && $paymentTerms !== 'custom') {
  95. $terms = PaymentTerms::parse($paymentTerms);
  96. $set('expiration_date', Carbon::parse($date)->addDays($terms->getDays())->toDateString());
  97. }
  98. }),
  99. Forms\Components\Select::make('payment_terms')
  100. ->label('Payment terms')
  101. ->options(function () {
  102. return collect(PaymentTerms::cases())
  103. ->mapWithKeys(function (PaymentTerms $paymentTerm) {
  104. return [$paymentTerm->value => $paymentTerm->getLabel()];
  105. })
  106. ->put('custom', 'Custom')
  107. ->toArray();
  108. })
  109. ->selectablePlaceholder(false)
  110. ->default($settings->payment_terms->value)
  111. ->live()
  112. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state) {
  113. if (! $state || $state === 'custom') {
  114. return;
  115. }
  116. $date = $get('date');
  117. if ($date) {
  118. $terms = PaymentTerms::parse($state);
  119. $set('expiration_date', Carbon::parse($date)->addDays($terms->getDays())->toDateString());
  120. }
  121. }),
  122. ])
  123. ->label('Estimate date')
  124. ->columns(3),
  125. Forms\Components\DatePicker::make('expiration_date')
  126. ->label('Expiration date')
  127. ->default(function () use ($settings) {
  128. return now()->addDays($settings->payment_terms->getDays());
  129. })
  130. ->minDate(static function (Forms\Get $get) {
  131. return $get('date') ?? now();
  132. })
  133. ->live()
  134. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state) {
  135. if (! $state) {
  136. return;
  137. }
  138. $date = $get('date');
  139. $paymentTerms = $get('payment_terms');
  140. if (! $date || $paymentTerms === 'custom') {
  141. return;
  142. }
  143. $term = PaymentTerms::parse($paymentTerms);
  144. $expected = Carbon::parse($date)->addDays($term->getDays());
  145. if (! Carbon::parse($state)->isSameDay($expected)) {
  146. $set('payment_terms', 'custom');
  147. }
  148. }),
  149. Forms\Components\Select::make('discount_method')
  150. ->label('Discount method')
  151. ->options(DocumentDiscountMethod::class)
  152. ->selectablePlaceholder(false)
  153. ->default($settings->discount_method)
  154. ->afterStateUpdated(function ($state, Forms\Set $set) {
  155. $discountMethod = DocumentDiscountMethod::parse($state);
  156. if ($discountMethod->isPerDocument()) {
  157. $set('lineItems.*.salesDiscounts', []);
  158. }
  159. })
  160. ->live(),
  161. ])->grow(true),
  162. ])->from('md'),
  163. CustomTableRepeater::make('lineItems')
  164. ->hiddenLabel()
  165. ->relationship()
  166. ->saveRelationshipsUsing(null)
  167. ->dehydrated(true)
  168. ->reorderable()
  169. ->reorderAtStart()
  170. ->cloneable()
  171. ->headers(function (Forms\Get $get) use ($settings) {
  172. $hasDiscounts = DocumentDiscountMethod::parse($get('discount_method'))->isPerLineItem();
  173. $headers = [
  174. Header::make($settings->resolveColumnLabel('item_name', 'Items'))
  175. ->width($hasDiscounts ? '15%' : '20%'),
  176. Header::make('Description')
  177. ->width($hasDiscounts ? '15%' : '20%'),
  178. Header::make($settings->resolveColumnLabel('unit_name', 'Quantity'))
  179. ->width('10%'),
  180. Header::make($settings->resolveColumnLabel('price_name', 'Price'))
  181. ->width('10%'),
  182. Header::make('Taxes')
  183. ->width($hasDiscounts ? '20%' : '30%'),
  184. ];
  185. if ($hasDiscounts) {
  186. $headers[] = Header::make('Discounts')->width('20%');
  187. }
  188. $headers[] = Header::make($settings->resolveColumnLabel('amount_name', 'Amount'))
  189. ->width('10%')
  190. ->align('right');
  191. return $headers;
  192. })
  193. ->schema([
  194. CreateOfferingSelect::make('offering_id')
  195. ->label('Item')
  196. ->required()
  197. ->live()
  198. ->sellable()
  199. ->afterStateUpdated(function (Forms\Set $set, Forms\Get $get, $state, ?DocumentLineItem $record) {
  200. $offeringId = $state;
  201. $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
  202. $isPerLineItem = $discountMethod->isPerLineItem();
  203. $existingTaxIds = [];
  204. $existingDiscountIds = [];
  205. if ($record) {
  206. $existingTaxIds = $record->salesTaxes()->pluck('adjustments.id')->toArray();
  207. if ($isPerLineItem) {
  208. $existingDiscountIds = $record->salesDiscounts()->pluck('adjustments.id')->toArray();
  209. }
  210. }
  211. $with = [
  212. 'salesTaxes' => static function ($query) use ($existingTaxIds) {
  213. $query->where(static function ($query) use ($existingTaxIds) {
  214. $query->where('status', AdjustmentStatus::Active)
  215. ->orWhereIn('adjustments.id', $existingTaxIds);
  216. });
  217. },
  218. ];
  219. if ($isPerLineItem) {
  220. $with['salesDiscounts'] = static function ($query) use ($existingDiscountIds) {
  221. $query->where(static function ($query) use ($existingDiscountIds) {
  222. $query->where('status', AdjustmentStatus::Active)
  223. ->orWhereIn('adjustments.id', $existingDiscountIds);
  224. });
  225. };
  226. }
  227. $offeringRecord = Offering::with($with)->find($offeringId);
  228. if (! $offeringRecord) {
  229. return;
  230. }
  231. $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
  232. $set('description', $offeringRecord->description);
  233. $set('unit_price', $unitPrice);
  234. $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
  235. if ($isPerLineItem) {
  236. $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
  237. }
  238. }),
  239. Forms\Components\TextInput::make('description'),
  240. Forms\Components\TextInput::make('quantity')
  241. ->required()
  242. ->numeric()
  243. ->live()
  244. ->maxValue(9999999999.99)
  245. ->default(1),
  246. Forms\Components\TextInput::make('unit_price')
  247. ->hiddenLabel()
  248. ->numeric()
  249. ->live()
  250. ->maxValue(9999999999.99)
  251. ->default(0),
  252. CreateAdjustmentSelect::make('salesTaxes')
  253. ->label('Taxes')
  254. ->category(AdjustmentCategory::Tax)
  255. ->type(AdjustmentType::Sales)
  256. ->adjustmentsRelationship('salesTaxes')
  257. ->saveRelationshipsUsing(null)
  258. ->dehydrated(true)
  259. ->preload()
  260. ->multiple()
  261. ->live()
  262. ->searchable(),
  263. CreateAdjustmentSelect::make('salesDiscounts')
  264. ->label('Discounts')
  265. ->category(AdjustmentCategory::Discount)
  266. ->type(AdjustmentType::Sales)
  267. ->adjustmentsRelationship('salesDiscounts')
  268. ->saveRelationshipsUsing(null)
  269. ->dehydrated(true)
  270. ->multiple()
  271. ->live()
  272. ->hidden(function (Forms\Get $get) {
  273. $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
  274. return $discountMethod->isPerDocument();
  275. })
  276. ->searchable(),
  277. Forms\Components\Placeholder::make('total')
  278. ->hiddenLabel()
  279. ->extraAttributes(['class' => 'text-left sm:text-right'])
  280. ->content(function (Forms\Get $get) {
  281. $quantity = max((float) ($get('quantity') ?? 0), 0);
  282. $unitPrice = max((float) ($get('unit_price') ?? 0), 0);
  283. $salesTaxes = $get('salesTaxes') ?? [];
  284. $salesDiscounts = $get('salesDiscounts') ?? [];
  285. $currencyCode = $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency();
  286. $subtotal = $quantity * $unitPrice;
  287. $subtotalInCents = CurrencyConverter::convertToCents($subtotal, $currencyCode);
  288. $taxAmountInCents = Adjustment::whereIn('id', $salesTaxes)
  289. ->get()
  290. ->sum(function (Adjustment $adjustment) use ($subtotalInCents) {
  291. if ($adjustment->computation->isPercentage()) {
  292. return RateCalculator::calculatePercentage($subtotalInCents, $adjustment->getRawOriginal('rate'));
  293. } else {
  294. return $adjustment->getRawOriginal('rate');
  295. }
  296. });
  297. $discountAmountInCents = Adjustment::whereIn('id', $salesDiscounts)
  298. ->get()
  299. ->sum(function (Adjustment $adjustment) use ($subtotalInCents) {
  300. if ($adjustment->computation->isPercentage()) {
  301. return RateCalculator::calculatePercentage($subtotalInCents, $adjustment->getRawOriginal('rate'));
  302. } else {
  303. return $adjustment->getRawOriginal('rate');
  304. }
  305. });
  306. // Final total
  307. $totalInCents = $subtotalInCents + ($taxAmountInCents - $discountAmountInCents);
  308. return CurrencyConverter::formatCentsToMoney($totalInCents, $currencyCode);
  309. }),
  310. ]),
  311. DocumentTotals::make()
  312. ->type(DocumentType::Estimate),
  313. Forms\Components\Textarea::make('terms')
  314. ->default($settings->terms)
  315. ->columnSpanFull(),
  316. ]),
  317. DocumentFooterSection::make('Estimate Footer')
  318. ->defaultFooter($settings->footer),
  319. ]);
  320. }
  321. public static function table(Table $table): Table
  322. {
  323. return $table
  324. ->defaultSort('expiration_date')
  325. ->columns([
  326. Columns::id(),
  327. Tables\Columns\TextColumn::make('status')
  328. ->badge()
  329. ->searchable(),
  330. Tables\Columns\TextColumn::make('expiration_date')
  331. ->label('Expiration date')
  332. ->asRelativeDay()
  333. ->sortable(),
  334. Tables\Columns\TextColumn::make('date')
  335. ->date()
  336. ->sortable(),
  337. Tables\Columns\TextColumn::make('estimate_number')
  338. ->label('Number')
  339. ->searchable()
  340. ->sortable(),
  341. Tables\Columns\TextColumn::make('client.name')
  342. ->sortable()
  343. ->searchable()
  344. ->hiddenOn(EstimatesRelationManager::class),
  345. Tables\Columns\TextColumn::make('total')
  346. ->currencyWithConversion(static fn (Estimate $record) => $record->currency_code)
  347. ->sortable()
  348. ->alignEnd(),
  349. ])
  350. ->filters([
  351. Tables\Filters\SelectFilter::make('client')
  352. ->relationship('client', 'name')
  353. ->searchable()
  354. ->preload()
  355. ->hiddenOn(EstimatesRelationManager::class),
  356. Tables\Filters\SelectFilter::make('status')
  357. ->options(EstimateStatus::class)
  358. ->native(false),
  359. DateRangeFilter::make('date')
  360. ->fromLabel('From date')
  361. ->untilLabel('To date')
  362. ->indicatorLabel('Date'),
  363. DateRangeFilter::make('expiration_date')
  364. ->fromLabel('From expiration date')
  365. ->untilLabel('To expiration date')
  366. ->indicatorLabel('Due'),
  367. ])
  368. ->actions([
  369. Tables\Actions\ActionGroup::make([
  370. Tables\Actions\ActionGroup::make([
  371. Tables\Actions\EditAction::make()
  372. ->url(static fn (Estimate $record) => Pages\EditEstimate::getUrl(['record' => $record])),
  373. Tables\Actions\ViewAction::make()
  374. ->url(static fn (Estimate $record) => Pages\ViewEstimate::getUrl(['record' => $record])),
  375. Estimate::getReplicateAction(Tables\Actions\ReplicateAction::class),
  376. Estimate::getApproveDraftAction(Tables\Actions\Action::class),
  377. Estimate::getMarkAsSentAction(Tables\Actions\Action::class),
  378. Estimate::getMarkAsAcceptedAction(Tables\Actions\Action::class),
  379. Estimate::getMarkAsDeclinedAction(Tables\Actions\Action::class),
  380. Estimate::getConvertToInvoiceAction(Tables\Actions\Action::class),
  381. ])->dropdown(false),
  382. Tables\Actions\DeleteAction::make(),
  383. ]),
  384. ])
  385. ->bulkActions([
  386. Tables\Actions\BulkActionGroup::make([
  387. Tables\Actions\DeleteBulkAction::make(),
  388. ReplicateBulkAction::make()
  389. ->label('Replicate')
  390. ->modalWidth(MaxWidth::Large)
  391. ->modalDescription('Replicating estimates will also replicate their line items. Are you sure you want to proceed?')
  392. ->successNotificationTitle('Estimates replicated successfully')
  393. ->failureNotificationTitle('Failed to replicate estimates')
  394. ->databaseTransaction()
  395. ->deselectRecordsAfterCompletion()
  396. ->excludeAttributes([
  397. 'estimate_number',
  398. 'date',
  399. 'expiration_date',
  400. 'approved_at',
  401. 'accepted_at',
  402. 'converted_at',
  403. 'declined_at',
  404. 'last_sent_at',
  405. 'last_viewed_at',
  406. 'status',
  407. 'created_by',
  408. 'updated_by',
  409. 'created_at',
  410. 'updated_at',
  411. ])
  412. ->beforeReplicaSaved(function (Estimate $replica) {
  413. $replica->status = EstimateStatus::Draft;
  414. $replica->estimate_number = Estimate::getNextDocumentNumber();
  415. $replica->date = now();
  416. $replica->expiration_date = now()->addDays($replica->company->defaultInvoice->payment_terms->getDays());
  417. })
  418. ->withReplicatedRelationships(['lineItems'])
  419. ->withExcludedRelationshipAttributes('lineItems', [
  420. 'subtotal',
  421. 'total',
  422. 'created_by',
  423. 'updated_by',
  424. 'created_at',
  425. 'updated_at',
  426. ]),
  427. Tables\Actions\BulkAction::make('approveDrafts')
  428. ->label('Approve')
  429. ->icon('heroicon-o-check-circle')
  430. ->databaseTransaction()
  431. ->successNotificationTitle('Estimates approved')
  432. ->failureNotificationTitle('Failed to approve estimates')
  433. ->before(function (Collection $records, Tables\Actions\BulkAction $action) {
  434. $isInvalid = $records->contains(fn (Estimate $record) => ! $record->canBeApproved());
  435. if ($isInvalid) {
  436. Notification::make()
  437. ->title('Approval failed')
  438. ->body('Only draft estimates can be approved. Please adjust your selection and try again.')
  439. ->persistent()
  440. ->danger()
  441. ->send();
  442. $action->cancel(true);
  443. }
  444. })
  445. ->action(function (Collection $records, Tables\Actions\BulkAction $action) {
  446. $records->each(function (Estimate $record) {
  447. $record->approveDraft();
  448. });
  449. $action->success();
  450. }),
  451. Tables\Actions\BulkAction::make('markAsSent')
  452. ->label('Mark as sent')
  453. ->icon('heroicon-o-paper-airplane')
  454. ->databaseTransaction()
  455. ->successNotificationTitle('Estimates sent')
  456. ->failureNotificationTitle('Failed to mark estimates as sent')
  457. ->before(function (Collection $records, Tables\Actions\BulkAction $action) {
  458. $isInvalid = $records->contains(fn (Estimate $record) => ! $record->canBeMarkedAsSent());
  459. if ($isInvalid) {
  460. Notification::make()
  461. ->title('Sending failed')
  462. ->body('Only unsent estimates can be marked as sent. Please adjust your selection and try again.')
  463. ->persistent()
  464. ->danger()
  465. ->send();
  466. $action->cancel(true);
  467. }
  468. })
  469. ->action(function (Collection $records, Tables\Actions\BulkAction $action) {
  470. $records->each(function (Estimate $record) {
  471. $record->markAsSent();
  472. });
  473. $action->success();
  474. }),
  475. Tables\Actions\BulkAction::make('markAsAccepted')
  476. ->label('Mark as accepted')
  477. ->icon('heroicon-o-check-badge')
  478. ->databaseTransaction()
  479. ->successNotificationTitle('Estimates accepted')
  480. ->failureNotificationTitle('Failed to mark estimates as accepted')
  481. ->before(function (Collection $records, Tables\Actions\BulkAction $action) {
  482. $isInvalid = $records->contains(fn (Estimate $record) => ! $record->canBeMarkedAsAccepted());
  483. if ($isInvalid) {
  484. Notification::make()
  485. ->title('Acceptance failed')
  486. ->body('Only sent estimates that haven\'t been accepted can be marked as accepted. Please adjust your selection and try again.')
  487. ->persistent()
  488. ->danger()
  489. ->send();
  490. $action->cancel(true);
  491. }
  492. })
  493. ->action(function (Collection $records, Tables\Actions\BulkAction $action) {
  494. $records->each(function (Estimate $record) {
  495. $record->markAsAccepted();
  496. });
  497. $action->success();
  498. }),
  499. Tables\Actions\BulkAction::make('markAsDeclined')
  500. ->label('Mark as declined')
  501. ->icon('heroicon-o-x-circle')
  502. ->requiresConfirmation()
  503. ->databaseTransaction()
  504. ->color('danger')
  505. ->modalHeading('Mark Estimates as Declined')
  506. ->modalDescription('Are you sure you want to mark the selected estimates as declined? This action cannot be undone.')
  507. ->successNotificationTitle('Estimates declined')
  508. ->failureNotificationTitle('Failed to mark estimates as declined')
  509. ->before(function (Collection $records, Tables\Actions\BulkAction $action) {
  510. $isInvalid = $records->contains(fn (Estimate $record) => ! $record->canBeMarkedAsDeclined());
  511. if ($isInvalid) {
  512. Notification::make()
  513. ->title('Declination failed')
  514. ->body('Only sent estimates that haven\'t been declined can be marked as declined. Please adjust your selection and try again.')
  515. ->persistent()
  516. ->danger()
  517. ->send();
  518. $action->cancel(true);
  519. }
  520. })
  521. ->action(function (Collection $records, Tables\Actions\BulkAction $action) {
  522. $records->each(function (Estimate $record) {
  523. $record->markAsDeclined();
  524. });
  525. $action->success();
  526. }),
  527. ]),
  528. ]);
  529. }
  530. public static function getRelations(): array
  531. {
  532. return [
  533. //
  534. ];
  535. }
  536. public static function getPages(): array
  537. {
  538. return [
  539. 'index' => Pages\ListEstimates::route('/'),
  540. 'create' => Pages\CreateEstimate::route('/create'),
  541. 'view' => Pages\ViewEstimate::route('/{record}'),
  542. 'edit' => Pages\EditEstimate::route('/{record}/edit'),
  543. ];
  544. }
  545. public static function getWidgets(): array
  546. {
  547. return [
  548. Widgets\EstimateOverview::class,
  549. ];
  550. }
  551. }