feat(helpdesk): show manual domain input when customer has no domains

When the domain API returns an empty list for a selected customer, the
domain select is replaced with two text inputs: domain name (required)
and URL (optional). JS syncs the manual values into the existing hidden
domain_no/domain_url fields so the server-side validation and save logic
is unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
aminovfariz
2026-06-08 10:04:27 +02:00
parent 2b230e756e
commit 0fc2d3f2c3
4 changed files with 63 additions and 4 deletions

View File

@@ -149,11 +149,23 @@ if ($canManage && $mode === 'assign' && $step === 2) {
data-initial-domain="<?php e($form['domain_no'] ?? ''); ?>"
>
<label for="wizard-domain"><?php e(t('Domain')); ?> <span class="handover-form-required">*</span></label>
<select id="wizard-domain" name="domain_no" disabled>
<option value=""><?php e(t('Select a customer first...')); ?></option>
</select>
<div class="app-wizard-domain-select-wrap">
<select id="wizard-domain" name="domain_no" disabled>
<option value=""><?php e(t('Select a customer first...')); ?></option>
</select>
</div>
<input type="hidden" name="domain_url" id="wizard-domain-url" value="<?php e($form['domain_url'] ?? ''); ?>">
<div id="wizard-domain-feedback" class="app-wizard-field-feedback" role="alert" hidden></div>
<!-- Manual entry — shown by JS when no domains exist for this customer -->
<div id="wizard-domain-manual" hidden>
<p class="app-wizard-field-hint"><?php e(t('No domains found for this customer. Enter domain name manually:')); ?></p>
<input type="text" id="wizard-domain-manual-no" placeholder="<?php e(t('Domain name (e.g. example.de)')); ?>"
value="<?php e($form['domain_no'] ?? ''); ?>" autocomplete="off">
<input type="text" id="wizard-domain-manual-url" placeholder="<?php e(t('URL (optional, e.g. https://example.de)')); ?>"
value="<?php e($form['domain_url'] ?? ''); ?>" autocomplete="off" style="margin-top:0.4rem;">
</div>
<?php if (!empty($errors['domain_no'])): ?>
<p class="field-error"><?php e($errors['domain_no']); ?></p>
<?php endif; ?>