@extends('layouts.admin_layout')
@section('content')
@if(session('success'))
{{ session('success') }}
@endif
@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)
| Inventori |
| ID |
Nama Peralatan |
Kuantiti |
Catatan |
Tarikh Kemaskini |
| Baik |
Rosak |
Hilang |
@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
| {{ $item->inventori_id }} |
{{ $item->nama_barang }} |
{{ $item->kuantiti }} |
{{ $baik }} |
{{ $rosak }} |
{{ $hilang }} |
{{ $item->tarikh_kemaskini ?? '-' }} |
@endforeach
@endif
@if($showLaporan)
| Laporan Kerosakan / Kehilangan |
| ID |
Nama Pelapor |
Nama Peralatan |
Kuantiti |
Tarikh Lapor |
Jenis |
Punca Kerosakan |
Penyelesaian |
Status |
@foreach($monthData['laporan'] as $item)
| {{ $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 ?? '-' }} |
@endforeach
@endif
@endforeach
@endif
@if($jenis && !$hasAny)
Tiada data untuk tempoh ini.
@endif
@endsection