Filling edit form
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
const idx = Math.max(this.data.selected.length, 0, Math.max(...this.data.selected) + 1)
|
||||
this.data.selected.push(idx)
|
||||
this.draw.promotions()
|
||||
return idx
|
||||
}
|
||||
reset() {
|
||||
this.data.selected = []
|
||||
@ -86,6 +87,16 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
async fill(promotions) {
|
||||
if (reservations.locks.promotions !== null) {
|
||||
await reservations.locks.promotions
|
||||
}
|
||||
promotions.forEach(promotion => {
|
||||
const idx = this.add()
|
||||
const dropdown = $(this.components.promotions.querySelector(`div.promotion[data-id="${idx}"]`).querySelector('div.dropdown'))
|
||||
dropdown.dropdown('set selected', promotion.id)
|
||||
})
|
||||
}
|
||||
setup() {
|
||||
this.components.button = document.getElementById(this.ids.button)
|
||||
this.components.promotions = document.getElementById(this.ids.elements)
|
||||
|
||||
Reference in New Issue
Block a user