drawer menu view edit

drawermenu:
1. contact info: address,phone,location
2. working hours
3. description
4. social links
This commit is contained in:
2026-04-09 18:08:31 +07:00
parent b6f1b92feb
commit 324166e07a
2 changed files with 57 additions and 33 deletions

View File

@@ -13,6 +13,7 @@
<div class="content-with-fixed-buttons">
<!-- Hidden inputs for JSON data -->
<input type="hidden" name="topbarJson" id="topbarJson" />
<input type="hidden" name="offcanvasJson" id="offcanvasJson" />
<input type="hidden" name="logo" id="logoInput" />
<input type="hidden" name="activeTab" id="activeTabInput" value="topbar" />
<input type="hidden" name="menuUpdates" id="menuUpdates" />
@@ -99,6 +100,25 @@
placeholder="69 Street, 5th Avenue LA, United States"
/>
</div>
<div class="col-md-6">
<label class="form-label fw-medium">Working Hours <small class="text-muted fw-normal">(Drawer Menu)</small></label>
<input
type="text"
class="form-control"
id="offcanvasWorkingHours"
value="<%= (data.header && data.header.offcanvas && data.header.offcanvas.contactInfo && data.header.offcanvas.contactInfo.workingHours) ? data.header.offcanvas.contactInfo.workingHours : '' %>"
placeholder="Mon-Friday, 09am - 05pm"
/>
</div>
<div class="col-md-12">
<label class="form-label fw-medium">Offcanvas Description <small class="text-muted fw-normal">(Drawer Menu)</small></label>
<textarea
class="form-control"
id="offcanvasDescription"
rows="3"
placeholder="Short description displayed in the offcanvas sidebar..."
><%= (data.header && data.header.offcanvas && data.header.offcanvas.description) ? data.header.offcanvas.description : '' %></textarea>
</div>
</div>
</div>
</div>
@@ -179,6 +199,7 @@
</div>
</div>
<!-- Menu Structure Tab -->
<div class="tab-pane fade <%= activeTab === 'menu' ? 'show active' : '' %>" id="menu" role="tabpanel">
<%- include('menu') %>
@@ -349,6 +370,7 @@
// 1. Collect and Save Topbar & Logo
const headerData = {
topbarJson: document.getElementById('topbarJson').value,
offcanvasJson: document.getElementById('offcanvasJson').value,
logo: document.getElementById('logoInput').value,
activeTab: document.getElementById('activeTabInput').value
};
@@ -421,6 +443,18 @@
document.getElementById('topbarJson').value = JSON.stringify(topbarData);
document.getElementById('logoInput').value = document.getElementById('logoImage').value || '';
// Collect offcanvas data — phone/email/address shared from topbar
const offcanvasData = {
description: document.getElementById('offcanvasDescription').value || '',
contactInfo: {
phone: document.getElementById('contactPhone').value || '',
email: document.getElementById('contactEmail').value || '',
address: document.getElementById('contactLocation').value || '',
workingHours: document.getElementById('offcanvasWorkingHours').value || ''
}
};
document.getElementById('offcanvasJson').value = JSON.stringify(offcanvasData);
try {
const menuUpdates = collectMenuUpdates();
document.getElementById('menuUpdates').value = JSON.stringify(menuUpdates);