<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } ?> <div class="faq-form"> <div class="faq-form-title"><?= $editFaq ? 'Edit FAQ' : 'New FAQ Entry' ?> <?php if ($editFaq): ?> <span style="margin-left:auto;font-size:9px;font-family:monospace;color:rgba(200,204,212,.2)">fq_<?= htmlspecialchars($editFaq['public_id']) ?></span><?php endif; ?> </div> <form method="POST"><?= CSRF::field() ?> <input type="hidden" name="faq_action" value="save"><?php if ($editFaq): ?> <input type="hidden" name="faq_id" value="<?= $editFaq['id'] ?>"><?php endif; ?> <div class="faq-form-grid"> <div><label>Store Scope</label><select name="faq_store_id"><option value="">Universal (All Stores)</option><?php foreach ($faqStores as $s): ?> <option value="<?= $s['id'] ?>"<?= ($editFaq && (string)($editFaq['store_id'] ?? '') === (string)$s['id']) ? 'selected' : '' ?>><?= htmlspecialchars($s['display']) ?></option><?php endforeach; ?></select></div> <div><label>Tab Group (encrypted)</label><input type="text" name="tab_group" value="<?= htmlspecialchars($editFaq['tab_group'] ?? '') ?>" placeholder="e.g. Shipping, Returns, Account..." list="faq-tab-groups"> <datalist id="faq-tab-groups"><?php foreach ($tabGroups as $tg): ?><option value="<?= htmlspecialchars($tg) ?>"><?php endforeach; ?></datalist></div> </div> <div class="faq-form-grid"> <div><label>Display Order</label><input type="number" name="display_order" value="<?= $editFaq['display_order'] ?? 0 ?>" min="0"></div> <div style="display:flex;align-items:end;gap:12px;padding-bottom:8px"> <label style="display:flex;align-items:center;gap:6px;cursor:pointer;margin:0"><input type="checkbox" name="is_active"<?= (!$editFaq || ($editFaq['is_active'] ?? 1)) ? 'checked' : '' ?> style="width:auto"><span style="font-size:10px;font-weight:700;color:rgba(200,204,212,.5)">Active</span></label> </div> </div> <div style="margin-bottom:14px"><label>Question (encrypted)</label><input type="text" name="question" value="<?= htmlspecialchars($editFaq['question'] ?? '') ?>" placeholder="What is your return policy?" required></div> <div style="margin-bottom:14px"><label>Answer (encrypted)</label><textarea name="answer" placeholder="Full answer -- supports HTML for formatting..." required><?= htmlspecialchars($editFaq['answer'] ?? '') ?></textarea></div> <div class="faq-form-actions"> <button type="submit" class="btn btn-accent"><?= $editFaq ? 'Update FAQ' : 'Create FAQ' ?></button><?php if ($editFaq): ?> <a href="?view=faq" class="btn btn-ghost">Cancel</a><?php endif; ?> </div> </form> </div>