@extends('layouts.location_app') @section('title', 'Tasks') @section('content') @livewireStyles()
Filter Tasks
Type



Status




Date
Task Deadline
30 Days
{{-- --}}

Tasks

@if($tasks->isEmpty())
No tasks found.
@else @foreach ($tasks as $task) @php // Use the due date from the task $effectiveDueDate = $task->due_date; // Calculate if overdue based on the due date $isOverdue = $effectiveDueDate && \Carbon\Carbon::parse($effectiveDueDate)->isPast() && $task->status !== 'completed'; $deadlineDays = $effectiveDueDate ? \Carbon\Carbon::now()->diffInDays(\Carbon\Carbon::parse($effectiveDueDate), false) : ''; // Get allocations for this task $taskHoAllocations = $hoAllocations->get($task->id, collect()); $taskLocAllocations = $locAllocations->get($task->id, collect()); @endphp
Task #{{ $task->id }}
{{ $task->title ?? '[Task Name goes here]' }}
{{ $task->priority ?? 'No Priority' }} @if($isOverdue) Overdue @endif
@if ($task->created_by_name)
Created by: {{ $task->created_by_name ?? 'Default Task' }}
@endif
Created at: {{ \Carbon\Carbon::parse($task->created_at)->format('d M Y (D) h:i a') }}
Last Updated {{ \Carbon\Carbon::parse($task->updated_at)->diffForHumans() }}
Due Date: {{ $effectiveDueDate ? \Carbon\Carbon::parse($effectiveDueDate)->format('d M Y (D) h:i a') : 'No Due Date' }}
@if ($taskHoAllocations->count() > 0)
Assigned To: {{ $taskHoAllocations->pluck('name')->implode(', ') }}
@endif @if ($taskLocAllocations->count() > 0)
Assigned To: {{ $taskLocAllocations->pluck('trading_name')->implode(', ') }}
@endif @if ($task->case_location_name)
Site Involved: {{ $task->case_location_name ?? 'Unknown Site' }}
@endif
Description:
{!! $task->description ?? 'No Description' !!}
@livewire('task-status', ['task' => $task->id])
@endforeach @endif
1 Items Selected
@endsection @livewireScripts @section('scripts') @endsection