@php $ordersCount = count($orders_data ?? []); $titleOrder = $ordersCount === 1 ? ($orders_data[0]['order_no'] ?? 'Report') : ($ordersCount > 1 ? "({$ordersCount} Orders)" : ($meta['order_no'] ?? 'Report')); @endphp Batch Decision - {{ $titleOrder }} @php $docsList = !empty($orders_data) ? $orders_data : [ [ 'order_no' => $meta['order_no'] ?? '-', 'meta' => $meta ?? [], 'overview' => $overview ?? [], 'inspeksi' => $inspeksi ?? [], 'non_conf' => $non_conf ?? [], 'non_conforming' => $non_conforming ?? [], 'decision' => $decision ?? [], 'off_grade_batches' => $off_grade_batches ?? collect([]), ] ]; $allOrdersStr = implode(',', array_column($docsList, 'order_no')); $pdfParams = request()->query(); $pdfParams['print_process_order'] = $allOrdersStr; @endphp @if(!isset($is_pdf) || !$is_pdf) {{-- Browser Toolbar --}}
📄 Preview Dokumen: Batch Decision @if(count($docsList) === 1) (Order: {{ $docsList[0]['order_no'] }}) @else ({{ count($docsList) }} Order Terpilih) @endif
@php $currentUser = auth()->user(); $userRoles = $currentUser ? (method_exists($currentUser, 'getRolesListAttribute') ? $currentUser->roles_list : array_map('trim', explode(',', $currentUser->idroles ?? ''))) : []; $isCurrentUserAdmin = $currentUser && ($currentUser->username === 'msjit' || (method_exists($currentUser, 'isMsjIt') && $currentUser->isMsjIt()) || in_array('admins', $userRoles) || in_array('admbat', $userRoles)); @endphp
@if($isCurrentUserAdmin) @php $excelParams = request()->query(); $excelParams['print_process_order'] = $allOrdersStr; $excelParams['order_no'] = $allOrdersStr; @endphp 📊 Download Excel ({{ count($docsList) }} Order) @endif
@endif @foreach($docsList as $docIndex => $doc) @php $mMeta = $doc['meta'] ?? []; $mOverview = $doc['overview'] ?? []; $mInspeksi = $doc['inspeksi'] ?? []; $mNonConf = $doc['non_conf'] ?? []; $mNonConforming = $doc['non_conforming'] ?? []; $mDecision = $doc['decision'] ?? []; $mOffGrade = $doc['off_grade_batches'] ?? collect([]); @endphp
{{-- 1. HEADER LOGO & COMPANY --}} @php $logoPath = public_path('storage/logo_msj_full.png'); $logoSrc = file_exists($logoPath) ? 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath)) : asset('storage/logo_msj_full.png'); @endphp
PT Multi Spunindo Jaya Tbk
{{-- 2. DOCUMENT TITLE --}}
BATCH DECISION
{{-- 3. METADATA SECTION (2 COLUMNS) --}}
Customer : {{ $mMeta['customer'] ?? '-' }} Inspeksi Level : {{ $mMeta['inspeksi_level'] ?? '-' }}
Material : {{ $mMeta['material'] ?? '-' }} Qty Sampling : {{ $mMeta['qty_sampling'] ?? '-' }}
No Order : {{ $mMeta['order_no'] ?? '-' }} Accept Number : {{ $mMeta['accept_number'] ?? '0' }}
Qty Order : {{ isset($mMeta['qty_order']) ? number_format((int)$mMeta['qty_order'], 0, ',', '.') : '-' }} Reject Number : {{ $mMeta['reject_number'] ?? '1' }}
{{-- 4. MIDDLE SECTION: SUMMARY BOXES --}} {{-- ROW 1: Overview & Qty Inspeksi (Left) vs Approval & Keputusan (Right) --}} {{-- LEFT COLUMN TOP --}} {{-- RIGHT COLUMN TOP --}} {{-- ROW 2: Inspeksi Data & Frekuensi Non Conforming (Left) vs Catatan Box (Right) --}} {{-- LEFT COLUMN BOTTOM --}} {{-- RIGHT COLUMN BOTTOM --}}
{{-- Overview Box --}}
Overview
Grade A/B {{ $mOverview['grade_ab'] ?? 0 }}
Grade C {{ $mOverview['grade_c'] ?? 0 }}
Grade D {{ ($mOverview['grade_d'] ?? 0) > 0 ? $mOverview['grade_d'] : '0' }}
Qty Produksi {{ ($mOverview['grade_ab'] ?? 0) + ($mOverview['grade_c'] ?? 0) + ($mOverview['grade_d'] ?? 0) }}
{{-- Qty Inspeksi Box --}}
Qty Inspeksi
Cek OK {{ $mInspeksi['cek_ok'] ?? 0 }}
Cek Not OK {{ $mInspeksi['cek_not_ok'] ?? 0 }}
Actual Cek {{ $mInspeksi['actual_cek'] ?? 0 }}
{{-- Spacer to align horizontally with Overview table --}}
 
