@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @push('css') @endpush @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
{{-- Card Header Standar MSJ --}}
Result {{ $title_menu ?? 'Batch Decision' }}
Mode: {{ $view_mode === 'summary' ? 'Order Summary' : 'Only Batch Data' }}
Last Update: {{ date('d F Y, H:i') }}

{{-- Action Buttons (Kembali, Preview, Excel, PDF) --}}
Kembali @php if (!empty($selected_orders)) { $orderParamVal = implode(',', $selected_orders); } elseif (!empty($all_matching_orders)) { $orderParamVal = implode(',', $all_matching_orders); } else { $ordersList = ($view_mode === 'summary' ? $summary_data->pluck('order_no')->filter()->unique()->toArray() : $batch_data->pluck('order_no')->filter()->unique()->toArray()); $orderParamVal = implode(',', $ordersList); } $currentUser = auth()->user() ?? ($user_login ?? null); $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
{{-- Table Container --}}
@if ($view_mode === 'summary') {{-- ========================================================== --}} {{-- MODE 2: ORDER SUMMARY --}} {{-- ========================================================== --}} @forelse ($summary_data as $index => $row) @empty @endforelse
NO TANGGAL NO. ORDER CUSTOMER MATERIAL QTY ORDER INSP. LEVEL QTY SAMPLING ACCEPT NUMB REJECT NUMB TOTAL PRODUKSI GRADE A/B GRADE C GRADE D CEK OK CEK NOT OK ACTUAL CEK KEPUTUSAN
{{ $summary_data->firstItem() + $loop->index }} {{ $row->production_date ?? '-' }} {{ $row->order_no }} {{ \Illuminate\Support\Str::limit($row->customer_name ?? ($row->sold_to ?? '-'), 22) }} {{ \Illuminate\Support\Str::limit($row->material, 24) ?? '-' }} {{ $row->order_qty !== null ? number_format($row->order_qty, 0, ',', '.') : '-' }} {{ $row->level_no !== null ? (is_numeric($row->level_no) ? (int)$row->level_no : $row->level_no) : '-' }} {{ $row->sampling !== null ? number_format($row->sampling, 0, ',', '.') : '-' }} {{ $row->accept_qty !== null ? number_format($row->accept_qty, 0, ',', '.') : '-' }} {{ $row->reject_qty !== null ? number_format($row->reject_qty, 0, ',', '.') : '-' }} {{ $row->qty_produksi }} {{ $row->grade_ab }} {{ $row->grade_c }} {{ $row->grade_d }} {{ $row->cek_ok }} {{ $row->cek_not_ok }} {{ $row->actual_cek }} @if (in_array(strtoupper($row->keputusan), ['DITERIMA', 'RELEASE / OK', 'RELEASE', 'OK'])) DITERIMA @elseif (in_array(strtoupper($row->keputusan), ['DITOLAK', 'HOLD / REVIEW', 'HOLD', 'REJECT'])) DITOLAK @else {{ $row->keputusan }} @endif
Tidak ada data order summary untuk filter yang dipilih.
@else {{-- ========================================================== --}} {{-- MODE 1: BATCH DATA (Only Batch Data - Sesuai SAP GUI) --}} {{-- ========================================================== --}} @php $batchRows = $batch_data instanceof \Illuminate\Pagination\LengthAwarePaginator ? $batch_data->getCollection() : collect($batch_data ?? []); $dynamicColumnNames = $batchRows->flatMap(function ($row) { return array_keys($row->dynamic_details ?? []); })->filter(function ($columnName) { $trimmed = trim((string) $columnName); $upperTrimmed = strtoupper($trimmed); return $trimmed !== '' && !in_array($upperTrimmed, ['KURZTEXT', 'DDTEXT', 'SHORT_TEXT', '0000', 'DETAIL', 'MANDT', 'CUSTOM_FIELD_1', 'CUSTOM_FIELD_2', 'CUSTOM_FIELD_3'], true) && !str_starts_with($upperTrimmed, 'CUSTOM_FIELD'); })->unique()->values()->all(); $batchTableColspan = 29 + count($dynamicColumnNames); @endphp @foreach ($dynamicColumnNames as $columnName) @endforeach @forelse ($batch_data as $index => $row) @php $rowCheckResult = $row->check_result ?? null; $is_defect = ($row->isactive == '0' || in_array(strtoupper(trim($rowCheckResult ?? '')), ['NOT OK', 'NOK', 'CEK NOT OK', 'CEK_NOT_OK'])); $det = $row->dynamic_details ?? []; @endphp {{-- NO --}} {{-- 1. Order --}} {{-- 2. work center --}} {{-- 3. sold to --}} {{-- 4. Name 1 --}} {{-- 5. search_tem --}} {{-- 6. order_qty --}} {{-- 7. roll_unit --}} {{-- 8. Level_no --}} {{-- 9. Sampling --}} {{-- 10. accept_qty --}} {{-- 11. reject_qty --}} {{-- 12. gsm --}} {{-- 13. width --}} {{-- 14. length --}} {{-- 15. weight --}} {{-- 16. Unit --}} {{-- 17. Batch_no --}} {{-- 18. Joint_qty --}} {{-- 18. Material --}} {{-- 19. Validation_grade --}} {{-- 20. Defect_classify --}} {{-- 21. Validation_remark --}} @php $remarkCell = (!empty($row->ddtext) && !in_array(strtoupper(trim($row->ddtext)), ['QC', 'PRD', 'MKT'], true)) ? $row->ddtext : ((!empty($row->validation_remark) && !in_array(strtoupper(trim($row->validation_remark)), ['QC', 'PRD', 'MKT'], true)) ? $row->validation_remark : '-'); @endphp {{-- 22. Validation_condition --}} {{-- 23. Source roll --}} {{-- 24. jumbo roll --}} {{-- 25. CEK_RESULT --}} {{-- 26. Short Text --}} @foreach ($dynamicColumnNames as $columnName) @php $dynamicValue = $det[$columnName] ?? null; if ($dynamicValue === null || $dynamicValue === '') { $dynamicText = '-'; } elseif (is_array($dynamicValue)) { $dynamicText = json_encode($dynamicValue); } elseif (is_bool($dynamicValue)) { $dynamicText = $dynamicValue ? 'TRUE' : 'FALSE'; } elseif (is_numeric($dynamicValue)) { $dynamicText = number_format((float) $dynamicValue, 3, ',', '.'); } else { $dynamicText = (string) $dynamicValue; } @endphp @endforeach @empty @endforelse
NO Order Work Center Sold To Name 1 Search_term Order_qty Roll_Unit Level_no Sampling Accept_qty Reject_qty Gsm Width Length Weight Unit Batch_no Joint_qty Material Validation_grade Defect_classify Validation_remark Validation_condition Source_roll Jumbo_roll Check_result Short Text{{ strtoupper($columnName) }}
{{ $batch_data->firstItem() + $loop->index }}{{ $row->order_no }}{{ $row->work_center ?? '-' }}{{ $row->sold_to ?? '-' }} {{ \Illuminate\Support\Str::limit($row->name_1 ?? '-', 24) }} {{ $row->search_term ?? '-' }}{{ $row->order_qty !== null ? number_format($row->order_qty, 0, ',', '.') : '-' }}{{ $row->roll_unit !== null ? number_format($row->roll_unit, 3, ',', '.') : '-' }}{{ $row->level_no !== null ? (is_numeric($row->level_no) ? (int)$row->level_no : $row->level_no) : '-' }}{{ $row->sampling !== null ? number_format($row->sampling, 0, ',', '.') : '-' }}{{ $row->accept_qty !== null ? number_format($row->accept_qty, 0, ',', '.') : '-' }}{{ $row->reject_qty !== null ? number_format($row->reject_qty, 0, ',', '.') : '-' }}{{ $row->gsm !== null ? number_format($row->gsm, 3, ',', '.') : '-' }}{{ $row->width !== null ? number_format($row->width, 3, ',', '.') : '-' }}{{ $row->length !== null ? number_format($row->length, 3, ',', '.') : '-' }}{{ ($row->weight ?? $row->quantity) !== null ? number_format((float) ($row->weight ?? $row->quantity), 3, ',', '.') : '-' }}{{ $row->unit ?? 'KG' }}{{ $row->batch_no ?? '-' }}{{ $row->joint_qty ?? 0 }} {{ $row->material ?? '-' }} {{ $row->validation_grade ?? '-' }} {{ $row->defect_classify ?? '-' }} {{ $remarkCell }} {{ $row->validation_condition ?? ($row->validation_condition ?? '-') }} {{ $row->source_roll ?? ($row->source_roll ?? '-') }} {{ $row->jumbo_roll ?? ($row->jumbo_roll ?? '-') }} @if (in_array(strtoupper(trim($rowCheckResult ?? '')), ['OK', 'CEK OK', 'CEK_OK'])) CEK OK @elseif (in_array(strtoupper(trim($rowCheckResult ?? '')), ['NOT OK', 'NOK', 'CEK NOT OK', 'CEK_NOT_OK'])) CEK NOT OK @else No Cek @endif {{ $det['KURZTEXT'] ?? ($det['DDTEXT'] ?? ($det['SHORT_TEXT'] ?? '-')) }} {{ $dynamicText }}
Tidak ada data batch yang sesuai dengan kriteria filter.
@endif
{{-- Footer Note & Pagination Standar MSJ --}}
Note : ( Data not active / Defect )
@if ($view_mode === 'summary') {{ $summary_data->appends(request()->except('page'))->links('pagination::bootstrap-5') }} @else {{ $batch_data->appends(request()->except('page'))->links('pagination::bootstrap-5') }} @endif
@endsection