Spaces:
Running
Running
| // Request notification permission on page load | |
| document.addEventListener('DOMContentLoaded', async () => { | |
| // Request notification permission | |
| if ('Notification' in window) { | |
| try { | |
| const permission = await Notification.requestPermission(); | |
| console.log('Notification permission:', permission); | |
| } catch (err) { | |
| console.error('Notification permission error:', err); | |
| } | |
| } | |
| // Theme toggle | |
| const themeToggle = document.getElementById('theme-toggle'); | |
| themeToggle.addEventListener('click', () => { | |
| document.documentElement.classList.toggle('dark'); | |
| const icon = themeToggle.querySelector('i'); | |
| if (document.documentElement.classList.contains('dark')) { | |
| feather.icons['moon'].toSvg().then(svg => icon.innerHTML = svg); | |
| } else { | |
| feather.icons['sun'].toSvg().then(svg => icon.innerHTML = svg); | |
| } | |
| }); | |
| // Add column button | |
| const addColumnBtn = document.getElementById('add-column'); | |
| const orderBoard = document.getElementById('order-board'); | |
| addColumnBtn.addEventListener('click', () => { | |
| const columnName = prompt('Enter order type name:'); | |
| if (columnName) { | |
| const column = document.createElement('order-column'); | |
| column.setAttribute('title', columnName); | |
| orderBoard.appendChild(column); | |
| } | |
| }); | |
| // Initialize with default columns if empty | |
| if (orderBoard.children.length === 0) { | |
| const defaultColumns = ['Order', 'Order Completed', 'Order Paid']; | |
| defaultColumns.forEach(title => { | |
| const column = document.createElement('order-column'); | |
| column.setAttribute('title', title); | |
| orderBoard.appendChild(column); | |
| }); | |
| } | |
| }); |