{{-- Tanda Tangan / Approval Box --}}
Dibuat Mengetahui Disetujui
     
Petugas QC Line Control Supervisor
{{-- Keputusan Box --}}
Keputusan
[   ] Hold / Re-inspeksi [   ] Rework Keseluruhan
[   ] OK / Release [   ] Rework Sebagian
{{-- Inspeksi Data Box --}}
Inspeksi Data
Frekuensi Non Conformities Ac Re
Critical {{ ($mNonConf['critical'] ?? 0) > 0 ? $mNonConf['critical'] : '' }} {{ $mNonConf['critical_ac'] ?? 0 }} {{ $mNonConf['critical_re'] ?? 0 }}
Major {{ ($mNonConf['major'] ?? 0) > 0 ? $mNonConf['major'] : '' }} {{ $mNonConf['major_ac'] ?? 0 }} {{ $mNonConf['major_re'] ?? 1 }}
Minor {{ ($mNonConf['minor'] ?? 0) > 0 ? $mNonConf['minor'] : '' }} {{ $mNonConf['minor_ac'] ?? 0 }} {{ $mNonConf['minor_re'] ?? 1 }}
{{-- Frekuensi Non Conforming Box --}}
Frekuensi Non Conforming Ac / Re %
OK {{ $mNonConforming['ok'] ?? 0 }} {{ ($mNonConforming['ac'] ?? 0) }} / {{ ($mNonConforming['re'] ?? 1) }} {{ number_format($mNonConforming['pct_ok'] ?? 0, 2, ',', '.') }} %
Not OK {{ $mNonConforming['not_ok'] ?? 0 }}
{{-- Catatan Box --}}
Catatan
-
{{-- 5. DETAIL PRODUK OFF GRADE TABLE --}}
Detail Produk Off Grade
@forelse($mOffGrade as $index => $item) @php $remarkText = (!empty($item->ddtext) && !in_array(strtoupper(trim($item->ddtext)), ['QC', 'PRD', 'MKT'], true)) ? $item->ddtext : ((!empty($item->validation_remark) && !in_array(strtoupper(trim($item->validation_remark)), ['QC', 'PRD', 'MKT'], true)) ? $item->validation_remark : (!empty($item->ddtext) ? $item->ddtext : 'Prop off spec')); @endphp @empty @endforelse
No Roll Jumbo P(m) L(m) W(kg) Grd Remark Condition
{{ $loop->iteration }} {{ $item->batch_no }} {{ $item->jumbo_roll ?? '-' }} {{ $item->length !== null ? number_format($item->length > 100 ? $item->length / 1000 : $item->length, 3, ',', '.') : '-' }} {{ $item->width !== null ? number_format($item->width > 100 ? $item->width / 1000 : $item->width, 3, ',', '.') : '-' }} {{ ($item->weight ?? $item->quantity) !== null ? number_format((float) ($item->weight ?? $item->quantity), 3, ',', '.') : '-' }} {{ $item->validation_grade ?? '-' }}{{ $remarkText }} {{ $item->validation_condition ?? '-' }}
Tidak ada produk off-grade untuk order ini.
{{-- 6. FOOTER --}}
{{-- Page break for mPDF when multiple orders --}} @if(!empty($is_pdf) && $is_pdf && !$loop->last) @endif @endforeach @if(!isset($is_pdf) || !$is_pdf) @endif