1274 lines
63 KiB
PHP
1274 lines
63 KiB
PHP
<style>
|
|
.readonly-color {
|
|
background-color: #e0e0e0;
|
|
/* Darker background */
|
|
color: #666;
|
|
/* Darker text color */
|
|
}
|
|
|
|
.readonly-select {
|
|
pointer-events: none;
|
|
background-color: #f0f0f0;
|
|
color: #666;
|
|
}
|
|
|
|
.info-icon {
|
|
color: #007bff;
|
|
font-size: 15px;
|
|
transition: 0.3s ease;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.info-icon:hover {
|
|
color: #0056b3;
|
|
font-size: 24px;
|
|
}
|
|
</style>
|
|
<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="mdi mdi-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 <span class="text-danger">*</span> <i class="mdi mdi-magnify 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" required>
|
|
</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" required>
|
|
</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'] : '' ?>" required>
|
|
</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" required>
|
|
<option value="">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_no">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" required>
|
|
</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" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="emp_personal_mail">Employee Personal Mail ID</label>
|
|
<input type="text" class="form-control" id="emp_personal_mail" placeholder="Enter EMP Personal Mail"
|
|
value="<?= isset($ticket_data['emp_personal_mail']) ? $ticket_data['emp_personal_mail'] : '' ?>"
|
|
name="emp_personal_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 required>
|
|
</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 required>
|
|
</div>
|
|
<input type="hidden" id="empIDHidden" onchange="getClientPolicy()">
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<label>Policy <span class="text-danger">*</span></label>
|
|
<select id="emp_client_policy" name="client_policy_id"
|
|
class="form-control custom-select" required onchange="setMinDateDOA(this.value); setInsurerAndTPAData(this)">
|
|
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
|
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
|
<?php } else { ?>
|
|
<option value="">Policy</option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="tpa_name">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" required>
|
|
<!-- <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 -->
|
|
|
|
<br><br>
|
|
|
|
<div style="display: flex; align-items: center; gap: 10px;">
|
|
<h5 style="margin: 0;">
|
|
Claim Details
|
|
<i id="infoIcon" class="mdi mdi-information-outline info-icon" title="Click for more details" style="margin-left: 5px;"></i>
|
|
<?= isset($ticket_data['claim_number']) && !empty($ticket_data['claim_number']) ? '( Claim No : ' . $ticket_data['claim_number'] . ' )' : '' ?>
|
|
</h5>
|
|
</div>
|
|
|
|
<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" required>
|
|
<!-- <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" required>
|
|
<!-- <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 Submission <span
|
|
class="text-danger">*</span></label>
|
|
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation" required>
|
|
<!-- <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" required>
|
|
<!-- <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" required>
|
|
</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" required>
|
|
</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" required>
|
|
</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" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label id="pod_no_label_1" for="pod_no">POD No with Courier Name <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 -->
|
|
|
|
<br><br>
|
|
<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-6 approved" style="display: none;">
|
|
<label for="approved_description">Approved Description</label>
|
|
<input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description"
|
|
value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description">
|
|
</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">Return 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 <span id="non_id_reason_lable_id" class="text-danger"></span></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>
|
|
|
|
<!-- Info Modal -->
|
|
<div class="modal fade" id="moreInfoModal" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-xl" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title" id="fullWidthModalLabel">More Information</h4>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div id="dynamicDivFillInfo"></div>
|
|
</div>
|
|
</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 = [];
|
|
var doa;
|
|
|
|
$(document).ready(function() {
|
|
$("#emp_client_policy").select2();
|
|
|
|
var policy_id = $("#emp_client_policy").val();
|
|
if (policy_id != null && policy_id != "") {
|
|
$("#emp_client_policy").addClass('readonly-select').select2('destroy');
|
|
}
|
|
// getClientPolicy();
|
|
var doa = flatpickr("#doa", {
|
|
dateFormat: "d/m/Y",
|
|
allowInput: false,
|
|
maxDate: "today",
|
|
onChange: function(selectedDates) {
|
|
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
|
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
|
}
|
|
});
|
|
|
|
var dod = flatpickr("#dod", {
|
|
dateFormat: "d/m/Y",
|
|
allowInput: false,
|
|
maxDate: "today"
|
|
});
|
|
|
|
flatpickr("#raised_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
flatpickr("#registration_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
flatpickr("#query_received_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
flatpickr("#denial_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
flatpickr("#approved_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
flatpickr("#settled_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
flatpickr("#pay_initiate_date", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
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>');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
$field = $('#approved_description')
|
|
$field.prop('required', false);
|
|
var $parentDiv = $field.closest("div");
|
|
$parentDiv.find("label[for='approved_description'] .text-danger").remove();
|
|
}
|
|
|
|
$('#claim_status_id').on('change', function() {
|
|
updateClaimStatusDisplay($(this).val());
|
|
// claimStatusFieldChanges()
|
|
const selectedVal = $(this).val();
|
|
const elementId = $(this).attr('id');
|
|
|
|
console.log('Selected Value:', selectedVal);
|
|
console.log('Element ID:', elementId);
|
|
|
|
if(selectedVal == 2 || selectedVal == 14){
|
|
$field = $('#non_id_reason')
|
|
$field.prop('required', false);
|
|
}else if(selectedVal == 1){
|
|
|
|
if($('#tpa_no').val() != ""){
|
|
$field = $('#non_id_reason')
|
|
$field.prop('required', false);
|
|
var $parentDiv = $field.closest("div");
|
|
$parentDiv.find("label[for='non_id_reason'] .text-danger").remove();
|
|
}else{
|
|
$field = $('#non_id_reason')
|
|
$field.prop('required', true);
|
|
}
|
|
}
|
|
|
|
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
|
try {
|
|
extrafieldsArray = JSON.parse(extrafieldsArray);
|
|
|
|
// Keep only the entry for the current claim_status_id
|
|
extrafieldsArray = {
|
|
[selectedVal]: extrafieldsArray[selectedVal]
|
|
};
|
|
|
|
console.log('Filtered extrafieldsArray:', extrafieldsArray);
|
|
|
|
extrafieldsArray = JSON.stringify(extrafieldsArray);
|
|
console.log('Filtered extrafieldsArray string:', extrafieldsArray);
|
|
|
|
$('#extra_fields_array_for_validate').val(extrafieldsArray);
|
|
|
|
|
|
} catch (error) {
|
|
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
|
return;
|
|
}
|
|
|
|
});
|
|
|
|
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);
|
|
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
|
try {
|
|
extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
|
|
} catch (error) {
|
|
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
|
return;
|
|
}
|
|
|
|
var selectedClaimStatus = $('#claim_status_id').val();
|
|
var $thirdClass = $(`.${thirdClass}`);
|
|
var hasValue = $thirdClass.find('input, textarea, select').filter(function() {
|
|
return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
|
}).length > 0;
|
|
|
|
$thirdClass.each(function() {
|
|
var id = $(this).find('[id]').first().attr('id');
|
|
var $label = $(this).find('label');
|
|
var $thisDiv = $(this);
|
|
var $inputs = $thisDiv.find('input, textarea, select');
|
|
|
|
|
|
// ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
|
|
var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
|
|
|
|
// ✅ Condition 2: If any field in the class has a value, make all required
|
|
if (shouldAddRequired || hasValue) {
|
|
if ($label.length && !$label.find('.text-danger').length) {
|
|
$label.append(' <span class="text-danger">*</span>');
|
|
}
|
|
console.log("input from if ", $inputs);
|
|
// $inputs.attr('required', true);
|
|
$('.' + thirdClass).find('input, textarea,select').attr('required', true);
|
|
} else {
|
|
$label.find('.text-danger').remove();
|
|
console.log("input ", $inputs);
|
|
// $inputs.prop('required', false);
|
|
$('.' + thirdClass).find('input, textarea,select').attr('required', false);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
$(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");
|
|
}
|
|
}
|
|
}
|
|
|
|
$field = $('#approved_description')
|
|
$field.prop('required', false);
|
|
var $parentDiv = $field.closest("div");
|
|
$parentDiv.find("label[for='approved_description'] .text-danger").remove();
|
|
|
|
});
|
|
|
|
// 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) {
|
|
var $divsWithClass = $(`.${className}`);
|
|
|
|
if ($divsWithClass.length) {
|
|
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
|
try {
|
|
extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
|
|
} catch (error) {
|
|
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
|
return;
|
|
}
|
|
|
|
var selectedClaimStatus = $('#claim_status_id').val();
|
|
console.log("Selected claim status ID:", selectedClaimStatus);
|
|
console.log("Extra Field Array:", extrafieldsArray[selectedClaimStatus]);
|
|
|
|
// ✅ Check if at least one field inside the class has a value
|
|
// var hasValue = $divsWithClass.find('input, textarea, select').filter(function () {
|
|
// return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
|
// }).length > 0;
|
|
|
|
// $divsWithClass.each(function () {
|
|
// var id = $(this).find('[id]').first().attr('id');
|
|
// var $label = $(this).find('label');
|
|
// var $thisDiv = $(this);
|
|
// var $inputs = $thisDiv.find('input, textarea, select');
|
|
|
|
|
|
// // ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
|
|
// var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
|
|
|
|
// // ✅ Condition 2: If any field in the class has a value, make all required
|
|
// if (shouldAddRequired || hasValue) {
|
|
// if ($label.length && !$label.find('.text-danger').length) {
|
|
// $label.append(' <span class="text-danger">*</span>');
|
|
// }
|
|
// console.log("input from if ",$inputs);
|
|
// $inputs.attr('required', true);
|
|
// } else {
|
|
// $label.find('.text-danger').remove();
|
|
// console.log("input ",$inputs);
|
|
// $inputs.prop('required', false);
|
|
// }
|
|
// });
|
|
|
|
console.log(`Processed ${$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("");
|
|
|
|
}
|
|
});
|
|
|
|
$("#empIDHidden").change(function() {
|
|
console.log("change is detected in hidden branch id");
|
|
getClientPolicy();
|
|
})
|
|
|
|
function getClientPolicy() {
|
|
console.log("get policy function called");
|
|
hiddenData = $("#empIDHidden").val();
|
|
hiddenData = JSON.parse(hiddenData);
|
|
console.log('employee id ', hiddenData['emp_id']);
|
|
data = {
|
|
emp_id: hiddenData['emp_id']
|
|
}
|
|
$.ajax({
|
|
url: '<?= base_url("/ticket/getPoliciesbyEmpID") ?>',
|
|
type: "POST",
|
|
data: data,
|
|
dataType: 'json',
|
|
success: function(res) {
|
|
|
|
console.log('getClientAndBranchAndPolicy', res);
|
|
if (res.status == true) {
|
|
console.log("data is received2");
|
|
policyList = res.policy_data;
|
|
// appendClients(res.client_data);
|
|
// appendClientsFoerMobileSearch(res.client_data);
|
|
appendPolicyDropdown(policyList);
|
|
console.log("after function");
|
|
} else {
|
|
console.log('No data found');
|
|
}
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
}
|
|
});
|
|
}
|
|
|
|
//append the clients policy data to the modal
|
|
// function appendPolicyDropdown(data) {
|
|
// console.log("second function is called : ", data);
|
|
// let ticket_type = $('#ticket_type_id').val();
|
|
// hiddenData = $("#empIDHidden").val();
|
|
// hiddenData = JSON.parse(hiddenData);
|
|
// let branch_id = hiddenData['branch_id'];
|
|
// let policy_id = hiddenData['policy_id'];
|
|
// let searchType = hiddenData['searchType'];
|
|
// data = data[branch_id];
|
|
// console.log("branch filtered data ", data);
|
|
// $('#emp_client_policy').empty();
|
|
|
|
// $('#emp_client_policy').append($('<option>', {
|
|
// value: '',
|
|
// text: 'Select Client Policy'
|
|
// }));
|
|
|
|
// $.each(data, function(index, item) {
|
|
// // console.log('inside the loop for this time count : ',item);
|
|
// console.log("debugging policy type id : ", item.id);
|
|
// if (ticket_type == 1) {
|
|
// console.log("inside if condition 1");
|
|
|
|
// if (item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 || item
|
|
// .policy_type_id == 5) {
|
|
// console.log("inside if condition 2");
|
|
|
|
// if (policy_id == item.id) {
|
|
// console.log("inside if condition 3");
|
|
|
|
// var option = $('<option>', {
|
|
// value: item.id,
|
|
// text: item.policy_type + '-' + item.policy_no,
|
|
// });
|
|
|
|
// $('#emp_client_policy').append(option).select2();
|
|
// if (searchType != null && searchType != "") {
|
|
// $('#emp_client_policy').val(item.id).addClass('readonly-select').select2('destroy');
|
|
// }
|
|
// }
|
|
// }
|
|
// } else if (ticket_type == 2) {
|
|
|
|
// if (item.policy_type_id == 1) {
|
|
// var option = $('<option>', {
|
|
// value: item.id,
|
|
// text: item.policy_type + '-' + item.policy_no,
|
|
// });
|
|
|
|
// $('#emp_client_policy').append(option).select2();
|
|
// }
|
|
|
|
// } else if (ticket_type == 3) {
|
|
|
|
// if (item.policy_type_id == 6) {
|
|
// var option = $('<option>', {
|
|
// value: item.id,
|
|
// text: item.policy_type + '-' + item.policy_no,
|
|
// });
|
|
|
|
// $('#emp_client_policy').append(option).select2();
|
|
// }
|
|
|
|
// } else if (ticket_type == 4) {
|
|
|
|
// if (item.policy_type == 7) {
|
|
// var option = $('<option>', {
|
|
// value: item.id,
|
|
// text: item.policy_type + '-' + item.policy_no,
|
|
// });
|
|
|
|
// $('#emp_client_policy').append(option).select2();
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
// console.log("loop is completed");
|
|
// setMinDateDOA(policy_id);
|
|
// }
|
|
|
|
function appendPolicyDropdown(data) {
|
|
hiddenData = $("#empIDHidden").val();
|
|
hiddenData = JSON.parse(hiddenData);
|
|
|
|
console.log("second function is called : ", data);
|
|
let ticket_type = $('#ticket_type_id').val();
|
|
$('#emp_client_policy').empty();
|
|
$('#emp_client_policy').append($('<option>', {
|
|
value: '',
|
|
text: 'Select Client Policy'
|
|
}));
|
|
console.log("got data from backend ", data);
|
|
let policyCount = 1;
|
|
var policyAppendCount = 0;
|
|
$.each(data, function(index, item) {
|
|
// console.log(item);
|
|
|
|
if (ticket_type == 1 && item.policy_type_id != 1) {
|
|
$('#emp_client_policy').append($('<option>', {
|
|
value: item.client_policy_value,
|
|
text: item.client_policy_name,
|
|
'data-insurerid' : item.insurer_id ?? "",
|
|
'data-tpaid' : item.tpa_id ?? "",
|
|
'data-insurername' : item.insurer_name ?? "",
|
|
'data-tpaname' : item.tpa_name ?? "",
|
|
}));
|
|
$("#policy_no").val("");
|
|
if (policyCount == 1) {
|
|
console.log("policy count from if", item.policy_no);
|
|
$("#policy_no").val(item.policy_no);
|
|
} else {
|
|
console.log("policy count from greter if ", "");
|
|
$("#policy_no").val("");
|
|
}
|
|
policyCount++;
|
|
policyAppendCount++;
|
|
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
|
// $('#emp_client_policy').select2();
|
|
$("#emp_client_policy").select2();
|
|
$('#emp_client_policy').val(hiddenData['policy_id']).addClass('readonly-select').select2('destroy').trigger("change");
|
|
} else {
|
|
// $('#emp_client_policy').append($('<option>', {
|
|
// value: item.client_policy_value,
|
|
// text: item.client_policy_name
|
|
// }));
|
|
}
|
|
}
|
|
|
|
})
|
|
console.log('policy append count ', policyAppendCount);
|
|
if (policyAppendCount == 0) {
|
|
toastr.warning("No Policies found for the Employee", "Warning");
|
|
}
|
|
}
|
|
// $('#emp_client_policy').select2();
|
|
$("#emp_client_policy").on('change', function() {
|
|
var policy_name = $("#emp_client_policy option:selected").text();
|
|
var policy_no = policy_name.split("-")[1];
|
|
$("#policy_no").val(policy_no);
|
|
console.log("change function called ");
|
|
policy_id = $("#emp_client_policy").val();
|
|
setMinDateDOA(policy_id);
|
|
})
|
|
|
|
function setMinDateDOA(policy_id) {
|
|
var policy_name = $("#emp_client_policy option:selected").text();
|
|
var policy_no = policy_name.split("-")[1];
|
|
$("#policy_no").val(policy_no);
|
|
console.log("Function set min date called ");
|
|
console.log("Existing DOA instance: ", doa);
|
|
console.log('sent data ', policy_id);
|
|
$.ajax({
|
|
url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
|
method: "POST",
|
|
data: {
|
|
policy_id: policy_id
|
|
},
|
|
|
|
success: function(response) {
|
|
console.log("mindate response ", response);
|
|
|
|
if (response.status) {
|
|
let minDate = new Date(response.minDate);
|
|
// If doa is not initialized, create the instance
|
|
if (!doa) {
|
|
console.log("doa not found, initializing");
|
|
doa = flatpickr("#doa", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false,
|
|
onChange: function(selectedDates) {
|
|
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
|
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
|
},
|
|
minDate: minDate
|
|
});
|
|
var dod = flatpickr("#dod", {
|
|
dateFormat: "d/m/Y",
|
|
maxDate: "today",
|
|
allowInput: false
|
|
});
|
|
} else {
|
|
// If already initialized, just set the minDate
|
|
doa.set("minDate", minDate);
|
|
}
|
|
} else {
|
|
console.error(response.message);
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
}
|
|
});
|
|
}
|
|
|
|
function setInsurerAndTPAData(input) {
|
|
let selectedOption = $(input).find('option:selected');
|
|
|
|
let insurer_id = selectedOption.data('insurerid');
|
|
let insurer_name = selectedOption.data('insurername');
|
|
let tap_name = selectedOption.data('tpaname');
|
|
let tap_id = selectedOption.data('tpaid');
|
|
|
|
console.log('Insurer ID:', insurer_id);
|
|
console.log('Insurer Name:', insurer_name);
|
|
console.log('TPA Name:', tap_name);
|
|
console.log('TPA ID:', tap_id);
|
|
|
|
$('#insurer_id').val(insurer_id);
|
|
$('#insurer_name').val(insurer_name);
|
|
$('#tpa_id').val(tap_id);
|
|
$('#tpa_name').val(tap_name);
|
|
}
|
|
|
|
</script>
|
|
<script>
|
|
$("#infoIcon").click(function() {
|
|
var ticket_id = $('#ticket_master_id').val();
|
|
getDataForInfo(ticket_id, function(data) {
|
|
console.log("claims history data response : ", data);
|
|
if (data && Object.keys(data).length) {
|
|
// openModal();
|
|
var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal'));
|
|
myModal.show();
|
|
|
|
appendHtmlToModal(data);
|
|
} else {
|
|
// toastr.warning("Data not Found");
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
function getDataForInfo(ticketId, callback) {
|
|
$.ajax({
|
|
url: "<?= base_url('ticket/getMoreInfo') ?>",
|
|
type: "POST",
|
|
data: {
|
|
ticket_id: ticketId
|
|
},
|
|
success: function(response) {
|
|
if (response.status) {
|
|
console.log("Info Response: ", response);
|
|
callback(response.data); // pass data to the callback
|
|
} else {
|
|
toastr.warning("No Data Found");
|
|
callback(null);
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
callback(null);
|
|
}
|
|
});
|
|
}
|
|
|
|
function appendHtmlToModal(data) {
|
|
var container = document.getElementById('dynamicDivFillInfo');
|
|
|
|
// Clear any previous content inside the container
|
|
container.innerHTML = '';
|
|
|
|
// Iterate over each status in the data
|
|
for (let status in data) {
|
|
|
|
let length = Object.keys(data[status]).length;
|
|
console.log('length', length);
|
|
|
|
if (data.hasOwnProperty(status) && length > 0) {
|
|
// Create the status subheading
|
|
var statusHeading = document.createElement('h5');
|
|
statusHeading.textContent = status;
|
|
container.appendChild(statusHeading);
|
|
|
|
// Create a row container to group the fields in a row
|
|
var rowContainer = document.createElement('div');
|
|
rowContainer.classList.add('row'); // Add Bootstrap row class to group fields
|
|
|
|
// Iterate over each field within the current status
|
|
for (let field in data[status]) {
|
|
if (data[status].hasOwnProperty(field)) {
|
|
// Create a container for each field with col-md-4 class
|
|
var fieldContainer = document.createElement('div');
|
|
fieldContainer.classList.add('form-group', 'col-md-4'); // Apply col-md-4 to each field
|
|
|
|
// Create a label for the field
|
|
var fieldLabel = document.createElement('label');
|
|
// fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize
|
|
fieldLabel.textContent = field.display_name; // Convert underscores to spaces and capitalize
|
|
fieldContainer.appendChild(fieldLabel);
|
|
|
|
// Create either an input field or a textarea based on the field name
|
|
var fieldInput;
|
|
if (field === 'approved_letter' || field == "settle_letter") {
|
|
// Create a textarea for 'approved_letter'
|
|
fieldInput = document.createElement('textarea');
|
|
fieldInput.classList.add('form-control');
|
|
fieldInput.textContent = data[status][field].display_value; // Set the value to the field content
|
|
} else {
|
|
// Create an input field for other fields
|
|
fieldInput = document.createElement('input');
|
|
fieldInput.type = 'text';
|
|
fieldInput.classList.add('form-control');
|
|
fieldInput.value = data[status][field].display_value;
|
|
}
|
|
|
|
fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly
|
|
|
|
// Append the input (or textarea) to the container
|
|
fieldContainer.appendChild(fieldInput);
|
|
|
|
// Append the field container to the row container
|
|
rowContainer.appendChild(fieldContainer);
|
|
}
|
|
}
|
|
|
|
// Append the row container to the main container
|
|
container.appendChild(rowContainer);
|
|
}
|
|
}
|
|
}
|
|
</script>
|