Finished combobox integration!!!!!!
This commit is contained in:
parent
1ea6cd9588
commit
7854e9c910
2 changed files with 16 additions and 0 deletions
|
|
@ -36,6 +36,8 @@ function ComboBox(cfg) {
|
|||
const id = this.editingOption.value;
|
||||
const ok = await this._post(this.editUrl, { id, name });
|
||||
if (ok) this.editingOption.textContent = name;
|
||||
|
||||
this.$dispatch('combobox:item-edited', { id, name, ...this.editingOption.dataset });
|
||||
} else if (this.createUrl) {
|
||||
const data = await this._post(this.createUrl, { name }, true);
|
||||
const id = (data && data.id) ? data.id : ('temp-' + Math.random().toString(36).slice(2));
|
||||
|
|
|
|||
|
|
@ -239,5 +239,19 @@
|
|||
const roomEditorModal = new bootstrap.Modal(document.getElementById('roomEditor'));
|
||||
roomEditorModal.show();
|
||||
});
|
||||
|
||||
container.addEventListener('combobox:item-edited', (e) => {
|
||||
if (container.id !== 'room-container') return;
|
||||
|
||||
const { id, name, area_id, function_id } = e.detail;
|
||||
console.log(id, name, area_id, function_id)
|
||||
const prep = new CustomEvent('roomEditor:prepare', {
|
||||
detail: { id, name, sectionId: area_id, functionId: function_id }
|
||||
});
|
||||
document.getElementById('roomEditor').dispatchEvent(prep);
|
||||
|
||||
const roomEditorModal = new bootstrap.Modal(document.getElementById('roomEditor'));
|
||||
roomEditorModal.show();
|
||||
});
|
||||
})();
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue