Skip to content
Brok UI

Loading…

No results

Resource Pages

Open source

Authenticated resource workflows — searchable and selectable index, create, edit, and detail pages with activity history, plus the operator set: an alert-led index, a waiting-for work queue, a stepped record and one create/edit form with save blockers.

6 of 8

Preview

resources/views/pages/admin-worklist.blade.php Blade
{{--
    Admin Worklist — a queue, which is NOT the same thing as an index.

    Generalised from the Noord-C admin's `fulfilment/index.blade.php` and
    `returns/index.blade.php`: organised by what each item is WAITING FOR
    rather than by a lifecycle status, because the operator's question is
    "what is stuck, and on what" — not "what state is this record in".

    Three rules carried over from the source pages, all visible in this file:
      - No create action anywhere on the page. Work arrives in a queue on its
        own (a paid order, a customer return); it is not authored here.
      - The KPI row, the saved views, and the table's own "Waiting for" column
        all group by the SAME waiting-for vocabulary, not by status.
      - Freshness names the upstream system the queue depends on (a carrier or
        marketplace sync), because parcel/return states the queue shows are
        exactly as current as that last sync.

    Left out on purpose (domain logic the consumer supplies): which carrier or
    warehouse integration produced a waiting-for reason, and any eligibility
    rule for which action a given row may take — `rows[].actions` arrives
    already filtered to what the viewer may do.
--}}
@props([
    'title' => 'Fulfilment queue',
    'description' => 'Shipments waiting on stock, a label, or a hold before they can go out.',
    'freshness' => null,
    'alerts' => null,
    'kpis' => null,
    'views' => null,
    'searchValue' => '',
    'searchAction' => null,
    'waitingFilterValue' => '',
    'waitingFilterOptions' => null,
    'activeFilters' => null,
    'clearFiltersHref' => null,
    'rows' => null,
    'bulkActions' => null,
    'bulkActionUrl' => null,
    'bulkState' => 'idle',
    'bulkFailures' => null,
    'perPage' => 25,
    'perPageOptions' => null,
    'perPageAction' => null,
    'pagination' => null,
])

