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