diff options
Diffstat (limited to 'public/js/form.js')
| -rw-r--r-- | public/js/form.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/public/js/form.js b/public/js/form.js index 7cee970..d8849c8 100644 --- a/public/js/form.js +++ b/public/js/form.js | |||
| @@ -58,6 +58,36 @@ function keepEmails(block_id){ | |||
| 58 | console.error('Erreur:', error); | 58 | console.error('Erreur:', error); |
| 59 | }); | 59 | }); |
| 60 | } | 60 | } |
| 61 | function setEmailsRetentionPeriod(block_id){ | ||
| 62 | const form = document.getElementById('retention_period_' + block_id); | ||
| 63 | if(!form){ | ||
| 64 | return; | ||
| 65 | } | ||
| 66 | |||
| 67 | fetch('index.php?action=set_retention_period', { | ||
| 68 | method: 'POST', | ||
| 69 | headers: { | ||
| 70 | 'Content-Type': 'application/json' | ||
| 71 | }, | ||
| 72 | body: JSON.stringify({ | ||
| 73 | id: block_id, | ||
| 74 | months: form.value | ||
| 75 | }) | ||
| 76 | }) | ||
| 77 | .then(response => response.json()) | ||
| 78 | .then(data => { | ||
| 79 | if(data.success){ | ||
| 80 | form.value = data.months; | ||
| 81 | console.log(data.months + " mois"); | ||
| 82 | } | ||
| 83 | else{ | ||
| 84 | toastNotify("Erreur, le réglage n'a pas été enregistré par le serveur."); | ||
| 85 | } | ||
| 86 | }) | ||
| 87 | .catch(error => { | ||
| 88 | console.error('Erreur:', error); | ||
| 89 | }); | ||
| 90 | } | ||
| 61 | 91 | ||
| 62 | function checkCase(id){ | 92 | function checkCase(id){ |
| 63 | if(document.getElementById('email_address_' + id).value.match('[A-Z]')){ | 93 | if(document.getElementById('email_address_' + id).value.match('[A-Z]')){ |
