diff options
Diffstat (limited to 'public/js/calendar_admin.js')
-rw-r--r-- | public/js/calendar_admin.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/public/js/calendar_admin.js b/public/js/calendar_admin.js index 8fe91a3..a99b069 100644 --- a/public/js/calendar_admin.js +++ b/public/js/calendar_admin.js | |||
@@ -1,3 +1,5 @@ | |||
1 | // js/calendar_admin.js | ||
2 | |||
1 | document.addEventListener('DOMContentLoaded', function(){ | 3 | document.addEventListener('DOMContentLoaded', function(){ |
2 | const calendarEl = document.getElementById('calendar'); | 4 | const calendarEl = document.getElementById('calendar'); |
3 | let selected_start_string = null; | 5 | let selected_start_string = null; |
@@ -35,7 +37,8 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
35 | allDayContent: 'Journée', // texte dans la case "toute la journée" | 37 | allDayContent: 'Journée', // texte dans la case "toute la journée" |
36 | nowIndicator: true, // barre rouge pour maintenant | 38 | nowIndicator: true, // barre rouge pour maintenant |
37 | 39 | ||
38 | events: '../src/load-events.php', // fichier PHP qui retourne les événements | 40 | // params en plus: https://fullcalendar.io/docs/events-json-feed |
41 | events: 'index.php?action=get_events', // fichier PHP qui retourne les événements | ||
39 | 42 | ||
40 | select: function(info){ | 43 | select: function(info){ |
41 | selected_start_string = info.startStr; // variable "globale" | 44 | selected_start_string = info.startStr; // variable "globale" |
@@ -220,7 +223,7 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
220 | color: event_color | 223 | color: event_color |
221 | }; | 224 | }; |
222 | 225 | ||
223 | fetch('../src/post-ajax.php', { | 226 | fetch('index.php?action=new_event', { |
224 | method: 'POST', | 227 | method: 'POST', |
225 | headers: { | 228 | headers: { |
226 | 'Content-Type': 'application/json', | 229 | 'Content-Type': 'application/json', |
@@ -255,7 +258,7 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
255 | color: event_color | 258 | color: event_color |
256 | }; | 259 | }; |
257 | 260 | ||
258 | fetch('../src/post-ajax.php', { | 261 | fetch('index.php?action=update_event', { |
259 | method: 'POST', | 262 | method: 'POST', |
260 | headers: { | 263 | headers: { |
261 | 'Content-Type': 'application/json', | 264 | 'Content-Type': 'application/json', |
@@ -318,12 +321,12 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
318 | const event_id = document.getElementById('event_id').value; | 321 | const event_id = document.getElementById('event_id').value; |
319 | const event = calendar.getEventById(event_id); | 322 | const event = calendar.getEventById(event_id); |
320 | 323 | ||
321 | fetch('../src/post-ajax.php', { | 324 | fetch('index.php?action=remove_event', { |
322 | method: 'POST', | 325 | method: 'POST', |
323 | headers: { | 326 | headers: { |
324 | 'Content-Type': 'application/json', | 327 | 'Content-Type': 'application/json', |
325 | }, | 328 | }, |
326 | body: JSON.stringify(event_id), | 329 | body: JSON.stringify({'id': event_id}), |
327 | }) | 330 | }) |
328 | .then(response => response.json()) | 331 | .then(response => response.json()) |
329 | .then(data => { | 332 | .then(data => { |