Record view with cards and tabs
A project opens with collapsible cards on the left (one per field group, plus the client) and tabs on the right; each card edits only its own fields.
- Cards remember whether you opened or closed them.
- The client card is a compact view of the related record.
- The select field switches to another project of the same client.
Try it: log in with the demo account
Email demo@frontdesk-demo.test · Password Try-Frontdesk-2026
Everyone shares this account. You may change anything – all data is reset every night.
The code
app/src/Controllers/ProjectController.php – defineRecordPages() with layout tabs
whole file
protected function defineRecordPages(DataObject $record): ?RecordPages
{
/** @var Project $record */
return RecordPages::create()
->layout('tabs')
->switcher($this->clientProjects($record))
->page(RecordPage::create('tasks', 'Tasks')->sublist(TaskSubController::class, ''))
->page(RecordPage::create('description', 'Description')->groups(['description']))
->page(RecordPage::create('history', 'History')->timeline())
->card(RecordCard::create('client', 'Client')
->related(fn (Project $project) => $project->Client(), ClientController::class))
->groupCards(null, ['description'])
->card(RecordCard::create('share', 'Feedback link')
->open(false)
->summary(fn (Project $project) => $project->FeedbackAt ? 'Feedback received' : 'No feedback yet')
->content(fn (Project $project) => $this->feedbackLinkHtml($project)));
}
/**
* Right of the title: status and priority.
*/
protected function defineHeaderStatus(DataObject $record): ?ArrayList
{
/** @var Project $record */
return ArrayList::create([
ArrayData::create([
'Title' => 'Status',
'Value' => $record->getStatusLabel(),
'Color' => ['active' => 'success', 'on_hold' => 'warning', 'done' => 'neutral'][$record->Status] ?? '',
]),
ArrayData::create(['Title' => 'Priority', 'Value' => $record->getPriorityLabel()]),
]);
}
/**
* The other projects of the same client, with a link to add one.
*/
private function clientProjects(Project $project): RecordSwitcher
{
$segment = (string) $this->getRequest()->param('OtherID');
$switcher = RecordSwitcher::create()->withAddLink($this->Link('add'), '+ Project');
$client = $project->Client();
$others = $client->exists() ? $client->Projects()->sort('StartDate', 'DESC') : [$project];
foreach ($others as $other) {
$switcher->option(
(string) $other->Title,
$this->Link('view/' . $other->ID . ($segment !== '' ? '/' . $segment : '')),
$other->ID === $project->ID
);
}
return $switcher;
}
app/src/Controllers/ClientController.php – The client on a project card
whole file
/**
* A client on a project's card: where it is and its primary contact.
*/
protected function defineCompactFields(DataObject $record): ArrayList
{
/** @var Client $record */
$rows = ArrayList::create([
ArrayData::create([
'Label' => 'City',
'Value' => trim($record->City . ', ' . $record->Country, ', '),
'Type' => 'text',
]),
]);
$contact = $record->Contacts()->filter('IsPrimary', true)->first();
if ($contact) {
$rows->push(ArrayData::create([
'Label' => 'Contact',
'Value' => sprintf(
'%s<br><a class="link" href="mailto:%s">%s</a>',
htmlspecialchars($contact->getTitle()),
htmlspecialchars((string) $contact->Email),
htmlspecialchars((string) $contact->Email)
),
'Type' => 'html',
]));
}
return $rows;
}