Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
ebdaee8b08
@ -172,6 +172,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("others", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "ClientController::createOtherTabContent");
|
||||
$routes->post('check-duplicate', 'ClientController::validateDuplicateByClientBranch');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -132,6 +132,15 @@ class ClientController extends AdminController
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function validateDuplicateByClientBranch()
|
||||
{
|
||||
$request = service('request');
|
||||
$value = $request->getPost('value');
|
||||
$clientId = $request->getPost('client_id');
|
||||
$branchId = $request->getPost('branch_id');
|
||||
$isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $clientId, $branchId);
|
||||
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||
}
|
||||
public function checkDuplicateTableFieldValue()
|
||||
{
|
||||
$table = $this->request->getPost('table');
|
||||
|
||||
@ -2868,14 +2868,14 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}else if($ClientPolicyValue['policy_type_id'] == 6)
|
||||
{
|
||||
$policyGroup = 'gpa';
|
||||
$policyGroup = 'other';
|
||||
$data['ticket_type_id'] = 3;
|
||||
$data['claim_subject'] = "Claim EDLI";
|
||||
$data['sum_insured_label'] = "Sum Assured";
|
||||
|
||||
}else if($ClientPolicyValue['policy_type_id'] == 7)
|
||||
{
|
||||
$policyGroup = 'gpa';
|
||||
$policyGroup = 'other';
|
||||
$data['ticket_type_id'] = 4;
|
||||
$data['claim_subject'] = "Claim GTLI";
|
||||
$data['sum_insured_label'] = "Sum Assured";
|
||||
@ -2969,9 +2969,6 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
function policyTermsFiter($terms , $type)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$gpa = [
|
||||
"sumInsured2" => "Sum Insured",
|
||||
"totalSumInsured" => "Total Sum Assured",
|
||||
@ -3021,8 +3018,6 @@ class EmployeeRestController extends AdminController
|
||||
"moderntreatmentsasperirdai" => "Modern Treatment "
|
||||
];
|
||||
|
||||
|
||||
|
||||
$finalarray = [];
|
||||
if($type == 'gpa'){
|
||||
foreach ($gpa as $key => $value) {
|
||||
@ -3046,6 +3041,18 @@ class EmployeeRestController extends AdminController
|
||||
$finalarray[$terms->gpa_special_condition_label[$i]] = $terms->gpa_special_condition_input[$i];
|
||||
}
|
||||
}
|
||||
}else if($type == 'other'){
|
||||
foreach ($terms as $key => $value) {
|
||||
if($key != "multiple_sum_insured" && $value != ""){
|
||||
$result = ucwords(str_replace('_', ' ', $key));
|
||||
$finalarray[$result] = $value;
|
||||
}
|
||||
}
|
||||
if(isset(($terms->gpa_special_condition_label)) && is_array($terms->gpa_special_condition_label) && is_array($terms->gpa_special_condition_input)){
|
||||
for ($i=0; $i < count($terms->gpa_special_condition_label); $i++) {
|
||||
$finalarray[$terms->gpa_special_condition_label[$i]] = $terms->gpa_special_condition_input[$i];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($gmc as $key => $value) {
|
||||
if(isset($terms->$key))
|
||||
@ -3070,9 +3077,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $finalarray;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -138,7 +138,10 @@ class LeadsController extends BaseController
|
||||
$this->cause_of_death = [
|
||||
'natural_death' => 'Natural Death',
|
||||
'suicide' => 'Suicide',
|
||||
'accident' => 'Accident'
|
||||
'accident' => 'Accident',
|
||||
'cardiac_arrest' => 'Cardiac Arrest',
|
||||
'septic_shock' => 'Septic shock',
|
||||
'heart_attack' => 'Heart Attack',
|
||||
];
|
||||
|
||||
$this->member_data_excel_columns = [
|
||||
@ -2408,8 +2411,11 @@ class LeadsController extends BaseController
|
||||
$row = 2;
|
||||
foreach ($claim_details['finyear'] as $record) {
|
||||
$col = 'A';
|
||||
foreach ($record as $value) {
|
||||
foreach ($record as $array_key => $value) {
|
||||
$label = ucwords(str_replace('_', ' ', ($value ?? "")));
|
||||
if(in_array($array_key, ['sum_insured', 'claim_amount', 'settled'])){
|
||||
$label = formatIndianCurrency(intval($label));
|
||||
}
|
||||
$sheet->setCellValue($col . $row, $label);
|
||||
$col++;
|
||||
}
|
||||
@ -2427,19 +2433,27 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
// Enable wrap text for all cells
|
||||
$maxColLetter = chr(64 + count($headers)); // Last column letter
|
||||
$sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true);
|
||||
// $maxColLetter = chr(64 + count($headers)); // Last column letter
|
||||
// $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true);
|
||||
|
||||
// Optional: center vertically for neatness
|
||||
$sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
// // Optional: center vertically for neatness
|
||||
// $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
// Optional: Make row height auto (helps when wrap text is on)
|
||||
for ($i = 2; $i < $row; $i++) {
|
||||
$sheet->getRowDimension($i)->setRowHeight(-1);
|
||||
}
|
||||
$maxColLetter = chr(64 + count($headers));
|
||||
$dataRange = "A1:{$maxColLetter}" . ($row - 1);
|
||||
|
||||
}
|
||||
}
|
||||
$sheet->getStyle($dataRange)->getAlignment()
|
||||
->setWrapText(true)
|
||||
->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER)
|
||||
->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
// Optional: Make row height auto (helps when wrap text is on)
|
||||
for ($i = 2; $i < $row; $i++) {
|
||||
$sheet->getRowDimension($i)->setRowHeight(-1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Save to temporary location
|
||||
$uploadFilePath = WRITEPATH . 'tmp/' . $filename;
|
||||
|
||||
@ -226,5 +226,18 @@ class ClientModel extends Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isDuplicateByClientBranch($email, $clientId, $branchId)
|
||||
{
|
||||
$builder = $this->db->table('level_contacts lc')
|
||||
->select('lc.id')
|
||||
->join('client_branch cb', 'lc.ref_id = cb.id', 'left')
|
||||
->where('lc.email', $email)
|
||||
->where('lc.contact_type', 'client')
|
||||
->where('cb.client_id', $clientId)
|
||||
->where('lc.ref_id', $branchId)
|
||||
->get();
|
||||
|
||||
return $builder->getNumRows() > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
||||
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
||||
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateDuplicateByClientBranch(this, 'branchBtnSubmit')" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
@ -649,7 +649,7 @@ function appendContactHtml(contact = false, reset = false) {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateDuplicateByClientBranch(this, 'branchBtnSubmit')" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
@ -972,6 +972,57 @@ function validateInput(input, table, field, submitButId){
|
||||
|
||||
}
|
||||
|
||||
function validateDuplicateByClientBranch(input, submitButId) {
|
||||
let value = $(input).val().trim();
|
||||
let clientId = $('#client_id_branch').val();
|
||||
let branchId = $('#branch_id_primarykey').val();
|
||||
console.log(`Ln968 cId: ${clientId} | bId: ${branchId}`);
|
||||
|
||||
// Don't forgot be careful
|
||||
// 1 Local duplication check (User entered)
|
||||
let isLocalDuplicate = false;
|
||||
$('input[name="email[]"]').each(function() {
|
||||
if (this !== input && $(this).val().trim() === value && value !== '') {
|
||||
isLocalDuplicate = true;
|
||||
return false; // break loop
|
||||
}
|
||||
});
|
||||
|
||||
if (isLocalDuplicate) {
|
||||
console.log(`r u n Local`);
|
||||
toastr.warning("Email is duplicate!", 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
return; // don’t call server if duplicate in UI
|
||||
}
|
||||
|
||||
// Don't forgot be careful
|
||||
// 2 Server-side duplicate check (DB)
|
||||
if (!isLocalDuplicate && value !== '') {
|
||||
console.log(`r u n Server`);
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/others/check-duplicate") ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
client_id: clientId,
|
||||
branch_id: branchId,
|
||||
value: value
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.isDuplicate) {
|
||||
toastr.warning("Email already exists!", 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
} else {
|
||||
$('#' + submitButId).prop('disabled', false);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getContactsData() {
|
||||
const contacts = [];
|
||||
|
||||
|
||||
@ -1862,6 +1862,7 @@
|
||||
let claimData = [];
|
||||
|
||||
$(".claim-row").each(function() {
|
||||
|
||||
let year = $(this).find("[name='first_year[]']").val();
|
||||
let claimAmount = $(this).find("[name='first_claim_amount[]']").val();
|
||||
let claimStatus = $(this).find("[name='first_claim_status[]']").val();
|
||||
@ -1869,13 +1870,22 @@
|
||||
let causeOfDeath = $(this).find("[name='first_cause_of_death[]']").val();
|
||||
let deathDate = $(this).find("[name='first_death_date[]']").val();
|
||||
|
||||
let emp_id = $(this).find("[name='emp_id[]']").val();
|
||||
let emp_name = $(this).find("[name='emp_name[]']").val();
|
||||
let gender = $(this).find("[name='gender[]']").val();
|
||||
let designation = $(this).find("[name='designation[]']").val();
|
||||
let sum_insured = $(this).find("[name='sum_insured[]']").val();
|
||||
|
||||
claimData.push({
|
||||
"year": year,
|
||||
"claim_amount": claimAmount,
|
||||
"status": claimStatus,
|
||||
"claim_type": claimType,
|
||||
"emp_id": emp_id,
|
||||
"emp_name": emp_name,
|
||||
"gender": gender,
|
||||
"designation": designation,
|
||||
"sum_insured": sum_insured,
|
||||
"death_date": deathDate,
|
||||
"cause_of_death": causeOfDeath,
|
||||
"death_date": deathDate
|
||||
"settled": claimAmount,
|
||||
});
|
||||
});
|
||||
|
||||
@ -1893,6 +1903,93 @@
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
// do not remove this
|
||||
// function appendThreeYearsClaims(count) {
|
||||
|
||||
// // let count = $('#appendAreaForClaim').data('count');
|
||||
// console.log("count", count);
|
||||
|
||||
// let policy_type_id = $('#policy_type_id_' + count).val()
|
||||
// console.log('policy_type_id', policy_type_id);
|
||||
|
||||
// console.log('claimIndex from parent', claimIndex);
|
||||
// let increment = claimIndex;
|
||||
|
||||
// let claimsFields = `
|
||||
// <div class="row claim-row">
|
||||
|
||||
// <div class="form-group col-md-2">
|
||||
// <label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||
// <select class="form-control first_year_" id="first_year_${increment}" name="first_year[]">
|
||||
// <option value="">Select Year</option>
|
||||
// <?php foreach ($lastFiveYears as $year) {echo "<option value='$year'>$year</option>";} ?>
|
||||
// </select>
|
||||
// </div>
|
||||
// <div class="form-group col-md-2">
|
||||
// <label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
// <input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||
// </div>
|
||||
// <div class="form-group col-md-2">
|
||||
// <label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||
// <input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||
// </div>
|
||||
// <div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
// <label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||
// <select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
|
||||
// <option value="">Select Cause of Death</option>
|
||||
// <?php foreach ($causeOfDeath as $cause => $death_value) {echo "<option value='$cause'>$death_value</option>";} ?>
|
||||
// </select>
|
||||
// </div>
|
||||
// <div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
// <label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||
// <input type="text" class="form-control" id="first_death_date_${increment}" name="first_death_date[]">
|
||||
// </div>
|
||||
// <div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
// <label for="claim_type_${increment}">Claim Type<span class="text-danger">*</span></label>
|
||||
// <select class="form-control" id="claim_type_${increment}" name="claim_type[]">
|
||||
// <option value="">Select Claim Type</option>
|
||||
// <?php foreach ($gpaClaimType as $claimType => $claim_value) {echo "<option value='$claimType'>$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, ${count})">x</a>
|
||||
// <a class="btn btn-primary waves-effect waves-light mr-1" onclick="appendThreeYearsClaims(${count})">+</a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// `;
|
||||
|
||||
// // Append new claim fields
|
||||
// let referenceDiv = document.getElementById('appendAreaForClaim_' + count);
|
||||
|
||||
// if (referenceDiv) {
|
||||
// referenceDiv.insertAdjacentHTML('beforeend', claimsFields);
|
||||
// } else {
|
||||
// console.error('Element not found: appendAreaForClaim_' + count);
|
||||
// }
|
||||
|
||||
// // Increment claim index
|
||||
// console.log("claim index " + claimIndex);
|
||||
// claimIndex++;
|
||||
// console.log("after claim index " + claimIndex);
|
||||
|
||||
// if (policy_type_id == 1) {
|
||||
// $('.gpaClaimFileds').show();
|
||||
// $('.lifeClaimFields').hide();
|
||||
// } else if (policy_type_id == 6 || policy_type_id == 7) {
|
||||
// $('.gpaClaimFileds').hide();
|
||||
// $('.lifeClaimFields').show();
|
||||
// }
|
||||
|
||||
// // Initialize Select2 for the newly added fields
|
||||
// $("#first_year_" + increment).select2();
|
||||
// $("#claim_type_" + increment).select2();
|
||||
// $("#first_cause_of_death_" + increment).select2();
|
||||
|
||||
// toggleRequiredFields();
|
||||
// }
|
||||
|
||||
function appendThreeYearsClaims(count) {
|
||||
|
||||
// let count = $('#appendAreaForClaim').data('count');
|
||||
@ -1916,15 +2013,46 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||
<label for="emp_id_${increment}">Emp ID<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_id_${increment}" name="emp_id[]">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||
<label for="emp_name_${increment}">Employee Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_name_${increment}" name="emp_name[]">
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="gender_${increment}">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="gender_${increment}" name="gender[]">
|
||||
<option value="">Select Gender</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Male">Male</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="designation_${increment}">Designation <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="designation_${increment}" name="designation[]">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="sum_insured_${increment}">Sum Insured <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="sum_insured_${increment}" name="sum_insured[]">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||
<div class="input-icon">
|
||||
<input type="text" class="form-control death_date flatpickr-date" id="first_death_date_${increment}" name="first_death_date[]" autocomplete="off">
|
||||
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
|
||||
<option value="">Select Cause of Death</option>
|
||||
@ -1933,11 +2061,18 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_death_date_${increment}" name="first_death_date[]">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||
</div>
|
||||
<div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
|
||||
<!-- <div class="form-group col-md-2">
|
||||
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
<label for="claim_type_${increment}">Claim Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="claim_type_${increment}" name="claim_type[]">
|
||||
<option value="">Select Claim Type</option>
|
||||
@ -1945,7 +2080,8 @@
|
||||
echo "<option value='$claimType'>$claim_value</option>";
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</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, ${count})">x</a>
|
||||
@ -1981,10 +2117,18 @@
|
||||
$("#first_year_" + increment).select2();
|
||||
$("#claim_type_" + increment).select2();
|
||||
$("#first_cause_of_death_" + increment).select2();
|
||||
$("#gender_" + increment).select2();
|
||||
|
||||
flatpickr('.flatpickr-date', {
|
||||
dateFormat: 'd-m-Y', // Example format: 11-10-2025
|
||||
allowInput: true, // Allow manual typing
|
||||
maxDate: 'today', // Optional: disable future dates
|
||||
});
|
||||
|
||||
toggleRequiredFields();
|
||||
}
|
||||
|
||||
|
||||
function removeClaim(btn, count) {
|
||||
const container = document.getElementById('appendAreaForClaim_' + count);
|
||||
const rows = container.querySelectorAll('.claim-row');
|
||||
@ -2108,6 +2252,10 @@
|
||||
$(this).find('.form-group').each(function() {
|
||||
var input = $(this).find('input, select');
|
||||
|
||||
if (input.attr('name') === "gender[]") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
console.warn('No input/select fields found in:', this);
|
||||
return;
|
||||
|
||||
@ -393,7 +393,6 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#client_branch_id').change(function() {
|
||||
|
||||
let client_branch_id = $(this).val();
|
||||
|
||||
@ -37,14 +37,15 @@
|
||||
<hr>
|
||||
|
||||
<?php if(isset($lead_edit_data)) { ?>
|
||||
|
||||
<div class="form-row" id="appendAreaForClaim_1">
|
||||
<?php
|
||||
|
||||
$claims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
|
||||
|
||||
foreach ($claims as $key => $value) { ?>
|
||||
|
||||
<div class="row claim-row">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_year">Year<span class="text-danger">*</span></label>
|
||||
<select class="form-control first_year_" id="first_year" name="first_year[]">
|
||||
@ -55,15 +56,42 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars($value['claim_amount']) ?>">
|
||||
<label for="emp_id">Emp ID<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_id" name="emp_id[]" value="<?= htmlspecialchars(isset($value['emp_id']) ? $value['emp_id'] : '-' ) ?>">
|
||||
</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="<?= htmlspecialchars($value['status']) ?>">
|
||||
<label for="emp_name">Employee Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_name" name="emp_name[]" value="<?= htmlspecialchars(isset($value['emp_name']) ? $value['emp_name'] : '-' ) ?>">
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="gender">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="gender" name="gender[]">
|
||||
<option value="">Select Gender</option>
|
||||
<option value="Female" <?= htmlspecialchars(isset($value['gender']) && $value['gender'] == "" ? 'selected' : "Female" ) ?> >Female</option>
|
||||
<option value="Male" <?= htmlspecialchars(isset($value['gender']) && $value['gender'] == "" ? 'selected' : "Male" ) ?> >Male</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="designation">Designation <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="designation" name="designation[]" value="<?= htmlspecialchars(isset($value['designation']) ? $value['designation'] : '-' ) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="sum_insured">Sum Insured <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="sum_insured" name="sum_insured[]" value="<?= htmlspecialchars(isset($value['sum_insured']) ? $value['sum_insured'] : '-' ) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control flatpickr-date" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_cause_of_death">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="first_cause_of_death" name="first_cause_of_death[]">
|
||||
<option value="">Select Cause of Death</option>
|
||||
@ -73,26 +101,37 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars(isset($value['claim_amount']) ? $value['claim_amount'] : ( isset($value['settled']) ? $value['settled'] : '-' )) ?>">
|
||||
</div>
|
||||
<div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
|
||||
<!-- <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>";
|
||||
} ?>
|
||||
<?php
|
||||
// foreach ($gpaClaimType as $claimType => $claim_value) {
|
||||
// $selected = ($claimType == $value['claim_type']) ? 'selected' : '';
|
||||
// echo "<option value='$claimType' $selected>$claim_value</option>";
|
||||
// }
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</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>
|
||||
@ -100,3 +139,13 @@
|
||||
<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
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user