authorize('billing.manage'); $this->statusMessage = (string) session('billing-status', ''); } /** * @return list */ #[Computed] public function exports(): array { return app(BillingQueries::class)->exports(); } #[Computed] public function openDraft(): ?ExportSummary { foreach ($this->exports as $export) { if ($export->status === ExportStatus::Draft) { return $export; } } return null; } public function openDraftNow(OpenBillingDraft $openBillingDraft): void { $this->authorize('billing.manage'); try { $id = $openBillingDraft->execute((int) auth()->id()); $this->redirectRoute('billing.export', ['export' => $id], navigate: true); } catch (DraftAlreadyOpen) { $this->statusMessage = __('billing.errors.draft_open'); unset($this->exports, $this->openDraft); } } /** * @return list */ public function headers(): array { return [ ['index' => 'number', 'label' => __('billing.index.columns.number'), 'sortable' => false], ['index' => 'status', 'label' => __('billing.index.columns.status'), 'sortable' => false], ['index' => 'created', 'label' => __('billing.index.columns.created'), 'sortable' => false], ['index' => 'finalized', 'label' => __('billing.index.columns.finalized'), 'sortable' => false], ['index' => 'invoices', 'label' => __('billing.index.columns.invoices'), 'sortable' => false, 'align' => 'right'], ['index' => 'jobs', 'label' => __('billing.index.columns.jobs'), 'sortable' => false, 'align' => 'right'], ['index' => 'net', 'label' => __('billing.index.columns.net'), 'sortable' => false, 'align' => 'right'], ]; } public function render(): mixed { return $this->view()->title(__('billing.index.title')); } }; ?>

{{ __('billing.index.title') }}

{{ __('billing.index.intro') }}

@if ($this->openDraft !== null) @else @endif

{{ $statusMessage }}

@if ($this->exports === [])

{{ __('billing.index.none') }}

@else @interact('column_number', $export) {{ __('billing.index.export_label', ['number' => $export->id]) }} @endinteract @interact('column_status', $export) @endinteract @interact('column_created', $export) {{ $this->timeLabel($export->createdAt) }} {{ $export->createdByName }} @endinteract @interact('column_finalized', $export) @if ($export->finalizedAt !== null) {{ $this->timeLabel($export->finalizedAt) }} {{ $export->finalizedByName }} @endif @endinteract @interact('column_invoices', $export) {{ $export->invoiceCount }} @endinteract @interact('column_jobs', $export) {{ $export->jobCount }} @endinteract @interact('column_net', $export) {{ $export->netCents === null ? '' : $this->money($export->netCents) }} @endinteract @endif