203 lines
6.3 KiB
PHP
203 lines
6.3 KiB
PHP
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>Container {{ $container->container_number }} Summary</title>
|
||
<style>
|
||
* { box-sizing: border-box; }
|
||
body {
|
||
font-family: DejaVu Sans, sans-serif;
|
||
font-size: 10px;
|
||
margin: 10px;
|
||
background: #e5e7ff;
|
||
}
|
||
|
||
/* COMMON CARD GRID – 4 equal columns, 2 rows */
|
||
.card-grid {
|
||
display: table;
|
||
width: 100%;
|
||
border-spacing: 8px 6px;
|
||
margin-bottom: 8px;
|
||
}
|
||
.card-row {
|
||
display: table-row;
|
||
}
|
||
.card {
|
||
display: table-cell;
|
||
width: 25%;
|
||
padding: 7px 10px;
|
||
border-radius: 14px;
|
||
box-shadow: 0 4px 12px rgba(15,35,52,0.18);
|
||
color: #0f172a;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
/* INFO CARDS (FIRST ROW) */
|
||
.info-id { background: #e0f2ff; border-left: 4px solid #2563eb; }
|
||
.info-no { background: #dcfce7; border-left: 4px solid #22c55e; }
|
||
.info-date { background: #fee2e2; border-left: 4px solid #ef4444; }
|
||
.info-name { background: #fef9c3; border-left: 4px solid #f59e0b; }
|
||
|
||
/* TOTAL CARDS (SECOND ROW) */
|
||
.total-ctn { background: #dbeafe; border-left: 4px solid #1d4ed8; }
|
||
.total-qty { background: #bbf7d0; border-left: 4px solid #16a34a; }
|
||
.total-cbm { background: #fef3c7; border-left: 4px solid #d97706; }
|
||
.total-kg { background: #fecaca; border-left: 4px solid #dc2626; }
|
||
|
||
.label-text {
|
||
font-size: 9px;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.4px;
|
||
color: #4b5563;
|
||
}
|
||
.value-text-small {
|
||
font-size: 12px;
|
||
font-weight: 800;
|
||
margin-top: 2px;
|
||
word-wrap: break-word;
|
||
}
|
||
.value-text-big {
|
||
font-size: 16px;
|
||
font-weight: 800;
|
||
margin-top: 2px;
|
||
}
|
||
|
||
/* TABLE – solid yellow header like screenshot */
|
||
table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
margin-top: 6px;
|
||
table-layout: fixed;
|
||
background: #ffffff;
|
||
border-radius: 12px;
|
||
overflow: hidden;
|
||
}
|
||
th, td {
|
||
border: 1px solid #e5e7eb;
|
||
padding: 4px 3px;
|
||
text-align: center;
|
||
word-wrap: break-word;
|
||
}
|
||
th {
|
||
background: #fbd85d; /* इथे solid yellow */
|
||
font-size: 9px;
|
||
font-weight: 700;
|
||
color: #0c0909;
|
||
}
|
||
td {
|
||
font-size: 9px;
|
||
color: #111827;
|
||
}
|
||
tr:nth-child(even) td {
|
||
background: #f9fafb;
|
||
}
|
||
|
||
thead { display: table-header-group; }
|
||
tr { page-break-inside: avoid; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
@php
|
||
$totalCtn = 0;
|
||
$totalQty = 0;
|
||
$totalCbm = 0.0;
|
||
$totalKg = 0.0;
|
||
|
||
foreach ($container->rows as $row) {
|
||
if (!is_array($row->data)) continue;
|
||
foreach ($row->data as $h => $v) {
|
||
$norm = strtoupper(str_replace([' ', '/', '-', '.'],'', $h));
|
||
$val = is_numeric(str_replace([','], '', $v)) ? floatval(str_replace([','], '', $v)) : 0;
|
||
|
||
if (str_contains($norm, 'TOTALCTN') || $norm === 'CTN' || str_contains($norm,'TOTALCNTR') || str_contains($norm,'TOTALCARTON')) {
|
||
$totalCtn += $val;
|
||
}
|
||
if (str_contains($norm,'TOTALQTY') || str_contains($norm,'ITLQTY') || str_contains($norm,'TTLQTY')) {
|
||
$totalQty += $val;
|
||
}
|
||
if (str_contains($norm,'TOTALCBM') || str_contains($norm,'TTLCBM') || str_contains($norm,'ITLCBM')) {
|
||
$totalCbm += $val;
|
||
}
|
||
if (str_contains($norm,'TOTALKG') || str_contains($norm,'TTKG')) {
|
||
$totalKg += $val;
|
||
}
|
||
}
|
||
}
|
||
|
||
$allHeadings = [];
|
||
foreach ($container->rows as $row) {
|
||
if (is_array($row->data)) {
|
||
$allHeadings = array_unique(array_merge($allHeadings, array_keys($row->data)));
|
||
}
|
||
}
|
||
@endphp
|
||
|
||
{{-- TWO ROW GRID – FIRST: INFO / SECOND: TOTALS --}}
|
||
<div class="card-grid">
|
||
<div class="card-row">
|
||
<div class="card info-id">
|
||
<div class="label-text">Container ID</div>
|
||
<div class="value-text-small">{{ $container->id }}</div>
|
||
</div>
|
||
<div class="card info-no">
|
||
<div class="label-text">Container Number</div>
|
||
<div class="value-text-small">{{ $container->container_number }}</div>
|
||
</div>
|
||
<div class="card info-date">
|
||
<div class="label-text">Container Date</div>
|
||
<div class="value-text-small">
|
||
{{ $container->container_date ? $container->container_date->format('d-m-Y') : '-' }}
|
||
</div>
|
||
</div>
|
||
<div class="card info-name">
|
||
<div class="label-text">Container Name</div>
|
||
<div class="value-text-small">
|
||
{{ $container->container_name ?? '-' }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card-row">
|
||
<div class="card total-ctn">
|
||
<div class="label-text">Total CTN</div>
|
||
<div class="value-text-big">{{ number_format($totalCtn, 0) }}</div>
|
||
</div>
|
||
<div class="card total-qty">
|
||
<div class="label-text">Total QTY</div>
|
||
<div class="value-text-big">{{ number_format($totalQty, 0) }}</div>
|
||
</div>
|
||
<div class="card total-cbm">
|
||
<div class="label-text">Total CBM</div>
|
||
<div class="value-text-big">{{ number_format($totalCbm, 3) }}</div>
|
||
</div>
|
||
<div class="card total-kg">
|
||
<div class="label-text">Total KG</div>
|
||
<div class="value-text-big">{{ number_format($totalKg, 2) }}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- FULL TABLE --}}
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th style="width:18px;">#</th>
|
||
@foreach($allHeadings as $heading)
|
||
<th>{{ $heading }}</th>
|
||
@endforeach
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach($container->rows as $index => $row)
|
||
<tr>
|
||
<td>{{ $index + 1 }}</td>
|
||
@foreach($allHeadings as $heading)
|
||
<td>{{ $row->data[$heading] ?? '' }}</td>
|
||
@endforeach
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</body>
|
||
</html>
|