Files
Kent-logistics-Laravel/resources/views/admin/popup_invoice.blade.php
2025-12-23 00:30:18 +05:30

645 lines
23 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Professional Invoice</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root {
--primary: #2c3e50;
--secondary: #3498db;
--accent: #e74c3c;
--light: #f8f9fa;
--dark: #2c3e50;
--success: #27ae60;
--warning: #f39c12;
--danger: #e74c3c;
--border-radius: 8px;
--box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f5f7fa;
color: #333;
line-height: 1.5;
}
.invoice-container {
max-width: 1200px;
margin: 2rem auto;
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
overflow: hidden;
}
.invoice-header {
background: white;
padding: 1.5rem 2rem;
border-bottom: 1px solid #e9ecef;
}
.invoice-title {
font-weight: 700;
font-size: 1.8rem;
color: var(--primary);
}
.status-badge {
font-size: 0.85rem;
padding: 0.5rem 1rem;
border-radius: 50px;
font-weight: 600;
}
.id-container {
margin-bottom: 1rem;
}
.id-box {
background: white;
border-radius: var(--border-radius);
padding: 1rem;
border: 1px solid #e9ecef;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
height: 100%;
display: flex;
align-items: center;
gap: 1rem;
}
.id-box:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.id-box-primary {
border-left: 4px solid var(--secondary);
}
.id-box-secondary {
border-left: 4px solid var(--success);
}
.id-icon {
width: 48px;
height: 48px;
border-radius: var(--border-radius);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
flex-shrink: 0;
}
.id-icon-primary {
background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
color: white;
}
.id-icon-secondary {
background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
color: white;
}
.id-content {
flex: 1;
}
.id-label {
font-size: 0.75rem;
color: #6c757d;
font-weight: 600;
margin-bottom: 0.25rem;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.id-value {
font-size: 0.95rem;
font-weight: 700;
color: var(--primary);
margin-bottom: 0;
word-break: break-word;
line-height: 1.3;
}
/* Enhanced Date Section with Blue-Purple Gradient */
.date-badge {
font-size: 0.85rem;
padding: 0.75rem 1rem;
border-radius: 8px;
font-weight: 500;
background: linear-gradient(135deg, #3498db 0%, #9b59b6 100%);
color: white;
border: none;
min-width: 140px;
position: relative;
overflow: hidden;
box-shadow: 0 4px 15px rgba(52, 152, 219, 0.2);
}
.date-badge:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}
.date-badge .badge-label {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.5px;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 0.25rem;
display: flex;
align-items: center;
gap: 4px;
}
.date-badge .badge-label i {
font-size: 0.6rem;
}
.date-badge .badge-value {
font-weight: 700;
font-size: 0.95rem;
color: white;
}
.date-badge.due-date {
background: linear-gradient(135deg, #3498db 0%, #9b59b6 100%);
}
.date-badge.overdue {
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
70% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}
.date-separator {
color: #dee2e6;
font-weight: 300;
padding: 0 0.5rem;
display: flex;
align-items: center;
}
.date-separator i {
background: white;
padding: 8px;
border-radius: 50%;
color: var(--secondary);
border: 2px solid #e9ecef;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.card {
border: 1px solid #e9ecef;
border-radius: var(--border-radius);
margin-bottom: 1rem;
box-shadow: var(--box-shadow);
}
.card-header {
background: var(--light);
border-bottom: 1px solid #e9ecef;
padding: 0.75rem 1.25rem;
font-weight: 600;
color: var(--primary);
}
.table {
margin-bottom: 0;
font-size: 0.9rem;
}
.table > :not(caption) > * > * {
padding: 10px 8px;
}
.table thead th {
background-color: var(--light);
color: var(--primary);
font-weight: 600;
border-bottom: 1px solid #dee2e6;
font-size: 0.85rem;
}
.table tbody tr:hover {
background-color: rgba(52, 152, 219, 0.03);
}
/* Simplified Summary Section */
.summary-container {
margin: 2rem 0;
}
.amount-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 0;
}
.text-primary {
color: var(--primary) !important;
}
.text-success {
color: var(--success) !important;
}
.text-danger {
color: var(--danger) !important;
}
.badge {
font-size: 0.75rem;
padding: 0.35rem 0.65rem;
}
/* COMPACT HEADER STYLES */
.compact-header {
margin-bottom: 0.75rem;
}
.compact-header .invoice-title {
margin-bottom: 0.25rem;
}
/* Date and status row */
.date-status-row {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.75rem;
flex-wrap: wrap;
}
@media (max-width: 768px) {
.invoice-container {
margin: 1rem;
}
.table-responsive {
font-size: 0.8rem;
}
.id-box {
margin-bottom: 1rem;
}
.date-status-row {
justify-content: flex-start;
margin-top: 0.5rem;
}
.compact-header .col-md-6.text-end {
text-align: left !important;
}
.date-badge {
min-width: 120px;
}
.summary-container {
padding: 0 1rem;
}
}
@media (max-width: 576px) {
.date-status-row {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
}
.date-separator {
display: none;
}
.date-badge {
width: 100%;
}
.id-box {
flex-direction: column;
text-align: center;
gap: 0.75rem;
}
.id-icon {
width: 40px;
height: 40px;
font-size: 1rem;
}
.table-responsive {
overflow-x: auto;
}
}
</style>
</head>
<body>
<div class="invoice-container">
<div class="p-4">
<!-- ============================
INVOICE HEADER - COMPACT
============================ -->
@php
$showActions = $showActions ?? true;
@endphp
<div class="compact-header">
<div class="row align-items-center">
<div class="col-md-6">
<h2 class="invoice-title 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="date-status-row">
<!-- Invoice Date -->
<div class="date-badge">
<div class="badge-label">
<i class="fas fa-calendar-alt"></i> INVOICE DATE
</div>
<div class="badge-value">{{ \Carbon\Carbon::parse($invoice->invoice_date)->format('M d, Y') }}</div>
</div>
<!-- Due Date -->
<div class="date-badge due-date @if($invoice->status == 'overdue') overdue @endif">
<div class="badge-label">
<i class="fas fa-clock"></i> DUE DATE
</div>
<div class="badge-value">{{ \Carbon\Carbon::parse($invoice->due_date)->format('M d, Y') }}</div>
</div>
<!-- Status Badge -->
<span class="status-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">
<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>
</div>
<!-- ============================
ORDER & SHIPMENT ID BOXES
============================ -->
<div class="id-container">
<div class="row">
<!-- Order ID Box -->
<div class="col-md-6 mb-3">
<div class="id-box id-box-primary">
<div class="id-icon id-icon-primary">
<i class="fas fa-shopping-cart"></i>
</div>
<div class="id-content">
<div class="id-label">ORDER ID</div>
<div class="id-value">
@if($invoice->order && $invoice->order->order_id)
{{ $invoice->order->order_id }}
@elseif($invoice->order_id)
{{ $invoice->order_id }}
@else
N/A
@endif
</div>
</div>
</div>
</div>
<!-- Shipment ID Box -->
<div class="col-md-6 mb-3">
<div class="id-box id-box-secondary">
<div class="id-icon id-icon-secondary">
<i class="fas fa-shipping-fast"></i>
</div>
<div class="id-content">
<div class="id-label">SHIPMENT ID</div>
<div class="id-value">
@php
$shipmentId = 'N/A';
// Try multiple ways to get shipment ID
if($invoice->shipment && $invoice->shipment->shipment_id) {
$shipmentId = $invoice->shipment->shipment_id;
} elseif($invoice->shipment_id) {
$shipmentId = $invoice->shipment_id;
} elseif(isset($shipment) && $shipment && $shipment->shipment_id) {
$shipmentId = $shipment->shipment_id;
}
@endphp
{{ $shipmentId }}
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ============================
CUSTOMER DETAILS
============================ -->
<div class="card">
<div class="card-header">
<h6 class="mb-0 fw-bold">
<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-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">
<div class="card-header">
<h6 class="mb-0 fw-bold">
<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>
@php
$totalAmount = $invoice->final_amount;
$gstAmount = $invoice->gst_amount;
$totalPayable = $invoice->final_amount_with_gst;
$paidAmount = $invoice->totalPaid();
$remaining = $invoice->remainingAmount();
@endphp
<div class="summary-container">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="amount-row">
<span>Total Amount</span>
<span class="fw-bold">{{ number_format($totalAmount,2) }}</span>
</div>
<div class="amount-row">
<span>GST Amount</span>
<span class="fw-bold text-danger">
+ {{ number_format($gstAmount,2) }}
</span>
</div>
<div class="amount-row border-top pt-2">
<span class="fw-bold">Total Payable</span>
<span class="fw-bold text-success">
{{ number_format($totalPayable,2) }}
</span>
</div>
<div class="amount-row">
<span>Paid Amount</span>
<span class="fw-bold text-primary">
{{ number_format($paidAmount,2) }}
</span>
</div>
<div class="amount-row border-top pt-2">
<span class="fw-bold text-danger">Remaining Amount</span>
<span class="fw-bold text-danger fs-5">
{{ number_format($remaining,2) }}
</span>
</div>
</div>
</div>
</div>
<!-- ============================
FOOTER DOWNLOAD & SHARE
============================ -->
<div class="mt-4 pt-3 border-top text-center">
<a href="{{ route('admin.invoices.download', $invoice->id) }}"
class="btn btn-primary me-2">
<i class="fas fa-download me-1"></i> Download PDF
</a>
<button class="btn btn-success" onclick="shareInvoice()">
<i class="fas fa-share me-1"></i> Share
</button>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<!-- ============================
SHARE SCRIPT
============================ -->
<script>
function shareInvoice() {
const shareData = {
title: "Invoice {{ $invoice->invoice_number }}",
text: "Sharing invoice {{ $invoice->invoice_number }}",
url: "{{ route('admin.invoices.download', $invoice->id) }}"
};
if (navigator.share) {
navigator.share(shareData).catch(() => {});
} else {
navigator.clipboard.writeText(shareData.url);
alert("Link copied! Sharing not supported on this browser.");
}
}
</script>
</body>
</html>