@extends('layouts.mainlayout') @section('fullwidth', true) @section('content') @php $dashboardMetrics = [ 'total_staff' => DB::table('ourstaffs')->count(), 'active_staff' => DB::table('ourstaffs')->where('status', 2)->count(), 'active_farms' => DB::table('farm')->where('status', 1)->count(), 'open_transit' => DB::table('tranzit')->whereIn('status', [1, 2, 6])->count(), ]; $transitSnapshot = [ 'today_arrivals' => DB::table('tranzit')->whereDate('arrival_date', date('Y-m-d'))->count(), 'tomorrow_arrivals' => DB::table('tranzit')->whereDate('arrival_date', date('Y-m-d', strtotime('+1 day')))->count(), 'pending_requests' => DB::table('tranzit')->where('status', 1)->count(), ]; $transitSummaryPreview = DB::table('tranzit') ->select('arrival_date', DB::raw('COUNT(*) as travel_count')) ->whereIn('status', [1, 2]) ->whereDate('arrival_date', '>=', date('Y-m-d')) ->groupBy('arrival_date') ->orderBy('arrival_date') ->limit(3) ->get(); $recentActivity = DB::table('log') ->leftJoin('users', 'users.id', '=', 'log.user') ->where('log.content', 'not like', '%chart generated%') ->select('log.id', 'log.dattim', 'log.content', 'log.role', 'users.name') ->orderByDesc('log.id') ->limit(6) ->get(); $dashboardChartData = \App\Services\DashboardChartData::build(); $charts = [ ["id" => "farm-staff", "title" => "Active farm staff", "description" => "Current staff distribution across active farms.", "icon" => "fa-users", "url" => "/activestaffs"], ["id" => "contracts", "title" => "New contracts by year", "description" => "Yearly development of registered employment contracts.", "icon" => "fa-file-signature", "url" => null], ["id" => "potential-departures", "title" => "Potential departures", "description" => "Active farm staff approaching or passing 90 days.", "icon" => "fa-user-clock", "url" => "/farm_staffs_potential_departed"], ["id" => "gender", "title" => "Active staff by gender", "description" => "Gender distribution among currently active staff.", "icon" => "fa-venus-mars", "url" => null], ["id" => "transit", "title" => "Finalized transit by month", "description" => "Completed transit activity during ".date("Y").".", "icon" => "fa-plane", "url" => "/tranzit_charts"], ["id" => "usage", "title" => "Weekly program usage", "description" => "Application usage activity during ".date("Y").".", "icon" => "fa-chart-line", "url" => null], ]; @endphp

Admin Dashboard

  1. Dashboard
  2. Admin Dashboard
{{ date('F Y') }}

Welcome back, {{ Auth::user()->name }}

Here is the latest overview of your manpower operations.

Transit summary

Upcoming travel dates included in the general email summary.

View summary
@forelse($transitSummaryPreview as $summaryDate) {{ date('F j, Y', strtotime($summaryDate->arrival_date)) }} {{ $summaryDate->travel_count }} {{ $summaryDate->travel_count == 1 ? 'travel' : 'travels' }} @empty
No upcoming transit summary records.
@endforelse
Active farms {{ number_format($dashboardMetrics['active_farms']) }} Operational locations

Workforce analytics

The existing operational charts in the new dashboard layout.

@foreach($charts as $dashboardChart)

{{ $dashboardChart['title'] }}

{{ $dashboardChart['description'] }}

@if($dashboardChart['url']) View details @endif
@endforeach

Recent activity

Latest operational actions.

@forelse($recentActivity as $activity)

{{ $activity->content }}

{{ $activity->name ?: $activity->role }} · {{ date('M j, H:i', strtotime($activity->dattim)) }}
@empty
No recent activity.
@endforelse
@endsection