@php
    $freshness ??= [
        'source' => 'PostNL tracking',
        'syncedAt' => now()->subMinutes(18)->toIso8601String(),
        'stale' => true,
    ];

    $alerts ??= [
        [
            'tone' => 'warning',
            'title' => 'Label sync running behind',
            'description' => '15 shipments could not request a label from PostNL in the last hour. They will retry automatically, or you can retry them now.',
        ],
    ];

    $kpis ??= [
        ['label' => 'Awaiting stock', 'value' => '8', 'tone' => 'attention', 'href' => '?waiting=stock'],
        ['label' => 'Awaiting label', 'value' => '15', 'tone' => 'attention', 'href' => '?waiting=label'],
        ['label' => 'Ready to pack', 'value' => '27', 'tone' => 'positive', 'href' => '?waiting=pack'],
        ['label' => 'On hold', 'value' => '4', 'tone' => 'negative', 'href' => '?waiting=hold'],
    ];

    $views ??= [
        ['key' => 'all', 'label' => 'All shipments', 'href' => '?view=all', 'count' => 54, 'active' => true, 'system' => true],
        ['key' => 'stock', 'label' => 'Awaiting stock', 'href' => '?view=stock', 'count' => 8, 'tone' => 'attention', 'system' => true],
        ['key' => 'label', 'label' => 'Awaiting label', 'href' => '?view=label', 'count' => 15, 'tone' => 'attention', 'system' => true],
        ['key' => 'pack', 'label' => 'Ready to pack', 'href' => '?view=pack', 'count' => 27, 'system' => true],
        ['key' => 'hold', 'label' => 'On hold', 'href' => '?view=hold', 'count' => 4, 'tone' => 'attention', 'system' => true],
    ];

    $waitingVocabulary = [
        'stock' => ['label' => 'Awaiting stock', 'tone' => 'soft-warning'],
        'label' => ['label' => 'Awaiting label', 'tone' => 'soft-warning'],
        'pack' => ['label' => 'Ready to pack', 'tone' => 'soft-info'],
        'hold' => ['label' => 'On hold', 'tone' => 'soft-destructive'],
    ];

    $waitingFilterOptions ??= ['' => 'Everything waiting'] + collect($waitingVocabulary)->map(fn ($w) => $w['label'])->all();

    $rows ??= [
        [
            'id' => 'shp_2291', 'number' => '#SHP-2291', 'customer' => 'Fenna van Dijk', 'destination' => 'Utrecht, NL',
            'waitingFor' => 'stock', 'waitingSince' => now()->subDays(2)->toIso8601String(),
            'actions' => [
                ['key' => 'check-stock', 'label' => 'Check stock', 'kind' => 'link', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2288', 'number' => '#SHP-2288', 'customer' => 'Sven Jansen', 'destination' => 'Rotterdam, NL',
            'waitingFor' => 'label', 'waitingSince' => now()->subHours(6)->toIso8601String(),
            'actions' => [
                ['key' => 'retry-label', 'label' => 'Retry label', 'kind' => 'submit', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2285', 'number' => '#SHP-2285', 'customer' => 'Mila Peters', 'destination' => 'Ghent, BE',
            'waitingFor' => 'pack', 'waitingSince' => now()->subHours(3)->toIso8601String(),
            'actions' => [
                ['key' => 'start-packing', 'label' => 'Start packing', 'kind' => 'link', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2270', 'number' => '#SHP-2270', 'customer' => 'Daan Willems', 'destination' => 'Antwerp, BE',
            'waitingFor' => 'hold', 'waitingSince' => now()->subDays(5)->toIso8601String(),
            'actions' => [
                ['key' => 'release-hold', 'label' => 'Release hold', 'kind' => 'submit', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
                ['key' => 'cancel', 'label' => 'Cancel shipment', 'kind' => 'dialog'],
            ],
        ],
        [
            'id' => 'shp_2265', 'number' => '#SHP-2265', 'customer' => 'Noah de Groot', 'destination' => 'Eindhoven, NL',
            'waitingFor' => 'label', 'waitingSince' => now()->subDay()->toIso8601String(),
            'actions' => [
                ['key' => 'retry-label', 'label' => 'Retry label', 'kind' => 'submit', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2260', 'number' => '#SHP-2260', 'customer' => 'Els Bakker', 'destination' => 'Utrecht, NL',
            'waitingFor' => 'pack', 'waitingSince' => now()->subHours(4)->toIso8601String(),
            'actions' => [
                ['key' => 'start-packing', 'label' => 'Start packing', 'kind' => 'link', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
    ];

    $activeFilters ??= [
        ['key' => 'waiting', 'label' => 'Waiting for', 'value' => 'Awaiting label', 'href' => '?waiting='],
    ];
    $clearFiltersHref ??= '?';

    $bulkActions ??= [
        ['key' => 'retry-labels', 'label' => 'Retry labels'],
        ['key' => 'export', 'label' => 'Export'],
    ];

    $bulkFailures ??= $bulkState === 'partial'
        ? ['#SHP-2270 — shipment is on hold and cannot be retried.']
        : [];

    $perPageOptions ??= [10, 25, 50, 100];

    $columns = [
        ['key' => 'shipment', 'label' => __('Shipment'), 'sortable' => false],
        ['key' => 'destination', 'label' => __('Destination'), 'sortable' => false, 'tier' => 2],
        ['key' => 'waiting', 'label' => __('Waiting for'), 'sortable' => false],
        ['key' => 'since', 'label' => __('Waiting since'), 'sortable' => false],
        ['key' => 'actions', 'label' => __('Actions'), 'align' => 'end', 'sortable' => false],
    ];
@endphp

<main
    id="main-content"
    data-slot="admin-worklist-page"
    data-surface="admin"
    data-visual-contracts="VC-005"
    {{ $attributes->merge(['class' => 'min-h-screen bg-background text-foreground']) }}
>
    <header class="border-b border-border bg-background px-4 py-4 sm:px-6" data-slot="admin-worklist-header">
        <div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
            <div class="min-w-0">
                <div class="flex flex-wrap items-center gap-2">
                    <h1 class="text-xl font-semibold tracking-tight">{{ __($title) }}</h1>
                    <x-ui.badge variant="secondary">{{ trans_choice(':count shipment|:count shipments', count($rows), ['count' => count($rows)]) }}</x-ui.badge>
                </div>
                <p class="mt-2 max-w-2xl text-sm text-muted-foreground">{{ __($description) }}</p>
            </div>

            {{-- No create action here, deliberately: this queue is populated by
                 an upstream event, never authored from this screen. --}}
            @if ($freshness)
                <span
                    title="{{ __(':source synced :time', ['source' => $freshness['source'] ?? __($title), 'time' => \Illuminate\Support\Carbon::parse($freshness['syncedAt'])->diffForHumans()]) }}"
                    @class([
                        'inline-flex h-8 shrink-0 items-center gap-2 rounded-md border px-2 text-xs',
                        'border-warning-line bg-warning-soft text-warning-text' => $freshness['stale'] ?? false,
                        'border-border text-muted-foreground' => ! ($freshness['stale'] ?? false),
                    ])
                >
                    <span
                        @class(['size-2 rounded-full', 'bg-warning' => $freshness['stale'] ?? false, 'bg-success' => ! ($freshness['stale'] ?? false)])
                        aria-hidden="true"
                    ></span>
                    {{ __(':source, ', ['source' => $freshness['source'] ?? '']) }}<x-ui.relative-time :datetime="$freshness['syncedAt']" />
                </span>
            @endif
        </div>
    </header>

    <div class="mx-auto max-w-screen-2xl px-4 py-6 sm:px-6">
        @if (! empty($alerts))
            <div class="mb-6 space-y-2" data-slot="admin-worklist-alerts">
                @foreach ($alerts as $alert)
                    <x-ui.alert :variant="$alert['tone'] ?? 'warning'">
                        <div class="text-sm font-semibold">{{ __($alert['title'] ?? '') }}</div>
                        @if (! empty($alert['description']))
                            <p class="mt-2 max-w-2xl text-xs leading-5 text-pretty opacity-90">{{ __($alert['description']) }}</p>
                        @endif
                    </x-ui.alert>
                @endforeach
            </div>
        @endif

        <div class="mb-6 grid grid-cols-2 gap-4 xl:grid-cols-4" data-slot="admin-worklist-kpis">
            @foreach ($kpis as $kpi)
                <x-ui.stat
                    :label="__($kpi['label'] ?? '')"
                    :value="$kpi['value'] ?? null"
                    :tone="$kpi['tone'] ?? null"
                    :href="$kpi['href'] ?? null"
                />
            @endforeach
        </div>

        <div class="mb-4 flex flex-wrap items-center justify-between gap-4">
            <x-ui.saved-views :views="$views" mode="tabs" heading="{{ __('Waiting for') }}" />

            <x-ui.form method="GET" :action="$searchAction" class="flex flex-wrap items-center gap-2 !space-y-0">
                <label for="admin-worklist-search" class="sr-only">{{ __('Search') }}</label>
                <x-ui.input
                    type="search"
                    name="search"
                    id="admin-worklist-search"
                    :value="$searchValue"
                    placeholder="{{ __('Search by shipment or customer…') }}"
                    class="w-56"
                />
                <label for="admin-worklist-waiting" class="sr-only">{{ __('Waiting for') }}</label>
                <x-ui.select name="waiting" id="admin-worklist-waiting" aria-label="{{ __('Waiting for') }}">
                    @foreach ($waitingFilterOptions as $value => $label)
                        <option value="{{ $value }}" @selected((string) $waitingFilterValue === (string) $value)>{{ __($label) }}</option>
                    @endforeach
                </x-ui.select>
                <x-ui.button type="submit" variant="secondary" size="sm">{{ __('Apply') }}</x-ui.button>
            </x-ui.form>
        </div>

        @if (! empty($activeFilters))
            <div class="mb-4">
                <x-ui.active-filters :filters="$activeFilters" :clear-href="$clearFiltersHref" />
            </div>
        @endif

        <x-ui.admin-table
            :columns="$columns"
            :selectable="true"
            :pinned="true"
            :summary="trans_choice('Showing :count shipment|Showing :count shipments', count($rows), ['count' => count($rows)])"
            :bulk-actions="$bulkActions"
            :bulk-action-url="$bulkActionUrl"
            :bulk-state="$bulkState"
            :bulk-failures="$bulkFailures"
        >
            @forelse ($rows as $row)
                @php $wait = $waitingVocabulary[$row['waitingFor'] ?? ''] ?? ['label' => $row['waitingFor'] ?? '', 'tone' => 'soft-neutral']; @endphp
                <x-ui.admin-table.row :key="$row['id']" select-label="Select shipment :record">
                    <x-ui.admin-table.cell column="shipment" :pinned="true" class="py-4">
                        <span class="block truncate font-medium">{{ $row['number'] ?? $row['id'] }}</span>
                        <span class="block truncate text-xs text-muted-foreground">{{ $row['customer'] ?? '' }}</span>
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="destination" :tier="2" class="py-4 text-muted-foreground">
                        {{ $row['destination'] ?? '' }}
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="waiting" class="py-4">
                        <x-ui.badge :variant="$wait['tone']" size="status">{{ __($wait['label']) }}</x-ui.badge>
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="since" class="py-4 text-muted-foreground">
                        <x-ui.relative-time :datetime="$row['waitingSince'] ?? null" />
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="actions" align="end" class="py-4">
                        <x-ui.row-actions :actions="$row['actions'] ?? []" :row-label="__('shipment :number', ['number' => $row['number'] ?? $row['id']])" />
                    </x-ui.admin-table.cell>
                </x-ui.admin-table.row>
            @empty
                <x-ui.admin-table.empty>
                    <x-ui.empty variant="plain" size="sm">
                        <x-ui.empty.header>
                            <x-ui.empty.title as="h2">{{ __('Nothing is waiting') }}</x-ui.empty.title>
                            <x-ui.empty.description>{{ __('Every shipment has cleared this queue. Change the search or the waiting-for filter to see more.') }}</x-ui.empty.description>
                        </x-ui.empty.header>
                        <x-ui.empty.content>
                            <x-ui.button variant="outline" :href="$clearFiltersHref ?? '#'">{{ __('Reset view') }}</x-ui.button>
                        </x-ui.empty.content>
                    </x-ui.empty>
                </x-ui.admin-table.empty>
            @endforelse

            <x-slot:footer>
                <label for="admin-worklist-per-page" class="sr-only">{{ __('Rows per page') }}</label>
                <x-ui.form method="GET" :action="$perPageAction" class="!space-y-0">
                    <x-ui.select name="per_page" id="admin-worklist-per-page" aria-label="{{ __('Rows per page') }}" class="h-8 text-xs" onchange="this.form.requestSubmit()">
                        @foreach ($perPageOptions as $option)
                            <option value="{{ $option }}" @selected((int) $perPage === (int) $option)>{{ __(':count / page', ['count' => $option]) }}</option>
                        @endforeach
                    </x-ui.select>
                </x-ui.form>

                @if ($pagination && method_exists($pagination, 'links'))
                    {{ $pagination->links() }}
                @else
                    <x-ui.button variant="ghost" size="sm" disabled>{{ __('Previous') }}</x-ui.button>
                    <span aria-current="page" class="text-foreground">{{ __('Page 1') }}</span>
                    <x-ui.button variant="ghost" size="sm" disabled>{{ __('Next') }}</x-ui.button>
                @endif
            </x-slot:footer>
        </x-ui.admin-table>
    </div>
</main>

Installation

terminal
php artisan ui:add pages/admin-worklist

Registry contract

Install confidence

php artisan ui:add pages/admin-worklist writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.0.2
License
open
Stability
stable
Contract
v4
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/pages/admin-worklist.blade.php

Registry dependencies

admin-table badge button stat saved-views active-filters row-actions empty alert select form input relative-time

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the page is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this page in an assistant.

admin-worklist.md
# Brok UI page: Admin Worklist (`admin-worklist`)

An operational queue organised by what each item is waiting for, not by status: no create action (work arrives, it is not authored), freshness readout for the upstream system the queue depends on, waiting-for KPI tiles, an operator-facing table with row actions, and bulk actions surfaced through the admin table's own async status.

Brok UI is a Laravel Blade registry. `ui:add` copies this page into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add pages/admin-worklist
```

## Render it

```blade
<x-pages.admin-worklist />
```

## Props

- `title` (string, default `Fulfilment queue`) — Page heading.
- `description` (string, default `Shipments waiting on stock, a label, or a hold before they can go out.`) — Supporting page description.
- `freshness` (array|null, default `null`) — Upstream sync readout: ['source','syncedAt' (ISO datetime),'stale' (bool)].
- `alerts` (array|null, default `null`) — Operational alerts needing attention: each entry is ['tone','title','description'].
- `kpis` (array|null, default `null`) — Clickable waiting-for KPI tiles: each entry is ['label','value','tone','href'].
- `views` (array|null, default `null`) — Waiting-for saved views passed to <x-ui.saved-views mode="tabs">.
- `search-value` (string) — Current search query.
- `search-action` (string|null, default `null`) — GET action the toolbar's search and waiting-for filter submit to.
- `waiting-filter-value` (string) — Current waiting-for filter value.
- `waiting-filter-options` (array|null, default `null`) — Associative value-to-label options for the waiting-for filter select.
- `active-filters` (array|null, default `null`) — Applied filters rendered as removable chips.
- `clear-filters-href` (string|null, default `null`) — Destination that clears every active filter.
- `rows` (array|null, default `null`) — Queue items, each already filtered to the actions the viewer is eligible for.
- `bulk-actions` (array|null, default `null`) — Server-authorized bulk actions for the selection bar.
- `bulk-action-url` (string|null, default `null`) — POST target for the bulk action bar.
- `bulk-state` (idle|progress|partial|complete, default `idle`) — Async state of the most recent bulk run, reported inline by the admin table.
- `bulk-failures` (array|null, default `null`) — Per-item failure reasons shown under the bulk status when bulkState is partial.
- `per-page` (int, default `25`) — Current rows-per-page value.
- `per-page-options` (array|null, default `null`) — Selectable rows-per-page values.
- `per-page-action` (string|null, default `null`) — GET action the per-page control submits to.
- `pagination` (object|null, default `null`) — Optional Laravel paginator whose links render in the list footer.

## Use when

- Building a queue of work that arrives on its own from an upstream event (a paid order, a customer return request, a webhook) rather than work an operator creates.
- Items are naturally grouped by what they are blocked on (awaiting stock, awaiting a label, on hold, …) rather than by a lifecycle status.

## Avoid when

- The list is authored by the operator (records they create and own) — use pages/admin-overview instead, which has a primary create action.
- There is nothing upstream to be stale — a queue with no external sync does not need a freshness readout.

## Rules

- Render the installed page with `<x-pages.admin-worklist />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/pages/admin-worklist
- Registry JSON (files, props, contract): https://brokui.dev/r/open/pages/admin-worklist.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Building a queue of work that arrives on its own from an upstream event (a paid order, a customer return request, a webhook) rather than work an operator creates.
  • Items are naturally grouped by what they are blocked on (awaiting stock, awaiting a label, on hold, …) rather than by a lifecycle status.

Avoid when

  • The list is authored by the operator (records they create and own) — use pages/admin-overview instead, which has a primary create action.
  • There is nothing upstream to be stale — a queue with no external sync does not need a freshness readout.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
page header (title, freshness — no create action) operational alert zone waiting-for kpi row waiting-for saved views search and filter toolbar applied-filter chips selectable admin table with row actions bulk action bar with inline async status list footer with per-page control
Theming hooks
Pins the pattern to the admin surface and uses semantic design tokens throughout.

Usage

Render the page as a component, or wire it to a route. Pass data where useful:

resources/views/welcome.blade.php Blade
<x-pages.admin-worklist />

Built from blocks & primitives

This page composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only pages.

resources/views/pages/admin-worklist.blade.php Blade
{{--
    Admin Worklist — a queue, which is NOT the same thing as an index.

    Generalised from the Noord-C admin's `fulfilment/index.blade.php` and
    `returns/index.blade.php`: organised by what each item is WAITING FOR
    rather than by a lifecycle status, because the operator's question is
    "what is stuck, and on what" — not "what state is this record in".

    Three rules carried over from the source pages, all visible in this file:
      - No create action anywhere on the page. Work arrives in a queue on its
        own (a paid order, a customer return); it is not authored here.
      - The KPI row, the saved views, and the table's own "Waiting for" column
        all group by the SAME waiting-for vocabulary, not by status.
      - Freshness names the upstream system the queue depends on (a carrier or
        marketplace sync), because parcel/return states the queue shows are
        exactly as current as that last sync.

    Left out on purpose (domain logic the consumer supplies): which carrier or
    warehouse integration produced a waiting-for reason, and any eligibility
    rule for which action a given row may take — `rows[].actions` arrives
    already filtered to what the viewer may do.
--}}
@props([
    'title' => 'Fulfilment queue',
    'description' => 'Shipments waiting on stock, a label, or a hold before they can go out.',
    'freshness' => null,
    'alerts' => null,
    'kpis' => null,
    'views' => null,
    'searchValue' => '',
    'searchAction' => null,
    'waitingFilterValue' => '',
    'waitingFilterOptions' => null,
    'activeFilters' => null,
    'clearFiltersHref' => null,
    'rows' => null,
    'bulkActions' => null,
    'bulkActionUrl' => null,
    'bulkState' => 'idle',
    'bulkFailures' => null,
    'perPage' => 25,
    'perPageOptions' => null,
    'perPageAction' => null,
    'pagination' => null,
])

@php
    $freshness ??= [
        'source' => 'PostNL tracking',
        'syncedAt' => now()->subMinutes(18)->toIso8601String(),
        'stale' => true,
    ];

    $alerts ??= [
        [
            'tone' => 'warning',
            'title' => 'Label sync running behind',
            'description' => '15 shipments could not request a label from PostNL in the last hour. They will retry automatically, or you can retry them now.',
        ],
    ];

    $kpis ??= [
        ['label' => 'Awaiting stock', 'value' => '8', 'tone' => 'attention', 'href' => '?waiting=stock'],
        ['label' => 'Awaiting label', 'value' => '15', 'tone' => 'attention', 'href' => '?waiting=label'],
        ['label' => 'Ready to pack', 'value' => '27', 'tone' => 'positive', 'href' => '?waiting=pack'],
        ['label' => 'On hold', 'value' => '4', 'tone' => 'negative', 'href' => '?waiting=hold'],
    ];

    $views ??= [
        ['key' => 'all', 'label' => 'All shipments', 'href' => '?view=all', 'count' => 54, 'active' => true, 'system' => true],
        ['key' => 'stock', 'label' => 'Awaiting stock', 'href' => '?view=stock', 'count' => 8, 'tone' => 'attention', 'system' => true],
        ['key' => 'label', 'label' => 'Awaiting label', 'href' => '?view=label', 'count' => 15, 'tone' => 'attention', 'system' => true],
        ['key' => 'pack', 'label' => 'Ready to pack', 'href' => '?view=pack', 'count' => 27, 'system' => true],
        ['key' => 'hold', 'label' => 'On hold', 'href' => '?view=hold', 'count' => 4, 'tone' => 'attention', 'system' => true],
    ];

    $waitingVocabulary = [
        'stock' => ['label' => 'Awaiting stock', 'tone' => 'soft-warning'],
        'label' => ['label' => 'Awaiting label', 'tone' => 'soft-warning'],
        'pack' => ['label' => 'Ready to pack', 'tone' => 'soft-info'],
        'hold' => ['label' => 'On hold', 'tone' => 'soft-destructive'],
    ];

    $waitingFilterOptions ??= ['' => 'Everything waiting'] + collect($waitingVocabulary)->map(fn ($w) => $w['label'])->all();

    $rows ??= [
        [
            'id' => 'shp_2291', 'number' => '#SHP-2291', 'customer' => 'Fenna van Dijk', 'destination' => 'Utrecht, NL',
            'waitingFor' => 'stock', 'waitingSince' => now()->subDays(2)->toIso8601String(),
            'actions' => [
                ['key' => 'check-stock', 'label' => 'Check stock', 'kind' => 'link', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2288', 'number' => '#SHP-2288', 'customer' => 'Sven Jansen', 'destination' => 'Rotterdam, NL',
            'waitingFor' => 'label', 'waitingSince' => now()->subHours(6)->toIso8601String(),
            'actions' => [
                ['key' => 'retry-label', 'label' => 'Retry label', 'kind' => 'submit', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2285', 'number' => '#SHP-2285', 'customer' => 'Mila Peters', 'destination' => 'Ghent, BE',
            'waitingFor' => 'pack', 'waitingSince' => now()->subHours(3)->toIso8601String(),
            'actions' => [
                ['key' => 'start-packing', 'label' => 'Start packing', 'kind' => 'link', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2270', 'number' => '#SHP-2270', 'customer' => 'Daan Willems', 'destination' => 'Antwerp, BE',
            'waitingFor' => 'hold', 'waitingSince' => now()->subDays(5)->toIso8601String(),
            'actions' => [
                ['key' => 'release-hold', 'label' => 'Release hold', 'kind' => 'submit', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
                ['key' => 'cancel', 'label' => 'Cancel shipment', 'kind' => 'dialog'],
            ],
        ],
        [
            'id' => 'shp_2265', 'number' => '#SHP-2265', 'customer' => 'Noah de Groot', 'destination' => 'Eindhoven, NL',
            'waitingFor' => 'label', 'waitingSince' => now()->subDay()->toIso8601String(),
            'actions' => [
                ['key' => 'retry-label', 'label' => 'Retry label', 'kind' => 'submit', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
        [
            'id' => 'shp_2260', 'number' => '#SHP-2260', 'customer' => 'Els Bakker', 'destination' => 'Utrecht, NL',
            'waitingFor' => 'pack', 'waitingSince' => now()->subHours(4)->toIso8601String(),
            'actions' => [
                ['key' => 'start-packing', 'label' => 'Start packing', 'kind' => 'link', 'url' => '#', 'quick' => true],
                ['key' => 'view', 'label' => 'View order', 'kind' => 'link', 'url' => '#'],
            ],
        ],
    ];

    $activeFilters ??= [
        ['key' => 'waiting', 'label' => 'Waiting for', 'value' => 'Awaiting label', 'href' => '?waiting='],
    ];
    $clearFiltersHref ??= '?';

    $bulkActions ??= [
        ['key' => 'retry-labels', 'label' => 'Retry labels'],
        ['key' => 'export', 'label' => 'Export'],
    ];

    $bulkFailures ??= $bulkState === 'partial'
        ? ['#SHP-2270 — shipment is on hold and cannot be retried.']
        : [];

    $perPageOptions ??= [10, 25, 50, 100];

    $columns = [
        ['key' => 'shipment', 'label' => __('Shipment'), 'sortable' => false],
        ['key' => 'destination', 'label' => __('Destination'), 'sortable' => false, 'tier' => 2],
        ['key' => 'waiting', 'label' => __('Waiting for'), 'sortable' => false],
        ['key' => 'since', 'label' => __('Waiting since'), 'sortable' => false],
        ['key' => 'actions', 'label' => __('Actions'), 'align' => 'end', 'sortable' => false],
    ];
@endphp

<main
    id="main-content"
    data-slot="admin-worklist-page"
    data-surface="admin"
    data-visual-contracts="VC-005"
    {{ $attributes->merge(['class' => 'min-h-screen bg-background text-foreground']) }}
>
    <header class="border-b border-border bg-background px-4 py-4 sm:px-6" data-slot="admin-worklist-header">
        <div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
            <div class="min-w-0">
                <div class="flex flex-wrap items-center gap-2">
                    <h1 class="text-xl font-semibold tracking-tight">{{ __($title) }}</h1>
                    <x-ui.badge variant="secondary">{{ trans_choice(':count shipment|:count shipments', count($rows), ['count' => count($rows)]) }}</x-ui.badge>
                </div>
                <p class="mt-2 max-w-2xl text-sm text-muted-foreground">{{ __($description) }}</p>
            </div>

            {{-- No create action here, deliberately: this queue is populated by
                 an upstream event, never authored from this screen. --}}
            @if ($freshness)
                <span
                    title="{{ __(':source synced :time', ['source' => $freshness['source'] ?? __($title), 'time' => \Illuminate\Support\Carbon::parse($freshness['syncedAt'])->diffForHumans()]) }}"
                    @class([
                        'inline-flex h-8 shrink-0 items-center gap-2 rounded-md border px-2 text-xs',
                        'border-warning-line bg-warning-soft text-warning-text' => $freshness['stale'] ?? false,
                        'border-border text-muted-foreground' => ! ($freshness['stale'] ?? false),
                    ])
                >
                    <span
                        @class(['size-2 rounded-full', 'bg-warning' => $freshness['stale'] ?? false, 'bg-success' => ! ($freshness['stale'] ?? false)])
                        aria-hidden="true"
                    ></span>
                    {{ __(':source, ', ['source' => $freshness['source'] ?? '']) }}<x-ui.relative-time :datetime="$freshness['syncedAt']" />
                </span>
            @endif
        </div>
    </header>

    <div class="mx-auto max-w-screen-2xl px-4 py-6 sm:px-6">
        @if (! empty($alerts))
            <div class="mb-6 space-y-2" data-slot="admin-worklist-alerts">
                @foreach ($alerts as $alert)
                    <x-ui.alert :variant="$alert['tone'] ?? 'warning'">
                        <div class="text-sm font-semibold">{{ __($alert['title'] ?? '') }}</div>
                        @if (! empty($alert['description']))
                            <p class="mt-2 max-w-2xl text-xs leading-5 text-pretty opacity-90">{{ __($alert['description']) }}</p>
                        @endif
                    </x-ui.alert>
                @endforeach
            </div>
        @endif

        <div class="mb-6 grid grid-cols-2 gap-4 xl:grid-cols-4" data-slot="admin-worklist-kpis">
            @foreach ($kpis as $kpi)
                <x-ui.stat
                    :label="__($kpi['label'] ?? '')"
                    :value="$kpi['value'] ?? null"
                    :tone="$kpi['tone'] ?? null"
                    :href="$kpi['href'] ?? null"
                />
            @endforeach
        </div>

        <div class="mb-4 flex flex-wrap items-center justify-between gap-4">
            <x-ui.saved-views :views="$views" mode="tabs" heading="{{ __('Waiting for') }}" />

            <x-ui.form method="GET" :action="$searchAction" class="flex flex-wrap items-center gap-2 !space-y-0">
                <label for="admin-worklist-search" class="sr-only">{{ __('Search') }}</label>
                <x-ui.input
                    type="search"
                    name="search"
                    id="admin-worklist-search"
                    :value="$searchValue"
                    placeholder="{{ __('Search by shipment or customer…') }}"
                    class="w-56"
                />
                <label for="admin-worklist-waiting" class="sr-only">{{ __('Waiting for') }}</label>
                <x-ui.select name="waiting" id="admin-worklist-waiting" aria-label="{{ __('Waiting for') }}">
                    @foreach ($waitingFilterOptions as $value => $label)
                        <option value="{{ $value }}" @selected((string) $waitingFilterValue === (string) $value)>{{ __($label) }}</option>
                    @endforeach
                </x-ui.select>
                <x-ui.button type="submit" variant="secondary" size="sm">{{ __('Apply') }}</x-ui.button>
            </x-ui.form>
        </div>

        @if (! empty($activeFilters))
            <div class="mb-4">
                <x-ui.active-filters :filters="$activeFilters" :clear-href="$clearFiltersHref" />
            </div>
        @endif

        <x-ui.admin-table
            :columns="$columns"
            :selectable="true"
            :pinned="true"
            :summary="trans_choice('Showing :count shipment|Showing :count shipments', count($rows), ['count' => count($rows)])"
            :bulk-actions="$bulkActions"
            :bulk-action-url="$bulkActionUrl"
            :bulk-state="$bulkState"
            :bulk-failures="$bulkFailures"
        >
            @forelse ($rows as $row)
                @php $wait = $waitingVocabulary[$row['waitingFor'] ?? ''] ?? ['label' => $row['waitingFor'] ?? '', 'tone' => 'soft-neutral']; @endphp
                <x-ui.admin-table.row :key="$row['id']" select-label="Select shipment :record">
                    <x-ui.admin-table.cell column="shipment" :pinned="true" class="py-4">
                        <span class="block truncate font-medium">{{ $row['number'] ?? $row['id'] }}</span>
                        <span class="block truncate text-xs text-muted-foreground">{{ $row['customer'] ?? '' }}</span>
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="destination" :tier="2" class="py-4 text-muted-foreground">
                        {{ $row['destination'] ?? '' }}
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="waiting" class="py-4">
                        <x-ui.badge :variant="$wait['tone']" size="status">{{ __($wait['label']) }}</x-ui.badge>
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="since" class="py-4 text-muted-foreground">
                        <x-ui.relative-time :datetime="$row['waitingSince'] ?? null" />
                    </x-ui.admin-table.cell>
                    <x-ui.admin-table.cell column="actions" align="end" class="py-4">
                        <x-ui.row-actions :actions="$row['actions'] ?? []" :row-label="__('shipment :number', ['number' => $row['number'] ?? $row['id']])" />
                    </x-ui.admin-table.cell>
                </x-ui.admin-table.row>
            @empty
                <x-ui.admin-table.empty>
                    <x-ui.empty variant="plain" size="sm">
                        <x-ui.empty.header>
                            <x-ui.empty.title as="h2">{{ __('Nothing is waiting') }}</x-ui.empty.title>
                            <x-ui.empty.description>{{ __('Every shipment has cleared this queue. Change the search or the waiting-for filter to see more.') }}</x-ui.empty.description>
                        </x-ui.empty.header>
                        <x-ui.empty.content>
                            <x-ui.button variant="outline" :href="$clearFiltersHref ?? '#'">{{ __('Reset view') }}</x-ui.button>
                        </x-ui.empty.content>
                    </x-ui.empty>
                </x-ui.admin-table.empty>
            @endforelse

            <x-slot:footer>
                <label for="admin-worklist-per-page" class="sr-only">{{ __('Rows per page') }}</label>
                <x-ui.form method="GET" :action="$perPageAction" class="!space-y-0">
                    <x-ui.select name="per_page" id="admin-worklist-per-page" aria-label="{{ __('Rows per page') }}" class="h-8 text-xs" onchange="this.form.requestSubmit()">
                        @foreach ($perPageOptions as $option)
                            <option value="{{ $option }}" @selected((int) $perPage === (int) $option)>{{ __(':count / page', ['count' => $option]) }}</option>
                        @endforeach
                    </x-ui.select>
                </x-ui.form>

                @if ($pagination && method_exists($pagination, 'links'))
                    {{ $pagination->links() }}
                @else
                    <x-ui.button variant="ghost" size="sm" disabled>{{ __('Previous') }}</x-ui.button>
                    <span aria-current="page" class="text-foreground">{{ __('Page 1') }}</span>
                    <x-ui.button variant="ghost" size="sm" disabled>{{ __('Next') }}</x-ui.button>
                @endif
            </x-slot:footer>
        </x-ui.admin-table>
    </div>
</main>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.0.2
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v4
Foundation
≥ 1.0.0