From a05d9fed2be6d43b83f1b8df378d4191095293e6 Mon Sep 17 00:00:00 2001 From: solocla Date: Thu, 26 Mar 2026 11:47:02 +0100 Subject: [PATCH] scheme alphabetical order --- public/userarea/insert_template_xls.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/userarea/insert_template_xls.php b/public/userarea/insert_template_xls.php index 71b1a2e..32b6c8d 100644 --- a/public/userarea/insert_template_xls.php +++ b/public/userarea/insert_template_xls.php @@ -236,7 +236,15 @@ $routines = $stmt->fetchAll(PDO::FETCH_ASSOC); if (!response.ok) throw new Error(data.error || `Errore HTTP: ${response.status}`); const select = document.getElementById("schemaSelect"); select.innerHTML = ''; - data.value.forEach(schema => { + const sortedSchemas = [...data.value].sort((a, b) => { + const nomeA = (a.Nome || "").trim().toLowerCase(); + const nomeB = (b.Nome || "").trim().toLowerCase(); + return nomeA.localeCompare(nomeB, 'it', { + sensitivity: 'base' + }); + }); + + sortedSchemas.forEach(schema => { const nome = schema.Nome || "Nome non disponibile"; const id = schema.IdSchemaCustomFields || "ID non disponibile"; const option = new Option(`${nome.trim()} (ID: ${id})`, id);