@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @if (empty($selected_detail_month)) @include('layouts.navbars.auth.topnav', ['title' => '']) @endif
{{-- ===== Filter ===== --}}
Filter Material
{{-- Material Type (MTART) --}}
{{-- Material Grup (MATKL) --}}
{{-- Material (Select2 + AJAX) --}}
{{-- vendor hidden array --}}
@if (!empty($selectedVendor ?? [])) @foreach ((array) $selectedVendor as $vn) @endforeach @endif
Pilih satu atau lebih material.
Reset
{{-- ===== History Price (NAME1 — MATNR — MAKTKX) ===== --}}
History Price
{{-- Header Tahun --}} @forelse(($yearsGrouped ?? collect()) as $y => $ms) @empty @if (!empty($months)) @endif @endforelse {{-- Header Bulan --}} @foreach ($months ?? [] as $m) @php $mKey = (string) $m; try { $label = \Carbon\Carbon::createFromFormat('Ym', $mKey)->format('M Y'); } catch (\Exception $e) { $label = $mKey; } @endphp @endforeach @foreach ($pricePivot as $rowKey => $monthValues) @php $firstCell = reset($monthValues); $meins = $firstCell['meins'] ?? ''; @endphp @foreach ($months as $m) @php $cell = $monthValues[$m] ?? null; @endphp @endforeach @endforeach
Vendor — Material Curr UoM{{ $y }}Periode
{{ $label }}
{{ $rowKey }} {{ $rowCurrency[$rowKey] ?? '' }} {{ $meins }} -
{{ $selectedMatkl }} — Harga (USD/MT)
@php // Pakai urutan bulan dari $months (YYYYMM) $chartMonths = $months ?? []; $chartLabels = array_map(fn($m) => \Carbon\Carbon::createFromFormat('Ym', $m)->format('M'), $chartMonths); // Legend untuk setiap baris (vendor — material) $rowLegend = []; foreach ($pricePivot as $rowKey => $values) { $first = reset($values); $maktx = $first['maktx'] ?? ''; $matnr = $first['matnr'] ?? ''; $rowLegend[$rowKey] = trim("{$maktx} ({$matnr})"); } // Seri yang akan ditampilkan (pakai semua baris by default) $pickedKeys = array_keys($pricePivot ?? []); @endphp
@endsection @push('js') @endpush