@extends('layouts.app') @section('page-pretitle', __('Management')) @section('page-title', __('Dashboard')) @section('content') @if ($errors->any()) @endif @if (session('success')) @endif
@if($announcements->count() > 0) @else @endif
{{--
--}}
{{-- Assigned Projects (Takes two rows / taller) --}} @php $isAdmin = auth()->user()->role === 'admin'; @endphp

{{ $isAdmin ? 'Total Projects' : 'Your Assigned Projects' }}


{{ $isAdmin ? $totalProjects : $totalAssignedProjects }}

{{--

Your Assigned Projects


{{ $totalAssignedProjects }}

--}} {{-- Project Types --}}
@php $types = [ 'Pending Project' => ['text-warning', 'bg-warning-subtle'], 'On Going Project' => ['text-primary', 'bg-primary-subtle'], 'KIV Project' => ['text-secondary', 'bg-secondary-subtle'], 'Cancel Project' => ['text-danger', 'bg-danger-subtle'], 'Completed Project' => ['text-success', 'bg-success-subtle'], ]; @endphp @foreach ($types as $type => [$textClass, $bgClass])
{{ $projectTypeCounts[$type] ?? 0 }}
{{ $type }}
@endforeach
{{-- Submission Progression Status --}}
Submission Progression Status
@foreach($statuses as $statusId => $statusName) @php // Define icon and color classes $statusStyles = [ 'pending' => ['icon' => 'ti ti-progress-alert', 'text' => 'text-warning', 'bg' => 'bg-warning-subtle'], 'in progress' => ['icon' => 'ti ti-progress', 'text' => 'text-primary', 'bg' => 'bg-primary-subtle'], 'completed' => ['icon' => 'ti ti-progress-check', 'text' => 'text-success', 'bg' => 'bg-success-subtle'], 'need review' => ['icon' => 'ti ti-progress-help', 'text' => 'text-info', 'bg' => 'bg-info-subtle'], 'not yet submitted' => ['icon' => 'ti ti-ban', 'text' => 'text-danger', 'bg' => 'bg-danger-subtle'], 'default' => ['icon' => 'ti ti-progress-bolt', 'text' => 'text-secondary', 'bg' => 'bg-secondary-subtle'], ]; $key = strtolower($statusName); $style = $statusStyles[$key] ?? $statusStyles['default']; @endphp
{{ $statusCounts[$statusId] ?? 0 }}
{{ Str::title($statusName) }}
Submission
{{-- Modal --}} @include('partials.status-modal', [ 'statusId' => $statusId, 'statusName' => $statusName, 'submissionTypesByStatus' => $submissionTypesByStatus ]) @endforeach
{{--
--}}
Others

{{ __('License & Renewal Due Soon') }}

