156 lines
7.3 KiB
PHP
156 lines
7.3 KiB
PHP
@extends('layouts.admin')
|
|
|
|
@section('content')
|
|
<div class="container px-4 py-8 mx-auto">
|
|
<div class="max-w-6xl mx-auto">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-gray-800">
|
|
Laporan {{ ucfirst($jenis) }}
|
|
</h1>
|
|
<p class="mt-2 text-gray-600">
|
|
Periode: {{ \Carbon\Carbon::parse($startDate)->format('d M Y') }} - {{ \Carbon\Carbon::parse($endDate)->format('d M Y') }}
|
|
</p>
|
|
</div>
|
|
<form action="{{ route('admin.laporan.download') }}" method="POST" class="flex gap-4">
|
|
@csrf
|
|
<input type="hidden" name="jenis" value="{{ $jenis }}">
|
|
<input type="hidden" name="tanggal_mulai" value="{{ $startDate }}">
|
|
<input type="hidden" name="tanggal_selesai" value="{{ $endDate }}">
|
|
<a href="{{ route('admin.laporan.index') }}" class="btn-secondary">
|
|
Kembali
|
|
</a>
|
|
<button type="submit" class="btn-primary">
|
|
<i class="mr-2 fas fa-download"></i> Download PDF
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
@if($jenis === 'transaksi')
|
|
<div class="grid grid-cols-1 gap-6 mb-8 md:grid-cols-2 lg:grid-cols-3">
|
|
<div class="p-6 card">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm text-gray-500">Total Transaksi</p>
|
|
<h3 class="text-2xl font-bold text-gray-800">{{ $totalTransaksi }}</h3>
|
|
</div>
|
|
<div class="p-3 bg-[#E6F7F4] rounded-full">
|
|
<i class="fas fa-shopping-cart text-[#88D8CC] text-xl"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="p-6 card">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm text-gray-500">Total Pendapatan</p>
|
|
<h3 class="text-2xl font-bold text-gray-800">
|
|
Rp {{ number_format($totalPendapatan, 0, ',', '.') }}
|
|
</h3>
|
|
</div>
|
|
<div class="p-3 bg-[#E6F7F4] rounded-full">
|
|
<i class="fas fa-money-bill-wave text-[#88D8CC] text-xl"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="overflow-hidden card">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-[#F0FDFB]">
|
|
<tr>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Kode Transaksi
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Tanggal
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Customer
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Barang
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Total
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@forelse($data as $t)
|
|
<tr class="hover:bg-[#F8FCFB] transition-colors duration-150">
|
|
<td class="px-6 py-4 text-sm font-medium text-gray-900 whitespace-nowrap">
|
|
{{ $t->kode_transaksi }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
{{ $t->created_at->format('d/m/Y H:i') }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
{{ $t->user->nama }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
{{ $t->pesanan->barang->nama_barang }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
Rp {{ number_format($t->total_pembayaran, 0, ',', '.') }}
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="px-6 py-4 text-sm text-center text-gray-500 whitespace-nowrap">
|
|
Tidak ada data transaksi
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<div class="overflow-hidden card">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-[#F0FDFB]">
|
|
<tr>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Nama Barang
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Stok
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Harga
|
|
</th>
|
|
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
|
|
Total Pesanan
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@forelse($data as $b)
|
|
<tr class="hover:bg-[#F8FCFB] transition-colors duration-150">
|
|
<td class="px-6 py-4 text-sm font-medium text-gray-900 whitespace-nowrap">
|
|
{{ $b->nama_barang }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
{{ $b->stok }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
Rp {{ number_format($b->harga, 0, ',', '.') }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
|
|
{{ $b->pesanan_count }}
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="4" class="px-6 py-4 text-sm text-center text-gray-500 whitespace-nowrap">
|
|
Tidak ada data barang
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endsection |