{% extends "layout.html" %} {% block title %}{{ title }}{% endblock %} {% block content %}
{{ breadcrumbs.breadcrumb_header( title=title, submit_button=True ) }}
Inventory Settings
{{ combos.render_combobox( id='brand', options=brands, label='Brands', placeholder='Add a new brand' ) }}
{{ combos.render_combobox( id='type', options=types, label='Inventory Types', placeholder='Add a new type' ) }}
Location Settings
{{ combos.render_combobox( id='section', options=sections, label='Sections', placeholder='Add a new section' ) }}
{{ combos.render_combobox( id='function', options=functions, label='Functions', placeholder='Add a new function' ) }}
{% set room_editor %} const roomEditor = new bootstrap.Modal(document.getElementById('roomEditor')); const roomNameInput = document.getElementById('roomName'); roomNameInput.value = document.getElementById('room-input').value; roomEditor.show(); {% endset %}
{{ combos.render_combobox( id='room', options=rooms, label='Rooms', placeholder='Add a new room', onAdd=room_editor ) }}
{% endblock %} {% block script %} document.addEventListener('DOMContentLoaded', () => { const modal = document.getElementById('roomEditor'); const saveButton = document.getElementById('roomEditorSaveButton'); const cancelButton = document.getElementById('roomEditorCancelButton'); saveButton.addEventListener('click', () => { console.log('Save button clicked'); const name = document.getElementById('roomName').value; const section = document.getElementById('roomSection').value; const func = document.getElementById('roomFunction').value; if (name.trim()) { const newRoom = ComboBoxWidget.createOption(`${name}`, null); const selectWidget = document.getElementById('room-list'); selectWidget.appendChild(newRoom); ComboBoxWidget.sortOptions(selectWidget); bootstrap.Modal.getInstance(modal).hide(); } else { alert('Please enter a room name.'); } }); cancelButton.addEventListener('click', () => { console.log('Cancel button clicked'); bootstrap.Modal.getInstance(modal).hide(); }); }); {% endblock %}