From 43bf840b943f17d68472ceeef01b4a040f3ed9a2 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:11:30 -0500 Subject: [PATCH] "Add All Zones" button This adds a "Add All Zones" button to the multiple zones selector used for RenderWithZones. This addresses the Issue # 775 --- .../html/js/entityProperties.js | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 5a20ae6f20..bb38e10a82 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -3722,6 +3722,25 @@ function addZoneToZonesSelection(propertyId, id) { document.getElementById("zones-select-selector-list-panel-" + propertyId).style.display = "none"; } +function addAllZonesToZonesSelection (propertyId) { + let hiddenField = document.getElementById(propertyId); + if (JSON.stringify(hiddenField.value) === '"undefined"') { + hiddenField.value = "[]"; + } + let selectedZones = JSON.parse(hiddenField.value); + let i; + for (i = 0; i < zonesList.length; i++) { + if (!selectedZones.includes(zonesList[i].id)) { + selectedZones.push(zonesList[i].id); + } + } + hiddenField.value = JSON.stringify(selectedZones); + displaySelectedZones(propertyId, true); + let propertyName = propertyId.replace("property-", ""); + updateProperty(propertyName, selectedZones, false); + document.getElementById("zones-select-selector-list-panel-" + propertyId).style.display = "none"; +} + function removeZoneFromZonesSelection(propertyId, zoneId) { let hiddenField = document.getElementById(propertyId); if (JSON.stringify(hiddenField.value) === '"undefined"') { @@ -3813,7 +3832,10 @@ function setZonesSelectionData(element, isEditable) { zoneSelector += ""; zoneSelector += "