@if (!$overdueNotes->isEmpty()) @php // Get the month and year of the first grouped item $firstGroupMonthYear = \Carbon\Carbon::parse($overdueNotes->first()->notes_duedate)->format('F Y'); @endphp
{{ $firstGroupMonthYear }}
@endif
@if ($overdueNotes->isEmpty())
There is no license and renewal available for the current month.
@else @foreach ($overdueNotes->groupBy(function($note) { return \Carbon\Carbon::parse($note->notes_duedate)->format('F Y'); }) as $monthYear => $group) {{--

{{ $monthYear }}

--}}
Date
    @foreach ($group as $note) {{-- @php $dueDate = \Carbon\Carbon::parse($note->notes_duedate); $isDueToday = $dueDate->isToday(); $isOverdue = $dueDate->isPast(); // includes today $textColor = $isOverdue ? 'red' : 'blue'; $iconBg = $isOverdue ? 'bg-red-lt' : 'bg-blue-lt'; @endphp --}} @php $dueDate = \Carbon\Carbon::parse($note->notes_duedate); $isDueToday = $dueDate->isToday(); $isOverdue = $dueDate->isPast() && !$isDueToday; $textColor = ($isDueToday || $isOverdue) ? 'red' : 'blue'; $iconBg = ($isDueToday || $isOverdue) ? 'bg-red-lt' : 'bg-blue-lt'; $badgeText = $isDueToday ? 'Today' : $dueDate->diffForHumans(); @endphp
  • {{--
    {{ $dueDate->format('d') }}
    --}}
    {{ $dueDate->format('d') }}
    {{-- {{ $dueDate->diffForHumans() }} --}} {{ $badgeText }}

    {{ ucfirst($note->notes) }}

    Project: {{ $note->project->description ?? '-' }}
    Client: {{ $note->project->client ?? '-' }}

    Created on {{ $note->created_at->format('d M Y') }}
  • @endforeach
@endforeach @endif

My To-Do List

{{-- {{ $startOfWeek->format('d M') }} - {{ $endOfWeek->format('d M Y') }} --}}
@if(auth()->user()->role === 'admin') {{--
Clear
--}} @endif
@csrf
@forelse($todos as $todo)
@csrf @method('PATCH') is_done ? 'checked' : '' }} class="form-check-input mt-1">
{{ \Illuminate\Support\Str::words($todo->title, 4, '...') }}
@if($todo->project && $todo->project->ref_no) {{ $todo->project->ref_no }} @endif @if($todo->user && ($todo->assigned_by == auth()->id() || is_null($todo->assigned_by))) {{-- {{ $todo->user->name }} --}} @endif
@if($todo->date_received) Assigned Date: {{ \Carbon\Carbon::parse($todo->date_received)->format('d-m-Y') }} @endif @if($todo->created_at && is_null($todo->date_received)) Created Date: {{ \Carbon\Carbon::parse($todo->created_at)->format('d-m-Y') }} @endif @if($todo->date_received && $todo->due_date)  |  @endif @if($todo->due_date) Due Date: {{ \Carbon\Carbon::parse($todo->due_date)->format('d-m-Y') }} @endif @if($todo->due_date && $todo->status)  |  @endif @if($todo->status) Status: {{ $todo->status->name }} @endif @if($todo->assigned_by)  | 
Assigned By: {{ $todo->assigner->name ?? '-' }} @endif
@auth {{-- @if ($todo->assigned_by === Auth::id() || is_null($todo->assigned_by)) --}} @if (is_null($todo->assigned_by))
@csrf @method('DELETE')
@endif @endauth
@empty
No to-dos for this week.
@endforelse
{{--
--}}

My Task

{{-- {{ $startOfWeek->format('d M') }} - {{ $endOfWeek->format('d M Y') }} --}}
{{--
{{-- Tasks Tab --}}
@if($userTasks->isEmpty())

No tasks assigned to you.

@else
@foreach($userTasks as $item) @php $task = $item['task']; $project = $item['project']; $dueDate = $task->due_date ?? null; $isOverdue = $dueDate && $dueDate->isPast() && optional($task->status)->name !== 'Completed'; $overdueBadge = ''; if ($isOverdue) { $overdueBadge = $dueDate->diffForHumans(now(), [ 'parts' => 1, 'short' => false, 'syntax' => \Carbon\CarbonInterface::DIFF_RELATIVE_TO_NOW, ]); } @endphp
{{ $task->name }} {{-- {{ $task->user->name }} --}}
@if($task->priority == 1) Priority @endif @if ($isOverdue) {{ $overdueBadge }} @endif
Project: {{ $project->description ?? $project->project_name ?? 'Unknown' }}
@if($task->due_date) Due: {{ \Carbon\Carbon::parse($task->due_date)->format('d-m-Y') }} @else Due: No due date available @endif
@endforeach
{{-- --}} @endif
{{-- Overdue Tasks Tab --}} {{--
@if($overdueTasks->isEmpty())

No overdue tasks.

@else
@foreach($overdueTasks as $item)
{{ $item['task']->name ?? 'No name' }} {{ $item['task']->user->name ?? '' }}
@php $due = \Carbon\Carbon::parse($item['task']->end_date); $now = \Carbon\Carbon::now(); $daysOverdue = $now->diffInDays($due, false); @endphp {{ $daysOverdue == 0 ? 'Due Today' : abs($daysOverdue) . ' day' . (abs($daysOverdue) > 1 ? 's' : '') }}
Project: {{ $item['project']->project_title ?? '' }}
Due: {{ \Carbon\Carbon::parse($item['task']->end_date)->format('d-m-Y') }}
@endforeach
@endif
--}}
{{--
--}} {{-- Right Column: On-Going Project Progress --}} {{--

{{ __('On-Going Project Progress') }}


@forelse($projectsWithProgress as $index => $project) @empty @endforelse
# Project Assignee Progress
{{ $index + 1 }} {{ $project->description }} @forelse ($project->assignees as $user) {{ $user->name }} @empty No assignee @endforelse
{{ $project->weighted_progress }}%
{{ __('No ongoing projects.') }}
@if ($projectsWithProgress->hasPages()) @endif
--}}
@endsection