diff --git a/web/components/management/section.js b/web/components/management/section.js index a262d7d318045e3303f10e2a5e258eb5f43ca972..18e003d1274194639162cc1484cd108719915d04 100644 --- a/web/components/management/section.js +++ b/web/components/management/section.js @@ -106,6 +106,12 @@ class Section { <input class="input" type="text" id="section-modal-name" /> </div> </div> + <div class="field"> + <label>Identifiant de carte</label> + <div class="control"> + <input class="input" type="number" id="section-modal-mapID" /> + </div> + </div> </section> <footer class="modal-card-foot"> <button id="section-modal-save" class="button is-success"> @@ -167,11 +173,9 @@ class Section { }); }); - document - .getElementById(`section-new`) - .addEventListener("click", () => { - this.newSection(this.area); - }); + document.getElementById(`section-new`).addEventListener("click", () => { + this.newSection(this.area); + }); } emptySections() { @@ -231,6 +235,7 @@ class Section { this.area = area; document.getElementById("section-modal-id").value = null; document.getElementById("section-modal-name").value = area.Name; + document.getElementById("section-modal-mapID").value = null; Common.toggleModal("section-modal", "section-modal-card"); } @@ -238,6 +243,7 @@ class Section { this.method = "PUT"; document.getElementById("section-modal-id").value = section.ID; document.getElementById("section-modal-name").value = section.Name; + document.getElementById("section-modal-mapID").value = section.MapID; Common.toggleModal("section-modal", "section-modal-card"); } @@ -250,7 +256,8 @@ class Section { this.method, parseInt(document.getElementById("section-modal-id").value), this.area.ID, - document.getElementById("section-modal-name").value + document.getElementById("section-modal-name").value, + document.getElementById("section-modal-mapID").value ); await this.displaySections(); Common.toggleModal("section-modal", "section-modal-card"); @@ -272,7 +279,6 @@ class Section { await this.SectionModel.deleteSections(section.ID); this.displaySections(); this.parent.deskHandler.emptyDesks(); - document.getElementById("desk-new").setAttribute("disabled", "true"); } async cloneSections(areaCloned, areaToClone) { @@ -286,7 +292,8 @@ class Section { "POST", null, areaCloned.ID, - sectionToClone.Name + sectionToClone.Name, + sectionToClone.MapID ); await sectionHandler.parent.deskHandler.cloneDesks( sectionCloned, diff --git a/web/services/model/section-model.js b/web/services/model/section-model.js index 96c4a2815b3b949894fe3fb160d8b087691f84ed..4c177f324c6c99f164e610122bf500e571aa13d9 100644 --- a/web/services/model/section-model.js +++ b/web/services/model/section-model.js @@ -44,7 +44,7 @@ class SectionModel { return this.sections; } - async saveSection(method, ID, AreaID, Name) { + async saveSection(method, ID, AreaID, Name, MapID) { try { const response = await fetch("/api/Section/" + ID, { method: method, @@ -55,6 +55,7 @@ class SectionModel { ID: ID, AreaID: AreaID, Name: Name, + MapID: MapID, }), }); if (response.status !== 200) {