CHANAGE_CLAIMS_MODULE_SRI
This commit is contained in:
parent
3bdf3f6bb5
commit
bfe5c2be2d
@ -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'],
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -2,18 +2,18 @@
|
||||
<div class="col-12">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<?php if(!isset($ticket_data)){ ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<h4 class="mb-0">Claim GMC</h4>
|
||||
<?php if (!isset($ticket_data)) { ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<h4 class="mb-0">Claim GMC</h4>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
|
||||
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
|
||||
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
|
||||
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
|
||||
<input type="hidden" id="head_rejection_reason" name="head_rejection_reason">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
@ -30,12 +31,12 @@
|
||||
<select class="form-control" id="claim_status_id" name="claim_status_id">
|
||||
<!-- <option value="0">Select status</option> -->
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -45,12 +46,12 @@
|
||||
<select class="form-control" id="priority" name="priority">
|
||||
<!-- <option value="0">Select Priority</option> -->
|
||||
<?php
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -60,12 +61,12 @@
|
||||
<select class="form-control" id="acm_id" name="acm_id">
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
|
||||
}
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -74,7 +75,7 @@
|
||||
<label for="policy_no">Policy No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="policy_no"
|
||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||
name="policy_no" placeholder="Policy Number" >
|
||||
name="policy_no" placeholder="Policy Number">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -130,12 +131,12 @@
|
||||
<select class="form-control" id="relationship" name="relationship">
|
||||
<option value="0">Select Relationship</option>
|
||||
<?php
|
||||
if (isset($relationshipType) && count($relationshipType)) {
|
||||
foreach ($relationshipType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['relationship'] == $key) ? 'selected' : '';
|
||||
echo "<option value='$key' $selected>$value</option>";
|
||||
}
|
||||
if (isset($relationshipType) && count($relationshipType)) {
|
||||
foreach ($relationshipType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['relationship'] == $key) ? 'selected' : '';
|
||||
echo "<option value='$key' $selected>$value</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -160,12 +161,12 @@
|
||||
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation">
|
||||
<!-- <option value="0">Select Mode</option> -->
|
||||
<?php
|
||||
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
|
||||
foreach ($modeOFIntimate as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['mode_of_intimation'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
|
||||
foreach ($modeOFIntimate as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['mode_of_intimation'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -175,12 +176,12 @@
|
||||
<select class="form-control" id="claim_type" name="claim_type">
|
||||
<!-- <option value="0">Select claim Type</option> -->
|
||||
<?php
|
||||
if (isset($claim_type) && count($claim_type)) {
|
||||
foreach ($claim_type as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($claim_type) && count($claim_type)) {
|
||||
foreach ($claim_type as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -215,7 +216,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="pod_no">POD No<span class="text-danger"></span></label>
|
||||
<label id="pod_no_label_1" for="pod_no">POD No<span id="pod_no_label_1_span" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO"
|
||||
value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>"
|
||||
name="pod_no">
|
||||
@ -320,12 +321,12 @@
|
||||
<label for="non_id_reason">Non ID Reason</label>
|
||||
<textarea class="form-control" id="non_id_reason" placeholder="Enter Cancel Remark" name="non_id_reason"><?= isset($ticket_data['non_id_reason']) ? $ticket_data['non_id_reason'] : '' ?></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit" >Submit</button>
|
||||
<?php if(get_role_id() == 5 && isset($ticket_data) && $ticket_data['claim_status_id'] == 8) { ?>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||
<?php if (get_role_id() == 5 && isset($ticket_data) && $ticket_data['claim_status_id'] == 8) { ?>
|
||||
<a class="btn btn-secondary waves-effect waves-light mr-1" onclick="showConfirmationModal(event)">Approve Claim Rejection</a>
|
||||
<?php } ?>
|
||||
<!-- <button type="button" class="btn btn-primary waves-effect waves-light mr-1" id="btnApprove" >Approve</button> -->
|
||||
@ -347,206 +348,299 @@
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
let GlobelExtraFields = [];
|
||||
$(document).ready(function() {
|
||||
|
||||
$(document).ready(function() {
|
||||
var doa = flatpickr("#doa", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var doa = flatpickr("#doa", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
var dod = flatpickr("#dod", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var dod = flatpickr("#dod", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#raised_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#registration_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#query_received_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#denial_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#approved_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#settled_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#pay_initiate_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
flatpickr("#raised_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#registration_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#query_received_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#denial_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#pay_initiate_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
// updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
|
||||
GlobelExtraFields = extraFields;
|
||||
console.log("extraFields", extraFields);
|
||||
claimStatusFieldChanges(extraFields);
|
||||
|
||||
// updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
|
||||
GlobelExtraFields = extraFields;
|
||||
console.log("extraFields", extraFields);
|
||||
claimStatusFieldChanges(extraFields);
|
||||
})
|
||||
|
||||
})
|
||||
// function updateClaimStatusDisplay(value) {
|
||||
// // Hide all sections first
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').hide();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').hide().find('input, textarea').removeAttr('required');
|
||||
|
||||
// function updateClaimStatusDisplay(value) {
|
||||
// // Hide all sections first
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').hide();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').hide().find('input, textarea').removeAttr('required');
|
||||
// // Show relevant section based on value
|
||||
// if (value == 3 || value == 4) { // CDA & INFORMATION REQUIRED
|
||||
// $('.cda_ir').show();
|
||||
// $('.settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
|
||||
// $('.up_cnu').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
// $('.up_qdr').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 8) { // REJECTED
|
||||
// $('.rejected').show();
|
||||
// $('.cda_ir, .settled, .approved, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 9) { // APPROVED
|
||||
// $('.approved').show();
|
||||
// $('.cda_ir, .settled, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 11) { // SETTLED
|
||||
// $('.settled').show();
|
||||
// $('.cda_ir, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// }else if (value == 13) { // CANCELLED
|
||||
// $('.canceled').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .returned').find('input, textarea').removeAttr('required');
|
||||
// }else if (value == 14) { // RETURNED
|
||||
// $('.returned').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled').find('input, textarea').removeAttr('required');
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Show relevant section based on value
|
||||
// if (value == 3 || value == 4) { // CDA & INFORMATION REQUIRED
|
||||
// $('.cda_ir').show();
|
||||
// $('.settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
|
||||
// $('.up_cnu').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
// $('.up_qdr').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 8) { // REJECTED
|
||||
// $('.rejected').show();
|
||||
// $('.cda_ir, .settled, .approved, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 9) { // APPROVED
|
||||
// $('.approved').show();
|
||||
// $('.cda_ir, .settled, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 11) { // SETTLED
|
||||
// $('.settled').show();
|
||||
// $('.cda_ir, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// }else if (value == 13) { // CANCELLED
|
||||
// $('.canceled').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .returned').find('input, textarea').removeAttr('required');
|
||||
// }else if (value == 14) { // RETURNED
|
||||
// $('.returned').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled').find('input, textarea').removeAttr('required');
|
||||
// }
|
||||
// }
|
||||
function updateClaimStatusDisplay(value) {
|
||||
|
||||
function updateClaimStatusDisplay(value) {
|
||||
// Hide all sections and remove required attribute from their inputs and textareas
|
||||
let sections = $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned, .payment, .non_id');
|
||||
sections.hide().find('input, textarea').removeAttr('required');
|
||||
|
||||
// Hide all sections and remove required attribute from their inputs and textareas
|
||||
let sections = $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned, .payment, .non_id');
|
||||
sections.hide().find('input, textarea').removeAttr('required');
|
||||
// Determine which section to show
|
||||
let showClass = '';
|
||||
if (value == 3 || value == 4) { // CDA & INFORMATION REQUIRED
|
||||
showClass = '.cda_ir';
|
||||
} else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
|
||||
showClass = '.up_cnu';
|
||||
} else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
showClass = '.up_qdr';
|
||||
} else if (value == 8) { // REJECTED
|
||||
showClass = '.rejected';
|
||||
} else if (value == 9) { // APPROVED
|
||||
showClass = '.approved';
|
||||
} else if (value == 11) { // SETTLED
|
||||
showClass = '.settled';
|
||||
} else if (value == 13) { // CANCELLED
|
||||
showClass = '.canceled';
|
||||
} else if (value == 14) { // RETURNED
|
||||
showClass = '.returned';
|
||||
} else if (value == 1) { // NON ID
|
||||
showClass = '.non_id';
|
||||
} else if (value == 10) { // PAYMENT INITIATED
|
||||
showClass = '.payment';
|
||||
}
|
||||
|
||||
// Determine which section to show
|
||||
let showClass = '';
|
||||
if (value == 3 || value == 4) { // CDA & INFORMATION REQUIRED
|
||||
showClass = '.cda_ir';
|
||||
} else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
|
||||
showClass = '.up_cnu';
|
||||
} else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
showClass = '.up_qdr';
|
||||
} else if (value == 8) { // REJECTED
|
||||
showClass = '.rejected';
|
||||
} else if (value == 9) { // APPROVED
|
||||
showClass = '.approved';
|
||||
} else if (value == 11) { // SETTLED
|
||||
showClass = '.settled';
|
||||
} else if (value == 13) { // CANCELLED
|
||||
showClass = '.canceled';
|
||||
} else if (value == 14) { // RETURNED
|
||||
showClass = '.returned';
|
||||
} else if (value == 1) { // NON ID
|
||||
showClass = '.non_id';
|
||||
} else if (value == 10) { // PAYMENT INITIATED
|
||||
showClass = '.payment';
|
||||
// Show the relevant section and enable required attributes
|
||||
if (showClass) {
|
||||
// $(showClass).show().find('input, textarea').attr('required', true);
|
||||
$(showClass).show().find('input, textarea').attr('required', true).each(function() {
|
||||
var $label = $("label[for='" + $(this).attr('id') + "']");
|
||||
if ($label.length && !$label.find('.text-danger').length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Show the relevant section and enable required attributes
|
||||
if (showClass) {
|
||||
// $(showClass).show().find('input, textarea').attr('required', true);
|
||||
$(showClass).show().find('input, textarea').attr('required', true).each(function() {
|
||||
var $label = $("label[for='" + $(this).attr('id') + "']");
|
||||
$('#claim_status_id').on('change', function() {
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
// claimStatusFieldChanges()
|
||||
});
|
||||
|
||||
function claimStatusFieldChanges(fields) {
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
// $field.prop('required', true);
|
||||
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.show();
|
||||
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||
|
||||
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||
console.log('fields', fields);
|
||||
console.log('remove_or_add', remove_or_add);
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', remove_or_add);
|
||||
var $parentDiv = $field.closest("div");
|
||||
console.log('parentDiv', $parentDiv);
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
// if(remove_or_add == false){
|
||||
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||
// // console.log('one', remove_or_add);
|
||||
// }else{
|
||||
// if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.' + thirdClass).find('input, textarea').attr('required', true);
|
||||
|
||||
}
|
||||
|
||||
$(document).on("input", function(event) {
|
||||
|
||||
let fields = GlobelExtraFields;
|
||||
console.log('fields', fields);
|
||||
let targetId = event.target.id;
|
||||
console.log('targetId', targetId);
|
||||
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||
|
||||
if (fields.includes(targetId)) {
|
||||
|
||||
let $field = $("#" + targetId);
|
||||
console.log('$field id', $field);
|
||||
let $parentDiv = $field.closest("div");
|
||||
console.log('$parentDiv', $parentDiv);
|
||||
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
addRequiredFieldSymbolByClass(thirdClass);
|
||||
// addRequiredFieldSymbol(targetId);
|
||||
if (thirdClass) {
|
||||
// console.log("fields",fields);
|
||||
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||
$(thirdClass).each(function() {
|
||||
let $label = $(this).find("label");
|
||||
$label.each(function() {
|
||||
if (!$(this).find(".text-danger").length) {
|
||||
$(this).append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
claimStatusFieldRemoveREquired($field, false, '');
|
||||
console.log("In Else Condition");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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(' <span class="text-danger">*</span>');
|
||||
}
|
||||
});
|
||||
|
||||
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(' <span class="text-danger">*</span>');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
}
|
||||
|
||||
$('#claim_status_id').on('change', function() {
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
// claimStatusFieldChanges()
|
||||
});
|
||||
$('#mode_of_intimation').change(function(){
|
||||
console.log("function called");
|
||||
var mode_of_intimation = $('#mode_of_intimation').val();
|
||||
console.log('mode of ',mode_of_intimation);
|
||||
|
||||
if (mode_of_intimation == 2){
|
||||
$('#pod_no').attr('required', 'required');
|
||||
$('#pod_no_label_1_span').text("*");
|
||||
}else{
|
||||
$('#pod_no').removeAttr('required', false);
|
||||
$('#pod_no_label_1_span').text("");
|
||||
|
||||
function claimStatusFieldChanges(fields) {
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
// $field.prop('required', true);
|
||||
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.show();
|
||||
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||
|
||||
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||
console.log('fields', fields);
|
||||
console.log('remove_or_add', remove_or_add);
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', remove_or_add);
|
||||
var $parentDiv = $field.closest("div");
|
||||
console.log('parentDiv', $parentDiv);
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
// if(remove_or_add == false){
|
||||
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||
// // console.log('one', remove_or_add);
|
||||
// }else{
|
||||
// if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.'+thirdClass).find('input, textarea').attr('required', true);
|
||||
|
||||
}
|
||||
|
||||
$(document).on("input", function (event) {
|
||||
|
||||
let fields = GlobelExtraFields;
|
||||
console.log('fields', fields);
|
||||
let targetId = event.target.id;
|
||||
console.log('targetId', targetId);
|
||||
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||
|
||||
if (fields.includes(targetId)) {
|
||||
|
||||
let $field = $("#" + targetId);
|
||||
console.log('$field id', $field);
|
||||
let $parentDiv = $field.closest("div");
|
||||
console.log('$parentDiv', $parentDiv);
|
||||
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
|
||||
if (thirdClass) {
|
||||
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||
$(thirdClass).each(function() {
|
||||
let $label = $(this).find("label");
|
||||
$label.each(function() {
|
||||
if (!$(this).find(".text-danger").length) {
|
||||
$(this).append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
claimStatusFieldRemoveREquired($field, false, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
@ -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(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// });
|
||||
|
||||
// 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(' <span class="text-danger">*</span>');
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user