Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Index every overlapping slot and the same number can't overlap itself in php

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.'"
    }
    });';

image of the schedule:
Click here for image of the schedule

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!