210 lines
13 KiB
PHP
210 lines
13 KiB
PHP
<hr>
|
|
|
|
<div class="form-row" >
|
|
|
|
<div class="form-group col-md-4">
|
|
<label for="incept_emp_count" class="emp_title">
|
|
<span class="emp_title_text"> No of Employees at Inception </span>
|
|
<span class="text-danger">*</span>
|
|
</label>
|
|
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]" placeholder="Enter Lives" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<label for="total_lives_at_incept" class="total_title">
|
|
<span class="total_title_text"> Total Lives at Inception </span> <span class="text-danger"></span></label>
|
|
<input value="<?= isset($lead_edit_data['total_lives_at_incept']) ? $lead_edit_data['total_lives_at_incept'] : '' ?>" type="text" class="form-control" id="total_lives_at_incept" name="total_lives_at_incept[]" placeholder="Enter Lives">
|
|
</div>
|
|
|
|
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
|
<label for="total_si_at_incept"> Total Sum Insured at Inception <span class="text-danger">*</span></label>
|
|
<input value="<?= isset($lead_edit_data['total_si_at_incept']) ? $lead_edit_data['total_si_at_incept'] : '' ?>" type="text" class="form-control" id="total_si_at_incept" name="total_si_at_incept[]" placeholder="Enter Sum Insured" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
|
<label for="premium_at_incept"> Premium at inception <span class="text-danger">*</span></label>
|
|
<input value="<?= isset($lead_edit_data['premium_at_incept']) ? $lead_edit_data['premium_at_incept'] : '' ?>" type="text" class="form-control" id="premium_at_incept" name="premium_at_incept[]" placeholder="Enter Premium" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
|
<label for="renewal_emp_count"> No of Employees at Renewal <span class="text-danger">*</span></label>
|
|
<input value="<?= isset($lead_edit_data['renewal_emp_count']) ? $lead_edit_data['renewal_emp_count'] : '' ?>" type="text" class="form-control" id="renewal_emp_count" name="renewal_emp_count[]" placeholder="Enter Lives" >
|
|
</div>
|
|
|
|
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
|
<label for="total_si_at_renewal"> Total Sum Insured at Renewal <span class="text-danger">*</span></label>
|
|
<input value="<?= isset($lead_edit_data['total_si_at_renewal']) ? $lead_edit_data['total_si_at_renewal'] : '' ?>" type="text" class="form-control" id="total_si_at_renewal" name="total_si_at_renewal[]" placeholder="Enter Sum Insured" >
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<?php if(isset($lead_edit_data)) { ?>
|
|
<?php
|
|
if (! isset($lastFiveYears) || ! is_array($lastFiveYears)) {
|
|
$year = (int) date('Y');
|
|
$month = (int) date('m');
|
|
$currentFYStart = ($month >= 4) ? $year : $year - 1;
|
|
$lastFiveYears = [];
|
|
|
|
for ($i = 0; $i < 6; $i++) {
|
|
$startYear = $currentFYStart - $i;
|
|
$lastFiveYears[] = "{$startYear}-" . ($startYear + 1);
|
|
}
|
|
}
|
|
|
|
if (! isset($causeOfDeath) || ! is_array($causeOfDeath)) {
|
|
$causeOfDeath = [];
|
|
}
|
|
|
|
$savedClaims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [];
|
|
$isClaimHistoryChecked = (isset($lead_edit_data['claim_history']) && (int) $lead_edit_data['claim_history'] === 1) || !empty($savedClaims);
|
|
$showClaimHistorySwitch = isset($lead_edit_data['lead_type'], $lead_edit_data['policy_type_id'])
|
|
&& in_array((int) $lead_edit_data['lead_type'], [1, 2, 3], true)
|
|
&& in_array((int) $lead_edit_data['policy_type_id'], [1, 6, 7], true);
|
|
$claimHistoryLabel = (isset($lead_edit_data['lead_type']) && (int) $lead_edit_data['lead_type'] === 1)
|
|
? 'Mortality Experience'
|
|
: 'Claims Experience';
|
|
?>
|
|
<?php if ($showClaimHistorySwitch) { ?>
|
|
<div class="custom-control custom-switch">
|
|
<input type="checkbox" onchange="claimHistoryToggle()" class="custom-control-input" id="claim_history" name="claim_history" <?= $isClaimHistoryChecked ? 'checked' : '' ?>>
|
|
<label class="custom-control-label" for="claim_history"><?= $claimHistoryLabel ?></label>
|
|
</div><br>
|
|
<?php } ?>
|
|
<div class="form-row" id="appendAreaForClaim_1">
|
|
<?php
|
|
|
|
$claims = !empty($savedClaims) ? $savedClaims : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
|
|
|
|
foreach ($claims as $key => $value) {
|
|
$isNilClaimRow = !empty($value['nil_claims']);
|
|
?>
|
|
|
|
<div class="row claim-row<?= $isNilClaimRow ? ' claim-row-nil' : '' ?>">
|
|
|
|
<div class="form-group col-md-2 claim-year-group">
|
|
<label for="first_year_<?= $key ?>">Year<span class="text-danger claim-required-star">*</span></label>
|
|
<select class="form-control first_year_ claim-input" id="first_year_<?= $key ?>" name="first_year[]">
|
|
<option value="">Select Year</option>
|
|
<?php foreach ($lastFiveYears as $year) {
|
|
$selected = ($year == $value['year']) ? 'selected' : '';
|
|
echo "<option value='$year' $selected>$year</option>";
|
|
} ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2">
|
|
<label>Nil Claims</label>
|
|
<input type="hidden" class="nil-claims-value" name="nil_claims[]" value="<?= $isNilClaimRow ? '1' : '0' ?>">
|
|
<div class="custom-control custom-checkbox" style="padding-top: 8px;">
|
|
<input type="checkbox" class="custom-control-input nil-claims-checkbox" id="nil_claims_<?= $key ?>" onchange="nilClaimsToggle(this)"<?= $isNilClaimRow ? ' checked' : '' ?>>
|
|
<label class="custom-control-label" for="nil_claims_<?= $key ?>">Nil Claims</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="emp_id_<?= $key ?>">Emp ID<span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<input type="text" class="form-control claim-input" id="emp_id_<?= $key ?>" name="emp_id[]" value="<?= htmlspecialchars(isset($value['emp_id']) ? $value['emp_id'] : '-' ) ?>"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="emp_name_<?= $key ?>">Employee Name<span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<input type="text" class="form-control claim-input" id="emp_name_<?= $key ?>" name="emp_name[]" value="<?= htmlspecialchars(isset($value['emp_name']) ? $value['emp_name'] : '-' ) ?>"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="gender_<?= $key ?>">Gender<span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<select class="form-control claim-input" id="gender_<?= $key ?>" name="gender[]"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
<option value="">Select Gender</option>
|
|
<option value="Female" <?= (isset($value['gender']) && $value['gender'] == 'Female') ? 'selected' : '' ?>>Female</option>
|
|
<option value="Male" <?= (isset($value['gender']) && $value['gender'] == 'Male') ? 'selected' : '' ?>>Male</option>
|
|
<?php if ($isNilClaimRow) { ?>
|
|
<option value="Nil" selected>Nil</option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="designation_<?= $key ?>">Designation <span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<input type="text" class="form-control claim-input" id="designation_<?= $key ?>" name="designation[]" value="<?= htmlspecialchars(isset($value['designation']) ? $value['designation'] : '-' ) ?>"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="sum_insured_<?= $key ?>">Sum Insured <span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<input type="text" class="form-control claim-input" id="sum_insured_<?= $key ?>" name="sum_insured[]" value="<?= htmlspecialchars(isset($value['sum_insured']) ? $value['sum_insured'] : '-' ) ?>"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="first_death_date_<?= $key ?>">Date of Death<span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<input type="text" class="form-control flatpickr-date claim-input" id="first_death_date_<?= $key ?>" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date'] ?? '') ?>" autocomplete="off"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="first_cause_of_death_<?= $key ?>">Nature/Cause Of Death <span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<select class="form-control claim-input" id="first_cause_of_death_<?= $key ?>" name="first_cause_of_death[]"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
<option value="">Select Cause of Death</option>
|
|
<?php foreach ($causeOfDeath as $cause => $death_value) {
|
|
$selected = ($cause == $value['cause_of_death']) ? 'selected' : '';
|
|
echo "<option value='$cause' $selected>$death_value</option>";
|
|
} ?>
|
|
<?php if ($isNilClaimRow) { ?>
|
|
<option value="Nil" selected>Nil</option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-2 claim-field-group">
|
|
<label for="first_claim_amount_<?= $key ?>">Claim/Settled Amount<span class="text-danger claim-required-star"<?= $isNilClaimRow ? ' style="display:none;"' : '' ?>>*</span></label>
|
|
<input type="text" class="form-control claim-input" id="first_claim_amount_<?= $key ?>" name="first_claim_amount[]" value="<?= htmlspecialchars(isset($value['claim_amount']) ? $value['claim_amount'] : ( isset($value['settled']) ? $value['settled'] : '-' )) ?>"<?= $isNilClaimRow ? ' disabled' : '' ?>>
|
|
</div>
|
|
|
|
<!-- <div class="form-group col-md-2">
|
|
<label for="first_claim_status">Claim Status<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="first_claim_status" name="first_claim_status[]" value="<?php //htmlspecialchars($value['status']) ?>">
|
|
</div> -->
|
|
|
|
<!-- <div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
|
<label for="claim_type">Claim Type<span class="text-danger">*</span></label>
|
|
<select class="form-control" id="claim_type" name="claim_type[]">
|
|
<option value="">Select Claim Type</option>
|
|
<?php
|
|
// foreach ($gpaClaimType as $claimType => $claim_value) {
|
|
// $selected = ($claimType == $value['claim_type']) ? 'selected' : '';
|
|
// echo "<option value='$claimType' $selected>$claim_value</option>";
|
|
// }
|
|
?>
|
|
</select>
|
|
</div> -->
|
|
|
|
<div class="form-group col-md-2">
|
|
<div class="" style="position: relative; top: 28px; float: right; text-align: end;">
|
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeClaim(this, 1)">x</a>
|
|
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="appendThreeYearsClaims(1)">+</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
<?php } else { ?>
|
|
<div class="form-row" id="appendAreaForClaim"></div>
|
|
<?php } ?>
|
|
|
|
<script>
|
|
|
|
flatpickr('.flatpickr-date', {
|
|
dateFormat: 'd-M-Y', // Example format: 11-10-2025
|
|
allowInput: true, // Allow manual typing
|
|
maxDate: 'today', // Optional: disable future dates
|
|
});
|
|
|
|
if (typeof initNilClaimsRows === 'function') {
|
|
initNilClaimsRows();
|
|
}
|
|
|
|
</script>
|
|
|