@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => 'Detail']) {{-- Top Action Card (Persis seperti troutp/add.blade.php) --}}
{{-- Kolom Kiri: Tombol Aksi --}}
Kembali @if (!in_array($qc->status, ['approved', 'rejected']) && ($authorize->edit ?? '1') == '1') Edit @endif @if ($qc->status === 'approved') @endif
{{-- Kolom Kanan: Status & Alert --}}
@if (!empty($qc->note_reject)) @endif @if ($qc->status === 'draft') Draft @elseif ($qc->status === 'pending') Pending @elseif ($qc->status === 'approved') Approved @elseif ($qc->status === 'rejected') Rejected @endif
{{-- CARD HEADER: Persis format troutp/add.blade.php --}}
Test Product Outsource: {{ $qc->material_code ?: '-' }}

@include('components.alert')
{{-- NAV TABS: Header & Detail Tambahan --}}
{{-- ================= TAB 1: HEADER ================= --}}
{{-- BARIS 1: Tanggal Uji, Tanggal Datang, No Batch, IO --}}
{{-- BARIS 2: Material, Deskripsi Material, Jenis Material, Warna --}}
{{-- BARIS 3: Customer & Supplier --}}
{{-- BARIS 4: Tested By, Send To & Catatan --}}
{{-- ================= TAB 2: DETAIL TAMBAHAN ================= --}}
@php // Determine how many runs exist across all details (minimal 5 seperti add.blade.php) $maxRun = 5; foreach ($details as $d) { $rObj = $d->run_values ?? ($d->runs ?? []); if (is_string($rObj)) { $rObj = json_decode($rObj, true) ?? []; } if (is_array($rObj)) { for ($r = 1; $r <= 100; $r++) { if (isset($rObj["run_{$r}"]) && $rObj["run_{$r}"] !== '') { if ($r > $maxRun) $maxRun = $r; } } } } @endphp {{-- CARD DETAIL: GRID TITIK UJI RUN MATRIX (Persis format troutp/add.blade.php) --}}
Detail Test
@if ($maxRun > 5) Menampilkan Run 1 - 5 (Total: {{ $maxRun }}) @else Total Run: {{ $maxRun }} @endif
OK Sesuai Spesifikasi | Out Di luar Batas Toleransi

{{-- Run 1..maxRun Column Headers --}} @for ($r = 1; $r <= $maxRun; $r++) @endfor {{-- Indicator Column when Minimized (Total Run > 5) --}} @if ($maxRun > 5) {{-- Action Column when Maximized --}} @endif @forelse ($details as $d) @php $runs = $d->run_values ?? ($d->runs ?? []); if (is_string($runs)) { $runs = json_decode($runs, true) ?? []; } $lower = $d->lower ?? ($specs->get($d->mic_name)->lower ?? null); $upper = $d->upper ?? ($specs->get($d->mic_name)->upper ?? null); $minNum = ($lower !== null && $lower !== '') ? (float) str_replace(',', '.', $lower) : null; $maxNum = ($upper !== null && $upper !== '') ? (float) str_replace(',', '.', $upper) : null; @endphp @for ($r = 1; $r <= $maxRun; $r++) @php $val = isset($runs["run_{$r}"]) && $runs["run_{$r}"] !== '' ? $runs["run_{$r}"] : null; $valClass = ''; if ($val !== null) { $cleanNum = str_replace(',', '.', $val); if (is_numeric($cleanNum)) { $num = (float) $cleanNum; if ($minNum === null && $maxNum === null) { $valClass = 'input-run'; } else { $isOut = ($minNum !== null && $num < $minNum) || ($maxNum !== null && $num > $maxNum); $valClass = $isOut ? 'input-run run-invalid' : 'input-run run-valid'; } } else { $valClass = 'input-run'; } } @endphp @endfor {{-- Cell when Minimized --}} @if ($maxRun > 5) {{-- Cell when Maximized --}} @endif @empty @endforelse
MIC Name Unit Spesifikasi RUN {{ $r }} AVG Val
Min Max
{{ $d->mic_name ?: ($d->parameter_name ?? '-') }} {{ $d->unit ?: '-' }} {{ $lower !== null && $lower !== '' ? $lower : '-' }} {{ $upper !== null && $upper !== '' ? $upper : '-' }} @if ($val !== null)
@else - @endif
••• {{ $d->average_value !== null ? (is_numeric(str_replace(',', '.', $d->average_value)) ? number_format((float)str_replace(',', '.', $d->average_value), $d->decimal ?? 2) : $d->average_value) : '-' }} @if ($d->evaluation_status === '-' || (empty($d->lower) && empty($d->upper))) - @elseif ($d->evaluation_status === 'OK') OK @else Out @endif
Tidak ada rincian data titik uji.
{{-- Audit info --}}
Diinput oleh: {{ $qc->user_create ?: 'System' }} pada {{ $qc->created_at }}
Verifikasi terakhir: {{ $qc->user_update ?: '-' }} pada {{ $qc->updated_at }}
{{-- Tombol Aksi Bawah: Reject & Approve / Unapprove --}} @if (!in_array($qc->status, ['approved', 'rejected']))
@elseif ($qc->status === 'approved')
@endif
@if (!in_array($qc->status, ['approved', 'rejected'])) {{-- Modal Approve --}} {{-- Modal Reject / Revision --}} @endif @if ($qc->status === 'approved') {{-- Modal Unapprove --}} @endif @if (!empty($qc->note_reject)) @php $rejectEntries = []; $rawEntries = preg_split('/\r\n---\r\n|\n---\n|\r\n\r\n|\n\n|---/', $qc->note_reject); foreach ($rawEntries as $entry) { $entry = trim($entry); if (!empty($entry)) { if (preg_match('/\[REJECT \/ REVISION by (.*?) on (.*?)]: (.*)/s', $entry, $matches)) { $rejectEntries[] = [ 'by' => trim($matches[1]), 'date' => trim($matches[2]), 'msg' => trim($matches[3]), 'raw' => $entry, ]; } else { $rejectEntries[] = [ 'by' => null, 'date' => null, 'msg' => $entry, 'raw' => $entry, ]; } } } $totalRevisions = count($rejectEntries); @endphp {{-- Modal Riwayat Catatan Revisi / Reject --}} @endif @endsection @push('js') @endpush @push('css') @endpush