@php use \App\Http\Controllers\PlanningController @endphp @extends('layouts.app') @section('title', 'Planning') @section('content')
@foreach($projects as $project)
{{ $project->company_name }} Project ID: WG-{{str_pad($project->id, 4, '0', STR_PAD_LEFT);}} {{ $project->status }}
@endforeach
@if(!request()->has('view'))
{{ date('jS M', strtotime($dates[0])) }} - {{ date('jS M', strtotime(end($dates))) }} {{ date('Y', strtotime(end($dates))) }}
Week @foreach($months as $month) {{ date('F Y', strtotime($month)) }} @endforeach

@foreach($dates as $date)

{{ date('l d', strtotime($date)) }}

@endforeach
@foreach($users as $user)

{{ $user->firstname }} {{ $user->lastname }}

@php $i = 1; $next_class = ''; $sequence = 1; @endphp @foreach($dates as $date) @php $planning = PlanningController::getUserPlannings($user->id, $date) @endphp @php $resizable = 'resizable'; $class = ""; if(isset($dates[$i])){ $planning_next = PlanningController::getUserPlannings($user->id, $dates[$i]); if($planning_next && isset($planning->project_id)){ if($planning_next->project_id==$planning->project_id){ $class = "next-same"; }elseif($planning_next->project_id!=$planning->project_id){ $resizable = ''; } } } @endphp

@if($planning) @if($planning->confirmed==0) @php $style = 'background:#ddd;border:2px solid grey'; @endphp @else @php $style = 'background:'.$planning->background.'.;border:2px solid '.$planning->border.';'; @endphp @endif
@if($planning->confirmed==0) @endif

{{ $planning->company_name }}

WG-{{str_pad($planning->project_id, 4, '0', STR_PAD_LEFT)}}
@php $staffs = PlanningController::getProjectUsers($planning->project_id, $date) @endphp @foreach($staffs as $staff)
Pic
@endforeach
@endif
@php $i++; if($class=='next-same'){ $next_class = 'prev-same'; }else{ $next_class=''; $sequence++; } @endphp @endforeach
@endforeach
@else
@if(!request()->has('m')) {{ date('jS M', strtotime($dates[0])) }} - {{ date('jS M', strtotime(end($dates))) }} {{ date('Y', strtotime(end($dates))) }} @endif
Week @foreach($months as $month) {{ date('F Y', strtotime($month)) }} @endforeach
@if(!request()->has('m')) @endif

@php $dates = PlanningController::getDatesOfMonth(request()->m) @endphp @foreach($dates as $date)

{{ date('d', strtotime($date)) }}

@endforeach
@foreach($users as $user)

{{ $user->firstname }} {{ $user->lastname }}

@php $i = 1; $next_class = ''; @endphp @foreach($dates as $date) @php $planning = PlanningController::getUserPlannings($user->id, $date) @endphp @php $resizable = 'resizable'; $class = ""; if(isset($dates[$i])){ $planning_next = PlanningController::getUserPlannings($user->id, $dates[$i]); if($planning_next && isset($planning->project_id)){ if($planning_next->project_id==$planning->project_id){ $class = "next-same"; $resizable = ''; }elseif($planning_next->project_id!=$planning->project_id){ $resizable = ''; } } } @endphp

@if($planning) @php $staffs = PlanningController::getProjectUsers($planning->project_id, $date); $names = []; foreach ($staffs as $staff) { $names[] = $staff->firstname . ' ' . $staff->lastname; } $tooltip = 'Project: '.$planning->company_name.' (WG-'.str_pad($planning->project_id, 4, '0', STR_PAD_LEFT).')
Date: '.date('jS M Y', strtotime($date)).'
People working: '.implode(', ', $names); @endphp
@endif
@php $i++; if($class=='next-same'){ $next_class = 'prev-same'; }else{ $next_class=''; } @endphp @endforeach
@endforeach
@endif
@endsection @section('js') @endsection