Refactor settings logic; streamline brand and item type creation, enhance ComboBoxWidget integration for improved usability

This commit is contained in:
Yaro Kasear 2025-06-23 10:13:22 -05:00
parent c6fc1a4795
commit 347baaa12e
3 changed files with 40 additions and 35 deletions

View file

@ -21,19 +21,13 @@
</select>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
ComboBoxWidget.initComboBox("{{ id }}", {
onAdd: function(newItem, list, createOption) {
{% if onAdd %}
{{ onAdd | safe }}
{% else %}
ComboBoxWidget.handleComboAdd('{{ id }}-input', '{{ id }}-list', '{{ id }}s', '{{ label or id }}');
{% endif %}
},
{% if onRemove %}onRemove: function(option) { {{ onRemove | safe }} },{% endif %}
{% if onEdit %}onEdit: function(option) { {{ onEdit | safe }} }{% endif %}
<script>
document.addEventListener('DOMContentLoaded', () => {
ComboBoxWidget.initComboBox("{{ id }}", {
{% if onAdd %}onAdd: function(newItem, list, createOption) { {{ onAdd | safe }} },{% endif %}
{% if onRemove %}onRemove: function(option) { {{ onRemove | safe }} },{% endif %}
{% if onEdit %}onEdit: function(option) { {{ onEdit | safe }} }{% endif %}
});
});
});
</script>
</script>
{% endmacro %}