@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
Dashboard MSJso

Ringkasan status permohonan dan performa penjualan secara real-time.

{{-- Card Pending Approval --}} {{-- Card Approved --}} {{-- Card Rejected --}} {{-- Card Unreviewed --}}
{{-- Ringkasan Riwayat Permohonan --}}
Ringkasan Riwayat Permohonan

Total akumulasi data permohonan

  • Approved (Overall)
    Permohonan yang telah disetujui keseluruhan
    {{ $count_approved_ovr ?? 0 }}
  • Rejected (Overall)
    Permohonan yang ditolak keseluruhan
    {{ $count_rejected_ovr ?? 0 }}
{{-- Jumlah Data per Divisi --}}
Jumlah Data per Divisi

Pembagian permohonan berdasarkan divisi operasional

  • Hygiene and Medical (H&M)
    Total permohonan divisi H&M
    {{ $count_hm ?? 0 }}
  • Industrial
    Total permohonan divisi Industrial
    {{ $count_industrial ?? 0 }}
{{-- Salesperson Dashboard Section --}}
Salesperson Dashboard

Performa penjualan per salesperson

@if(!empty($can_sync_sap))
@csrf
@endif Laporan Lengkap
{{-- Filter Form --}}
@if(!empty($salesperson_dashboard)) @php // Actual/On Hand USD sengaja null (sumber data tidak jelas) -> tampilkan '-' $fmtUsd = fn($v) => $v === null ? '-' : number_format((float) $v, 2); $fmtPct = fn($v) => $v === null ? '-' : number_format((float) $v, 1) . '%'; $fmtDiff = fn($a, $b) => ($a ?? null) === null ? '-' : number_format((float) $a - (float) $b, 2); @endphp {{-- Main Metrics Cards --}}

Sales SO {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }}

QTY (kg)

{{ number_format($salesperson_dashboard['sales_so_qty'] ?? 0, 2) }}

USD

{{ number_format($salesperson_dashboard['sales_so'] ?? 0, 2) }}

Sudah Dikirim & Dibayar {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }}

Sudah Dikirim (kg)

{{ number_format($salesperson_dashboard['sales_actual_qty'] ?? 0, 2) }}

Sudah Dibayar (USD)

{{ $fmtUsd($salesperson_dashboard['sales_actual'] ?? null) }}

Belum Dikirim & Dibayar {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }}

Belum Di Kirim (kg)

{{ number_format($salesperson_dashboard['sales_on_hand_qty'] ?? 0, 2) }}

Belum Dibayar (USD)

{{ $fmtUsd($salesperson_dashboard['sales_on_hand'] ?? null) }}
{{--

Est. Achievement {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }}

QTY (kg)

{{ number_format($salesperson_dashboard['estimated_achievement_qty'] ?? 0, 2) }}

USD

{{ $fmtUsd($salesperson_dashboard['estimated_achievement'] ?? null) }}
--}}
{{-- Percentage Cards --}}

% Budget

{{ $fmtPct($salesperson_dashboard['pct_budget'] ?? null) }}

Budget: {{ number_format($salesperson_dashboard['budget'] ?? 0, 2) }} kg

% Threshold

{{ $fmtPct($salesperson_dashboard['pct_threshold'] ?? null) }}

Threshold: {{ number_format($salesperson_dashboard['threshold'] ?? 0, 2) }} kg

% Target

{{ $fmtPct($salesperson_dashboard['pct_target'] ?? null) }}

Target: {{ number_format($salesperson_dashboard['target'] ?? 0, 2) }} kg

@if(!empty($salesperson_dashboard['pct_excellence']))

% Excellence

{{ $fmtPct($salesperson_dashboard['pct_excellence'] ?? null) }}

Excellence: {{ number_format($salesperson_dashboard['excellence_qty'] ?? 0, 2) }} kg

