{{-- resources/views/pages/dashboard/chart.blade.php --}} @extends('layouts.app', ['class' => 'bg-gray-100']) @section('content') @php $ID_COLS = [ 'Hide' => '__exclude__', 'No' => '__no__', 'Shift Date' => 'shift_date', 'Shift' => 'shift', 'Batch' => 'batch', 'Gedung' => 'gedung', 'Customer' => 'customer', 'Material' => 'material', 'Mesin' => 'mesin', 'Team Group' => 'teamgroup', 'Delivery' => 'delivery', 'Width' => 'width', 'Length' => 'length', 'Weight' => 'weight', 'Unit of Dimension' => 'unit_of_dimension', 'Base Unit Measure' => 'base_unit_measure', 'Tested By' => 'tested_by', 'Checked By' => 'checked_by', 'Supervisor By' => 'supervisor_by', 'Tested At' => 'tested_at', 'Checked At' => 'checked_at', 'Supervisor At' => 'supervisor_at', ]; @endphp @php // Querystring utk link Detail $passQsStr = http_build_query(request()->except('chart')); $passQs = $passQsStr ? '&' . $passQsStr : ''; // ID terpilih (SUMBER KEBENARAN) $propIds = array_filter(array_map('intval', (array) request('properties', []))); $paramIds = array_filter(array_map('intval', (array) request('param_mesin', []))); $hasProps = !empty($propIds); $hasParams = !empty($paramIds); $propCol = $hasProps && $hasParams ? 'col-lg-6' : 'col-lg-12'; $paramCol = $hasProps && $hasParams ? 'col-lg-6' : 'col-lg-12'; @endphp @if (empty($hide_topnav)) @include('layouts.navbars.auth.topnav', ['title' => '']) @endif {{-- HEADER --}}
Dashboard
Mengambil data…
Kembali @if (session('error')) @endif @if (session('success')) @endif
@if (empty($chart_keys))
Belum ada metrik terpilih. Silakan pilih Properties atau Parameter Mesin.
@else
{{-- BLOK PROPERTIES --}} @if ($hasProps)
Properties
@foreach ($chart_keys as $ckey) @php if (!str_starts_with($ckey, 'prop_')) { continue; } $id = (int) str_replace('prop_', '', $ckey); $title = $mst_properties->firstWhere('id', $id)->nama ?? 'Property'; @endphp @php $canvasId = 'c_' . preg_replace('/[^a-zA-Z0-9_]/', '_', (string) $ckey); @endphp
{{ $title }}
Mengambil data…
@endforeach
@endif {{-- BLOK PARAMETER MESIN --}} @if ($hasParams)
Parameter Mesin
@foreach ($chart_keys as $ckey) @php // HANYA PARAMETER MESIN if (!str_starts_with($ckey, 'param_')) { continue; } $id = (int) str_replace('param_', '', $ckey); $title = $mst_parameter_mesin->firstWhere('id', $id)->nama ?? 'Parameter'; @endphp @php $canvasId = 'c_' . preg_replace('/[^a-zA-Z0-9_]/', '_', (string) $ckey); @endphp
{{ $title }}
Mengambil data...
@endforeach
@endif
{{-- ======================= TABEL 1: DATA BATCH ======================== --}}
Tabel Batch
@foreach ($ID_COLS as $label => $key) @endforeach {{-- AJAX --}}
{{ $label }}
{{-- ======================= TABEL 2: PROPERTIES ======================== --}} @if ($hasProps) @php // Kelompokkan header property menjadi: {Nama Property} -> [Nilai, Min, Target, Max, Allowance] $propGroups = []; foreach ($HPROP as $label => $key) { if (preg_match('/^(.*)\s—\s(Min|Target|Max|Allowance)$/u', $label, $m)) { $base = trim($m[1]); $sub = $m[2]; $propGroups[$base] = $propGroups[$base] ?? [ 'Nilai' => null, 'Min' => null, 'Target' => null, 'Max' => null, 'Allowance' => null, ]; $propGroups[$base][$sub] = $key; } else { $base = trim($label); $propGroups[$base] = $propGroups[$base] ?? [ 'Nilai' => null, 'Min' => null, 'Target' => null, 'Max' => null, 'Allowance' => null, ]; $propGroups[$base]['Nilai'] = $key; // kolom nilai aktual } } // urutan sub-kolom yang dipakai $SUBS = ['Nilai', 'Min', 'Target', 'Max']; @endphp
Tabel Properties
{{-- Header baris-1: kolom identitas (rowspan 2) + grup property (colspan 5) --}} {{-- @foreach ($ID_COLS as $label => $key) @endforeach @foreach ($propGroups as $pname => $cols) @endforeach --}} {{-- Header baris-2: sub kolom tiap property --}} {{-- @foreach ($propGroups as $pname => $cols) @foreach ($SUBS as $s) @endforeach @endforeach --}} {{-- DIISI VIA AJAX --}}
{{ $label }} {{ $pname }}
{{ $s }}
@endif {{-- ============================ TABEL 3: PARAMETER MESIN ============================= --}} @if ($hasParams)
Tabel Parameter Mesin
{{-- @foreach ($ID_COLS as $label => $key) @endforeach @foreach ($HPARAM as $label => $key) @endforeach --}} {{-- DIISI VIA AJAX --}}
{{ $label }}{{ $label }}
@endif @endif
@includeIf('pages.dashboard.partials.modal-filter') {{-- form export --}}
@csrf @php if (!function_exists('renderHidden')) { function renderHidden($name, $value) { if (is_array($value)) { foreach ($value as $k => $v) { renderHidden($name . '[' . $k . ']', $v); } } else { echo ''; } } } @endphp @foreach (request()->all() as $k => $v) @php renderHidden($k, $v); @endphp @endforeach
@endsection @push('js') @endpush