From b5c8b755d173fec8aa4b50bc818235022fe3bd81 Mon Sep 17 00:00:00 2001 From: wolfganggreschus Date: Wed, 29 Jan 2025 15:07:51 +0100 Subject: [PATCH] Add deletion preparation for students and improve CSV file handling --- controllers/management/managementLogic.js | 6 ++++++ static/scripts/management.js | 19 +++++++++-------- views/management/management.hbs | 25 +++++++++++++++++++++-- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/controllers/management/managementLogic.js b/controllers/management/managementLogic.js index fbaccd7..988016a 100644 --- a/controllers/management/managementLogic.js +++ b/controllers/management/managementLogic.js @@ -54,12 +54,18 @@ const mainRoute = async function (req, res, next) { 'Link', ]; const policiesBody = createPoliciesBody(consentVersions.data); + + const deletionContainerHead = [ + 'Schüler-IDs', + 'Lehrer-IDs', + ]; res.render('management/management', { title: 'Allgemeine Verwaltung', user: res.locals.currentUser, themeTitle: process.env.SC_NAV_TITLE || 'Schul-Cloud', policiesHead, policiesBody, + deletionContainerHead, }); } catch (err) { next(err); diff --git a/static/scripts/management.js b/static/scripts/management.js index 870561e..39f339f 100644 --- a/static/scripts/management.js +++ b/static/scripts/management.js @@ -35,10 +35,11 @@ const loadPolicyFile = () => { if (file) { reader.readAsDataURL(file); } - }) -} + }); +}; $(document).ready(() => { + console.log("Management.js geladen"); const $addConsentModal = $('.add-modal--policy'); $('.btn-add-modal--policy').on('click', (e) => { @@ -49,20 +50,22 @@ $(document).ready(() => { submitLabel: "Hinzufügen", }); $addConsentModal.appendTo('body').modal('show'); - }) + }); document.querySelector('#policy-input').addEventListener('change', loadPolicyFile, false); -}) + document.querySelector('#batchDeletionFileInput').addEventListener('change', addFile); +}); + + -document.getElementById('batchDeletionFileInput').addEventListener('change', function(event) { +const addFile = (event) => { const file = event.target.files[0]; if (!file) return; const reader = new FileReader(); reader.onload = function(e) { const content = e.target.result; - console.log("CSV Inhalt:", content); - document.getElementById('output').textContent = content; + document.getElementById('csvContent').textContent = content; }; reader.readAsText(file); -}); \ No newline at end of file +}; \ No newline at end of file diff --git a/views/management/management.hbs b/views/management/management.hbs index e04a37a..d9008d1 100644 --- a/views/management/management.hbs +++ b/views/management/management.hbs @@ -38,17 +38,38 @@ {{/ifEnvNot}} +
+
+

Löschvorbereitung

+
+
+
+ {{> "lib/components/table" head=../deletionContainerHead}} +
+
+
+
+ +
+
+
+
+

Sammellöschung von Schülern

- - +

 								
+
+ +