@extends('layouts.master') @section('title', 'Admin Dashboard') @section('style') @endsection @section('script') @endsection @section('content')
@include('layouts.sidebar')
@yield('title')

ภาพรวมการเบิก-จ่ายวัสดุและอุปกรณ์

{{ now()->format('d F Y') }} {{ \Carbon\Carbon::now()->locale('en')->translatedFormat('l H:i') }}
👋 Hello, {{ Auth::user()->name ?? 'Guest' }}

ยินดีต้อนรับสู่ระบบบริหารจัดการวัสดุและอุปกรณ์


{{ number_format(array_sum($statusCounts ?? [])) }}

รายการเบิกทั้งหมด


@php $pct = $percentageChanges['total'] ?? 0; @endphp
{{ $pct >= 0 ? '▲' : '▼' }} {{ abs($pct) }}%

จากเดือนที่แล้ว

{{ $statusCounts['pending_admin'] ?? 0 }}

รอแอดมินตรวจสอบ


@php $pct = $percentageChanges['pending_admin'] ?? 0; @endphp
{{ $pct >= 0 ? '▲' : '▼' }} {{ abs($pct) }}%

จากเดือนที่แล้ว

{{ $statusCounts['pending_supervisor'] ?? 0 }}

รอหัวหน้าตรวจสอบ


@php $pct = $percentageChanges['pending_supervisor'] ?? 0; @endphp
{{ $pct >= 0 ? '▲' : '▼' }} {{ abs($pct) }}%

จากเดือนที่แล้ว

{{ $statusCounts['pending_auth'] ?? 0 }}

รออนุมัติ


@php $pct = $percentageChanges['pending_auth'] ?? 0; @endphp
{{ $pct >= 0 ? '▲' : '▼' }} {{ abs($pct) }}%

จากเดือนที่แล้ว

{{ $statusCounts['approved'] ?? 0 }}

อนุมัติแล้ว


@php $pct = $percentageChanges['approved'] ?? 0; @endphp
{{ $pct >= 0 ? '▲' : '▼' }} {{ abs($pct) }}%

จากเดือนที่แล้ว

{{ $statusCounts['rejected'] ?? 0 }}

ไม่อนุมัติ


@php $pct = $percentageChanges['rejected'] ?? 0; @endphp
{{ $pct >= 0 ? '▲' : '▼' }} {{ abs($pct) }}%

จากเดือนที่แล้ว


รายการเบิกล่าสุด
View All
@forelse($latestWithdraw as $item) @empty @endforelse
# Product Name Customer Name Date Qty Status
{{ $loop->iteration }} {{ $item->product_name }} {{ $item->user_fullname }} {{ date('d M Y', strtotime($item->order_request_date)) }} {{ number_format($item->total_qty) }} @if ($item->item_status == 'pending') รออนุมัติ @elseif($item->item_status == 'approved') อนุมัติแล้ว @elseif($item->item_status == 'rejected') ไม่อนุมัติ @elseif($item->item_status == 'delivered') จัดส่งแล้ว @elseif($item->item_status == 'returned') คืนสินค้าแล้ว @else {{ $item->item_status ?? '-' }} @endif
ไม่มีข้อมูล

สินค้าที่มีการเบิกมากที่สุด
@php // หาค่าการเบิกที่สูงที่สุดในรายการเพื่อใช้เป็นฐาน 100% สำหรับ Progress Bar $maxWithdraw = count($topProducts) > 0 ? collect($topProducts)->max('total_withdraw') : 1; @endphp @foreach ($topProducts as $index => $product)
{{ $index + 1 }} product
{{ $product->product_name }}
@php $currentPercentage = $maxWithdraw > 0 ? ($product->total_withdraw / $maxWithdraw) * 100 : 0; @endphp
{{ number_format($product->total_withdraw) }} รายการ ({{ round($currentPercentage) }}%)
@endforeach @if (empty($topProducts))
ไม่มีข้อมูลสินค้า
@endif

{{--
สถิติภาพรวม
--}}
จำนวนสินค้าในระบบ
{{ number_format($totalProductCount ?? 0) }}
รายการ
มูลค่ารวมสินค้าคงเหลือ
{{ number_format($totalStockValue ?? 0) }}
บาท
หมวดหมู่สินค้า
{{ number_format($categoryCount ?? 0) }}
หมวดหมู่
ผู้ใช้งานในระบบ
{{ number_format($userCount ?? 0) }}
คน
กิจกรรมล่าสุด (Log Activity)
View All
@foreach ($logs as $log) @endforeach
{{ $log->TYPE ?? 'UPDATE' }}
user {{ $log->user_name ?? 'Nongtest' }}
{{ \Carbon\Carbon::parse($log->created_at)->format('d/m/Y H:i') }}
@endsection