@endif
{{-- Customer Tables --}}
@if(!empty($salesperson_dashboard['hygiene_rows']))
Aplikasi: Hygiene
@foreach($salesperson_dashboard['hygiene_rows'] as $row) @endforeach
Customer Name SO (USD) SO Qty (kg) Sudah Dibayar (USD) Sudah Dikirim (kg) Belum Dibayar (USD) Belum Di Kirim (kg)
{{ $row['customer_name'] }} PIC {{ $salesperson_selected_salesperson }} {{ number_format($row['so_amount'] ?? 0, 2) }} {{ number_format($row['so_qty'] ?? 0, 2) }} {{ $fmtUsd($row['actual_amount']) }} {{ number_format($row['actual_qty'], 2) }} {{ $fmtUsd($row['on_hand_amount'] ?? null) }} {{ number_format($row['on_hand_qty'] ?? 0, 2) }}
@endif @if(!empty($salesperson_dashboard['medical_rows']))
Aplikasi: Medical
@foreach($salesperson_dashboard['medical_rows'] as $row) @endforeach
Customer Name SO (USD) SO Qty (kg) Sudah Dibayar (USD) Sudah Dikirim (kg) Belum Dibayar (USD) Belum Di Kirim (kg)
{{ $row['customer_name'] }} PIC {{ $salesperson_selected_salesperson }} {{ number_format($row['so_amount'] ?? 0, 2) }} {{ number_format($row['so_qty'] ?? 0, 2) }} {{ $fmtUsd($row['actual_amount']) }} {{ number_format($row['actual_qty'], 2) }} {{ $fmtUsd($row['on_hand_amount'] ?? null) }} {{ number_format($row['on_hand_qty'] ?? 0, 2) }}
@endif @if(!empty($salesperson_dashboard['industrial_rows']))
Aplikasi: Industrial
@foreach($salesperson_dashboard['industrial_rows'] as $row) @endforeach
Customer Name SO (USD) SO Qty (kg) Sudah Dibayar (USD) Sudah Dikirim (kg) Belum Dibayar (USD) Belum Di Kirim (kg)
{{ $row['customer_name'] }} PIC {{ $salesperson_selected_salesperson }} {{ number_format($row['so_amount'] ?? 0, 2) }} {{ number_format($row['so_qty'] ?? 0, 2) }} {{ $fmtUsd($row['actual_amount']) }} {{ number_format($row['actual_qty'], 2) }} {{ $fmtUsd($row['on_hand_amount'] ?? null) }} {{ number_format($row['on_hand_qty'] ?? 0, 2) }}
@endif
{{-- Summary Table --}}
Summary
@if(!empty($salesperson_dashboard['pct_excellence'])) @endif
Metric Target (kg) SO Qty (kg) Sudah Dikirim (kg) Difference (kg) % Achievement
Budget {{ $salesperson_selected_year }} VS Sudah Dikirim {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }} {{ $salesperson_selected_salesperson }} {{ number_format($salesperson_dashboard['budget'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_so_qty'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_actual_qty'] ?? 0, 2) }} {{ $fmtDiff($salesperson_dashboard['sales_actual_qty'] ?? null, $salesperson_dashboard['budget'] ?? 0) }} {{ $fmtPct($salesperson_dashboard['pct_budget'] ?? null) }}
Threshold {{ $salesperson_selected_year }} VS Sudah Dikirim {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }} {{ $salesperson_selected_salesperson }} {{ number_format($salesperson_dashboard['threshold'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_so_qty'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_actual_qty'] ?? 0, 2) }} {{ $fmtDiff($salesperson_dashboard['sales_actual_qty'] ?? null, $salesperson_dashboard['threshold'] ?? 0) }} {{ $fmtPct($salesperson_dashboard['pct_threshold'] ?? null) }}
Target {{ $salesperson_selected_year }} VS Sudah Dikirim {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }} {{ $salesperson_selected_salesperson }} {{ number_format($salesperson_dashboard['target'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_so_qty'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_actual_qty'] ?? 0, 2) }} {{ $fmtDiff($salesperson_dashboard['sales_actual_qty'] ?? null, $salesperson_dashboard['target'] ?? 0) }} {{ $fmtPct($salesperson_dashboard['pct_target'] ?? null) }}
Excellence {{ $salesperson_selected_year }} VS Sudah Dikirim {{ $salesperson_month_options[$salesperson_selected_month] }} {{ $salesperson_selected_year }} {{ $salesperson_selected_salesperson }} {{ number_format($salesperson_dashboard['excellence_qty'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_so_qty'] ?? 0, 2) }} {{ number_format($salesperson_dashboard['sales_actual_qty'] ?? 0, 2) }} {{ $fmtDiff($salesperson_dashboard['sales_actual_qty'] ?? null, $salesperson_dashboard['target'] ?? 0) }} {{ $fmtPct($salesperson_dashboard['pct_excellence'] ?? null) }}
{{-- Detail Data untuk popup (prompt7) --}} @php $customerMap = $salesperson_dashboard['customer_map'] ?? []; $priceHistoryMap = $salesperson_dashboard['price_history'] ?? []; $detailJson = []; foreach ($customerMap as $code => $cdata) { $detailJson[$code] = [ 'so_amount' => $cdata['so_amount'] ?? 0, 'so_qty' => $cdata['so_qty'] ?? 0, 'so_details' => $cdata['so_details'] ?? [], 'actual_amount' => $cdata['actual_amount'] ?? 0, 'actual_qty' => $cdata['actual_qty'] ?? 0, 'actual_details' => $cdata['actual_details'] ?? [], 'actual_qty_details' => $cdata['actual_qty_details'] ?? [], 'on_hand_amount' => ($cdata['so_amount'] ?? 0) - ($cdata['cumulative_actual_amount'] ?? 0), 'on_hand_qty' => ($cdata['so_qty'] ?? 0) - ($cdata['actual_qty'] ?? 0), 'on_hand_details' => $cdata['on_hand_details'] ?? [], 'price_history' => $priceHistoryMap[$code] ?? null, ]; } @endphp @else

Pilih salesperson untuk melihat dashboard

@endif
{{-- Data Source Indicator --}}
@if(!empty($data_source_currency_missing)) @endif
@php $indoMonths = [1=>'Januari',2=>'Februari',3=>'Maret',4=>'April',5=>'Mei',6=>'Juni',7=>'Juli',8=>'Agustus',9=>'September',10=>'Oktober',11=>'November',12=>'Desember']; $fmtTgl = function($dt) use ($indoMonths) { if (!$dt) return '-'; try { $c = \Carbon\Carbon::parse($dt); return $c->format('j') . ' ' . ($indoMonths[(int)$c->format('n')] ?? $c->format('F')) . ' ' . $c->format('Y H:i'); } catch (\Exception $e) { return $dt; } }; @endphp Data SAP: hingga {{ $fmtTgl($data_source_sap_until) }} Data Sistem: mulai {{ $fmtTgl($data_source_system_from) }} @if(!empty($data_source_onhand_until)) Data Belum Di Kirim: {{ $fmtTgl($data_source_onhand_until) }} @else Data Belum Di Kirim: belum tersedia @endif
{{-- Detail Popup Modal (prompt7) --}} {{-- Price History Popup Modal (prompt15) --}} @endsection @push('js') @endpush