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

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