@extends('admin.layouts.layout') @push('page_style') @endpush @section('content')

All Schedules

Clear
@if(session('success'))
{{ session('success') }}
@endif
@if($schedules->count()) @php $authUser = Auth::user(); $roleSlugs = $authUser ? $authUser->roles->pluck('slug')->toArray() : []; $isCustomerOrAgent = in_array('customer',$roleSlugs) || in_array('agent',$roleSlugs); @endphp @foreach($schedules as $row) @php $statusLabel = $row->is_cancelled ? 'Cancelled' : (($row->is_report_submitted == 1) ? 'Complete' : (in_array($row->status,[1,2]) ? 'In Progress' : (($row->status==3)?'Booked':'N/A'))); $statusClass = $row->is_cancelled ? 'bg-danger' : (($row->is_report_submitted == 1) ? 'bg-success' : ($row->status==3 ? 'bg-success' : 'bg-warning text-dark')); $datetime = ''; if($row->scheduled_date && $row->start_time){ $dt = is_string($row->start_time) ? $row->start_time : ($row->start_time?->format('H:i:s')); $d = $row->scheduled_date instanceof \Illuminate\Support\Carbon ? $row->scheduled_date->format('Y-m-d') : $row->scheduled_date; $datetime = $d.' '.$dt; } $locParts = []; if($row->property){ foreach(['address_line1','city','state','postal_code'] as $f){ if(!empty($row->property->{$f})) $locParts[] = $row->property->{$f}; } } $location = implode(', ', $locParts); // Determine if this user (when customer/agent) is the creator of the schedule $createdById = $row->created_by ?? null; $canModify = !$isCustomerOrAgent || ($isCustomerOrAgent && $createdById && $authUser && (int)$createdById === (int)$authUser->id); @endphp @endforeach @else @endif
Appointment ID Created By Date & Time Location Status Is Payment Done? Actions
{{ $row->appointment_id }} {{ $row->created_by_full_name }} {{ \App\Helpers\Helper::showdate($datetime, true) }} {{ $location }} {{ $statusLabel }} {{ $row->is_payment_done == 1 ? 'Done' : 'Not Done'}}
@if($row->status == 3 && isset($row->templates_count) && $row->templates_count > 0) @endif @if($canModify) @if(!$row->is_cancelled && !$row->is_report_submitted) @else @endif @if(!$isCustomerOrAgent) @elseif($isCustomerOrAgent && $createdById && (int)$createdById === (int)$authUser->id) @endif @else @endif
No schedules found.
@php($data = $schedules) @include('admin.components.pagination') @endsection @push('page_script') @endpush