<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } RBAC::enforce('view.listings'); require_once __DIR__ . '/../modules/store/stores_data.php'; ?> <div class="workspace" id="ws-stores"> <div class="workspace-header"> <h1>Stores</h1> <div class="workspace-actions"> <a href="?view=stores&edit=0" class="btn-primary">+ New Store</a> </div> </div><?php if ($msg === 'saved'): ?> <div class="toast toast-ok"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><polyline points="20 6 9 17 4 12"/></svg> Store saved.<?php if ($syncErr): ?> <span class="str-sync-badge str-sync-err">SYNC FAILED</span><?php else: ?> <span class="str-sync-badge str-sync-ok">GATEWAY SYNCED</span><?php endif; ?> </div><?php elseif ($msg === 'deleted'): ?> <div class="toast toast-del">Store removed. Products moved to inactive.<span class="str-sync-badge str-sync-ok">GATEWAY SYNCED</span></div><?php elseif ($msg === 'toggled'): ?> <div class="toast toast-ok"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><polyline points="20 6 9 17 4 12"/></svg> Status toggled.<span class="str-sync-badge str-sync-ok">GATEWAY SYNCED</span></div><?php endif; ?> <?php if ($editId !== null && ($editId === 0 || $editStore)): ?> <?php require_once __DIR__ . '/../modules/store/stores_edit_form.php'; ?> <?php endif; ?> <?php require_once __DIR__ . '/../modules/store/stores_grid.php'; ?> </div> <script nonce="<?= $cspNonce ?? '' ?>"> (function(){ document.querySelectorAll('[data-confirm]').forEach(function(f){ f.addEventListener('submit',function(e){if(!confirm(f.dataset.confirm))e.preventDefault();}); }); })(); </script>