Darken the dark canvas, add customer colours, the ongoing status and the board model
- Dark theme page background is #5a5e60; text on it is lifted to zinc-200 / primary-100 and TallStackUI's dark labels, hints and checkbox labels are lightened so everything stays at 4.5:1. - Shared HexColor picks white or black text by the higher WCAG contrast; a native-dialog colour picker and a large work dialog component. - Customers get a header colour (customers.header_color), set on the customer page. - New job status Jatkuvat / Kausi (ongoing): open, never late, billed monthly like running jobs. - Kanban model: board columns and views, urgent threshold, per-user board preferences (density, column colours and sort), card positions, tasks of continuing jobs pinned to the board, MoveBoardCard and board queries with logged hours from TimeTracking. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -21,8 +21,8 @@ use App\Modules\Jobs\Domain\Enums\PaymentBasis;
|
|||||||
*/
|
*/
|
||||||
class JobsForBilling implements BillingJobs
|
class JobsForBilling implements BillingJobs
|
||||||
{
|
{
|
||||||
/** Statuses in which a monthly fee job is billed: running or done. */
|
/** Statuses in which a monthly fee job is billed: running, ongoing or done. */
|
||||||
private const array MONTHLY_STATUSES = [JobStatus::Order, JobStatus::InProduction, JobStatus::OnHold, JobStatus::Done];
|
private const array MONTHLY_STATUSES = [JobStatus::Order, JobStatus::InProduction, JobStatus::OnHold, JobStatus::Done, JobStatus::Ongoing];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private CustomerJobQueries $jobs,
|
private CustomerJobQueries $jobs,
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ new class extends Component
|
|||||||
@error('period') aria-invalid="true" @enderror
|
@error('period') aria-invalid="true" @enderror
|
||||||
class="w-full rounded-md border border-zinc-400 bg-white px-2 py-1.5 text-zinc-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300 aria-invalid:border-red-700 dark:border-zinc-500 dark:bg-zinc-900 dark:text-zinc-100 dark:aria-invalid:border-red-400 dark:[color-scheme:dark]"
|
class="w-full rounded-md border border-zinc-400 bg-white px-2 py-1.5 text-zinc-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300 aria-invalid:border-red-700 dark:border-zinc-500 dark:bg-zinc-900 dark:text-zinc-100 dark:aria-invalid:border-red-400 dark:[color-scheme:dark]"
|
||||||
/>
|
/>
|
||||||
<p id="billing-period-help" class="text-xs text-zinc-600 dark:text-zinc-300">{{ __('billing.export.period_help') }}</p>
|
<p id="billing-period-help" class="text-xs text-zinc-600 dark:text-zinc-200">{{ __('billing.export.period_help') }}</p>
|
||||||
@error('period')
|
@error('period')
|
||||||
<p id="billing-period-error" class="text-xs text-red-700 dark:text-red-400">{{ $message }}</p>
|
<p id="billing-period-error" class="text-xs text-red-700 dark:text-red-400">{{ $message }}</p>
|
||||||
@enderror
|
@enderror
|
||||||
@@ -504,7 +504,7 @@ new class extends Component
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<p id="hours-help-{{ $job->jobId }}" class="text-xs text-zinc-600 dark:text-zinc-300">{{ __('billing.jobs.billable_help') }}</p>
|
<p id="hours-help-{{ $job->jobId }}" class="text-xs text-zinc-600 dark:text-zinc-200">{{ __('billing.jobs.billable_help') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@php($expenseLines = $this->linesOfKind($job, LineKind::Expense))
|
@php($expenseLines = $this->linesOfKind($job, LineKind::Expense))
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-1 text-sm">
|
<div class="space-y-1 text-sm">
|
||||||
<p class="text-zinc-600 dark:text-zinc-300">{{ __('catalog.intro') }}</p>
|
<p class="text-zinc-600 dark:text-zinc-200">{{ __('catalog.intro') }}</p>
|
||||||
<p><x-link :href="route('catalog.prices')" navigate>{{ __('catalog.prices_link') }}</x-link></p>
|
<p><x-link :href="route('catalog.prices')" navigate>{{ __('catalog.prices_link') }}</x-link></p>
|
||||||
<p><x-link :href="route('catalog.workflow-templates')" navigate>{{ __('catalog.workflows_link') }}</x-link></p>
|
<p><x-link :href="route('catalog.workflow-templates')" navigate>{{ __('catalog.workflows_link') }}</x-link></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -159,11 +159,11 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($unit->isShared)
|
@if ($unit->isShared)
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.shared') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.shared') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($unit->usesStock)
|
@if ($unit->usesStock)
|
||||||
<p class="flex items-center gap-1 text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="flex items-center gap-1 text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
<x-icon name="archive-box" class="size-4" aria-hidden="true" />
|
<x-icon name="archive-box" class="size-4" aria-hidden="true" />
|
||||||
{{ __('catalog.service_units.uses_stock_on') }}
|
{{ __('catalog.service_units.uses_stock_on') }}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ new class extends Component
|
|||||||
<section aria-labelledby="consumer-products-heading" class="space-y-4">
|
<section aria-labelledby="consumer-products-heading" class="space-y-4">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<h2 id="consumer-products-heading" class="text-xl font-semibold">{{ __('catalog.price_list.consumer_products') }}</h2>
|
<h2 id="consumer-products-heading" class="text-xl font-semibold">{{ __('catalog.price_list.consumer_products') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.price_list.consumer_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.price_list.consumer_help') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($this->consumerProducts === [])
|
@if ($this->consumerProducts === [])
|
||||||
@@ -156,7 +156,7 @@ new class extends Component
|
|||||||
<section aria-labelledby="hourly-rates-heading" class="space-y-4">
|
<section aria-labelledby="hourly-rates-heading" class="space-y-4">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<h2 id="hourly-rates-heading" class="text-xl font-semibold">{{ __('catalog.prices.hourly_rates') }}</h2>
|
<h2 id="hourly-rates-heading" class="text-xl font-semibold">{{ __('catalog.prices.hourly_rates') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.price_list.hourly_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.price_list.hourly_help') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach ($this->hourlyRates as $group)
|
@foreach ($this->hourlyRates as $group)
|
||||||
@@ -173,7 +173,7 @@ new class extends Component
|
|||||||
<tr wire:key="rate-{{ $row->workTypeId }}" class="border-b border-zinc-200 dark:border-zinc-700">
|
<tr wire:key="rate-{{ $row->workTypeId }}" class="border-b border-zinc-200 dark:border-zinc-700">
|
||||||
<th scope="row" class="py-2 pr-3 text-left font-normal break-words">
|
<th scope="row" class="py-2 pr-3 text-left font-normal break-words">
|
||||||
@if ($row->serviceName !== null)
|
@if ($row->serviceName !== null)
|
||||||
<span class="text-zinc-600 dark:text-zinc-300">{{ $row->serviceName }}:</span>
|
<span class="text-zinc-600 dark:text-zinc-200">{{ $row->serviceName }}:</span>
|
||||||
@endif
|
@endif
|
||||||
{{ $row->name }}
|
{{ $row->name }}
|
||||||
</th>
|
</th>
|
||||||
@@ -226,6 +226,6 @@ new class extends Component
|
|||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
@else
|
@else
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.price_list.no_permission') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.price_list.no_permission') }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-5xl space-y-8 p-4 sm:p-6">
|
<div class="mx-auto max-w-5xl space-y-8 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="tag">{{ __('catalog.prices.title') }}</x-page-title>
|
<x-page-title icon="tag">{{ __('catalog.prices.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.prices.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.prices.intro') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (session('status'))
|
@if (session('status'))
|
||||||
@@ -364,7 +364,7 @@ new class extends Component
|
|||||||
<section aria-labelledby="hourly-rates-heading" class="space-y-4">
|
<section aria-labelledby="hourly-rates-heading" class="space-y-4">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<h2 id="hourly-rates-heading" class="text-xl font-semibold">{{ __('catalog.prices.hourly_rates') }}</h2>
|
<h2 id="hourly-rates-heading" class="text-xl font-semibold">{{ __('catalog.prices.hourly_rates') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.prices.hourly_rates_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.prices.hourly_rates_help') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach ($this->hourlyRates as $group)
|
@foreach ($this->hourlyRates as $group)
|
||||||
@@ -388,7 +388,7 @@ new class extends Component
|
|||||||
<tr wire:key="rate-{{ $row->workTypeId }}" class="border-b border-zinc-200 align-top dark:border-zinc-700">
|
<tr wire:key="rate-{{ $row->workTypeId }}" class="border-b border-zinc-200 align-top dark:border-zinc-700">
|
||||||
<th scope="row" class="py-2 pr-3 text-left font-normal break-words">
|
<th scope="row" class="py-2 pr-3 text-left font-normal break-words">
|
||||||
@if ($row->serviceName !== null)
|
@if ($row->serviceName !== null)
|
||||||
<span class="text-zinc-600 dark:text-zinc-300">{{ $row->serviceName }}:</span>
|
<span class="text-zinc-600 dark:text-zinc-200">{{ $row->serviceName }}:</span>
|
||||||
@endif
|
@endif
|
||||||
{{ $row->name }}
|
{{ $row->name }}
|
||||||
@unless ($row->isActive)
|
@unless ($row->isActive)
|
||||||
@@ -424,7 +424,7 @@ new class extends Component
|
|||||||
<h2 id="products-heading" class="text-xl font-semibold">{{ __('catalog.products.title') }}</h2>
|
<h2 id="products-heading" class="text-xl font-semibold">{{ __('catalog.products.title') }}</h2>
|
||||||
<x-button :href="route('catalog.products.create')" wire:navigate icon="plus" :text="__('catalog.products.add')" />
|
<x-button :href="route('catalog.products.create')" wire:navigate icon="plus" :text="__('catalog.products.add')" />
|
||||||
</div>
|
</div>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.products.help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.products.help') }}</p>
|
||||||
|
|
||||||
@if ($this->products === [])
|
@if ($this->products === [])
|
||||||
<x-empty-state icon="tag">{{ __('catalog.products.none') }}</x-empty-state>
|
<x-empty-state icon="tag">{{ __('catalog.products.none') }}</x-empty-state>
|
||||||
@@ -444,14 +444,14 @@ new class extends Component
|
|||||||
@interact('column_net', $product)
|
@interact('column_net', $product)
|
||||||
<span class="whitespace-nowrap">{{ $this->money($product->netCents) }}</span>
|
<span class="whitespace-nowrap">{{ $this->money($product->netCents) }}</span>
|
||||||
@unless ($product->priceIncludesVat)
|
@unless ($product->priceIncludesVat)
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ __('catalog.products.entered') }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ __('catalog.products.entered') }}</span>
|
||||||
@endunless
|
@endunless
|
||||||
@endinteract
|
@endinteract
|
||||||
|
|
||||||
@interact('column_gross', $product)
|
@interact('column_gross', $product)
|
||||||
<span class="whitespace-nowrap">{{ $this->money($product->grossCents) }}</span>
|
<span class="whitespace-nowrap">{{ $this->money($product->grossCents) }}</span>
|
||||||
@if ($product->priceIncludesVat)
|
@if ($product->priceIncludesVat)
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ __('catalog.products.entered') }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ __('catalog.products.entered') }}</span>
|
||||||
@endif
|
@endif
|
||||||
@endinteract
|
@endinteract
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ new class extends Component
|
|||||||
@if ($product->durationQuarters > 0)
|
@if ($product->durationQuarters > 0)
|
||||||
{{ __('catalog.products.duration_value', ['hours' => $this->duration($product->durationQuarters)]) }}
|
{{ __('catalog.products.duration_value', ['hours' => $this->duration($product->durationQuarters)]) }}
|
||||||
@if ($product->workTypeName !== null)
|
@if ($product->workTypeName !== null)
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ $product->workTypeName }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ $product->workTypeName }}</span>
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
{{ __('catalog.products.no_duration') }}
|
{{ __('catalog.products.no_duration') }}
|
||||||
@@ -492,7 +492,7 @@ new class extends Component
|
|||||||
<h2 id="vat-rates-heading" class="text-xl font-semibold">{{ __('catalog.vat_rates.title') }}</h2>
|
<h2 id="vat-rates-heading" class="text-xl font-semibold">{{ __('catalog.vat_rates.title') }}</h2>
|
||||||
<x-button :href="route('catalog.vat-rates.create')" wire:navigate icon="plus" :text="__('catalog.vat_rates.add')" />
|
<x-button :href="route('catalog.vat-rates.create')" wire:navigate icon="plus" :text="__('catalog.vat_rates.add')" />
|
||||||
</div>
|
</div>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.vat_rates.help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.vat_rates.help') }}</p>
|
||||||
|
|
||||||
<x-table :headers="$this->vatRateHeaders()" :rows="$this->vatRates">
|
<x-table :headers="$this->vatRateHeaders()" :rows="$this->vatRates">
|
||||||
@interact('column_name', $vatRate)
|
@interact('column_name', $vatRate)
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ new class extends Component
|
|||||||
|
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-checkbox id="product-consumer" wire:model.live="form.is_consumer_product" :label="__('catalog.products.consumer')" />
|
<x-checkbox id="product-consumer" wire:model.live="form.is_consumer_product" :label="__('catalog.products.consumer')" />
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.products.consumer_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.products.consumer_help') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<x-select.native wire:model.live="form.vat_rate_id" :label="__('catalog.products.vat_rate')" :aria-label="__('catalog.products.vat_rate')">
|
<x-select.native wire:model.live="form.vat_rate_id" :label="__('catalog.products.vat_rate')" :aria-label="__('catalog.products.vat_rate')">
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ new class extends Component
|
|||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="rectangle-stack">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="rectangle-stack">{{ $this->heading() }}</x-page-title>
|
||||||
@if ($unitName !== '')
|
@if ($unitName !== '')
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.fields.service_unit') }}: {{ $unitName }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.fields.service_unit') }}: {{ $unitName }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ new class extends Component
|
|||||||
@unless ($isShared)
|
@unless ($isShared)
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-checkbox id="uses-stock" wire:model="usesStock" :label="__('catalog.service_units.uses_stock')" />
|
<x-checkbox id="uses-stock" wire:model="usesStock" :label="__('catalog.service_units.uses_stock')" />
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.service_units.uses_stock_hint') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.service_units.uses_stock_hint') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@endunless
|
@endunless
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ new class extends Component
|
|||||||
<x-page-title icon="receipt-percent">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="receipt-percent">{{ $this->heading() }}</x-page-title>
|
||||||
|
|
||||||
@if ($vatRateId !== null)
|
@if ($vatRateId !== null)
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.vat_rates.change_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.vat_rates.change_help') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<form wire:submit="save" class="card space-y-6" novalidate>
|
<form wire:submit="save" class="card space-y-6" novalidate>
|
||||||
@@ -126,7 +126,7 @@ new class extends Component
|
|||||||
@else
|
@else
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-checkbox id="vat-rate-default" wire:model="makeDefault" :label="__('catalog.vat_rates.make_default')" />
|
<x-checkbox id="vat-rate-default" wire:model="makeDefault" :label="__('catalog.vat_rates.make_default')" />
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.vat_rates.make_default_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.vat_rates.make_default_help') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ new class extends Component
|
|||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="wrench-screwdriver">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="wrench-screwdriver">{{ $this->heading() }}</x-page-title>
|
||||||
@if ($unitName !== '')
|
@if ($unitName !== '')
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.fields.service_unit') }}: {{ $unitName }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.fields.service_unit') }}: {{ $unitName }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ new class extends Component
|
|||||||
<section aria-labelledby="steps-heading" class="space-y-4 rounded-lg border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50">
|
<section aria-labelledby="steps-heading" class="space-y-4 rounded-lg border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<h2 id="steps-heading" class="text-xl font-semibold">{{ __('catalog.workflows.steps') }}</h2>
|
<h2 id="steps-heading" class="text-xl font-semibold">{{ __('catalog.workflows.steps') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.workflows.steps_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.workflows.steps_help') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p role="status" aria-live="polite" class="text-sm">{{ $statusMessage }}</p>
|
<p role="status" aria-live="polite" class="text-sm">{{ $statusMessage }}</p>
|
||||||
@@ -388,7 +388,7 @@ new class extends Component
|
|||||||
@if ($this->stepUsesStock($index) || ($step['materials'] ?? []) !== [])
|
@if ($this->stepUsesStock($index) || ($step['materials'] ?? []) !== [])
|
||||||
<fieldset class="space-y-3">
|
<fieldset class="space-y-3">
|
||||||
<legend class="text-sm font-semibold">{{ __('catalog.workflows.materials') }}</legend>
|
<legend class="text-sm font-semibold">{{ __('catalog.workflows.materials') }}</legend>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('catalog.workflows.materials_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('catalog.workflows.materials_help') }}</p>
|
||||||
|
|
||||||
@foreach ($step['materials'] ?? [] as $materialIndex => $material)
|
@foreach ($step['materials'] ?? [] as $materialIndex => $material)
|
||||||
<div wire:key="material-{{ $material['key'] }}-{{ $materialIndex }}" class="flex flex-wrap items-end gap-2">
|
<div wire:key="material-{{ $material['key'] }}-{{ $materialIndex }}" class="flex flex-wrap items-end gap-2">
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-1 text-sm">
|
<div class="space-y-1 text-sm">
|
||||||
<p class="text-zinc-600 dark:text-zinc-300">{{ __('catalog.workflows.intro') }}</p>
|
<p class="text-zinc-600 dark:text-zinc-200">{{ __('catalog.workflows.intro') }}</p>
|
||||||
<p><x-link :href="route('catalog.index')" navigate>{{ __('catalog.workflows.back_to_catalog') }}</x-link></p>
|
<p><x-link :href="route('catalog.index')" navigate>{{ __('catalog.workflows.back_to_catalog') }}</x-link></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ interface CustomerQueries
|
|||||||
*/
|
*/
|
||||||
public function namesByIds(array $ids): array;
|
public function namesByIds(array $ids): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card header colours (#rrggbb, null = default colour) by customer id.
|
||||||
|
*
|
||||||
|
* @param list<int> $ids
|
||||||
|
* @return array<int, string|null>
|
||||||
|
*/
|
||||||
|
public function headerColorsByIds(array $ids): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The company's own internal customer, whose jobs hold internal work
|
* The company's own internal customer, whose jobs hold internal work
|
||||||
* and the yearly quick sale job.
|
* and the yearly quick sale job.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ final readonly class CustomerSummary
|
|||||||
public ?string $businessId,
|
public ?string $businessId,
|
||||||
public ?string $personalIdentityCodeMasked = null,
|
public ?string $personalIdentityCodeMasked = null,
|
||||||
public bool $isInternal = false,
|
public bool $isInternal = false,
|
||||||
|
public ?string $headerColor = null,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function hasPersonalIdentityCode(): bool
|
public function hasPersonalIdentityCode(): bool
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Customers\Application\UseCases;
|
||||||
|
|
||||||
|
use App\Modules\Customers\Domain\Contracts\CustomerRepository;
|
||||||
|
use App\Modules\Customers\Domain\Exceptions\CustomerNotFound;
|
||||||
|
use App\Modules\Shared\Application\Contracts\TransactionManager;
|
||||||
|
use App\Modules\Shared\Domain\Exceptions\InvalidHexColor;
|
||||||
|
use App\Modules\Shared\Domain\ValueObjects\HexColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the customer's colour, shared by its Kanban cards and its time sheet
|
||||||
|
* rows. Null returns to the default colour.
|
||||||
|
*/
|
||||||
|
final class ChangeCustomerHeaderColor
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private CustomerRepository $customers,
|
||||||
|
private TransactionManager $transactions,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws CustomerNotFound
|
||||||
|
* @throws InvalidHexColor
|
||||||
|
*/
|
||||||
|
public function execute(int $customerId, ?string $color): void
|
||||||
|
{
|
||||||
|
$headerColor = $color === null || trim($color) === '' ? null : new HexColor($color);
|
||||||
|
|
||||||
|
$this->transactions->run(function () use ($customerId, $headerColor): void {
|
||||||
|
$customer = $this->customers->findById($customerId) ?? throw new CustomerNotFound($customerId);
|
||||||
|
|
||||||
|
$customer->changeHeaderColor($headerColor);
|
||||||
|
|
||||||
|
$this->customers->save($customer);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ use App\Modules\Customers\Domain\Exceptions\InternalCustomerMustBeCompany;
|
|||||||
use App\Modules\Customers\Domain\ValueObjects\CustomerName;
|
use App\Modules\Customers\Domain\ValueObjects\CustomerName;
|
||||||
use App\Modules\Customers\Domain\ValueObjects\PersonalIdentityCode;
|
use App\Modules\Customers\Domain\ValueObjects\PersonalIdentityCode;
|
||||||
use App\Modules\Shared\Domain\ValueObjects\BusinessId;
|
use App\Modules\Shared\Domain\ValueObjects\BusinessId;
|
||||||
|
use App\Modules\Shared\Domain\ValueObjects\HexColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A customer of the company: a business or a private consumer.
|
* A customer of the company: a business or a private consumer.
|
||||||
@@ -27,6 +28,7 @@ final class Customer
|
|||||||
private ?BusinessId $businessId,
|
private ?BusinessId $businessId,
|
||||||
private ?PersonalIdentityCode $personalIdentityCode,
|
private ?PersonalIdentityCode $personalIdentityCode,
|
||||||
private bool $internal = false,
|
private bool $internal = false,
|
||||||
|
private ?HexColor $headerColor = null,
|
||||||
) {
|
) {
|
||||||
self::ensureIdentifiersFitType($type, $businessId, $personalIdentityCode);
|
self::ensureIdentifiersFitType($type, $businessId, $personalIdentityCode);
|
||||||
self::ensureInternalIsCompany($internal, $type);
|
self::ensureInternalIsCompany($internal, $type);
|
||||||
@@ -54,8 +56,9 @@ final class Customer
|
|||||||
?BusinessId $businessId,
|
?BusinessId $businessId,
|
||||||
?PersonalIdentityCode $personalIdentityCode = null,
|
?PersonalIdentityCode $personalIdentityCode = null,
|
||||||
bool $internal = false,
|
bool $internal = false,
|
||||||
|
?HexColor $headerColor = null,
|
||||||
): self {
|
): self {
|
||||||
return new self($id, $name, $type, $businessId, $personalIdentityCode, $internal);
|
return new self($id, $name, $type, $businessId, $personalIdentityCode, $internal, $headerColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,6 +84,20 @@ final class Customer
|
|||||||
$this->personalIdentityCode = $personalIdentityCode;
|
$this->personalIdentityCode = $personalIdentityCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The colour of the customer's card headers on the Kanban board and of
|
||||||
|
* its rows on the time sheet. Null uses the default colour.
|
||||||
|
*/
|
||||||
|
public function changeHeaderColor(?HexColor $color): void
|
||||||
|
{
|
||||||
|
$this->headerColor = $color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headerColor(): ?HexColor
|
||||||
|
{
|
||||||
|
return $this->headerColor;
|
||||||
|
}
|
||||||
|
|
||||||
public function removePersonalIdentityCode(): void
|
public function removePersonalIdentityCode(): void
|
||||||
{
|
{
|
||||||
$this->personalIdentityCode = null;
|
$this->personalIdentityCode = null;
|
||||||
|
|||||||
@@ -23,9 +23,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property string|null $personal_identity_code Decrypted by the cast; sensitive.
|
* @property string|null $personal_identity_code Decrypted by the cast; sensitive.
|
||||||
* @property string|null $personal_identity_code_hash
|
* @property string|null $personal_identity_code_hash
|
||||||
* @property bool $is_internal
|
* @property bool $is_internal
|
||||||
|
* @property string|null $header_color #rrggbb
|
||||||
*/
|
*/
|
||||||
#[Table('customers')]
|
#[Table('customers')]
|
||||||
#[Fillable(['name', 'type', 'business_id', 'personal_identity_code', 'personal_identity_code_hash'])]
|
#[Fillable(['name', 'type', 'business_id', 'personal_identity_code', 'personal_identity_code_hash', 'header_color'])]
|
||||||
#[Hidden(['personal_identity_code', 'personal_identity_code_hash'])]
|
#[Hidden(['personal_identity_code', 'personal_identity_code_hash'])]
|
||||||
#[UseFactory(CustomerFactory::class)]
|
#[UseFactory(CustomerFactory::class)]
|
||||||
class CustomerModel extends Model
|
class CustomerModel extends Model
|
||||||
|
|||||||
+6
-1
@@ -27,6 +27,11 @@ class EloquentCustomerQueries implements CustomerQueries
|
|||||||
return $ids === [] ? [] : CustomerModel::query()->whereIn('id', $ids)->pluck('name', 'id')->all();
|
return $ids === [] ? [] : CustomerModel::query()->whereIn('id', $ids)->pluck('name', 'id')->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function headerColorsByIds(array $ids): array
|
||||||
|
{
|
||||||
|
return $ids === [] ? [] : CustomerModel::query()->whereIn('id', $ids)->pluck('header_color', 'id')->all();
|
||||||
|
}
|
||||||
|
|
||||||
public function internalCustomerId(): ?int
|
public function internalCustomerId(): ?int
|
||||||
{
|
{
|
||||||
$id = CustomerModel::query()->where('is_internal', true)->orderBy('id')->value('id');
|
$id = CustomerModel::query()->where('is_internal', true)->orderBy('id')->value('id');
|
||||||
@@ -118,7 +123,7 @@ class EloquentCustomerQueries implements CustomerQueries
|
|||||||
? null
|
? null
|
||||||
: (new PersonalIdentityCode($model->personal_identity_code))->masked();
|
: (new PersonalIdentityCode($model->personal_identity_code))->masked();
|
||||||
|
|
||||||
return new CustomerSummary($model->id, $model->name, $model->type, $model->business_id, $masked, (bool) $model->is_internal);
|
return new CustomerSummary($model->id, $model->name, $model->type, $model->business_id, $masked, (bool) $model->is_internal, $model->header_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function toContactSummary(CustomerContactModel $model): ContactSummary
|
private function toContactSummary(CustomerContactModel $model): ContactSummary
|
||||||
|
|||||||
+3
@@ -10,6 +10,7 @@ use App\Modules\Customers\Domain\ValueObjects\PersonalIdentityCode;
|
|||||||
use App\Modules\Customers\Infrastructure\Persistence\Eloquent\CustomerModel;
|
use App\Modules\Customers\Infrastructure\Persistence\Eloquent\CustomerModel;
|
||||||
use App\Modules\Customers\Infrastructure\Persistence\PersonalIdentityCodeHasher;
|
use App\Modules\Customers\Infrastructure\Persistence\PersonalIdentityCodeHasher;
|
||||||
use App\Modules\Shared\Domain\ValueObjects\BusinessId;
|
use App\Modules\Shared\Domain\ValueObjects\BusinessId;
|
||||||
|
use App\Modules\Shared\Domain\ValueObjects\HexColor;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
|
|
||||||
class EloquentCustomerRepository implements CustomerRepository
|
class EloquentCustomerRepository implements CustomerRepository
|
||||||
@@ -35,6 +36,7 @@ class EloquentCustomerRepository implements CustomerRepository
|
|||||||
'business_id' => $customer->businessId()?->value,
|
'business_id' => $customer->businessId()?->value,
|
||||||
'personal_identity_code' => $customer->personalIdentityCode()?->value,
|
'personal_identity_code' => $customer->personalIdentityCode()?->value,
|
||||||
'personal_identity_code_hash' => $customer->personalIdentityCode() === null ? null : $this->hasher->hash($customer->personalIdentityCode()),
|
'personal_identity_code_hash' => $customer->personalIdentityCode() === null ? null : $this->hasher->hash($customer->personalIdentityCode()),
|
||||||
|
'header_color' => $customer->headerColor()?->value,
|
||||||
])->save();
|
])->save();
|
||||||
|
|
||||||
return $this->toEntity($model);
|
return $this->toEntity($model);
|
||||||
@@ -83,6 +85,7 @@ class EloquentCustomerRepository implements CustomerRepository
|
|||||||
$model->business_id === null ? null : new BusinessId($model->business_id),
|
$model->business_id === null ? null : new BusinessId($model->business_id),
|
||||||
$model->personal_identity_code === null ? null : new PersonalIdentityCode($model->personal_identity_code),
|
$model->personal_identity_code === null ? null : new PersonalIdentityCode($model->personal_identity_code),
|
||||||
(bool) $model->is_internal,
|
(bool) $model->is_internal,
|
||||||
|
$model->header_color === null ? null : new HexColor($model->header_color),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="building-office-2">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="building-office-2">{{ $this->heading() }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('customers.customer_label') }}:
|
{{ __('customers.customer_label') }}:
|
||||||
<x-link :href="route('customers.show', $customerId)" navigate>{{ $customerName }}</x-link>
|
<x-link :href="route('customers.show', $customerId)" navigate>{{ $customerName }}</x-link>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="user">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="user">{{ $this->heading() }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('customers.customer_label') }}:
|
{{ __('customers.customer_label') }}:
|
||||||
<x-link :href="route('customers.show', $customerId)" navigate>{{ $customerName }}</x-link>
|
<x-link :href="route('customers.show', $customerId)" navigate>{{ $customerName }}</x-link>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ new class extends Component
|
|||||||
:hint="__('customers.search_description')"
|
:hint="__('customers.search_description')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm text-zinc-600 dark:text-zinc-100">
|
||||||
{{ trans_choice('customers.result_count', $this->customers->total(), ['count' => $this->customers->total()]) }}
|
{{ trans_choice('customers.result_count', $this->customers->total(), ['count' => $this->customers->total()]) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use App\Modules\Customers\Application\DTOs\BillingUnitSummary;
|
|||||||
use App\Modules\Customers\Application\DTOs\ContactSummary;
|
use App\Modules\Customers\Application\DTOs\ContactSummary;
|
||||||
use App\Modules\Customers\Application\DTOs\CustomerSummary;
|
use App\Modules\Customers\Application\DTOs\CustomerSummary;
|
||||||
use App\Modules\Customers\Application\Services\CustomerRemoval;
|
use App\Modules\Customers\Application\Services\CustomerRemoval;
|
||||||
|
use App\Modules\Customers\Application\UseCases\ChangeCustomerHeaderColor;
|
||||||
use App\Modules\Customers\Application\UseCases\RemoveBillingUnit;
|
use App\Modules\Customers\Application\UseCases\RemoveBillingUnit;
|
||||||
use App\Modules\Customers\Application\UseCases\RemoveContact;
|
use App\Modules\Customers\Application\UseCases\RemoveContact;
|
||||||
use App\Modules\Customers\Application\UseCases\RemoveCustomer;
|
use App\Modules\Customers\Application\UseCases\RemoveCustomer;
|
||||||
@@ -16,6 +17,7 @@ use App\Modules\Customers\Domain\Exceptions\CustomerInUse;
|
|||||||
use App\Modules\Customers\Domain\Exceptions\CustomerNotFound;
|
use App\Modules\Customers\Domain\Exceptions\CustomerNotFound;
|
||||||
use App\Modules\Customers\Domain\Exceptions\InternalCustomerCannotBeRemoved;
|
use App\Modules\Customers\Domain\Exceptions\InternalCustomerCannotBeRemoved;
|
||||||
use App\Modules\Customers\Domain\Enums\CustomerType;
|
use App\Modules\Customers\Domain\Enums\CustomerType;
|
||||||
|
use App\Modules\Shared\Domain\Exceptions\InvalidHexColor;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Livewire\Attributes\Computed;
|
use Livewire\Attributes\Computed;
|
||||||
use Livewire\Attributes\Locked;
|
use Livewire\Attributes\Locked;
|
||||||
@@ -71,6 +73,27 @@ new class extends Component
|
|||||||
return $this->customerQueries->findSummary($this->customerId) ?? abort(404);
|
return $this->customerQueries->findSummary($this->customerId) ?? abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The colour picker's "Use colour", or "Restore default colour" with null.
|
||||||
|
*/
|
||||||
|
public function setHeaderColor(?string $color, ChangeCustomerHeaderColor $changeColor): void
|
||||||
|
{
|
||||||
|
$this->authorize('customers.use');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$changeColor->execute($this->customerId, $color);
|
||||||
|
} catch (InvalidHexColor) {
|
||||||
|
$this->statusMessage = __('customers.errors.invalid_header_color');
|
||||||
|
|
||||||
|
return;
|
||||||
|
} catch (CustomerNotFound) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($this->customer);
|
||||||
|
$this->statusMessage = __('customers.header_color_saved');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The personal identity code as this user may see it: in full for admins
|
* The personal identity code as this user may see it: in full for admins
|
||||||
* and management, masked for others. Computed, so the full code is never
|
* and management, masked for others. Computed, so the full code is never
|
||||||
@@ -211,7 +234,7 @@ new class extends Component
|
|||||||
|
|
||||||
<div class="mx-auto max-w-5xl space-y-8 p-4 sm:p-6">
|
<div class="mx-auto max-w-5xl space-y-8 p-4 sm:p-6">
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<a href="{{ route('customers.index') }}" wire:navigate class="inline-flex min-h-6 items-center gap-1 rounded-md text-sm font-medium text-primary-700 underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:text-primary-300 dark:focus-visible:outline-primary-300">
|
<a href="{{ route('customers.index') }}" wire:navigate class="inline-flex min-h-6 items-center gap-1 rounded-md text-sm font-medium text-primary-700 underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:text-primary-100 dark:focus-visible:outline-primary-300">
|
||||||
<x-icon name="arrow-left" class="size-4" aria-hidden="true" />{{ __('customers.title') }}
|
<x-icon name="arrow-left" class="size-4" aria-hidden="true" />{{ __('customers.title') }}
|
||||||
</a>
|
</a>
|
||||||
<div class="flex flex-wrap items-center justify-between gap-4">
|
<div class="flex flex-wrap items-center justify-between gap-4">
|
||||||
@@ -227,6 +250,14 @@ new class extends Component
|
|||||||
:text="__('customers.edit_details')"
|
:text="__('customers.edit_details')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<x-button
|
||||||
|
subtle
|
||||||
|
color="black"
|
||||||
|
icon="swatch"
|
||||||
|
:text="__('customers.fields.header_color')"
|
||||||
|
x-on:click="$dispatch('color-picker:open', {{ Js::from(['id' => 'colour-picker', 'title' => __('customers.header_color_title', ['name' => $this->customer->name]), 'color' => $this->customer->headerColor ?? '#23476a', 'method' => 'setHeaderColor', 'args' => [], 'resettable' => $this->customer->headerColor !== null]) }})"
|
||||||
|
/>
|
||||||
|
|
||||||
@if ($this->canBeRemoved)
|
@if ($this->canBeRemoved)
|
||||||
<x-button
|
<x-button
|
||||||
wire:click="confirmRemoval('customer', {{ $customerId }})"
|
wire:click="confirmRemoval('customer', {{ $customerId }})"
|
||||||
@@ -317,7 +348,7 @@ new class extends Component
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($contact->note !== null)
|
@if ($contact->note !== null)
|
||||||
<p class="whitespace-pre-line text-zinc-600 dark:text-zinc-300">{{ $contact->note }}</p>
|
<p class="whitespace-pre-line text-zinc-600 dark:text-zinc-200">{{ $contact->note }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -430,4 +461,6 @@ new class extends Component
|
|||||||
<x-button wire:click="remove" color="red" icon="trash" :text="__('customers.remove')" />
|
<x-button wire:click="remove" color="red" icon="trash" :text="__('customers.remove')" />
|
||||||
</x-slot:actions>
|
</x-slot:actions>
|
||||||
</x-confirm-dialog>
|
</x-confirm-dialog>
|
||||||
|
|
||||||
|
<x-color-picker />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ new class extends Component
|
|||||||
@foreach ($tasks as $task)
|
@foreach ($tasks as $task)
|
||||||
<li wire:key="task-{{ $task->taskId }}" class="py-2 text-sm">
|
<li wire:key="task-{{ $task->taskId }}" class="py-2 text-sm">
|
||||||
<x-link :href="route('jobs.show', $task->jobId).'#task-'.$task->taskId" navigate class="font-medium">{{ $task->title }}</x-link>
|
<x-link :href="route('jobs.show', $task->jobId).'#task-'.$task->taskId" navigate class="font-medium">{{ $task->title }}</x-link>
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">{{ $task->jobNumber }} {{ $task->jobName }}</span>
|
<span class="block text-zinc-600 dark:text-zinc-200">{{ $task->jobNumber }} {{ $task->jobName }}</span>
|
||||||
<span class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-zinc-700 dark:text-zinc-200">
|
<span class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-zinc-700 dark:text-zinc-200">
|
||||||
<x-jobs.task-status :status="$task->status" />
|
<x-jobs.task-status :status="$task->status" />
|
||||||
@if ($task->dueOn !== null)
|
@if ($task->dueOn !== null)
|
||||||
@@ -134,7 +134,7 @@ new class extends Component
|
|||||||
@foreach (array_keys($overview->week->days) as $day)
|
@foreach (array_keys($overview->week->days) as $day)
|
||||||
<th scope="col" class="py-1 text-center font-medium">
|
<th scope="col" class="py-1 text-center font-medium">
|
||||||
{{ $this->dayName($day) }}
|
{{ $this->dayName($day) }}
|
||||||
<span class="block text-xs font-normal text-zinc-600 dark:text-zinc-300">{{ (new DateTimeImmutable($day))->format('j.n.') }}</span>
|
<span class="block text-xs font-normal text-zinc-600 dark:text-zinc-200">{{ (new DateTimeImmutable($day))->format('j.n.') }}</span>
|
||||||
</th>
|
</th>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
@@ -170,7 +170,7 @@ new class extends Component
|
|||||||
@foreach ($overview->jobs as $job)
|
@foreach ($overview->jobs as $job)
|
||||||
<li wire:key="job-{{ $job->id }}" class="py-2 text-sm">
|
<li wire:key="job-{{ $job->id }}" class="py-2 text-sm">
|
||||||
<x-link :href="route('jobs.show', $job->id)" navigate class="font-medium">{{ $job->number }} {{ $job->name }}</x-link>
|
<x-link :href="route('jobs.show', $job->id)" navigate class="font-medium">{{ $job->number }} {{ $job->name }}</x-link>
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">{{ $job->customerName }}</span>
|
<span class="block text-zinc-600 dark:text-zinc-200">{{ $job->customerName }}</span>
|
||||||
<span class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-zinc-700 dark:text-zinc-200">
|
<span class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-zinc-700 dark:text-zinc-200">
|
||||||
<x-jobs.status :status="$job->status" />
|
<x-jobs.status :status="$job->status" />
|
||||||
<x-jobs.priority :priority="\App\Modules\Jobs\Domain\Enums\Priority::from($job->priority)" />
|
<x-jobs.priority :priority="\App\Modules\Jobs\Domain\Enums\Priority::from($job->priority)" />
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ new class extends Component
|
|||||||
|
|
||||||
@can('reports.view')
|
@can('reports.view')
|
||||||
<x-panel :title="__('dashboard.month.title')" icon="chart-bar" :level="3" heading-id="month-heading">
|
<x-panel :title="__('dashboard.month.title')" icon="chart-bar" :level="3" heading-id="month-heading">
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('dashboard.month.period', [
|
{{ __('dashboard.month.period', [
|
||||||
'from' => $this->dateLabel($overview->monthFrom), 'to' => $this->dateLabel($overview->monthTo),
|
'from' => $this->dateLabel($overview->monthFrom), 'to' => $this->dateLabel($overview->monthTo),
|
||||||
'previous_from' => $this->dateLabel($overview->previousFrom), 'previous_to' => $this->dateLabel($overview->previousTo),
|
'previous_from' => $this->dateLabel($overview->previousFrom), 'previous_to' => $this->dateLabel($overview->previousTo),
|
||||||
@@ -174,7 +174,7 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</dl>
|
</dl>
|
||||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{{ __('dashboard.month.billing_note') }}</p>
|
<p class="text-xs text-zinc-600 dark:text-zinc-200">{{ __('dashboard.month.billing_note') }}</p>
|
||||||
</x-panel>
|
</x-panel>
|
||||||
@endcan
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
@@ -223,7 +223,7 @@ new class extends Component
|
|||||||
@foreach ($overview->oldestOverdueTasks as $task)
|
@foreach ($overview->oldestOverdueTasks as $task)
|
||||||
<li wire:key="late-{{ $task->taskId }}" class="py-2">
|
<li wire:key="late-{{ $task->taskId }}" class="py-2">
|
||||||
<x-link :href="route('jobs.show', $task->jobId).'#task-'.$task->taskId" navigate class="font-medium">{{ $task->title }}</x-link>
|
<x-link :href="route('jobs.show', $task->jobId).'#task-'.$task->taskId" navigate class="font-medium">{{ $task->title }}</x-link>
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">
|
<span class="block text-zinc-600 dark:text-zinc-200">
|
||||||
{{ $task->jobNumber }} {{ $task->jobName }} · {{ $task->assigneeName ?? __('dashboard.stock.no_assignee') }}
|
{{ $task->jobNumber }} {{ $task->jobName }} · {{ $task->assigneeName ?? __('dashboard.stock.no_assignee') }}
|
||||||
· {{ __('dashboard.tasks.due', ['date' => $this->dateLabel((string) $task->dueOn)]) }}
|
· {{ __('dashboard.tasks.due', ['date' => $this->dateLabel((string) $task->dueOn)]) }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="receipt-refund">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="receipt-refund">{{ $this->heading() }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('expenses.fields.job') }}: {{ $job->label() }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('expenses.fields.job') }}: {{ $job->label() }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($job->isLocked)
|
@if ($job->isLocked)
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ new class extends Component
|
|||||||
<h2 id="expenses-heading" tabindex="-1" class="text-xl font-semibold focus:outline-none">{{ __('expenses.job_page.list') }}</h2>
|
<h2 id="expenses-heading" tabindex="-1" class="text-xl font-semibold focus:outline-none">{{ __('expenses.job_page.list') }}</h2>
|
||||||
|
|
||||||
@unless ($this->canSeeTotals)
|
@unless ($this->canSeeTotals)
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('expenses.amounts_hidden_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('expenses.amounts_hidden_help') }}</p>
|
||||||
@endunless
|
@endunless
|
||||||
|
|
||||||
@if ($this->expenses === [])
|
@if ($this->expenses === [])
|
||||||
@@ -174,7 +174,7 @@ new class extends Component
|
|||||||
|
|
||||||
@interact('column_what', $expense)
|
@interact('column_what', $expense)
|
||||||
<span class="block font-medium break-words whitespace-normal">{{ $this->summaryText($expense) }}</span>
|
<span class="block font-medium break-words whitespace-normal">{{ $this->summaryText($expense) }}</span>
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('expenses.categories.'.$expense->category->value) }}, {{ __('expenses.payers.'.$expense->paidBy->value) }}
|
{{ __('expenses.categories.'.$expense->category->value) }}, {{ __('expenses.payers.'.$expense->paidBy->value) }}
|
||||||
</span>
|
</span>
|
||||||
@endinteract
|
@endinteract
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="receipt-refund">{{ __('expenses.mine.title') }}</x-page-title>
|
<x-page-title icon="receipt-refund">{{ __('expenses.mine.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __(auth()->user()?->can('expenses.record') ? 'expenses.mine.help' : 'expenses.mine.help_subcontractor') }}
|
{{ __(auth()->user()?->can('expenses.record') ? 'expenses.mine.help' : 'expenses.mine.help_subcontractor') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -139,7 +139,7 @@ new class extends Component
|
|||||||
|
|
||||||
@interact('column_what', $expense)
|
@interact('column_what', $expense)
|
||||||
<span class="block break-words whitespace-normal">{{ $this->summaryText($expense) }}</span>
|
<span class="block break-words whitespace-normal">{{ $this->summaryText($expense) }}</span>
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('expenses.categories.'.$expense->category->value) }}, {{ __('expenses.payers.'.$expense->paidBy->value) }}
|
{{ __('expenses.categories.'.$expense->category->value) }}, {{ __('expenses.payers.'.$expense->paidBy->value) }}
|
||||||
</span>
|
</span>
|
||||||
@endinteract
|
@endinteract
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ new class extends Component
|
|||||||
<p class="text-sm">{{ __('inventory.counts.values', ['before' => $this->money((int) $count->valueBeforeCents), 'after' => $this->money((int) $count->valueAfterCents)]) }}</p>
|
<p class="text-sm">{{ __('inventory.counts.values', ['before' => $this->money((int) $count->valueBeforeCents), 'after' => $this->money((int) $count->valueAfterCents)]) }}</p>
|
||||||
@endcan
|
@endcan
|
||||||
@else
|
@else
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.counts.count_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.counts.count_help') }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ new class extends Component
|
|||||||
<li wire:key="count-line-{{ $line->itemId }}" class="flex flex-wrap items-end justify-between gap-3 p-3">
|
<li wire:key="count-line-{{ $line->itemId }}" class="flex flex-wrap items-end justify-between gap-3 p-3">
|
||||||
<div class="min-w-0 flex-1 space-y-1">
|
<div class="min-w-0 flex-1 space-y-1">
|
||||||
<p class="font-medium break-words">{{ $line->itemName }}</p>
|
<p class="font-medium break-words">{{ $line->itemName }}</p>
|
||||||
<p class="text-sm text-zinc-700 dark:text-zinc-300">
|
<p class="text-sm text-zinc-700 dark:text-zinc-200">
|
||||||
@if ($line->isCounted())
|
@if ($line->isCounted())
|
||||||
{{ __('inventory.counts.book', ['book' => $this->quantity((int) $line->bookMilli, $line->unit)]) }}
|
{{ __('inventory.counts.book', ['book' => $this->quantity((int) $line->bookMilli, $line->unit)]) }}
|
||||||
· <span class="font-medium">{{ __('inventory.counts.difference', ['difference' => $this->signed((int) $difference, $line->unit)]) }}</span>
|
· <span class="font-medium">{{ __('inventory.counts.difference', ['difference' => $this->signed((int) $difference, $line->unit)]) }}</span>
|
||||||
@@ -240,7 +240,7 @@ new class extends Component
|
|||||||
<p class="text-sm font-medium">{{ $line->isCounted() ? $this->quantity((int) $line->countedMilli, $line->unit) : '–' }}</p>
|
<p class="text-sm font-medium">{{ $line->isCounted() ? $this->quantity((int) $line->countedMilli, $line->unit) : '–' }}</p>
|
||||||
@else
|
@else
|
||||||
<div class="w-36">
|
<div class="w-36">
|
||||||
<label for="counted-{{ $line->itemId }}" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-300">
|
<label for="counted-{{ $line->itemId }}" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200">
|
||||||
{{ __('inventory.counts.counted', ['unit' => __('inventory.units.'.$line->unit->value)]) }}
|
{{ __('inventory.counts.counted', ['unit' => __('inventory.units.'.$line->unit->value)]) }}
|
||||||
<span class="sr-only">: {{ $line->itemName }}</span>
|
<span class="sr-only">: {{ $line->itemName }}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="clipboard-document-check">{{ __('inventory.counts.title') }}</x-page-title>
|
<x-page-title icon="clipboard-document-check">{{ __('inventory.counts.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.counts.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.counts.intro') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@can('inventory.manage-counts')
|
@can('inventory.manage-counts')
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-3xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-3xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="folder">{{ __('inventory.groups.title') }}</x-page-title>
|
<x-page-title icon="folder">{{ __('inventory.groups.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.groups.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.groups.intro') }}</p>
|
||||||
<p class="text-sm"><x-link :href="route('inventory.index')" navigate>{{ __('inventory.groups.back') }}</x-link></p>
|
<p class="text-sm"><x-link :href="route('inventory.index')" navigate>{{ __('inventory.groups.back') }}</x-link></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ new class extends Component
|
|||||||
@else
|
@else
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
<p class="font-medium break-words">{{ $group->name }}</p>
|
<p class="font-medium break-words">{{ $group->name }}</p>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ trans_choice('inventory.groups.items', $group->itemCount, ['count' => $group->itemCount]) }}
|
{{ trans_choice('inventory.groups.items', $group->itemCount, ['count' => $group->itemCount]) }}
|
||||||
@unless ($group->isActive)
|
@unless ($group->isActive)
|
||||||
· {{ __('inventory.status.inactive') }}
|
· {{ __('inventory.status.inactive') }}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-6xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-6xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="archive-box">{{ __('inventory.index.title') }}</x-page-title>
|
<x-page-title icon="archive-box">{{ __('inventory.index.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.index.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.index.intro') }}</p>
|
||||||
@can('inventory.manage')
|
@can('inventory.manage')
|
||||||
<div class="flex flex-wrap gap-3">
|
<div class="flex flex-wrap gap-3">
|
||||||
<x-button :href="route('inventory.items.create')" wire:navigate icon="plus" :text="__('inventory.index.new_item')" />
|
<x-button :href="route('inventory.items.create')" wire:navigate icon="plus" :text="__('inventory.index.new_item')" />
|
||||||
@@ -133,7 +133,7 @@ new class extends Component
|
|||||||
@interact('column_name', $item)
|
@interact('column_name', $item)
|
||||||
<x-link :href="route('inventory.items.show', $item->id)" navigate class="whitespace-normal">{{ $item->name }}</x-link>
|
<x-link :href="route('inventory.items.show', $item->id)" navigate class="whitespace-normal">{{ $item->name }}</x-link>
|
||||||
@if ($item->code !== null)
|
@if ($item->code !== null)
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ $item->code }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ $item->code }}</span>
|
||||||
@endif
|
@endif
|
||||||
@endinteract
|
@endinteract
|
||||||
|
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ new class extends Component
|
|||||||
<x-input id="item-reorder" wire:model="reorderLevel" inputmode="decimal" :label="__('inventory.form.reorder_level')" :hint="__('inventory.form.reorder_level_hint')" autocomplete="off" />
|
<x-input id="item-reorder" wire:model="reorderLevel" inputmode="decimal" :label="__('inventory.form.reorder_level')" :hint="__('inventory.form.reorder_level_hint')" autocomplete="off" />
|
||||||
|
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<label for="item-image" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-300">{{ __('inventory.form.image') }}</label>
|
<label for="item-image" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200">{{ __('inventory.form.image') }}</label>
|
||||||
<p id="item-image-hint" class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.form.image_hint', ['size' => $this::MAX_KILOBYTES / 1024]) }}</p>
|
<p id="item-image-hint" class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.form.image_hint', ['size' => $this::MAX_KILOBYTES / 1024]) }}</p>
|
||||||
@if ($hasImage && $itemId !== null)
|
@if ($hasImage && $itemId !== null)
|
||||||
<img src="{{ route('inventory.items.image', [$itemId, 'thumbnail']) }}" alt="{{ __('inventory.form.current_image') }}" class="size-24 rounded-md border border-zinc-300 object-cover dark:border-zinc-600" />
|
<img src="{{ route('inventory.items.image', [$itemId, 'thumbnail']) }}" alt="{{ __('inventory.form.current_image') }}" class="size-24 rounded-md border border-zinc-300 object-cover dark:border-zinc-600" />
|
||||||
<x-checkbox id="remove-image" wire:model="removeImage" :label="__('inventory.form.remove_image')" />
|
<x-checkbox id="remove-image" wire:model="removeImage" :label="__('inventory.form.remove_image')" />
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ new class extends Component
|
|||||||
@can('inventory.manage')
|
@can('inventory.manage')
|
||||||
<section aria-labelledby="purchase-heading" class="card space-y-3">
|
<section aria-labelledby="purchase-heading" class="card space-y-3">
|
||||||
<h2 id="purchase-heading" class="text-lg font-semibold">{{ __('inventory.purchase.title') }}</h2>
|
<h2 id="purchase-heading" class="text-lg font-semibold">{{ __('inventory.purchase.title') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.purchase.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.purchase.intro') }}</p>
|
||||||
<form wire:submit="recordPurchase" class="space-y-4" novalidate>
|
<form wire:submit="recordPurchase" class="space-y-4" novalidate>
|
||||||
<x-input id="purchase-day" wire:model="purchaseDay" type="date" :label="__('inventory.purchase.day')" required />
|
<x-input id="purchase-day" wire:model="purchaseDay" type="date" :label="__('inventory.purchase.day')" required />
|
||||||
<x-input id="purchase-quantity" wire:model="purchaseQuantity" inputmode="decimal" :label="__('inventory.purchase.quantity', ['unit' => $unitLabel])" autocomplete="off" />
|
<x-input id="purchase-quantity" wire:model="purchaseQuantity" inputmode="decimal" :label="__('inventory.purchase.quantity', ['unit' => $unitLabel])" autocomplete="off" />
|
||||||
@@ -434,7 +434,7 @@ new class extends Component
|
|||||||
@can('inventory.record-use')
|
@can('inventory.record-use')
|
||||||
<section aria-labelledby="use-heading" class="card space-y-3">
|
<section aria-labelledby="use-heading" class="card space-y-3">
|
||||||
<h2 id="use-heading" class="text-lg font-semibold">{{ __('inventory.use.title') }}</h2>
|
<h2 id="use-heading" class="text-lg font-semibold">{{ __('inventory.use.title') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.use.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.use.intro') }}</p>
|
||||||
<form wire:submit="recordUse" class="space-y-4" novalidate>
|
<form wire:submit="recordUse" class="space-y-4" novalidate>
|
||||||
<x-input id="use-quantity" wire:model="useQuantity" inputmode="decimal" :label="__('inventory.use.quantity', ['unit' => $unitLabel])" autocomplete="off" />
|
<x-input id="use-quantity" wire:model="useQuantity" inputmode="decimal" :label="__('inventory.use.quantity', ['unit' => $unitLabel])" autocomplete="off" />
|
||||||
<x-input id="use-reason" wire:model="useReason" :label="__('inventory.use.reason')" autocomplete="off" maxlength="255" />
|
<x-input id="use-reason" wire:model="useReason" :label="__('inventory.use.reason')" autocomplete="off" maxlength="255" />
|
||||||
@@ -454,7 +454,7 @@ new class extends Component
|
|||||||
<x-empty-state icon="archive-box">{{ __('inventory.item.history_none') }}</x-empty-state>
|
<x-empty-state icon="archive-box">{{ __('inventory.item.history_none') }}</x-empty-state>
|
||||||
@else
|
@else
|
||||||
@if (count($this->movements) >= $this::HISTORY_LIMIT)
|
@if (count($this->movements) >= $this::HISTORY_LIMIT)
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.item.history_limit', ['count' => $this::HISTORY_LIMIT]) }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.item.history_limit', ['count' => $this::HISTORY_LIMIT]) }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<x-table :headers="$this->headers()" :rows="$this->movements">
|
<x-table :headers="$this->headers()" :rows="$this->movements">
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ new class extends Component
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
@if (mb_strlen(trim($search)) >= 2)
|
@if (mb_strlen(trim($search)) >= 2)
|
||||||
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ trans_choice('inventory.task.results', count($this->results), ['count' => count($this->results)]) }}
|
{{ trans_choice('inventory.task.results', count($this->results), ['count' => count($this->results)]) }}
|
||||||
</p>
|
</p>
|
||||||
<ul class="space-y-1">
|
<ul class="space-y-1">
|
||||||
@@ -345,7 +345,7 @@ new class extends Component
|
|||||||
aria-label="{{ __('inventory.task.choose', ['item' => $result->name, 'balance' => $this->quantity($result->balanceMilli, $result->unit)]) }}"
|
aria-label="{{ __('inventory.task.choose', ['item' => $result->name, 'balance' => $this->quantity($result->balanceMilli, $result->unit)]) }}"
|
||||||
>
|
>
|
||||||
<span class="font-medium">{{ $result->name }}</span>
|
<span class="font-medium">{{ $result->name }}</span>
|
||||||
<span class="text-zinc-700 dark:text-zinc-300">{{ $this->quantity($result->balanceMilli, $result->unit) }}</span>
|
<span class="text-zinc-700 dark:text-zinc-200">{{ $this->quantity($result->balanceMilli, $result->unit) }}</span>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -356,7 +356,7 @@ new class extends Component
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($this->movements === [])
|
@if ($this->movements === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('inventory.task.none') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('inventory.task.none') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul class="divide-y divide-zinc-200 text-sm dark:divide-zinc-700">
|
<ul class="divide-y divide-zinc-200 text-sm dark:divide-zinc-700">
|
||||||
@foreach ($this->movements as $movement)
|
@foreach ($this->movements as $movement)
|
||||||
@@ -364,7 +364,7 @@ new class extends Component
|
|||||||
<span>
|
<span>
|
||||||
<span class="font-medium">{{ $movement->itemName }}</span>
|
<span class="font-medium">{{ $movement->itemName }}</span>
|
||||||
{{ $this->quantity(-$movement->quantityMilli, $movement->unit) }}
|
{{ $this->quantity(-$movement->quantityMilli, $movement->unit) }}
|
||||||
<span class="text-zinc-600 dark:text-zinc-300">
|
<span class="text-zinc-600 dark:text-zinc-200">
|
||||||
· {{ __('inventory.kinds.'.$movement->kind->value) }} · {{ $movement->userName }}, {{ $this->dateLabel($movement->recordedAt) }}
|
· {{ __('inventory.kinds.'.$movement->kind->value) }} · {{ $movement->userName }}, {{ $this->dateLabel($movement->recordedAt) }}
|
||||||
@if ($movement->reversedByMovementId !== null)
|
@if ($movement->reversedByMovementId !== null)
|
||||||
· {{ __('inventory.task.undone_mark') }}
|
· {{ __('inventory.task.undone_mark') }}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\Contracts;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Application\DTOs\BoardCard;
|
||||||
|
use App\Modules\Jobs\Application\DTOs\BoardFilter;
|
||||||
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read side of the Kanban board.
|
||||||
|
*/
|
||||||
|
interface JobBoardQueries
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Every card the filter lets through: open and done jobs (not archived,
|
||||||
|
* not the yearly quick-sale job) with their tasks, and tasks of
|
||||||
|
* continuing jobs pinned to the board as cards of their own.
|
||||||
|
*
|
||||||
|
* @param string $today Y-m-d, for late jobs
|
||||||
|
* @return list<BoardCard>
|
||||||
|
*/
|
||||||
|
public function cards(BoardFilter $filter, string $today): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user's board settings, or the defaults.
|
||||||
|
*/
|
||||||
|
public function preferencesOf(int $userId): BoardPreferences;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\Contracts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hours recorded on jobs and tasks, for the Kanban cards. The TimeTracking
|
||||||
|
* module provides it; Jobs knows nothing about time entries.
|
||||||
|
*/
|
||||||
|
interface LoggedJobHours
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Recorded quarter-hours by job id (jobs without hours are left out).
|
||||||
|
*
|
||||||
|
* @param list<int> $jobIds
|
||||||
|
* @return array<int, int>
|
||||||
|
*/
|
||||||
|
public function quartersByJobs(array $jobIds): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recorded quarter-hours by task id (tasks without hours are left out).
|
||||||
|
*
|
||||||
|
* @param list<int> $taskIds
|
||||||
|
* @return array<int, int>
|
||||||
|
*/
|
||||||
|
public function quartersByTasks(array $taskIds): array;
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\DTOs;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Enums\JobKind;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A card on the Kanban board: a customer job, or a task of a continuing
|
||||||
|
* job that is pinned to the board as its own card ($taskId set).
|
||||||
|
*/
|
||||||
|
final readonly class BoardCard
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param list<BoardTask> $tasks the job's tasks (empty on a task card)
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public int $jobId,
|
||||||
|
public ?int $taskId,
|
||||||
|
public string $number,
|
||||||
|
public string $title,
|
||||||
|
public string $jobName,
|
||||||
|
public int $customerId,
|
||||||
|
public string $customerName,
|
||||||
|
public ?string $customerHeaderColor,
|
||||||
|
public JobStatus $jobStatus,
|
||||||
|
public ?TaskStatus $taskStatus,
|
||||||
|
public Priority $priority,
|
||||||
|
public JobKind $kind,
|
||||||
|
public ?string $dueOn,
|
||||||
|
public bool $isLate,
|
||||||
|
public ?string $responsibleName,
|
||||||
|
public ?string $serviceUnitName,
|
||||||
|
public ?string $estimatedHours,
|
||||||
|
public int $loggedQuarters,
|
||||||
|
public int $boardPosition,
|
||||||
|
public ?int $billerUserId,
|
||||||
|
public array $tasks = [],
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function isTaskCard(): bool
|
||||||
|
{
|
||||||
|
return $this->taskId !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stable key for wire:key and wire:sort:item: "job-12" or "task-34".
|
||||||
|
*/
|
||||||
|
public function key(): string
|
||||||
|
{
|
||||||
|
return $this->isTaskCard() ? 'task-'.$this->taskId : 'job-'.$this->jobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isOngoing(): bool
|
||||||
|
{
|
||||||
|
return $this->jobStatus === JobStatus::Ongoing && ! $this->isTaskCard();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function doneTaskCount(): int
|
||||||
|
{
|
||||||
|
return count(array_filter($this->tasks, fn (BoardTask $task): bool => $task->isDone()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first open task of a continuing job ("Seuraava vuorossa").
|
||||||
|
*/
|
||||||
|
public function nextOpenTask(): ?BoardTask
|
||||||
|
{
|
||||||
|
foreach ($this->tasks as $task) {
|
||||||
|
if (! $task->isDone()) {
|
||||||
|
return $task;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function responsibleInitials(): string
|
||||||
|
{
|
||||||
|
if ($this->responsibleName === null || trim($this->responsibleName) === '') {
|
||||||
|
return '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = preg_split('/\s+/', trim($this->responsibleName)) ?: [];
|
||||||
|
$initials = '';
|
||||||
|
|
||||||
|
foreach (array_slice($parts, 0, 2) as $part) {
|
||||||
|
$initials .= mb_strtoupper(mb_substr($part, 0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $initials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function responsibleFirstName(): ?string
|
||||||
|
{
|
||||||
|
return $this->responsibleName === null ? null : explode(' ', trim($this->responsibleName))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loggedHours(): float
|
||||||
|
{
|
||||||
|
return $this->loggedQuarters / 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\DTOs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whose cards the Kanban board shows (docs/ui-kanban-board.md 2): one
|
||||||
|
* person's jobs (their own board or another person's), one service line,
|
||||||
|
* or the whole company. Subcontractors are always limited to their jobs.
|
||||||
|
*/
|
||||||
|
final readonly class BoardFilter
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
/** Jobs this user is responsible for, a member of or does a task of. */
|
||||||
|
public ?int $personUserId = null,
|
||||||
|
public ?int $serviceUnitId = null,
|
||||||
|
/** Restricts everything to jobs the user is a member of (subcontractors). */
|
||||||
|
public ?int $onlyMemberUserId = null,
|
||||||
|
public bool $onlyUrgent = false,
|
||||||
|
public bool $onlyLate = false,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\DTOs;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A task row in a Kanban card's task list.
|
||||||
|
*/
|
||||||
|
final readonly class BoardTask
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public int $id,
|
||||||
|
public string $title,
|
||||||
|
public TaskStatus $status,
|
||||||
|
public ?string $assigneeName,
|
||||||
|
public bool $pinnedToBoard,
|
||||||
|
public ?string $dueOn = null,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function isDone(): bool
|
||||||
|
{
|
||||||
|
return $this->status === TaskStatus::Done;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function assigneeFirstName(): ?string
|
||||||
|
{
|
||||||
|
return $this->assigneeName === null ? null : explode(' ', trim($this->assigneeName))[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\Services;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Application\DTOs\BoardCard;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\BoardColumn;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\BoardView;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\ColumnSort;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||||
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Places Kanban cards in the columns of a view and orders each column
|
||||||
|
* (docs/ui-kanban-board.md 3–4):
|
||||||
|
*
|
||||||
|
* - jobs in production go to the urgent column when their priority meets
|
||||||
|
* the user's threshold, to the normal one otherwise;
|
||||||
|
* - continuing jobs only ever stand in "Jatkuvat & Kausi";
|
||||||
|
* - a pinned task stands in Jonossa, Työn alla or Valmis by its status;
|
||||||
|
* - a manual column is in drag order, a due-date column has the earliest
|
||||||
|
* due date on top and cards without one last.
|
||||||
|
*/
|
||||||
|
final class BoardLayout
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param list<BoardCard> $cards
|
||||||
|
* @return array<string, list<BoardCard>> by BoardColumn value, in the view's column order
|
||||||
|
*/
|
||||||
|
public function arrange(array $cards, BoardView $view, BoardPreferences $preferences): array
|
||||||
|
{
|
||||||
|
$columns = [];
|
||||||
|
|
||||||
|
foreach ($view->columns() as $column) {
|
||||||
|
$columns[$column->value] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($cards as $card) {
|
||||||
|
$column = $this->columnOf($card, $view, $preferences);
|
||||||
|
|
||||||
|
if ($column !== null && array_key_exists($column->value, $columns)) {
|
||||||
|
$columns[$column->value][] = $card;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($columns as $value => $columnCards) {
|
||||||
|
$columns[$value] = $this->sorted($columnCards, $preferences->sortOf(BoardColumn::from($value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columnOf(BoardCard $card, BoardView $view, BoardPreferences $preferences): ?BoardColumn
|
||||||
|
{
|
||||||
|
if ($card->isTaskCard()) {
|
||||||
|
return $card->taskStatus === null ? null : BoardColumn::forTask($card->taskStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($card->jobStatus === JobStatus::Ongoing) {
|
||||||
|
return BoardColumn::Ongoing;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BoardColumn::forJob($card->jobStatus, $card->priority, $preferences->urgentThreshold, $view->gathersQuotes());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<BoardCard> $cards
|
||||||
|
* @return list<BoardCard>
|
||||||
|
*/
|
||||||
|
private function sorted(array $cards, ColumnSort $sort): array
|
||||||
|
{
|
||||||
|
usort($cards, function (BoardCard $a, BoardCard $b) use ($sort): int {
|
||||||
|
if ($sort === ColumnSort::DueDate) {
|
||||||
|
$byDue = ($a->dueOn ?? '9999-12-31') <=> ($b->dueOn ?? '9999-12-31');
|
||||||
|
|
||||||
|
if ($byDue !== 0) {
|
||||||
|
return $byDue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$a->boardPosition, $a->isTaskCard() ? 1 : 0, $a->taskId ?? $a->jobId]
|
||||||
|
<=> [$b->boardPosition, $b->isTaskCard() ? 1 : 0, $b->taskId ?? $b->jobId];
|
||||||
|
});
|
||||||
|
|
||||||
|
return $cards;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\UseCases;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\CustomerJobNotFound;
|
||||||
|
use App\Modules\Shared\Application\Contracts\TransactionManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes a job's priority (e.g. in the board's job editor) and records it.
|
||||||
|
*/
|
||||||
|
final class ChangeJobPriority
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private CustomerJobRepository $jobs,
|
||||||
|
private TransactionManager $transactions,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws CustomerJobNotFound
|
||||||
|
*/
|
||||||
|
public function execute(int $jobId, Priority $priority, int $actorUserId): void
|
||||||
|
{
|
||||||
|
$this->transactions->run(function () use ($jobId, $priority, $actorUserId): void {
|
||||||
|
$job = $this->jobs->findById($jobId) ?? throw new CustomerJobNotFound($jobId);
|
||||||
|
$changes = $job->changePriority($priority);
|
||||||
|
|
||||||
|
if ($changes === []) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->jobs->save($job);
|
||||||
|
$this->jobs->recordChanges($jobId, $actorUserId, $changes);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\UseCases;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\TaskRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\BoardColumn;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\UrgentThreshold;
|
||||||
|
use App\Modules\Jobs\Domain\Events\TaskCompleted;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\CardCannotMoveThere;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\CustomerJobNotFound;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\TaskNotFound;
|
||||||
|
use App\Modules\Shared\Application\Contracts\EventDispatcher;
|
||||||
|
use App\Modules\Shared\Application\Contracts\TransactionManager;
|
||||||
|
use App\Modules\Users\Application\Contracts\Clock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Kanban card dropped into a column (docs/ui-kanban-board.md 3):
|
||||||
|
*
|
||||||
|
* - a job dropped into another status's column gets that status;
|
||||||
|
* - a job dropped into "Työn alla • Kiire" gets at least the threshold's
|
||||||
|
* priority, and one dropped into the normal "Työn alla" with an urgent
|
||||||
|
* priority gets the normal priority;
|
||||||
|
* - a pinned task card gets the status of its new column;
|
||||||
|
* - the column's cards get positions in the dropped order.
|
||||||
|
*
|
||||||
|
* Who may set a billing status or open a lock is checked by the caller.
|
||||||
|
*/
|
||||||
|
final class MoveBoardCard
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private CustomerJobRepository $jobs,
|
||||||
|
private TaskRepository $tasks,
|
||||||
|
private BoardRepository $board,
|
||||||
|
private TransactionManager $transactions,
|
||||||
|
private EventDispatcher $events,
|
||||||
|
private Clock $clock,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $orderedKeys the target column's card keys ("job-12", "task-34") in their new order
|
||||||
|
*
|
||||||
|
* @throws CustomerJobNotFound
|
||||||
|
* @throws TaskNotFound
|
||||||
|
* @throws CardCannotMoveThere
|
||||||
|
*/
|
||||||
|
public function execute(int $jobId, ?int $taskId, BoardColumn $target, array $orderedKeys, UrgentThreshold $threshold, int $actorUserId): void
|
||||||
|
{
|
||||||
|
$this->transactions->run(function () use ($jobId, $taskId, $target, $orderedKeys, $threshold, $actorUserId): void {
|
||||||
|
if ($taskId === null) {
|
||||||
|
$this->moveJob($jobId, $target, $threshold, $actorUserId);
|
||||||
|
} else {
|
||||||
|
$this->moveTask($jobId, $taskId, $target);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->reorder($orderedKeys);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The status a job gets when dropped into the column: its own when the
|
||||||
|
* column already holds it (e.g. moving between the quote statuses in
|
||||||
|
* "Tarjoukset"), the column's otherwise.
|
||||||
|
*/
|
||||||
|
public static function statusAfterDrop(JobStatus $current, BoardColumn $target): JobStatus
|
||||||
|
{
|
||||||
|
return in_array($current, $target->statuses(), true) ? $current : $target->targetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function moveJob(int $jobId, BoardColumn $target, UrgentThreshold $threshold, int $actorUserId): void
|
||||||
|
{
|
||||||
|
$job = $this->jobs->findById($jobId) ?? throw new CustomerJobNotFound($jobId);
|
||||||
|
$current = $job->details()->status;
|
||||||
|
|
||||||
|
if (($current === JobStatus::Ongoing) !== $target->isOngoing()) {
|
||||||
|
throw new CardCannotMoveThere;
|
||||||
|
}
|
||||||
|
|
||||||
|
$changes = $job->changeStatus(self::statusAfterDrop($current, $target));
|
||||||
|
$priority = $job->details()->priority;
|
||||||
|
|
||||||
|
if ($target->isUrgentLane() && ! $threshold->includes($priority)) {
|
||||||
|
$changes = [...$changes, ...$job->changePriority($threshold->lowestPriority())];
|
||||||
|
} elseif ($target->isNormalProductionLane() && $threshold->includes($priority)) {
|
||||||
|
$changes = [...$changes, ...$job->changePriority(Priority::Normal)];
|
||||||
|
}
|
||||||
|
|
||||||
|
$job->recordCompletion($this->clock->now());
|
||||||
|
|
||||||
|
if ($changes !== []) {
|
||||||
|
$this->jobs->save($job);
|
||||||
|
$this->jobs->recordChanges($jobId, $actorUserId, $changes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function moveTask(int $jobId, int $taskId, BoardColumn $target): void
|
||||||
|
{
|
||||||
|
$status = $target->taskStatus() ?? throw new CardCannotMoveThere;
|
||||||
|
$task = $this->tasks->findForJob($jobId, $taskId) ?? throw new TaskNotFound($jobId, $taskId);
|
||||||
|
$wasDone = $task->status() === TaskStatus::Done;
|
||||||
|
|
||||||
|
if ($task->status() === $status || ($status === TaskStatus::InProgress && $task->status() === TaskStatus::InReview)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$task->changeStatus($status);
|
||||||
|
$this->tasks->save($task);
|
||||||
|
|
||||||
|
if (! $wasDone && $status === TaskStatus::Done) {
|
||||||
|
$this->events->dispatch(new TaskCompleted($taskId, $jobId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $orderedKeys
|
||||||
|
*/
|
||||||
|
private function reorder(array $orderedKeys): void
|
||||||
|
{
|
||||||
|
$jobPositions = [];
|
||||||
|
$taskPositions = [];
|
||||||
|
|
||||||
|
foreach (array_values($orderedKeys) as $index => $key) {
|
||||||
|
if (preg_match('/^(job|task)-(\d+)$/', $key, $matches) !== 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$position = ($index + 1) * 10;
|
||||||
|
|
||||||
|
if ($matches[1] === 'job') {
|
||||||
|
$jobPositions[(int) $matches[2]] = $position;
|
||||||
|
} else {
|
||||||
|
$taskPositions[(int) $matches[2]] = $position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->board->setJobPositions($jobPositions);
|
||||||
|
$this->board->setTaskPositions($taskPositions);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\UseCases;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\TaskRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\CustomerJobNotFound;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\TaskCannotBePinned;
|
||||||
|
use App\Modules\Jobs\Domain\Exceptions\TaskNotFound;
|
||||||
|
use App\Modules\Shared\Application\Contracts\TransactionManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lifts a task of a continuing job onto the Kanban board as a card of its
|
||||||
|
* own ("Nosta putkeen"), or releases it back under the job's card.
|
||||||
|
*/
|
||||||
|
final class PinTaskToBoard
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private CustomerJobRepository $jobs,
|
||||||
|
private TaskRepository $tasks,
|
||||||
|
private BoardRepository $board,
|
||||||
|
private TransactionManager $transactions,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws CustomerJobNotFound
|
||||||
|
* @throws TaskNotFound
|
||||||
|
* @throws TaskCannotBePinned
|
||||||
|
*/
|
||||||
|
public function execute(int $jobId, int $taskId, bool $pinned): void
|
||||||
|
{
|
||||||
|
$this->transactions->run(function () use ($jobId, $taskId, $pinned): void {
|
||||||
|
$job = $this->jobs->findById($jobId) ?? throw new CustomerJobNotFound($jobId);
|
||||||
|
$this->tasks->findForJob($jobId, $taskId) ?? throw new TaskNotFound($jobId, $taskId);
|
||||||
|
|
||||||
|
if ($pinned && $job->details()->status !== JobStatus::Ongoing) {
|
||||||
|
throw new TaskCannotBePinned;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->board->setTaskPinned($taskId, $pinned);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Application\UseCases;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
||||||
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
||||||
|
use App\Modules\Shared\Application\Contracts\TransactionManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores one user's Kanban settings. They never change anyone else's board.
|
||||||
|
*/
|
||||||
|
final class SaveBoardPreferences
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private BoardRepository $board,
|
||||||
|
private TransactionManager $transactions,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function execute(int $userId, BoardPreferences $preferences): void
|
||||||
|
{
|
||||||
|
$this->transactions->run(fn () => $this->board->savePreferences($userId, $preferences));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Contracts;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kanban board state that is not part of a job's details: card order,
|
||||||
|
* tasks pinned to the board and each user's board settings. None of it is
|
||||||
|
* recorded in a job's change history.
|
||||||
|
*/
|
||||||
|
interface BoardRepository
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<int, int> $positions board position by job id
|
||||||
|
*/
|
||||||
|
public function setJobPositions(array $positions): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, int> $positions board position by task id
|
||||||
|
*/
|
||||||
|
public function setTaskPositions(array $positions): void;
|
||||||
|
|
||||||
|
public function setTaskPinned(int $taskId, bool $pinned): void;
|
||||||
|
|
||||||
|
public function preferencesOf(int $userId): BoardPreferences;
|
||||||
|
|
||||||
|
public function savePreferences(int $userId, BoardPreferences $preferences): void;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Modules\Jobs\Domain\Entities;
|
namespace App\Modules\Jobs\Domain\Entities;
|
||||||
|
|
||||||
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||||
use App\Modules\Jobs\Domain\ValueObjects\FieldChange;
|
use App\Modules\Jobs\Domain\ValueObjects\FieldChange;
|
||||||
use App\Modules\Jobs\Domain\ValueObjects\JobDetails;
|
use App\Modules\Jobs\Domain\ValueObjects\JobDetails;
|
||||||
use App\Modules\Jobs\Domain\ValueObjects\JobNumber;
|
use App\Modules\Jobs\Domain\ValueObjects\JobNumber;
|
||||||
@@ -87,6 +88,14 @@ final class CustomerJob
|
|||||||
return $this->changeDetails($this->details->withStatus($status));
|
return $this->changeDetails($this->details->withStatus($status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<FieldChange>
|
||||||
|
*/
|
||||||
|
public function changePriority(Priority $priority): array
|
||||||
|
{
|
||||||
|
return $this->changeDetails($this->details->withPriority($priority));
|
||||||
|
}
|
||||||
|
|
||||||
public function id(): ?int
|
public function id(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A column of the Kanban board (docs/ui-kanban-board.md 2–3). Most columns
|
||||||
|
* are one job status; "Tarjoukset" gathers the three sales statuses, and
|
||||||
|
* jobs in production are split into a normal and an urgent column by the
|
||||||
|
* user's urgent threshold. Continuing jobs have a column of their own.
|
||||||
|
*/
|
||||||
|
enum BoardColumn: string
|
||||||
|
{
|
||||||
|
case Quotes = 'quotes';
|
||||||
|
case Prospect = 'prospect';
|
||||||
|
case Tentative = 'tentative';
|
||||||
|
case QuoteRequest = 'quote_request';
|
||||||
|
case Order = 'order';
|
||||||
|
case InProduction = 'in_production';
|
||||||
|
case InProductionUrgent = 'in_production_urgent';
|
||||||
|
case OnHold = 'on_hold';
|
||||||
|
case Done = 'done';
|
||||||
|
case Invoiced = 'invoiced';
|
||||||
|
case Billed = 'billed';
|
||||||
|
case Ongoing = 'ongoing';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<JobStatus>
|
||||||
|
*/
|
||||||
|
public function statuses(): array
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Quotes => [JobStatus::Prospect, JobStatus::Tentative, JobStatus::QuoteRequest],
|
||||||
|
self::InProduction, self::InProductionUrgent => [JobStatus::InProduction],
|
||||||
|
default => [JobStatus::from($this->value)],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The status a card gets when it is dropped into this column from
|
||||||
|
* another one.
|
||||||
|
*/
|
||||||
|
public function targetStatus(): JobStatus
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Quotes => JobStatus::QuoteRequest,
|
||||||
|
self::InProduction, self::InProductionUrgent => JobStatus::InProduction,
|
||||||
|
default => JobStatus::from($this->value),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isOngoing(): bool
|
||||||
|
{
|
||||||
|
return $this === self::Ongoing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isUrgentLane(): bool
|
||||||
|
{
|
||||||
|
return $this === self::InProductionUrgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isNormalProductionLane(): bool
|
||||||
|
{
|
||||||
|
return $this === self::InProduction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether a promoted (pinned) task card may be in or dropped into this
|
||||||
|
* column: its column follows the task's status.
|
||||||
|
*/
|
||||||
|
public function acceptsTasks(): bool
|
||||||
|
{
|
||||||
|
return in_array($this, [self::Order, self::InProduction, self::Done], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column header colour before the user picks one (the design's
|
||||||
|
* default palette).
|
||||||
|
*/
|
||||||
|
public function defaultColor(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Quotes, self::Tentative => '#4338ca',
|
||||||
|
self::Prospect => '#374151',
|
||||||
|
self::QuoteRequest => '#6d28d9',
|
||||||
|
self::Order => '#23476a',
|
||||||
|
self::InProduction, self::InProductionUrgent => '#1d4ed8',
|
||||||
|
self::OnHold => '#78350f',
|
||||||
|
self::Done => '#14532d',
|
||||||
|
self::Invoiced => '#0f5c63',
|
||||||
|
self::Billed => '#065f46',
|
||||||
|
self::Ongoing => '#3b2d5e',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Heroicon name for the column header.
|
||||||
|
*/
|
||||||
|
public function icon(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Quotes, self::QuoteRequest => 'document-text',
|
||||||
|
self::Prospect => 'light-bulb',
|
||||||
|
self::Tentative => 'pencil-square',
|
||||||
|
self::Order => 'inbox-stack',
|
||||||
|
self::InProduction => 'play-circle',
|
||||||
|
self::InProductionUrgent => 'fire',
|
||||||
|
self::OnHold => 'clock',
|
||||||
|
self::Done => 'check-circle',
|
||||||
|
self::Invoiced => 'credit-card',
|
||||||
|
self::Billed => 'check-badge',
|
||||||
|
self::Ongoing => 'arrow-path',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column a job card stands in. A sales status is in "Tarjoukset" in
|
||||||
|
* views that gather them, in its own column otherwise.
|
||||||
|
*/
|
||||||
|
public static function forJob(JobStatus $status, Priority $priority, UrgentThreshold $threshold, bool $gatherQuotes): ?self
|
||||||
|
{
|
||||||
|
return match ($status) {
|
||||||
|
JobStatus::Prospect, JobStatus::Tentative, JobStatus::QuoteRequest => $gatherQuotes ? self::Quotes : self::from($status->value),
|
||||||
|
JobStatus::InProduction => $threshold->includes($priority) ? self::InProductionUrgent : self::InProduction,
|
||||||
|
JobStatus::Archived => null,
|
||||||
|
default => self::from($status->value),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column a promoted task card stands in, by the task's status.
|
||||||
|
*/
|
||||||
|
public static function forTask(TaskStatus $status): self
|
||||||
|
{
|
||||||
|
return match ($status) {
|
||||||
|
TaskStatus::Waiting => self::Order,
|
||||||
|
TaskStatus::InProgress, TaskStatus::InReview => self::InProduction,
|
||||||
|
TaskStatus::Done => self::Done,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The task status a promoted task card gets when dropped here.
|
||||||
|
*/
|
||||||
|
public function taskStatus(): ?TaskStatus
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Order => TaskStatus::Waiting,
|
||||||
|
self::InProduction => TaskStatus::InProgress,
|
||||||
|
self::Done => TaskStatus::Done,
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card density of a user's Kanban board: normal cards or three-row
|
||||||
|
* compact cards (docs/ui-kanban-board.md 1.1).
|
||||||
|
*/
|
||||||
|
enum BoardDensity: string
|
||||||
|
{
|
||||||
|
case Normal = 'normal';
|
||||||
|
case Compact = 'compact';
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Näkymäputki of the Kanban board (docs/ui-kanban-board.md 2.2).
|
||||||
|
*/
|
||||||
|
enum BoardView: string
|
||||||
|
{
|
||||||
|
/** Päivittäinen työputki: quotes gathered, production, continuing jobs. */
|
||||||
|
case Production = 'production';
|
||||||
|
|
||||||
|
/** Myynti & Tarjoukset: the three sales statuses apart. */
|
||||||
|
case Sales = 'sales';
|
||||||
|
|
||||||
|
/** Täysi tilaputki: every status from prospect to billed, plus continuing jobs. */
|
||||||
|
case Full = 'full';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<BoardColumn>
|
||||||
|
*/
|
||||||
|
public function columns(): array
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Production => [
|
||||||
|
BoardColumn::Quotes, BoardColumn::Order, BoardColumn::InProduction, BoardColumn::InProductionUrgent,
|
||||||
|
BoardColumn::OnHold, BoardColumn::Done, BoardColumn::Ongoing,
|
||||||
|
],
|
||||||
|
self::Sales => [BoardColumn::Prospect, BoardColumn::Tentative, BoardColumn::QuoteRequest],
|
||||||
|
self::Full => [
|
||||||
|
BoardColumn::Prospect, BoardColumn::Tentative, BoardColumn::QuoteRequest, BoardColumn::Order,
|
||||||
|
BoardColumn::InProduction, BoardColumn::InProductionUrgent, BoardColumn::OnHold, BoardColumn::Done,
|
||||||
|
BoardColumn::Invoiced, BoardColumn::Billed, BoardColumn::Ongoing,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function gathersQuotes(): bool
|
||||||
|
{
|
||||||
|
return $this === self::Production;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order of cards in one Kanban column: the user's own drag order, or by due
|
||||||
|
* date with the earliest (most overdue) on top and cards without one last.
|
||||||
|
*/
|
||||||
|
enum ColumnSort: string
|
||||||
|
{
|
||||||
|
case Manual = 'manual';
|
||||||
|
case DueDate = 'due_date';
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ enum JobStatus: string
|
|||||||
case Done = 'done';
|
case Done = 'done';
|
||||||
case Invoiced = 'invoiced';
|
case Invoiced = 'invoiced';
|
||||||
case Billed = 'billed';
|
case Billed = 'billed';
|
||||||
|
case Ongoing = 'ongoing';
|
||||||
case Archived = 'archived';
|
case Archived = 'archived';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which priorities lift a job in production into the "Työn alla • Kiire"
|
||||||
|
* column of the Kanban board (docs/ui-kanban-board.md 3.1). Each user
|
||||||
|
* chooses it for their own board.
|
||||||
|
*/
|
||||||
|
enum UrgentThreshold: string
|
||||||
|
{
|
||||||
|
case Immediate = 'immediate';
|
||||||
|
case Urgent = 'urgent';
|
||||||
|
case First = 'first';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The lowest priority that is urgent at this threshold.
|
||||||
|
*/
|
||||||
|
public function lowestPriority(): Priority
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Immediate => Priority::Immediate,
|
||||||
|
self::Urgent => Priority::Urgent,
|
||||||
|
self::First => Priority::First,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function includes(Priority $priority): bool
|
||||||
|
{
|
||||||
|
return self::rank($priority) >= self::rank($this->lowestPriority());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waiting 1, Normal 2, First 3, Urgent 4, Immediate 5.
|
||||||
|
*/
|
||||||
|
public static function rank(Priority $priority): int
|
||||||
|
{
|
||||||
|
return match ($priority) {
|
||||||
|
Priority::Waiting => 1,
|
||||||
|
Priority::Normal => 2,
|
||||||
|
Priority::First => 3,
|
||||||
|
Priority::Urgent => 4,
|
||||||
|
Priority::Immediate => 5,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Exceptions;
|
||||||
|
|
||||||
|
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Kanban card was dropped into a column it cannot stand in: a continuing
|
||||||
|
* job outside "Jatkuvat & Kausi", another job into it, or a pinned task
|
||||||
|
* outside Jonossa, Työn alla and Valmis.
|
||||||
|
*/
|
||||||
|
final class CardCannotMoveThere extends DomainException
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct('The card cannot be moved to that column.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\Exceptions;
|
||||||
|
|
||||||
|
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only tasks of continuing jobs (status "Jatkuvat / Kausi") can be lifted
|
||||||
|
* onto the Kanban board as cards of their own.
|
||||||
|
*/
|
||||||
|
final class TaskCannotBePinned extends DomainException
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct('Only tasks of continuing jobs can be pinned to the board.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Domain\ValueObjects;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Enums\BoardColumn;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\BoardDensity;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\ColumnSort;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\UrgentThreshold;
|
||||||
|
use App\Modules\Shared\Domain\ValueObjects\HexColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One user's Kanban board settings: card density, the urgent threshold,
|
||||||
|
* and their own colour and order for each column. A column without a
|
||||||
|
* colour of its own uses the design's default colour.
|
||||||
|
*/
|
||||||
|
final readonly class BoardPreferences
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, HexColor> $columnColors by BoardColumn value
|
||||||
|
* @param array<string, ColumnSort> $columnSorts by BoardColumn value
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public BoardDensity $density = BoardDensity::Normal,
|
||||||
|
public UrgentThreshold $urgentThreshold = UrgentThreshold::Urgent,
|
||||||
|
public array $columnColors = [],
|
||||||
|
public array $columnSorts = [],
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public static function defaults(): self
|
||||||
|
{
|
||||||
|
return new self;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebuilds stored settings, dropping unknown columns and invalid values
|
||||||
|
* so a bad stored value never breaks the board.
|
||||||
|
*
|
||||||
|
* @param array<array-key, mixed> $colors
|
||||||
|
* @param array<array-key, mixed> $sorts
|
||||||
|
*/
|
||||||
|
public static function fromStored(?string $density, ?string $threshold, array $colors, array $sorts): self
|
||||||
|
{
|
||||||
|
$columnColors = [];
|
||||||
|
|
||||||
|
foreach ($colors as $column => $color) {
|
||||||
|
if (BoardColumn::tryFrom((string) $column) !== null && is_string($color) && preg_match('/^#[0-9a-f]{6}$/i', $color) === 1) {
|
||||||
|
$columnColors[(string) $column] = new HexColor($color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnSorts = [];
|
||||||
|
|
||||||
|
foreach ($sorts as $column => $sort) {
|
||||||
|
$parsed = is_string($sort) ? ColumnSort::tryFrom($sort) : null;
|
||||||
|
|
||||||
|
if (BoardColumn::tryFrom((string) $column) !== null && $parsed !== null) {
|
||||||
|
$columnSorts[(string) $column] = $parsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new self(
|
||||||
|
BoardDensity::tryFrom((string) $density) ?? BoardDensity::Normal,
|
||||||
|
UrgentThreshold::tryFrom((string) $threshold) ?? UrgentThreshold::Urgent,
|
||||||
|
$columnColors,
|
||||||
|
$columnSorts,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function colorOf(BoardColumn $column): HexColor
|
||||||
|
{
|
||||||
|
return $this->columnColors[$column->value] ?? new HexColor($column->defaultColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasOwnColor(BoardColumn $column): bool
|
||||||
|
{
|
||||||
|
return isset($this->columnColors[$column->value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sortOf(BoardColumn $column): ColumnSort
|
||||||
|
{
|
||||||
|
return $this->columnSorts[$column->value] ?? ColumnSort::Manual;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withDensity(BoardDensity $density): self
|
||||||
|
{
|
||||||
|
return new self($density, $this->urgentThreshold, $this->columnColors, $this->columnSorts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withUrgentThreshold(UrgentThreshold $threshold): self
|
||||||
|
{
|
||||||
|
return new self($this->density, $threshold, $this->columnColors, $this->columnSorts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Null returns the column to its default colour.
|
||||||
|
*/
|
||||||
|
public function withColumnColor(BoardColumn $column, ?HexColor $color): self
|
||||||
|
{
|
||||||
|
$colors = $this->columnColors;
|
||||||
|
|
||||||
|
if ($color === null) {
|
||||||
|
unset($colors[$column->value]);
|
||||||
|
} else {
|
||||||
|
$colors[$column->value] = $color;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new self($this->density, $this->urgentThreshold, $colors, $this->columnSorts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withColumnSort(BoardColumn $column, ColumnSort $sort): self
|
||||||
|
{
|
||||||
|
$sorts = $this->columnSorts;
|
||||||
|
$sorts[$column->value] = $sort;
|
||||||
|
|
||||||
|
return new self($this->density, $this->urgentThreshold, $this->columnColors, $sorts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public function colorValues(): array
|
||||||
|
{
|
||||||
|
return array_map(fn (HexColor $color): string => $color->value, $this->columnColors);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public function sortValues(): array
|
||||||
|
{
|
||||||
|
return array_map(fn (ColumnSort $sort): string => $sort->value, $this->columnSorts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -102,6 +102,18 @@ final readonly class JobDetails
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withPriority(Priority $priority): self
|
||||||
|
{
|
||||||
|
return new self(
|
||||||
|
$this->name, $this->description, $this->customerId, $this->serviceUnitIds,
|
||||||
|
$this->startsOn, $this->dueOn, $this->plannedFrom, $this->plannedTo,
|
||||||
|
$this->kind, $this->status, $priority, $this->paymentBasis, $this->estimatedHours,
|
||||||
|
$this->customerReference, $this->instructions, $this->responsibleUserId, $this->contactUserId,
|
||||||
|
$this->customerContactId, $this->billerUserId, $this->billingUnitId, $this->memberUserIds,
|
||||||
|
$this->tags, $this->links, $this->quotedAmount, $this->monthlyFee,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function withServiceUnit(int $serviceUnitId): self
|
public function withServiceUnit(int $serviceUnitId): self
|
||||||
{
|
{
|
||||||
return new self(
|
return new self(
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Infrastructure;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default when no module records hours.
|
||||||
|
*/
|
||||||
|
class NoLoggedJobHours implements LoggedJobHours
|
||||||
|
{
|
||||||
|
public function quartersByJobs(array $jobIds): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function quartersByTasks(array $taskIds): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property JobKind $kind
|
* @property JobKind $kind
|
||||||
* @property JobStatus $status
|
* @property JobStatus $status
|
||||||
* @property Priority $priority
|
* @property Priority $priority
|
||||||
|
* @property int $board_position
|
||||||
* @property PaymentBasis|null $payment_basis
|
* @property PaymentBasis|null $payment_basis
|
||||||
* @property string|null $estimated_hours
|
* @property string|null $estimated_hours
|
||||||
* @property string|null $customer_reference
|
* @property string|null $customer_reference
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Infrastructure\Persistence\Eloquent;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One user's Kanban board settings.
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $user_id
|
||||||
|
* @property string $density
|
||||||
|
* @property string $urgent_threshold
|
||||||
|
* @property array<string, string>|null $column_colors
|
||||||
|
* @property array<string, string>|null $column_sorts
|
||||||
|
*/
|
||||||
|
#[Table('job_board_preferences')]
|
||||||
|
#[Fillable(['user_id', 'density', 'urgent_threshold', 'column_colors', 'column_sorts'])]
|
||||||
|
class JobBoardPreferenceModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'user_id' => 'integer',
|
||||||
|
'column_colors' => 'array',
|
||||||
|
'column_sorts' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property CarbonImmutable|null $planned_to
|
* @property CarbonImmutable|null $planned_to
|
||||||
* @property string|null $estimated_hours
|
* @property string|null $estimated_hours
|
||||||
* @property int|null $assignee_user_id
|
* @property int|null $assignee_user_id
|
||||||
|
* @property bool $is_pinned_to_board
|
||||||
|
* @property int $board_position
|
||||||
* @property int $created_by
|
* @property int $created_by
|
||||||
*/
|
*/
|
||||||
#[Table('tasks')]
|
#[Table('tasks')]
|
||||||
@@ -50,6 +52,8 @@ class TaskModel extends Model
|
|||||||
'planned_from' => 'immutable_date',
|
'planned_from' => 'immutable_date',
|
||||||
'planned_to' => 'immutable_date',
|
'planned_to' => 'immutable_date',
|
||||||
'assignee_user_id' => 'integer',
|
'assignee_user_id' => 'integer',
|
||||||
|
'is_pinned_to_board' => 'boolean',
|
||||||
|
'board_position' => 'integer',
|
||||||
'created_by' => 'integer',
|
'created_by' => 'integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Infrastructure\Persistence\Repositories;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
||||||
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
||||||
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\JobBoardPreferenceModel;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card order and pins are plain column updates: they are board state, not
|
||||||
|
* job details, so they bypass the job entity and its change history.
|
||||||
|
*/
|
||||||
|
class EloquentBoardRepository implements BoardRepository
|
||||||
|
{
|
||||||
|
public function setJobPositions(array $positions): void
|
||||||
|
{
|
||||||
|
foreach ($positions as $jobId => $position) {
|
||||||
|
DB::table('customer_jobs')->where('id', $jobId)->update(['board_position' => $position]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTaskPositions(array $positions): void
|
||||||
|
{
|
||||||
|
foreach ($positions as $taskId => $position) {
|
||||||
|
DB::table('tasks')->where('id', $taskId)->update(['board_position' => $position]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTaskPinned(int $taskId, bool $pinned): void
|
||||||
|
{
|
||||||
|
DB::table('tasks')->where('id', $taskId)->update(['is_pinned_to_board' => $pinned]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preferencesOf(int $userId): BoardPreferences
|
||||||
|
{
|
||||||
|
$model = JobBoardPreferenceModel::query()->where('user_id', $userId)->first();
|
||||||
|
|
||||||
|
return $model === null
|
||||||
|
? BoardPreferences::defaults()
|
||||||
|
: BoardPreferences::fromStored($model->density, $model->urgent_threshold, $model->column_colors ?? [], $model->column_sorts ?? []);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function savePreferences(int $userId, BoardPreferences $preferences): void
|
||||||
|
{
|
||||||
|
JobBoardPreferenceModel::query()->updateOrCreate(['user_id' => $userId], [
|
||||||
|
'density' => $preferences->density->value,
|
||||||
|
'urgent_threshold' => $preferences->urgentThreshold->value,
|
||||||
|
'column_colors' => $preferences->colorValues(),
|
||||||
|
'column_sorts' => $preferences->sortValues(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -197,7 +197,7 @@ class EloquentCustomerJobQueries implements CustomerJobQueries
|
|||||||
{
|
{
|
||||||
return array_values($this->billingInfo(CustomerJobModel::query()
|
return array_values($this->billingInfo(CustomerJobModel::query()
|
||||||
->where('payment_basis', PaymentBasis::MonthlyFee)
|
->where('payment_basis', PaymentBasis::MonthlyFee)
|
||||||
->whereIn('status', [JobStatus::Order, JobStatus::InProduction, JobStatus::OnHold, JobStatus::Done])
|
->whereIn('status', [JobStatus::Order, JobStatus::InProduction, JobStatus::OnHold, JobStatus::Done, JobStatus::Ongoing])
|
||||||
->orderBy('number')
|
->orderBy('number')
|
||||||
->get()));
|
->get()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,220 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Jobs\Infrastructure\Persistence\Repositories;
|
||||||
|
|
||||||
|
use App\Modules\Catalog\Application\Contracts\CatalogQueries;
|
||||||
|
use App\Modules\Customers\Application\Contracts\CustomerQueries;
|
||||||
|
use App\Modules\Jobs\Application\Contracts\JobBoardQueries;
|
||||||
|
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
|
||||||
|
use App\Modules\Jobs\Application\DTOs\BoardCard;
|
||||||
|
use App\Modules\Jobs\Application\DTOs\BoardFilter;
|
||||||
|
use App\Modules\Jobs\Application\DTOs\BoardTask;
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||||
|
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||||
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
||||||
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\CustomerJobModel;
|
||||||
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\TaskModel;
|
||||||
|
use App\Modules\Jobs\Infrastructure\Persistence\JobInvolvement;
|
||||||
|
use App\Modules\Users\Application\Contracts\UserAccountQueries;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customer, user and service unit names and customer colours come from
|
||||||
|
* those modules' query contracts; recorded hours from LoggedJobHours.
|
||||||
|
*/
|
||||||
|
class EloquentJobBoardQueries implements JobBoardQueries
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private CustomerQueries $customers,
|
||||||
|
private UserAccountQueries $users,
|
||||||
|
private CatalogQueries $catalog,
|
||||||
|
private LoggedJobHours $hours,
|
||||||
|
private BoardRepository $board,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function cards(BoardFilter $filter, string $today): array
|
||||||
|
{
|
||||||
|
$jobs = $this->filteredJobs($filter, $today)->get();
|
||||||
|
|
||||||
|
if ($jobs->isEmpty()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$jobIds = $jobs->pluck('id')->map(fn ($id): int => (int) $id)->all();
|
||||||
|
$tasks = TaskModel::query()
|
||||||
|
->whereIn('customer_job_id', $jobIds)
|
||||||
|
->orderByRaw('status = ?', [TaskStatus::Done->value])
|
||||||
|
->orderByRaw('due_on IS NULL')
|
||||||
|
->orderBy('due_on')
|
||||||
|
->orderBy('board_position')
|
||||||
|
->orderBy('id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$customerIds = $jobs->pluck('customer_id')->unique()->values()->all();
|
||||||
|
$customerNames = $this->customers->namesByIds($customerIds);
|
||||||
|
$customerColors = $this->customers->headerColorsByIds($customerIds);
|
||||||
|
$userNames = $this->users->namesByIds($jobs->pluck('responsible_user_id')
|
||||||
|
->merge($tasks->pluck('assignee_user_id')->filter())
|
||||||
|
->map(fn ($id): int => (int) $id)->unique()->values()->all());
|
||||||
|
$jobQuarters = $this->hours->quartersByJobs($jobIds);
|
||||||
|
$pinnedTasks = $tasks->filter(fn (TaskModel $task): bool => (bool) $task->is_pinned_to_board);
|
||||||
|
$taskQuarters = $this->hours->quartersByTasks($pinnedTasks->pluck('id')->map(fn ($id): int => (int) $id)->values()->all());
|
||||||
|
$serviceUnitNames = $this->firstServiceUnitNames($jobIds);
|
||||||
|
$tasksByJob = $tasks->groupBy('customer_job_id');
|
||||||
|
|
||||||
|
$cards = [];
|
||||||
|
|
||||||
|
foreach ($jobs as $job) {
|
||||||
|
$jobTasks = $tasksByJob->get($job->id) ?? collect();
|
||||||
|
$common = [
|
||||||
|
'customerName' => $customerNames[$job->customer_id] ?? '',
|
||||||
|
'customerColor' => $customerColors[$job->customer_id] ?? null,
|
||||||
|
'serviceUnit' => $serviceUnitNames[$job->id] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$cards[] = new BoardCard(
|
||||||
|
jobId: $job->id,
|
||||||
|
taskId: null,
|
||||||
|
number: $job->number,
|
||||||
|
title: $job->name,
|
||||||
|
jobName: $job->name,
|
||||||
|
customerId: $job->customer_id,
|
||||||
|
customerName: $common['customerName'],
|
||||||
|
customerHeaderColor: $common['customerColor'],
|
||||||
|
jobStatus: $job->status,
|
||||||
|
taskStatus: null,
|
||||||
|
priority: $job->priority,
|
||||||
|
kind: $job->kind,
|
||||||
|
dueOn: $job->due_on?->format('Y-m-d'),
|
||||||
|
isLate: $this->isLate($job->status, $job->due_on?->format('Y-m-d'), $today),
|
||||||
|
responsibleName: $userNames[$job->responsible_user_id] ?? null,
|
||||||
|
serviceUnitName: $common['serviceUnit'],
|
||||||
|
estimatedHours: $this->hoursText($job->estimated_hours),
|
||||||
|
loggedQuarters: $jobQuarters[$job->id] ?? 0,
|
||||||
|
boardPosition: (int) $job->board_position,
|
||||||
|
billerUserId: $job->biller_user_id,
|
||||||
|
tasks: $jobTasks->map(fn (TaskModel $task): BoardTask => new BoardTask(
|
||||||
|
$task->id,
|
||||||
|
$task->title,
|
||||||
|
$task->status,
|
||||||
|
$task->assignee_user_id === null ? null : ($userNames[$task->assignee_user_id] ?? null),
|
||||||
|
(bool) $task->is_pinned_to_board,
|
||||||
|
$task->due_on?->format('Y-m-d'),
|
||||||
|
))->values()->all(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($job->status !== JobStatus::Ongoing) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($jobTasks as $task) {
|
||||||
|
if (! $task->is_pinned_to_board) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cards[] = new BoardCard(
|
||||||
|
jobId: $job->id,
|
||||||
|
taskId: $task->id,
|
||||||
|
number: $job->number,
|
||||||
|
title: $task->title,
|
||||||
|
jobName: $job->name,
|
||||||
|
customerId: $job->customer_id,
|
||||||
|
customerName: $common['customerName'],
|
||||||
|
customerHeaderColor: $common['customerColor'],
|
||||||
|
jobStatus: $job->status,
|
||||||
|
taskStatus: $task->status,
|
||||||
|
priority: Priority::Normal,
|
||||||
|
kind: $job->kind,
|
||||||
|
dueOn: $task->due_on?->format('Y-m-d'),
|
||||||
|
isLate: $task->status !== TaskStatus::Done && $task->due_on !== null && $task->due_on->format('Y-m-d') < $today,
|
||||||
|
responsibleName: $task->assignee_user_id === null ? null : ($userNames[$task->assignee_user_id] ?? null),
|
||||||
|
serviceUnitName: $common['serviceUnit'],
|
||||||
|
estimatedHours: $this->hoursText($task->estimated_hours),
|
||||||
|
loggedQuarters: $taskQuarters[$task->id] ?? 0,
|
||||||
|
boardPosition: (int) $task->board_position,
|
||||||
|
billerUserId: $job->biller_user_id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preferencesOf(int $userId): BoardPreferences
|
||||||
|
{
|
||||||
|
return $this->board->preferencesOf($userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Builder<CustomerJobModel>
|
||||||
|
*/
|
||||||
|
private function filteredJobs(BoardFilter $filter, string $today): Builder
|
||||||
|
{
|
||||||
|
$query = CustomerJobModel::query()
|
||||||
|
->where('status', '!=', JobStatus::Archived->value)
|
||||||
|
->whereNull('quick_sale_year');
|
||||||
|
|
||||||
|
foreach (array_filter([$filter->personUserId, $filter->onlyMemberUserId]) as $userId) {
|
||||||
|
JobInvolvement::restrict($query, $userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter->serviceUnitId !== null) {
|
||||||
|
$query->whereIn('id', DB::table('customer_job_service_unit')->select('customer_job_id')->where('service_unit_id', $filter->serviceUnitId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter->onlyUrgent) {
|
||||||
|
$query->whereIn('priority', [Priority::Urgent->value, Priority::Immediate->value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter->onlyLate) {
|
||||||
|
$query->whereNotNull('due_on')
|
||||||
|
->where('due_on', '<', $today)
|
||||||
|
->whereIn('status', array_map(
|
||||||
|
fn (JobStatus $status): string => $status->value,
|
||||||
|
array_values(array_filter(JobStatus::openStatuses(), fn (JobStatus $status): bool => $status !== JobStatus::Ongoing)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->orderBy('board_position')->orderBy('id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A continuing job runs past its due date by nature, so it is never late.
|
||||||
|
*/
|
||||||
|
private function isLate(JobStatus $status, ?string $dueOn, string $today): bool
|
||||||
|
{
|
||||||
|
return $dueOn !== null && $dueOn < $today && $status->isOpen() && $status !== JobStatus::Ongoing;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function hoursText(?string $hours): ?string
|
||||||
|
{
|
||||||
|
return $hours === null ? null : rtrim(rtrim($hours, '0'), '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first service unit's name of each job.
|
||||||
|
*
|
||||||
|
* @param list<int> $jobIds
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
private function firstServiceUnitNames(array $jobIds): array
|
||||||
|
{
|
||||||
|
/** @var Collection<int, object{customer_job_id: int, service_unit_id: int}> $rows */
|
||||||
|
$rows = DB::table('customer_job_service_unit')
|
||||||
|
->whereIn('customer_job_id', $jobIds)
|
||||||
|
->orderBy('service_unit_id')
|
||||||
|
->get(['customer_job_id', 'service_unit_id']);
|
||||||
|
$names = $this->catalog->serviceUnitNames($rows->pluck('service_unit_id')->map(fn ($id): int => (int) $id)->unique()->values()->all());
|
||||||
|
$first = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$first[(int) $row->customer_job_id] ??= $names[(int) $row->service_unit_id] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_filter($first, fn (?string $name): bool => $name !== null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,9 @@ use App\Modules\Customers\Application\Contracts\CustomerReferences;
|
|||||||
use App\Modules\Customers\Application\Contracts\CustomerRowUsage;
|
use App\Modules\Customers\Application\Contracts\CustomerRowUsage;
|
||||||
use App\Modules\Jobs\Application\Contracts\ChecklistQueries;
|
use App\Modules\Jobs\Application\Contracts\ChecklistQueries;
|
||||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||||
|
use App\Modules\Jobs\Application\Contracts\JobBoardQueries;
|
||||||
use App\Modules\Jobs\Application\Contracts\JobOverviewQueries;
|
use App\Modules\Jobs\Application\Contracts\JobOverviewQueries;
|
||||||
|
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
|
||||||
use App\Modules\Jobs\Application\Contracts\TaskCalendarQueries;
|
use App\Modules\Jobs\Application\Contracts\TaskCalendarQueries;
|
||||||
use App\Modules\Jobs\Application\Contracts\TaskCommentQueries;
|
use App\Modules\Jobs\Application\Contracts\TaskCommentQueries;
|
||||||
use App\Modules\Jobs\Application\Contracts\TaskImageFiles;
|
use App\Modules\Jobs\Application\Contracts\TaskImageFiles;
|
||||||
@@ -15,6 +17,7 @@ use App\Modules\Jobs\Application\Contracts\TaskImageQueries;
|
|||||||
use App\Modules\Jobs\Application\Contracts\TaskQueries;
|
use App\Modules\Jobs\Application\Contracts\TaskQueries;
|
||||||
use App\Modules\Jobs\Application\Contracts\TaskUsage;
|
use App\Modules\Jobs\Application\Contracts\TaskUsage;
|
||||||
use App\Modules\Jobs\Application\Contracts\UpcomingTasks;
|
use App\Modules\Jobs\Application\Contracts\UpcomingTasks;
|
||||||
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
||||||
use App\Modules\Jobs\Domain\Contracts\ChecklistItemRepository;
|
use App\Modules\Jobs\Domain\Contracts\ChecklistItemRepository;
|
||||||
use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
||||||
use App\Modules\Jobs\Domain\Contracts\JobNumberSequence;
|
use App\Modules\Jobs\Domain\Contracts\JobNumberSequence;
|
||||||
@@ -25,12 +28,15 @@ use App\Modules\Jobs\Domain\Contracts\TaskRepository;
|
|||||||
use App\Modules\Jobs\Infrastructure\CustomerReferencesFromJobs;
|
use App\Modules\Jobs\Infrastructure\CustomerReferencesFromJobs;
|
||||||
use App\Modules\Jobs\Infrastructure\CustomerRowUsageFromJobs;
|
use App\Modules\Jobs\Infrastructure\CustomerRowUsageFromJobs;
|
||||||
use App\Modules\Jobs\Infrastructure\Files\GdTaskImageFiles;
|
use App\Modules\Jobs\Infrastructure\Files\GdTaskImageFiles;
|
||||||
|
use App\Modules\Jobs\Infrastructure\NoLoggedJobHours;
|
||||||
use App\Modules\Jobs\Infrastructure\NothingUsesTasks;
|
use App\Modules\Jobs\Infrastructure\NothingUsesTasks;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\DatabaseJobNumberSequence;
|
use App\Modules\Jobs\Infrastructure\Persistence\DatabaseJobNumberSequence;
|
||||||
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentBoardRepository;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentChecklistItemRepository;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentChecklistItemRepository;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentChecklistQueries;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentChecklistQueries;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentCustomerJobQueries;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentCustomerJobQueries;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentCustomerJobRepository;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentCustomerJobRepository;
|
||||||
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentJobBoardQueries;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentJobOverviewQueries;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentJobOverviewQueries;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskBookingRepository;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskBookingRepository;
|
||||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskCalendarQueries;
|
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskCalendarQueries;
|
||||||
@@ -75,6 +81,10 @@ class JobsServiceProvider extends ServiceProvider
|
|||||||
UpcomingTasks::class => EloquentUpcomingTasks::class,
|
UpcomingTasks::class => EloquentUpcomingTasks::class,
|
||||||
// Replaced by the TimeTracking module, which knows which tasks have time entries.
|
// Replaced by the TimeTracking module, which knows which tasks have time entries.
|
||||||
TaskUsage::class => NothingUsesTasks::class,
|
TaskUsage::class => NothingUsesTasks::class,
|
||||||
|
BoardRepository::class => EloquentBoardRepository::class,
|
||||||
|
JobBoardQueries::class => EloquentJobBoardQueries::class,
|
||||||
|
// Replaced by the TimeTracking module, which records the hours.
|
||||||
|
LoggedJobHours::class => NoLoggedJobHours::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function register(): void
|
public function register(): void
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ new class extends Component
|
|||||||
</x-select.native>
|
</x-select.native>
|
||||||
|
|
||||||
@if ($this->isSubcontractor())
|
@if ($this->isSubcontractor())
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.list.subcontractor_note') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.list.subcontractor_note') }}</p>
|
||||||
@else
|
@else
|
||||||
<div class="flex items-end pb-2">
|
<div class="flex items-end pb-2">
|
||||||
<x-checkbox id="board-only-mine" wire:model.live="mine" :label="__('jobs.list.only_mine')" />
|
<x-checkbox id="board-only-mine" wire:model.live="mine" :label="__('jobs.list.only_mine')" />
|
||||||
@@ -209,6 +209,7 @@ new class extends Component
|
|||||||
'in_production' => 'border-t-primary-500',
|
'in_production' => 'border-t-primary-500',
|
||||||
'on_hold' => 'border-t-amber-500',
|
'on_hold' => 'border-t-amber-500',
|
||||||
'done', 'billed' => 'border-t-emerald-500',
|
'done', 'billed' => 'border-t-emerald-500',
|
||||||
|
'ongoing' => 'border-t-teal-500',
|
||||||
default => 'border-t-zinc-400',
|
default => 'border-t-zinc-400',
|
||||||
}])
|
}])
|
||||||
>
|
>
|
||||||
@@ -245,7 +246,7 @@ new class extends Component
|
|||||||
</x-link>
|
</x-link>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p class="break-words text-zinc-700 dark:text-zinc-300">{{ $job->customerName }}</p>
|
<p class="break-words text-zinc-700 dark:text-zinc-200">{{ $job->customerName }}</p>
|
||||||
|
|
||||||
<div class="flex flex-wrap gap-x-4 gap-y-1">
|
<div class="flex flex-wrap gap-x-4 gap-y-1">
|
||||||
<x-jobs.priority :priority="$job->priority" />
|
<x-jobs.priority :priority="$job->priority" />
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-[120rem] space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-[120rem] space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="calendar-days">{{ __('jobs.calendar.title') }}</x-page-title>
|
<x-page-title icon="calendar-days">{{ __('jobs.calendar.title') }}</x-page-title>
|
||||||
<p class="max-w-3xl text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.calendar.intro') }}</p>
|
<p class="max-w-3xl text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.calendar.intro') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card flex flex-wrap items-end gap-4">
|
<div class="card flex flex-wrap items-end gap-4">
|
||||||
@@ -530,7 +530,7 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($this->isSubcontractor())
|
@if ($this->isSubcontractor())
|
||||||
<p class="pb-2 text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.calendar.subcontractor_note') }}</p>
|
<p class="pb-2 text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.calendar.subcontractor_note') }}</p>
|
||||||
@else
|
@else
|
||||||
<div class="pb-2">
|
<div class="pb-2">
|
||||||
<x-checkbox id="calendar-only-mine" wire:model.live="mine" :label="__('jobs.calendar.only_mine')" />
|
<x-checkbox id="calendar-only-mine" wire:model.live="mine" :label="__('jobs.calendar.only_mine')" />
|
||||||
@@ -623,7 +623,7 @@ new class extends Component
|
|||||||
@class([
|
@class([
|
||||||
'pointer-events-none px-1 pt-1 text-right text-xs whitespace-nowrap',
|
'pointer-events-none px-1 pt-1 text-right text-xs whitespace-nowrap',
|
||||||
'font-semibold text-amber-900 dark:text-amber-200' => $booked > $this->capacityMinutes,
|
'font-semibold text-amber-900 dark:text-amber-200' => $booked > $this->capacityMinutes,
|
||||||
'text-zinc-600 dark:text-zinc-300' => $booked === 0,
|
'text-zinc-600 dark:text-zinc-200' => $booked === 0,
|
||||||
])
|
])
|
||||||
style="grid-column: {{ $index + 2 }}; grid-row: 1;"
|
style="grid-column: {{ $index + 2 }}; grid-row: 1;"
|
||||||
>
|
>
|
||||||
@@ -751,7 +751,7 @@ new class extends Component
|
|||||||
<h3 id="agenda-{{ $rowKey }}-name" class="font-semibold break-words">{{ $row->name }}</h3>
|
<h3 id="agenda-{{ $rowKey }}-name" class="font-semibold break-words">{{ $row->name }}</h3>
|
||||||
|
|
||||||
@if ($row->bars === [])
|
@if ($row->bars === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.calendar.no_tasks') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.calendar.no_tasks') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul class="space-y-2">
|
<ul class="space-y-2">
|
||||||
@foreach ($row->bars as $bar)
|
@foreach ($row->bars as $bar)
|
||||||
@@ -793,7 +793,7 @@ new class extends Component
|
|||||||
@if ($this->unscheduled === [])
|
@if ($this->unscheduled === [])
|
||||||
<x-empty-state icon="calendar-days">{{ __('jobs.calendar.unscheduled_none') }}</x-empty-state>
|
<x-empty-state icon="calendar-days">{{ __('jobs.calendar.unscheduled_none') }}</x-empty-state>
|
||||||
@else
|
@else
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.calendar.unscheduled_intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.calendar.unscheduled_intro') }}</p>
|
||||||
|
|
||||||
<ul class="grid gap-2 sm:grid-cols-2 xl:grid-cols-4">
|
<ul class="grid gap-2 sm:grid-cols-2 xl:grid-cols-4">
|
||||||
@foreach ($this->unscheduled as $task)
|
@foreach ($this->unscheduled as $task)
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ new class extends Component
|
|||||||
|
|
||||||
<p id="tags-label" class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.tags') }}</p>
|
<p id="tags-label" class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.tags') }}</p>
|
||||||
@if ($form->tags === [])
|
@if ($form->tags === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tags.none') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tags.none') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul aria-labelledby="tags-label" class="flex flex-wrap gap-2">
|
<ul aria-labelledby="tags-label" class="flex flex-wrap gap-2">
|
||||||
@foreach ($form->tags as $index => $tag)
|
@foreach ($form->tags as $index => $tag)
|
||||||
@@ -498,7 +498,7 @@ new class extends Component
|
|||||||
<p class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.links') }}</p>
|
<p class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.links') }}</p>
|
||||||
|
|
||||||
@if ($form->links === [])
|
@if ($form->links === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.links.none') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.links.none') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@foreach ($form->links as $index => $link)
|
@foreach ($form->links as $index => $link)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ new class extends Component
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($this->isSubcontractor())
|
@if ($this->isSubcontractor())
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.list.subcontractor_note') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.list.subcontractor_note') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="grid gap-4 rounded-xl border border-zinc-200 bg-white p-4 shadow-sm md:grid-cols-2 xl:grid-cols-4 dark:border-zinc-700 dark:bg-zinc-900">
|
<div class="grid gap-4 rounded-xl border border-zinc-200 bg-white p-4 shadow-sm md:grid-cols-2 xl:grid-cols-4 dark:border-zinc-700 dark:bg-zinc-900">
|
||||||
@@ -158,7 +158,7 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm text-zinc-600 dark:text-zinc-100">
|
||||||
{{ trans_choice('jobs.list.result_count', $this->jobs->total(), ['count' => $this->jobs->total()]) }}
|
{{ trans_choice('jobs.list.result_count', $this->jobs->total(), ['count' => $this->jobs->total()]) }}
|
||||||
@if ($mine && ! $this->isSubcontractor())
|
@if ($mine && ! $this->isSubcontractor())
|
||||||
– {{ __('jobs.list.only_mine_description') }}
|
– {{ __('jobs.list.only_mine_description') }}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="bolt">{{ __('jobs.quick.title') }}</x-page-title>
|
<x-page-title icon="bolt">{{ __('jobs.quick.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.quick.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.quick.intro') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="quick-created" tabindex="-1" role="status" aria-live="polite" class="focus:outline-none">
|
<div id="quick-created" tabindex="-1" role="status" aria-live="polite" class="focus:outline-none">
|
||||||
|
|||||||
@@ -209,11 +209,11 @@ new class extends Component
|
|||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||||
<div class="min-w-0 flex-1 space-y-1">
|
<div class="min-w-0 flex-1 space-y-1">
|
||||||
<a href="{{ route('jobs.index') }}" wire:navigate class="inline-flex min-h-6 items-center gap-1 rounded-md text-sm font-medium text-primary-700 underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:text-primary-300 dark:focus-visible:outline-primary-300">
|
<a href="{{ route('jobs.index') }}" wire:navigate class="inline-flex min-h-6 items-center gap-1 rounded-md text-sm font-medium text-primary-700 underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:text-primary-100 dark:focus-visible:outline-primary-300">
|
||||||
<x-icon name="arrow-left" class="size-4" aria-hidden="true" />{{ __('jobs.title') }}
|
<x-icon name="arrow-left" class="size-4" aria-hidden="true" />{{ __('jobs.title') }}
|
||||||
</a>
|
</a>
|
||||||
<h1 class="text-2xl font-semibold break-words">
|
<h1 class="text-2xl font-semibold break-words">
|
||||||
<span class="whitespace-nowrap text-primary-700 dark:text-primary-300">{{ $job->number }}</span> {{ $job->name }}
|
<span class="whitespace-nowrap text-primary-700 dark:text-primary-100">{{ $job->number }}</span> {{ $job->name }}
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ new class extends Component
|
|||||||
|
|
||||||
@can('jobs.manage-tasks', $job->id)
|
@can('jobs.manage-tasks', $job->id)
|
||||||
@unless ($job->status->allowsTasks())
|
@unless ($job->status->allowsTasks())
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.not_allowed_yet') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.not_allowed_yet') }}</p>
|
||||||
@endunless
|
@endunless
|
||||||
@endcan
|
@endcan
|
||||||
|
|
||||||
@@ -588,7 +588,7 @@ new class extends Component
|
|||||||
<h2 id="links-heading" class="text-xl font-semibold">{{ __('jobs.sections.links') }}</h2>
|
<h2 id="links-heading" class="text-xl font-semibold">{{ __('jobs.sections.links') }}</h2>
|
||||||
|
|
||||||
@if ($job->links === [])
|
@if ($job->links === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.links.none') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.links.none') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul class="list-disc space-y-1 pl-5 text-sm">
|
<ul class="list-disc space-y-1 pl-5 text-sm">
|
||||||
@foreach ($job->links as $link)
|
@foreach ($job->links as $link)
|
||||||
@@ -626,7 +626,7 @@ new class extends Component
|
|||||||
|
|
||||||
<div id="history-panel" x-show="open" x-cloak>
|
<div id="history-panel" x-show="open" x-cloak>
|
||||||
@if ($this->changes === [])
|
@if ($this->changes === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.history.empty') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.history.empty') }}</p>
|
||||||
@else
|
@else
|
||||||
<ol class="space-y-2 text-sm">
|
<ol class="space-y-2 text-sm">
|
||||||
@foreach ($this->changes as $change)
|
@foreach ($this->changes as $change)
|
||||||
@@ -643,7 +643,7 @@ new class extends Component
|
|||||||
<span class="font-medium">{{ __('jobs.history.unlocked') }}</span>
|
<span class="font-medium">{{ __('jobs.history.unlocked') }}</span>
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">
|
<span class="block text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('jobs.history.by', ['user' => $change->userName, 'time' => CarbonImmutable::parse($change->changedAt)->format('j.n.Y H.i')]) }}
|
{{ __('jobs.history.by', ['user' => $change->userName, 'time' => CarbonImmutable::parse($change->changedAt)->format('j.n.Y H.i')]) }}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ new class extends Component
|
|||||||
<p role="status" aria-live="polite" class="text-sm">{{ $message }}</p>
|
<p role="status" aria-live="polite" class="text-sm">{{ $message }}</p>
|
||||||
|
|
||||||
@if ($this->items === [])
|
@if ($this->items === [])
|
||||||
<p class="text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.checklist.empty') }}</p>
|
<p class="text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.checklist.empty') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul class="space-y-2" aria-label="{{ __('jobs.tasks.checklist.list_of', ['title' => $taskTitle]) }}">
|
<ul class="space-y-2" aria-label="{{ __('jobs.tasks.checklist.list_of', ['title' => $taskTitle]) }}">
|
||||||
@foreach ($this->items as $item)
|
@foreach ($this->items as $item)
|
||||||
@@ -304,7 +304,7 @@ new class extends Component
|
|||||||
@else
|
@else
|
||||||
<span class="min-w-0 grow break-words">
|
<span class="min-w-0 grow break-words">
|
||||||
<span @class(['line-through' => $item->done])>{{ $item->text }}</span>
|
<span @class(['line-through' => $item->done])>{{ $item->text }}</span>
|
||||||
<span class="text-zinc-600 dark:text-zinc-300">({{ $item->done ? __('jobs.tasks.checklist.done') : __('jobs.tasks.checklist.not_done') }})</span>
|
<span class="text-zinc-600 dark:text-zinc-200">({{ $item->done ? __('jobs.tasks.checklist.done') : __('jobs.tasks.checklist.not_done') }})</span>
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ new class extends Component
|
|||||||
<p role="status" aria-live="polite" class="text-sm">{{ $message }}</p>
|
<p role="status" aria-live="polite" class="text-sm">{{ $message }}</p>
|
||||||
|
|
||||||
@if ($this->comments === [])
|
@if ($this->comments === [])
|
||||||
<p class="text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.comments.empty') }}</p>
|
<p class="text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.comments.empty') }}</p>
|
||||||
@else
|
@else
|
||||||
<ol class="space-y-3">
|
<ol class="space-y-3">
|
||||||
@foreach ($this->comments as $comment)
|
@foreach ($this->comments as $comment)
|
||||||
@@ -298,7 +298,7 @@ new class extends Component
|
|||||||
<li wire:key="task-comment-{{ $comment->id }}" class="space-y-1 rounded-md bg-zinc-50 p-3 dark:bg-zinc-800">
|
<li wire:key="task-comment-{{ $comment->id }}" class="space-y-1 rounded-md bg-zinc-50 p-3 dark:bg-zinc-800">
|
||||||
<p class="flex flex-wrap gap-x-2">
|
<p class="flex flex-wrap gap-x-2">
|
||||||
<span class="font-medium">{{ $this->authorName($comment) }}</span>
|
<span class="font-medium">{{ $this->authorName($comment) }}</span>
|
||||||
<span class="text-zinc-600 dark:text-zinc-300">
|
<span class="text-zinc-600 dark:text-zinc-200">
|
||||||
<time datetime="{{ str_replace(' ', 'T', $comment->createdAt) }}">{{ $at }}</time>
|
<time datetime="{{ str_replace(' ', 'T', $comment->createdAt) }}">{{ $at }}</time>
|
||||||
@if ($comment->editedAt !== null)
|
@if ($comment->editedAt !== null)
|
||||||
({{ __('jobs.tasks.comments.edited', ['at' => $this->formatTime($comment->editedAt)]) }})
|
({{ __('jobs.tasks.comments.edited', ['at' => $this->formatTime($comment->editedAt)]) }})
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="clipboard-document-list">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="clipboard-document-list">{{ $this->heading() }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ __('jobs.tasks.job_label') }}:
|
{{ __('jobs.tasks.job_label') }}:
|
||||||
<x-link :href="route('jobs.show', $jobId)" navigate>{{ $jobTitle }}</x-link>
|
<x-link :href="route('jobs.show', $jobId)" navigate>{{ $jobTitle }}</x-link>
|
||||||
</p>
|
</p>
|
||||||
@@ -228,7 +228,7 @@ new class extends Component
|
|||||||
|
|
||||||
<fieldset class="space-y-2">
|
<fieldset class="space-y-2">
|
||||||
<legend class="text-sm font-semibold">{{ __('jobs.tasks.schedule') }}</legend>
|
<legend class="text-sm font-semibold">{{ __('jobs.tasks.schedule') }}</legend>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.fields.planned_hint') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.fields.planned_hint') }}</p>
|
||||||
<div class="grid gap-6 sm:grid-cols-2">
|
<div class="grid gap-6 sm:grid-cols-2">
|
||||||
<x-input wire:model="form.planned_from" type="date" :label="__('jobs.tasks.fields.planned_from')" />
|
<x-input wire:model="form.planned_from" type="date" :label="__('jobs.tasks.fields.planned_from')" />
|
||||||
<x-input wire:model="form.planned_to" type="date" :label="__('jobs.tasks.fields.planned_to')" />
|
<x-input wire:model="form.planned_to" type="date" :label="__('jobs.tasks.fields.planned_to')" />
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ new class extends Component
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
@if ($this->images === [])
|
@if ($this->images === [])
|
||||||
<p class="text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.images.empty') }}</p>
|
<p class="text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.images.empty') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul class="grid grid-cols-1 gap-4 min-[360px]:grid-cols-2 lg:grid-cols-3">
|
<ul class="grid grid-cols-1 gap-4 min-[360px]:grid-cols-2 lg:grid-cols-3">
|
||||||
@foreach ($this->images as $index => $image)
|
@foreach ($this->images as $index => $image)
|
||||||
@@ -367,7 +367,7 @@ new class extends Component
|
|||||||
@if ($image->caption !== null)
|
@if ($image->caption !== null)
|
||||||
<span class="block">{{ $image->caption }}</span>
|
<span class="block">{{ $image->caption }}</span>
|
||||||
@endif
|
@endif
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">
|
<span class="block text-zinc-600 dark:text-zinc-200">
|
||||||
{{ $this->uploaderName($image) }}, <time datetime="{{ str_replace(' ', 'T', $image->uploadedAt) }}">{{ $this->formatTime($image->uploadedAt) }}</time>
|
{{ $this->uploaderName($image) }}, <time datetime="{{ str_replace(' ', 'T', $image->uploadedAt) }}">{{ $this->formatTime($image->uploadedAt) }}</time>
|
||||||
</span>
|
</span>
|
||||||
</figcaption>
|
</figcaption>
|
||||||
@@ -422,8 +422,8 @@ new class extends Component
|
|||||||
@if ($canUpload)
|
@if ($canUpload)
|
||||||
<form wire:submit="add" class="space-y-3">
|
<form wire:submit="add" class="space-y-3">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<label for="image-new-{{ $taskId }}" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-300">{{ __('jobs.tasks.images.new') }}</label>
|
<label for="image-new-{{ $taskId }}" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200">{{ __('jobs.tasks.images.new') }}</label>
|
||||||
<p id="image-new-{{ $taskId }}-hint" class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.images.hint', ['size' => $this::MAX_KILOBYTES / 1024]) }}</p>
|
<p id="image-new-{{ $taskId }}-hint" class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.images.hint', ['size' => $this::MAX_KILOBYTES / 1024]) }}</p>
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
id="image-new-{{ $taskId }}"
|
id="image-new-{{ $taskId }}"
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-2xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="queue-list">{{ __('jobs.tasks.from_template.title') }}</x-page-title>
|
<x-page-title icon="queue-list">{{ __('jobs.tasks.from_template.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.job_label') }}: {{ $jobTitle }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.job_label') }}: {{ $jobTitle }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="text-sm">{{ __('jobs.tasks.from_template.intro') }}</p>
|
<p class="text-sm">{{ __('jobs.tasks.from_template.intro') }}</p>
|
||||||
@@ -241,7 +241,7 @@ new class extends Component
|
|||||||
@if (($template = $this->selectedTemplate) !== null)
|
@if (($template = $this->selectedTemplate) !== null)
|
||||||
{{-- An input grid is a form, so a native table rather than <x-table>. --}}
|
{{-- An input grid is a form, so a native table rather than <x-table>. --}}
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.from_template.schedule_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.from_template.schedule_help') }}</p>
|
||||||
|
|
||||||
{{-- Below sm the rows stack (each cell on its own line, with its own visible label) so that the page reflows at 320 px. --}}
|
{{-- Below sm the rows stack (each cell on its own line, with its own visible label) so that the page reflows at 320 px. --}}
|
||||||
<table class="w-full border-collapse text-sm">
|
<table class="w-full border-collapse text-sm">
|
||||||
@@ -259,7 +259,7 @@ new class extends Component
|
|||||||
<tr wire:key="row-{{ $template->id }}-{{ $index }}" class="border-b border-zinc-200 align-top max-sm:block max-sm:py-2 dark:border-zinc-700">
|
<tr wire:key="row-{{ $template->id }}-{{ $index }}" class="border-b border-zinc-200 align-top max-sm:block max-sm:py-2 dark:border-zinc-700">
|
||||||
<th scope="row" class="py-2 pr-2 text-left font-normal break-words max-sm:block max-sm:py-0">
|
<th scope="row" class="py-2 pr-2 text-left font-normal break-words max-sm:block max-sm:py-0">
|
||||||
<span class="font-medium">{{ $step->title }}</span>
|
<span class="font-medium">{{ $step->title }}</span>
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ $step->workTypeName }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ $step->workTypeName }}</span>
|
||||||
</th>
|
</th>
|
||||||
<td class="px-1 py-2 max-sm:block max-sm:px-0 max-sm:py-1">
|
<td class="px-1 py-2 max-sm:block max-sm:px-0 max-sm:py-1">
|
||||||
<span class="block text-xs font-medium sm:hidden" aria-hidden="true">{{ __('jobs.tasks.fields.due_on') }}</span>
|
<span class="block text-xs font-medium sm:hidden" aria-hidden="true">{{ __('jobs.tasks.fields.due_on') }}</span>
|
||||||
@@ -317,7 +317,7 @@ new class extends Component
|
|||||||
aria-describedby="schedule-to-due-dates-hint"
|
aria-describedby="schedule-to-due-dates-hint"
|
||||||
:label="__('jobs.tasks.from_template.schedule_to_due')"
|
:label="__('jobs.tasks.from_template.schedule_to_due')"
|
||||||
/>
|
/>
|
||||||
<p id="schedule-to-due-dates-hint" class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tasks.from_template.schedule_to_due_hint') }}</p>
|
<p id="schedule-to-due-dates-hint" class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('jobs.tasks.from_template.schedule_to_due_hint') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ new #[Layout('layouts.console')] class extends Component
|
|||||||
@if ($lateMaintenance !== [])
|
@if ($lateMaintenance !== [])
|
||||||
<div class="space-y-1 rounded-xl border-2 border-red-700 bg-red-50 p-3 dark:border-red-400 dark:bg-red-400/10">
|
<div class="space-y-1 rounded-xl border-2 border-red-700 bg-red-50 p-3 dark:border-red-400 dark:bg-red-400/10">
|
||||||
@foreach ($lateMaintenance as $late)
|
@foreach ($lateMaintenance as $late)
|
||||||
<p wire:key="late-{{ $late->id }}" class="flex items-center gap-2 font-semibold text-red-700 dark:text-red-400">
|
<p wire:key="late-{{ $late->id }}" class="flex items-center gap-2 font-semibold text-red-700 dark:text-red-100">
|
||||||
<x-icon name="exclamation-triangle" class="size-6 shrink-0" aria-hidden="true" />
|
<x-icon name="exclamation-triangle" class="size-6 shrink-0" aria-hidden="true" />
|
||||||
{{ __('machines.console.maintenance_late', ['name' => $late->name]) }}
|
{{ __('machines.console.maintenance_late', ['name' => $late->name]) }}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ new class extends Component
|
|||||||
|
|
||||||
<fieldset class="space-y-3">
|
<fieldset class="space-y-3">
|
||||||
<legend class="text-lg font-semibold">{{ __('machines.form.counters') }}</legend>
|
<legend class="text-lg font-semibold">{{ __('machines.form.counters') }}</legend>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('machines.form.counters_hint') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('machines.form.counters_hint') }}</p>
|
||||||
@error('counters')
|
@error('counters')
|
||||||
<p role="alert" class="text-sm text-red-700 dark:text-red-400">{{ $message }}</p>
|
<p role="alert" class="text-sm text-red-700 dark:text-red-400">{{ $message }}</p>
|
||||||
@enderror
|
@enderror
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="cpu-chip">{{ __('machines.index.title') }}</x-page-title>
|
<x-page-title icon="cpu-chip">{{ __('machines.index.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('machines.index.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('machines.index.intro') }}</p>
|
||||||
@can('machines.manage')
|
@can('machines.manage')
|
||||||
<p><x-button :href="route('machines.create')" wire:navigate icon="plus" :text="__('machines.index.new')" /></p>
|
<p><x-button :href="route('machines.create')" wire:navigate icon="plus" :text="__('machines.index.new')" /></p>
|
||||||
@endcan
|
@endcan
|
||||||
@@ -118,7 +118,7 @@ new class extends Component
|
|||||||
<p class="font-medium break-words">
|
<p class="font-medium break-words">
|
||||||
<x-link :href="route('machines.show', $machine->id)" navigate :aria-label="__('machines.index.open_named', ['name' => $machine->name])">{{ $machine->name }}</x-link>
|
<x-link :href="route('machines.show', $machine->id)" navigate :aria-label="__('machines.index.open_named', ['name' => $machine->name])">{{ $machine->name }}</x-link>
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-zinc-700 dark:text-zinc-300">
|
<p class="text-sm text-zinc-700 dark:text-zinc-200">
|
||||||
{{ __('machines.types.'.$machine->type->value) }}
|
{{ __('machines.types.'.$machine->type->value) }}
|
||||||
@if ($machine->responsibleName !== null)
|
@if ($machine->responsibleName !== null)
|
||||||
· {{ __('machines.index.responsible', ['name' => $machine->responsibleName]) }}
|
· {{ __('machines.index.responsible', ['name' => $machine->responsibleName]) }}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ new class extends Component
|
|||||||
|
|
||||||
<fieldset class="space-y-3">
|
<fieldset class="space-y-3">
|
||||||
<legend class="font-semibold">{{ __('machines.maintenance.counter_interval') }}</legend>
|
<legend class="font-semibold">{{ __('machines.maintenance.counter_interval') }}</legend>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('machines.maintenance.counter_interval_hint') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('machines.maintenance.counter_interval_hint') }}</p>
|
||||||
@if ($this->machine->counters === [])
|
@if ($this->machine->counters === [])
|
||||||
<p class="text-sm">{{ __('machines.maintenance.no_counters') }}</p>
|
<p class="text-sm">{{ __('machines.maintenance.no_counters') }}</p>
|
||||||
@else
|
@else
|
||||||
@@ -215,7 +215,7 @@ new class extends Component
|
|||||||
|
|
||||||
<fieldset class="space-y-3">
|
<fieldset class="space-y-3">
|
||||||
<legend class="font-semibold">{{ __('machines.maintenance.time_interval') }}</legend>
|
<legend class="font-semibold">{{ __('machines.maintenance.time_interval') }}</legend>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('machines.maintenance.time_interval_hint') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('machines.maintenance.time_interval_hint') }}</p>
|
||||||
<div class="grid gap-4 sm:grid-cols-2">
|
<div class="grid gap-4 sm:grid-cols-2">
|
||||||
<x-select.native id="item-period" wire:model.live="period" :label="__('machines.maintenance.period')" :aria-label="__('machines.maintenance.period')">
|
<x-select.native id="item-period" wire:model.live="period" :label="__('machines.maintenance.period')" :aria-label="__('machines.maintenance.period')">
|
||||||
<option value="">{{ __('machines.maintenance.no_period') }}</option>
|
<option value="">{{ __('machines.maintenance.no_period') }}</option>
|
||||||
|
|||||||
@@ -266,8 +266,8 @@ new class extends Component
|
|||||||
<x-icon :name="$this->levelIcon($item)" class="size-4" aria-hidden="true" />
|
<x-icon :name="$this->levelIcon($item)" class="size-4" aria-hidden="true" />
|
||||||
{{ $this->levelLabel($item) }}@if ($this->stateText($item) !== ''): {{ $this->stateText($item) }}@endif
|
{{ $this->levelLabel($item) }}@if ($this->stateText($item) !== ''): {{ $this->stateText($item) }}@endif
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-zinc-700 dark:text-zinc-300">{{ __('machines.maintenance.interval_text', ['interval' => $this->intervalText($item)]) }}</p>
|
<p class="text-sm text-zinc-700 dark:text-zinc-200">{{ __('machines.maintenance.interval_text', ['interval' => $this->intervalText($item)]) }}</p>
|
||||||
<p class="text-sm text-zinc-700 dark:text-zinc-300">
|
<p class="text-sm text-zinc-700 dark:text-zinc-200">
|
||||||
@if ($item->lastPerformedAt === null)
|
@if ($item->lastPerformedAt === null)
|
||||||
{{ __('machines.maintenance.never_done') }}
|
{{ __('machines.maintenance.never_done') }}
|
||||||
@else
|
@else
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ new class extends Component
|
|||||||
@if ($this->isAvailable())
|
@if ($this->isAvailable())
|
||||||
<section aria-labelledby="process-heading" class="card space-y-4">
|
<section aria-labelledby="process-heading" class="card space-y-4">
|
||||||
<h2 id="process-heading" class="text-xl font-semibold">{{ __('machines.process.title') }}</h2>
|
<h2 id="process-heading" class="text-xl font-semibold">{{ __('machines.process.title') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('machines.process.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('machines.process.intro') }}</p>
|
||||||
|
|
||||||
<p role="status" aria-live="polite" class="text-sm font-medium">{{ $message }}</p>
|
<p role="status" aria-live="polite" class="text-sm font-medium">{{ $message }}</p>
|
||||||
@error('steps')
|
@error('steps')
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ new class extends Component
|
|||||||
<p class="font-medium break-words">{{ $this->rowTitle($row) }}</p>
|
<p class="font-medium break-words">{{ $this->rowTitle($row) }}</p>
|
||||||
@if ($task !== null)
|
@if ($task !== null)
|
||||||
<p class="text-sm">{{ $task->jobNumber }} {{ $task->jobName }} · {{ $task->customerName }}</p>
|
<p class="text-sm">{{ $task->jobNumber }} {{ $task->jobName }} · {{ $task->customerName }}</p>
|
||||||
<p class="flex flex-wrap gap-x-3 gap-y-1 text-sm text-zinc-700 dark:text-zinc-300">
|
<p class="flex flex-wrap gap-x-3 gap-y-1 text-sm text-zinc-700 dark:text-zinc-200">
|
||||||
@if ($task->dueOn !== null)
|
@if ($task->dueOn !== null)
|
||||||
<span>{{ __('machines.show.due', ['date' => $this->dateLabel($task->dueOn)]) }}</span>
|
<span>{{ __('machines.show.due', ['date' => $this->dateLabel($task->dueOn)]) }}</span>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ new class extends Component
|
|||||||
</p>
|
</p>
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('machines.task.not_on_machine') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('machines.task.not_on_machine') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($this->canPlan())
|
@if ($this->canPlan())
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ new class extends Component
|
|||||||
<tr wire:key="job-{{ $row->job->id }}" class="align-top">
|
<tr wire:key="job-{{ $row->job->id }}" class="align-top">
|
||||||
<th scope="row" class="py-2 pr-3 text-left font-normal">
|
<th scope="row" class="py-2 pr-3 text-left font-normal">
|
||||||
<x-link :href="route('jobs.show', $row->job->id)" navigate>{{ $row->job->number }} {{ $row->job->name }}</x-link>
|
<x-link :href="route('jobs.show', $row->job->id)" navigate>{{ $row->job->number }} {{ $row->job->name }}</x-link>
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">
|
||||||
{{ $row->job->customerName }}@if ($row->job->paymentBasis !== null), {{ __('jobs.payment_bases.'.$row->job->paymentBasis) }}@endif
|
{{ $row->job->customerName }}@if ($row->job->paymentBasis !== null), {{ __('jobs.payment_bases.'.$row->job->paymentBasis) }}@endif
|
||||||
@if ($row->job->quotedAmountCents !== null), {{ __('reports.profitability.quoted', ['amount' => $this->money($row->job->quotedAmountCents)]) }}@endif
|
@if ($row->job->quotedAmountCents !== null), {{ __('reports.profitability.quoted', ['amount' => $this->money($row->job->quotedAmountCents)]) }}@endif
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ new class extends Component
|
|||||||
<tr wire:key="job-{{ $row->job->id }}" class="align-top">
|
<tr wire:key="job-{{ $row->job->id }}" class="align-top">
|
||||||
<th scope="row" class="py-2 pr-3 text-left font-normal">
|
<th scope="row" class="py-2 pr-3 text-left font-normal">
|
||||||
<x-link :href="route('jobs.show', $row->job->id)" navigate>{{ $row->job->number }} {{ $row->job->name }}</x-link>
|
<x-link :href="route('jobs.show', $row->job->id)" navigate>{{ $row->job->number }} {{ $row->job->name }}</x-link>
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ $row->job->customerName }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ $row->job->customerName }}</span>
|
||||||
<details class="mt-1">
|
<details class="mt-1">
|
||||||
<summary class="cursor-pointer text-xs font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600">
|
<summary class="cursor-pointer text-xs font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600">
|
||||||
{{ __('reports.unbilled.by_work_type', ['job' => $row->job->number]) }}
|
{{ __('reports.unbilled.by_work_type', ['job' => $row->job->number]) }}
|
||||||
@@ -158,7 +158,7 @@ new class extends Component
|
|||||||
<td class="py-2 pr-3">
|
<td class="py-2 pr-3">
|
||||||
<x-jobs.status :status="$row->job->status" />
|
<x-jobs.status :status="$row->job->status" />
|
||||||
@if ($row->job->paymentBasis !== null)
|
@if ($row->job->paymentBasis !== null)
|
||||||
<span class="block text-xs text-zinc-600 dark:text-zinc-300">{{ __('jobs.payment_bases.'.$row->job->paymentBasis) }}</span>
|
<span class="block text-xs text-zinc-600 dark:text-zinc-200">{{ __('jobs.payment_bases.'.$row->job->paymentBasis) }}</span>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="py-2 pr-3 whitespace-nowrap">{{ $this->dateLabel($row->oldestDay) }}</td>
|
<td class="py-2 pr-3 whitespace-nowrap">{{ $this->dateLabel($row->oldestDay) }}</td>
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ new class extends Component
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($cashDay->reopenedAt !== null)
|
@if ($cashDay->reopenedAt !== null)
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('sales.cash_day.reopened', ['at' => $this->dateLabel($cashDay->reopenedAt), 'name' => $cashDay->reopenedByName]) }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('sales.cash_day.reopened', ['at' => $this->dateLabel($cashDay->reopenedAt), 'name' => $cashDay->reopenedByName]) }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="grid gap-4 md:grid-cols-2">
|
<div class="grid gap-4 md:grid-cols-2">
|
||||||
@@ -418,7 +418,7 @@ new class extends Component
|
|||||||
</x-select.native>
|
</x-select.native>
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('sales.index.own_only') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('sales.index.own_only') }}</p>
|
||||||
@endcan
|
@endcan
|
||||||
|
|
||||||
@if ($this->sales === [])
|
@if ($this->sales === [])
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ new class extends Component
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{{ __('sales.orders.complete_hint') }}</p>
|
<p class="text-xs text-zinc-600 dark:text-zinc-200">{{ __('sales.orders.complete_hint') }}</p>
|
||||||
<div class="flex flex-wrap gap-2">
|
<div class="flex flex-wrap gap-2">
|
||||||
<x-button submit sm icon="check" :text="__('sales.orders.complete')" />
|
<x-button submit sm icon="check" :text="__('sales.orders.complete')" />
|
||||||
<x-button wire:click="$set('completingLineId', null)" subtle color="black" sm :text="__('layout.cancel')" />
|
<x-button wire:click="$set('completingLineId', null)" subtle color="black" sm :text="__('layout.cancel')" />
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="shopping-cart">{{ __('sales.sell.title') }}</x-page-title>
|
<x-page-title icon="shopping-cart">{{ __('sales.sell.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('sales.sell.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('sales.sell.intro') }}</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
<x-link :href="route('sales.index')" navigate>{{ __('sales.sell.to_list') }}</x-link>
|
<x-link :href="route('sales.index')" navigate>{{ __('sales.sell.to_list') }}</x-link>
|
||||||
</p>
|
</p>
|
||||||
@@ -526,7 +526,7 @@ new class extends Component
|
|||||||
@else
|
@else
|
||||||
<section aria-labelledby="products-heading" class="card space-y-3">
|
<section aria-labelledby="products-heading" class="card space-y-3">
|
||||||
<h2 id="products-heading" class="text-lg font-semibold">{{ __('sales.sell.products') }}</h2>
|
<h2 id="products-heading" class="text-lg font-semibold">{{ __('sales.sell.products') }}</h2>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('sales.sell.products_help') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('sales.sell.products_help') }}</p>
|
||||||
|
|
||||||
<ul class="grid grid-cols-2 gap-2">
|
<ul class="grid grid-cols-2 gap-2">
|
||||||
@foreach ($this->products as $product)
|
@foreach ($this->products as $product)
|
||||||
@@ -569,11 +569,11 @@ new class extends Component
|
|||||||
<li wire:key="line-{{ $product->id }}" class="flex flex-wrap items-center gap-x-3 gap-y-2 py-2">
|
<li wire:key="line-{{ $product->id }}" class="flex flex-wrap items-center gap-x-3 gap-y-2 py-2">
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
<p class="font-medium break-words">{{ $product->name }}</p>
|
<p class="font-medium break-words">{{ $product->name }}</p>
|
||||||
<p class="text-sm text-zinc-700 dark:text-zinc-300">
|
<p class="text-sm text-zinc-700 dark:text-zinc-200">
|
||||||
{{ __('sales.sell.line', ['quantity' => $line['quantity'], 'price' => $this->money($product->grossCents), 'total' => $this->money($line['quantity'] * $product->grossCents)]) }}
|
{{ __('sales.sell.line', ['quantity' => $line['quantity'], 'price' => $this->money($product->grossCents), 'total' => $this->money($line['quantity'] * $product->grossCents)]) }}
|
||||||
</p>
|
</p>
|
||||||
@if ($product->durationQuarters > 0 && $product->workTypeId !== null)
|
@if ($product->durationQuarters > 0 && $product->workTypeId !== null)
|
||||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{{ __('sales.sell.line_hours', ['hours' => $this->hours($product->durationQuarters * $line['quantity'])]) }}</p>
|
<p class="text-xs text-zinc-600 dark:text-zinc-200">{{ __('sales.sell.line_hours', ['hours' => $this->hours($product->durationQuarters * $line['quantity'])]) }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
@@ -659,7 +659,7 @@ new class extends Component
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
@if (mb_strlen(trim($customerSearch)) >= 2)
|
@if (mb_strlen(trim($customerSearch)) >= 2)
|
||||||
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ trans_choice('sales.sell.customer_results', count($this->customerResults), ['count' => count($this->customerResults)]) }}
|
{{ trans_choice('sales.sell.customer_results', count($this->customerResults), ['count' => count($this->customerResults)]) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Shared\Domain\Exceptions;
|
||||||
|
|
||||||
|
final class InvalidHexColor extends DomainException
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct('The colour must be a hex colour like #1d4ed8.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Modules\Shared\Domain\ValueObjects;
|
||||||
|
|
||||||
|
use App\Modules\Shared\Domain\Exceptions\InvalidHexColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An sRGB colour as #rrggbb (lower case), e.g. a customer's card header
|
||||||
|
* colour or a Kanban column colour.
|
||||||
|
*
|
||||||
|
* Text on a coloured surface is dark or white, whichever has the higher
|
||||||
|
* WCAG contrast. The Kanban design (docs/ui-kanban-board.md 1.2) names a
|
||||||
|
* luminance limit of 0.36, but that leaves white text below 4.5:1 on mid
|
||||||
|
* tones; the crossover of the two contrasts (about 0.18) keeps every colour
|
||||||
|
* at 4.5:1 or more.
|
||||||
|
*/
|
||||||
|
final readonly class HexColor
|
||||||
|
{
|
||||||
|
public const string DARK_TEXT = '#000000';
|
||||||
|
|
||||||
|
public const string LIGHT_TEXT = '#ffffff';
|
||||||
|
|
||||||
|
public string $value;
|
||||||
|
|
||||||
|
public function __construct(string $value)
|
||||||
|
{
|
||||||
|
$value = strtolower(trim($value));
|
||||||
|
|
||||||
|
if (preg_match('/^#[0-9a-f]{3}$/', $value) === 1) {
|
||||||
|
$value = '#'.$value[1].$value[1].$value[2].$value[2].$value[3].$value[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^#[0-9a-f]{6}$/', $value) !== 1) {
|
||||||
|
throw new InvalidHexColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->value = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromRgb(int $red, int $green, int $blue): self
|
||||||
|
{
|
||||||
|
$channel = static fn (int $value): string => str_pad(dechex(max(0, min(255, $value))), 2, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
return new self('#'.$channel($red).$channel($green).$channel($blue));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{0: int, 1: int, 2: int}
|
||||||
|
*/
|
||||||
|
public function rgb(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
(int) hexdec(substr($this->value, 1, 2)),
|
||||||
|
(int) hexdec(substr($this->value, 3, 2)),
|
||||||
|
(int) hexdec(substr($this->value, 5, 2)),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WCAG relative luminance, 0 (black) to 1 (white).
|
||||||
|
*/
|
||||||
|
public function luminance(): float
|
||||||
|
{
|
||||||
|
[$red, $green, $blue] = array_map(static function (int $value): float {
|
||||||
|
$channel = $value / 255;
|
||||||
|
|
||||||
|
return $channel <= 0.03928 ? $channel / 12.92 : (($channel + 0.055) / 1.055) ** 2.4;
|
||||||
|
}, $this->rgb());
|
||||||
|
|
||||||
|
return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isLight(): bool
|
||||||
|
{
|
||||||
|
$dark = new self(self::DARK_TEXT);
|
||||||
|
$light = new self(self::LIGHT_TEXT);
|
||||||
|
|
||||||
|
return $this->contrastWith($dark) > $this->contrastWith($light);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text colour for a surface of this colour.
|
||||||
|
*/
|
||||||
|
public function textColor(): string
|
||||||
|
{
|
||||||
|
return $this->isLight() ? self::DARK_TEXT : self::LIGHT_TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WCAG contrast ratio against another colour, 1 to 21.
|
||||||
|
*/
|
||||||
|
public function contrastWith(self $other): float
|
||||||
|
{
|
||||||
|
$lighter = max($this->luminance(), $other->luminance());
|
||||||
|
$darker = min($this->luminance(), $other->luminance());
|
||||||
|
|
||||||
|
return ($lighter + 0.05) / ($darker + 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This colour mixed into $base: $share of this colour, the rest of $base.
|
||||||
|
*/
|
||||||
|
public function mixedInto(self $base, float $share): self
|
||||||
|
{
|
||||||
|
$share = max(0.0, min(1.0, $share));
|
||||||
|
[$red, $green, $blue] = $this->rgb();
|
||||||
|
[$baseRed, $baseGreen, $baseBlue] = $base->rgb();
|
||||||
|
|
||||||
|
return self::fromRgb(
|
||||||
|
(int) round($baseRed * (1 - $share) + $red * $share),
|
||||||
|
(int) round($baseGreen * (1 - $share) + $green * $share),
|
||||||
|
(int) round($baseBlue * (1 - $share) + $blue * $share),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function equals(self $other): bool
|
||||||
|
{
|
||||||
|
return $this->value === $other->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,7 +119,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="building-office">{{ __('company.title') }}</x-page-title>
|
<x-page-title icon="building-office">{{ __('company.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('company.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('company.intro') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p role="status" aria-live="polite" class="text-sm font-medium">{{ $statusMessage }}</p>
|
<p role="status" aria-live="polite" class="text-sm font-medium">{{ $statusMessage }}</p>
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-4xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-4xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<x-page-title icon="sun">{{ __('holidays.title') }}</x-page-title>
|
<x-page-title icon="sun">{{ __('holidays.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('holidays.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('holidays.intro') }}</p>
|
||||||
<p class="text-sm"><x-link :href="route('settings.company')" navigate>{{ __('company.title') }}</x-link></p>
|
<p class="text-sm"><x-link :href="route('settings.company')" navigate>{{ __('company.title') }}</x-link></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,22 @@ interface TimeEntryQueries
|
|||||||
|
|
||||||
public function hasEntries(int $taskId): bool;
|
public function hasEntries(int $taskId): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recorded quarter-hours of all users by job id.
|
||||||
|
*
|
||||||
|
* @param list<int> $jobIds
|
||||||
|
* @return array<int, int>
|
||||||
|
*/
|
||||||
|
public function quartersByJobs(array $jobIds): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recorded quarter-hours of all users by task id.
|
||||||
|
*
|
||||||
|
* @param list<int> $taskIds
|
||||||
|
* @return array<int, int>
|
||||||
|
*/
|
||||||
|
public function quartersByTasks(array $taskIds): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unapproved hours by user and week (Monday to Sunday), oldest week first.
|
* Unapproved hours by user and week (Monday to Sunday), oldest week first.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\TimeTracking\Infrastructure;
|
||||||
|
|
||||||
|
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
|
||||||
|
use App\Modules\TimeTracking\Application\Contracts\TimeEntryQueries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells the Jobs module's Kanban cards how many hours are recorded.
|
||||||
|
*/
|
||||||
|
class LoggedHoursFromTimeEntries implements LoggedJobHours
|
||||||
|
{
|
||||||
|
public function __construct(private TimeEntryQueries $entries) {}
|
||||||
|
|
||||||
|
public function quartersByJobs(array $jobIds): array
|
||||||
|
{
|
||||||
|
return $this->entries->quartersByJobs($jobIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function quartersByTasks(array $taskIds): array
|
||||||
|
{
|
||||||
|
return $this->entries->quartersByTasks($taskIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -114,6 +114,35 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
|||||||
return TimeEntryModel::query()->where('task_id', $taskId)->exists();
|
return TimeEntryModel::query()->where('task_id', $taskId)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function quartersByJobs(array $jobIds): array
|
||||||
|
{
|
||||||
|
return $this->quartersBy('customer_job_id', $jobIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function quartersByTasks(array $taskIds): array
|
||||||
|
{
|
||||||
|
return $this->quartersBy('task_id', $taskIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<int> $ids
|
||||||
|
* @return array<int, int>
|
||||||
|
*/
|
||||||
|
private function quartersBy(string $column, array $ids): array
|
||||||
|
{
|
||||||
|
if ($ids === []) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return TimeEntryModel::query()
|
||||||
|
->whereIn($column, $ids)
|
||||||
|
->groupBy($column)
|
||||||
|
->selectRaw("{$column} as id, sum(hours) as total")
|
||||||
|
->pluck('total', 'id')
|
||||||
|
->map(fn ($total): int => (int) round(((float) $total) * 4))
|
||||||
|
->all();
|
||||||
|
}
|
||||||
|
|
||||||
public function pendingWeeks(?int $userId = null): array
|
public function pendingWeeks(?int $userId = null): array
|
||||||
{
|
{
|
||||||
$entries = TimeEntryModel::query()
|
$entries = TimeEntryModel::query()
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ namespace App\Modules\TimeTracking\Infrastructure\Providers;
|
|||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||||
|
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
|
||||||
use App\Modules\Jobs\Application\Contracts\TaskUsage;
|
use App\Modules\Jobs\Application\Contracts\TaskUsage;
|
||||||
use App\Modules\TimeTracking\Application\Contracts\TimeEntryQueries;
|
use App\Modules\TimeTracking\Application\Contracts\TimeEntryQueries;
|
||||||
use App\Modules\TimeTracking\Application\Contracts\TimeReportQueries;
|
use App\Modules\TimeTracking\Application\Contracts\TimeReportQueries;
|
||||||
use App\Modules\TimeTracking\Domain\Contracts\TimeEntryRepository;
|
use App\Modules\TimeTracking\Domain\Contracts\TimeEntryRepository;
|
||||||
|
use App\Modules\TimeTracking\Infrastructure\LoggedHoursFromTimeEntries;
|
||||||
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeEntryQueries;
|
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeEntryQueries;
|
||||||
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeEntryRepository;
|
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeEntryRepository;
|
||||||
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeReportQueries;
|
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeReportQueries;
|
||||||
@@ -30,6 +32,7 @@ class TimeTrackingServiceProvider extends ServiceProvider
|
|||||||
TimeEntryQueries::class => EloquentTimeEntryQueries::class,
|
TimeEntryQueries::class => EloquentTimeEntryQueries::class,
|
||||||
TimeReportQueries::class => EloquentTimeReportQueries::class,
|
TimeReportQueries::class => EloquentTimeReportQueries::class,
|
||||||
TaskUsage::class => TaskUsageFromTimeEntries::class,
|
TaskUsage::class => TaskUsageFromTimeEntries::class,
|
||||||
|
LoggedJobHours::class => LoggedHoursFromTimeEntries::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ new class extends Component
|
|||||||
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="check-badge">{{ __('time.approvals.title') }}</x-page-title>
|
<x-page-title icon="check-badge">{{ __('time.approvals.title') }}</x-page-title>
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.approvals.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.approvals.intro') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="max-w-sm">
|
<div class="max-w-sm">
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ new class extends Component
|
|||||||
<h2 id="entries-heading" tabindex="-1" class="text-xl font-semibold focus:outline-none">{{ __('time.task_page.own_entries') }}</h2>
|
<h2 id="entries-heading" tabindex="-1" class="text-xl font-semibold focus:outline-none">{{ __('time.task_page.own_entries') }}</h2>
|
||||||
|
|
||||||
@if ($this->entries === [])
|
@if ($this->entries === [])
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.task_page.no_entries') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.task_page.no_entries') }}</p>
|
||||||
@else
|
@else
|
||||||
<ul class="divide-y divide-zinc-200 rounded-lg border border-zinc-200 text-sm dark:divide-zinc-700 dark:border-zinc-700">
|
<ul class="divide-y divide-zinc-200 rounded-lg border border-zinc-200 text-sm dark:divide-zinc-700 dark:border-zinc-700">
|
||||||
@foreach ($this->entries as $entry)
|
@foreach ($this->entries as $entry)
|
||||||
@@ -267,7 +267,7 @@ new class extends Component
|
|||||||
<div>
|
<div>
|
||||||
<p class="font-medium">{{ $this->dayLabel($entry->workedOn) }}: {{ __('time.hours_suffix', ['hours' => WorkedHours::formatQuarters($entry->quarters)]) }}</p>
|
<p class="font-medium">{{ $this->dayLabel($entry->workedOn) }}: {{ __('time.hours_suffix', ['hours' => WorkedHours::formatQuarters($entry->quarters)]) }}</p>
|
||||||
@if ($entry->note !== null)
|
@if ($entry->note !== null)
|
||||||
<p class="whitespace-pre-line text-zinc-700 dark:text-zinc-300">{{ $entry->note }}</p>
|
<p class="whitespace-pre-line text-zinc-700 dark:text-zinc-200">{{ $entry->note }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@if ($entry->isApproved)
|
@if ($entry->isApproved)
|
||||||
|
|||||||
@@ -346,10 +346,10 @@ new class extends Component
|
|||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<x-page-title icon="clock">{{ $this->heading() }}</x-page-title>
|
<x-page-title icon="clock">{{ $this->heading() }}</x-page-title>
|
||||||
@if ($this->isReadOnly())
|
@if ($this->isReadOnly())
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.other_intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.other_intro') }}</p>
|
||||||
<x-link :href="route('time.approvals')" navigate class="text-sm">{{ __('time.approval.back_to_list') }}</x-link>
|
<x-link :href="route('time.approvals')" navigate class="text-sm">{{ __('time.approval.back_to_list') }}</x-link>
|
||||||
@else
|
@else
|
||||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.intro') }}</p>
|
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.intro') }}</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -386,9 +386,9 @@ new class extends Component
|
|||||||
<tr wire:key="row-{{ $row->task->taskId }}" class="border-b border-zinc-200 align-top dark:border-zinc-700">
|
<tr wire:key="row-{{ $row->task->taskId }}" class="border-b border-zinc-200 align-top dark:border-zinc-700">
|
||||||
<th scope="row" class="py-2 pr-3 text-left font-normal">
|
<th scope="row" class="py-2 pr-3 text-left font-normal">
|
||||||
<x-link :href="route('time.task', $row->task->taskId)" navigate class="font-medium">{{ $row->task->label() }}</x-link>
|
<x-link :href="route('time.task', $row->task->taskId)" navigate class="font-medium">{{ $row->task->label() }}</x-link>
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">{{ $row->task->workTypeName }}</span>
|
<span class="block text-zinc-600 dark:text-zinc-200">{{ $row->task->workTypeName }}</span>
|
||||||
@if ($row->task->isLocked())
|
@if ($row->task->isLocked())
|
||||||
<span class="mt-1 inline-flex items-center gap-1 text-zinc-700 dark:text-zinc-300">
|
<span class="mt-1 inline-flex items-center gap-1 text-zinc-700 dark:text-zinc-200">
|
||||||
<x-icon name="lock-closed" class="size-4" aria-hidden="true" /> {{ __('time.locked') }}
|
<x-icon name="lock-closed" class="size-4" aria-hidden="true" /> {{ __('time.locked') }}
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
@@ -462,7 +462,7 @@ new class extends Component
|
|||||||
@foreach ($sheet->rows as $row)
|
@foreach ($sheet->rows as $row)
|
||||||
<li wire:key="mrow-{{ $row->task->taskId }}" class="rounded-xl border border-zinc-200 bg-white p-3 text-sm shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
<li wire:key="mrow-{{ $row->task->taskId }}" class="rounded-xl border border-zinc-200 bg-white p-3 text-sm shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||||
<x-link :href="route('time.task', $row->task->taskId)" navigate class="font-medium break-words">{{ $row->task->label() }}</x-link>
|
<x-link :href="route('time.task', $row->task->taskId)" navigate class="font-medium break-words">{{ $row->task->label() }}</x-link>
|
||||||
<span class="block text-zinc-600 dark:text-zinc-300">{{ $row->task->workTypeName }}</span>
|
<span class="block text-zinc-600 dark:text-zinc-200">{{ $row->task->workTypeName }}</span>
|
||||||
|
|
||||||
@if ($row->isApprovedOn($selectedDay))
|
@if ($row->isApprovedOn($selectedDay))
|
||||||
<p class="mt-2 inline-flex items-center gap-1">
|
<p class="mt-2 inline-flex items-center gap-1">
|
||||||
@@ -561,7 +561,7 @@ new class extends Component
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
@if (mb_strlen(trim($taskSearch)) >= 2)
|
@if (mb_strlen(trim($taskSearch)) >= 2)
|
||||||
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-300">
|
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-200">
|
||||||
{{ trans_choice('time.add.results', count($this->searchResults), ['count' => count($this->searchResults)]) }}
|
{{ trans_choice('time.add.results', count($this->searchResults), ['count' => count($this->searchResults)]) }}
|
||||||
</p>
|
</p>
|
||||||
<ul class="space-y-1">
|
<ul class="space-y-1">
|
||||||
@@ -574,7 +574,7 @@ new class extends Component
|
|||||||
class="w-full rounded-md px-3 py-2 text-left text-sm hover:bg-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300 dark:hover:bg-zinc-700"
|
class="w-full rounded-md px-3 py-2 text-left text-sm hover:bg-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300 dark:hover:bg-zinc-700"
|
||||||
>
|
>
|
||||||
<span class="font-medium">{{ $task->label() }}</span>
|
<span class="font-medium">{{ $task->label() }}</span>
|
||||||
<span class="text-zinc-600 dark:text-zinc-300">{{ $task->workTypeName }}</span>
|
<span class="text-zinc-600 dark:text-zinc-200">{{ $task->workTypeName }}</span>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user