diff options
| author | polo <ordipolo@gmx.fr> | 2025-12-17 13:33:07 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-12-17 13:33:07 +0100 |
| commit | 8393acd0366ee3408db103ba29e8686bab127f42 (patch) | |
| tree | bf6f6170caea009f9ffeb5b5827536cf893c9820 /public/js | |
| parent | fc14268ad5d644680a5802eb1af4691bb9294dd5 (diff) | |
| download | cms-8393acd0366ee3408db103ba29e8686bab127f42.tar.gz cms-8393acd0366ee3408db103ba29e8686bab127f42.tar.bz2 cms-8393acd0366ee3408db103ba29e8686bab127f42.zip | |
Diffstat (limited to 'public/js')
| -rw-r--r-- | public/js/form.js | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/public/js/form.js b/public/js/form.js index b498b40..7cee970 100644 --- a/public/js/form.js +++ b/public/js/form.js | |||
| @@ -26,6 +26,39 @@ function setEmailParam(what_param, id){ | |||
| 26 | }); | 26 | }); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | function keepEmails(block_id){ | ||
| 30 | const form = document.getElementById('keep_emails_' + block_id); | ||
| 31 | const warning = document.getElementById('form_warning_' + block_id); | ||
| 32 | if(!form || !warning){ | ||
| 33 | return; | ||
| 34 | } | ||
| 35 | |||
| 36 | fetch('index.php?action=keep_emails', { | ||
| 37 | method: 'POST', | ||
| 38 | headers: { | ||
| 39 | 'Content-Type': 'application/json' | ||
| 40 | }, | ||
| 41 | body: JSON.stringify({ | ||
| 42 | id: block_id, | ||
| 43 | checked: form.checked | ||
| 44 | }) | ||
| 45 | }) | ||
| 46 | .then(response => response.json()) | ||
| 47 | .then(data => { | ||
| 48 | if(data.success){ | ||
| 49 | form.checked = data.checked; | ||
| 50 | data.checked ? warning.classList.remove('hidden') : warning.classList.add('hidden'); | ||
| 51 | toastNotify(data.checked ? "Les e-mails seront conservés. Pensez au RGPD." : "Les nouveaux e-mails ne seront pas conservés."); | ||
| 52 | } | ||
| 53 | else{ | ||
| 54 | toastNotify("Erreur, le réglage n'a pas été enregistré par le serveur."); | ||
| 55 | } | ||
| 56 | }) | ||
| 57 | .catch(error => { | ||
| 58 | console.error('Erreur:', error); | ||
| 59 | }); | ||
| 60 | } | ||
| 61 | |||
| 29 | function checkCase(id){ | 62 | function checkCase(id){ |
| 30 | if(document.getElementById('email_address_' + id).value.match('[A-Z]')){ | 63 | if(document.getElementById('email_address_' + id).value.match('[A-Z]')){ |
| 31 | toastNotify("Votre e-mail comporte une lettre majuscule, il s'agit probablement d'une erreur."); | 64 | toastNotify("Votre e-mail comporte une lettre majuscule, il s'agit probablement d'une erreur."); |
| @@ -136,8 +169,11 @@ function deleteEmail(id){ | |||
| 136 | }) | 169 | }) |
| 137 | .then(response => response.json()) | 170 | .then(response => response.json()) |
| 138 | .then(data => { | 171 | .then(data => { |
| 139 | table_row.remove(); | 172 | if(data.success){ |
| 140 | toastNotify("E-mail supprimé"); | 173 | table_row.remove(); |
| 174 | toastNotify("E-mail supprimé"); | ||
| 175 | } | ||
| 176 | else{} | ||
| 141 | }) | 177 | }) |
| 142 | .catch(error => { | 178 | .catch(error => { |
| 143 | console.error('Erreur:', error); | 179 | console.error('Erreur:', error); |
| @@ -165,9 +201,12 @@ function toggleSensitiveEmail(id){ | |||
| 165 | }) | 201 | }) |
| 166 | .then(response => response.json()) | 202 | .then(response => response.json()) |
| 167 | .then(data => { | 203 | .then(data => { |
| 168 | checkbox.checked = data.checked; | 204 | if(data.success){ |
| 169 | deletion_date.innerHTML = data.deletion_date; | 205 | checkbox.checked = data.checked; |
| 170 | console.log(data.checked ? "Cet e-mail est maintenant considéré comme sensible." : "Cet e-mail n'est plus sensible."); | 206 | deletion_date.innerHTML = data.deletion_date; |
| 207 | console.log(data.checked ? "Cet e-mail est maintenant considéré comme sensible." : "Cet e-mail n'est plus sensible."); | ||
| 208 | } | ||
| 209 | else{} | ||
| 171 | }) | 210 | }) |
| 172 | .catch(error => { | 211 | .catch(error => { |
| 173 | console.error('Erreur:', error); | 212 | console.error('Erreur:', error); |
