App-title and language sit in one App identity card now (both single-field sections; separate cards were chrome-heavy). The trivial info blockquotes that paraphrased the field labels are gone, and the per-field descriptions on the user creation defaults dropped because the section blockquote already says when the values apply. The "User creation rules" label is renamed to "User creation defaults" so the card title matches its scope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
163 lines
7.0 KiB
PHTML
163 lines
7.0 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var array $tenants
|
|
* @var array $roles
|
|
* @var array $departments
|
|
* @var array $values
|
|
* @var array $settings
|
|
* @var bool $canUpdateSettings
|
|
*/
|
|
|
|
use MintyPHP\Session;
|
|
|
|
$values = $values ?? [];
|
|
$settings = $settings ?? [];
|
|
$defaultTenantId = (int) ($values['default_tenant_id'] ?? 0);
|
|
$defaultRoleId = (int) ($values['default_role_id'] ?? 0);
|
|
$defaultDepartmentId = (int) ($values['default_department_id'] ?? 0);
|
|
$appTitle = (string) ($values['app_title'] ?? '');
|
|
$appLocale = (string) ($values['app_locale'] ?? '');
|
|
$appTitleDesc = $settings['app_title']['description'] ?? 'setting.app_title';
|
|
$appLocaleDesc = $settings['app_locale']['description'] ?? 'setting.app_locale';
|
|
$locales = defined('APP_LOCALES') ? APP_LOCALES : [];
|
|
$canUpdateSettings = (bool) ($canUpdateSettings ?? false);
|
|
$isReadOnly = !$canUpdateSettings;
|
|
$readonlyAttr = $isReadOnly ? 'readonly' : '';
|
|
$disabledAttr = $isReadOnly ? 'disabled' : '';
|
|
?>
|
|
|
|
<div class="app-details-container">
|
|
<section>
|
|
<?php
|
|
$titlebar = [
|
|
'title' => t('General settings'),
|
|
'backHref' => 'admin/settings',
|
|
'backTitle' => t('Cancel'),
|
|
'actions' => $canUpdateSettings ? [
|
|
[
|
|
'form' => 'settings-general-form',
|
|
'name' => 'action',
|
|
'value' => 'save',
|
|
'class' => 'secondary outline',
|
|
'label' => t('Save'),
|
|
],
|
|
[
|
|
'form' => 'settings-general-form',
|
|
'name' => 'action',
|
|
'value' => 'save_close',
|
|
'class' => 'primary',
|
|
'label' => t('Save & close'),
|
|
],
|
|
] : [],
|
|
];
|
|
require templatePath('partials/app-details-titlebar.phtml');
|
|
?>
|
|
|
|
<form id="settings-general-form" method="post" data-details-storage="settings-general-details-v1" data-standard-detail-form="1">
|
|
<details class="app-details-card" name="settings-general-app-identity" data-details-key="settings-general-app-identity" open>
|
|
<summary>
|
|
<span class="app-details-card-summary-title"><?php e(t('App identity')); ?></span>
|
|
<span class="app-details-card-summary-meta">
|
|
<span class="badge" data-variant="neutral"><?php e($appTitle !== '' ? t('Configured') : t('Default')); ?></span>
|
|
<span class="badge" data-variant="neutral"><?php e($appLocale !== '' ? strtoupper($appLocale) : t('Default')); ?></span>
|
|
</span>
|
|
</summary>
|
|
<div class="app-details-card-container">
|
|
<div class="grid">
|
|
<label class="app-field">
|
|
<span><?php e(t('App title')); ?> <span class="badge" data-variant="info"><?php e(t('Cached')); ?></span></span>
|
|
<input type="text" name="app_title" value="<?php e($appTitle); ?>" placeholder="<?php e(appTitle()); ?>" <?php e($readonlyAttr); ?>>
|
|
<small><?php e(t($appTitleDesc)); ?></small>
|
|
</label>
|
|
<label class="app-field">
|
|
<span><?php e(t('Default language')); ?> <span class="badge" data-variant="info"><?php e(t('Cached')); ?></span></span>
|
|
<select name="app_locale" <?php e($disabledAttr); ?>>
|
|
<option value=""><?php e(t('None')); ?></option>
|
|
<?php foreach ($locales as $locale): ?>
|
|
<?php
|
|
$label = strtoupper($locale);
|
|
if ($locale === 'de') {
|
|
$label = t('German');
|
|
} elseif ($locale === 'en') {
|
|
$label = t('English');
|
|
}
|
|
?>
|
|
<option value="<?php e($locale); ?>" <?php e($appLocale === $locale ? 'selected' : ''); ?>>
|
|
<?php e($label); ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<small><?php e(t($appLocaleDesc)); ?></small>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<?php $configuredDefaultsCount = (int) ($defaultTenantId > 0) + (int) ($defaultDepartmentId > 0) + (int) ($defaultRoleId > 0); ?>
|
|
<details class="app-details-card" name="user-creation" data-details-key="user-creation">
|
|
<summary>
|
|
<span class="app-details-card-summary-title"><?php e(t('User creation defaults')); ?></span>
|
|
<span class="app-details-card-summary-meta">
|
|
<span class="badge" data-variant="neutral"><?php e(sprintf(t('%d defaults configured'), $configuredDefaultsCount)); ?></span>
|
|
</span>
|
|
</summary>
|
|
<div class="app-details-card-container">
|
|
<blockquote data-variant="info">
|
|
<small><?php e(t('These defaults prefill tenant, department and role when new users are created.')); ?></small>
|
|
</blockquote>
|
|
<div class="grid">
|
|
<label class="app-field">
|
|
<span><?php e(t('Default tenant')); ?></span>
|
|
<select name="default_tenant_id" <?php e($disabledAttr); ?>>
|
|
<option value=""><?php e(t('None')); ?></option>
|
|
<?php foreach ($tenants ?? [] as $tenant): ?>
|
|
<?php $tenantId = (int) ($tenant['id'] ?? 0); ?>
|
|
<?php if ($tenantId > 0): ?>
|
|
<option value="<?php e((string) $tenantId); ?>" <?php e($tenantId === $defaultTenantId ? 'selected' : ''); ?>>
|
|
<?php e($tenant['description'] ?? ''); ?>
|
|
</option>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
<label class="app-field">
|
|
<span><?php e(t('Default department')); ?></span>
|
|
<select name="default_department_id" <?php e($disabledAttr); ?>>
|
|
<option value=""><?php e(t('None')); ?></option>
|
|
<?php foreach ($departments ?? [] as $department): ?>
|
|
<?php $departmentId = (int) ($department['id'] ?? 0); ?>
|
|
<?php if ($departmentId > 0): ?>
|
|
<option value="<?php e((string) $departmentId); ?>" <?php e($departmentId === $defaultDepartmentId ? 'selected' : ''); ?>>
|
|
<?php e($department['description'] ?? ''); ?>
|
|
</option>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
<label class="app-field">
|
|
<span><?php e(t('Default role')); ?></span>
|
|
<select name="default_role_id" <?php e($disabledAttr); ?>>
|
|
<option value=""><?php e(t('None')); ?></option>
|
|
<?php foreach ($roles ?? [] as $role): ?>
|
|
<?php $roleId = (int) ($role['id'] ?? 0); ?>
|
|
<?php if ($roleId > 0): ?>
|
|
<option value="<?php e((string) $roleId); ?>" <?php e($roleId === $defaultRoleId ? 'selected' : ''); ?>>
|
|
<?php e($role['description'] ?? ''); ?>
|
|
</option>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
</details>
|
|
|
|
<?php Session::getCsrfInput(); ?>
|
|
</form>
|
|
</section>
|
|
<aside id="app-details-aside-section">
|
|
<div class="app-details-aside-section"></div>
|
|
</aside>
|
|
</div>
|