From fa6ff639a5d09febba2c7e66b0a35ff55b1e53d6 Mon Sep 17 00:00:00 2001 From: tranjennie Date: Wed, 6 Dec 2023 05:11:40 -0800 Subject: [PATCH] INTGR-203: feat / Add full list of HOS rulesets --- src/software/js-samples/importUsers.html | 117 ++++++----------------- 1 file changed, 29 insertions(+), 88 deletions(-) diff --git a/src/software/js-samples/importUsers.html b/src/software/js-samples/importUsers.html index 6e105fd78..3e061046e 100644 --- a/src/software/js-samples/importUsers.html +++ b/src/software/js-samples/importUsers.html @@ -489,93 +489,7 @@

DEVELOPER SAMPLE

- +

@@ -866,7 +780,8 @@

Template

document.addEventListener('click', toggleDocs, true); - document.addEventListener("DOMContentLoaded", function() { + document.addEventListener("DOMContentLoaded", function() { + populateHOSRuleSetSelect(); document.getElementById("content").addEventListener("keyup", function(event) { event.preventDefault(); @@ -1475,6 +1390,32 @@

Template

else alert("Custom NFC Key Serial Number must be between 0 and 72057594037927940.") return keys; } + + function getHOSRuleSet() { + return new Promise(function (resolve, reject) { + api.call("GetHosRuleSets", { + // empty + }, function (result) { + resolve(result); + }, function (error) { + reject(error); + }); + }); + } + async function populateHOSRuleSetSelect() { + try { + const hosRuleSetSelect = document.getElementById("options_hosRuleSet"); + const result = await getHOSRuleSet(); + result.forEach((option) => { + const optionElement = document.createElement("option"); + optionElement.value = option.id; + optionElement.textContent = option.name; + hosRuleSetSelect.appendChild(optionElement); + }); + } catch (error) { + console.error("Error fetching HOS Rule Set:", error); + } + }