Refactor invoice data report to improve status handling and styling
This commit is contained in:
@@ -263,7 +263,29 @@ class SendInvoiceDataReport extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($pendingInvoices as $inv) {
|
||||
// foreach ($pendingInvoices as $inv) {
|
||||
// $tableData[] = [
|
||||
// 'no' => $no++,
|
||||
// 'plant' => $plant->name,
|
||||
// // 'distribution_type' => $selectedDistribution,
|
||||
// // 'customer_code' => $inv->customer_code,
|
||||
// 'document_number' => $inv->document_number,
|
||||
// 'document_date' => $inv->document_date,
|
||||
// 'customer_trade_name' => $inv->customer_trade_name,
|
||||
// 'customer_location' => $inv->customer_location,
|
||||
// 'status' => 'Pending',
|
||||
// ];
|
||||
// }
|
||||
foreach ($pendingInvoices as $inv)
|
||||
{
|
||||
$documentDate = \Carbon\Carbon::parse($inv->document_date);
|
||||
|
||||
if ($documentDate->lt($startDate)) {
|
||||
$statusColor = 'status-pending-red';
|
||||
} else {
|
||||
$statusColor = 'status-pending-yellow';
|
||||
}
|
||||
|
||||
$tableData[] = [
|
||||
'no' => $no++,
|
||||
'plant' => $plant->name,
|
||||
@@ -274,6 +296,7 @@ class SendInvoiceDataReport extends Command
|
||||
'customer_trade_name' => $inv->customer_trade_name,
|
||||
'customer_location' => $inv->customer_location,
|
||||
'status' => 'Pending',
|
||||
'status_class' => $statusColor,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,18 @@
|
||||
color: #10b981;
|
||||
font-weight: bold;
|
||||
}
|
||||
.status-pending {
|
||||
/* .status-pending {
|
||||
color: #ef4444;
|
||||
font-weight: bold;
|
||||
} */
|
||||
/* .status-pending-yellow {
|
||||
color: #eab308;
|
||||
font-weight: bold;
|
||||
}
|
||||
.status-pending-red {
|
||||
color: #ef4444;
|
||||
font-weight: bold;
|
||||
} */
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
@@ -85,8 +93,6 @@
|
||||
{{-- <td>{{ $row['distribution_type'] }}</td>
|
||||
<td>{{ $row['customer_code'] }}</td> --}}
|
||||
<td>{{ $row['document_number'] }}</td>
|
||||
|
||||
{{-- ✅ Safe Carbon parse --}}
|
||||
<td>
|
||||
@if(!empty($row['document_date']) && $row['document_date'] != '-')
|
||||
{{ \Carbon\Carbon::parse($row['document_date'])->format('d-M-Y') }}
|
||||
@@ -97,7 +103,10 @@
|
||||
|
||||
<td>{{ $row['customer_trade_name'] }}</td>
|
||||
<td>{{ $row['customer_location'] }}</td>
|
||||
<td class="{{ $row['status'] == 'Went Out' ? 'status-wentout' : ($row['status'] == 'Pending' ? 'status-pending' : '') }}">
|
||||
{{-- <td class="{{ $row['status'] == 'Went Out' ? 'status-wentout' : ($row['status'] == 'Pending' ? 'status-pending' : '') }}">
|
||||
{{ $row['status'] }}
|
||||
</td> --}}
|
||||
<td class="{{ $row['status_class'] ?? '' }}">
|
||||
{{ $row['status'] }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user