mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
New Model for Event,Booking and Course
This commit is contained in:
41
public/js/calendar.js
vendored
Normal file
41
public/js/calendar.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
function initFullCalendar(authToken) {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var calendarEl = document.getElementById('fullCalendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
plugins: ['dayGrid','interaction'],
|
||||
locale: 'fr-ca',
|
||||
header: {
|
||||
left: 'title',
|
||||
center: '',
|
||||
right: 'prev,next'
|
||||
},
|
||||
events: '/api/schedule/events',
|
||||
eventClick: function (info) {
|
||||
console.log(info.event.id)
|
||||
$.get("/api/schedule/full/events/" + info.event.id + "/modal?api_token="+authToken, function (data) {
|
||||
$("#modal-content").html(data);
|
||||
});
|
||||
$('#schedulemodal').modal('toggle')
|
||||
},
|
||||
dateClick: function (info) {
|
||||
var date = moment(info.date).format("YYYY-MM-DD");
|
||||
Swal.fire({
|
||||
title: 'Ajouter un evenement?',
|
||||
text: "Voulez vous ajouter un evenement le "+date,
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Oui',
|
||||
cancelButtonText: 'Non',
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
window.location.href = '/admin/schedule/add/'+date;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user