From 09b43b706faaf4572c2394b0f757191255aabd02 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 28 Aug 2025 14:31:45 +0530 Subject: [PATCH 01/19] CHANGE: in lead mail send history data : GWM --- app/Controllers/LeadsController.php | 4 ++-- app/Models/GmailSentHistoryModel.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index fc4a4e86..95d9adad 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -2746,7 +2746,7 @@ class LeadsController extends BaseController } // print_r($subject); die; - + $common = ['module' => "leads", 'pk' =>$lead_id]; if ($recipient_data) { foreach ($recipient_data as $recipient) { @@ -2761,7 +2761,7 @@ class LeadsController extends BaseController $string = implode(", ", $cc_mails); $bcc_string = implode(", ", $bcc_mails); - $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]); + $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string, $common]); // !dd($res); $result_data[] = ['mail' => $recipient['email'], 'status' => $res]; } diff --git a/app/Models/GmailSentHistoryModel.php b/app/Models/GmailSentHistoryModel.php index 9a0ae8ea..9c2fecf0 100644 --- a/app/Models/GmailSentHistoryModel.php +++ b/app/Models/GmailSentHistoryModel.php @@ -7,5 +7,5 @@ use CodeIgniter\Model; class GmailSentHistoryModel extends Model{ protected $table = 'gmail_sent_history'; protected $primaryKey = 'id'; - protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"]; + protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "common", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"]; } \ No newline at end of file From 44a8af4e2e425efde455606a5438139d664e641e Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 28 Aug 2025 15:29:34 +0530 Subject: [PATCH 02/19] CHANGE_TicketHistory --- app/Config/Routes.php | 4 +- app/Controllers/ThzController.php | 113 ++++++++---- app/Models/ThzHistoryModel.php | 45 +++++ ...{TicketTypesModel.php => ThzTypeModel.php} | 4 +- app/Views/layout/header.php | 33 ++++ app/Views/thz_list.php | 162 ++++++++---------- app/Views/thz_notes.php | 120 ++++++++++++- 7 files changed, 350 insertions(+), 131 deletions(-) create mode 100644 app/Models/ThzHistoryModel.php rename app/Models/{TicketTypesModel.php => ThzTypeModel.php} (93%) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index acb156bd..42964439 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -562,6 +562,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->get("ticketList", "ThzController::ticketList"); $routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); $routes->get("ticketConversationList", "ThzController::ticketConversationList"); + $routes->get("ticketHistoryList", "ThzController::ticketHistoryList"); $routes->get("hrFileList", "EmployeeRestController::hrFileList"); $routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters"); @@ -660,4 +661,5 @@ $routes->get("ticketList", "ThzController::ticketList"); $routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); $routes->get("ticketConversationList", "ThzController::ticketConversationList"); $routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails"); -// $routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType'); \ No newline at end of file +$routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType'); +$routes->get("ticketHistoryList", "ThzController::ticketHistoryList"); \ No newline at end of file diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index e286d651..fe6ad35b 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -8,12 +8,13 @@ use CodeIgniter\HTTP\ResponseInterface; use App\Models\ThzMasterModel; use App\Models\ThzMasterNotesModel; +use App\Models\ThzTypeModel; +use App\Models\ThzHistoryModel; use App\ControllerCleaners\ThzControllerCleaner; use App\Models\UserModel; use App\Models\ClientPolicyModel; use App\Models\ClientModel; use App\Models\TicketMailTemplateModel; -// use App\Models\TicketTypesModel; class ThzController extends BaseController @@ -21,7 +22,8 @@ class ThzController extends BaseController protected $thzMasterModel; protected $thzMasterNotesModel; - + protected $thzTypeModel; + protected $thzHistoryModel; protected $thzControllerCleaner; protected $userModel; @@ -29,16 +31,17 @@ class ThzController extends BaseController protected $clientModel; protected $ticketMailTemplateModel; - // protected $ticketTypesModel; public function __construct() { $this->thzMasterModel = new ThzMasterModel(); $this->thzMasterNotesModel = new ThzMasterNotesModel(); + $this->thzTypeModel = new thzTypeModel(); + $this->thzHistoryModel = new ThzHistoryModel(); $this->thzControllerCleaner = new ThzControllerCleaner(); $this->userModel = new UserModel(); $this->clientPolicyModel = new ClientPolicyModel(); - $this->clientModel = new ClientModel(); + $this->clientModel = new ClientModel(); $this->ticketMailTemplateModel = new TicketMailTemplateModel(); } @@ -55,6 +58,28 @@ class ThzController extends BaseController $text = "update"; $result = $this->updateTicket($data); + // here insert history Status. + $old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray(); + + if ($old && isset($data['status'])) { + if ($old['status'] != $data['status']) { + $history = [ + 'thz_id' => $data['thz_id'], + 'field_name' => 'status', + 'display_name' => 'Status', + 'old_value' => $old['status'], + 'new_value' => $data['status'], + 'is_active' => 1 + ]; + + if (!empty(get_session_userid())) { + $history['created_by'] = get_session_userid(); + } + + $this->thzHistoryModel->insert($history); + } + } + $updateID = $data['thz_id']; } else { @@ -228,43 +253,63 @@ class ThzController extends BaseController } - // public function ticketType() - // { - // $method = $this->request->getMethod(); // get, post + public function ticketType() + { + $method = $this->request->getMethod(); // get, post - // if ($method === 'get') { + if ($method === 'get') { - // $types = $this->ticketTypesModel->where('is_active', 1)->findAll(); - // if (empty($types)) { - // return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); - // } - // return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200); + $types = $this->thzTypeModel->where('is_active', 1)->findAll(); + if (empty($types)) { + return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); + } + return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200); - // } + } - // if ($method === 'post') { + if ($method === 'post') { - // $data = $this->request->getPost(); - // if (!empty($data['id'])) { - // $text = "update"; - // $result = $this->ticketTypesModel->update($data['id'], $data); - // $updateID = $data['id']; - // } else { - // $text = "create"; - // $insertID = $this->ticketTypesModel->insert($data); - // $result = true; - // } + $data = $this->request->getPost(); + if (!empty($data['id'])) { + $text = "update"; + $result = $this->thzTypeModel->update($data['id'], $data); + $updateID = $data['id']; + } else { + $text = "create"; + $insertID = $this->thzTypeModel->insert($data); + $result = true; + } - // $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ; + $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ; - // return $this->response->setJSON([ - // 'status' => $id ? 'success' : 'error', - // 'message' => $id ? "Ticket Type {$text}d successfully " : "Unable to {$text} ticket type. Please try again." , - // 'id' => $id - // ])->setStatusCode($id ? 200 : 400); - // } - // return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); - // } + return $this->response->setJSON([ + 'status' => $id ? 'success' : 'error', + 'message' => $id ? "Ticket Type {$text}d successfully " : "Unable to {$text} ticket type. Please try again." , + 'id' => $id + ])->setStatusCode($id ? 200 : 400); + } + return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); + } + + public function ticketHistoryList() + { + + $data = $this->request->getGet(); + $thz_id = $data['thz_id']; + // $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray(); + $details = $this->thzHistoryModel->select('thz_history.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as created_name') + ->join('user_profiles', 'user_profiles.id = thz_history.created_by', 'left') + ->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1)->get()->getResultArray(); + + + + if (empty($details)) { + return $this->response->setJSON([ 'status' => 'error','message' => 'No History found'])->setStatusCode(404); + } + + + return $this->response->setJSON(['status' => 'success','data' => $details])->setStatusCode(200); + } /************************************************** PRIVATE FUNCTIONS ********************************************************/ diff --git a/app/Models/ThzHistoryModel.php b/app/Models/ThzHistoryModel.php new file mode 100644 index 00000000..f7dd22d2 --- /dev/null +++ b/app/Models/ThzHistoryModel.php @@ -0,0 +1,45 @@ + diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index cde116e0..8b123006 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -7,52 +7,17 @@ width: 100%; } -/* HEADER */ -thead th { - background-color: #00999E; - color: #fff !important; - border-top: 0px solid #fff !important; - border-bottom: 0px solid #fff !important; -} - /* .table thead th { vertical-align: bottom; border-bottom: 2px solid #fff; } */ -/* Rounded header corners */ -thead th:first-child { - border-top-left-radius: 15px !important; - border-bottom-left-radius: 15px !important; -} -thead th:last-child { - border-top-right-radius: 15px !important; - border-bottom-right-radius: 15px !important; -} - -/* BODY ROWS */ -tbody td { - background: #F5FFFF; /* apply bg to td not tr */ - padding: 12px; - border-top: 1px solid #eee; - border-bottom: 1px solid #eee; -} /* Add shadow + spacing row "card" effect */ tbody tr { /* box-shadow: 0 2px 5px rgba(0,0,0,0.08); */ } -/* Rounded corners for first + last cell of each row */ -tbody tr td:first-child { - border-top-left-radius: 15px !important; - border-bottom-left-radius: 15px !important; -} -tbody tr td:last-child { - border-top-right-radius: 15px !important; - border-bottom-right-radius: 15px !important; -} - /* Hover effect */ #scroll-horizontal-datatable tbody tr:hover td { background-color: #e0e0e0; @@ -123,8 +88,7 @@ tbody tr td:last-child { white-space: nowrap !important; } */ - -.text-custom-black{ +.app-text-black{ color: #000000 !important; } .text-custom-grey{ @@ -251,8 +215,8 @@ table thead th {
- - +
+ @@ -265,7 +229,7 @@ table thead th { - + $row){ ?> @@ -394,9 +358,17 @@ table thead th { @@ -683,62 +655,66 @@ table thead th { document.getElementById('policy_id').value = policyId || ""; } - function hideandshowpolicy() { - var select = document.getElementById('ticket_type').value; - var policyContainer = document.getElementById('policy_container'); + // function hideandshowpolicy() { + // var select = document.getElementById('ticket_type').value; + // var policyContainer = document.getElementById('policy_container'); - if (select === 'Service') { - policyContainer.style.display = "block"; // show + // if (select === 'Service') { + // policyContainer.style.display = "block"; // show + // } else { + // policyContainer.style.display = "none"; // hide + // document.getElementById('policy_no').value = ""; + // document.getElementById('policy_id').value = ""; + // } + // } + +function hideandshowpolicy() { + var select = document.getElementById('ticket_type'); + var value = select.value; + var policyContainer = document.getElementById('policy_container'); + + if (value === "0") { + let newType = prompt("Enter new ticket type:"); + if (newType && newType.trim() !== "") { + + var formData = new FormData(form); + + $.ajax({ + url: "", + type: "POST", + data: formData, + processData: false, + contentType: false, + dataType: 'json', + success: function(response) { + if (response.status === "success") { + + let option = new Option(newType, newType); + let addNewOption = select.querySelector('option[value="0"]'); + select.insertBefore(option, addNewOption); + select.value = newType; + value = newType; + console.log(response.message); + + } else { console.log(response.message); value = ""; } + }, + error: function(xhr) { console.log("Error: " + xhr.statusText); value = ""; } + }); } else { - policyContainer.style.display = "none"; // hide - document.getElementById('policy_no').value = ""; - document.getElementById('policy_id').value = ""; + select.value = ""; + value = ""; } } -// function hideandshowpolicy() { -// var select = document.getElementById('ticket_type'); -// var value = select.value; -// var policyContainer = document.getElementById('policy_container'); + if (value === 'Service') { + policyContainer.style.display = "block"; + } else { + policyContainer.style.display = "none"; + document.getElementById('policy_no').value = ""; + document.getElementById('policy_id').value = ""; + } -// if (value === "0") { -// let newType = prompt("Enter new ticket type:"); -// if (newType && newType.trim() !== "") { - -// $.ajax({ -// url: "", -// type: "POST", -// data: { name: newType }, -// dataType: 'json', -// success: function(response) { -// if (response.status === "success") { - -// let option = new Option(newType, newType); -// let addNewOption = select.querySelector('option[value="0"]'); -// select.insertBefore(option, addNewOption); -// select.value = newType; -// value = newType; -// console.log(response.message); - -// } else { console.log(response.message); value = ""; } -// }, -// error: function(xhr) { console.log("Error: " + xhr.statusText); value = ""; } -// }); -// } else { -// select.value = ""; -// value = ""; -// } -// } - -// if (value === 'Service') { -// policyContainer.style.display = "block"; -// } else { -// policyContainer.style.display = "none"; -// document.getElementById('policy_no').value = ""; -// document.getElementById('policy_id').value = ""; -// } - -// } +} + \ No newline at end of file From 637542eaf1f121f306ef5ea3370f42f341a4f351 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 28 Aug 2025 15:57:52 +0530 Subject: [PATCH 03/19] FIX_TicketType --- app/Views/thz_list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index 8b123006..3de203f4 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -358,9 +358,9 @@ table thead th { From 54d8662bce911f48aef02b72d8a0941d6fd05f0f Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 28 Aug 2025 17:16:40 +0530 Subject: [PATCH 04/19] CHANGE: in lead mail send history data : GWM --- app/Controllers/LeadsController.php | 2 +- app/Helpers/MailHelper.php | 1 + app/Models/GmailSentHistoryModel.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 95d9adad..dfee8dc0 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -2761,7 +2761,7 @@ class LeadsController extends BaseController $string = implode(", ", $cc_mails); $bcc_string = implode(", ", $bcc_mails); - $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string, $common]); + $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string, 'common' => $common]); // !dd($res); $result_data[] = ['mail' => $recipient['email'], 'status' => $res]; } diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index cce74a9a..89e90262 100755 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -322,6 +322,7 @@ class MailHelper $from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail'); // $from_address = "claims@nhanceindia.in"; + if(isset($params['common'])){ $params['common']['from_mail'] = $from_address; } try { $curl = curl_init(); diff --git a/app/Models/GmailSentHistoryModel.php b/app/Models/GmailSentHistoryModel.php index 9c2fecf0..d26486e8 100644 --- a/app/Models/GmailSentHistoryModel.php +++ b/app/Models/GmailSentHistoryModel.php @@ -7,5 +7,5 @@ use CodeIgniter\Model; class GmailSentHistoryModel extends Model{ protected $table = 'gmail_sent_history'; protected $primaryKey = 'id'; - protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "common", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"]; + protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "module", "pk", "from_mail", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"]; } \ No newline at end of file From 1b644b5f99b88c65431739c6fa225e5270b3ee8c Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 28 Aug 2025 17:18:34 +0530 Subject: [PATCH 05/19] FIX_THZ changes --- app/Views/thz_list.php | 17 ++++++++--------- app/Views/thz_notes.php | 12 +++++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index 3de203f4..44cecd6f 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -88,9 +88,6 @@ tbody tr { white-space: nowrap !important; } */ -.app-text-black{ - color: #000000 !important; -} .text-custom-grey{ font-size: 0.85em; color: #6c757d !important; @@ -215,7 +212,7 @@ table thead th {
-
Ticket ID NameUpdated At
+
@@ -257,15 +254,17 @@ table thead th { @@ -359,7 +358,7 @@ table thead th {
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- + @@ -241,7 +249,7 @@
- +
- +
- +
- +
- + @@ -302,108 +310,108 @@
Ticket ID format('d/m/Y') . "
" . $cdt->format('h:i a') . ""; + $cd = date("j F Y", strtotime($row['created_at'])); + $ct = date("h:i a", strtotime($row['created_at'])); + echo $cd . "
" . $ct . ""; endif; ?>
format('d/m/Y') . "
" . $udt->format('h:i a') . ""; + $ud = date("j F Y", strtotime($row['updated_at'])); + $ut = date("h:i a", strtotime($row['updated_at'])); + echo $ud . "
" . $ut . ""; endif; ?>
+
diff --git a/app/Views/thz_notes.php b/app/Views/thz_notes.php index 755a1af1..a5bf3ea1 100644 --- a/app/Views/thz_notes.php +++ b/app/Views/thz_notes.php @@ -1,12 +1,4 @@ @@ -917,7 +923,7 @@ a.app-badge-secondary:focus, a.app-badge-secondary.focus { - +
  • /assets/images/ticket.png" alt="Logo" height="20"> diff --git a/app/Views/notification old.php b/app/Views/notification old.php index ed5f8ee5..c606b064 100644 --- a/app/Views/notification old.php +++ b/app/Views/notification old.php @@ -1494,7 +1494,7 @@ template_name = ''; newRow.innerHTML = `
  • - + `; container.appendChild(newRow); diff --git a/app/Views/notification.php b/app/Views/notification.php index 316ebae9..cffe679b 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -860,7 +860,7 @@ newRow.innerHTML = ` - + `; container.appendChild(newRow); @@ -1155,7 +1155,7 @@ newRow.innerHTML = ` - + `; container.appendChild(newRow); diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 596f7a21..13791cd2 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -861,8 +861,10 @@
    - Yes + + No +
    diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index 3400d1a2..60be9f72 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -1691,7 +1691,7 @@ function addInsurerColumn() { $('#insurerTable thead tr').append(`
    `); diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 9e095f2e..ba236dd8 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -4047,7 +4047,7 @@ function addInsurerColumn() { $('#insurerTable thead tr').append(` `); diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 03a9450b..ff8a98da 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -1073,7 +1073,7 @@ function appendFileTableBody(data) .attr('target', '_blank') // Open in a new tab .attr('style', 'font-size:18px;') .attr('data-id', item.id) - .addClass('fa fa-download') + .addClass('mdi mdi-download') // Append the tag inside the
    Ticket ID ${item.file_name} ${item.file_name} ${item.file_name} Insurer ${insurerCount} - ${insurerCount > 1 ? `` : ''} + ${insurerCount > 1 ? `` : ''} Insurer ${insurerCount} - ${insurerCount > 1 ? `` : ''} + ${insurerCount > 1 ? `` : ''} @@ -1168,14 +1168,14 @@ function appendVehicleFileTableBody(data) .attr('href', '' + item.file_name) .attr('style', 'font-size:18px;') .attr('data-id', item.id) - .addClass('fa fa-download') + .addClass('mdi mdi-download') .text(' '); // Space after the icon // Create the delete link var deleteLink = $('') .attr('style', 'font-size:18px;') .attr('data-id', item.id) - .addClass('fa fa-trash') + .addClass('mdi mdi-delete') .text(' '); // Space after the icon // Append the download and delete icons inside the same diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index 89cf7748..3709fb15 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -399,7 +399,9 @@
    - +
    @@ -5827,3 +5829,4 @@ + diff --git a/public/assets/libs/bootstrap-daterangepicker/index.html b/public/assets/libs/bootstrap-daterangepicker/index.html index 459d6138..5ff06a07 100755 --- a/public/assets/libs/bootstrap-daterangepicker/index.html +++ b/public/assets/libs/bootstrap-daterangepicker/index.html @@ -60,7 +60,7 @@   -   Download ZIP +   Download ZIP
    diff --git a/public/assets/libs/bootstrap-daterangepicker/website/index.html b/public/assets/libs/bootstrap-daterangepicker/website/index.html index 407c4bfb..48eee18a 100755 --- a/public/assets/libs/bootstrap-daterangepicker/website/index.html +++ b/public/assets/libs/bootstrap-daterangepicker/website/index.html @@ -60,7 +60,7 @@   -   Download ZIP +   Download ZIP
    From a3f84efe3b4a00b1419d004944b5cbfc7467f37e Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Fri, 29 Aug 2025 16:38:12 +0530 Subject: [PATCH 11/19] FIX_Small Fixes --- app/Controllers/EmpDataServiceController.php | 12 +++++-- app/Controllers/EmployeeController.php | 8 +++++ app/Controllers/LeadsController.php | 1 + app/Controllers/ThzController.php | 4 ++- app/Models/BatchFileModel.php | 1 + app/Views/insurer_or_tpa_data.php | 33 +++++++++++++++++++- 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 506b39a1..285207f4 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -1862,6 +1862,7 @@ class EmpDataServiceController extends BaseController $status = $file['status']; $batch_code = $file['batch_code']; $user_id = $file['created_by']; + $policy_issue_date = $file['policy_issue_date']; $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first(); @@ -2086,6 +2087,7 @@ class EmpDataServiceController extends BaseController 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, 'gst' => $base_bremium_and_gst['gst'] ?? null, + 'policy_issue_date' => $policy_issue_date ?? null, ]]); // $this->cashDepositCalculationForInception($depositeData); @@ -2417,6 +2419,7 @@ class EmpDataServiceController extends BaseController $batch_code = $file['batch_code']; $user_id = $file['created_by']; $event_type = $file['event_type']; + $policy_issue_date = $file['policy_issue_date']; $status_val = 'success'; @@ -2519,6 +2522,7 @@ class EmpDataServiceController extends BaseController 'endorsement_no' => $endorsement_id[0] ?? null, 'emp_count' => $emp_count ?? null, 'action_type' => $file['event_type'] ?? null, + 'policy_issue_date' => $policy_issue_date ?? null, ]]); @@ -2999,6 +3003,7 @@ class EmpDataServiceController extends BaseController $status = $file['status']; $batch_code = $file['batch_code']; $user_id = $file['created_by']; + $policy_issue_date = $file['policy_issue_date']; $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first(); @@ -3179,6 +3184,7 @@ class EmpDataServiceController extends BaseController 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, 'gst' => $base_bremium_and_gst['gst'] ?? null, + 'policy_issue_date' => $policy_issue_date ?? null, ]]); } @@ -3537,6 +3543,7 @@ class EmpDataServiceController extends BaseController $status = $file['status']; $batch_code = $file['batch_code']; $user_id = $file['created_by']; + $policy_issue_date = $file['policy_issue_date']; $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first(); @@ -3687,6 +3694,7 @@ class EmpDataServiceController extends BaseController 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, 'gst' => $base_bremium_and_gst['gst'] ?? null, + 'policy_issue_date' => $policy_issue_date ?? null, ]]); } @@ -4981,7 +4989,7 @@ class EmpDataServiceController extends BaseController 'policy_no' => $policy_data['policy_no'] ?? null, 'cd_ac_no' => $policy_data['cd_ac_no'] ?? null, 'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null, - 'policy_issue_date' => $policy_data['policy_start_date'] ?? null, + 'policy_issue_date' => $policy_data['policy_issue_date'] ?? null, 'policy_start_date' => $policy_data['policy_start_date'] ?? null, 'policy_end_date' => $policy_data['policy_end_date'] ?? null, 'data_received_date' => $policy_data['data_received_date'] ?? null, @@ -4992,7 +5000,7 @@ class EmpDataServiceController extends BaseController 'co_share' => $policy_data['co_share'] ?? 0, 'pre_payable_by' => $policy_data['pre_payable_by'] ?? 1, 'renewal_date' => $policy_data['policy_end_date'] ?? null, - 'month' => date('Y-m-01', strtotime($policy_data['policy_start_date'])) ?? null, + 'month' => date('Y-m-01', strtotime($policy_data['policy_issue_date'] ?? "")) ?? null, 'ct_type' => 1, 'is_cd_reduce_from_bds' => 0, 'client_type_id' => 0, diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 40e8af2b..91ed4ef6 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -515,6 +515,7 @@ class EmployeeController extends AdminController $client_branch_id = $this->request->getPost('client_branch_id'); $insurer_or_tpa = $this->request->getPost('insurer_or_tpa'); $actions = $this->request->getPost('action_type'); + $policy_issue_date = $this->request->getPost('policy_issue_date'); $client_data = $this->clientPolicyModel->getCliendDataForExcelFileName($client_policy_id); $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $client_data['policy_type'], $client_data['branch_code']); @@ -530,6 +531,13 @@ class EmployeeController extends AdminController 'actions' => $actions, 'file_name' => $file_name, ]; + + + $batch_data['policy_issue_date'] = (!empty($policy_issue_date) && strtotime($policy_issue_date) !== false) + ? change_date_format($policy_issue_date) + : null; + + if ($actions == 'export') { if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception' || ($event_type == 'MultipleEvents' && $insurer_or_tpa == 'tpa')) { diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 742ca2cf..545662e3 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -3676,6 +3676,7 @@ class LeadsController extends BaseController $result = $this->gmailSentHistoryModel ->where('pk', $id) ->where('module',"leads") + ->orderBy('created_at', 'desc') ->findAll(); if(!empty($result)){ $result = !empty($result) ? $result : []; diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index fe6ad35b..ad3633e2 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -299,7 +299,9 @@ class ThzController extends BaseController // $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray(); $details = $this->thzHistoryModel->select('thz_history.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as created_name') ->join('user_profiles', 'user_profiles.id = thz_history.created_by', 'left') - ->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1)->get()->getResultArray(); + ->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1) + ->orderBy('thz_history.created_at', 'desc') + ->get()->getResultArray(); diff --git a/app/Models/BatchFileModel.php b/app/Models/BatchFileModel.php index b8ebc8e9..e791553a 100755 --- a/app/Models/BatchFileModel.php +++ b/app/Models/BatchFileModel.php @@ -25,6 +25,7 @@ class BatchFileModel extends Model "status", "error_data", "client_branch_id", + "policy_issue_date", ]; // Callbacks diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index 6c22b23c..dc07ab1c 100755 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -90,9 +90,15 @@
    +
    -
     [ ] @@ -144,6 +150,16 @@ }); + $(document).ready(function() { + + var policy_issue_datePicker = flatpickr("#policy_issue_date", { + dateFormat: "d/m/Y", + allowInput: false, + }); + + $('#insurer_or_tpa, #action_type').on('change', togglePolicyIssueDate); + }); + $(document).ready(function() { has('error')) : ?> @@ -730,4 +746,19 @@ //------------------------------------------------------------------------------------------------------ + + \ No newline at end of file From 485cb61ae9232a83a7f4f52a07840443976240de Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Fri, 29 Aug 2025 17:23:15 +0530 Subject: [PATCH 12/19] FIX_THZ White color --- app/Views/thz_list.php | 29 ++++++++++++++--------------- app/Views/thz_notes.php | 15 ++++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index 4c38f373..f0e3d6ea 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -167,7 +167,7 @@ table thead th { .form-control { background-color: #ECECEC !important; border: 1px solid #ccc; /* optional */ - color: #000; /* keep text readable */ + /* color: #000; keep text readable */ } .form-control:focus { @@ -184,12 +184,11 @@ table thead th { /* Text inside */ .select2-container .select2-selection__rendered { - color: #000 !important; line-height: 36px !important; } .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { - background-color: #ECECEC !important; + background-color: #00999E !important; } @@ -202,7 +201,7 @@ table thead th {
    -

    Tickets

    +

    Tickets

    @@ -295,7 +294,7 @@ table thead th {
    - @@ -314,7 +313,7 @@ table thead th {
    - +
    @@ -428,7 +427,7 @@ table thead th {
    @@ -746,31 +745,31 @@ $(document).ready(function() { "<'row'<'col-sm-5'i><'col-sm-7'p>>", buttons: [ { - text: ' Create New Ticket ', - className: 'btn app-btn-primary app-btn-border-radius app-text-white mr-2', + text: ' Create New Ticket ', + className: 'btn app-btn-primary app-btn-border-radius mr-2', action: function(e, dt, node, config) { openTicket(); } }, { extend: 'collection', - text: ' Export ', - className: 'btn app-btn-secondary app-btn-border-radius app-text-white', + text: ' Export ', + className: 'btn app-btn-secondary app-btn-border-radius', buttons: [ { extend: 'csv', - text: ' CSV ', + text: ' CSV ', title: 'Tickets', - className: 'app-btn-primary app-text-white', + className: 'app-btn-primary ', }, { extend: 'excel', - text: ' EXCEL ', + text: ' EXCEL ', title: 'Tickets', exportOptions: { orthogonal: 'sort' }, - className: 'app-btn-primary app-text-white', + className: 'app-btn-primary ', } ] } diff --git a/app/Views/thz_notes.php b/app/Views/thz_notes.php index a5bf3ea1..7121dee7 100644 --- a/app/Views/thz_notes.php +++ b/app/Views/thz_notes.php @@ -125,12 +125,12 @@ hr{ /* Text inside */ .select2-container .select2-selection__rendered { - color: #000 !important; + /* color: #000 !important; */ line-height: 36px !important; } .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { - background-color: #ECECEC !important; + background-color: #00999E !important; } @@ -472,7 +472,7 @@ hr{
    - @@ -601,12 +601,13 @@ hr{ diff --git a/app/Views/other_policy_terms.php b/app/Views/other_policy_terms.php index 9cdf9887..03850e4b 100755 --- a/app/Views/other_policy_terms.php +++ b/app/Views/other_policy_terms.php @@ -229,6 +229,7 @@ }); var policy_type_id = ""; + var other_auto_save_enable = false; $('body').on('click', '.btnPolicyMaster', function() { $("#append_html_for_other_policy_terms").empty(); @@ -276,10 +277,12 @@ if (res.emp_count_by_policy != 0) { $("#btnOtherTermsSubmit").hide(); $("#otherButtonSpecialCondition").hide(); + other_auto_save_enable = false; } else { $("#btnOtherTermsSubmit").show(); $("#otherButtonSpecialCondition").show(); - startAutoSubmit('OTHERS'); + // startAutoSubmit('OTHERS'); + other_auto_save_enable = true; } @@ -760,12 +763,12 @@ } function beautifyString(str) { - return str - .split('_') // Split the string by underscores - .map(word => - word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word - ) - .join(' '); // Join with spaces instead of underscores + return str + .split('_') // Split the string by underscores + .map(word => + word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word + ) + .join(' '); // Join with spaces instead of underscores } function autoSaveOtherTerms(){ @@ -836,4 +839,42 @@ } + function debounceothers(fn, delay) { + let timeout; + return function () { + clearTimeout(timeout); + timeout = setTimeout(fn, delay); + }; + } + + $(document).ready(function () { + const form = document.querySelector("#otherPolicyTerms"); + + // MutationObserver (always runs) + const observer = new MutationObserver(() => { + $("#otherPolicyTerms").find("input, select, textarea").each(function () { + if (other_auto_save_enable) { // only bind autosave if enabled + if (!$(this).attr("data-observed")) { + const debouncedSave = debounceothers(autoSaveOtherTerms, 1000); + $(this).on("input change", debouncedSave); + $(this).attr("data-observed", "true"); + } + } + }); + }); + + observer.observe(form, { childList: true, subtree: true }); + + // Bind for existing fields (only if enabled) + if (other_auto_save_enable) { + const debouncedSave = debounceothers(autoSaveOtherTerms, 1000); + $("#otherPolicyTerms").find("input, select, textarea").each(function () { + $(this).on("input change", debouncedSave); + $(this).attr("data-observed", "true"); + }); + } else { + console.log("This policy has employee processed (autosave disabled) -- OTHERS") ; + } + }); + \ No newline at end of file diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 596f7a21..cb62f0ab 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -887,6 +887,7 @@ \ No newline at end of file diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index 513ee345..cf7cb962 100755 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -473,6 +473,7 @@ var policy_grid_id = $('#client_id').val(); var grid_html = ''; + var gpa_auto_save_enable = false; $("#policyGPATerms").submit(function(event) { @@ -603,10 +604,12 @@ if (res.emp_count_by_policy != 0) { $("#btnGPATermsSubmit").hide(); $("#gpaButtonSpecialCondition").hide(); + gpa_auto_save_enable = false; } else { $("#btnGPATermsSubmit").show(); $("#gpaButtonSpecialCondition").show(); startAutoSubmit('GPA'); + gpa_auto_save_enable = true; } @@ -720,7 +723,17 @@ // console.log('jsonObject value', jsonObject[key]) // console.log('jsonObject value type', typeof jsonObject[key]) - let elements = document.getElementsByName(key); + let elements; // declare the element variable + + if (key === "terrorism") { + let form = document.getElementById("policyGPATerms"); + elements = form.querySelectorAll('[name="terrorism"]'); + } else { + elements = document.getElementsByName(key); + } + + + // let elements = document.getElementsByName(key); if (elements && elements.length > 0) { let element = elements[0]; @@ -1086,4 +1099,43 @@ }); } + function debouncegpa(fn, delay) { + let timeout; + return function () { + clearTimeout(timeout); + timeout = setTimeout(fn, delay); + }; + } + + $(document).ready(function () { + const form = document.querySelector("#policyGPATerms"); + + // MutationObserver (always runs) + const observer = new MutationObserver(() => { + $("#policyGPATerms").find("input, select, textarea").each(function () { + if (gpa_auto_save_enable) { // only bind autosave if enabled + if (!$(this).attr("data-observed")) { + const debouncedSave = debouncegpa(autoSaveGpaTerms, 1000); + $(this).on("input change", debouncedSave); + $(this).attr("data-observed", "true"); + } + } + }); + }); + + observer.observe(form, { childList: true, subtree: true }); + + // Bind for existing fields (only if enabled) + if (gpa_auto_save_enable) { + const debouncedSave = debouncegpa(autoSaveGpaTerms, 1000); + $("#policyGPATerms").find("input, select, textarea").each(function () { + $(this).on("input change", debouncedSave); + $(this).attr("data-observed", "true"); + }); + } else { + console.log("This policy has employee processed (autosave disabled) -- GPA"); + } + }); + + \ No newline at end of file diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index ebb7d4b1..23f427b2 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -916,8 +916,11 @@ hiddenData = $("#empIDHidden").val(); hiddenData = JSON.parse(hiddenData); console.log('employee id ', hiddenData['emp_id']); + let ticket_type_id = $('#ticket_type_id').val(); + console.log("ticket_type_id", ticket_type_id); data = { - emp_id: hiddenData['emp_id'] + emp_id: hiddenData['emp_id'], + ticket_type_id: ticket_type_id, } $.ajax({ url: '', diff --git a/app/Views/ticket_form_handler.php b/app/Views/ticket_form_handler.php index c454791f..6fb57a44 100644 --- a/app/Views/ticket_form_handler.php +++ b/app/Views/ticket_form_handler.php @@ -205,6 +205,7 @@ var client_list = ''; // local variable for storing the client branch list var branch_list = ''; // local variable for storing the client branch list var policy_list = ''; // local variable for storing the client policy list + var selected_ticket_type_id = ``; $(document).ready(function() { getClientAndBranchAndPolicy(); @@ -575,7 +576,8 @@ let type = $('#employee_data_points').val() let param = $('#emp_mobile_number_for_claim').val() let client_policy_id = $('#emp_client_policy_data_list').val() - let client_id = $('#mobile_emp_client_data_list').val() + let client_id = $('#mobile_emp_client_data_list').val(); + console.log('selected_ticket_type_id', selected_ticket_type_id); if (searchType == 'client') { type = 'emp_code'; @@ -583,7 +585,7 @@ client_id = $('#emp_client_data_list').val() } let url = '' + param + '/' + type + '/' + - client_policy_id + '/' + client_id; + client_policy_id + '/' + client_id + '/'+ selected_ticket_type_id; // Data to send in the AJAX request let requestData = { @@ -591,6 +593,7 @@ type: type, client_policy_id: client_policy_id, client_id: client_id, + ticket_type_id: selected_ticket_type_id, }; // Show loader diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index 87085a6d..b5f80c5e 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -3667,7 +3667,7 @@ function appendInput(data) { for (const id in contacts) { const contact = contacts[id]; html += ` - + `; } @@ -3839,13 +3839,21 @@ function constructURL_ForInsurerAndClientMailSend() { } else { var insurerContact = $('#insurerContact').val(); insurerContact = insurerContact.map(Number); + + let insurerIds = []; + $("#insurerContact option:selected").each(function () { + insurerIds.push($(this).data("value")); + }); + console.log(insurerIds); + formData.append('file_type', 'rfq'); formData.append('recipient_type', 'insurer'); formData.append('recipient_mail', JSON.stringify(insurerContact)); + formData.append('insurer_ids', JSON.stringify(insurerIds)); } - ajaxRequest(formData) - console.log('formData', formData) + ajaxRequest(formData); + console.log('formData', formData); } diff --git a/public/sample_excel/sample_multievent_file.xls b/public/sample_excel/sample_multievent_file.xls new file mode 100644 index 0000000000000000000000000000000000000000..6db7fcea56fa279d0ced5eda8013d1b199c5288d GIT binary patch literal 13824 zcmeI2du${}oyV)^{n%YU*8A#BmL`zhO|o`o{MfbOLj2mzKC&Cf-h=?*NZZr)w09n6 zX6&qWcR6P-{B=YGA`uCY04X5C8=Z87haidI9ufqEgiav-2+`>z?htYix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MKU6#}(t;LhHPD|cpv?TAe$NRp< zhyF?NPD|buU!O4Vw8lHF@lI>J(;Dxz#yhR?PHVi=lJ_(JsPgZ$7Eky#XX2lQ%7@dE z_kw3JGw&ed=39g*-tVolDSMYkvA6`&;()bvf@tu9U`0>B~ z=kiP6e756*m&E7AnJ2OlT<6XOcQ$HRiON_H>Y|9Z)(aTffqkr7z>f|b)XiXKGb%l| zu9rd7mC@2gy9V04Z3}%pX?zsE$T!^0wc{?#0{V2ZV{Ai@`WAHKTcxgBt36RO?zdh| zGaH)CBbHR4S@|_-)@o1Gj61(q)9eChEqTmpuSv63d!n!Ljpmg!qp#J$tLFQfy9M1g z`daIKQ9EY*SJTeMvz!OJ5SoeAS6rogd5aaPres^}3Gxt>&_@5f| zRrYWh=@4&_SMzF-i6w<`9 zT)6q$|5I2bXXP{D^4q{tUPaC3<*+wCU#MEOpS-^4br~1q7-2^0;9#W27WEl?74~!f UH@xv*kFTxr5C8uDe|!8t01-fq9RL6T literal 0 HcmV?d00001 diff --git a/public/sample_excel/sample_multievent_file.xlsx b/public/sample_excel/sample_multievent_file.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..552e48881c80db622387507bbe04ee2e30987427 GIT binary patch literal 7890 zcmaJ`1yodRx2C&0q&uX$q*IVi>4qVP?rw%|=|&o95Cla+x};+eL1HLTO75Wly83zV z|Ls|8);Tk0KQm{)&%5_N&sJA~M<9SfK|z7Br=T!``NPPd$36f~Q+I0skki}6-O<9u z#gW6u3Bd92Nu8#Y!yp$<&u2mlNb6x)geLoEJhaY=efWr;wx<9kJ3*(jn;KQSM<~U} zg>OGN*hZO;&AaWrW0L>Uqor;ojN&o0nD0m!aJXJzVx}`b`uH+;mblrNI>qY|OXG(v z9c3OOWYrw(y_vF8x2YFq0P8862BY+IG1F0@g^(}uS^x(`H!WgnugZ}7=}XmF(&zp_ zlBrV)^bvdFv?9>s<}gzq#(4JF(4Inb32UTntt1ajx1pp%Vy)%is}834;YEaCZM1La zVu#zlGaR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Z)=h`2?&eGA#7+I4gzW#B72?tosW5HAkm#&mgUA;ebDA~xi^ z*{5(iZgh$K5Ig#%XJS8~ktzDur~3z4+epU6*~8k|!&KYX)f#C05WZd=QI`QOob@Zh zltor$Tn!=S3=2l-s%$C?0YHm&DS*~amEzR*W z7Pe56Z#RN`dNZLOP3MoSvLz(n*tEt|5_hb9p?x9y&8Z-36lJ!HNEk>`A))NOjWKr# zDP!u=p)V}+Q)Y-=fOSx?;I`JFvmy%hF5-$4LbTn71b-V$#wj_~ zjX>@Tm7M)(%~^!U3=~=I3O-tAeEd2Dw8-^m2I0wX9pDpI(E5w7PM(o5?%)PSzeiby zYyz-DcVmh?$H)MSpO9vPUx~mRI;@&=cbqipVFk5{0tR#MKVq=jg!GAo6RUnM{kS8s zQ=0#VK_p4-y}W&VR&nU;*xmH`o<1Ee2@_UfTPv+*;hO2mB02I8z3!};69J6ApKNCv zwj^+au9h;=L&k=MBY^om?E7=P^)T%Fr~UWQ-`_ZY4m%!(VZV(T`pZz9KSyJKJO3$V zKM?1)SwO`#sPo^`k-q`{)Zrc!@89+Y@h8A<{rhj%KgFsCq3*ZIL7S}q{PBO2?fwS* zvp;*#xPF@vv||1f@VDaiH_D$?_Mw;iZJp2vK~ersXZJV4pY`aW8viz7qJPxpza9Tf zjt}MPw`manKgH{B_doN)Lk9hAchGSBZ|(a}KK Date: Sat, 30 Aug 2025 11:57:14 +0530 Subject: [PATCH 15/19] FIX_THZ Ticket Type --- app/Config/Routes.php | 1 + app/Controllers/ThzController.php | 220 +++++++++++++++++++++++------- app/Views/thz_list.php | 29 ++-- app/Views/thz_notes.php | 11 +- 4 files changed, 198 insertions(+), 63 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0e4c1f27..9eaf2c54 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -564,6 +564,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); $routes->get("ticketConversationList", "ThzController::ticketConversationList"); $routes->get("ticketHistoryList", "ThzController::ticketHistoryList"); + $routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType'); $routes->get("hrFileList", "EmployeeRestController::hrFileList"); $routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters"); diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index ad3633e2..645b3ea6 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -31,6 +31,7 @@ class ThzController extends BaseController protected $clientModel; protected $ticketMailTemplateModel; + protected $myLogger; public function __construct() { @@ -43,6 +44,7 @@ class ThzController extends BaseController $this->clientPolicyModel = new ClientPolicyModel(); $this->clientModel = new ClientModel(); $this->ticketMailTemplateModel = new TicketMailTemplateModel(); + $this->myLogger = \Config\Services::mylogger(); } public function index() @@ -51,7 +53,8 @@ class ThzController extends BaseController } public function ticketSave(){ - + try + { $data = $this->request->getPost(); if (!empty($data['thz_id'])) { @@ -99,11 +102,27 @@ class ThzController extends BaseController 'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again." , 'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!' ])->setStatusCode($result ? 200 : 400); + } catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } } public function ticketList() { + try{ $returnType = strtolower($this->request->getGet('return_type') ?? 'api'); @@ -117,7 +136,8 @@ class ThzController extends BaseController if ($returnType === 'api') { if (empty($tickets)) { - return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found'])->setStatusCode(404); + // return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found'])->setStatusCode(404); + throw new \RuntimeException('No tickets found', 400); } }else{ @@ -126,18 +146,37 @@ class ThzController extends BaseController $data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu // 2,3,4 remain person varannum. $data['client_list'] = $this->clientModel->getCreatedByUserName(); + $data['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll(); return $this->loadLayout('thz_list', $data); } + return $this->response->setJSON([ 'status' => 'success', 'data' => $tickets, ])->setStatusCode(200); + } + catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } } public function ticketConversationSave(){ + try { $data = $this->request->getPost(); $data['notes_type'] = $data['notes_type'] ?? 'External' ; @@ -145,7 +184,8 @@ class ThzController extends BaseController $result = $this->thzMasterNotesModel->insert($data); if(empty($result)){ - return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); + // return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); + throw new \RuntimeException('No tickets found', 404); } if($data['notes_type'] == "External"){ @@ -161,41 +201,72 @@ class ThzController extends BaseController 'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again." , 'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed Or No Need..!!' ])->setStatusCode($result ? 200 : 400); + } + catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } } - public function ticketAutoFetchDetails(){ + public function ticketAutoFetchDetails() + { + try { $data = $this->request->getPost(); - $client_id = $data['client_id']; - $mobile = $data['mobile']; + $client_id = $data['client_id'] ?? null; + $mobile = $data['mobile'] ?? null; - if($client_id && $mobile){ - - $details = $this->thzMasterModel->ticketAutoFetchDetails($client_id ,$mobile); - - if(empty($details)){ - return $this->response->setJSON((['status' => 'error', 'message' => 'No Data found']))->setStatusCode(400); - }else{ - - $policyIds = array_column($details, 'policy_id'); - $policyIds = array_filter($policyIds); - $clientPolicy = $this->clientPolicyModel->whereIn('id', $policyIds)->where('is_active', 1)->get()->getResultArray(); - $result['client_details'] = $details; - $result['policy_details'] = empty($clientPolicy) ? [] : $clientPolicy ; + if ($client_id && $mobile) { + $details = $this->thzMasterModel->ticketAutoFetchDetails($client_id, $mobile); + if (empty($details)) { + throw new \RuntimeException('No Data found', 400); } - }else{ - return $this->response->setJSON((['status' => 'error', 'message' => 'Client and Mobile Not found']))->setStatusCode(400); - } - - return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); - + $policyIds = array_filter(array_column($details, 'policy_id')); + $clientPolicy = !empty($policyIds) + ? $this->clientPolicyModel->whereIn('id', $policyIds)->where('is_active', 1)->get()->getResultArray() + : []; + + $result['client_details'] = $details; + $result['policy_details'] = $clientPolicy ?? []; + } else { + throw new \RuntimeException('Client and Mobile Not found', 400); + } + + return $this->response->setJSON(['status' => 'success', 'data' => $result])->setStatusCode(200); + + } + catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } } - public function ticketConversationList(){ - + public function ticketConversationList() + { $data = $this->request->getGet(); $returnType = strtolower($this->request->getGet('return_type') ?? 'api'); @@ -215,16 +286,32 @@ class ThzController extends BaseController $notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType ); $result['notes'] = !empty($notes) ? $notes : []; }else{ - return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400); + // return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400); + throw new \RuntimeException('No tickets found', 400); } }else{ - return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); + // return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); + throw new \RuntimeException('No tickets found', 404); } - - if ($returnType === 'api') { - return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); + try { + return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); + } catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } }else{ $assign_to = $result['master'][0]['assign_to']; @@ -247,24 +334,24 @@ class ThzController extends BaseController $result['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu // 2,3,4 remain person varannum. $result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : ''; + + $result['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll(); return $this->loadLayout('thz_notes', $result); - } - + + } } public function ticketType() { - $method = $this->request->getMethod(); // get, post - - if ($method === 'get') { - - $types = $this->thzTypeModel->where('is_active', 1)->findAll(); + $method = $this->request->getMethod(); // get, post + try{ + if ($method === 'get') { + $types = $this->thzTypeModel->select('id,name,is_active')->where('is_active', 1)->findAll(); if (empty($types)) { return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); } return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200); - } if ($method === 'post') { @@ -280,20 +367,37 @@ class ThzController extends BaseController $result = true; } - $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ; + $id = isset($insertID) && !empty($insertID) ? $insertID : ($updateID ?? null); - return $this->response->setJSON([ - 'status' => $id ? 'success' : 'error', - 'message' => $id ? "Ticket Type {$text}d successfully " : "Unable to {$text} ticket type. Please try again." , - 'id' => $id + return $this->response->setJSON([ + 'status' => $id ? 'success' : 'error', + 'message' => $id ? "Ticket Type {$text}d successfully" : "Unable to {$text} ticket type. Please try again.", + 'id' => $id ])->setStatusCode($id ? 200 : 400); - } - return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); + } + return $this->response->setJSON([ 'status' => 'error', 'message' => 'Invalid request method' ])->setStatusCode(405); + } + catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } } public function ticketHistoryList() { - + try + { $data = $this->request->getGet(); $thz_id = $data['thz_id']; // $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray(); @@ -306,11 +410,27 @@ class ThzController extends BaseController if (empty($details)) { - return $this->response->setJSON([ 'status' => 'error','message' => 'No History found'])->setStatusCode(404); + // return $this->response->setJSON([ 'status' => 'error','message' => 'No History found'])->setStatusCode(404); + throw new \RuntimeException('No History found', 404); } - return $this->response->setJSON(['status' => 'success','data' => $details])->setStatusCode(200); + return $this->response->setJSON(['status' => 'success','data' => $details])->setStatusCode(200); + } catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database / ' : 'application / ' . $code . ' / ' . $e->getLine() + ])->setStatusCode($code); + } } diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index b38798ac..1057ad26 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -7,8 +7,17 @@ width: 100%; } +/* .table thead th { + vertical-align: bottom; + border-bottom: 2px solid #fff; +} */ +/* Add shadow + spacing row "card" effect */ +tbody tr { + /* box-shadow: 0 2px 5px rgba(0,0,0,0.08); */ +} + /* Search input with icon */ .dataTables_filter { position: absolute; @@ -196,7 +205,7 @@ table thead th {
    - +
    @@ -341,17 +350,17 @@ table thead th { @@ -725,15 +734,14 @@ $(document).ready(function() { hideandshowpolicy(); var ticketsTable = $('#scroll-horizontal-datatable'); - $('#scroll-horizontal-datatable_filter').prepend(''); if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-7'p>>", buttons: [ { text: ' Create New Ticket ', @@ -775,7 +783,6 @@ $(document).ready(function() { }, paging: true, pageLength: 25, - ordering: false, }); } else { diff --git a/app/Views/thz_notes.php b/app/Views/thz_notes.php index 2a5720b7..03b2aa66 100644 --- a/app/Views/thz_notes.php +++ b/app/Views/thz_notes.php @@ -347,8 +347,15 @@ hr{ From 782dd2eb7078b90e20561b9648d1489cd9282046 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Sat, 30 Aug 2025 12:47:45 +0530 Subject: [PATCH 16/19] CHANGE_UI_FIX - VADIVEL J 2025-08-30 --- app/Controllers/LeadsController.php | 2 +- app/Views/layout/header.php | 24 ++-- app/Views/view_rfq.php | 140 ++++++++++++++-------- app/Views/view_rfq_non_eb.php | 18 +-- public/assets/js/pages/foo-tables.init.js | 2 +- 5 files changed, 111 insertions(+), 75 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index db3e331d..6590496c 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -4902,7 +4902,7 @@ class LeadsController extends BaseController // Start table with clean styling $html .= "

    {$category}

    "; - $html .= "
    Ticket ID
    "; + $html .= "
    "; // Table header with light background $html .= ""; diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 5783afbf..35ad766e 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -97,17 +97,7 @@