From 67d9b51186c3d4fa87cc0288f838722ddaf8e525 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 8 Jan 2024 22:57:13 +0530 Subject: [PATCH] Notification fixes : ps --- app/Controllers/Notifications.php | 5 +++-- app/Helpers/NotificationHelper.php | 2 +- app/Views/noifications_acknowlegdement.php | 19 ++++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index a4abbb33..ee6f7f98 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -102,12 +102,13 @@ class Notifications extends BaseController $receiving_status = $success['receiving_status']; $parents_status = $success['receiving_status']; $history_msg = strtolower(gettype($success)) == "string" ? $success : json_encode($success['reponse']); - session()->setFlashdata('success', 'Message : ' . $success['message']); + $tag = (int)$receiving_status === 0 ? 'success' : 'error' ; + session()->setFlashdata($tag, 'Message : ' . $success['message']); $this->logger->info("Whatsapp : Reponse = " . $success['message']); } catch (\Exception $e) { $this->logger->error("Whatsapp : Exception Message = " . $e->getMessage() . "
File: " . $e->getFile() . "
Line: " . $e->getLine() . "
"); session()->setFlashdata('error', 'Message: ' . $e->getMessage()); - $history_msg = strtolower(gettype($success)) == "string" ? $success : json_encode($success['reponse']); + $history_msg = $e->getMessage(); } $NotificationModel = new NotificationModel(); $history_parents_data = ['campaign_id' => 0,'status' => $parents_status]; diff --git a/app/Helpers/NotificationHelper.php b/app/Helpers/NotificationHelper.php index da34e98a..9cecf2c1 100644 --- a/app/Helpers/NotificationHelper.php +++ b/app/Helpers/NotificationHelper.php @@ -143,7 +143,7 @@ class NotificationHelper curl_close($curl); } catch (\Exception $e) { $this->logger->error('Helper : Whatsapp Exception Occur = ' . $e->getMessage()); - $final_result['message'] = "Exception Errno returned " . $e->getMessage() . "
"; + $final_result['message'] = $e->getMessage(); $final_result['receiving_status'] = 0 ; } $final_result['reponse'] = json_decode($curl_exec); diff --git a/app/Views/noifications_acknowlegdement.php b/app/Views/noifications_acknowlegdement.php index c83032cd..724b5b79 100644 --- a/app/Views/noifications_acknowlegdement.php +++ b/app/Views/noifications_acknowlegdement.php @@ -19,21 +19,26 @@ 0 ? $na['customers_name'] : "--" ; + $campaign = "--"; + switch ((int)$na['campaign_id']) { + case 0: $campaign = "Custom Notify"; break; + case 1: case 2: $campaign = "Expiry Notify"; break; + default: $campaign = $na['campaign_name']; + } - - - if ((int)$na['receiving_status'] == 1) { $class = 'text-success'; $icon = ''; $result = "";} - else { $class = 'text-danger'; $icon = ''; $result = "";} + if ((int)$na['receiving_status'] == 1) { $class = 'text-success text-center display-1'; $icon = ''; $result = "";} + else { $class = 'text-danger text-center display-1'; $icon = ''; $result = "";} ?> - + - - + +