This commit is contained in:
Utkarsh Khedkar
2025-11-17 10:36:00 +05:30
16 changed files with 1330 additions and 139 deletions

View File

@@ -1,12 +1,110 @@
@extends('admin.layouts.app')
@section('page-title', 'Dashboard')
@section('page-title', 'Invoice List')
@section('content')
<div class="card shadow-sm">
<div class="card-body">
<h4>Welcome to the Admin invoice</h4>
<p>Here you can manage all system modules.</p>
<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

View File

@@ -0,0 +1,89 @@
@extends('admin.layouts.app')
@section('page-title', 'Edit Invoice')
@section('content')
<div class="card shadow-sm">
<div class="card-header bg-light">
<h4>Edit Invoice</h4>
</div>
<div class="card-body">
<form action="{{ route('admin.invoices.update', $invoice->id) }}" method="POST">
@csrf
<div class="row g-3">
<div class="col-md-4">
<label class="form-label">Invoice Date</label>
<input type="date" class="form-control"
name="invoice_date"
value="{{ $invoice->invoice_date }}" required>
</div>
<div class="col-md-4">
<label class="form-label">Due Date</label>
<input type="date" class="form-control"
name="due_date"
value="{{ $invoice->due_date }}" required>
</div>
<div class="col-md-4">
<label class="form-label">Payment Method</label>
<input type="text" class="form-control"
name="payment_method"
value="{{ $invoice->payment_method }}">
</div>
<div class="col-md-4">
<label class="form-label">Reference No</label>
<input type="text" class="form-control"
name="reference_no"
value="{{ $invoice->reference_no }}">
</div>
<div class="col-md-4">
<label class="form-label">Final Amount (Editable)</label>
<input type="number" step="0.01" class="form-control"
name="final_amount"
value="{{ $invoice->final_amount }}" required>
</div>
<div class="col-md-4">
<label class="form-label">GST Percentage</label>
<input type="number" step="0.01" class="form-control"
name="gst_percent"
value="{{ $invoice->gst_percent }}" required>
</div>
<div class="col-md-4">
<label class="form-label">Status</label>
<select class="form-select" name="status" required>
<option value="pending" @selected($invoice->status=='pending')>Pending</option>
<option value="paid" @selected($invoice->status=='paid')>Paid</option>
<option value="overdue" @selected($invoice->status=='overdue')>Overdue</option>
</select>
</div>
<div class="col-md-12">
<label class="form-label">Notes</label>
<textarea class="form-control" rows="3" name="notes">
{{ $invoice->notes }}
</textarea>
</div>
<div class="col-md-12 text-end mt-3">
<button type="submit" class="btn btn-success">
Update Invoice
</button>
</div>
</div>
</form>
</div>
</div>
@endsection

View File

@@ -182,7 +182,11 @@
<a href="{{ route('admin.dashboard') }}" class="{{ request()->routeIs('admin.dashboard') ? 'active' : '' }}"><i class="bi bi-house"></i> Dashboard</a>
<a href="{{ route('admin.shipments') }}" class="{{ request()->routeIs('admin.shipments') ? 'active' : '' }}"><i class="bi bi-truck"></i> Shipments</a>
<a href="{{ route('admin.invoice') }}" class="{{ request()->routeIs('admin.invoice') ? 'active' : '' }}"><i class="bi bi-receipt"></i> Invoice</a>
<a href="{{ route('admin.invoices.index') }}"
class="{{ request()->routeIs('admin.invoices.index') ? 'active' : '' }}">
<i class="bi bi-receipt"></i> Invoice
</a>
<a href="{{ route('admin.customers') }}" class="{{ request()->routeIs('admin.customers') ? 'active' : '' }}"><i class="bi bi-people"></i> Customers</a>
<a href="{{ route('admin.reports') }}" class="{{ request()->routeIs('admin.reports') ? 'active' : '' }}"><i class="bi bi-graph-up"></i> Reports</a>
<a href="{{ route('admin.chat_support') }}" class="{{ request()->routeIs('admin.chat_support') ? 'active' : '' }}"><i class="bi bi-chat-dots"></i> Chat Support</a>

View File

