@if (!count($stages))

No tasks are found!

@endif @foreach ($stages as $key => $stage)
{{ $stage->name }}
@if (!$stage->is_current_stage && $stage->status()) {{ $stage->status() }} @elseif($stage->is_current_stage) Current @endif
{{ $stage->percentComplete() }}% Complete
@php $allUsers = []; foreach ($stage->tasks as $task) { foreach ($task->assigned as $assignee) { $user = $assignee->head_office_user->user ?? null; if ($user) { $allUsers[$user->id] = $user; } } } foreach ($stage->stage_case_handlers as $handler) { $user = $handler->case_handler->case_head_office_user->user ?? null; if ($user) { $allUsers[$user->id] = $user; } } @endphp @foreach ($allUsers as $user)
@if ($user->logo) {{ $user->name }} @else
{{ implode('',array_map(function ($word) {return strtoupper($word[0]);}, explode(' ', $user->name))) }}
@endif @include('head_office.user_card_component')
@endforeach
@if (($case->status == 'open' || $case->status == 'InProgress') && $case->isArchived == false) id)}}' title="Add Task"> @endif
@foreach ($stage->tasks as $key => $task) {{-- @if ($task->is_default_task) --}}
{{ $task->title }}
@if ($task->shared_with == 'user') User Task @elseif ($task->shared_with == 'location') Site Task @elseif(isset($task->case_id)) Case Task @endif @if ($task->mandatory == 1) Mandatory @endif @php $priority = $task->priority ?? 'low'; $priorityClass = match($priority) { 'high' => 'priority-high', 'medium' => 'priority-medium', default => 'priority-low', }; @endphp {{ ucfirst($priority) }}
@livewire('task-status', ['task' => $task->id])
@if($task->description)
{!! strip_tags($task->description) !!}
@endif
Task ID: #{{ $task->id }}
@if(isset($task->case_id))
Case ID: #{{ $task->case_id }}
@endif
Created: {{ $task->created_at->format('d/m/Y') }}
@if($task->calculateDueDate())
Due: {{ \Carbon\Carbon::parse($task->due_date)->format('d/m/Y') }}
@endif
@if (isset($task->form_json) || (isset($task->linked_forms) && $task->linked_forms->isNotEmpty()))
@if (isset($task->form_json)) @endif {{-- Linked forms --}} @if (isset($task->linked_forms)) @foreach ($task->linked_forms as $f_form) @if (isset($f_form->form) && isset($f_form->form->external_link) && isset($f_form->completed_at)) @elseif (isset($f_form->form) && isset($f_form->form->external_link) && !isset($f_form->completed_at)) Complete Form @endif @endforeach @endif
@endif @if ($task->assigned_to->count() > 0 || (isset($task->assign_to) && $task->assign_to == 'everyone') || (isset($task->assign_to) && $task->assign_to == 'specific_profiles') || $task->ho_allocations->count() > 0 || $task->loc_allocations->count() > 0)
Assigned to:
@if ($task->assigned_to->count() > 0) @foreach ($task->assigned_to as $view) @php $task_user = optional($view->head_office_user)->user; @endphp @if($task_user)
User @if ($task->assigned_to->count() <= 3) {{$view->head_office_user->user->name}} @endif @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @elseif (isset($task->assign_to) && $task->assign_to == 'everyone' && $task->shared_with == null) Everyone @if (isset($task->case)) @php $involved_users = $task->case->getAllInvolvedUsers(); @endphp @if (count($involved_users) > 0) @foreach ($involved_users as $view) @php $task_user = optional($view)->user; @endphp @if($task_user)
User @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @endif @endif @elseif (isset($task->assign_to) && $task->assign_to == 'specific_profiles') Profiles @if (isset($task->case)) @php $involved_users = $task->getCaseProfileInvolvedUsers(); @endphp @if (count($involved_users) > 0) @foreach ($involved_users as $view) @php $task_user = optional($view)->user; @endphp @if($task_user)
User @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @endif @endif @elseif ($task->ho_allocations->count() > 0) @foreach ($task->ho_allocations as $view) @php $task_user = optional($view->head_office_user)->user; @endphp @if($task_user)
User @if ($task->ho_allocations->count() <= 3) {{$view->head_office_user->user->name}} @endif @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @elseif ($task->loc_allocations->count() > 0) @foreach ($task->loc_allocations as $view) @php $location = optional($view->head_office_location)->location; @endphp @if($location)
{{$location->trading_name}}
@endif @endforeach @endif
@endif
{{-- @endif --}} @endforeach
@endforeach @if(isset($case->new_tasks) && $case->new_tasks->where('stage_id', null)->count() > 0)
Independent Stage Tasks
@foreach ($case->new_tasks->where('stage_id', null) as $new_task)
{{ $new_task->title }}
@if ($new_task->shared_with == 'user') User Task @elseif ($new_task->shared_with == 'location') Site Task @elseif(isset($new_task->case_id)) Case Task @endif @if ($new_task->mandatory == 1) Mandatory @endif @php $priority = $new_task->priority ?? 'low'; $priorityClass = match($priority) { 'high' => 'priority-high', 'medium' => 'priority-medium', default => 'priority-low', }; @endphp {{ ucfirst($priority) }}
@livewire('task-status', ['task' => $new_task->id])
@if($new_task->description)
{!! strip_tags($new_task->description) !!}
@endif
Task ID: #{{ $new_task->id }}
@if(isset($new_task->case_id))
Case ID: #{{ $new_task->case_id }}
@endif
Created: {{ $new_task->created_at->format('d/m/Y') }}
@if($new_task->due_date)
Due: {{ \Carbon\Carbon::parse($new_task->due_date)->format('d/m/Y') }}
@endif
@if (isset($new_task->form_json) || (isset($new_task->linked_forms) && $new_task->linked_forms->isNotEmpty()))
@if (isset($new_task->form_json)) @endif {{-- Linked forms --}} @if (isset($new_task->linked_forms)) @foreach ($new_task->linked_forms as $f_form) @if (isset($f_form->form) && isset($f_form->form->external_link) && isset($f_form->completed_at)) @elseif (isset($f_form->form) && isset($f_form->form->external_link) && !isset($f_form->completed_at)) Complete Form @endif @endforeach @endif
@endif @if ($new_task->assigned_to->count() > 0 || (isset($new_task->assign_to) && $new_task->assign_to == 'everyone') || (isset($new_task->assign_to) && $new_task->assign_to == 'specific_profiles') || $new_task->ho_allocations->count() > 0 || $new_task->loc_allocations->count() > 0)
Assigned to:
@if ($new_task->assigned_to->count() > 0) @foreach ($new_task->assigned_to as $view) @php $task_user = optional($view->head_office_user)->user; @endphp @if($task_user)
User @if ($new_task->assigned_to->count() <= 3) {{$view->head_office_user->user->name}} @endif @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @elseif (isset($new_task->assign_to) && $new_task->assign_to == 'everyone' && $new_task->shared_with == null) Everyone @if (isset($new_task->case)) @php $involved_users = $new_task->case->getAllInvolvedUsers(); @endphp @if (count($involved_users) > 0) @foreach ($involved_users as $view) @php $task_user = optional($view)->user; @endphp @if($task_user)
User @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @endif @endif @elseif (isset($new_task->assign_to) && $new_task->assign_to == 'specific_profiles') Profiles @if (isset($new_task->case)) @php $involved_users = $new_task->getCaseProfileInvolvedUsers(); @endphp @if (count($involved_users) > 0) @foreach ($involved_users as $view) @php $task_user = optional($view)->user; @endphp @if($task_user)
User @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @endif @endif @elseif ($new_task->ho_allocations->count() > 0) @foreach ($new_task->ho_allocations as $view) @php $task_user = optional($view->head_office_user)->user; @endphp @if($task_user)
User @if ($new_task->ho_allocations->count() <= 3) {{$view->head_office_user->user->name}} @endif @include('head_office.user_card_component', [ 'user' => $task_user ])
@endif @endforeach @elseif ($new_task->loc_allocations->count() > 0) @foreach ($new_task->loc_allocations as $view) @php $location = optional($view->head_office_location)->location; @endphp @if($location)
{{$location->trading_name}}
@endif @endforeach @endif
@endif
@endforeach
@endif {{-- --}} {{-- --}}