Standardize global empty-state UI component

This commit is contained in:
2026-03-11 21:38:15 +01:00
parent 51e9a5c19a
commit a1c7c9cf7d
7 changed files with 147 additions and 18 deletions

View File

@@ -678,15 +678,25 @@ foreach ($tenants as $tenant) {
<p class="muted"><?php e(t('Assign tenants first to edit custom fields')); ?></p>
<?php else: ?>
<?php $hasRenderedCustomFields = false; ?>
<?php $hasConfiguredTenantDefinitions = false; ?>
<?php foreach ($customFieldTenantMap as $tenantId => $tenant): ?>
<?php $tenantDefinitions = $customFieldDefinitionsByTenant[$tenantId] ?? []; ?>
<?php if ($tenantDefinitions): ?>
<?php $hasConfiguredTenantDefinitions = true; ?>
<?php endif; ?>
<details name="custom-fields-tenant" data-details-key="custom-fields-tenant-<?php e((string) $tenantId); ?>">
<summary>
<?php e((string) ($tenant['description'] ?? t('Custom fields for tenant'))); ?>
</summary>
<hr>
<?php if (!$tenantDefinitions): ?>
<p class="muted"><?php e(t('No custom fields configured for this tenant')); ?></p>
<?php
$emptyState = [
'message' => t('No custom fields configured for this tenant'),
'size' => 'compact',
];
require templatePath('partials/app-empty-state.phtml');
?>
<?php else: ?>
<div>
<?php foreach ($tenantDefinitions as $definition): ?>
@@ -829,8 +839,14 @@ foreach ($tenants as $tenant) {
</details>
<hr>
<?php endforeach; ?>
<?php if (!$hasRenderedCustomFields): ?>
<p class="muted"><?php e(t('No custom fields configured for selected tenants')); ?></p>
<?php if (!$hasRenderedCustomFields && $hasConfiguredTenantDefinitions): ?>
<?php
$emptyState = [
'message' => t('No custom fields configured for selected tenants'),
'size' => 'compact',
];
require templatePath('partials/app-empty-state.phtml');
?>
<?php endif; ?>
<?php endif; ?>
</div>