Rebuild the Kanban board after the prototype, with the job editor and quick intake dialog
- Toolbar: whose board (own, a person, a service line, all), pipeline views (daily, sales, full), urgent and late filters with a live count, normal and compact density, and the quick intake button. - Columns side by side with horizontal scrolling on desktop, stacked on phones; each user's own column colours and order, the urgent column's threshold menu, and the continuing jobs column. - Cards in customer colours: job cards with their tasks checked off inside the card (the status select is gone), continuing job cards with the next period, PIN and quick add, and pinned task cards. Dragging moves and orders cards; the keyboard opens the job editor from the card title. - Job editor dialog: every job detail, tasks with checklists and templates, quick hours (TimeTracking) and expenses (Expenses), history. - The quick intake form also adds a contact person, initial status and priority, and opens as a dialog on the board. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Jobs\Presentation\Livewire\Concerns;
|
||||
|
||||
use App\Modules\Catalog\Application\Contracts\CatalogQueries;
|
||||
use App\Modules\Customers\Application\Contracts\CustomerQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||
use App\Modules\Jobs\Application\DTOs\CustomerJobDetails;
|
||||
use App\Modules\Jobs\Application\DTOs\JobChangeEntry;
|
||||
use App\Modules\Shared\Domain\ValueObjects\Money;
|
||||
use App\Modules\Users\Application\Contracts\UserAccountQueries;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Livewire\Attributes\Computed;
|
||||
|
||||
/**
|
||||
* A job's change history as text, shared by the job page and the board's
|
||||
* job editor. Quote and monthly fee changes are shown only to those who may
|
||||
* see quotes (spec 5.7). The page has `$jobId` and a computed `job`.
|
||||
*
|
||||
* @property-read CustomerJobDetails $job
|
||||
* @property-read list<JobChangeEntry> $changes
|
||||
*/
|
||||
trait DescribesJobHistory
|
||||
{
|
||||
/**
|
||||
* @return list<JobChangeEntry>
|
||||
*/
|
||||
#[Computed]
|
||||
public function changes(): array
|
||||
{
|
||||
$changes = app(CustomerJobQueries::class)->changes($this->jobId);
|
||||
|
||||
return Gate::allows('money.quotes')
|
||||
? $changes
|
||||
: array_values(array_filter($changes, fn (JobChangeEntry $change): bool => ! in_array($change->field, ['quoted_amount', 'monthly_fee'], true)));
|
||||
}
|
||||
|
||||
public function formatDate(?string $date): string
|
||||
{
|
||||
return $date === null ? __('jobs.not_set') : CarbonImmutable::parse($date)->format('j.n.Y');
|
||||
}
|
||||
|
||||
/**
|
||||
* A history value as text: names for ids, labels for enum keys,
|
||||
* Finnish dates and amounts.
|
||||
*/
|
||||
public function historyValue(string $field, ?string $value): string
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return __('jobs.not_set');
|
||||
}
|
||||
|
||||
$ids = array_map('intval', explode(',', $value));
|
||||
$named = fn (array $names): string => implode(', ', array_map(
|
||||
fn (int $id): string => $names[$id] ?? __('jobs.history.unknown', ['id' => $id]),
|
||||
$ids,
|
||||
));
|
||||
|
||||
return match ($field) {
|
||||
'starts_on', 'due_on', 'planned_from', 'planned_to' => $this->formatDate($value),
|
||||
'quoted_amount', 'monthly_fee' => Money::fromCents((int) $value)->format(),
|
||||
'kind' => __('jobs.kinds.'.$value),
|
||||
'status' => __('jobs.statuses.'.$value),
|
||||
'priority' => __('jobs.priorities.'.$value),
|
||||
'payment_basis' => __('jobs.payment_bases.'.$value),
|
||||
'customer' => $named(app(CustomerQueries::class)->namesByIds($ids)),
|
||||
'service_units' => $named(app(CatalogQueries::class)->serviceUnitNames($ids)),
|
||||
'responsible_user', 'contact_user', 'biller_user', 'members' => $named(app(UserAccountQueries::class)->namesByIds($ids)),
|
||||
'customer_contact' => app(CustomerQueries::class)->findContact($this->job->customer->id, $ids[0])->name ?? __('jobs.history.unknown', ['id' => $ids[0]]),
|
||||
'billing_unit' => app(CustomerQueries::class)->findBillingUnit($this->job->customer->id, $ids[0])->name ?? __('jobs.history.unknown', ['id' => $ids[0]]),
|
||||
default => $value,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user