@extends('layouts.head_office_app') @if (isset($case)) @section('title', 'Case ' . $case->id) @endif @section('content') @php $case_involved_locations = isset($case) ? $case->link_case_with_form->getInvolvedLocations() : collect(); $involved_location_ids_sorted = isset($case->link_case_with_form) && $case->link_case_with_form->hide == 0 && isset($case_involved_locations) ? $case_involved_locations->pluck('id')->toArray() : []; @endphp
{{isset($new_task) ? 'Edit task' : 'Create new task'}}

Easily assign tasks based on your needs.

@if (isset($case)) @endif @if(!request()->query('loc_id')) @endif

@if (isset($case))

Case ID: #{{$case->id}}

@endif

Saved Templates

Loading...

@if ( (isset($case) && !isset($new_task)) || (isset($new_task) && is_null($new_task->shared_with)) )
@csrf @include('head_office.case_manager.notes.create_task_component', [ 'type' => 'case_task', ])
@endif
@if (isset($case_involved_locations) && count($case_involved_locations) > 0) @foreach ($case_involved_locations as $ho_loc) @php // Skip if this location is already in preselected (task-assigned) locations $isTaskAssigned = request()->query('loc_id') == $ho_loc->head_office_location->id || (isset($new_task) && $new_task->loc_allocations->contains('ho_location_id', $ho_loc->head_office_location->id)); @endphp @if (!$isTaskAssigned)
{{ $ho_loc->username }}
@if (isset($ho_loc->location_type))
{{ $ho_loc->location_type->name }}
@endif
@if ($ho_loc->id == $case->link_case_with_form->location_id) Reported From @endif
@if (isset($ho_loc->location_code)) #{{ $ho_loc->location_code . ' | ' }} @endif {{ $ho_loc->trading_name }}
address {{ $ho_loc->full_address }}
email {{ $ho_loc->email }}
phone {{ $ho_loc->telephone_no }}
@endif @endforeach @endif @if (isset($head_office->locations) && count($head_office->locations) > 0) @php // Get IDs of already involved locations to filter them out $involved_location_ids = isset($case_involved_locations) ? $case_involved_locations->pluck('id')->toArray() : []; // Collect task-related preselected HO location ids $preselected_location_ids = []; foreach ($head_office->locations as $ho_loc_pre) { $isPreselected = request()->query('loc_id') == $ho_loc_pre->id || (isset($new_task) && $new_task->loc_allocations->contains('ho_location_id', $ho_loc_pre->id)); // Include preselected locations even if they are in involved locations (for task editing) if ($isPreselected) { $preselected_location_ids[] = $ho_loc_pre->id; } } @endphp @if (!empty($preselected_location_ids)) @foreach ($head_office->locations as $ho_loc) @if (in_array($ho_loc->id, $preselected_location_ids))
{{ $ho_loc->location->username }}
@if (isset($ho_loc->location->location_type))
{{ $ho_loc->location->location_type->name }}
@endif
@if (isset($case) && isset($case->link_case_with_form) && $ho_loc->location->id == $case->link_case_with_form->location_id) Reported From @endif
@if (isset($ho_loc->location->location_code)) #{{ $ho_loc->location->location_code . ' | ' }} @endif {{ $ho_loc->location->trading_name }}
address {{ $ho_loc->location->full_address }}
email {{ $ho_loc->location->email }}
phone {{ $ho_loc->location->telephone_no }}
@endif @endforeach @endif
@php if($profile->super_access == 1){ $assigned_locations = $head_office->locations; }else{ $assigned_locations = $head_office_user->get_assigned_locs(); } @endphp @foreach ($assigned_locations as $ho_loc) @if (!in_array($ho_loc->id, $preselected_location_ids) && !in_array($ho_loc->location->id, $involved_location_ids))
{{ $ho_loc->location->username }}
@if (isset($ho_loc->location->location_type))
{{ $ho_loc->location->location_type->name }}
@endif
@if (isset($ho_loc->location->location_code)) #{{ $ho_loc->location->location_code . ' | ' }} @endif {{ $ho_loc->location->trading_name }}
address {{ $ho_loc->location->full_address }}
email {{ $ho_loc->location->email }}
phone {{ $ho_loc->location->telephone_no }}
@endif @endforeach
@endif
{{-- ====== CREATE TEMPLATE MODAL (fullscreen, all task fields) ====== --}} @endsection @section('scripts') @if (request()->query('loc_id')) @endif {{-- ====== TASK TEMPLATES JS ====== --}} @endsection