@extends('layouts.admin_layout') @section('content') @if(session('success'))
{{ session('success') }}
@endif
@php $bulanList = [ 1 => 'Januari', 2 => 'Februari', 3 => 'Mac', 4 => 'April', 5 => 'Mei', 6 => 'Jun', 7 => 'Julai', 8 => 'Ogos', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Disember' ]; @endphp
@php $hasAny = false; @endphp @if($jenis) @foreach($months as $monthData) @php $showInventori = ($jenis === 'semua' || $jenis === 'inventori') && $monthData['inventori']->isNotEmpty(); $showLaporan = ($jenis === 'semua' || $jenis === 'laporan') && $monthData['laporan']->isNotEmpty(); @endphp @if(!($showInventori || $showLaporan)) @continue @endif @php $hasAny = true; @endphp
Bulan {{ $bulanList[$monthData['bulan']] }} {{ $monthData['tahun'] }}
@if($showInventori) @foreach($monthData['inventori'] as $item) @php $totalSiri = (int) ($item->siri_baik_count ?? 0) + (int) ($item->siri_rosak_count ?? 0) + (int) ($item->siri_hilang_count ?? 0); if ($totalSiri > 0) { $baik = (int) ($item->siri_baik_count ?? 0); $rosak = (int) ($item->siri_rosak_count ?? 0); $hilang = (int) ($item->siri_hilang_count ?? 0); } else { $rosak = (int) ($item->jumlah_rosak ?? 0); $hilang = 0; $baik = max((int) $item->kuantiti - $rosak, 0); } @endphp @endforeach
Inventori
ID Nama Peralatan Kuantiti Catatan Tarikh Kemaskini
Baik Rosak Hilang
{{ $item->inventori_id }} {{ $item->nama_barang }} {{ $item->kuantiti }} {{ $baik }} {{ $rosak }} {{ $hilang }} {{ $item->tarikh_kemaskini ?? '-' }}
@endif @if($showLaporan) @foreach($monthData['laporan'] as $item) @endforeach
Laporan Kerosakan / Kehilangan
ID Nama Pelapor Nama Peralatan Kuantiti Tarikh Lapor Jenis Punca Kerosakan Penyelesaian Status
{{ $item->laporan_id ?? $item->id }} {{ $item->user->name ?? '-' }} {{ $item->inventori?->nama_barang ?? '-' }} {{ $item->kuantiti }} {{ $item->tarikh_lapor }} {{ $item->butiran }} {{ $item->butiran === 'kerosakan' ? ($item->punca ?? '-') : '-' }} {{ $item->butiran === 'kerosakan' ? ($item->penyelesaian ?? '-') : '-' }} {{ $item->rekod_status ?? '-' }}
@endif @endforeach @endif @if($jenis && !$hasAny)
Tiada data untuk tempoh ini.
@endif @endsection