@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
List {{ $title_menu }}
{{-- alert --}} @include('components.alert')

{{-- BAGIAN KIRI: TOMBOL TAMBAH --}}
{{-- BAGIAN TENGAH: FILTER STATUS MATCHING COLOR (BUTTON GROUP) --}}
@php $currentStatusFilter = request('status', $status_filter ?? null); @endphp
Status Matching:
{{-- BAGIAN KANAN: SEARCH BAR --}}
{{-- Label Cari --}} {{-- Input Field --}}
{{-- 3. CONTENT (LIST CARD) --}}
{{-- Alert if Empty --}} @if ($table_detail->isEmpty())
No data found.
@else {{-- Loop through Grouped Data --}} @foreach ($table_detail as $reqNo => $group) @php $req = $group['request_info']; @endphp
{{-- CARD HEADER (Request Info) --}}
{{ $req->request_no }} @php $status = strtolower($req->status_req); $displayText = strtoupper($status); // Default text adalah statusnya (COMPLETED, ENTRY, dll) $badgeClass = 'bg-gradient-secondary'; // Default warna $icon = 'fa-info-circle'; // Default icon // LOGIC CUSTOM if ($status == 'progress') { // 1. Hitung jumlah sample jika status progress $countSample = DB::table('match_result') ->where( 'request_no', $req->request_no, ) ->count(); $displayText = $countSample . ' ' . ($countSample <= 1 ? 'sample' : 'samples') . ' (PROGRESS)'; $badgeClass = 'bg-secondary'; // Kuning $icon = 'fa-spinner fa-spin'; // Icon loading } // STATUS LAINNYA else { $badgeClass = match ($status) { 'completed' => 'bg-success', 'underreview' => 'bg-danger', default => 'bg-warning', }; $icon = match ($status) { 'completed' => 'fa-check-circle', 'rejected' => 'fa-times-circle', default => 'fa-info-circle', }; } @endphp {{-- Tampilan Badge yang Lebih Bagus --}} {{ $displayText }}
{{ $req->customer_name }}  |  {{ $req->customer_color_code ?? '-' }}
{{-- Jika status OPEN/PROGRESS -> Link Aktif --}} View Detail
{{-- CARD BODY (Nested Table for Suppliers & Samples) --}}
@foreach ($group['suppliers'] as $supplierName => $samples) @foreach ($samples as $index => $row) {{-- Supplier Column (Only show once per supplier group) --}} {{-- Sample Code --}} {{-- Dates --}} {{-- Pricing --}} {{-- Status --}} @endforeach {{-- Separator between suppliers within the same request --}} @if (!$loop->last) @endif @endforeach
Supplier Code Dates Dosing Price Remark Status
@if ($index === 0) {{ $row->supplier_to }} Ext. Memo: {{ $row->ext_memo }} @endif {{ $row->code }} S: {{ $row->send_date ? date('d/m/y', strtotime($row->send_date)) : '-' }} R: {{ $row->receive_date ? date('d/m/y', strtotime($row->receive_date)) : '-' }} Dosage: {{ $row->dosage }}% {{ $row->currency }} {{ number_format($row->dosing_price, 2) }} / Kg {{ $row->remark ?? '-' }} {{-- --}} @php $badgeClass = match ( $row->status ) { 'accepted' => 'bg-success', // Hijau 'rejected' => 'bg-danger', // Merah 'entry' => 'bg-secondary', // Abu-abu default => 'bg-primary', // Biru (Default) }; @endphp {{ strtoupper($row->status) }}
@endforeach @endif {{-- 4. PAGINATION --}}
{{-- check flag js on dmenu --}} @if ($jsmenu == '1') @if (view()->exists("js.{$dmenu}")) @push('addjs') {{-- file js in folder (resources/views/js) --}} @include('js.' . $dmenu); @endpush @else @push('addjs') @endpush @endif @endif @endsection @push('js') @endpush