|
@@ -44,7 +44,8 @@ class AppointmentController extends Controller
|
|
|
->where(function ($query) use ($proIds, $clientId) {
|
|
|
$query
|
|
|
->whereIn('pro_id', $proIds)
|
|
|
- ->orWhere('client_id', '=', $clientId);
|
|
|
+ ->orWhere('client_id', '=', $clientId)
|
|
|
+ ->orWhereRaw('client_id IN (SELECT shadow_client_id FROM pro WHERE id IN (?))', [implode(',', $proIds)]);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -245,8 +246,8 @@ class AppointmentController extends Controller
|
|
|
}
|
|
|
|
|
|
// make already booked slots unavailable
|
|
|
- $proAppointments = $appointments->filter(function ($record) use ($proId) {
|
|
|
- return $record->pro_id == $proId && !in_array($record->status, ['CANCELLED', 'COMPLETED', 'ABANDONED']);
|
|
|
+ $proAppointments = $appointments->filter(function ($record) use ($proId, $pro) {
|
|
|
+ return ($record->pro_id == $proId || $record->client_id == $pro->shadow_client_id) && !in_array($record->status, ['CANCELLED', 'COMPLETED', 'ABANDONED']);
|
|
|
});
|
|
|
foreach ($proAppointments as $appointment) {
|
|
|
if ($appointment->start_time && $appointment->end_time) {
|