I'm using jq.schedule(https://github.com/ateliee/jquery.schedule/) to display a schedule that is changing every day. Today we "index" every blue time slot with a number from 1-7 depending on how many time slots are overlapping manually on paper. The index number tells the cashier which register they should be at.
For example, in the morning between 7 and 9 in the morning, there are only 2 cashiers. So the highest index number can be 2. And between 16-17 there are 5 overlapping slots, so the highest number can be 5.
All the time slots are in a array. I've tried to loop foreach and find which are overlapping but I don't get the numbers correct.
And to get the cashier to move and get rotation, the same person shouldn't be the same number more than two hours at a time.
Purple means break, so there shouldn't be any index on those.
This is what I've tried:
foreach ($timeslot as $thisevent) {
$kassanralla = 1;
foreach ($timeslot as $thatevent) {
if ($thisevent['Timestart'] > $thatevent['Timestart']) {
$thisevent_from = $thisevent['Timestart'];
$thisevent_ends = $thisevent['Timestop'];
$thatevent_from = $thatevent['Timestart'];
$thatevent_ends = $thatevent['Timestop'];
if ($thatevent_ends > $thisevent_from AND $thisevent_ends > $thatevent_from) {
$kassanralla++;
}
}
if ($kassanralla === 0) {
}
}
echo'
$("#schedule").timeSchedule("addSchedule", "'.$thisevent['Row'].'", {
start: "'.$thisevent['Timestart'].'",
end: "'.$thisevent['Timestop'].'",
text:"'.$kassanralla.'",
data:{
"class": "'.$divclass.'"
}
});';