From 33d0476728d5ed73e5877247bc65c5a89049f205 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 26 Mar 2025 17:49:12 +0530 Subject: [PATCH] FEAT_RFQ_NONEB_COMPLETE --- app/Controllers/LeadsController.php | 51 +- app/Views/policyRegisterModel.php | 4 + app/Views/view_rfq_non_eb.php | 1720 +++++++++++++++++++-------- 3 files changed, 1232 insertions(+), 543 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index b361c5b3..2c01c428 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -628,12 +628,11 @@ class LeadsController extends BaseController public function createRFQ() { - - // print_r($this->request->getPost('json')); die(); - $data = $this->request->getPost(); $lead_id = $data['lead_id']; $data['type'] = 1; + + // Deactivate previous RFQs $this->RFQModel ->where('lead_id', $lead_id) ->where('type', 1) @@ -641,43 +640,34 @@ class LeadsController extends BaseController ->set('is_active', 0) ->update(); - $registrationJson = $data['registration_json'] ?? null; // Use null coalescing operator for safety + $registrationJson = $data['registration_json'] ?? null; - if ($registrationJson) { - // If registration_json is provided, insert the data directly - $result = $this->RFQModel->insert($data); - } else { - // If registration_json is not provided, fetch the latest registration_json from the database - $this->RFQModel->select('registration_json') + if (!$registrationJson) { + // Fetch latest registration_json from database + $registrationJson = $this->RFQModel->select('registration_json') ->where("lead_id", $lead_id) - ->order_by('id', 'DESC') // Assuming 'id' is an auto-increment field - ->limit(1); - - $query = $this->RFQModel->get(); - $latestRegistrationJson = $query->row()->registration_json ?? null; - - if ($latestRegistrationJson) { - // If a valid registration_json is found, update the data and insert - $data['registration_json'] = $latestRegistrationJson; - $result = $this->RFQModel->insert($data); - } else { - // If no registration_json is found, insert the data as-is - $result = $this->RFQModel->insert($data); - } + ->orderBy('id', 'DESC') + ->limit(1) + ->get() + ->getRow('registration_json'); } - if ($result) { + if ($registrationJson) { + $data['registration_json'] = $registrationJson; + } - $message = "RFQ submitted successfully"; - if ($data['submit_type'] == 'QCR') { - $message = "QCR submitted successfully"; - } + // Insert new RFQ + $result = $this->RFQModel->insert($data); + + if ($result) { + $message = ($data['submit_type'] == 'QCR') ? "QCR submitted successfully" : "RFQ submitted successfully"; return $this->respond(['status' => true, 'id' => $result, 'message' => $message, 'data' => $data], 200); } - return $this->respond(['status' => false, 'id' => $result, 'message' => "Failed to create RFQ", 'data' => $data], 200); + return $this->respond(['status' => false, 'message' => "Failed to create RFQ", 'data' => $data], 200); } + public function createQCR() { @@ -3132,5 +3122,4 @@ class LeadsController extends BaseController // kint::dump($data); return $data; } - } diff --git a/app/Views/policyRegisterModel.php b/app/Views/policyRegisterModel.php index 680b2b12..12f86dce 100644 --- a/app/Views/policyRegisterModel.php +++ b/app/Views/policyRegisterModel.php @@ -1128,7 +1128,11 @@ prependTable(policySummary[key],key); }); } + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); toastr.success("Policy Information Collected ","SUCCESS"); + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); console.log("Updated policy data in localStorage:", existingData); } diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index 402b597e..65a4d695 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -10,35 +10,58 @@ color: #fff; margin-right: 10px; } + .readonly-select { + pointer-events: none; + background-color: #f0f0f0; + color: #666; + } table { /* border-collapse: collapse; */ margin-bottom: 20px; /* max-width: 800px; */ /* table-layout: fixed; */ - width: 1200px; - /* Set a fixed width */ + width: 1400px; + min-width: 1200px; table-layout: fixed; - /* Ensures equal column widths */ border-collapse: collapse; - /* Optional: Makes borders cleaner */ word-wrap: break-word; } - th:nth-child(1), - td:nth-child(1) { + /* Apply styles to the first column, accounting for rowspan */ + table th:nth-child(1), + table td:nth-child(1) { width: 110px; - /* Adjust first column width */ + background-color: #bfe0e2; + } + + + + /* Ensure rowspan cells in the first column inherit the same styles */ + table td[rowspan]:nth-child(1) { + width: 110px; + /* background-color: #bfe0e2; */ + } + + .table th[contenteditable], + .table td[contenteditable] { + border: 1px solid #007bff; + outline: none; } th:nth-child(2), td:nth-child(2) { width: 720px; + background-color: #bfe0e2; /* Adjust first column width */ } + .bold { + font-weight: bold; + color: red; + } th:nth-last-child(1), td:nth-last-child(1) { @@ -53,7 +76,7 @@ } th { - background-color: #f2f2f2 !important; + /* background-color: #f2f2f2 !important; */ position: relative !important; } @@ -68,6 +91,12 @@ box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2); z-index: 1; } + /* Selects the last cell in each row */ + table tr td:last-child, + table tr th:last-child { + background-color: white !important; + } + .dropdown-content button { display: block; @@ -98,11 +127,13 @@ cursor: pointer; min-width: 80px; user-select: none; + background-color: #ff9999; } /* Hover effect for options */ .dropdown-option:hover { - background-color: #f0f0f0; + background-color: #333; + color : white; } /* Optional: Add transition for smoother hover effect */ @@ -115,11 +146,6 @@ cursor: pointer; } - [contenteditable="true"] { - pointer-events: auto; - /* Ensure clicking works */ - } - /* Optional: Style for selected state */ .selected-option { background-color: #f8f9fa; @@ -160,6 +186,56 @@ color: white !important; margin-right: 5px; } + + .table-collapsible-bar { + background-color: #f1f1f1; + padding: 10px; + cursor: pointer; + border: 1px solid #ddd; + border-radius: 4px 4px 0 0; + font-weight: bold; + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 0; + } + + .table-collapsible-bar .collapse-icon { + transition: transform 0.3s ease; + } + + .table-collapsible-bar.collapsed .collapse-icon { + transform: rotate(-90deg); + } + + .table-content { + overflow-x: auto; + width: 100%; + } + + /* Ensure these styles are present */ + .table-content { + transition: all 0.3s ease; + /* overflow: hidden; */ + } + + .table-content.collapse:not(.show) { + display: none; + } + + .table-content.collapse.show { + display: block; + } + + .collapse-icon { + transition: transform 0.3s ease; + } + + .table-collapsible-bar { + cursor: pointer; + user-select: none; + } + @@ -387,6 +463,7 @@