ifnex/04_Laravel/resources/views/pdfs/import_invoice.blade.php
Kazem Alghasi 02c29db696 feat(core): implement order approval flow, credit system, and import invoicing
Introduce a comprehensive set of commercial features including a multi-step
order approval workflow, customer credit management, and specialized
import service invoicing.

Key changes:
- Implement `pending_approval` and `approved` shipment statuses to allow
  staff verification before customer payment.
- Add a credit system to `User` model with `credit_limit` and `credit_used`
  to manage customer balances and debts.
- Develop a new `importInvoice` PDF generation service following the
  "Sheet ENG Invoice" specification for import services.
- Add Filament resources for managing Audit Logs, Commitment Forms,
  Customer Credits, and Shipment Checklists.
- Implement staff-specific APIs for order approval/rejection and
  customer financial status monitoring.
- Integrate Kavenegar SMS service for mobile verification and notifications.
- Add bulk tracking import functionality via CSV/Excel.
- Update WordPress bridge assets (CSS/JS) to support the new multi-step
  order form UI and updated redirection logic.
- Update deployment configurations and documentation to reflect new
  production domains and feature sets.
2026-09-03 06:04:20 +03:30

354 lines
11 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: DejaVu Sans, Arial, sans-serif;
font-size: 10px;
color: #000;
background: #fff;
}
.page {
width: 210mm;
min-height: 297mm;
padding: 15mm;
margin: 0 auto;
}
/* ─── HEADER ─── */
.header {
margin-bottom: 20px;
}
.invoice-to {
margin-bottom: 15px;
}
.invoice-to h2 {
font-size: 14px;
color: #333;
margin-bottom: 5px;
}
.invoice-to p {
font-size: 11px;
color: #666;
}
.invoice-to .name {
font-size: 16px;
font-weight: bold;
color: #000;
}
/* ─── INVOICE INFO ─── */
.invoice-info {
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
}
.invoice-info-table {
border-collapse: collapse;
font-size: 11px;
}
.invoice-info-table td {
padding: 4px 10px;
border: 1px solid #ccc;
}
.invoice-info-table td:first-child {
font-weight: bold;
background: #f5f5f5;
width: 120px;
}
/* ─── SHIPMENT DETAILS ─── */
.shipment-details {
margin-bottom: 20px;
padding: 10px;
border: 1px solid #ccc;
}
.shipment-details h3 {
font-size: 12px;
margin-bottom: 10px;
color: #333;
}
.details-grid {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.detail-item {
flex: 1;
min-width: 150px;
}
.detail-item .label {
font-size: 9px;
color: #666;
margin-bottom: 2px;
}
.detail-item .value {
font-size: 12px;
font-weight: bold;
color: #000;
}
/* ─── ITEMS TABLE ─── */
.items-section {
margin-bottom: 20px;
}
.items-section h3 {
font-size: 12px;
margin-bottom: 10px;
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 10px;
}
th, td {
border: 1px solid #ccc;
padding: 6px 8px;
text-align: left;
}
th {
background: #f5f5f5;
font-weight: bold;
text-align: center;
}
td.text-center { text-align: center; }
td.text-right { text-align: right; }
.total-row {
background: #f9f9f9;
font-weight: bold;
}
.subtotal-row {
background: #fafafa;
}
/* ─── TOTALS ─── */
.totals-section {
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
}
.totals-table {
border-collapse: collapse;
font-size: 11px;
width: 350px;
}
.totals-table td {
padding: 6px 10px;
border: 1px solid #ccc;
}
.totals-table td:first-child {
font-weight: bold;
background: #f5f5f5;
width: 180px;
}
.totals-table .grand-total {
background: #333;
color: #fff;
font-size: 13px;
}
/* ─── TERMS & CONDITIONS ─── */
.terms-section {
margin-top: 30px;
padding-top: 15px;
border-top: 1px solid #ccc;
}
.terms-section h4 {
font-size: 11px;
margin-bottom: 10px;
color: #333;
}
.terms-section p {
font-size: 9px;
color: #666;
line-height: 1.6;
}
/* ─── SIGNATURE ─── */
.signature-section {
display: flex;
justify-content: flex-end;
margin-top: 30px;
}
.signature-box {
width: 200px;
text-align: center;
}
.signature-box .label {
font-size: 10px;
color: #666;
margin-bottom: 40px;
}
.signature-line {
border-top: 1px solid #000;
padding-top: 5px;
font-size: 10px;
}
/* ─── FOOTER ─── */
.footer {
margin-top: 20px;
padding-top: 10px;
border-top: 2px solid #f37021;
text-align: center;
font-size: 9px;
color: #999;
}
</style>
</head>
<body>
<div class="page">
<!-- INVOICE TO -->
<div class="invoice-to">
<h2>INVOICE TO</h2>
<p class="name">{{ $receiver['name'] }}</p>
<p>{{ $receiver['company'] ?: '' }}</p>
<p>{{ $receiver['address'] }}</p>
<p>{{ $receiver['city'] }}, {{ $receiver['country'] }}</p>
</div>
<!-- INVOICE INFO -->
<div class="invoice-info">
<table class="invoice-info-table">
<tr>
<td>Invoice No.</td>
<td>{{ $invoice_no }}</td>
</tr>
<tr>
<td>Date</td>
<td>{{ $invoice_date }}</td>
</tr>
<tr>
<td>Origin</td>
<td>{{ $shipment->fromCountry?->name }}</td>
</tr>
<tr>
<td>Transport</td>
<td>Air Freight</td>
</tr>
<tr>
<td>Customs</td>
<td>{{ $customs_office ?: 'Imam Khomeini Airport' }}</td>
</tr>
</table>
</div>
<!-- SHIPMENT DETAILS -->
<div class="shipment-details">
<h3>SHIPMENT DETAILS</h3>
<div class="details-grid">
<div class="detail-item">
<div class="label">Actual Weight:</div>
<div class="value">{{ number_format($shipment->weight, 2) }} KG</div>
</div>
<div class="detail-item">
<div class="label">Volume:</div>
<div class="value">{{ $shipment->dimensions ?: '—' }}</div>
</div>
<div class="detail-item">
<div class="label">Volumetric Weight:</div>
<div class="value">{{ number_format($shipment->volumetric_weight ?? 0, 2) }} KG</div>
</div>
<div class="detail-item">
<div class="label">Chargeable Weight:</div>
<div class="value">{{ number_format($shipment->chargeable_weight ?? $shipment->weight, 2) }} KG</div>
</div>
<div class="detail-item">
<div class="label">Goods Nature:</div>
<div class="value">{{ $shipment->content_description ?: 'General Goods' }}</div>
</div>
<div class="detail-item">
<div class="label">Exchange Rate:</div>
<div class="value">{{ number_format($exchange_rate) }} IRR</div>
</div>
</div>
</div>
<!-- ITEMS TABLE -->
<div class="items-section">
<table>
<thead>
<tr>
<th style="width: 40px;">No.</th>
<th>Item Description</th>
<th style="width: 70px;">Unit</th>
<th style="width: 60px;">Qty</th>
<th style="width: 100px;">Unit Price</th>
<th style="width: 120px;">Total (Currency)</th>
<th style="width: 120px;">Total (Rial)</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@foreach($service_items as $index => $item)
<tr>
<td class="text-center">{{ $index + 1 }}</td>
<td>{{ $item['description'] }}</td>
<td class="text-center">{{ $item['unit'] ?: 'service' }}</td>
<td class="text-center">{{ number_format($item['quantity'], 2) }}</td>
<td class="text-right">{{ $item['unit_price'] > 0 ? number_format($item['unit_price'], 2) : '0.00' }}</td>
<td class="text-right">{{ $item['total_currency'] > 0 ? number_format($item['total_currency'], 2) : '0.00' }}</td>
<td class="text-right">{{ $item['total_rial'] > 0 ? number_format($item['total_rial']) : '0' }}</td>
<td>{{ $item['notes'] ?: '' }}</td>
</tr>
@endforeach
<!-- Freight Subtotal -->
<tr class="subtotal-row">
<td colspan="5" class="text-right">Freight Subtotal</td>
<td class="text-right">{{ number_format($freight_subtotal_currency, 2) }}</td>
<td class="text-right">{{ number_format($freight_subtotal_rial) }}</td>
<td></td>
</tr>
<!-- Clearance Subtotal -->
<tr class="subtotal-row">
<td colspan="5" class="text-right">Clearance Subtotal</td>
<td class="text-right">{{ number_format($clearance_subtotal_currency, 2) }}</td>
<td class="text-right">{{ number_format($clearance_subtotal_rial) }}</td>
<td></td>
</tr>
<!-- Currency Rate -->
<tr class="subtotal-row">
<td colspan="5" class="text-right">Currency Rate:</td>
<td class="text-right" colspan="2">{{ number_format($exchange_rate) }}</td>
<td></td>
</tr>
<!-- TOTAL -->
<tr class="total-row">
<td colspan="5" class="text-right">TOTAL</td>
<td class="text-right">{{ number_format($total_currency, 2) }}</td>
<td class="text-right">{{ number_format($total_rial) }}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<!-- TERMS & CONDITIONS -->
<div class="terms-section">
<h4>TERMS & CONDITIONS</h4>
<p>{{ $terms_and_conditions }}</p>
</div>
<!-- SIGNATURE -->
<div class="signature-section">
<div class="signature-box">
<div class="label">Authorised Signature</div>
<div class="signature-line">IFNEX Logistics</div>
</div>
</div>
<!-- FOOTER -->
<div class="footer">
IFNEX Logistics We Deliver Value | Invoice: {{ $invoice_no }} | Generated: {{ now()->format('Y-m-d H:i') }}
</div>
</div>
</body>
</html>