The open cards are kept in the user's board preferences (expanded_cards, at most 500), saved without redrawing the board and restored on return. Co-Authored-By: Claude Opus 5.5 <[email protected]>
102 lines
6.0 KiB
PHP
102 lines
6.0 KiB
PHP
{{--
|
|
A customer job card (docs/ui-kanban-board.md 4.1): customer bar, title
|
|
that opens the job editor, responsible person, service unit, priority,
|
|
due date, hours and the job's tasks, which open inside the card and can
|
|
be marked done. Compact cards have three rows.
|
|
--}}
|
|
@props(['card', 'expanded' => false, 'compact' => false, 'canMove' => false, 'canColor' => false, 'canCheck' => false])
|
|
|
|
@use('App\Modules\Jobs\Presentation\Support\BoardFormat')
|
|
|
|
@php
|
|
$total = count($card->tasks);
|
|
$done = $card->doneTaskCount();
|
|
@endphp
|
|
|
|
<article
|
|
aria-labelledby="card-{{ $card->key() }}-title"
|
|
x-data="{ expanded: {{ $expanded ? 'true' : 'false' }} }"
|
|
class="overflow-hidden rounded-xl border border-neutral-300 bg-white shadow-sm transition dark:border-[#36393f] dark:bg-[#282a2e]"
|
|
>
|
|
<x-jobs.board.card-header :card="$card" :can-move="$canMove" :can-color="$canColor" />
|
|
|
|
<div @class(['space-y-1.5 p-1.5' => $compact, 'space-y-2 p-2.5' => ! $compact])>
|
|
<h3 class="m-0" id="card-{{ $card->key() }}-title">
|
|
<button
|
|
type="button"
|
|
id="card-{{ $card->key() }}-open"
|
|
wire:click="openJob({{ $card->jobId }})"
|
|
title="{{ $card->title }}"
|
|
class="block w-full truncate rounded text-left text-[13px] font-bold text-neutral-900 hover:underline focus-visible:outline-2 focus-visible:outline-primary-600 dark:text-white dark:focus-visible:outline-primary-300"
|
|
><span class="sr-only">{{ $card->number }} </span>{{ $card->title }}</button>
|
|
</h3>
|
|
|
|
@if ($compact)
|
|
<div class="flex items-center justify-between gap-1 text-[10px]">
|
|
<div class="flex min-w-0 items-center gap-1">
|
|
<x-jobs.board.person :initials="$card->responsibleInitials()" :name="$card->responsibleFirstName()" />
|
|
<x-jobs.board.priority-badge :priority="$card->priority" />
|
|
</div>
|
|
@if ($total > 0)
|
|
<button
|
|
type="button"
|
|
x-on:click="expanded = ! expanded; $wire.setCardExpanded('{{ $card->key() }}', expanded)"
|
|
aria-expanded="{{ $expanded ? 'true' : 'false' }}"
|
|
x-bind:aria-expanded="expanded.toString()"
|
|
aria-controls="tasks-{{ $card->key() }}"
|
|
aria-label="{{ __('jobs.board.tasks_compact', ['done' => $done, 'total' => $total]) }}"
|
|
class="inline-flex min-h-6 shrink-0 items-center gap-0.5 rounded bg-neutral-100 px-1.5 text-[10px] font-bold text-neutral-800 transition hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-primary-600 dark:bg-[#1e2023] dark:text-neutral-100 dark:hover:bg-[#32353b] dark:focus-visible:outline-primary-300"
|
|
>
|
|
{{ $done }}/{{ $total }}
|
|
<x-icon name="chevron-down" class="size-3 transition" x-bind:class="expanded && 'rotate-180'" aria-hidden="true" />
|
|
</button>
|
|
@endif
|
|
</div>
|
|
@else
|
|
<div class="flex items-center justify-between gap-1 text-[10px]">
|
|
<x-jobs.board.person :initials="$card->responsibleInitials()" :name="$card->responsibleFirstName()" />
|
|
<div class="flex min-w-0 items-center gap-1">
|
|
@if ($card->serviceUnitName !== null)
|
|
<span class="truncate rounded bg-neutral-100 px-1.5 py-0.5 font-medium text-neutral-700 dark:bg-[#1e2023] dark:text-neutral-200" title="{{ $card->serviceUnitName }}">{{ $card->serviceUnitName }}</span>
|
|
@endif
|
|
<x-jobs.board.priority-badge :priority="$card->priority" />
|
|
</div>
|
|
</div>
|
|
|
|
<p class="flex flex-wrap items-center gap-1.5 text-[10px] text-neutral-700 dark:text-neutral-200">
|
|
@if ($card->isLate)
|
|
<span class="inline-flex items-center gap-0.5 font-bold text-red-700 dark:text-red-200">
|
|
<x-icon name="exclamation-triangle" class="size-3" aria-hidden="true" />{{ __('jobs.board.late', ['date' => BoardFormat::shortDate($card->dueOn)]) }}
|
|
</span>
|
|
@else
|
|
<span class="font-medium">{{ __('jobs.board.due', ['date' => BoardFormat::shortDate($card->dueOn)]) }}</span>
|
|
@endif
|
|
<span aria-hidden="true">•</span>
|
|
<span>{{ BoardFormat::cardHours($card) }}</span>
|
|
</p>
|
|
|
|
@if ($total > 0)
|
|
<div class="border-t border-neutral-200 pt-1 dark:border-[#36393f]">
|
|
<button
|
|
type="button"
|
|
x-on:click="expanded = ! expanded; $wire.setCardExpanded('{{ $card->key() }}', expanded)"
|
|
aria-expanded="{{ $expanded ? 'true' : 'false' }}"
|
|
x-bind:aria-expanded="expanded.toString()"
|
|
aria-controls="tasks-{{ $card->key() }}"
|
|
class="flex min-h-6 w-full items-center justify-between rounded px-1.5 text-[11px] font-semibold text-neutral-800 transition hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-primary-600 dark:text-neutral-100 dark:hover:bg-[#32353b] dark:focus-visible:outline-primary-300"
|
|
>
|
|
<span>{{ __('jobs.board.tasks_toggle', ['done' => $done, 'total' => $total]) }}</span>
|
|
<x-icon name="chevron-down" class="size-3.5 transition" x-bind:class="expanded && 'rotate-180'" aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
|
|
@if ($total > 0)
|
|
<div id="tasks-{{ $card->key() }}" x-show="expanded" @unless ($expanded) x-cloak @endunless @class(['border-t border-neutral-200 pt-1 dark:border-[#36393f]' => $compact, 'mt-1.5' => ! $compact])>
|
|
<x-jobs.board.task-list :card="$card" :can-check="$canCheck" :compact="$compact" />
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</article>
|