@extends('layouts.app') @section('title', 'My Weekly Schedule') @section('page-title', 'My Weekly Schedule') @section('styles') @endsection @section('content') @php use Carbon\Carbon; // Calculate dates for the week $startOfWeek = Carbon::now()->setISODate($currentYear, $currentWeek)->startOfWeek(Carbon::SUNDAY); $dates = [ 'sunday' => $startOfWeek->copy()->format('d M Y'), 'monday' => $startOfWeek->copy()->addDay(1)->format('d M Y'), 'tuesday' => $startOfWeek->copy()->addDay(2)->format('d M Y'), 'wednesday' => $startOfWeek->copy()->addDay(3)->format('d M Y'), 'thursday' => $startOfWeek->copy()->addDay(4)->format('d M Y'), ]; @endphp
Week {{ $currentWeek }}, {{ $currentYear }}
Previous Next
@php $hasSubmitted = $schedules->contains('status', 'submitted'); $hasApproved = $schedules->contains('status', 'approved'); @endphp @if(!$hasSubmitted && !$hasApproved)
Your schedule is in draft mode. Once you complete all days, submit for approval.
@elseif($hasSubmitted)
Your schedule has been submitted and is pending leader approval.
@elseif($hasApproved)
Your schedule has been approved!
@endif
@foreach(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday'] as $day) @php $schedule = $schedules[$day] ?? null; $clients = $schedule->clients ?? []; $status = $schedule->status ?? 'draft'; $notes = $schedule->notes ?? ''; @endphp
{{ ucfirst($day) }}
{{ $dates[$day] }} @if($status == 'submitted') Pending @elseif($status == 'approved') Approved @else Draft @endif
@if(count($clients) > 0) @foreach($clients as $index => $client)
{{ $index + 1 }}. {{ $client['company_name'] ?? $client['name'] ?? 'Client' }} @if(isset($client['address']))
{{ $client['address'] }} @endif @if(isset($client['contact']))
{{ $client['contact'] }} @endif
@endforeach @if($notes)
{{ Str::limit($notes, 60) }}
@endif @else

No clients scheduled

@endif
@endforeach
@if(!$hasSubmitted && !$hasApproved)
@csrf
@endif
@endsection