This commit is contained in:
Abhishek Mali
2025-11-25 13:14:53 +05:30
parent a14fe614e5
commit bebe0711f4
18 changed files with 1105 additions and 623 deletions

View File

@@ -1,207 +1,280 @@
<div class="p-4">
<!-- Invoice Header -->
<div class="row mb-4">
<div class="col-md-6">
<h2 class="fw-bold text-primary mb-1">
<i class="fas fa-file-invoice me-2"></i>INVOICE
</h2>
<h4 class="fw-bold text-dark mb-0">{{ $invoice->invoice_number }}</h4>
</div>
<div class="col-md-6 text-end">
<div class="d-inline-block bg-light rounded-3 p-3">
<span class="badge
@if($invoice->status=='paid') bg-success
@elseif($invoice->status=='overdue') bg-danger
@elseif($invoice->status=='pending') bg-warning text-dark
@else bg-secondary @endif
fs-6 px-3 py-2">
<i class="fas
@if($invoice->status=='paid') fa-check-circle
@elseif($invoice->status=='overdue') fa-exclamation-circle
@elseif($invoice->status=='pending') fa-clock
@else fa-question-circle @endif me-1"></i>
{{ ucfirst($invoice->status) }}
</span>
</div>
</div>
</div>
{{-- INVOICE CONTENT (NO POPUP WRAPPERS HERE) --}}
<!-- Dates - Compact Professional Layout -->
<div class="row mb-3">
<div class="col-12">
<div class="card border-0 shadow-sm">
<div class="card-body py-2">
<div class="row align-items-center text-center">
<div class="col-md-5">
<div class="mb-0">
<div class="text-muted fw-semibold small">INVOICE DATE</div>
</div>
<div class="fw-bold text-dark" style="font-size: 0.95rem;">
{{ \Carbon\Carbon::parse($invoice->invoice_date)->format('M d, Y') }}
</div>
</div>
<div class="col-md-2">
<div class="date-connector">
<i class="fas fa-arrow-right text-muted small"></i>
</div>
</div>
<div class="col-md-5">
<div class="mb-0">
<div class="text-muted fw-semibold small">DUE DATE</div>
</div>
<div class="fw-bold @if($invoice->status == 'overdue') text-danger @else text-dark @endif" style="font-size: 0.95rem;">
{{ \Carbon\Carbon::parse($invoice->due_date)->format('M d, Y') }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ============================
INVOICE HEADER
============================ -->
<div class="mb-4">
<!-- Customer Details -->
<div class="row mb-4">
<div class="col-12">
<div class="card border-0 shadow-sm">
<div class="card-header bg-light py-2">
<h6 class="mb-0 fw-bold text-dark">
<i class="fas fa-user me-2"></i>Customer Details
</h6>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<h6 class="fw-bold text-primary mb-1">{{ $invoice->customer_name }}</h6>
@if($invoice->company_name)
<p class="mb-1">
<strong>Company:</strong> {{ $invoice->company_name }}
</p>
@endif
<p class="mb-1">
<strong>Mobile:</strong> {{ $invoice->customer_mobile }}
</p>
<p class="mb-1">
<strong>Email:</strong> {{ $invoice->customer_email }}
</p>
</div>
<div class="col-md-6">
<p class="mb-0">
<strong>Address:</strong><br>
{{ $invoice->customer_address }}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Invoice Items -->
<div class="row mb-4">
<div class="col-12">
<div class="card border-0 shadow-sm">
<div class="card-header bg-light py-2">
<h6 class="mb-0 fw-bold text-dark">
<i class="fas fa-list me-2"></i>Invoice Items
</h6>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-bordered table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th class="text-center">#</th>
<th>Description</th>
<th class="text-center">CTN</th>
<th class="text-center">QTY</th>
<th class="text-center">TTL/QTY</th>
<th class="text-center">Unit</th>
<th class="text-center">Price</th>
<th class="text-center">TTL Amount</th>
<th class="text-center">CBM</th>
<th class="text-center">TTL CBM</th>
<th class="text-center">KG</th>
<th class="text-center">TTL KG</th>
<th class="text-center">Shop No</th>
</tr>
</thead>
<tbody>
@foreach($invoice->items as $i => $item)
<tr>
<td class="text-center fw-bold text-muted">{{ $i+1 }}</td>
<td class="fw-semibold">{{ $item->description }}</td>
<td class="text-center">{{ $item->ctn }}</td>
<td class="text-center">{{ $item->qty }}</td>
<td class="text-center fw-bold">{{ $item->ttl_qty }}</td>
<td class="text-center">{{ $item->unit }}</td>
<td class="text-center text-success fw-bold">{{ number_format($item->price,2) }}</td>
<td class="text-center text-primary fw-bold">{{ number_format($item->ttl_amount,2) }}</td>
<td class="text-center">{{ $item->cbm }}</td>
<td class="text-center">{{ $item->ttl_cbm }}</td>
<td class="text-center">{{ $item->kg }}</td>
<td class="text-center">{{ $item->ttl_kg }}</td>
<td class="text-center">
<span class="badge bg-light text-dark border">{{ $item->shop_no }}</span>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Final Summary -->
<div class="row">
<div class="col-md-6 offset-md-6">
<div class="card border-0 bg-light">
<div class="card-header bg-dark text-white py-2">
<h6 class="mb-0 fw-bold">
<i class="fas fa-calculator me-2"></i>Final Summary
</h6>
</div>
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-2 pb-1 border-bottom">
<span class="fw-semibold">Amount:</span>
<span class="fw-bold text-dark">{{ number_format($invoice->final_amount,2) }}</span>
<div class="col-md-6">
<h2 class="fw-bold text-primary mb-1">
<i class="fas fa-file-invoice me-2"></i> INVOICE
</h2>
<h4 class="fw-bold text-dark mb-0">{{ $invoice->invoice_number }}</h4>
{{-- ORDER + SHIPMENT INFO --}}
<div class="mt-2 small">
{{-- ORDER ID --}}
@if($invoice->order_id)
<div>
<strong>Order ID:</strong>
{{ $invoice->order->order_id ?? $invoice->order_id }}
</div>
<div class="d-flex justify-content-between align-items-center mb-2 pb-1 border-bottom">
<span class="fw-semibold">GST ({{ $invoice->gst_percent }}%):</span>
<span class="fw-bold text-danger">{{ number_format($invoice->gst_amount,2) }}</span>
</div>
<div class="d-flex justify-content-between align-items-center pt-1">
<span class="fw-bold text-dark">Total With GST:</span>
<span class="fw-bold text-success">{{ number_format($invoice->final_amount_with_gst,2) }}</span>
@endif
{{-- SHIPMENT ID --}}
@if(isset($shipment) && $shipment)
<div>
<strong>Shipment ID:</strong> {{ $shipment->shipment_id }}
</div>
@endif
</div>
</div>
<div class="col-md-6 text-end">
<span class="badge fs-6 px-3 py-2
@if($invoice->status=='paid') bg-success
@elseif($invoice->status=='overdue') bg-danger
@elseif($invoice->status=='pending') bg-warning text-dark
@else bg-secondary @endif">
<i class="fas
@if($invoice->status=='paid') fa-check-circle
@elseif($invoice->status=='overdue') fa-exclamation-circle
@elseif($invoice->status=='pending') fa-clock
@else fa-question-circle @endif me-1"></i>
{{ ucfirst($invoice->status) }}
</span>
</div>
</div>
</div>
<!-- ============================
DATES SECTION
============================ -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-body py-3">
<div class="row text-center align-items-center">
<div class="col-md-5">
<small class="text-muted fw-semibold">INVOICE DATE</small>
<div class="fw-bold text-dark">
{{ \Carbon\Carbon::parse($invoice->invoice_date)->format('M d, Y') }}
</div>
</div>
<div class="col-md-2">
<i class="fas fa-arrow-right text-muted"></i>
</div>
<div class="col-md-5">
<small class="text-muted fw-semibold">DUE DATE</small>
<div class="fw-bold {{ $invoice->status=='overdue' ? 'text-danger' : 'text-dark' }}">
{{ \Carbon\Carbon::parse($invoice->due_date)->format('M d, Y') }}
</div>
</div>
</div>
</div>
</div>
<style>
.date-connector {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
color: #6c757d;
<!-- ============================
CUSTOMER DETAILS
============================ -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-light py-2">
<h6 class="fw-bold mb-0"><i class="fas fa-user me-2"></i> Customer Details</h6>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<h6 class="fw-bold text-primary">{{ $invoice->customer_name }}</h6>
@if($invoice->company_name)
<p class="mb-1"><strong>Company:</strong> {{ $invoice->company_name }}</p>
@endif
<p class="mb-1"><strong>Mobile:</strong> {{ $invoice->customer_mobile }}</p>
<p class="mb-1"><strong>Email:</strong> {{ $invoice->customer_email }}</p>
</div>
<div class="col-md-6">
<p class="mb-1"><strong>Address:</strong><br>{{ $invoice->customer_address }}</p>
<p class="mb-1"><strong>Pincode:</strong> {{ $invoice->pincode }}</p>
</div>
</div>
</div>
</div>
<!-- ============================
INVOICE ITEMS
============================ -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-light py-2">
<h6 class="fw-bold mb-0"><i class="fas fa-list me-2"></i> Invoice Items</h6>
</div>
<div class="table-responsive">
<table class="table table-bordered table-hover align-middle mb-0">
<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 class="text-center fw-bold">{{ $i + 1 }}</td>
<td>{{ $item->description }}</td>
<td class="text-center">{{ $item->ctn }}</td>
<td class="text-center">{{ $item->qty }}</td>
<td class="text-center">{{ $item->ttl_qty }}</td>
<td class="text-center">{{ $item->unit }}</td>
<td class="text-center">{{ number_format($item->price,2) }}</td>
<td class="text-center fw-bold text-primary">{{ number_format($item->ttl_amount,2) }}</td>
<td class="text-center">{{ $item->cbm }}</td>
<td class="text-center">{{ $item->ttl_cbm }}</td>
<td class="text-center">{{ $item->kg }}</td>
<td class="text-center">{{ $item->ttl_kg }}</td>
<td class="text-center">{{ $item->shop_no }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- ============================
FINAL SUMMARY
============================ -->
<div class="row">
<div class="col-md-6 offset-md-6">
<div class="card border-0 bg-light">
<div class="card-header bg-dark text-white py-2">
<h6 class="fw-bold mb-0"><i class="fas fa-calculator me-2"></i> Final Summary</h6>
</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-2 border-bottom pb-1">
<span class="fw-semibold">Amount:</span>
<span class="fw-bold">{{ number_format($invoice->final_amount, 2) }}</span>
</div>
@if($invoice->tax_type === 'gst')
{{-- CGST --}}
<div class="d-flex justify-content-between mb-2 border-bottom pb-1">
<span class="fw-semibold">CGST ({{ $invoice->cgst_percent }}%):</span>
<span class="fw-bold text-danger">{{ number_format($invoice->gst_amount/2, 2) }}</span>
</div>
{{-- SGST --}}
<div class="d-flex justify-content-between mb-2 border-bottom pb-1">
<span class="fw-semibold">SGST ({{ $invoice->sgst_percent }}%):</span>
<span class="fw-bold text-danger">{{ number_format($invoice->gst_amount/2, 2) }}</span>
</div>
@elseif($invoice->tax_type === 'igst')
{{-- IGST --}}
<div class="d-flex justify-content-between mb-2 border-bottom pb-1">
<span class="fw-semibold">IGST ({{ $invoice->igst_percent }}%):</span>
<span class="fw-bold text-danger">{{ number_format($invoice->gst_amount, 2) }}</span>
</div>
@endif
<div class="d-flex justify-content-between pt-1">
<span class="fw-bold text-dark">Total Payable:</span>
<span class="fw-bold text-success">{{ number_format($invoice->final_amount_with_gst, 2) }}</span>
</div>
</div>
</div>
</div>
</div>
<!-- ============================
FOOTER DOWNLOAD & SHARE
============================ -->
<div class="modal-footer">
@if($invoice->pdf_path)
<a href="{{ asset($invoice->pdf_path) }}" class="btn btn-primary" download>
<i class="bi bi-download me-1"></i> Download PDF
</a>
<button class="btn btn-success" onclick="shareInvoice()">
<i class="bi bi-share me-1"></i> Share
</button>
@endif
<!-- <button class="btn btn-secondary" data-bs-dismiss="modal">Close</button> -->
</div>
<!-- ============================
SHARE SCRIPT
============================ -->
<script>
function shareInvoice() {
const shareData = {
title: "Invoice {{ $invoice->invoice_number }}",
text: "Sharing invoice {{ $invoice->invoice_number }}",
url: "{{ asset($invoice->pdf_path) }}"
};
if (navigator.share) {
navigator.share(shareData).catch(() => {});
} else {
navigator.clipboard.writeText(shareData.url);
alert("Link copied! Sharing not supported on this browser.");
}
}
.date-connector i {
background: #f8f9fa;
padding: 4px;
border-radius: 50%;
border: 1px solid #e9ecef;
}
.card {
border-radius: 6px;
}
.table {
margin-bottom: 0;
}
.table > :not(caption) > * > * {
padding: 10px 6px;
}
</style>
</script>