worker_id] = $colorPalette[$i % count($colorPalette)]; $i++; } // Build initial bookings JSON $bookingsJson = array(); foreach ($bookings as $b) { $services = array(); if (is_array($b->services)) { foreach ($b->services as $s) { $services[] = array( 'service_name' => $s->service_name, 'service_price' => $s->service_price, 'service_time' => $s->service_time ); } } $bookingsJson[] = array( 'booking_id' => $b->booking_id, 'guest_name' => $b->guest_name, 'guest_email' => $b->guest_email, 'guest_phone' => $b->guest_phone, 'worker_id' => $b->worker_id, 'worker_name' => $b->worker_name, 'booking_date' => $b->booking_date, 'booking_start_time' => $b->booking_start_time, 'booking_finish_time' => $b->booking_finish_time, 'services' => $services, 'service_names_joined' => $b->service_names_joined ); } ?>