régler problème de dispos des coachs

This commit is contained in:
cedrick2711
2026-08-10 17:20:07 -04:00
parent bb0bc1c192
commit d007900f6c
5 changed files with 27 additions and 17 deletions
+13 -2
View File
@@ -15,6 +15,9 @@
</div>
<div class="form-actions mt-4">
<button type="button" class="btn btn-primary" onclick="saveAvailability()">
<i class="fas fa-save"></i> Save Availability
</button>
<button type="button" class="btn btn-secondary" onclick="clearAllAvailability()">
<i class="fas fa-trash"></i> Clear All
</button>
@@ -168,13 +171,18 @@ function saveAvailability() {
fetch('{{ url_for("users.manage_coach_availability") }}', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': '{{ csrf_token() }}'
},
body: JSON.stringify({ slots: slots })
})
.then(response => response.json())
.then(data => {
if (data.success) {
flash('Availability saved!', 'success');
} else {
flash(data.error || 'Error saving availability.', 'danger');
}
})
.catch(function(error) {
@@ -188,7 +196,10 @@ function clearAllAvailability() {
return;
}
fetch('{{ url_for("users.clear_coach_availability") }}', { method: 'POST' })
fetch('{{ url_for("users.clear_coach_availability") }}', {
method: 'POST',
headers: { 'X-CSRFToken': '{{ csrf_token() }}' }
})
.then(response => response.json())
.then(data => {
if (data.success) {