<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } ?> <div class="rm"> <div class="rm-header"> <h2>Storefront Layout Manager</h2> <select class="rm-store-select" id="rm-store-select" onchange="location.href='?view=page_editor&store='+this.value"><?php foreach ($stores as $s): ?> <option value="<?= (int)$s['id'] ?>"<?= (int)$s['id'] === $editorStoreId ? ' selected' : '' ?>><?= htmlspecialchars($s['nickname'] ?: $s['domain']) ?> (<?= htmlspecialchars($s['domain']) ?>)</option><?php endforeach; ?> </select> <button class="rm-btn rm-btn-primary" id="rm-add-row-btn">+ Add Row</button> <button class="rm-btn rm-btn-save" id="rm-save-order-btn" style="display:none">Save Order</button> </div> <div class="rm-rows" id="rm-rows"><?php if (empty($storeRows)): ?> <div style="text-align:center; padding:40px; color:rgba(200,204,212,.3); font-size:13px;">No rows configured for this store. Click "Add Row" to get started.</div><?php else: ?> <?php foreach ($storeRows as $i => $sr): $typeInfo = $rowTypeLabels[$sr['row_type']] ?? ['label' => $sr['row_type'], 'icon' => '?', 'desc' => '']; ?> <div class="rm-row" draggable="true" data-row-id="<?= (int)$sr['id'] ?>" data-row-type="<?= htmlspecialchars($sr['row_type']) ?>" data-sort="<?= (int)$sr['sort_order'] ?>"> <span class="rm-row-drag">&#8942;&#8942;</span> <span class="rm-row-order">#<?= $i ?></span> <span class="rm-row-icon"><?= $typeInfo['icon'] ?></span> <div class="rm-row-info"> <div class="rm-row-type"><?= htmlspecialchars($typeInfo['label']) ?></div> <div class="rm-row-label"><?= htmlspecialchars($sr['label'] ?: '—') ?></div> </div> <div class="rm-row-actions"> <button class="rm-row-btn rm-btn-edit" data-row-id="<?= (int)$sr['id'] ?>">Edit</button> <button class="rm-row-btn rm-btn-del" data-row-id="<?= (int)$sr['id'] ?>">&times;</button> </div> </div><?php endforeach; ?> <?php endif; ?> </div> <div class="rm-edit-panel" id="rm-edit-panel"> <h4 id="rm-edit-title">Edit Row</h4> <div id="rm-edit-form"></div> <div style="margin-top:14px; display:flex; gap:8px;"> <button class="rm-btn rm-btn-save" id="rm-edit-save">Save Row</button> <button class="rm-btn rm-btn-primary" id="rm-edit-cancel">Cancel</button> </div> </div> </div> <div class="rm-modal-bg" id="rm-modal"> <div class="rm-modal"> <h3>Add Row Type</h3> <div class="rm-type-grid"><?php foreach ($rowTypeLabels as $type => $info): ?> <div class="rm-type-option" data-type="<?= $type ?>"> <div class="rm-type-option-icon"><?= $info['icon'] ?></div> <div class="rm-type-option-label"><?= htmlspecialchars($info['label']) ?></div> <div class="rm-type-option-desc"><?= htmlspecialchars($info['desc']) ?></div> </div><?php endforeach; ?> </div> </div> </div> <div class="rm-toast" id="rm-toast"></div>