From bfe5c2be2d4f283d71ee818c568121d134d17889 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 26 Feb 2025 08:53:54 +0530 Subject: [PATCH] CHANAGE_CLAIMS_MODULE_SRI --- app/Controllers/TicketController.php | 3 +- app/Views/ticket_edit_onbording.php | 41 +- app/Views/ticket_form_gmc.php | 538 ++++++++++++++++----------- app/Views/ticket_form_gpa.php | 59 ++- 4 files changed, 413 insertions(+), 228 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index ed6a72e4..36007889 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -114,8 +114,7 @@ class TicketController extends BaseController '((AUTO_QUERY_CONTENT))' => 'auto_query_content', ]; $this->extraFields = [ - 1 => ['non_id_reason'], - 10 => ['pay_initiate_date'], + 3 => ['raised_date'], 4 => ['raised_date'], 5 => ['claim_number', 'registration_date'], diff --git a/app/Views/ticket_edit_onbording.php b/app/Views/ticket_edit_onbording.php index 835a252f..14e4a66f 100644 --- a/app/Views/ticket_edit_onbording.php +++ b/app/Views/ticket_edit_onbording.php @@ -235,9 +235,44 @@ function showConfirmationModal(event) { console.log($('#ticket_form_data')[0]) submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector } else if (result.isDenied) { - $('#is_head_approved').val(2); - console.log($('#ticket_form_data')[0]) - submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector + // Show second Swal for rejection reason + Swal.fire({ + title: "Rejection Reason", + text: "Please provide a reason for rejection", + input: "textarea", + inputPlaceholder: "Enter your reason here...", + icon: "info", + showCancelButton: true, + confirmButtonColor: "#3085d6", + cancelButtonColor: "#6c757d", + confirmButtonText: "Submit", + cancelButtonText: "Back" + }).then((reasonResult) => { + if (reasonResult.isConfirmed) { + // Check if reason is not empty + if (reasonResult.value && reasonResult.value.trim() !== "") { + $('#is_head_approved').val(2); + $('#rejection_reason').val(reasonResult.value.trim()); + console.log($('#ticket_form_data')[0]); + $('#head_rejection_reason').val(reasonResult.value.trim()); + submitClaimForm(event, $('#ticket_form_data')[0]); + } else { + // Alert if reason is empty + Swal.fire({ + title: "Error", + text: "Rejection reason cannot be empty", + icon: "error", + confirmButtonColor: "#3085d6" + }).then(() => { + // Go back to the rejection reason dialog + showConfirmationModal(event); + }); + } + } else { + // If canceled, go back to first Swal + showConfirmationModal(event); + } + }); } else { $('#is_head_approved').val(0); return false; diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index 23c8151c..e314f678 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -2,18 +2,18 @@
" style="margin-right: 23px;">
- - -
-
-

Claim GMC

+ + +
+
+

Claim GMC

+
+
+ + + +
-
- - - -
-
@@ -21,6 +21,7 @@ +
@@ -30,12 +31,12 @@
@@ -45,12 +46,12 @@
@@ -60,12 +61,12 @@
@@ -74,7 +75,7 @@ + name="policy_no" placeholder="Policy Number">
@@ -130,12 +131,12 @@
@@ -160,12 +161,12 @@
@@ -175,12 +176,12 @@
@@ -215,7 +216,7 @@
- + @@ -320,12 +321,12 @@
- +
- - + + Approve Claim Rejection @@ -347,206 +348,299 @@ // } // }); - - \ No newline at end of file diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php index 42b916cb..9a546bd4 100644 --- a/app/Views/ticket_form_gpa.php +++ b/app/Views/ticket_form_gpa.php @@ -399,9 +399,10 @@ console.log('fields', fields); console.log('$field id', $field); let $parentDiv = $field.closest("div"); console.log('$parentDiv', $parentDiv); - + // addRequiredFieldSymbol(targetId); if ($parentDiv.length) { let thirdClass = $parentDiv.attr("class").split(" ")[2] || ""; + addRequiredFieldSymbolByClass(thirdClass); console.log('thirdClass', thirdClass); if (thirdClass) { @@ -416,5 +417,61 @@ console.log('fields', fields); } } }); +// function addRequiredFieldSymbol(field_name) { +// // Find the field with the given name +// var $field = $(`[name="${field_name}"]`); + +// if ($field.length) { +// // Find the parent div of this field +// var $parentDiv = $field.closest('div'); + +// if ($parentDiv.length) { +// // Get the classes as an array +// var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : []; + +// if (classes.length > 0) { +// // Get the last class in the array +// var lastClass = classes[classes.length - 1]; + +// // Find all divs with this last class +// var $allDivsWithClass = $(`.${lastClass}`); + +// // Add asterisk to all labels within these divs +// $allDivsWithClass.each(function() { +// var $label = $(this).find('label'); +// if ($label.length && !$label.find('.text-danger').length) { +// $label.append(' *'); +// } +// }); + +// console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`); +// } else { +// console.warn(`Parent div for field "${field_name}" has no classes`); +// } +// } else { +// console.warn(`No parent div found for field name="${field_name}"`); +// } +// } else { +// console.warn(`No field found with name="${field_name}"`); +// } +// } +function addRequiredFieldSymbolByClass(className) { + // Find all divs with the specified class + var $divsWithClass = $(`.${className}`); + + if ($divsWithClass.length) { + // Add asterisk to all labels within these divs + $divsWithClass.each(function() { + var $label = $(this).find('label'); + if ($label.length && !$label.find('.text-danger').length) { + $label.append(' *'); + } + }); + + console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`); + } else { + console.warn(`No divs found with class="${className}"`); + } +} \ No newline at end of file