diff --git a/tampermonkey-script/GAIA-Swissknife.user.js b/tampermonkey-script/GAIA-Swissknife.user.js index b6d5caa..6fc8d4c 100644 --- a/tampermonkey-script/GAIA-Swissknife.user.js +++ b/tampermonkey-script/GAIA-Swissknife.user.js @@ -234,7 +234,7 @@ GM_addStyle(GM_getResourceText("DataTablesCSS")); } } - // Funzione per aggiungere il pulsante "Apri tutti i Curriculum" sezione iscritti + // Funzione per aggiungere il pulsante "Apri tutti i Curriculum" sezione iscritti di un corso function addOpenAllProfilesButton() { if (!window.location.href.includes('/iscritti/')) return; @@ -352,170 +352,125 @@ GM_addStyle(GM_getResourceText("DataTablesCSS")); function addAuthorizationProfileTool() { if (!window.location.href.includes("/autorizzazioni/")) return; - // Crea la finestra modale + console.log("GAIA Swissknife: Attivo tool per gestione richieste iscrizione..."); + + const richieste = []; + + $(".panel.panel-default").each(function () { + const $panel = $(this); + const $corsoLink = $panel.find("a[href^='/aspirante/corso-base/']"); + + if ($corsoLink.length === 0) return; // blocco non relativo a richiesta corso + + const corsoText = $corsoLink.text().trim(); + const match = corsoText.match(/([A-Z]{3,}\/\d{4}\/[A-Z]+\/\d+)/); + if (!match) return; + + const codiceCorso = match[1]; + const $profileLink = $panel.find("a[href^='/profilo/']").first(); + const nome = $profileLink.text().trim(); + const href = $profileLink.attr("href"); + const idMatch = href.match(/\/profilo\/(\d+)\//); + + if (idMatch && idMatch[1]) { + richieste.push({ + codice: codiceCorso, + nome, + id: idMatch[1], + $panel + }); + } + }); + + const corsiUnici = [...new Set(richieste.map(r => r.codice))]; + if (corsiUnici.length === 0) return; + + // === CREAZIONE MODALE === const $modal = $(` -