636 lines
23 KiB
PHP
636 lines
23 KiB
PHP
<!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: #ffffff;
|
|
border-radius: var(--border-radius);
|
|
box-shadow: var(--box-shadow);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.invoice-header {
|
|
background: #ffffff;
|
|
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: #ffffff;
|
|
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%;
|
|
}
|
|
|
|
.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: 36px;
|
|
height: 36px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 0.5rem;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.id-icon-primary {
|
|
background: rgba(52, 152, 219, 0.1);
|
|
color: var(--secondary);
|
|
}
|
|
|
|
.id-icon-secondary {
|
|
background: rgba(39, 174, 96, 0.1);
|
|
color: var(--success);
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.date-container {
|
|
background: #ffffff;
|
|
border-radius: var(--border-radius);
|
|
padding: 1rem;
|
|
margin-bottom: 1rem;
|
|
border: 1px solid #e9ecef;
|
|
box-shadow: var(--box-shadow);
|
|
}
|
|
|
|
.date-card {
|
|
text-align: center;
|
|
padding: 0.75rem;
|
|
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
|
border-radius: var(--border-radius);
|
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.date-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 0.5rem;
|
|
background: var(--secondary);
|
|
color: #ffffff;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.date-label {
|
|
font-size: 0.8rem;
|
|
color: #6c757d;
|
|
font-weight: 600;
|
|
margin-bottom: 0.5rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.date-value {
|
|
font-size: 1rem;
|
|
font-weight: 700;
|
|
color: var(--primary);
|
|
padding: 0.5rem;
|
|
background: #ffffff;
|
|
border-radius: 4px;
|
|
border: 1px solid #e9ecef;
|
|
}
|
|
|
|
.date-connector {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100%;
|
|
}
|
|
|
|
.date-connector i {
|
|
background: var(--light);
|
|
padding: 10px;
|
|
border-radius: 50%;
|
|
color: var(--secondary);
|
|
border: 2px solid #e9ecef;
|
|
}
|
|
|
|
.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);
|
|
}
|
|
|
|
.summary-card {
|
|
background: var(--light);
|
|
border-left: 4px solid var(--secondary);
|
|
}
|
|
|
|
.summary-header {
|
|
background: var(--primary);
|
|
color: #ffffff;
|
|
}
|
|
|
|
.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 {
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.compact-header .invoice-title {
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.compact-header .status-badge {
|
|
margin-top: 0.25rem;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.invoice-container {
|
|
margin: 1rem;
|
|
}
|
|
|
|
.date-connector {
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.table-responsive {
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
.id-box {
|
|
margin-bottom: 1rem;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="invoice-container">
|
|
<div class="p-4">
|
|
@php
|
|
$showActions = $showActions ?? true;
|
|
@endphp
|
|
|
|
{{-- HEADER --}}
|
|
<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">
|
|
<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>
|
|
|
|
{{-- ID BOXES: INVOICE + CONTAINER --}}
|
|
<div class="id-container">
|
|
<div class="row">
|
|
{{-- Invoice 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-receipt"></i>
|
|
</div>
|
|
<div class="id-label">Invoice ID</div>
|
|
<div class="id-value">{{ $invoice->invoice_number }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Container 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-box"></i>
|
|
</div>
|
|
<div class="id-label">Container ID</div>
|
|
<div class="id-value">
|
|
@if($invoice->container && $invoice->container->container_number)
|
|
{{ $invoice->container->container_number }}
|
|
@elseif($invoice->container_id)
|
|
{{ $invoice->container_id }}
|
|
@else
|
|
N/A
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{{-- DATES --}}
|
|
<div class="date-container">
|
|
<div class="row align-items-center">
|
|
<div class="col-md-5">
|
|
<div class="date-card">
|
|
<div class="date-icon">
|
|
<i class="fas fa-calendar-alt"></i>
|
|
</div>
|
|
<div class="date-label">INVOICE DATE</div>
|
|
<div class="date-value">
|
|
{{ \Carbon\Carbon::parse($invoice->invoice_date)->format('M d, Y') }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="date-connector">
|
|
<i class="fas fa-arrow-right"></i>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-5">
|
|
<div class="date-card">
|
|
<div class="date-icon">
|
|
<i class="fas fa-clock"></i>
|
|
</div>
|
|
<div class="date-label">DUE DATE</div>
|
|
<div class="date-value @if($invoice->status == 'overdue') text-danger @endif">
|
|
{{ \Carbon\Carbon::parse($invoice->due_date)->format('M d, Y') }}
|
|
</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 (EDITABLE WHEN EMBEDDED) --}}
|
|
@php
|
|
$isEmbedded = isset($embedded) && $embedded;
|
|
@endphp
|
|
|
|
<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">
|
|
|
|
@if($isEmbedded)
|
|
<form action="{{ route('admin.invoices.items.update', $invoice->id) }}" method="POST">
|
|
@csrf
|
|
@method('PUT')
|
|
@endif
|
|
|
|
<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>
|
|
|
|
@if($isEmbedded)
|
|
{{-- EDIT MODE (invoice_edit page) --}}
|
|
<td class="text-center" style="width:120px;">
|
|
<input type="number"
|
|
step="0.01"
|
|
min="0"
|
|
name="items[{{ $item->id }}][price]"
|
|
value="{{ old('items.' . $item->id . '.price', $item->price) }}"
|
|
class="form-control form-control-sm text-end">
|
|
</td>
|
|
<td class="text-center" style="width:140px;">
|
|
<input type="number"
|
|
step="0.01"
|
|
min="0"
|
|
name="items[{{ $item->id }}][ttl_amount]"
|
|
value="{{ old('items.' . $item->id . '.ttl_amount', $item->ttl_amount) }}"
|
|
class="form-control form-control-sm text-end">
|
|
</td>
|
|
@else
|
|
{{-- NORMAL POPUP (READ-ONLY) --}}
|
|
<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>
|
|
@endif
|
|
|
|
<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
|
|
|
|
@if($invoice->items->isEmpty())
|
|
<tr>
|
|
<td colspan="13" class="text-center text-muted fw-bold py-3">
|
|
No invoice items found.
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@if($isEmbedded)
|
|
<div class="text-end p-3">
|
|
<button type="submit" class="btn btn-primary btn-sm">
|
|
<i class="fas fa-save me-1"></i> Update Items & Recalculate
|
|
</button>
|
|
</div>
|
|
</form>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- FINAL SUMMARY --}}
|
|
<div class="row">
|
|
<div class="col-md-6 offset-md-6">
|
|
<div class="card summary-card">
|
|
<div class="card-header summary-header">
|
|
<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>
|
|
|
|
@if($invoice->tax_type === 'gst')
|
|
{{-- CGST --}}
|
|
<div class="d-flex justify-content-between align-items-center mb-2 pb-1 border-bottom">
|
|
<span class="fw-semibold">
|
|
CGST ({{ $invoice->cgst_percent ?? ($invoice->gst_percent / 2) }}%):
|
|
</span>
|
|
<span class="fw-bold text-danger">
|
|
₹{{ number_format($invoice->gst_amount / 2, 2) }}
|
|
</span>
|
|
</div>
|
|
|
|
{{-- SGST --}}
|
|
<div class="d-flex justify-content-between align-items-center mb-2 pb-1 border-bottom">
|
|
<span class="fw-semibold">
|
|
SGST ({{ $invoice->sgst_percent ?? ($invoice->gst_percent / 2) }}%):
|
|
</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 align-items-center mb-2 pb-1 border-bottom">
|
|
<span class="fw-semibold">
|
|
IGST ({{ $invoice->igst_percent ?? $invoice->gst_percent }}%):
|
|
</span>
|
|
<span class="fw-bold text-danger">
|
|
₹{{ number_format($invoice->gst_amount, 2) }}
|
|
</span>
|
|
</div>
|
|
@else
|
|
{{-- Default GST --}}
|
|
<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>
|
|
@endif
|
|
|
|
<div class="d-flex justify-content-between align-items-center 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 ACTIONS --}}
|
|
<div class="mt-4 pt-3 border-top text-center">
|
|
@if($invoice->pdf_path && $showActions)
|
|
<a href="{{ asset($invoice->pdf_path) }}"
|
|
class="btn btn-primary me-2" download>
|
|
<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>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- FOOTER MESSAGE --}}
|
|
<div class="mt-4 pt-3 border-top text-center text-muted">
|
|
<p class="mb-1">Thank you for your business!</p>
|
|
<p class="mb-0">For any inquiries, contact us at support@Kent Logistic</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></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.");
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|