Lists and detail page
Columns
Section titled “Columns”public function collection(Collection $collection): Collection{ $workflow = $this->workflow('purchase');
return $collection ->columns([ TextColumn::make('title'), TextColumn::make('budget_owner_id')->label('Budget owner')->user(), $workflow->stateColumn(), $workflow->nextActorsColumn(), $workflow->dueColumn(), $workflow->lastStepColumn()->toggleable(), ]) ->filters([$workflow->stateFilter(), $workflow->myTasksFilter()]);}| Method | Shows | Sortable |
|---|---|---|
stateColumn($label) |
the state as a badge with its label: initial light, locked green, final dark, others blue | yes |
nextActorsColumn($label) |
who the record waits for: the open tasks and decisions with the usernames of their candidates, or of the user who claimed one, e.g. “Budget owner review: bernd · Legal check: eva”; red with an alarm icon when a task is overdue | no |
dueColumn($label) |
due date of the next open task, red when it is overdue | no |
lastStepColumn($label) |
who ran the last transition, with the transition and when as second line | no |
The tasks and transitions of a page are loaded in a few queries, not one
per row. The columns take the options of every column (toggleable(),
icon(), …), see Columns.
Schedule
Section titled “Schedule”For cases with durations:
->columns([ TextColumn::make('title'), $workflow->stateColumn(), $workflow->stateDueColumn(), $workflow->deadlineColumn(), $workflow->forecastColumn(),])->filters([$workflow->riskFilter()])->presets([Preset::make('late', 'At risk or overdue')->filters(['schedule' => 'at_risk,overdue'])])| Method | Shows |
|---|---|
stateDueColumn($label) |
when the current step must be done; red when it has passed |
deadlineColumn($label) |
the deadline of the case; orange when at risk, red when overdue |
forecastColumn($label) |
the forecast with a badge On track / At risk / Overdue and as second line the difference, e.g. “3 working days late” |
riskFilter($label) |
records whose case is on track, at risk or overdue (several can be chosen; finished cases have no risk) |
The times of a page are loaded in one query. Exports contain the dates.
Filters
Section titled “Filters”| Method | Filter |
|---|---|
stateFilter($label) |
a select by state; add ->multiple() for several states |
myTasksFilter($label) |
a switch My tasks: records with an open task or decision for the logged in user, without those someone else has taken |
Use them in presets:
->presets([ Preset::make('my-tasks', 'My tasks')->filters(['my_tasks' => '1'])->default(), Preset::make('open', 'Open')->filters(['approval_state' => 'submitted,in_review']),])Detail page
Section titled “Detail page”Each workflow of the resource adds a section to the detail page:
- the current state (with a lock icon when locked),
- the transitions the user may run now, as buttons; dialogs for reason and form; transitions the user may only run as substitute are marked,
- the tasks of the record with their outcome and who completed them, and a link to the inbox,
- the schedule (cases with durations): deadline, forecast, risk and the difference, and a table of the steps with planned and actual working days – done, late, running, paused, and the steps still to come,
- the history: every transition with actor, time, reason and whether it was an override.
Workflow sections come before the own components of the resource.
Navigation badge
Section titled “Navigation badge”Show the number of open tasks of the user in the navigation of the resource:
public function navigationBadge(): ?string{ $count = service('tasks')->countFor((int) auth()->id());
return $count > 0 ? (string) $count : null;}The inbox has its own badge with all open tasks of the user.