@extends('layouts.location_app') @section('title', 'Task '.$task->id) @section('content')
Task Details
@if ($task->shared_with == 'user') User Task @elseif ($task->shared_with == 'location') Site Task @elseif(isset($task->case_id)) Case Task @endif
@livewire('task-status', ['task' => $task->id])
Task ID: #{{ $task->id }}
Task Name: {{ $task->title ?? 'N/A' }}
@if (isset($task->case_id))
Case ID: #{{ $task->case_id }}
@endif
Description: @if ($task->description != null) {!! $task->description !!} @else N/A @endif
Priority: @php $priority = $task->priority ?? 'low'; $priorityClass = match($priority) { 'high' => 'priority-high', 'medium' => 'priority-medium', default => 'priority-low', }; @endphp {{ ucfirst($priority) }}
@if ($task->mandatory == 1)
Mandatory: Yes
@endif @if ($task->calculateDueDate() != null)
Due Date: {{ \Carbon\Carbon::parse($task->due_date)->format('d/m/Y H:i') }}
@endif @if ($task->assigned_to->count() > 0)
Assignee:
@foreach ($task->assigned_to as $view) @php $task_user = optional($view->head_office_user)->user; @endphp @if($task_user)
@if ($task->assigned_to->count() <= 2) {{$view->head_office_user->user->name}} @endif
@endif @endforeach
@elseif (isset($task->assign_to) && $task->assign_to == 'everyone' && $task->shared_with == null)
Assignee:
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)
@endif @endforeach @endif @endif
@elseif (isset($task->assign_to) && $task->assign_to == 'specific_profiles')
Assignee:
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)
@endif @endforeach @endif @endif
@elseif ($task->loc_allocations->count() > 0)
Assignee:
@foreach ($task->loc_allocations as $view) @php $task_user = optional($view->head_office_location)->location; @endphp @if($task_user && $task_user->id == $location->id)
{{$view->head_office_location->location->trading_name}}
@endif @endforeach
@endif @if (isset($task->task_case) && isset($task->task_case->form_name))
Form: {{ $task->task_case?->form_name }}
@endif @if ($task->task_linked_cases->count() > 0)
Linked Cases:
@foreach ($task->task_linked_cases as $linked_case) @if (!isset($linked_case->linked_case)) @continue @endif
#{{ $linked_case->linked_case->both_cases->where('id', '!=', $task->case_id)->first()->id }} | {{ $linked_case->linked_case->both_cases->where('id', '!=', $task->case_id)->first()->form_name }} |
@endforeach
@endif
Created at: {{ $task->created_at->format('l d/m/Y h:i a') }} ({{ $task->created_at->diffForHumans() }})
Created by: {{ isset($task->created_by) ? $task->created_by->user->name : 'Default Task' }}
@if ($task->is_form_viewable == 1)
View Report: View Report
@if ($task->is_responder_details == 1 && isset($task->case)) @php $responder = $task->case->getReporter(); $UserType = optional($responder)->user_job()?->job_details?->job ?? '--'; @endphp
Responder: {{$responder->name}} | {{$UserType}}
@endif @if ($task->is_date_time == 1 && isset($task->case))
Form submitted at: {{$task->case->created_at->format('d M Y, h:i a')}} ({{$task->case->created_at->diffForHumans() }})
@endif @if ($task->is_site_details == 1 && isset($task->case)) @php $case = $task->case; @endphp
Sites Involved:
{{ isset($case->location->location_id) ? $case->location->location_id : $case->location_name}} @if (isset($case->link_case_with_form->all_involved_sites) && $case->link_case_with_form->all_involved_sites->count() > 0) @foreach ( $case->link_case_with_form->all_involved_sites as $l_sites ) @if ($l_sites->location->id == $case->location->id) @continue @endif location->email != 'external@qitech.com') title="{{$l_sites->location->location_full_address}}" @endif> , {{ isset($l_sites->location->location_id) ? $l_sites->location->location_id : $l_sites->location->trading_name}} @endforeach @endif
@endif @endif @if(isset($task->task_documents) && count($task->task_documents) > 0)
Documents:
@endif
{{-- Forms --}} @if (isset($task->form_json) || $task->linked_forms->isNotEmpty() || $task->backend_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->completed_at))

{{$f_form->form->name}}

{{ $f_form->is_mandatory == 1 ? 'Mandatory' : 'Optional' }}
@elseif (isset($f_form->form) && isset($f_form->form->external_link) && !isset($f_form->completed_at))

{{$f_form->form->name}}

{{ $f_form->is_mandatory == 1 ? 'Mandatory' : 'Optional' }}
@endif @endforeach @endif {{-- Backend forms --}} @if (isset($task->backend_forms)) @foreach ($task->backend_forms as $f_form) @php $formUrl = route('location.be_spoke_forms.location_submit_form_task_backend_json', ['id' => $f_form->id, 'task_id' => $task->id, 'backend' => 1]); $taskUrl = route('head_office.be_spoke_forms_templates.get_form_task_submit_json_linked', ['id' => $f_form->id, 'task_id' => $task->id, 'backend' => 1]); @endphp @if (isset($f_form))
@endif @endforeach @endif
@endif
@php $comments = $task->comments; @endphp @foreach ($comments as $key => $comment) @include('head_office.case_manager.notes.new_task_view_comments', compact('comment')) @endforeach
@include('head_office.case_manager.notes.new_task_comments', [ 'comment' => null, 'parent' => null, 'remove_backdrop' => true, ])
@endsection @section('scripts') @endsection