Add read-only client and coach code fields in questionnaire preview
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-06-06 16:40:19 +02:00
parent 8fdaefe10b
commit 4589be119c
2 changed files with 24 additions and 3 deletions

View File

@ -2578,6 +2578,16 @@ select:disabled {
background: var(--surface);
color: var(--text);
}
.qp-review-note {
margin-bottom: 4px;
}
.qp-review-codes .qp-readonly-field {
background: var(--bg, #f4f4f5);
color: var(--text-secondary);
cursor: default;
border-style: dashed;
user-select: all;
}
.qp-glass-table {
overflow-x: auto;
margin-top: 8px;

View File

@ -12,6 +12,10 @@ const GLASS_LABELS = [
{ key: 'extreme_glass', label: 'Extreme' },
];
/** Sample codes shown in preview (read-only), mimicking the app after load/login. */
const PREVIEW_CLIENT_CODE = 'CLIENT-042';
const PREVIEW_COACH_CODE = 'coach.demo';
const MONTHS = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December',
@ -395,9 +399,16 @@ function renderQuestionBody(q, sectionIdx) {
case 'client_coach_code_question':
inner += `
<div class="qp-form-stack">
<label>Client code<input type="text" data-field="client"></label>
<label>Coach code<input type="text" data-field="coach"></label>
<p class="qp-hint qp-review-note">In the app, client and coach codes are loaded automatically — coaches review them here, not type them in.</p>
<div class="qp-form-stack qp-review-codes">
<label>Client code
<input type="text" class="qp-readonly-field" data-field="client"
value="${esc(PREVIEW_CLIENT_CODE)}" readonly tabindex="-1" aria-readonly="true">
</label>
<label>Coach code
<input type="text" class="qp-readonly-field" data-field="coach"
value="${esc(PREVIEW_COACH_CODE)}" readonly tabindex="-1" aria-readonly="true">
</label>
</div>`;
break;