TA/web_JMW/resources/views/admin/riwayat.blade.php

114 lines
4.7 KiB
PHP

@extends('admin.layout')
@section('title', 'Riwayat Transaksi')
@section('content')
<div class="page-header">
<div>
<p style="margin:0; color:#6b7280; font-weight:600; letter-spacing:0.15em; text-transform:uppercase;">Riwayat Transaksi</p>
<h2>Catatan transaksi terbaru</h2>
<p>Lihat ringkasan transaksi, status pembayaran, dan detail pelanggan yang sudah selesai.</p>
</div>
<div class="badge">Transaksi</div>
</div>
<div class="cards">
<div class="card"><small>Total Transaksi</small><strong>{{ $summary['total'] ?? 0 }}</strong></div>
<div class="card"><small>Transaksi Lunas</small><strong>{{ $summary['paid'] ?? 0 }}</strong></div>
<div class="card"><small>Total Penjualan</small><strong>Rp {{ number_format($summary['sales'] ?? 0, 0, ',', '.') }}</strong></div>
<div class="card"><small>Transaksi Hari Ini</small><strong>{{ $summary['today'] ?? 0 }}</strong></div>
</div>
<div class="panel">
<div class="panel-header">
<h3>Daftar Transaksi</h3>
<a href="{{ route('input') }}" class="button-primary" style="text-decoration:none;">Input Transaksi</a>
</div>
@if(session('success'))
<div class="alert alert-success" style="margin-bottom:16px; padding:12px; border-radius:8px; background:#e6ffed; color:#165d37;">
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="alert alert-danger" style="margin-bottom:16px; padding:12px; border-radius:8px; background:#ffe6e6; color:#9b1c1c;">
{{ session('error') }}
</div>
@endif
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Kode Transaksi</th>
<th>Customer</th>
<th>Produk</th>
<th>Qty</th>
<th>Total Amount</th>
<th>Metode Pembayaran</th>
<th>Status</th>
<th>Bukti</th>
<th>Konfirmasi</th>
<th>Tanggal</th>
</tr>
</thead>
<tbody>
@forelse($transactions ?? [] as $transaction)
<tr>
<td>{{ $transaction->transaction_code }}</td>
<td>
<strong>{{ $transaction->customer_name }}</strong>
@if($transaction->customer_phone)
<br><span class="text-muted">{{ $transaction->customer_phone }}</span>
@endif
</td>
<td>{{ $transaction->category->name ?? 'Produk dihapus' }}</td>
<td>{{ $transaction->quantity }}</td>
<td>Rp {{ number_format($transaction->total_amount, 0, ',', '.') }}</td>
<td>{{ $transaction->payment_method_label }}</td>
<td>
@if($transaction->payment_status === 'paid')
<span class="tag tag-active">{{ $transaction->payment_status_label }}</span>
@elseif($transaction->payment_status === 'cancelled')
<span class="tag tag-inactive">{{ $transaction->payment_status_label }}</span>
@else
<span class="badge" style="background:#fef3c7; color:#92400e;">{{ $transaction->payment_status_label }}</span>
@endif
</td>
<td>
@if($transaction->payment_proof)
<a href="{{ asset('storage/' . $transaction->payment_proof) }}" target="_blank" class="button-secondary" style="display:inline-flex; text-decoration:none; padding:8px 12px;">Lihat Bukti</a>
@else
<span class="text-muted">Belum ada</span>
@endif
</td>
<td>
@if($transaction->payment_status === 'pending')
<form action="{{ route('transactions.confirm', $transaction) }}" method="POST" style="display:inline-block;">
@csrf
@method('PATCH')
<button type="submit" class="button-primary" style="padding:8px 12px;">Konfirmasi</button>
</form>
@else
<span class="text-muted">Selesai</span>
@endif
</td>
<td>{{ $transaction->created_at ? $transaction->created_at->format('d/m/Y H:i') : '-' }}</td>
</tr>
@empty
<tr>
<td colspan="10" style="text-align:center; color:#64748b; padding:24px 0;">Belum ada transaksi.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="panel" style="background:#16a34a; color:#fff; text-align:center;">
<p style="margin:0; font-size:18px; font-weight:600;">{{ $summary['paid'] ?? 0 }} Transaksi Lunas</p>
<p style="margin:0; font-size:22px;">Rp {{ number_format($summary['sales'] ?? 0, 0, ',', '.') }}</p>
</div>
@endsection