168 lines
5.4 KiB
PHTML
168 lines
5.4 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var array<int, string> $errors
|
|
* @var array $form
|
|
* @var array $department
|
|
*/
|
|
|
|
use MintyPHP\Session;
|
|
|
|
$values = $form ?? $department ?? [];
|
|
$isReadOnly = !can('departments.update');
|
|
|
|
?>
|
|
|
|
<div class="app-details-container">
|
|
<section>
|
|
<div class="app-breadcrumb">
|
|
<a href="/admin">Startseite</a><i class="bi bi-chevron-right"></i><a
|
|
href="/admin/departments"><?php e(t('Departments')); ?></a><i class="bi bi-chevron-right"></i><?php e(t('Edit department')); ?>
|
|
</div>
|
|
<div class="app-details-titlebar">
|
|
<h1>
|
|
<a href="admin/departments" title="<?php e(t('Cancel')); ?>"><i class="bi bi-arrow-left"></i></a>
|
|
<?php e(t('Edit department')); ?>
|
|
</h1>
|
|
<div class="app-details-titlebar-actions">
|
|
<?php if (can('departments.delete')): ?>
|
|
<details class="dropdown">
|
|
<summary role="button" class="outline secondary"><i class="bi bi-three-dots"></i></summary>
|
|
<ul dir="rtl">
|
|
<li>
|
|
<form method="post" action="admin/departments/delete/<?php e($values['uuid'] ?? ''); ?>"
|
|
onsubmit="return confirm('<?php e(t('Delete this department?')); ?>');">
|
|
<?php Session::getCsrfInput(); ?>
|
|
<button type="submit" class="transparent">
|
|
<?php e(t('Delete')); ?>
|
|
</button>
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</details>
|
|
<?php endif; ?>
|
|
|
|
<?php if (can('departments.update')): ?>
|
|
<button type="submit" form="department-form" name="action" value="save" class="secondary outline">
|
|
<?php e(t('Save')); ?>
|
|
</button>
|
|
<button type="submit" form="department-form" name="action" value="save_close" class="primary">
|
|
<?php e(t('Save & close')); ?>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($errors)): ?>
|
|
<div class="app-details-errors">
|
|
<div class="notice" data-variant="error">
|
|
<ul>
|
|
<?php foreach ($errors as $error): ?>
|
|
<li><?php e($error); ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
$detailsOpenAll = false;
|
|
$isReadOnly = $isReadOnly ?? false;
|
|
require __DIR__ . '/_form.phtml';
|
|
?>
|
|
</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>
|
|
<hr>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('ID')); ?></small>
|
|
<p>
|
|
<span class="badge" data-variant="neutral" data-copy="true"
|
|
data-copy-value="<?php e($values['id'] ?? ''); ?>">
|
|
<?php e($values['id'] ?? '-'); ?>
|
|
</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
$createdByLabel = $values['created_by_label'] ?? '';
|
|
$createdById = $values['created_by'] ?? null;
|
|
$createdByUuid = $values['created_by_uuid'] ?? null;
|
|
$modifiedByLabel = $values['modified_by_label'] ?? '';
|
|
$modifiedById = $values['modified_by'] ?? null;
|
|
$modifiedByUuid = $values['modified_by_uuid'] ?? null;
|
|
?>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Created')); ?></small>
|
|
<p><?php e(dt($values['created'] ?? '') ?: '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small>
|
|
<?php e(t('Created by')); ?>
|
|
</small>
|
|
<p>
|
|
<?php if ($createdByLabel !== ''): ?>
|
|
<?php if ($createdByUuid): ?>
|
|
<a href="admin/users/edit/<?php e($createdByUuid); ?>"><?php e($createdByLabel); ?></a>
|
|
<?php else: ?>
|
|
<?php e($createdByLabel); ?>
|
|
<?php endif; ?>
|
|
<?php elseif ($createdById): ?>
|
|
<?php e('#' . $createdById); ?>
|
|
<?php else: ?>
|
|
-
|
|
<?php endif; ?>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Modified')); ?></small>
|
|
<p><?php e(dt($values['modified'] ?? '') ?: '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small>
|
|
<?php e(t('Modified by')); ?>
|
|
</small>
|
|
<p>
|
|
<?php if ($modifiedByLabel !== ''): ?>
|
|
<?php if ($modifiedByUuid): ?>
|
|
<a href="admin/users/edit/<?php e($modifiedByUuid); ?>"><?php e($modifiedByLabel); ?></a>
|
|
<?php else: ?>
|
|
<?php e($modifiedByLabel); ?>
|
|
<?php endif; ?>
|
|
<?php elseif ($modifiedById): ?>
|
|
<?php e('#' . $modifiedById); ?>
|
|
<?php else: ?>
|
|
-
|
|
<?php endif; ?>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="grid">
|
|
<div>
|
|
<small>
|
|
<?php e(t('UUID')); ?>
|
|
</small>
|
|
<p>
|
|
<span class="badge" data-variant="neutral" data-copy="true"
|
|
data-copy-value="<?php e($values['uuid'] ?? ''); ?>">
|
|
<?php
|
|
$uuidValue = (string) ($values['uuid'] ?? '');
|
|
$uuidDisplay = $uuidValue !== '' ? substr($uuidValue, 0, 10) : '-';
|
|
e($uuidDisplay);
|
|
?>
|
|
</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
</div>
|