@extends('layouts.app')
@section('title','Dashboard')
@section('page-title','Dashboard')
@section('content')
{{-- ===== LOGIN REMINDER MODAL ===== --}}
@if(session()->pull('show_login_reminder'))
@php
$metrics = [
['label'=>'Total Tender', 'value'=>number_format($stats['total_tenders']), 'trend'=>null, 'color'=>'fill-gray-800 dark:fill-white/90', 'bg'=>'bg-gray-100 dark:bg-gray-800',
'icon'=>'M8.50391 4.25H17.7504C18.1646 4.25 18.5004 4.58579 18.5004 5V16.75H9.25391C8.83969 16.75 8.50391 16.4142 8.50391 16V4.25ZM7.00391 4.99854V4.25C7.00391 3.00736 8.01127 2 9.25391 2H15.2777C15.8745 2 16.4468 2.23705 16.8687 2.659L19.3414 5.13168C19.7634 5.55364 20.0004 6.12594 20.0004 6.72268V16.75C20.0004 17.9926 18.9931 19 17.7504 19H16.248L16.248 19.75C16.248 20.9926 15.2407 22 13.998 22H6.24805C5.00541 22 3.99805 20.9926 3.99805 19.75V7.24854C3.99805 6.00589 5.00541 4.99854 6.24805 4.99854H7.00391Z'],
['label'=>'Tender Pipeline', 'value'=>number_format($stats['active_tenders']), 'trend'=>null, 'color'=>'fill-gray-800 dark:fill-white/90', 'bg'=>'bg-gray-100 dark:bg-gray-800',
'icon'=>'M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 6.25C12.4142 6.25 12.75 6.58579 12.75 7V11.6893L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L11.4697 12.5303C11.329 12.3897 11.25 12.1989 11.25 12V7C11.25 6.58579 11.5858 6.25 12 6.25Z'],
['label'=>'Tender Menang', 'value'=>number_format($stats['won_tenders']), 'trend'=>'up', 'color'=>'fill-gray-800 dark:fill-white/90', 'bg'=>'bg-gray-100 dark:bg-gray-800',
'icon'=>'M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2ZM13.7071 8.20711C14.0976 7.81658 14.0976 7.18342 13.7071 6.79289C13.3166 6.40237 12.6834 6.40237 12.2929 6.79289L9 10.0858L7.70711 8.79289C7.31658 8.40237 6.68342 8.40237 6.29289 8.79289C5.90237 9.18342 5.90237 9.81658 6.29289 10.2071L8.29289 12.2071C8.68342 12.5976 9.31658 12.5976 9.70711 12.2071L13.7071 8.20711Z'],
['label'=>'Tender Kalah', 'value'=>number_format($stats['lost_tenders']), 'trend'=>'down', 'color'=>'fill-gray-800 dark:fill-white/90', 'bg'=>'bg-gray-100 dark:bg-gray-800',
'icon'=>'M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2ZM13.2803 7.21967C13.5732 7.51256 13.5732 7.98744 13.2803 8.28033L11.0607 10.5L13.2803 12.7197C13.5732 13.0126 13.5732 13.4874 13.2803 13.7803C12.9874 14.0732 12.5126 14.0732 12.2197 13.7803L10 11.5607L7.78033 13.7803C7.48744 14.0732 7.01256 14.0732 6.71967 13.7803C6.42678 13.4874 6.42678 13.0126 6.71967 12.7197L8.93934 10.5L6.71967 8.28033C6.42678 7.98744 6.42678 7.51256 6.71967 7.21967C7.01256 6.92678 7.48744 6.92678 7.78033 7.21967L10 9.43934L12.2197 7.21967C12.5126 6.92678 12.9874 6.92678 13.2803 7.21967Z'],
['label'=>'Proposal Aktif', 'value'=>number_format($stats['active_proposals']),'trend'=>'up', 'color'=>'fill-gray-800 dark:fill-white/90', 'bg'=>'bg-gray-100 dark:bg-gray-800',
'icon'=>'M5.5 3.25H18.5C19.74 3.25 20.75 4.26 20.75 5.5V18.5C20.75 19.74 19.74 20.75 18.5 20.75H5.5C4.26 20.75 3.25 19.74 3.25 18.5V5.5C3.25 4.26 4.26 3.25 5.5 3.25ZM7 9.71H17V8.21H7V9.71ZM7 14.29H14V12.79H7V14.29Z'],
['label'=>'Win Rate', 'value'=>$stats['win_rate'].'%', 'trend'=>($stats['win_rate']>=50 ? 'up' : 'down'), 'color'=>'fill-gray-800 dark:fill-white/90', 'bg'=>'bg-gray-100 dark:bg-gray-800',
'icon'=>'M12 2C11.5858 2 11.25 2.33579 11.25 2.75V12C11.25 12.4142 11.5858 12.75 12 12.75H21.25C21.6642 12.75 22 12.4142 22 12C22 6.47715 17.5228 2 12 2ZM12.75 11.25V3.53263C17.3175 3.97919 20.9728 7.49498 21.4674 11.25H12.75ZM2 12C2 7.25083 5.31065 3.27489 9.75 2.25415V13.5H21.7459C20.7251 18.6894 16.7492 22 12 22C6.47715 22 2 17.5229 2 12Z'],
];
@endphp
@foreach($metrics as $m)
{{ $m['label'] }}
{{ $m['value'] }}
@if($m['trend'] === 'up')
Aktif
@elseif($m['trend'] === 'down')
Perlu Perhatian
@endif
@endforeach
{{-- Charts — exact chart-01 structure --}}
Tender Pipeline
Distribusi tender per tahap
Lihat Semua
@php
$pipelineItems = [
['key'=>'draft', 'label'=>'Draft', 'color'=>'bg-gray-400'],
['key'=>'identified', 'label'=>'Identified', 'color'=>'bg-blue-400'],
['key'=>'qualification', 'label'=>'Qualification', 'color'=>'bg-brand-500'],
['key'=>'preparation', 'label'=>'Preparation', 'color'=>'bg-warning-500'],
['key'=>'submitted', 'label'=>'Submitted', 'color'=>'bg-gray-700'],
['key'=>'evaluation', 'label'=>'Evaluation', 'color'=>'bg-blue-light-500'],
['key'=>'clarification', 'label'=>'Clarification', 'color'=>'bg-warning-600'],
['key'=>'negotiation', 'label'=>'Negotiation', 'color'=>'bg-theme-purple-500'],
['key'=>'won', 'label'=>'Won', 'color'=>'bg-success-500'],
['key'=>'lost', 'label'=>'Lost', 'color'=>'bg-error-500'],
['key'=>'completed', 'label'=>'Completed', 'color'=>'bg-success-700'],
['key'=>'cancelled', 'label'=>'Cancelled', 'color'=>'bg-gray-300'],
];
@endphp
@foreach($pipelineItems as $item)
@php $count = $stats['pipeline'][$item['key']] ?? 0; @endphp
{{ $count }}
{{ $item['label'] }}
@endforeach
{{-- Upcoming Deadlines --}}