Files
petriandClaude Opus 5.5 51b40b24fe Give the UI an indigo look with cards, status badges and empty states
- Dark indigo header and tinted page background; the mobile main menu gets
  its own row, in the same order as the keyboard reaches it.
- Page titles with an icon chip (x-page-title, x-page, x-page-header) and
  card sections (x-panel, the card utility); x-table styled as a card with
  an indigo header row in AppServiceProvider::styleTables().
- Job and task statuses, late work, unapproved hours and stock states as
  badges with icon and text (x-status-badge, x-jobs.status,
  x-jobs.task-status), never colour alone.
- Empty lists as x-empty-state; dashboard quick link tiles, week hour bars
  and trend arrows; Kanban columns and task cards edged by status; calendar
  today column and bar accents; quick sale, reports and machine console
  restyled; signed-out pages show the app name.
- Focus rings use the primary colour in both themes (white in the header).
- Document the components in CLAUDE.md; test the status badges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 10:53:10 +02:00

158 lines
6.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use App\Modules\Billing\Application\DTOs\MonthlyBillingView;
use App\Modules\Billing\Application\Services\MonthlyBillingViews;
use App\Modules\Billing\Domain\ValueObjects\BillingMonths;
use App\Modules\Billing\Presentation\Livewire\Concerns\FormatsBilling;
use Livewire\Attributes\Computed;
use Livewire\Attributes\Locked;
use Livewire\Component;
/**
* The billing periods of a monthly fee job (spec 5.5): the months billed
* on created billing materials, with links to them, and the months from
* the job's start up to the current month that are still to bill.
* Management only.
*/
new class extends Component
{
use FormatsBilling;
#[Locked]
public int $jobId = 0;
public function mount(int $job): void
{
$this->authorize('billing.manage');
$this->jobId = $job;
if (app(MonthlyBillingViews::class)->forJob($job) === null) {
abort(404);
}
}
#[Computed]
public function billing(): MonthlyBillingView
{
return app(MonthlyBillingViews::class)->forJob($this->jobId) ?? abort(404);
}
public function monthLabel(string $month): string
{
return BillingMonths::label($month);
}
public function dayLabel(string $date): string
{
return (new DateTimeImmutable($date))->format('j.n.Y');
}
public function heading(): string
{
return __('billing.job_months.title', ['job' => $this->billing->job->number.' '.$this->billing->job->name]);
}
/**
* @return list<array{index: string, label: string, sortable: bool, align?: string}>
*/
public function headers(): array
{
return [
['index' => 'month', 'label' => __('billing.job_months.columns.month'), 'sortable' => false],
['index' => 'export', 'label' => __('billing.job_months.columns.export'), 'sortable' => false],
['index' => 'finalized', 'label' => __('billing.job_months.columns.finalized'), 'sortable' => false],
['index' => 'net', 'label' => __('billing.job_months.columns.net'), 'sortable' => false, 'align' => 'right'],
];
}
public function render(): mixed
{
return $this->view()->title($this->heading());
}
};
?>
@php($billing = $this->billing)
@php($job = $billing->job)
<div class="mx-auto max-w-4xl space-y-6 p-4 sm:p-6">
<div class="space-y-2">
<p><x-link :href="route('jobs.show', $job->id)" navigate>{{ __('billing.job_months.back') }}</x-link></p>
<x-page-title icon="calendar">{{ $this->heading() }}</x-page-title>
<p class="max-w-3xl text-sm">{{ __('billing.job_months.intro') }}</p>
</div>
<section aria-labelledby="summary-heading" class="card space-y-2">
<h2 id="summary-heading" class="sr-only">{{ __('billing.job_months.summary') }}</h2>
<dl class="grid grid-cols-1 gap-x-6 gap-y-1 text-sm sm:grid-cols-[auto_1fr]">
<dt class="font-medium">{{ __('billing.job_months.customer') }}</dt>
<dd>{{ $job->customerName }}</dd>
<dt class="font-medium">{{ __('billing.job_months.monthly_fee') }}</dt>
<dd>{{ $job->monthlyFeeCents === null ? __('billing.job_months.no_fee') : $this->money($job->monthlyFeeCents).' '.__('billing.job_months.vat_excluded') }}</dd>
<dt class="font-medium">{{ __('billing.job_months.starts') }}</dt>
<dd>{{ $job->billingStartsOn === '' ? '–' : $this->monthLabel(substr($job->billingStartsOn, 0, 7)) }}</dd>
<dt class="font-medium">{{ __('billing.job_months.ends') }}</dt>
<dd>{{ $billing->billingEndsOn === null ? __('billing.job_months.no_end') : $this->dayLabel($billing->billingEndsOn) }}</dd>
<dt class="font-medium">{{ __('billing.job_months.billing_unit') }}</dt>
<dd>{{ $job->billingUnitName ?? __('billing.invoices.no_billing_unit') }}</dd>
</dl>
@if (! $job->inBillableStatus)
<p class="flex items-center gap-1 text-sm font-medium">
<x-icon name="information-circle" class="size-5 shrink-0" aria-hidden="true" />
{{ __('billing.job_months.not_running') }}
</p>
@endif
</section>
<section aria-labelledby="billed-heading" class="space-y-3">
<h2 id="billed-heading" class="text-xl font-semibold">{{ __('billing.job_months.billed_title', ['count' => count($billing->billed)]) }}</h2>
@if ($billing->billed === [])
<x-empty-state icon="banknotes">{{ __('billing.job_months.none_billed') }}</x-empty-state>
@else
<x-table :headers="$this->headers()" :rows="$billing->billed">
@interact('column_month', $month)
<span class="whitespace-nowrap">{{ $this->monthLabel($month->month) }}</span>
@endinteract
@interact('column_export', $month)
<x-link :href="route('billing.export', $month->exportId)" navigate>{{ __('billing.index.export_label', ['number' => $month->exportNumber]) }}</x-link>
@endinteract
@interact('column_finalized', $month)
<span class="whitespace-nowrap">{{ $month->finalizedAt === null ? '' : $this->timeLabel($month->finalizedAt) }}</span>
@endinteract
@interact('column_net', $month)
<span class="whitespace-nowrap">{{ $this->money($month->netCents) }}</span>
@endinteract
</x-table>
<p class="text-sm font-medium">{{ __('billing.job_months.billed_total', ['net' => $this->money($billing->billedNetCents())]) }}</p>
@endif
</section>
<section aria-labelledby="unbilled-heading" class="card space-y-3">
<h2 id="unbilled-heading" class="text-xl font-semibold">{{ __('billing.job_months.unbilled_title', ['month' => $this->monthLabel($billing->currentMonth)]) }}</h2>
@if ($billing->unbilled === [])
<p class="flex items-center gap-1 text-sm">
<x-icon name="check-circle" class="size-5 shrink-0" aria-hidden="true" />
{{ __('billing.job_months.none_unbilled') }}
</p>
@else
<ul class="flex flex-wrap gap-2" aria-label="{{ __('billing.job_months.unbilled_list') }}">
@foreach ($billing->unbilled as $month)
<li class="rounded-md border border-zinc-300 px-3 py-1 text-sm dark:border-zinc-600">{{ $this->monthLabel($month) }}</li>
@endforeach
</ul>
<p class="text-sm">{{ __('billing.job_months.unbilled_help') }}</p>
@endif
</section>
</div>