|
@@ -44,7 +44,7 @@ class AppointmentController extends Controller
|
|
|
foreach ($appointments as $appointment) {
|
|
|
$events[] = [
|
|
|
"type" => "appointment",
|
|
|
- "title" => ($appointment->client->id != $clientId ? '* ' : '') . $appointment->pro->displayName(),
|
|
|
+ "title" => ($appointment->client->id != $clientId ? '* ' : '') . $appointment->pro->displayName() . " (booked)",
|
|
|
"_title" => $appointment->title,
|
|
|
"description" => $appointment->description,
|
|
|
"clientName" => $appointment->client->displayName(),
|
|
@@ -178,6 +178,18 @@ class AppointmentController extends Controller
|
|
|
$proTimeLine->removeAvailability($suaStart, $suaEnd);
|
|
|
}
|
|
|
|
|
|
+ // make already booked slots unavailable
|
|
|
+ $proAppointments = $appointments->filter(function ($record) use ($proId) {
|
|
|
+ return $record->pro_id == $proId;
|
|
|
+ });
|
|
|
+ foreach ($proAppointments as $appointment) {
|
|
|
+ if($appointment->start_time && $appointment->end_time) {
|
|
|
+ $appStart = $this->convertToTimezone($appointment->start_time, $timeZone, 'UTC', true);
|
|
|
+ $appEnd = $this->convertToTimezone($appointment->end_time, $timeZone, 'UTC', true);
|
|
|
+ $proTimeLine->removeAvailability($appStart, $appEnd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($proTimeLine->available as $item) {
|
|
|
|
|
|
$eStart = new \DateTime('@' . $item->start);
|
|
@@ -188,7 +200,7 @@ class AppointmentController extends Controller
|
|
|
|
|
|
$events[] = [
|
|
|
"type" => "availability",
|
|
|
- "title" => $pro->displayName(),
|
|
|
+ "title" => $pro->displayName() . " (available)",
|
|
|
"proId" => $pro->id,
|
|
|
"proUid" => $pro->uid,
|
|
|
"start" => $eStart->format('Y-m-d H:i:s'),
|