From 7bf4421d441b191c5f4b29f73a57ab25cddff19e Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 20 Oct 2018 14:04:09 +0200 Subject: [PATCH] Improve best before date comparison on stockoverview page (fixes #87) --- views/stockoverview.blade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 2a548619..d9975c2c 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -76,7 +76,7 @@ @foreach($currentStock as $currentStockEntry) - amount > 0) table-warning @elseif (FindObjectInArrayByPropertyValue($missingProducts, 'id', $currentStockEntry->product_id) !== null) table-info @endif"> + amount > 0) table-warning @elseif (FindObjectInArrayByPropertyValue($missingProducts, 'id', $currentStockEntry->product_id) !== null) table-info @endif"> {{ $currentStockEntry->best_before_date }} - + {{ FindObjectInArrayByPropertyValue($locations, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->location_id)->name }} - @if($currentStockEntry->best_before_date < date('Y-m-d', strtotime('-1 days')) && $currentStockEntry->amount > 0) expired @elseif($currentStockEntry->best_before_date < date('Y-m-d', strtotime("+$nextXDays days")) && $currentStockEntry->amount > 0) expiring @elseif (FindObjectInArrayByPropertyValue($missingProducts, 'id', $currentStockEntry->product_id) !== null) belowminstockamount @endif + @if($currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) expired @elseif($currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days")) && $currentStockEntry->amount > 0) expiring @elseif (FindObjectInArrayByPropertyValue($missingProducts, 'id', $currentStockEntry->product_id) !== null) belowminstockamount @endif @php $productGroup = FindObjectInArrayByPropertyValue($productGroups, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->product_group_id) @endphp