Implement sync_from_state methods for Area, Brand, Item, RoomFunction, and Room models; enhance entity management and foreign key resolution in settings

This commit is contained in:
Yaro Kasear 2025-06-25 09:31:05 -05:00
parent 8a5c5db9e0
commit 7833c4828b
9 changed files with 359 additions and 186 deletions

View file

@ -1,10 +1,14 @@
const ComboBoxWidget = (() => {
let tempIdCounter = -1;
let tempIdCounter = 1;
function createTempId(prefix = "temp") {
return `${prefix}-${tempIdCounter++}`;
}
function createOption(text, value = null) {
const option = document.createElement('option');
option.textContent = text;
option.value = value ?? (tempIdCounter--);
option.value = value ?? createTempId();
return option;
}
@ -144,6 +148,7 @@ const ComboBoxWidget = (() => {
initComboBox,
createOption,
sortOptions,
handleComboAdd
handleComboAdd,
createTempId
};
})();