681 lines
38 KiB
PHP
681 lines
38 KiB
PHP
<div class="row">
|
|
<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>
|
|
</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">
|
|
|
|
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
|
|
<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">
|
|
|
|
<h5>Employee Details</h5>
|
|
<hr>
|
|
|
|
<!-- first_data_points -->
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="emp_code">Employee ID <i class="fa fa-search text-danger"
|
|
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span
|
|
class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
|
|
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
|
name="emp_code">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
|
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
|
|
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
|
|
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
|
name="emp_name">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="insured_name"> Insured Name <span class="text-danger"></span></label>
|
|
<input type=hidden id="insured_emp_id" name="insured_emp_id" value="<?= isset($ticket_data['insured_emp_id']) ? $ticket_data['insured_emp_id'] : '' ?>">
|
|
<input class="form-control" id="insured_name" name="insured_name" value="<?= isset($ticket_data['insured_name']) ? $ticket_data['insured_name'] : '' ?>">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="relationship"> Relationship <span class="text-danger"></span></label>
|
|
<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>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<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" >
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="tpa_id">TPA ID<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
|
|
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
|
name="tpa_no">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="emp_mobile">Employee Mobile No<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
|
|
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
|
|
name="emp_mobile">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
|
|
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
|
|
name="emp_mail">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="client_name">Corporate Name<span class="text-danger"></span></label>
|
|
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
|
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
|
|
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
|
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="tpa_id">TPA<span class="text-danger"></span></label>
|
|
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
|
|
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="acm_id">Account Manager<span class="text-danger"></span></label>
|
|
<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>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- end first_data_points -->
|
|
|
|
<h5>Claim Details</h5>
|
|
<hr>
|
|
|
|
<!-- second_data_points -->
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="claim_status">Status<span class="text-danger"></span></label>
|
|
<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>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="priority">Priority<span class="text-danger"></span></label>
|
|
<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>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="mode_of_intimation"> Mode of Intimation <span
|
|
class="text-danger"></span></label>
|
|
<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>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="claim_type"> Claim Type <span class="text-danger"></span></label>
|
|
<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>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="hospital_name">Hospital Name<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="hospital_name"
|
|
placeholder="Enter Hospital Name"
|
|
value="<?= isset($ticket_data['hospital_name']) ? $ticket_data['hospital_name'] : '' ?>"
|
|
name="hospital_name">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="doa">DOA<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="doa" placeholder="Enter DOA"
|
|
value="<?= isset($ticket_data['doa']) ? $ticket_data['doa'] : '' ?>"
|
|
name="doa">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="dod">DOD<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="dod" placeholder="Enter DOD"
|
|
value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="claim_amount">Claim Amount<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="claim_amount"
|
|
placeholder="Enter Claim Amount"
|
|
value="<?= isset($ticket_data['claim_amount']) ? $ticket_data['claim_amount'] : '' ?>"
|
|
name="claim_amount">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<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">
|
|
</div>
|
|
|
|
</div>
|
|
<!-- end second_data_points -->
|
|
|
|
<h5>Additional Details</h5>
|
|
<hr>
|
|
|
|
<!-- third_data_points -->
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-3 up_cnu" style="display: none;">
|
|
<label for="claim_number">Claim Number<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
|
|
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
|
|
name="claim_number">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 up_cnu" style="display: none;">
|
|
<label for="registration_date">Registration Date</label>
|
|
<input type="text" class="form-control datepicker" id="registration_date" placeholder="Select Registration Date"
|
|
value="<?= isset($ticket_data['registration_date']) ? $ticket_data['registration_date'] : '' ?>" name="registration_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 cda_ir" style="display: none;">
|
|
<label for="raised_date">Raised Date</label>
|
|
<input type="text" class="form-control datepicker" id="raised_date" placeholder="Select Raised Date"
|
|
value="<?= isset($ticket_data['raised_date']) ? $ticket_data['raised_date'] : '' ?>" name="raised_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 up_qdr" style="display: none;">
|
|
<label for="query_received_date">Query Received Date</label>
|
|
<input type="text" class="form-control datepicker" id="query_received_date" placeholder="Select Query Received Date"
|
|
value="<?= isset($ticket_data['query_received_date']) ? $ticket_data['query_received_date'] : '' ?>" name="query_received_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 rejected" style="display: none;">
|
|
<label for="denial_reason">Denial Reason</label>
|
|
<input type="text" class="form-control" id="denial_reason" placeholder="Enter Denial Reason"
|
|
value="<?= isset($ticket_data['denial_reason']) ? $ticket_data['denial_reason'] : '' ?>" name="denial_reason">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 rejected" style="display: none;">
|
|
<label for="denial_date">Denial Date</label>
|
|
<input type="text" class="form-control datepicker" id="denial_date" placeholder="Select Denial Date"
|
|
value="<?= isset($ticket_data['denial_date']) ? $ticket_data['denial_date'] : '' ?>" name="denial_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 approved" style="display: none;">
|
|
<label for="approved_amount">Approved Amount</label>
|
|
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
|
|
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 approved" style="display: none;">
|
|
<label for="approved_date">Approved Date</label>
|
|
<input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
|
|
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-6 approved" style="display: none;">
|
|
<label for="approved_letter">Approved Letter</label>
|
|
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
|
|
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 settled" style="display: none;">
|
|
<label for="utr_details">UTR Details</label>
|
|
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
|
value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 settled" style="display: none;">
|
|
<label for="settled_date">Settled Date</label>
|
|
<input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date"
|
|
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-6 settled" style="display: none;">
|
|
<label for="settle_letter">Settle Letter</label>
|
|
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
|
|
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 payment" style="display: none;">
|
|
<label for="pay_initiate_date">Payment Initiate Date</label>
|
|
<input type="text" class="form-control datepicker" id="pay_initiate_date" placeholder="Select Payment Initiate Date"
|
|
value="<?= isset($ticket_data['pay_initiate_date']) ? $ticket_data['pay_initiate_date'] : '' ?>" name="pay_initiate_date">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 canceled" style="display: none;">
|
|
<label for="cancel_remark">Cancel Remark</label>
|
|
<textarea class="form-control" id="cancel_remark" rows="1" placeholder="Enter Cancel Remark" name="cancel_remark"><?= isset($ticket_data['cancel_remark']) ? $ticket_data['cancel_remark'] : '' ?></textarea>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 returned" style="display: none;">
|
|
<label for="return_remark">Return Remark</label>
|
|
<textarea class="form-control" id="return_remark" rows="1" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea>
|
|
</div>
|
|
|
|
<div class="form-group col-md-6 returned" style="display: none;">
|
|
<label for="awb_no_courier_name">AWB No with Courier Name</label>
|
|
<input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier"
|
|
value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name">
|
|
</div>
|
|
|
|
<div class="form-group col-md-3 non_id" style="display: none;">
|
|
<label for="non_id_reason">Non ID Reason</label>
|
|
<select class="form-control" id="non_id_reason" name="non_id_reason">
|
|
<option value="">Select Reason</option>
|
|
<?php
|
|
if (isset($nonIDReason) && count($nonIDReason)) {
|
|
foreach ($nonIDReason as $key => $value) {
|
|
$selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : '';
|
|
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- end third_data_points -->
|
|
|
|
</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) { ?>
|
|
<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> -->
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// $(document).ready(function() {
|
|
// var calim_status = $('#claim_status_id').val();
|
|
// if (calim_status == 8){
|
|
// $('#btnApprove').show();
|
|
// }else{
|
|
// $('#btnApprove').hide();
|
|
|
|
// }
|
|
// });
|
|
</script>
|
|
|
|
<script>
|
|
let GlobelExtraFields = [];
|
|
|
|
$(document).ready(function() {
|
|
|
|
var doa = flatpickr("#doa", {
|
|
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
|
|
});
|
|
|
|
// 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');
|
|
|
|
// // 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) {
|
|
|
|
// 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';
|
|
}
|
|
|
|
// 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>');
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
$('#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}"`);
|
|
}
|
|
}
|
|
|
|
$('#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("");
|
|
|
|
}
|
|
})
|
|
</script>
|