@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => 'Detail']) {{-- Action Buttons --}}
{{-- Form Content --}}

Detail Permintaan


{{-- KOLOM KIRI --}}
{{-- Nomor Permintaan --}}
{{-- Input Select Values untuk Jabatan --}}
{{-- Input Select Values untuk Alasan --}}
{{-- END KOLOM KIRI --}} {{-- KOLOM KANAN --}}
{{-- Input Nama Karyawan --}}
{{-- Select Bagian --}}
{{-- Textarea Uraian Pekerjaan --}}
{{-- END KOLOM KANAN --}}
@php $grouped = []; foreach ($detailPermintaan as $item) { if (!isset($grouped[$item->tanggal])) { $grouped[$item->tanggal] = [ 'tanggal' => $item->tanggal, 'shifts' => [ 1 => ['id_detail_permintaan' => null, 'jumlah' => 0, 'status_os' => ''], 2 => ['id_detail_permintaan' => null, 'jumlah' => 0, 'status_os' => ''], 3 => ['id_detail_permintaan' => null, 'jumlah' => 0, 'status_os' => ''], ], ]; } $grouped[$item->tanggal]['shifts'][(int) $item->shift] = [ 'id_detail_permintaan' => $item->id, 'jumlah' => (int) $item->jumlah, 'status_os' => $item->status_os, ]; } $grandTotalPermintaan = 0; $totalShift1 = 0; $totalShift2 = 0; $totalShift3 = 0; foreach ($grouped as $group) { $s1 = (int) ($group['shifts'][1]['jumlah'] ?? 0); $s2 = (int) ($group['shifts'][2]['jumlah'] ?? 0); $s3 = (int) ($group['shifts'][3]['jumlah'] ?? 0); $totalShift1 += $s1; $totalShift2 += $s2; $totalShift3 += $s3; $grandTotalPermintaan += $s1 + $s2 + $s3; } $viewRealisasiByDate = []; if (!empty($hasRealisasi)) { foreach ($grouped as $tanggal => $group) { $viewRealisasiByDate[$tanggal] = [ 'tanggal' => $tanggal, 'display' => \Carbon\Carbon::parse($tanggal)->format('d-m-Y'), 'shifts' => [], ]; for ($shift = 1; $shift <= 3; $shift++) { $shiftData = $group['shifts'][$shift]; $detailId = $shiftData['id_detail_permintaan']; $viewRealisasiByDate[$tanggal]['shifts'][$shift] = [ 'required' => (int) $shiftData['jumlah'], 'status_os' => $shiftData['status_os'] ?? '', 'rows' => $detailId && isset($detailRealisasi[$detailId]) ? $detailRealisasi[$detailId] : [], ]; } } } @endphp
@if (!empty($hasRealisasi)) @endif @forelse ($grouped as $tanggal => $group) @php $s1 = (int) ($group['shifts'][1]['jumlah'] ?? 0); $s2 = (int) ($group['shifts'][2]['jumlah'] ?? 0); $s3 = (int) ($group['shifts'][3]['jumlah'] ?? 0); @endphp @if (!empty($hasRealisasi)) @endif @empty @endforelse @if (!empty($hasRealisasi)) @endif
Tanggal Shift 1 Shift 2 Shift 3 Total Action
{{ \Carbon\Carbon::parse($tanggal)->format('d-m-Y') }} {{ $s1 }} {{ $s2 }} {{ $s3 }} {{ $s1 + $s2 + $s3 }}
Tidak ada data detail permintaan.
Total {{ $totalShift1 }} {{ $totalShift2 }} {{ $totalShift3 }} {{ $grandTotalPermintaan }}
@if (!empty($hasRealisasi)) @endif
@endsection @if (!empty($hasRealisasi)) @push('js') @endpush @endif