@if(!request()->has('view'))
@foreach($users as $user)
{{ $user->firstname }} {{ $user->lastname }}
@php $i = 1; $next_class = ''; $sequence = 1; $k =0; @endphp
@foreach($dates as $date)
@php
$k++;
$planning = PlanningController::getUserPlannings($user->id, $date);
$otherPlanning = PlanningController::getOtherPlannings($user->id, $date);
@endphp
@php
$resizable = 'resizable';
$class = "";
if(isset($dates[$i])){
$planning_next = PlanningController::getUserPlannings($user->id, $dates[$i]);
$nextBookings = PlanningController::checkBookings($user->id, $dates[$i]);
if($nextBookings==2){
$class = "";
}else{
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 = '';
}
}
}
/*if($nextBookings>0){
$resizable = '';
}*/
}
@endphp
@php
$dayName = date('l', strtotime($date));
$droppable = '';
if(!$planning){
$droppable = 'droppable';
}
if($planning && $otherPlanning->project_id==$planning->project_id){
$droppable = 'droppable';
}
@endphp
@if($planning)
@php
if($otherPlanning->project_id!=$planning->project_id){
$resizable = '';
$class = "";
$next_class = '';
}
@endphp
@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 && $otherPlanning->project_id==$planning->project_id)
@endif
@php $staffs = PlanningController::getProjectUsers($planning->project_id, $date) @endphp
@if($otherPlanning->project_id!=$planning->project_id)
@php $planning = $merged[0] @endphp
@php $otherPlanning = $merged[1] @endphp
{{ $planning->company_name }}
WG-{{str_pad($planning->project_id, 4, '0', STR_PAD_LEFT)}}
@foreach($staffs as $staff)
@endforeach
@endif
@if($otherPlanning->project_id!=$planning->project_id)
{{ $otherPlanning->company_name }}
WG-{{str_pad($otherPlanning->project_id, 4, '0', STR_PAD_LEFT)}}
@php $otherStaffs = PlanningController::getProjectUsers($otherPlanning->project_id, $date) @endphp
@foreach($otherStaffs as $staff)
@endforeach
@endif
@if($otherPlanning->project_id==$planning->project_id)
{{ $planning->company_name }}
WG-{{str_pad($planning->project_id, 4, '0', STR_PAD_LEFT)}}
@foreach($staffs as $staff)
@endforeach
@endif
@endif
@php
$i++; if($class=='next-same'){ $next_class = 'prev-same'; }else{ $next_class=''; $sequence++; }
@endphp
@endforeach
@endforeach
@else
@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
{{ $planning->company_name }}
WG-{{str_pad($planning->project_id, 4, '0', STR_PAD_LEFT)}}
@endif
@php
$i++; if($class=='next-same'){ $next_class = 'prev-same'; }else{ $next_class=''; }
@endphp
@endforeach
@endforeach
@endif