Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

EstimateResource.php 32KB

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