CHANGES_CLAIMS_CHANGES : RV
This commit is contained in:
parent
74fb6eb556
commit
785ac1bfbe
@ -30,6 +30,7 @@ $routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
|
||||
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
$routes->get("sendextraparam", "ClientController::sendextraparam");
|
||||
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
|
||||
@ -660,7 +660,7 @@ class ClientController extends AdminController
|
||||
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);
|
||||
|
||||
// dd($data['insurerName']);
|
||||
// dd($data);
|
||||
|
||||
// print_r($data['depositdata'] );die;
|
||||
// Load the view for the new list page;
|
||||
@ -691,6 +691,7 @@ class ClientController extends AdminController
|
||||
'client_id' => $this->request->getPost('client_id'),
|
||||
'client_policy_id' => null,
|
||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||
'cd_ac_pk' => $CD_Account_Number['id'] ?? null,
|
||||
'endorsement_no' => null,
|
||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
@ -3988,12 +3989,17 @@ class ClientController extends AdminController
|
||||
|
||||
public function sendextraparam()
|
||||
{
|
||||
|
||||
// $employeeController = new EmployeeController();
|
||||
// $employeeController->truncateFileData('633');
|
||||
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 835]);
|
||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||
$employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
|
||||
|
||||
@ -4472,6 +4478,59 @@ class ClientController extends AdminController
|
||||
$successData[] = ['id' => $value['id'], 'client' => $value['insured']];
|
||||
}
|
||||
|
||||
kint::dump($successData);
|
||||
}
|
||||
|
||||
public function updateRenewalDataNotExistingClient()
|
||||
{
|
||||
$limit = $this->request->getGet('limit') ?? 10;
|
||||
$group = $this->request->getGet('group') ?? 2;
|
||||
$db = db_connect();
|
||||
$renewalData = $db->table('old_renewal_data_copy')
|
||||
->where('client_id IS NULL')
|
||||
->where('is_inserted = 0')
|
||||
->where('client_type_id', $group)
|
||||
// ->limit($limit)
|
||||
->get()
|
||||
->getResultArray();
|
||||
// dd($renewalData);
|
||||
|
||||
$successData = [];
|
||||
foreach ($renewalData as $key => $value) {
|
||||
|
||||
$client_data = $this->clientModel->where('client_name', $value['insured'])->where('is_active', 1)->first();
|
||||
if(!empty($client_data)){
|
||||
$branch = $this->clientBranchModel->where('client_id', $client_data['id'] ?? 0)->first();
|
||||
$value['branch_id'] = $branch['id'] ?? null;
|
||||
$value['client_id'] = $client_data['id'] ?? null;
|
||||
}else{
|
||||
$value['client_id'] = $this->prepareClient($value);
|
||||
if($value['client_type_id'] == 1){
|
||||
$value['branch_id'] = $this->prepareClientBranch($value);
|
||||
}
|
||||
}
|
||||
|
||||
// Fix vehicle_id key (previously "vehicel_id")
|
||||
if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
|
||||
$value['vehicle_id'] = $this->prepareVehicleData($value);
|
||||
}else{
|
||||
$value['vehicle_id'] = 0;
|
||||
}
|
||||
|
||||
// Process client policy, policy transaction, and co-share details
|
||||
$value['client_policy_id'] = $this->prepareClientPolicy($value);
|
||||
$value['pt_id'] = $this->preparePolicyData($value);
|
||||
$value['pt_co_id'] = $this->preparePtCoShareDetails($value);
|
||||
|
||||
// Update is_inserted field in DB
|
||||
$db->table('old_renewal_data_copy')
|
||||
->where('id', $value['id'])
|
||||
->set(['is_inserted' => 1])
|
||||
->update();
|
||||
|
||||
$successData[] = ['id' => $value['id'], 'client' => $value['insured'], 'vehicle_id' => $value['vehicle_id']];
|
||||
}
|
||||
|
||||
kint::dump($successData);
|
||||
}
|
||||
|
||||
@ -4481,7 +4540,7 @@ class ClientController extends AdminController
|
||||
'issuer' => $renewalData['issuer_type_id'] ?? null,
|
||||
'client_id' => $renewalData['client_id'] ?? null,
|
||||
'client_branch_id' => $renewalData['branch_id'] ?? 0,
|
||||
'vehicle_id' => $renewalData['vehicel_id'] ?? null,
|
||||
'vehicle_id' => $renewalData['vehicle_id'] ?? null,
|
||||
'insurer_id' => $renewalData['insurer_id'] ?? null,
|
||||
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
'tpa_id' => null,
|
||||
@ -4547,20 +4606,36 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
private function prepareVehicleData($renewalData)
|
||||
{
|
||||
{
|
||||
$VehicleModel = new VehicleModel();
|
||||
|
||||
if ($renewalData['client_type_id'] == 1) {
|
||||
$veh_no = explode(" ", $renewalData['insured'])[0] . "_veh_no";
|
||||
} else {
|
||||
$veh_no = $renewalData['insured'] . "_veh_no";
|
||||
}
|
||||
|
||||
$vehicleData = $VehicleModel->where('owner', $renewalData['client_id'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
if (!empty($vehicleData)) {
|
||||
$increment = count($vehicleData);
|
||||
$veh_no = $increment . "_" . $veh_no;
|
||||
}
|
||||
|
||||
|
||||
$vehicleData = [
|
||||
'vehicle_no' => $renewalData['veh_no'],
|
||||
'vehicle_no' => $veh_no,
|
||||
'type' => null,
|
||||
'description' => null,
|
||||
'owner' => $renewalData['client_id'], // client_id
|
||||
'branch_id' => $renewalData['client_type_id'] == 1 ? $renewalData['branch_id'] : null, // client_branch_id
|
||||
'branch_id' => $renewalData['client_type_id'] == 1 ? $renewalData['branch_id'] : 0, // client_branch_id
|
||||
'old_owner' => null,
|
||||
'rc' => null,
|
||||
];
|
||||
|
||||
|
||||
// dd($vehicleData);
|
||||
$VehicleModel = new VehicleModel();
|
||||
$id = $VehicleModel->insert($vehicleData);
|
||||
return $id;
|
||||
}
|
||||
@ -4628,7 +4703,7 @@ class ClientController extends AdminController
|
||||
{
|
||||
$client_policy = [
|
||||
'client_id' => $renewalData['client_id'],
|
||||
'client_branch_id' => $renewalData['branch_id'],
|
||||
'client_branch_id' => $renewalData['branch_id'] ?? 0,
|
||||
'policy_type_id' => $renewalData['policy_type_id'],
|
||||
'insurer_id' => $renewalData['insurer_id'],
|
||||
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
@ -4659,6 +4734,83 @@ class ClientController extends AdminController
|
||||
$id = $ClientPolicyModel->insert($client_policy);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function prepareClientBranch($renewalData)
|
||||
{
|
||||
$branch_code = "BRANCH001";
|
||||
$short_name = explode(" ", $renewalData['insured'])[0];
|
||||
$unit = $short_name . " - " . $branch_code;
|
||||
|
||||
$clientBranchData = [
|
||||
'client_id' => $renewalData['client_id'],
|
||||
'branch_name' => "Branch 1",
|
||||
'branch_code' => $branch_code,
|
||||
'city' => null,
|
||||
'district' => null,
|
||||
'state' => null,
|
||||
'pincode' => null,
|
||||
'address1' => null,
|
||||
'address2' => null,
|
||||
'gst' => null,
|
||||
'sez' => 0,
|
||||
'is_active' => 1,
|
||||
'units' => $unit
|
||||
];
|
||||
|
||||
|
||||
$ClientBranchModel = new ClientBranchModel();
|
||||
$id = $ClientBranchModel->insert($clientBranchData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function prepareClient($renewalData)
|
||||
{
|
||||
|
||||
if($renewalData['client_type_id'] == 1){
|
||||
$short_name = explode(" ", $renewalData['insured'])[0];
|
||||
}else{
|
||||
$short_name = $renewalData['insured'];
|
||||
}
|
||||
|
||||
$clientData = [
|
||||
'client_type' => $renewalData['client_type_id'],
|
||||
'entity_type_id' => null,
|
||||
'client_name' => $renewalData['insured'],
|
||||
'short_name' => $short_name,
|
||||
'cost_center' => null,
|
||||
'client_code' => null, // Auto-generated
|
||||
'pan' => null,
|
||||
'gst' => null,
|
||||
'address1' => null,
|
||||
'address2' => null,
|
||||
'city' => null,
|
||||
'state' => null,
|
||||
'pincode' => null,
|
||||
'is_download_btn' => 0, // Assuming a default value if not specified
|
||||
'client_logo' => null,
|
||||
'created_by' => null,
|
||||
'created_at' => null, // Will be set automatically by MySQL
|
||||
'updated_by' => null,
|
||||
'updated_at' => null, // Will be set automatically by MySQL
|
||||
'is_active' => 1, // Default value is 1
|
||||
'common_mails' => null,
|
||||
'hr_mails' => null,
|
||||
'mail_domain' => null,
|
||||
'reply_to' => null,
|
||||
'dob' => null,
|
||||
'aadhar' => null,
|
||||
'reference' => null,
|
||||
'phone' => null,
|
||||
'email' => null,
|
||||
'addon_subheading' => null
|
||||
];
|
||||
|
||||
|
||||
|
||||
$ClientModel = new ClientModel();
|
||||
$id = $ClientModel->insert($clientData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ class EmployeeController extends AdminController
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
->limit(100)
|
||||
->limit(1000)
|
||||
->find();
|
||||
|
||||
|
||||
@ -1298,7 +1298,7 @@ class EmployeeController extends AdminController
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
|
||||
// print_r($file); die;
|
||||
// dd($cd_tranction, db_connect()->getLastQuery());
|
||||
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') {
|
||||
|
||||
|
||||
@ -1455,6 +1455,7 @@ class EmployeeController extends AdminController
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// dd($res);
|
||||
// print_r($this->empEndorsementModel->getLastQuery());
|
||||
// echo $res[0]->count;die();
|
||||
|
||||
@ -1464,14 +1465,15 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
||||
|
||||
$transaction_type = 'Credit';
|
||||
$cd_amount = $cd_tranction['amount'];
|
||||
$cd_amount = 0;
|
||||
|
||||
if($file['action'] == 'deletion'){
|
||||
if($file['action'] == 'deletion' && $res[0]->count > 0){
|
||||
|
||||
$transaction_type = 'Debit';
|
||||
//get cd amount for the particular file id to reverse entry to the cash deposite for only deletion
|
||||
$cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']);
|
||||
$totalSum = array_sum(array_column($cd_amount_total, 'total'));
|
||||
$cd_amount = $totalSum;
|
||||
$cd_amount = $totalSum ?? 0;
|
||||
|
||||
$this->myLogger->logme('error', 'Deletion CD Amount : {data}', ['data' => $cd_amount]);
|
||||
}
|
||||
@ -1488,7 +1490,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
||||
|
||||
//STEP 2:
|
||||
if($file['action'] == 'deletion') {
|
||||
if($file['action'] == 'deletion' && $res[0]->count > 0) {
|
||||
//update the employee policy table reverse the data
|
||||
$this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id);
|
||||
$this->myLogger->logme('error', 'employee_polices table updated for deletion');
|
||||
@ -1504,7 +1506,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'files table updated');
|
||||
|
||||
|
||||
if($cd_tranction && $file['action'] != 'correction'){
|
||||
if(!empty($cd_amount) && $file['action'] != 'correction'){
|
||||
|
||||
$cd_data = [
|
||||
'amount' => $cd_amount,
|
||||
|
||||
@ -1647,7 +1647,7 @@ class EmployeeServiceController extends AdminController
|
||||
// echo 'insert emp';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
@ -2056,6 +2056,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
}
|
||||
$value['family_floater_key'] = $relation;
|
||||
|
||||
// dd($value['family_floater_key']);
|
||||
|
||||
$policy_data['basic_cover_si'] = $row[9];
|
||||
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
|
||||
@ -2173,20 +2173,21 @@ if(!function_exists('group_slab_rates_basedon_name'))
|
||||
|
||||
|
||||
//this key generating mandantory for display employee info in enrolment app w/o error
|
||||
if(!function_exists('generate_family_floater_key'))
|
||||
{
|
||||
if (!function_exists('generate_family_floater_key')) {
|
||||
function generate_family_floater_key($relationship)
|
||||
{
|
||||
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
||||
$relation = 'parent';
|
||||
} else if(strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter'){
|
||||
$relation = 'child';
|
||||
}else if(strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law'){
|
||||
$relation = 'parent_in_law';
|
||||
}else if(strtolower(trim($relationship)) === 'spouse'){
|
||||
$relation = 'spouse';
|
||||
}else{
|
||||
$relation = 'self';
|
||||
}
|
||||
$relation = 'parent';
|
||||
} else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') {
|
||||
$relation = 'child';
|
||||
} else if (strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law') {
|
||||
$relation = 'parent_in_law';
|
||||
} else if (strtolower(trim($relationship)) === 'spouse') {
|
||||
$relation = 'spouse';
|
||||
} else {
|
||||
$relation = 'self';
|
||||
}
|
||||
|
||||
return $relation;
|
||||
}
|
||||
}
|
||||
@ -1682,7 +1682,10 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
// reverse the employee policy table data for the truncated the deletion file
|
||||
public function updateEmployeePolicyTruncateReverse($file_id)
|
||||
{
|
||||
{
|
||||
log_message('error', 'updateEmployeePolicyTruncateReverse model function called');
|
||||
log_message('error', 'FILE ID : {data}', ['data' => $file_id]);
|
||||
|
||||
$this->db->query("
|
||||
UPDATE employee_polices
|
||||
SET
|
||||
@ -1690,7 +1693,7 @@ class EmployeePolicyModel extends Model
|
||||
status = 'active',
|
||||
date_of_exit = NULL,
|
||||
reason_for_exit = NULL,
|
||||
claim_status = 0,
|
||||
claim_status = 0
|
||||
WHERE
|
||||
id IN (
|
||||
SELECT pk
|
||||
|
||||
@ -293,6 +293,7 @@
|
||||
<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 returned" style="display: none;">
|
||||
<label for="return_remark">Return Remark</label>
|
||||
<textarea class="form-control" id="return_remark" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea>
|
||||
@ -342,6 +343,8 @@
|
||||
|
||||
<script>
|
||||
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var doa = flatpickr("#doa", {
|
||||
@ -363,32 +366,74 @@ $(document).ready(function() {
|
||||
|
||||
// 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').hide();
|
||||
// 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();
|
||||
// // 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');
|
||||
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
|
||||
$('.up_cnu').show();
|
||||
showClass = '.up_cnu';
|
||||
} else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
$('.up_qdr').show();
|
||||
showClass = '.up_qdr';
|
||||
} else if (value == 8) { // REJECTED
|
||||
$('.rejected').show();
|
||||
showClass = '.rejected';
|
||||
} else if (value == 9) { // APPROVED
|
||||
$('.approved').show();
|
||||
showClass = '.approved';
|
||||
} else if (value == 11) { // SETTLED
|
||||
$('.settled').show();
|
||||
}else if (value == 13) { // CANCELLED
|
||||
$('.canceled').show();
|
||||
}else if (value == 14) { // RETURNED
|
||||
$('.returned').show();
|
||||
showClass = '.settled';
|
||||
} else if (value == 13) { // CANCELLED
|
||||
showClass = '.canceled';
|
||||
} else if (value == 14) { // RETURNED
|
||||
showClass = '.returned';
|
||||
}
|
||||
|
||||
// Show the relevant section and enable required attributes
|
||||
if (showClass) {
|
||||
$(showClass).show().find('input, textarea').attr('required', true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,4 +461,66 @@ function claimStatusFieldChanges(fields) {
|
||||
});
|
||||
}
|
||||
|
||||
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||
|
||||
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||
console.log('fields', fields);
|
||||
console.log('remove_or_add', remove_or_add);
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', remove_or_add);
|
||||
var $parentDiv = $field.closest("div");
|
||||
console.log('parentDiv', $parentDiv);
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
// if(remove_or_add == false){
|
||||
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||
// console.log('one', remove_or_add);
|
||||
// }else{
|
||||
// if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.'+thirdClass).find('input, textarea').attr('required', true);
|
||||
|
||||
}
|
||||
|
||||
$(document).on("input", function (event) {
|
||||
|
||||
let fields = GlobelExtraFields;
|
||||
console.log('fields', fields);
|
||||
let targetId = event.target.id;
|
||||
console.log('targetId', targetId);
|
||||
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||
|
||||
if (fields.includes(targetId)) {
|
||||
|
||||
let $field = $("#" + targetId);
|
||||
console.log('$field id', $field);
|
||||
let $parentDiv = $field.closest("div");
|
||||
console.log('$parentDiv', $parentDiv);
|
||||
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
|
||||
if (thirdClass) {
|
||||
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||
let $label = $(thirdClass).find("label");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
} else {
|
||||
claimStatusFieldRemoveREquired($field, false, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -266,7 +266,9 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var date_of_join = flatpickr("#date_of_join", {
|
||||
@ -304,6 +306,7 @@ $(document).ready(function() {
|
||||
|
||||
// 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);
|
||||
|
||||
@ -330,11 +333,11 @@ function updateClaimStatusDisplay(value) {
|
||||
}
|
||||
|
||||
$('#claim_status_id').on('change', function() {
|
||||
// updateClaimStatusDisplay($(this).val());
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
});
|
||||
|
||||
function claimStatusFieldChanges(fields) {
|
||||
|
||||
console.log('fields', fields);
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
@ -352,4 +355,66 @@ function claimStatusFieldChanges(fields) {
|
||||
});
|
||||
}
|
||||
|
||||
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||
|
||||
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||
console.log('fields', fields);
|
||||
console.log('remove_or_add', remove_or_add);
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', remove_or_add);
|
||||
var $parentDiv = $field.closest("div");
|
||||
console.log('parentDiv', $parentDiv);
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
// if(remove_or_add == false){
|
||||
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||
// console.log('one', remove_or_add);
|
||||
// }else{
|
||||
// if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.'+thirdClass).find('input, textarea').attr('required', true);
|
||||
|
||||
}
|
||||
|
||||
$(document).on("input", function (event) {
|
||||
|
||||
let fields = GlobelExtraFields;
|
||||
console.log('fields', fields);
|
||||
let targetId = event.target.id;
|
||||
console.log('targetId', targetId);
|
||||
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||
|
||||
if (fields.includes(targetId)) {
|
||||
|
||||
let $field = $("#" + targetId);
|
||||
console.log('$field id', $field);
|
||||
let $parentDiv = $field.closest("div");
|
||||
console.log('$parentDiv', $parentDiv);
|
||||
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
|
||||
if (thirdClass) {
|
||||
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||
let $label = $(thirdClass).find("label");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
} else {
|
||||
claimStatusFieldRemoveREquired($field, false, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user