@extends('layouts.main')
@section('title', 'Data Pesanan - Rei Cosrent')
@section('styles')
@endsection
@section('content')
Kelola pesanan pengguna dan ubah statusnya.Data Pesanan
@foreach($pesanan as $item)
ID
Nama Kostum
Pesanan Dibuat
Pesanan Diupdate
Tgl Pakai
Tgl Kembali
Total Harga
Status
Catatan
Pembayaran
Aksi
@endforeach
{{ $loop->iteration }}
{{ $item->nama_kostum }}
@if($item->created_at)
{{ \Carbon\Carbon::parse($item->created_at)->format('d-m-Y') }}
{{ \Carbon\Carbon::parse($item->created_at)->format('H:i:s') }}
@endif
@if($item->updated_at)
{{ \Carbon\Carbon::parse($item->updated_at)->format('d-m-Y') }}
{{ \Carbon\Carbon::parse($item->updated_at)->format('H:i:s') }}
@endif
{{ $item->tanggal_pemakaian ? \Carbon\Carbon::parse($item->tanggal_pemakaian)->format('d M Y') : '-' }}
{{ $item->tanggal_pengembalian ? \Carbon\Carbon::parse($item->tanggal_pengembalian)->format('d M Y') : '-' }}
Rp {{ number_format((float) $item->total_harga, 0, ',', '.') }}
@php
$statusClass = [
'proses' => 'bg-warning text-dark',
'revisi' => 'bg-secondary',
'diterima' => 'bg-info text-dark',
'selesai' => 'bg-success',
'dibatalkan' => 'bg-secondary'
][$item->status] ?? 'bg-dark';
@endphp
{{ ucfirst($item->status) }}
@php
$displayBuktiPath = null;
$displayExt = null;
$foundBuktiPath = null;
try {
$files = \Illuminate\Support\Facades\Storage::disk('public')->files('bukti_pembayaran');
foreach ($files as $f) {
if (\Illuminate\Support\Str::startsWith(basename($f), 'bukti_' . $item->id . '_')) {
$foundBuktiPath = $f;
break;
}
}
} catch (\Exception $e) {
$foundBuktiPath = null;
}
if (isset($item->pembayaran_safe) && !empty($item->pembayaran_safe->bukti_pembayaran)) {
$displayBuktiPath = asset('storage/' . $item->pembayaran_safe->bukti_pembayaran);
$displayExt = strtolower(pathinfo($item->pembayaran_safe->bukti_pembayaran, PATHINFO_EXTENSION));
} elseif (!empty($foundBuktiPath)) {
$displayBuktiPath = asset('storage/' . $foundBuktiPath);
$displayExt = strtolower(pathinfo($foundBuktiPath, PATHINFO_EXTENSION));
}
@endphp
@if($displayBuktiPath)
@if($displayExt === 'pdf')
@else
@endif
@else
-
@endif