diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 31c2ff0f..5d65c4a4 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1383,11 +1383,11 @@ class EmployeeServiceController extends AdminController { // dd($employee); $existing_endorsements = $this->empEndorsementModel->where('actions','d') - ->where('table_name','employees') + ->where('table_name','employee_polices') ->where('endorsement_id is null') ->where('emp_code',$employee['emp_code']) ->where('name',$employee['name']) - ->where('field_name','emp_status') + ->where('field_name','status') ->where('status !=','truncated') ->where('is_active', 1) ->findAll(); @@ -2087,12 +2087,14 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){ $relation = 'parent'; } else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){ $relation = 'child'; - }else if(strtolower(trim($value['relationship'])) === 'father in law' || strtolower(trim($value['relationship'])) === 'mother in law'){ + }else if((strtolower(trim($value['relationship'])) === 'father in law' || strtolower(trim($value['relationship'])) === 'mother in law') || (strtolower(trim($value['relationship'])) === 'father-in-law' || strtolower(trim($value['relationship'])) === 'mother-in-law')){ $relation = 'parent_in_law'; }else if(strtolower(trim($value['relationship'])) === 'spouse'){ $relation = 'spouse'; - }else{ + }else if(strtolower(trim($value['relationship'])) === 'self'){ $relation = 'self'; + }else { + $relation = ''; } $value['family_floater_key'] = $relation; diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 199c8d3b..6e6c6952 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -2378,7 +2378,9 @@ class LeadsController extends BaseController $installment_data = json_decode($params['installments'], true); if(!empty($installment_data)){ foreach ($installment_data as $key => $value) { - $value['payment_date'] = date('Y/m/d', strtotime($value['payment_date'])) ?? null; + $value['payment_date'] = !empty($value['payment_date']) && strtotime($value['payment_date']) + ? date('Y/m/d', strtotime($value['payment_date'])) + : null; if(isset($value['id']) && !empty($value['id'])){ $this->leadInstallmentPaymentDetails->where('id', $value['id'])->set($value)->update(); }else{ diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 7cbf5766..005bebc4 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -198,6 +198,12 @@ class TicketController extends BaseController }else if ($isFromDashboard == 2){ $data['ticket_data'] = $this->ticketSearch(4); + }else if ($isFromDashboard == 3){ + $data['ticket_data'] = $this->ticketSearch(2); + + }else if ($isFromDashboard == 4){ + $data['ticket_data'] = $this->ticketSearch(5); + } $data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll(); $data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll(); @@ -249,7 +255,7 @@ class TicketController extends BaseController ->groupBy('tm.id, tm.created_at, latest_history.created_at'); - //action 1 get last 100 rows, action 2 filter and get all rows related to that, action 3 gets according to dashboard, action 4 gets according to ACM + //action 1 get last 100 rows, action 2 filter and get all rows related to that, action 3 gets according to dashboard, action 4 gets according to ACM, action 5 tat if ($action == 1) { $query = $db->table('ticket_master tm') @@ -356,6 +362,10 @@ class TicketController extends BaseController $where = '1 = 0'; // No valid IDs, return empty result } + }else if ($action == 5) { + $search_data = $this->request->getPost(); + $where = "tm.created_at >= '" . $search_data['from_date'] . "' AND tm.created_at <= '" . $search_data['to_date'] . "'" ."and ticket_type_id = ".$search_data['ticket_type_id']; + } else { $search_data = $this->request->getPost(); // print_r($search_data); die() @@ -445,6 +455,17 @@ class TicketController extends BaseController ->orderBy('tm.id', 'DESC'); $data = $query->get()->getResultArray(); + // dd($db->getLastQuery()->getQuery()); + // dd($data); + if ($action == 5){ + + $tat = $this->request->getPost("tat_category"); + + $data = array_values(array_filter($data, function($dat) use ($tat) { + return $dat['tat'] == $tat; + })); + + } // print_rr($data); // log_message('error',' Claims Master Data '.json_encode($data));die(); // print_rr($data);die(); @@ -1068,6 +1089,10 @@ class TicketController extends BaseController $this->myLogger->logme('error', "Replacing placeholders in content"); if (!empty($ticket_data) && !empty($content)) { + // print_rr($ticket_data);die(); + if (!isset($ticket_data['id'])) { $ticket_data['id'] = $ticket_data['ticket_master_id'];} + if (!isset($ticket_data['ticket_master_id'])) {$ticket_data['ticket_master_id'] = $ticket_data['id'];} + foreach ($this->placeHolders as $key => $value) { if ($value == "emp_code") { @@ -1451,7 +1476,7 @@ class TicketController extends BaseController 'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED', 'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED', - 'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL' + 'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL','TPA_ID' ]; // Reorder data based on column order @@ -1465,6 +1490,7 @@ class TicketController extends BaseController $ordered_data[] = $temp; } $viewData['tpa_wise_data'] = $ordered_data; + // print_r($ordered_data);die(); // $html = view('claims_report_tpa_wise', $viewData); $html = view('claims_report_tpa_wise',$viewData); @@ -1472,6 +1498,9 @@ class TicketController extends BaseController } else if ($received_data['report_type'] == 'tat_band_wise') { $viewData['data'] = $this->ticketMasterModel->getTATReport($policy_type, $fromDate, $toDate); + $viewData['policyType'] = $policy_type; + $viewData['fromDate'] = $fromDate; + $viewData['toDate'] = $toDate; $html = view('tat_report_band_wise_list', $viewData); return $this->respond(['status' => true, 'html' => $html], 200); } @@ -1876,9 +1905,10 @@ class TicketController extends BaseController } } - private function isDate($value) { + private function isDate($value, $format = 'Y-m-d') { // Check if the value is a valid date string (basic validation) - return strtotime($value) !== false; + $date = \DateTime::createFromFormat($format, $value); + return $date && $date->format($format) === $value; } diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index d2e30828..67ffc9b1 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -2210,12 +2210,14 @@ if (!function_exists('generate_family_floater_key')) { $relation = 'parent'; } else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') { $relation = 'child'; - } else if (strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law') { + }else if((strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law') || (strtolower(trim($relationship)) === 'father-in-Law' || strtolower(trim($relationship)) === 'mother-in-Law')){ $relation = 'parent_in_law'; } else if (strtolower(trim($relationship)) === 'spouse') { $relation = 'spouse'; - } else { + } else if(strtolower(trim($relationship)) === 'self'){ $relation = 'self'; + }else{ + $relation = ''; } return $relation; diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 1404190e..62a5e101 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -335,159 +335,240 @@ class TicketMasterModel extends Model // return $data; // } + // public function getTATReport($ticket_type = null, $start_date = null, $end_date = null) + // { + // //set default last 3 months data date + // $fromDate = date('Y-m-d', strtotime('-90 days')); + // $toDate = date('Y-m-d 23:59:59'); + + // if (!empty($start_date) && !empty($end_date)) { + // $fromDate = change_date_format($start_date); + // $toDate = change_date_format($end_date); + // } + // $ticket_type_data_1 = ""; + // $ticket_type_data_2 = ""; + // if (!empty($ticket_type)) { + // $ticket_type_data_1 = "AND ticket_type = $ticket_type"; + // $ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type"; + // } + + // // Fetch claim statuses from the `ticket_claim_status` table + // $statusQuery = " SELECT + // id, claim_status, ticket_type + // FROM ticket_claim_status + // Where is_active = 1 + // $ticket_type_data_1 + // "; + // $statusResult = $this->db->query($statusQuery)->getResultArray(); + // // dd($statusResult); + + // // Initialize dynamic query parts + // $dynamicSelect = ''; + + // // Loop through each claim status and generate the COALESCE and CASE statements for the SELECT + // foreach ($statusResult as $status) { + + // $columnName = $status['claim_status']; // Default column name + + // if (empty($ticket_type)) { + // // Append the insurance type prefix based on `ticket_type` + // switch ($status['ticket_type']) { + // case 1: + // $columnName = "GMC - {$status['claim_status']}"; + // break; + // case 2: + // $columnName = "GPA - {$status['claim_status']}"; + // break; + // case 3: + // $columnName = "EDLI - {$status['claim_status']}"; + // break; + // case 4: + // $columnName = "GTLI - {$status['claim_status']}"; + // break; + // } + // } + + // $dynamicSelect .= " + // COALESCE( + // SUM( + // CASE + // WHEN subquery.status_id = {$status['id']} THEN 1 + // ELSE 0 + // END + // ), + // 0 + // ) AS `$columnName`, "; + // } + + // // Remove the trailing comma from the SELECT part + // $dynamicSelect = rtrim($dynamicSelect, ', '); + // // dd($dynamicSelect); + + + // // Construct the full SQL query + // $sql = " + // SELECT + // tc.TAT_Category, + // $dynamicSelect + // FROM + // ( + // SELECT 'Above 20 Days' AS TAT_Category + // UNION ALL + // SELECT '13-20 Days' + // UNION ALL + // SELECT '7-12 Days' + // UNION ALL + // SELECT '0-6 Days' + // ) AS tc + // LEFT JOIN ( + // SELECT + // tm.id AS ticket_id, + // latest_status.claim_status_id AS status_id, + // CASE + // WHEN DATEDIFF(CURDATE(), COALESCE(latest_status.change_date, tm.created_at)) BETWEEN 0 AND 6 THEN '0-6 Days' + // WHEN DATEDIFF(CURDATE(), COALESCE(latest_status.change_date, tm.created_at)) BETWEEN 7 AND 12 THEN '7-12 Days' + // WHEN DATEDIFF(CURDATE(), COALESCE(latest_status.change_date, tm.created_at)) BETWEEN 13 AND 20 THEN '13-20 Days' + // ELSE 'Above 20 Days' + // END AS TAT_Category + // FROM + // ticket_master tm + // LEFT JOIN ( + // SELECT + // th.ticket_id, + // th.new_value AS claim_status_id, + // MAX(th.created_at) AS change_date + // FROM + // ticket_history th + // WHERE + // th.field_name = 'claim_status_id' + // AND th.is_active = 1 + // GROUP BY + // th.ticket_id, th.new_value + // ) AS latest_status ON latest_status.ticket_id = tm.id + // WHERE tm.is_active = 1 + // AND tm.created_at >= '$fromDate' + // AND tm.created_at <= '$toDate' + // " . (!empty($ticket_type) ? " AND tm.ticket_type_id = $ticket_type" : "") . " + // GROUP BY tm.id, latest_status.claim_status_id, latest_status.change_date, tm.created_at + // ) AS subquery ON tc.TAT_Category = subquery.TAT_Category + // GROUP BY + // tc.TAT_Category + // ORDER BY + // FIELD( + // tc.TAT_Category, + // 'Above 20 Days', + // '13-20 Days', + // '7-12 Days', + // '0-6 Days' + // ); + // "; + + // // Execute the query and return the result + // $data = $this->db->query($sql)->getResultArray(); + // // dd($data); + // print_rr($data);die(); + // // print_rr($this->db->getLastQuery()->getQuery()); die; + + // return $data; + // } public function getTATReport($ticket_type = null, $start_date = null, $end_date = null) { - //set default last 3 months data date + // Set default date range (last 90 days) $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); - + if (!empty($start_date) && !empty($end_date)) { $fromDate = change_date_format($start_date); $toDate = change_date_format($end_date); } - $ticket_type_data_1 = ""; - $ticket_type_data_2 = ""; + + // Get all active claim statuses + $statusQuery = $this->db->table('ticket_claim_status') + ->select('id, claim_status') + ->where('is_active', 1) + ->orderBy('id', 'ASC'); + if (!empty($ticket_type)) { - $ticket_type_data_1 = "AND ticket_type = $ticket_type"; - $ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type"; + $statusQuery->where('ticket_type', $ticket_type); } - - // Fetch claim statuses from the `ticket_claim_status` table - $statusQuery = " SELECT - id, claim_status, ticket_type - FROM ticket_claim_status - Where is_active = 1 - $ticket_type_data_1 - "; - $statusResult = $this->db->query($statusQuery)->getResultArray(); - // dd($statusResult); - - // Initialize dynamic query parts - $dynamicSelect = ''; - - // Loop through each claim status and generate the COALESCE and CASE statements for the SELECT - foreach ($statusResult as $status) { - - $columnName = $status['claim_status']; // Default column name - - if (empty($ticket_type)) { - // Append the insurance type prefix based on `ticket_type` - switch ($status['ticket_type']) { - case 1: - $columnName = "GMC - {$status['claim_status']}"; - break; - case 2: - $columnName = "GPA - {$status['claim_status']}"; - break; - case 3: - $columnName = "EDLI - {$status['claim_status']}"; - break; - case 4: - $columnName = "GTLI - {$status['claim_status']}"; - break; + + $statusResult = $statusQuery->get()->getResultArray(); + + // Create a list of all TAT categories we want in the output + $tatCategories = [ + 'Above 20 Days', + '13-20 Days', + '7-12 Days', + '0-6 Days' + ]; + + // Initialize the result array with all TAT categories + $result = []; + foreach ($tatCategories as $category) { + $row = ['TAT_Category' => $category]; + foreach ($statusResult as $status) { + $row[$status['claim_status']] = 0; + } + $result[] = $row; + } + + // Get the base query for ticket counts by status and TAT category + $query = $this->db->table('ticket_master tm') + ->select([ + 'tcs.claim_status', + 'CASE + WHEN DATEDIFF(CURDATE(), COALESCE( + (SELECT MAX(th.created_at) + FROM ticket_history th + WHERE th.ticket_id = tm.id + AND th.field_name = "claim_status_id" + AND th.is_active = 1), + tm.created_at + )) BETWEEN 0 AND 6 THEN "0-6 Days" + WHEN DATEDIFF(CURDATE(), COALESCE( + (SELECT MAX(th.created_at) + FROM ticket_history th + WHERE th.ticket_id = tm.id + AND th.field_name = "claim_status_id" + AND th.is_active = 1), + tm.created_at + )) BETWEEN 7 AND 12 THEN "7-12 Days" + WHEN DATEDIFF(CURDATE(), COALESCE( + (SELECT MAX(th.created_at) + FROM ticket_history th + WHERE th.ticket_id = tm.id + AND th.field_name = "claim_status_id" + AND th.is_active = 1), + tm.created_at + )) BETWEEN 13 AND 20 THEN "13-20 Days" + ELSE "Above 20 Days"g + END AS tat_category', + 'COUNT(*) AS count' + ]) + ->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1') + ->where('tm.is_active', 1) + ->where('tm.created_at >=', $fromDate) + ->where('tm.created_at <=', $toDate) + ->groupBy('tcs.claim_status, tat_category') + ->orderBy('FIELD(tat_category, "Above 20 Days", "13-20 Days", "7-12 Days", "0-6 Days")'); + + if (!empty($ticket_type)) { + $query->where('tm.ticket_type_id', $ticket_type); + } + + $countResults = $query->get()->getResultArray(); + + // Populate the result array with actual counts + foreach ($countResults as $row) { + foreach ($result as &$categoryRow) { + if ($categoryRow['TAT_Category'] === $row['tat_category']) { + $categoryRow[$row['claim_status']] = (int)$row['count']; + break; } } - - $dynamicSelect .= " - COALESCE( - SUM( - CASE - WHEN subquery.status_id = {$status['id']} THEN 1 - ELSE 0 - END - ), - 0 - ) AS `$columnName`, "; } - - // Remove the trailing comma from the SELECT part - $dynamicSelect = rtrim($dynamicSelect, ', '); - // dd($dynamicSelect); - - - // Construct the full SQL query - $sql = " - SELECT - tc.TAT_Category, - $dynamicSelect - FROM - ( - SELECT 'Above 20 Days' AS TAT_Category - UNION ALL - SELECT '13-20 Days' - UNION ALL - SELECT '7-12 Days' - UNION ALL - SELECT '0-6 Days' - ) AS tc - LEFT JOIN ( - - SELECT - th.ticket_id, - tcs.claim_status, - tcs.id AS status_id, - CASE - WHEN DATEDIFF( - th.created_at, - COALESCE( - (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id), - tm.created_at - ) - ) BETWEEN 0 AND 6 THEN '0-6 Days' - WHEN DATEDIFF( - th.created_at, - COALESCE( - (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id), - tm.created_at - ) - ) BETWEEN 7 AND 12 THEN '7-12 Days' - WHEN DATEDIFF( - th.created_at, - COALESCE( - (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id), - tm.created_at - ) - ) BETWEEN 13 AND 20 THEN '13-20 Days' - ELSE 'Above 20 Days' - END AS TAT_Category - - FROM - ticket_master tm - JOIN ticket_history th ON tm.id = th.ticket_id - JOIN ticket_claim_status tcs ON th.field_name = 'claim_status_id' AND th.new_value = tcs.id - $ticket_type_data_2 - AND tm.created_at >= '$fromDate' - AND tm.created_at <= '$toDate' - AND tm.is_active = 1 - AND th.is_active = 1 - AND tcs.is_active = 1 - - ) AS subquery ON tc.TAT_Category = subquery.TAT_Category - GROUP BY - tc.TAT_Category - ORDER BY - FIELD( - tc.TAT_Category, - 'Above 20 Days', - '13-20 Days', - '7-12 Days', - '0-6 Days' - ); - "; - - // Execute the query and return the result - $data = $this->db->query($sql)->getResultArray(); - // print_rr($this->db->getLastQuery(), $data); die; - - // $tableData = []; - // if (!empty($data)) { - // // Extract table headers from the first row keys - // $headers = array_keys($data[0]); - // $tableData['headers'] = $headers; - // $tableData['body'] = $data; - // } - - return $data; + + return $result; } public function tpaWiseReport($policy_type = null, $start_date = null, $end_date = null) @@ -544,6 +625,7 @@ class TicketMasterModel extends Model // Construct the final SQL query $sql = " SELECT + tpa.id as TPA_ID, tpa.name AS TPA_NAME, $dynamicSelect, ($dynamicTotal) AS TOTAL, diff --git a/app/Views/claims_report_tpa_wise.php b/app/Views/claims_report_tpa_wise.php index 0a3fc65a..d473d717 100644 --- a/app/Views/claims_report_tpa_wise.php +++ b/app/Views/claims_report_tpa_wise.php @@ -37,16 +37,18 @@ - - + + + - - + + + @@ -62,7 +64,7 @@ } foreach ($column_order as $col_name) { - if ($col_name !== 'TPA_NAME') { + if ($col_name !== 'TPA_NAME' && $col_name != "TPA_ID") { echo "{$totals[$col_name]}"; } } @@ -98,4 +100,35 @@ console.error("Table not found."); } }); - + + function redirectTPAToClaimList(tpa_id){ + + // alert(tpa_id); + data = { + 'tpa_id' : tpa_id, + 'is_dashboard':3 + } + + redirectWithPost("", data); + + } + + function redirectWithPost(url, data = {}) { + const form = document.createElement('form'); + form.method = 'POST'; + form.action = url; + + for (const key in data) { + if (data.hasOwnProperty(key)) { + const input = document.createElement('input'); + input.type = 'hidden'; + input.name = key; + input.value = data[key]; + form.appendChild(input); + } + } + + document.body.appendChild(form); + form.submit(); + } + \ No newline at end of file diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php index 363baef6..8c9734ce 100644 --- a/app/Views/leads_form_handler.php +++ b/app/Views/leads_form_handler.php @@ -465,9 +465,19 @@ if (isset($selected_lead_type)) { + \ No newline at end of file diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index 86deabef..e42d2e2b 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -550,7 +550,7 @@
- +

@@ -5865,27 +5865,92 @@ function appendMultiFileData(data) { }) $("#is_installment_switch").change(function (){ - var switch_status = ($(this).is(":checked")? "on" : "off"); - console.log("Switch status",switch_status); - if (switch_status == "on"){ - $("#no_of_installment").show(); - $("#payment_date").hide(); - $("#utr_no").hide(); - $("#no_of_installment").closest('.form-group').show(); - $("#payment_date").closest('.form-group').hide(); - $("#utr_no").closest('.form-group').hide(); - addInstallmentHTML() - }else{ - $("#no_of_installment").hide(); - $("#payment_date").show(); - $("#utr_no").show(); - $("#no_of_installment").closest('.form-group').hide(); - $("#payment_date").closest('.form-group').show(); - $("#utr_no").closest('.form-group').show(); - $('#installment_form_row').empty(); - } + + var switch_status = ($(this).is(":checked")? "on" : "off"); + console.log("Switch status",switch_status); + if (switch_status == "on"){ + $("#no_of_installment").show(); + $("#payment_date").hide(); + $("#utr_no").hide(); + $("#no_of_installment").closest('.form-group').show(); + $("#payment_date").closest('.form-group').hide(); + $("#utr_no").closest('.form-group').hide(); + let $installmentContainer = $('#installment_form_row'); + let row_count = $installmentContainer.find('.form-row').length; + + if (row_count == 0 ) { addInstallmentHTML()} + // addInstallmentHTML() + }else{ + console.log("inside else") + + let $installmentContainer = $('#installment_form_row'); + let row_count = $installmentContainer.find('.form-row').length; + let remove_count = $("#no_of_installment").val(); + console.log("row count",row_count); + if (row_count > 0 ) { + let ids = $installmentContainer.find('.form-row').slice(-remove_count).find('input[name="installment_primary_key[]"]').map(function() { + return $(this).val(); + }).get(); + Swal.fire({ + title: "Do you want to remove all the entries?", + icon: "warning", + showCancelButton: true, + confirmButtonColor: "#3085d6", + cancelButtonColor: "#d33", + confirmButtonText: "Yes, Proceed!" + }).then((result) => { + if (result.isConfirmed) { + let url = ''; + let requestData = { id: ids }; + + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + + sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) { + console.log('Data fetched successfully:', response); + + if (response.status === true) { + toastr.success(response.message, 'SUCCESS'); + $("#no_of_installment").hide(); + $("#payment_date").show(); + $("#utr_no").show(); + $("#no_of_installment").closest('.form-group').hide(); + $("#payment_date").closest('.form-group').show(); + $("#utr_no").closest('.form-group').show(); + $('#installment_form_row').empty(); + $('#no_of_installment').val(""); + } else { + toastr.error(response.message, 'WARNING'); + } + + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + + }, function(xhr, status, error) { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + console.error('Error fetching data:', error); + console.error(xhr.responseText); + toastr.error('An error occurred while removing the installment.', 'ERROR'); + }); + }else{ + // alert("Inside else"); + $('#no_of_installment').val(row_count); + // $("#is_installment_switch").bootstrapToggle('on'); + // $('#is_installment_switch').val('1').change(); + // $('#is_installment_switch').bootstrapToggle('on'); + // $('#is_installment_switch').prop('checked', true).trigger('change'); + $('#is_installment_switch').trigger('click'); // in some cases, this forces the CSS to update + + + } + }); + } + + } }) + $(document).on("input", "#cd_amount, #premium_amount", function() { // alert("Function called"); @@ -6028,8 +6093,8 @@ function appendMultiFileData(data) { console.log("Form row count:", row_count); if (row_count === 1) { - $installmentContainer.empty(); - for (let index = 0; index < no_of_installments; index++) { + // $installmentContainer.empty(); + for (let index = 0; index < no_of_installments - 1; index++) { addInstallmentHTML(); } } else if (no_of_installments === row_count) { @@ -6047,7 +6112,7 @@ function appendMultiFileData(data) { console.log('ids', ids); - if (ids != null) { + if (Object.keys(ids).length > 0) { Swal.fire({ title: "Do you want to remove the last " + (remove_count ?? "") + " entries?", icon: "warning", @@ -6106,6 +6171,7 @@ function appendMultiFileData(data) { } }); + $(document).ready(function(){ setTimeout(function(){ $('.payment_date').flatpickr({ diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index 8fe7d058..183a1bb1 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -255,6 +255,12 @@ cursor: pointer; user-select: none; } + + .toggle.btn { + height: 38px !important; + line-height: 33px !important; + } + @@ -424,31 +430,66 @@
-
- - "> -
+
">
+
+ + > +
+
">
-
- - "> -
+ + +
+ + "> +
+ +
+ + "> +
+ +
- - "> + + >
+
+ + +
+ + + +
+ + "> +
+ +
+ + "> +
+ + + +
+
+
+

@@ -517,6 +558,22 @@ + + + + - \ No newline at end of file