@extends('layouts/base_view') @section('title') {!! $variables['header_routes'] !!} @endsection @section('content')

Stock Opname — Input Seksi

@php $hariIndo = ['Sunday'=>'Minggu','Monday'=>'Senin','Tuesday'=>'Selasa','Wednesday'=>'Rabu','Thursday'=>'Kamis','Friday'=>'Jumat','Saturday'=>'Sabtu']; $soDate = $data->so_date ?? now(); $namaHari = $hariIndo[$soDate->format('l')] ?? $soDate->format('l'); @endphp
User : {{ $logged_name }} ({{ $logged_role_name }}) Store : {{ $store_name ?: '-' }}
Date : {{ $namaHari }}, {{ $soDate->format('d M Y') }} Seksi : {{ $variables['seksi_names'] ?? '-' }}
@if($variables['raw_materials']->isEmpty()) Tidak ada item untuk seksi Anda. Hubungi administrator. @else
@foreach($variables['raw_materials'] as $index => $rm) @php $existingDetail = null; if (isset($data->details)) { $existingDetail = $data->details->where('raw_material_id', $rm->id)->first(); } $mapping = $variables['mappings']->get($rm->id); $convKey = $rm->id . '_' . ($mapping->dc_id ?? ''); $conv = $variables['conversions']->get($convKey); $hasConversion = $conv && $conv->conversion_factor_utuh_pakai && $conv->conversion_factor_utuh_pakai > 0; $conversionFactor = $hasConversion ? $conv->conversion_factor_utuh_pakai : 1; $uomUtuh = $conv->uom_utuh ?? $rm->uom; $uomPakai = $rm->uom_pakai ?? $rm->uom; @endphp {{-- FSTR Sub-lines --}} @php $fstrComponents = $rm->components() ->where('delete_flag', 0) ->where('input_lsm_flag', true) ->with('component') ->get() ->filter(fn($comp) => $comp->component !== null); @endphp @foreach($fstrComponents as $fstrComponent) @php $fstr = $fstrComponent->component; if (!$fstr) continue; $componentQtyPerUnit = $fstrComponent->qty; $isFSTR = $fstr->components()->where('delete_flag', 0)->exists(); $existingFstrQty = 0; if ($existingDetail && $existingDetail->fstr_qty_pakai) { $fstrQtyData = is_string($existingDetail->fstr_qty_pakai) ? json_decode($existingDetail->fstr_qty_pakai, true) : $existingDetail->fstr_qty_pakai; $existingFstrQty = $fstrQtyData[$fstr->id] ?? 0; } @endphp @endforeach {{-- SUB Sub-lines --}} @foreach($rm->substitutions->filter(fn($s) => !$s->delete_flag) as $subRelation) @php $subItem = $subRelation->substitution; if (!$subItem) continue; $existingSubQty = 0; if ($existingDetail && $existingDetail->fstr_qty_pakai) { $fstrQtyData = is_string($existingDetail->fstr_qty_pakai) ? json_decode($existingDetail->fstr_qty_pakai, true) : $existingDetail->fstr_qty_pakai; $existingSubQty = $fstrQtyData['sub_' . $subItem->id] ?? 0; } @endphp @endforeach @endforeach {{-- end foreach raw_materials --}}
No Item Utuh Pakai Adj X
{{ $index + 1 }} @if(!$hasConversion)
@endif
{{ $rm->code }} | {{ $rm->name }} | UOM: {{ $uomPakai }} @if($hasConversion) (1 {{ $uomUtuh }} = {{ number_format($conversionFactor, 2, '.', '') }} {{ $uomPakai }}) @endif @if(!$hasConversion)
Tidak ada mapping konversi @endif
@php $hasRestan = $rm->adj_restan_flag; $hasExtras = $rm->adj_extras_flag; $hasRingkas = $rm->adj_ringkas_flag; $hasSelisih = $rm->adj_selisih_flag; $hasAnyAdj = $hasRestan || $hasExtras || $hasRingkas || $hasSelisih; $totalAdj = 0; if ($existingDetail) { $totalAdj = ($existingDetail->adj_ekstra ?? 0) + ($existingDetail->adj_restan ?? 0) + ($existingDetail->adj_ringkas ?? 0) + ($existingDetail->adj_selisih ?? 0); } @endphp @if($hasAnyAdj) @else @endif
FSTR: {{ $fstr->code }} - {{ $fstr->name }} - {{ $fstr->uom_pakai ?? $fstr->uom }}
SUB: {{ $subItem->code }} - {{ $subItem->name }} - {{ $subItem->uom_pakai ?? $subItem->uom }}
{{-- Adj Modals — di luar tabel agar tidak blocking di mobile --}} @foreach($variables['raw_materials'] as $rm) @php $existingDetail = isset($data->details) ? $data->details->where('raw_material_id', $rm->id)->first() : null; $hasRestan = $rm->adj_restan_flag; $hasExtras = $rm->adj_extras_flag; $hasRingkas = $rm->adj_ringkas_flag; $hasSelisih = $rm->adj_selisih_flag; @endphp @if($hasRestan || $hasExtras || $hasRingkas || $hasSelisih) @endif @endforeach @endif {{-- end if raw_materials not empty --}}
{{-- .seksi-wrap --}} @endsection