From 6176cbba3dfbe0278560b82f49d3131c9d391663 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 29 Jan 2024 12:21:09 +0530 Subject: [PATCH] subscription in days count checked : ps --- app/Views/customer_form.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/app/Views/customer_form.php b/app/Views/customer_form.php index 0774c358..0f5356a9 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -274,17 +274,28 @@ subscription_in_days; - if ($daysRemaining <= 0) { + $fromDateTime = (new DateTime($subscription->from_subscription))->format('Y-m-d'); + $toDateTime = (new DateTime($subscription->to_subscription))->format('Y-m-d'); + $currentDate = (new DateTime())->format('Y-m-d'); + if ($currentDate === $toDateTime) { + $class = 'text-danger'; + $message = "Expired on Today"; + } elseif ($currentDate > $toDateTime) { $class = 'text-danger'; $message = "Expired"; - } elseif ($daysRemaining <= 3) { - $s = $daysRemaining == 1 ? "" : "s"; - $class = 'text-warning'; - $message = "Expire in $daysRemaining day".$s; } else { - $class = 'text-success'; - $message = $daysRemaining ." days until Expiration"; - }?> + if ($daysRemaining == 1) { + $class = 'text-warning'; + $message = "Expires in 1 day"; + } elseif ($daysRemaining <= 7) { + $class = 'text-warning'; + $message = "Expires in $daysRemaining days"; + } else { + $class = 'text-success'; + $message = "$daysRemaining days until expiration"; + } + } + ?> title ?> formatted_from_subscription ?>