Files
Kent-logistics-Laravel/resources/views/admin/invoice.blade.php
Abhishek Mali df89031d36 invoice update
2025-11-17 10:33:11 +05:30

111 lines
3.5 KiB
PHP

@extends('admin.layouts.app')
@section('page-title', 'Invoice List')
@section('content')
<div class="card shadow-sm">
<div class="card-header bg-light">
<h4 class="mb-0">All Invoices</h4>
</div>
<div class="card-body table-responsive">
<table class="table table-bordered table-striped align-middle text-center">
<thead class="table-light">
<tr>
<th>#</th>
<th>Invoice Number</th>
<th>Customer</th>
<th>Final Amount ()</th>
<th>GST %</th>
<th>Total w/GST ()</th>
<th>Status</th>
<th>Invoice Date</th>
<th>Due Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($invoices as $i => $invoice)
<tr>
<td>{{ $i + 1 }}</td>
<td>
<a href="#"
class="text-primary fw-bold open-invoice-popup"
data-id="{{ $invoice->id }}">
{{ $invoice->invoice_number }}
</a>
</td>
<td>{{ $invoice->customer_name }}</td>
<td>{{ number_format($invoice->final_amount, 2) }}</td>
<td>{{ $invoice->gst_percent }}%</td>
<td>{{ number_format($invoice->final_amount_with_gst, 2) }}</td>
<td>
<span class="badge
@if($invoice->status=='paid') bg-success
@elseif($invoice->status=='overdue') bg-danger
@else bg-warning text-dark @endif">
{{ ucfirst($invoice->status) }}
</span>
</td>
<td>{{ $invoice->invoice_date }}</td>
<td>{{ $invoice->due_date }}</td>
<td>
<a href="{{ route('admin.invoices.edit', $invoice->id) }}"
class="btn btn-sm btn-primary">
Edit
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
{{-- POPUP MODAL --}}
<div class="modal fade" id="invoiceModal" tabindex="-1">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Invoice Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body" id="invoiceModalBody">
<p class="text-center text-muted">Loading...</p>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('click', function(e) {
if (e.target.closest('.open-invoice-popup')) {
e.preventDefault();
const id = e.target.closest('.open-invoice-popup').dataset.id;
const modal = new bootstrap.Modal(document.getElementById('invoiceModal'));
document.getElementById('invoiceModalBody').innerHTML =
"<p class='text-center text-muted'>Loading...</p>";
modal.show();
fetch(`/admin/invoices/${id}/popup`)
.then(res => res.text())
.then(html => {
document.getElementById('invoiceModalBody').innerHTML = html;
});
}
});
</script>
@endsection