Replace the demo home page with a dashboard
Everyone sees their open tasks on an agenda, their open jobs, this week's hours and quick links. Admin and management also get a lazily loaded management panel: things to do, the month so far against the previous month, jobs and late work, and everyone's workload. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Dashboard\Presentation\Livewire\Concerns;
|
||||
|
||||
use App\Modules\Shared\Domain\ValueObjects\Money;
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Finnish number, money and date formats of the home page, in both UI
|
||||
* languages. Amounts may be negative (a loss), which Money does not hold.
|
||||
*/
|
||||
trait FormatsDashboard
|
||||
{
|
||||
public function money(int $cents): string
|
||||
{
|
||||
return ($cents < 0 ? '-' : '').Money::fromCents(abs($cents))->format();
|
||||
}
|
||||
|
||||
/**
|
||||
* E.g. 6 quarters → "1,5".
|
||||
*/
|
||||
public function hours(int $quarters): string
|
||||
{
|
||||
return rtrim(rtrim(number_format($quarters / 4, 2, ',', "\u{00A0}"), '0'), ',');
|
||||
}
|
||||
|
||||
/**
|
||||
* E.g. 0.125 → "12,5 %".
|
||||
*/
|
||||
public function percent(float $ratio): string
|
||||
{
|
||||
return number_format($ratio * 100, 1, ',', "\u{00A0}")."\u{00A0}%";
|
||||
}
|
||||
|
||||
public function dateLabel(string $day): string
|
||||
{
|
||||
return (new DateTimeImmutable($day))->format('j.n.Y');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\Dashboard\Application\DTOs\PersonalOverview;
|
||||
use App\Modules\Dashboard\Application\UseCases\PersonalOverviewQuery;
|
||||
use App\Modules\Dashboard\Presentation\Livewire\Concerns\FormatsDashboard;
|
||||
use App\Modules\Users\Application\Contracts\Clock;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Component;
|
||||
|
||||
/**
|
||||
* The home page: the user's open tasks on an agenda, their open jobs,
|
||||
* this week's hours and quick links; admin and management also get the
|
||||
* management panel, loaded lazily.
|
||||
*/
|
||||
new class extends Component
|
||||
{
|
||||
use FormatsDashboard;
|
||||
|
||||
#[Computed]
|
||||
public function overview(): PersonalOverview
|
||||
{
|
||||
return app(PersonalOverviewQuery::class)->execute((int) auth()->id(), app(Clock::class)->today());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{route: string, label: string, icon: string}>
|
||||
*/
|
||||
public function quickLinks(): array
|
||||
{
|
||||
$links = [
|
||||
['route' => 'jobs.quick', 'label' => __('dashboard.links.quick_intake'), 'icon' => 'bolt', 'ability' => 'jobs.manage'],
|
||||
['route' => 'jobs.create', 'label' => __('dashboard.links.new_job'), 'icon' => 'plus', 'ability' => 'jobs.manage'],
|
||||
['route' => 'time.week', 'label' => __('dashboard.links.time'), 'icon' => 'clock', 'ability' => 'time.use'],
|
||||
['route' => 'sales.sell', 'label' => __('dashboard.links.quick_sale'), 'icon' => 'shopping-cart', 'ability' => 'sales.use'],
|
||||
['route' => 'jobs.calendar', 'label' => __('dashboard.links.calendar'), 'icon' => 'calendar-days', 'ability' => 'jobs.view'],
|
||||
];
|
||||
|
||||
return array_values(array_map(
|
||||
fn (array $link): array => ['route' => $link['route'], 'label' => $link['label'], 'icon' => $link['icon']],
|
||||
array_filter($links, fn (array $link): bool => Gate::allows($link['ability'])),
|
||||
));
|
||||
}
|
||||
|
||||
public function dayName(string $day): string
|
||||
{
|
||||
return __('time.days')[(int) (new DateTimeImmutable($day))->format('N') - 1];
|
||||
}
|
||||
|
||||
public function render(): mixed
|
||||
{
|
||||
return $this->view()->title(__('dashboard.title'));
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<div class="mx-auto max-w-7xl space-y-8 p-4 sm:p-6">
|
||||
<h1 class="text-2xl font-semibold">{{ __('dashboard.greeting', ['name' => auth()->user()->name]) }}</h1>
|
||||
|
||||
@php($overview = $this->overview)
|
||||
|
||||
<nav aria-label="{{ __('dashboard.links.title') }}">
|
||||
<ul class="flex flex-wrap gap-2">
|
||||
@foreach ($this->quickLinks() as $link)
|
||||
<li><x-button :href="route($link['route'])" wire:navigate :icon="$link['icon']" :text="$link['label']" /></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="grid gap-6 lg:grid-cols-2">
|
||||
<section aria-labelledby="tasks-heading" class="space-y-4 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h2 id="tasks-heading" class="text-xl font-semibold">{{ __('dashboard.tasks.title') }}</h2>
|
||||
|
||||
@if (! $overview->hasTasks())
|
||||
<p class="text-sm">{{ __('dashboard.tasks.none') }}</p>
|
||||
@endif
|
||||
|
||||
@foreach (['overdue' => $overview->overdue, 'soon' => $overview->soon, 'this_week' => $overview->thisWeek] as $group => $tasks)
|
||||
@if ($tasks !== [])
|
||||
<div class="space-y-2">
|
||||
<h3 class="flex items-center gap-2 font-semibold">
|
||||
@if ($group === 'overdue')
|
||||
<x-icon name="exclamation-triangle" class="size-5 text-red-700 dark:text-red-400" aria-hidden="true" />
|
||||
@endif
|
||||
{{ __('dashboard.tasks.groups.'.$group, ['count' => count($tasks)]) }}
|
||||
</h3>
|
||||
<ul class="divide-y divide-zinc-200 dark:divide-zinc-700">
|
||||
@foreach ($tasks as $task)
|
||||
<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>
|
||||
<span class="block text-zinc-600 dark:text-zinc-300">{{ $task->jobNumber }} {{ $task->jobName }}</span>
|
||||
<span class="flex flex-wrap gap-x-3 text-zinc-700 dark:text-zinc-200">
|
||||
<span>{{ __('jobs.tasks.statuses.'.$task->status) }}</span>
|
||||
@if ($task->dueOn !== null)
|
||||
<span>{{ __('dashboard.tasks.due', ['date' => $this->dateLabel($task->dueOn)]) }}</span>
|
||||
@endif
|
||||
@if ($task->plannedFrom !== null)
|
||||
<span>{{ __('dashboard.tasks.starts', ['date' => $this->dateLabel($task->plannedFrom)]) }}</span>
|
||||
@endif
|
||||
@if ($task->isLate)
|
||||
<span class="inline-flex items-center gap-1 font-medium text-red-700 dark:text-red-400">
|
||||
<x-icon name="exclamation-triangle" class="size-4" aria-hidden="true" />{{ __('jobs.late') }}
|
||||
</span>
|
||||
@endif
|
||||
</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@if ($overview->laterCount > 0)
|
||||
<p class="text-sm">{{ trans_choice('dashboard.tasks.later', $overview->laterCount, ['count' => $overview->laterCount]) }}</p>
|
||||
<p class="text-sm"><x-link :href="route('jobs.calendar')" navigate>{{ __('dashboard.tasks.to_calendar') }}</x-link></p>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<div class="space-y-6">
|
||||
<section aria-labelledby="week-heading" class="space-y-3 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h2 id="week-heading" class="text-xl font-semibold">{{ __('dashboard.week.title') }}</h2>
|
||||
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('dashboard.week.caption', ['from' => $this->dateLabel($overview->week->monday)]) }}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach (array_keys($overview->week->days) as $day)
|
||||
<th scope="col" class="py-1 text-center font-medium">
|
||||
{{ $this->dayName($day) }}
|
||||
<span class="block text-xs font-normal text-zinc-600 dark:text-zinc-300">{{ (new DateTimeImmutable($day))->format('j.n.') }}</span>
|
||||
</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
@foreach ($overview->week->days as $quarters)
|
||||
<td class="py-1 text-center">{{ $this->hours($quarters) }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="text-sm">
|
||||
{{ __('dashboard.week.total', ['hours' => $this->hours($overview->week->totalQuarters)]) }}
|
||||
@if ($overview->week->unapprovedQuarters > 0)
|
||||
<span class="inline-flex items-center gap-1">
|
||||
<x-icon name="exclamation-circle" class="size-4" aria-hidden="true" />
|
||||
{{ __('dashboard.week.unapproved', ['hours' => $this->hours($overview->week->unapprovedQuarters)]) }}
|
||||
</span>
|
||||
@endif
|
||||
</p>
|
||||
<p class="text-sm"><x-link :href="route('time.week')" navigate>{{ __('dashboard.week.open') }}</x-link></p>
|
||||
</section>
|
||||
|
||||
<section aria-labelledby="jobs-heading" class="space-y-3 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h2 id="jobs-heading" class="text-xl font-semibold">{{ __('dashboard.jobs.title') }}</h2>
|
||||
|
||||
@if ($overview->jobs === [])
|
||||
<p class="text-sm">{{ __('dashboard.jobs.none') }}</p>
|
||||
@else
|
||||
<ul class="divide-y divide-zinc-200 dark:divide-zinc-700">
|
||||
@foreach ($overview->jobs as $job)
|
||||
<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>
|
||||
<span class="block text-zinc-600 dark:text-zinc-300">{{ $job->customerName }}</span>
|
||||
<span class="flex flex-wrap items-center gap-x-3 text-zinc-700 dark:text-zinc-200">
|
||||
<span>{{ __('jobs.statuses.'.$job->status) }}</span>
|
||||
<x-jobs.priority :priority="\App\Modules\Jobs\Domain\Enums\Priority::from($job->priority)" />
|
||||
@if ($job->dueOn !== null)
|
||||
<span>{{ __('dashboard.jobs.due', ['date' => $this->dateLabel($job->dueOn)]) }}</span>
|
||||
@endif
|
||||
@if ($job->isLate)
|
||||
<span class="inline-flex items-center gap-1 font-medium text-red-700 dark:text-red-400">
|
||||
<x-icon name="exclamation-triangle" class="size-4" aria-hidden="true" />{{ __('jobs.late') }}
|
||||
</span>
|
||||
@endif
|
||||
</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
<p class="text-sm">
|
||||
<x-link :href="route('jobs.index')" navigate>{{ trans_choice('dashboard.jobs.all', $overview->jobCount, ['count' => $overview->jobCount]) }}</x-link>
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@can('dashboard.management')
|
||||
{{-- Loaded right after the page, not only when scrolled to. --}}
|
||||
<livewire:dashboard::management lazy="on-load" />
|
||||
@endcan
|
||||
</div>
|
||||
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\Dashboard\Application\DTOs\ManagementOverview;
|
||||
use App\Modules\Dashboard\Application\UseCases\ManagementOverviewQuery;
|
||||
use App\Modules\Dashboard\Domain\ValueObjects\Change;
|
||||
use App\Modules\Dashboard\Domain\ValueObjects\Workload;
|
||||
use App\Modules\Dashboard\Presentation\Livewire\Concerns\FormatsDashboard;
|
||||
use App\Modules\Users\Application\Contracts\Clock;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Component;
|
||||
|
||||
/**
|
||||
* The management panel of the home page (admin and management): what
|
||||
* needs doing, this month's key figures against the same days of the
|
||||
* previous month, the jobs and late work, and everyone's workload. Loaded
|
||||
* lazily after the rest of the home page.
|
||||
*/
|
||||
new class extends Component
|
||||
{
|
||||
use FormatsDashboard;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->authorize('dashboard.management');
|
||||
}
|
||||
|
||||
#[Computed]
|
||||
public function overview(): ManagementOverview
|
||||
{
|
||||
return app(ManagementOverviewQuery::class)->execute(app(Clock::class)->today());
|
||||
}
|
||||
|
||||
public function placeholder(): string
|
||||
{
|
||||
return '<section class="rounded-lg border border-zinc-300 p-4 dark:border-zinc-600"><p role="status" class="text-sm">'.e(__('dashboard.management.loading')).'</p></section>';
|
||||
}
|
||||
|
||||
/**
|
||||
* E.g. "+12,5 % edelliseen", or "ei vertailukohtaa" when the earlier value was zero.
|
||||
*/
|
||||
public function change(int $current, int $previous): string
|
||||
{
|
||||
$ratio = (new Change($current, $previous))->ratio();
|
||||
|
||||
if ($ratio === null) {
|
||||
return __('dashboard.management.no_comparison');
|
||||
}
|
||||
|
||||
return __('dashboard.management.change', ['change' => ($ratio > 0 ? '+' : ($ratio < 0 ? '−' : '±')).$this->percent(abs($ratio))]);
|
||||
}
|
||||
|
||||
public function load(Workload $load): string
|
||||
{
|
||||
$ratio = $load->ratio();
|
||||
|
||||
return $ratio === null ? '–' : $this->percent($ratio);
|
||||
}
|
||||
|
||||
public function render(): mixed
|
||||
{
|
||||
return $this->view();
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<section aria-labelledby="management-heading" class="space-y-6">
|
||||
@php($overview = $this->overview)
|
||||
|
||||
<h2 id="management-heading" class="text-xl font-semibold">{{ __('dashboard.management.title') }}</h2>
|
||||
|
||||
<div class="grid gap-6 lg:grid-cols-2">
|
||||
<section aria-labelledby="todo-heading" class="space-y-3 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h3 id="todo-heading" class="text-lg font-semibold">{{ __('dashboard.todo.title') }}</h3>
|
||||
|
||||
<ul class="space-y-2 text-sm">
|
||||
@can('time.approve-others')
|
||||
<li>
|
||||
<x-link :href="route('time.approvals')" navigate>
|
||||
{{ trans_choice('dashboard.todo.approvals', count($overview->pendingApprovals), ['count' => count($overview->pendingApprovals)]) }}
|
||||
</x-link>
|
||||
@if ($overview->pendingApprovals !== [])
|
||||
<ul class="mt-1 ml-4 list-disc">
|
||||
@foreach ($overview->pendingApprovals as $pending)
|
||||
<li>{{ __('dashboard.todo.approval_line', ['name' => $pending->name, 'hours' => $this->hours($pending->quarters), 'weeks' => $pending->weekCount]) }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</li>
|
||||
@endcan
|
||||
@can('billing.manage')
|
||||
<li>
|
||||
<x-link :href="route('billing.index')" navigate>{{ trans_choice('dashboard.todo.done_jobs', $overview->doneJobCount, ['count' => $overview->doneJobCount]) }}</x-link>
|
||||
</li>
|
||||
@if ($overview->draftExportId !== null)
|
||||
<li><x-link :href="route('billing.export', $overview->draftExportId)" navigate>{{ __('dashboard.todo.draft') }}</x-link></li>
|
||||
@endif
|
||||
@endcan
|
||||
@can('sales.close-day')
|
||||
@if ($overview->unclosedCashDays !== [])
|
||||
<li>
|
||||
<x-link :href="route('sales.index', ['paiva' => $overview->unclosedCashDays[0]])" navigate>
|
||||
{{ trans_choice('dashboard.todo.cash_days', count($overview->unclosedCashDays), ['count' => count($overview->unclosedCashDays), 'first' => $this->dateLabel($overview->unclosedCashDays[0])]) }}
|
||||
</x-link>
|
||||
</li>
|
||||
@endif
|
||||
@endcan
|
||||
@can('reports.view')
|
||||
<li>
|
||||
<x-link :href="route('reports.unbilled')" navigate>{{ __('dashboard.todo.unbilled', ['amount' => $this->money($overview->unbilledValueCents)]) }}</x-link>
|
||||
</li>
|
||||
@endcan
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
@can('reports.view')
|
||||
<section aria-labelledby="month-heading" class="space-y-3 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h3 id="month-heading" class="text-lg font-semibold">{{ __('dashboard.month.title') }}</h3>
|
||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">
|
||||
{{ __('dashboard.month.period', [
|
||||
'from' => $this->dateLabel($overview->monthFrom), 'to' => $this->dateLabel($overview->monthTo),
|
||||
'previous_from' => $this->dateLabel($overview->previousFrom), 'previous_to' => $this->dateLabel($overview->previousTo),
|
||||
]) }}
|
||||
</p>
|
||||
|
||||
@php($month = $overview->month)
|
||||
@php($previous = $overview->previousMonth)
|
||||
<dl class="grid gap-3 sm:grid-cols-2">
|
||||
@foreach ([
|
||||
['label' => 'customer_hours', 'value' => $this->hours($month->customerQuarters).' h', 'current' => $month->customerQuarters, 'previous' => $previous->customerQuarters, 'route' => 'reports.hours'],
|
||||
['label' => 'internal_hours', 'value' => $this->hours($month->internalQuarters).' h', 'current' => $month->internalQuarters, 'previous' => $previous->internalQuarters, 'route' => 'reports.hours'],
|
||||
['label' => 'billed', 'value' => $this->money($month->billedCents), 'current' => $month->billedCents, 'previous' => $previous->billedCents, 'route' => 'reports.profitability'],
|
||||
['label' => 'margin', 'value' => $month->marginCents === null ? __('dashboard.month.no_cost') : $this->money($month->marginCents), 'current' => $month->marginCents, 'previous' => $previous->marginCents, 'route' => 'reports.profitability'],
|
||||
['label' => 'sales', 'value' => $this->money($month->salesCents), 'current' => $month->salesCents, 'previous' => $previous->salesCents, 'route' => 'reports.sales'],
|
||||
] as $figure)
|
||||
<div class="rounded border border-zinc-200 p-3 dark:border-zinc-700">
|
||||
<dt class="text-sm">
|
||||
<x-link :href="route($figure['route'])" navigate>{{ __('dashboard.month.'.$figure['label']) }}</x-link>
|
||||
</dt>
|
||||
<dd class="text-lg font-semibold">{{ $figure['value'] }}</dd>
|
||||
@if ($figure['current'] !== null && $figure['previous'] !== null)
|
||||
<dd class="text-sm text-zinc-700 dark:text-zinc-200">{{ $this->change($figure['current'], $figure['previous']) }}</dd>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</dl>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">{{ __('dashboard.month.billing_note') }}</p>
|
||||
</section>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 lg:grid-cols-2">
|
||||
<section aria-labelledby="jobs-overview-heading" class="space-y-3 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h3 id="jobs-overview-heading" class="text-lg font-semibold">{{ __('dashboard.stock.title') }}</h3>
|
||||
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('dashboard.stock.caption') }}</caption>
|
||||
<thead class="sr-only">
|
||||
<tr>
|
||||
<th scope="col">{{ __('dashboard.stock.status') }}</th>
|
||||
<th scope="col">{{ __('dashboard.stock.count') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-700">
|
||||
@foreach ($overview->jobCounts as $status => $count)
|
||||
<tr wire:key="status-{{ $status }}">
|
||||
<th scope="row" class="py-1 text-left font-normal">
|
||||
<x-link :href="route('jobs.index', ['status' => $status, 'mine' => 0])" navigate>{{ __('jobs.statuses.'.$status) }}</x-link>
|
||||
</th>
|
||||
<td class="py-1 text-right">{{ $count }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="flex items-center gap-2 text-sm">
|
||||
@if ($overview->overdueJobCount > 0)
|
||||
<x-icon name="exclamation-triangle" class="size-5 text-red-700 dark:text-red-400" aria-hidden="true" />
|
||||
@endif
|
||||
{{ trans_choice('dashboard.stock.overdue_jobs', $overview->overdueJobCount, ['count' => $overview->overdueJobCount]) }}
|
||||
</p>
|
||||
<p class="flex items-center gap-2 text-sm">
|
||||
@if ($overview->overdueTaskCount > 0)
|
||||
<x-icon name="exclamation-triangle" class="size-5 text-red-700 dark:text-red-400" aria-hidden="true" />
|
||||
@endif
|
||||
{{ trans_choice('dashboard.stock.overdue_tasks', $overview->overdueTaskCount, ['count' => $overview->overdueTaskCount]) }}
|
||||
</p>
|
||||
|
||||
@if ($overview->oldestOverdueTasks !== [])
|
||||
<h4 class="font-semibold">{{ __('dashboard.stock.oldest_overdue') }}</h4>
|
||||
<ul class="divide-y divide-zinc-200 text-sm dark:divide-zinc-700">
|
||||
@foreach ($overview->oldestOverdueTasks as $task)
|
||||
<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>
|
||||
<span class="block text-zinc-600 dark:text-zinc-300">
|
||||
{{ $task->jobNumber }} {{ $task->jobName }} · {{ $task->assigneeName ?? __('dashboard.stock.no_assignee') }}
|
||||
· {{ __('dashboard.tasks.due', ['date' => $this->dateLabel((string) $task->dueOn)]) }}
|
||||
</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<section aria-labelledby="load-heading" class="space-y-3 rounded-lg border border-zinc-300 bg-white p-4 dark:border-zinc-600 dark:bg-zinc-900">
|
||||
<h3 id="load-heading" class="text-lg font-semibold">{{ __('dashboard.load.title') }}</h3>
|
||||
|
||||
@if ($overview->workloads === [])
|
||||
<p class="text-sm">{{ __('dashboard.load.none') }}</p>
|
||||
@else
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('dashboard.load.caption') }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('dashboard.load.caption') }}</caption>
|
||||
<thead>
|
||||
<tr class="border-b border-zinc-300 text-left align-bottom dark:border-zinc-600">
|
||||
<th scope="col" class="py-2 pr-3">{{ __('dashboard.load.person') }}</th>
|
||||
<th scope="col" class="py-2 pr-3 text-right">{{ __('dashboard.load.week', ['from' => $this->dateLabel($overview->thisMonday)]) }}</th>
|
||||
<th scope="col" class="py-2 text-right">{{ __('dashboard.load.week', ['from' => $this->dateLabel($overview->nextMonday)]) }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-700">
|
||||
@foreach ($overview->workloads as $person)
|
||||
<tr wire:key="load-{{ $person->userId }}">
|
||||
<th scope="row" class="py-2 pr-3 text-left font-normal">{{ $person->name }}</th>
|
||||
@foreach ([$person->thisWeek, $person->nextWeek] as $index => $load)
|
||||
<td class="py-2 text-right {{ $index === 0 ? 'pr-3' : '' }}">
|
||||
{{ __('dashboard.load.value', ['booked' => $this->hours(intdiv($load->bookedMinutes, 15)), 'capacity' => $this->hours(intdiv($load->capacityMinutes, 15)), 'ratio' => $this->load($load)]) }}
|
||||
@if ($load->isOverloaded())
|
||||
<span class="flex items-center justify-end gap-1 font-medium text-red-700 dark:text-red-400">
|
||||
<x-icon name="exclamation-triangle" class="size-4" aria-hidden="true" />{{ __('dashboard.load.overloaded') }}
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="text-sm">{{ __('dashboard.load.note') }}</p>
|
||||
<p class="text-sm"><x-link :href="route('jobs.calendar')" navigate>{{ __('dashboard.load.to_calendar') }}</x-link></p>
|
||||
@endif
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user