Files
breadcrumb-the-shire/pages/admin/departments/edit(default).phtml
fs b749b5d192 feat: centralize breadcrumbs in topbar and remove history navigation
Move breadcrumb rendering from individual page templates into the core
topbar. Each page now sets $breadcrumbs in its action .php file; the
topbar renders it automatically via the shared partial.

- Remove global back/forward buttons and app-nav-history.js component
- Remove Alt+Arrow keyboard shortcuts for history navigation
- Render breadcrumb in topbar-left section (replaces button area)
- Clean up breadcrumb CSS: context-neutral base (flex, no margin)
- Recalculate sticky titlebar offset in details container
- Migrate all 41 pages (core + helpdesk, audit, addressbook, api-docs)
- Add missing breadcrumbs to addressbook detail view
- Update architecture contract tests (nav-history references removed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 17:17:06 +02:00

132 lines
4.5 KiB
PHTML

<?php
/**
* @var array<int, string> $errors
* @var array $form
* @var array $department
*/
use MintyPHP\Session;
$values = $form ?? $department ?? [];
$pageAuth = is_array($viewAuth['page'] ?? null) ? $viewAuth['page'] : [];
$canUpdateDepartment = (bool) ($pageAuth['can_update_department'] ?? false);
$canDeleteDepartment = (bool) ($pageAuth['can_delete_department'] ?? false);
$isReadOnly = !$canUpdateDepartment;
$titleText = $isReadOnly ? t('View department') : t('Edit department');
?>
<div class="app-details-container">
<section>
<?php
$hasTenantOptions = !empty($tenants);
$titlebar = [
'title' => $titleText,
'backHref' => 'admin/departments',
'backTitle' => t('Cancel'),
'actions' => $canUpdateDepartment ? [
[
'form' => 'department-form',
'name' => 'action',
'value' => 'save',
'class' => 'secondary outline',
'label' => t('Save'),
'disabled' => !$hasTenantOptions,
],
[
'form' => 'department-form',
'name' => 'action',
'value' => 'save_close',
'class' => 'primary',
'label' => t('Save & close'),
'disabled' => !$hasTenantOptions,
],
] : [],
];
require templatePath('partials/app-details-titlebar.phtml');
?>
<?php
$validationSummaryErrors = $validationSummaryErrors ?? ($errors ?? []);
require templatePath('partials/app-details-validation-summary.phtml');
?>
<?php if (!empty($warnings)): ?>
<div class="app-details-warnings">
<div class="notice" data-variant="info">
<ul>
<?php foreach ($warnings as $warning): ?>
<li><?php e($warning); ?></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endif; ?>
<?php
$detailsOpenAll = false;
$isReadOnly = $isReadOnly ?? false;
$showDangerZone = $canDeleteDepartment;
$dangerZoneDeleteFormId = $showDangerZone ? 'department-delete-form' : '';
$dangerZoneWarning = t('This will permanently delete this department.');
$dangerZoneActionLabel = t('Delete department');
require __DIR__ . '/_form.phtml';
?>
<?php if ($showDangerZone): ?>
<form
id="department-delete-form"
method="post"
action="admin/departments/delete/<?php e($values['uuid'] ?? ''); ?>"
hidden
data-detail-confirm-message="<?php e(t('Delete this department?')); ?>"
data-detail-action-kind="delete"
>
<?php Session::getCsrfInput(); ?>
</form>
<?php endif; ?>
</section>
<aside id="app-details-aside-section">
<div class="app-details-aside-section">
<hgroup>
<h2><?php e($values['description'] ?? ''); ?></h2>
<p><?php e(t('Department')); ?></p>
</hgroup>
<div class="badge-list">
<?php if ((string) ($values['active'] ?? '1') === '0'): ?>
<span class="badge" data-variant="danger"><?php e(t('Inactive')); ?></span>
<?php else: ?>
<span class="badge" data-variant="success"><?php e(t('Active')); ?></span>
<?php endif; ?>
</div>
<?php if (!empty($values['code']) || !empty($values['cost_center'])): ?>
<hr>
<?php if (!empty($values['code'])): ?>
<p><small><?php e(t('Code')); ?></small><br><?php e($values['code']); ?></p>
<?php endif; ?>
<?php if (!empty($values['cost_center'])): ?>
<p><small><?php e(t('Cost center')); ?></small><br><?php e($values['cost_center']); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php
$asideAuditDetailsName = 'department-audit';
$asideAuditCreated = (string) ($values['created'] ?? '');
$asideAuditCreatedByLabel = (string) ($values['created_by_label'] ?? '');
$asideAuditCreatedById = $values['created_by'] ?? null;
$asideAuditCreatedByUuid = (string) ($values['created_by_uuid'] ?? '');
$asideAuditModified = (string) ($values['modified'] ?? '');
$asideAuditModifiedByLabel = (string) ($values['modified_by_label'] ?? '');
$asideAuditModifiedById = $values['modified_by'] ?? null;
$asideAuditModifiedByUuid = (string) ($values['modified_by_uuid'] ?? '');
$asideIdsDetailsName = 'department-ids';
$asideIdValue = $values['id'] ?? '';
$asideUuidValue = (string) ($values['uuid'] ?? '');
?>
<hr>
<?php require templatePath('partials/app-details-aside-audit.phtml'); ?>
<hr>
<?php require templatePath('partials/app-details-aside-ids.phtml'); ?>
<hr>
</div>
</aside>
</div>