I'm developping a borrowing website for my job. We have some equipments that we can borrow for certain period(s) of time. I have a MySql dataBase with a table Article(id,name,stockQuantity,...) and Rent(id,id_user,date_start,date_end,quantity)
After days of fighting with FullCalendar, i don't know how to handle my problems. I need to handle the quantity for some equipments, and I don't know how to lock certains days if there is not available equipements.
Example: Article => PC DELL 720, stockQuantity => 3 , if this Article is borrowed by 3 persons the same day of different days, I need to lock this(ese) days, and handle overlapings times and quantities...
And how to manage this "quantity" parameters in FullCalendar ... I could easily use this calendar if I had only a quantity equal to 1.
If someone had faced a similar problem(s) :D
Thanks and sorry for my english.
My current code:
$(document).ready(function()
{
let calendarEl = document.getElementById('calendrier');
let today = new Date();
let calendar = new FullCalendar.Calendar(calendarEl, {
// On charge le composant "dayGrid"
plugins: [ 'dayGrid', 'list', 'interaction' ],
locale: 'fr',
buttonText: {
today: 'Aujourd\'hui',
},
events:"/location/loadAllById/"+$('#calendrier').attr('id_article'),
dayRender: function(day){
//console.warn(day.el)
if (day.date < today){
$(day.el).addClass('date-disabled');
$(day.el).addClass('editable = false');
}
},
eventDrop: function(eventDropInfo) {
console.log('event start' + eventDropInfo.event.start,'currentDate ' + today)
console.log(eventDropInfo.event.start < today);
if(eventDropInfo.event.start < today) {
eventDropInfo.revert();
}
},
select: function(selectionInfo) {
if(selectionInfo.start < today) {
calendar.unselect()
return false;
}
},
eventRender: function(info) {
// console.warn(info)
},
dayClick : function(info)
{
alert('Event: ' + info.event.title);
alert('Coordinates: ' + info.jsEvent.pageX + ',' + info.jsEvent.pageY);
alert('View: ' + info.view.type);
},
eventClick: function(info) {
alert('Event: ' + info.event);
},
editable: true,
selectable: true,
})
// On affiche le calendrier
calendar.render();