@extends('layouts.app') @section('content') @php $tabs = [ 'pending' => 'Pending Tasks', 'my_tasks' => 'All My Tasks', 'specific' => 'Specific Tasks', 'general' => 'General Tasks', 'given_by_me' => 'Tasks Given By Me', 'history' => 'My History', 'notes' => 'Employee Notes', 'categories' => 'Categories', 'report' => 'Task Report', ]; $activeTab = $filters['tab'] ?? 'pending'; $statuses = ['new' => 'New', 'pending' => 'Pending', 'ongoing' => 'Ongoing', 'completed' => 'Completed', 'verified' => 'Verified', 'rejected' => 'Rejected', 'cancelled' => 'Cancelled']; $types = ['specific' => 'Specific', 'general' => 'General', 'support' => 'Support Ticket', 'internal' => 'Internal']; $priorities = ['low' => 'Low', 'normal' => 'Normal', 'high' => 'High', 'urgent' => 'Urgent']; $modes = ['none' => 'No target', 'number' => 'Numbers', 'percentage' => 'Percentage (%)', 'yes_no' => 'Yes / No']; $canCreateTask = ($can['tasks.create_own'] ?? false) || ($can['tasks.post_specific'] ?? false) || ($can['tasks.post_general'] ?? false) || ($can['tasks.post_for_others'] ?? false) || ($can['tasks.assign'] ?? false); $tabPermissions = [ 'pending' => ($can['tasks.view_own'] ?? false) || ($can['tasks.view_others_specific'] ?? false) || ($can['tasks.view_others_general'] ?? false), 'my_tasks' => $can['tasks.view_own'] ?? false, 'specific' => ($can['tasks.view_own'] ?? false) || ($can['tasks.view_others_specific'] ?? false), 'general' => ($can['tasks.view_own'] ?? false) || ($can['tasks.view_others_general'] ?? false), 'given_by_me' => $can['tasks.view_own'] ?? false, 'history' => $can['tasks.view_own'] ?? false, 'notes' => $can['tasks.employee_notes_for_others'] ?? false, 'categories' => $can['task_categories.view'] ?? false, 'report' => $can['tasks.reports'] ?? false, ]; @endphp
Task Management
Track work, daily targets, progress, supervisor reviews, and employee notes.
@if($can['task_categories.create'] ?? false) @endif @if($can['tasks.employee_notes_for_others'] ?? false) @endif @if($canCreateTask) @endif
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif
@foreach($tabs as $key => $label) @if($tabPermissions[$key] ?? false) {{ $label }} @endif @endforeach
Pending{{ number_format($summary['pending']) }}
My Pending{{ number_format($summary['my_pending']) }}
Overdue{{ number_format($summary['overdue']) }}
Completed{{ number_format($summary['completed']) }}
Verified{{ number_format($summary['verified']) }}

Search Tasks

Reset
@if($activeTab === 'categories')

Task Categories

@if($can['task_categories.create'] ?? false) @endif
@forelse($categories as $category) @empty @endforelse
Task Name Mode Description Recurring Status Action
{{ $category->name }} {{ $modes[$category->default_measurement_mode] ?? ucfirst(str_replace('_', ' ', $category->default_measurement_mode)) }} {{ $category->description ?: '-' }} {{ $category->recurrence_frequency === 'none' ? '-' : ($category->recurrence_frequency === 'weekly' ? 'Selected weekdays' : ucfirst($category->recurrence_frequency)) }} {{ $category->is_active ? 'Active' : 'Inactive' }}
@if($can['task_categories.update'] ?? false) @endif @if($can['task_categories.delete'] ?? false)
@csrf @method('DELETE')
@endif
No category available.
Showing {{ $categories->count() ? 1 : 0 }} to {{ $categories->count() }} of {{ $categories->count() }} entries
@elseif($activeTab === 'notes')

Employee Notes

@forelse($employeeNotes as $note)
{{ $note->employee?->name ?: '-' }}
{{ $note->note_date?->format('Y-m-d') }} | {{ ucfirst($note->note_type) }} | Posted by {{ $note->postedBy?->name ?: '-' }}
{{ $note->note }}
@empty
No employee notes found.
@endforelse
@else

{{ $tabs[$activeTab] ?? 'Tasks' }}

@if($canCreateTask) @endif
@forelse($tasks as $task) @php $daysDue = $task->due_date ? now()->startOfDay()->diffInDays($task->due_date->copy()->startOfDay(), false) : null; $isOverdue = $task->due_date && $task->due_date->isPast() && !in_array($task->status, ['completed', 'verified', 'cancelled']); $isOwnTask = in_array((int) auth()->id(), [(int) $task->assigned_to_id, (int) $task->assigned_by_id, (int) $task->supervisor_id], true); $canUpdateTask = ($isOwnTask && ($can['tasks.update_own'] ?? false)) || (!$isOwnTask && ($can['tasks.assign'] ?? false)); $canDeleteTask = ($isOwnTask && ($can['tasks.delete_own'] ?? false)) || (!$isOwnTask && ($can['tasks.assign'] ?? false)); $canUpdateProgress = ($isOwnTask && ($can['tasks.update_own'] ?? false)) || (!$isOwnTask && ($can['tasks.clear_any_pending'] ?? false)); @endphp @empty @endforelse
Task No. Start Date Due Date Target / Achieved Days Due Assigned To Subject Description Supervisor Status Category Progress Action
{{ $task->task_no }} {{ $task->start_date?->format('Y-m-d H:i') ?: '-' }} {{ $task->due_date?->format('Y-m-d H:i') ?: '-' }} {{ $task->target_value !== null ? number_format($task->target_value, 2) : '-' }} / {{ number_format($task->achieved_value, 2) }}
{{ ucfirst(str_replace('_', ' ', $task->measurement_mode)) }}
{{ $daysDue === null ? '-' : ($daysDue < 0 ? abs($daysDue).' overdue' : $daysDue.' left') }} {{ $task->assignedTo?->name ?: ($task->task_type === 'general' ? 'General' : '-') }}
{{ $task->subject }}
{{ ucfirst($task->priority) }} | {{ ucfirst($task->task_type) }}
@if($task->recurrence_frequency !== 'none')
Repeats: {{ $task->recurrence_frequency === 'weekly' ? 'Selected weekdays' : ucfirst($task->recurrence_frequency) }}
Next: {{ $task->recurrence_next_at?->format('Y-m-d H:i') ?: 'Stopped / Finished' }}
@elseif($task->recurrence_source_id)
Recurring task
@endif
{{ $task->description ?: '-' }} {{ $task->supervisor?->name ?: '-' }} {{ $isOverdue ? 'Overdue' : ($statuses[$task->status] ?? $task->status) }} {{ $task->category?->name ?: '-' }} @php $latest = $task->progressUpdates->sortByDesc('created_at')->first(); @endphp
{{ $latest?->progress_note ?: '-' }}
{{ $latest?->created_at?->format('Y-m-d H:i') }}
@if($canUpdateProgress) @endif @if($canUpdateTask) @endif @if($canDeleteTask)
@csrf @method('DELETE')
@endif @unless($canUpdateProgress || $canUpdateTask || $canDeleteTask) @endunless
There are no records found.
{{ $tasks->links() }}
@endif
@endsection