@@ -0,0 +1,169 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{ $invoice->invoice_number }}</title>
<style>
body {
font-family: sans-serif;
font-size: 13px;
color: #333;
}
.header-box {
text-align: center;
padding: 10px 0;
border-bottom: 2px solid #000;
margin-bottom: 20px;
}
.logo {
width: 120px;
margin-bottom: 8px;
}
.title {
font-size: 22px;
font-weight: bold;
color: #000;
}
.subtitle {
font-size: 14px;
margin-top: 3px;
color: #666;
}
.section-title {
font-size: 16px;
font-weight: bold;
margin-top: 20px;
margin-bottom: 6px;
color: #222;
}
.info-box {
border: 1px solid #ccc;
padding: 10px;
line-height: 1.6;
background: #f9f9f9;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 12px;
}
th {
background: #efefef;
padding: 6px;
font-size: 13px;
font-weight: bold;
border: 1px solid #444;
}
td {
padding: 6px;
border: 1px solid #444;
font-size: 12px;
}
.totals-box {
margin-top: 20px;
padding: 10px;
border: 1px solid #bbb;
background: #fafafa;
font-size: 14px;
line-height: 1.8;
}
</style>
</head>
<body>
<!-- HEADER -->
<div class="header-box">
<!-- LOGO -->
<img src="{{ public_path('images/kent_logo2.png') }}" class="logo">
<div class="title">KENT LOGISTICS</div>
<div class="subtitle">Official Invoice</div>
</div>
<!-- INVOICE INFO -->
<div class="info-box">
<strong>Invoice No:</strong> {{ $invoice->invoice_number }} <br>
<strong>Invoice Date:</strong> {{ $invoice->invoice_date }} <br>
<strong>Due Date:</strong> {{ $invoice->due_date }} <br>
<strong>Status:</strong> {{ ucfirst($invoice->status) }}
</div>
<!-- CUSTOMER DETAILS -->
<div class="section-title">Customer Details</div>
<div class="info-box">
<strong>{{ $invoice->customer_name }}</strong><br>
{{ $invoice->company_name }} <br>
{{ $invoice->customer_mobile }} <br>
{{ $invoice->customer_email }} <br>
{{ $invoice->customer_address }}
</div>
<!-- ITEMS TABLE -->
<div class="section-title">Invoice Items</div>
<table>
<thead>
<tr>
<th>#</th>
<th>Description</th>
<th>CTN</th>
<th>QTY</th>
<th>TTL/QTY</th>
<th>Unit</th>
<th>Price</th>
<th>TTL Amount</th>
<th>CBM</th>
<th>TTL CBM</th>
<th>KG</th>
<th>TTL KG</th>
<th>Shop No</th>
</tr>
</thead>
<tbody>
@foreach($invoice->items as $i => $item)
<tr>
<td>{{ $i + 1 }}</td>
<td>{{ $item->description }}</td>
<td>{{ $item->ctn }}</td>
<td>{{ $item->qty }}</td>
<td>{{ $item->ttl_qty }}</td>
<td>{{ $item->unit }}</td>
<td>{{ number_format($item->price, 2) }}</td>
<td>{{ number_format($item->ttl_amount, 2) }}</td>
<td>{{ $item->cbm }}</td>
<td>{{ $item->ttl_cbm }}</td>
<td>{{ $item->kg }}</td>
<td>{{ $item->ttl_kg }}</td>
<td>{{ $item->shop_no }}</td>
</tr>
@endforeach
</tbody>
</table>
<!-- TOTALS -->
<div class="section-title">Totals</div>
<div class="totals-box">
<strong>Amount:</strong> {{ number_format($invoice->final_amount, 2) }} <br>
<strong>GST ({{ $invoice->gst_percent }}%):</strong> {{ number_format($invoice->gst_amount, 2) }} <br>
<strong>Total With GST:</strong> <strong>{{ number_format($invoice->final_amount_with_gst, 2) }}</strong>
</div>
</body>
</html>

View File

@@ -0,0 +1,73 @@
<div>
<h4 class="fw-bold mb-2">
Invoice: {{ $invoice->invoice_number }}
</h4>
<p><strong>Invoice Date:</strong> {{ $invoice->invoice_date }}</p>
<p><strong>Due Date:</strong> {{ $invoice->due_date }}</p>
<hr>
<h5>Customer Details</h5>
<p>
<strong>{{ $invoice->customer_name }}</strong><br>
{{ $invoice->company_name }}<br>
{{ $invoice->customer_mobile }}<br>
{{ $invoice->customer_email }}<br>
{{ $invoice->customer_address }}
</p>
<hr>
<h5>Invoice Items</h5>
<div class="table-responsive">
<table class="table table-bordered align-middle text-center">
<thead class="table-light">
<tr>
<th>#</th>
<th>Description</th>
<th>CTN</th>
<th>QTY</th>
<th>TTL/QTY</th>
<th>Unit</th>
<th>Price</th>
<th>TTL Amount</th>
<th>CBM</th>
<th>TTL CBM</th>
<th>KG</th>
<th>TTL KG</th>
<th>Shop No</th>
</tr>
</thead>
<tbody>
@foreach($invoice->items as $i => $item)
<tr>
<td>{{ $i+1 }}</td>
<td>{{ $item->description }}</td>
<td>{{ $item->ctn }}</td>
<td>{{ $item->qty }}</td>
<td>{{ $item->ttl_qty }}</td>
<td>{{ $item->unit }}</td>
<td>{{ number_format($item->price,2) }}</td>
<td>{{ number_format($item->ttl_amount,2) }}</td>
<td>{{ $item->cbm }}</td>
<td>{{ $item->ttl_cbm }}</td>
<td>{{ $item->kg }}</td>
<td>{{ $item->ttl_kg }}</td>
<td>{{ $item->shop_no }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<hr>
<h5>Final Summary</h5>
<p><strong>Amount:</strong> {{ number_format($invoice->final_amount,2) }}</p>
<p><strong>GST ({{ $invoice->gst_percent }}%):</strong> {{ number_format($invoice->gst_amount,2) }}</p>
<p><strong>Total With GST:</strong> {{ number_format($invoice->final_amount_with_gst,2) }}</p>
<p><strong>Status:</strong> {{ ucfirst($invoice->status) }}</p>
</div>