diff --git a/.env.sample b/.env.sample index ceb7085a..49343c62 100755 --- a/.env.sample +++ b/.env.sample @@ -120,4 +120,13 @@ FHPL_USER_NAME = FHPL_PASSWORD = FHPL_GRANT_TYPE = -METABASE_SECRET_KEY= \ No newline at end of file +METABASE_SECRET_KEY= + + +# Health care api details +HEALTH_INDIA_BASE_URL = +HEALTH_INDIA_TOKEN_URL = +HEALTH_INDIA_USERNAME = +HEALTH_INDIA_PASSWORD = + +HEALTH_INDIA_PRIMARY_KEY_CONSTANT = \ No newline at end of file diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0bbec752..0645578c 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -694,6 +694,7 @@ $routes->group("employeeRest", ["filter" => ['GlobalPostFileUploadGuard', 'ratel $routes->get("getPolicyAndEndorsementFiles", "EmployeeRestController::getPolicyAndEndorsementFiles"); $routes->get("downloadPolicyFiles", "EmployeeRestController::downloadPolicyFiles"); $routes->post("bulkEcardDownloadAsZip", "EmployeeRestController::bulkEcardDownloadAsZip"); + $routes->get("downloadSampleExcel/(:any)", "EmployeeController::downloadSampleExcelFile/$1"); }); $routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload"); @@ -783,10 +784,10 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails'); //Third party - testing route $routes->get('FhplGetBenefDetails','FhplApiController::FhplGetBenefDetails'); -$routes->get('EcardRequest','FhplApiController::EcardRequest'); +$routes->get('EcardRequest','HealthIndiaApiController::EcardRequest'); $routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork'); $routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails'); -$routes->get('ClaimDetail','FhplApiController::ClaimDetail'); +$routes->get('ClaimDetail','HealthIndiaApiController::ClaimDetail'); $routes->get('SubmitClaim','HealthIndiaApiController::SubmitClaim'); $routes->get('IntimateClaim','MediAssistApiController::IntimateClaim'); $routes->get('IRSubmission','MediAssistApiController::IRSubmission'); diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php index 6f2e8ae2..17320621 100644 --- a/app/Controllers/ApiServiceController.php +++ b/app/Controllers/ApiServiceController.php @@ -64,6 +64,10 @@ class ApiServiceController extends BaseController { // fhpl $fhplApiController = new FhplApiController; return $fhplApiController->SubmitClaim($claimId); + }else if ($tpaID == $this->health_india_primary_key) + { // health india + $healthIndiaApiController = new HealthIndiaApiController; + return $healthIndiaApiController->SubmitClaim($claimId); }else{ log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}"); } @@ -145,6 +149,12 @@ class ApiServiceController extends BaseController $fhplApiController = new FhplApiController; $data['eCardDownload'] = $fhplApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] ); + }else if($employee_policy[0]['tpa_primary_id'] == $this->health_india_primary_key)// health india + { + + $healthIndiaApiController = new HealthIndiaApiController; + $data['eCardDownload'] = $healthIndiaApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] ); + }else{ if($type == "download"){ @@ -292,6 +302,17 @@ class ApiServiceController extends BaseController return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]); + }else if ($tpa_id == $this->health_india_primary_key) // health india + { + $file_id = $fileModel->insert($data); + log_message('error', "Files table inserted successfully, File id : {$file_id}"); + // $healthIndiaApiController = new HealthIndiaApiController; + // $healthIndiaApiController->HealthIndiaGetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] ); + $r = Jobs::addJob(['job_name' => 'HealthIndiaGetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]); + log_message('error', "HealthIndiaGetBenefDetails job pushed successfully."); + + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]); + }else{ return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]); } @@ -328,6 +349,12 @@ class ApiServiceController extends BaseController $res = $fhplApiController->ClaimDetail($claimId); return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]); + }else if ($tpaID == $this->health_india_primary_key) { // health india + + $healthIndiaApiController = new HealthIndiaApiController; + $res = $healthIndiaApiController->ClaimDetail($claimId); + return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]); + }else{ log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}"); $message = "This TPA has no API service enabled"; diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 468e0864..780a56ac 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1036,12 +1036,13 @@ class ClientController extends AdminController // ] // ], 'client_logo' => [ + 'label' => 'Client Logo', 'rules' => 'permit_empty|is_image[client_logo]|max_size[client_logo,200]|ext_in[client_logo,jpg,jpeg,png]|max_dims[client_logo,100,100]', 'errors' => [ - 'is_image' => 'The uploaded file must be an image', - 'max_size' => 'File size should not exceed 200 KB', - 'ext_in' => 'Allowed file types: jpg, jpeg, png', - 'max_dims' => 'Image dimensions must be 100 x 100 pixels', + 'is_image' => 'Please upload a valid image file.', + 'max_size' => 'The logo is too heavy (Max 200KB).', + 'ext_in' => 'Only JPG, JPEG, and PNG files are allowed.', + 'max_dims' => 'The logo must be no larger than 100x100 pixels.', ] ], ]; diff --git a/app/Controllers/HealthIndiaApiController.php b/app/Controllers/HealthIndiaApiController.php index 9ac26461..f10801fb 100644 --- a/app/Controllers/HealthIndiaApiController.php +++ b/app/Controllers/HealthIndiaApiController.php @@ -79,7 +79,7 @@ class HealthIndiaApiController extends BaseController ]); } - public function SubmitClaim($claimId = 515) + public function SubmitClaim($claimId = 729) { helper('api'); @@ -205,7 +205,7 @@ class HealthIndiaApiController extends BaseController $response = call_third_party_api($url, 'POST', $headers, $body); - dd($response); + // dd($response); log_message('error', 'TPA CLAIM PUSH HEALTH_INDIA RESPONSE | claimId: ' . $claimId . ' | response: ' . json_encode($response)); @@ -239,7 +239,7 @@ class HealthIndiaApiController extends BaseController return; } - public function ClaimDetail($claimId = null) + public function ClaimDetail($claimId = 729) { helper('api'); @@ -284,6 +284,8 @@ class HealthIndiaApiController extends BaseController $response = call_third_party_api($url, 'POST', $headers, $body); + // dd($response); + log_message('error', 'CLAIM STATUS HEALTH_INDIA | claimId: ' . $claimId . ' | Response: ' . json_encode($response)); if (empty($response['data']['result'][0])) { @@ -368,9 +370,9 @@ class HealthIndiaApiController extends BaseController $url = getenv('HEALTH_INDIA_BASE_URL') . "/Member/GetMemberEcard"; $body = [ - "policY_NUMBER" => $policyNo, - "employeE_CODE" => $employeeId, - "membeR_ID" => $memberId + "policY_NUMBER" => $policyNo ,//'141600_POLICY_AWAITED', + "employeE_CODE" => $employeeId,//'DECP000', + "membeR_ID" => $memberId//'19662410E', ]; $headers = [ @@ -416,8 +418,8 @@ class HealthIndiaApiController extends BaseController try { helper('api'); - $policyNo = $requestData['policy_no'] ?? '141600_POLICY_AWAITED'; - $client_policy_id = $requestData['client_policy_id'] ?? 6473; + $policyNo = $requestData['policy_no'] ?? null; //'141600_POLICY_AWAITED'; + $client_policy_id = $requestData['client_policy_id'] ?? null; // 6473; @@ -442,24 +444,24 @@ class HealthIndiaApiController extends BaseController log_message('error', "TPA ID PULL HEALTH_INDIA | called for policy_no: {$policyNo}, client_policy_id: {$client_policy_id}"); // Fetch file download dates - // $batchFiles = $this->db->table('batch_files f') - // ->select("f.created_at") - // ->where('f.client_policy_id', $client_policy_id) - // ->where('f.insurer_or_tpa', 'tpa') - // ->where('f.actions', 'export') - // ->get() - // ->getResultArray(); + $batchFiles = $this->db->table('batch_files f') + ->select("f.created_at") + ->where('f.client_policy_id', $client_policy_id) + ->where('f.insurer_or_tpa', 'tpa') + ->where('f.actions', 'export') + ->get() + ->getResultArray(); - // if (empty($batchFiles)) { - // log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request'); - // if ($function_calling_type == "job") { - // return ['status' => false, 'message' => 'batchFiles not found']; - // } else { - // return $this->respond(['status' => false, 'message' => 'batchFiles not found']); - // } - // } + if (empty($batchFiles)) { + log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request'); + if ($function_calling_type == "job") { + return ['status' => false, 'message' => 'batchFiles not found']; + } else { + return $this->respond(['status' => false, 'message' => 'batchFiles not found']); + } + } // Generate Health India Token $tokenResponse = json_decode($this->generateAuthToken()->getBody(), true); @@ -489,9 +491,9 @@ class HealthIndiaApiController extends BaseController $response = call_third_party_api($url, 'POST', $headers, $body); - dd($response); + // dd($response); - log_message('error', "TPA ID PULL HEALTH_INDIA | API Response: " . json_encode($response)); + log_message('error', "TPA ID PULL HEALTH_INDIA | API Response Received "); if (($response['status'] ?? false) !== true) { log_message('error', 'HEALTH_INDIA API FAILED | response: ' . json_encode($response)); @@ -560,11 +562,22 @@ class HealthIndiaApiController extends BaseController $employeePolicyModel = new EmployeePolicyModel(); - $employeePolicyData = $employeePolicyModel - ->join('employees', 'employees.id = employee_polices.employee_id') - ->where('employee_polices.client_policy_id', $client_policy_id) - ->where('employee_polices.tpa_id IS NULL') - ->findAll(); + $employeePolicyData = $employeePolicyModel + ->select(' + employees.*, + employee_polices.id as emp_policy_id, + employee_polices.client_policy_id, + ') + ->join('employees', 'employees.id = employee_polices.employee_id') + ->where('employee_polices.is_active', 1) + ->where('employee_polices.status', 'active') + ->where('employees.is_active', 1) + ->where('employees.emp_status', 'active') + ->where('employee_polices.tpa_id IS NULL') + ->where('employee_polices.client_policy_id', $client_policy_id) + ->findAll(); + // echo (string) $employeePolicyModel->db->getLastQuery(); + // dd($employeePolicyData); $updated = 0; $batch_file_success = 'success'; @@ -575,10 +588,15 @@ class HealthIndiaApiController extends BaseController foreach ($allMembers as $m) { // Match based on: employee name, employee code, and relation + + if($m['relation'] == 'Employee') { $relation = 'self'; } + else if($m['relation'] == 'WIFE') { $relation = 'spouse'; } + else { $relation = $m['relation']; } + if ( strtolower(trim($policy['name'])) === strtolower(trim($m['insured_Name'] ?? '')) && ($policy['emp_code'] ?? '') == ($m['employeeCode'] ?? '') && - strtolower($policy['relationship']) === strtolower($m['relation'] ?? '') + strtolower($policy['relationship']) === strtolower($relation ?? '') ) { $hasMatchForThisPolicy = true; diff --git a/app/Controllers/ICICILombardController.php b/app/Controllers/ICICILombardController.php index e9cbdf32..4d98bc96 100644 --- a/app/Controllers/ICICILombardController.php +++ b/app/Controllers/ICICILombardController.php @@ -121,29 +121,29 @@ class ICICILombardController extends AdminController $body = [ "PolicyNumber" => "4016/PPN/A/O/53185987/00/000", "CDBGAccountNumber" => "CD-MUM-0026", - "CorrelationId" => "550e8400-e29b-41d4-a716-446655440021", + "CorrelationId" => "550e8400-e29b-41d4-a716-446655440022", "MemberDetails" => [ [ - "MemberEmpId" => "EMPID3625564", + "MemberEmpId" => "EMPID3625565", "DOJ" => "21-MAR-2019", - "InsuredName" => "Jeeva", + "InsuredName" => "sanjeev", "DOB" => "7-JUL-1993", "Relationship" => "SELF", "Gender" => "MALE", - "DOC" => '18-Nov-2025', + "DOC" => '25-Jan-2026', "SumInsured" => "500000", - "EmailId" => "Jeeva@GMAIL.COM", + "EmailId" => "sanjeev@GMAIL.COM", "FlagStatus" => "A" ], [ - "MemberEmpId" => "EMPID3625564", + "MemberEmpId" => "EMPID3625565", "DOJ" => "21-MAR-2019", - "InsuredName" => "Muthu", + "InsuredName" => "bhavya", "DOB" => "8-AUG-1970", "Relationship" => "MOTHER", "Gender" => "FEMALE", - "DOC" => '18-Nov-2025', - "EmailId" => "Muthu@GMAIL.COM", + "DOC" => '25-Jan-2026', + "EmailId" => "bhavya@GMAIL.COM", "FlagStatus" => "A" ], ] @@ -180,8 +180,8 @@ class ICICILombardController extends AdminController $body = [ "PolicyNumber" => "4016/PPN/A/O/53185987/00/000", - "BatchId" => "3727144", - "CorrelationId" => "550e8400-e29b-41d4-a716-446655440021" + "BatchId" => "3728144", + "CorrelationId" => "550e8400-e29b-41d4-a716-446655440022" ]; $response = call_third_party_api($url, 'POST', $headers, $body, true); @@ -215,7 +215,7 @@ class ICICILombardController extends AdminController $body = [ "PolicyNumber" => "4016/PPN/A/O/53185987/00/000", "IMID" => "201580517901", - "CorrelationId" => "550e8400-e29b-41d4-a716-446655440020" + "CorrelationId" => "550e8400-e29b-41d4-a716-446655440022" ]; $response = call_third_party_api($url, 'POST', $headers, $body, true); diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index d6ae550f..11338171 100755 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -195,6 +195,10 @@ class JobWorker extends AdminController 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\FhplApiController', ], + 'HealthIndiaGetBenefDetails' => [ + 'type' => 'CC', // Handler Category + 'handler' => 'App\Controllers\HealthIndiaApiController', + ], 'bdsDumpExcelFileFormatValidation' => [ 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\PolicyTransactionController', diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index c09b0e43..b826c277 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -447,7 +447,14 @@ class LeadsController extends BaseController 'status' => [ 'rules' => 'required', 'errors' => ['required' => 'Status is required'] - ] + ], + 'next_reminder_date' => [ + 'label' => 'Next Reminder Date', + 'rules' => 'permit_empty|valid_date[d/m/Y]', + 'errors' => [ + 'valid_date' => 'The {field} must be in the format DD/MM/YYYY.' + ] + ], ]; foreach ($postData as $key => $value) { @@ -465,7 +472,7 @@ class LeadsController extends BaseController // print_r($rules); die; - if (isset($data['lead_form_type']) && (int)$data['lead_form_type'] === 2) { + if ((int)$this->request->getPost('lead_form_type') === 2) { $rules['client_type'] = [ 'rules' => 'required', 'errors' => ['required' => 'Client Type is required'] @@ -482,6 +489,51 @@ class LeadsController extends BaseController 'rules' => 'required', 'errors' => ['required' => 'Date of Expiry is required'] ]; + + if ((int)$this->request->getPost('claim_history') === 1) { + $rules['first_year.*'] = [ + 'rules' => 'required|regex_match[/^\d{4}-\d{4}$/]', + 'errors' => ['required' => 'Claim Year is required for all entries.','regex_match' => 'Year must be in format YYYY-YYYY.'] + ]; + $rules['first_policy_type_.*'] = [ + 'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]', + 'errors' => ['required' => 'Policy Type is required in Claim History.', + 'regex_match' => 'Policy Type only letters, numbers, space, hyphens and underscores are allowed' + ] + ]; + $rules['first_date_of_loss_.*'] = [ + 'rules' => 'required|regex_match[/^[0-9]{2}-[0-9]{2}-[0-9]{4}$/]', + 'errors' => ['required' => 'Date of Loss is required.', + 'regex_match' => 'Date of Loss must be inValid format.'] + ]; + $rules['first_cause_of_loss.*'] = [ + 'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'errors' => [ + 'required' => 'Cause of Loss is required.', + 'regex_match' => 'Cause of Loss only letters, numbers, space, hyphens and underscores are allowed' + ] + ]; + $rules['first_claim_amount.*'] = [ + 'rules' => 'required|numeric', + 'errors' => [ + 'required' => 'Claim Amount is required.', + 'numeric' => 'Claim Amount must be a number.' + ] + ]; + $rules['first_settled_amount.*'] = [ + 'rules' => 'required|numeric', + 'errors' => ['required' => 'Settled Amount is required.', + 'numeric' => 'Settled Amount must be a number.'] + ]; + $rules['first_claim_status.*'] = [ + 'rules' => 'required|alpha_space', + 'errors' => [ + 'required' => 'Claim Status is required.', + 'alpha_space' => 'Claim Status should only contain letters and spaces.' + ] + ]; + } + } // 1. MANUALLY VALIDATE FILES BEFORE PROCESSING @@ -516,7 +568,41 @@ class LeadsController extends BaseController // } // } - if (!$this->validate($rules)) { + + $isValid = $this->validate($rules); + + $start_dates = $this->request->getPost('policy_start_date'); + $end_dates = $this->request->getPost('policy_end_date'); + + if ($start_dates && $end_dates) { + + $starts = is_array($start_dates) ? $start_dates : [$start_dates]; + $ends = is_array($end_dates) ? $end_dates : [$end_dates]; + + foreach ($starts as $index => $s_date) { + $e_date = $ends[$index] ?? null; + + if ($s_date && $e_date) { + + $f_start = change_date_format($s_date, 'd/m/Y', 'Y-m-d'); + $f_end = change_date_format($e_date, 'd/m/Y', 'Y-m-d'); + + if ($f_start && $f_end && ($f_end < $f_start)) { + $isValid = false; + + // Determine the error key name + // If it's an array, we use index (e.g., policy_end_date.0) + $errorKey = is_array($start_dates) ? "policy_end_date.$index" : "policy_end_date"; + + $this->validator->setError($errorKey, 'Date of Expiry cannot be before Date of Commencement.'); + } + } + } + } + + + if (!$isValid) { + return $this->response->setStatusCode(400)->setJSON([ 'status' => false, 'message' => 'Input validation failed', @@ -715,9 +801,13 @@ class LeadsController extends BaseController $data['source_policy_end_date'] = null; } - //convert the date - if (!empty($data['next_reminder_date'])) { - $data['next_reminder_date'] = change_date_format($data['next_reminder_date']); + // convert the date + // Clean the input and handle empty strings + $reminderDate = trim($data['next_reminder_date'] ?? ''); + + if ($reminderDate !== '' && $reminderDate != null && $reminderDate != 0) { + $convertedDate = change_date_format($reminderDate); + $data['next_reminder_date'] = $convertedDate ?: null; } else { $data['next_reminder_date'] = null; } diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 838c646e..e390e00d 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1052,7 +1052,47 @@ class PolicyTransactionController extends BaseController 'exp_amt.*' => ['label' => 'Expected Amount', 'rules' => 'permit_empty|decimal', 'errors' => ['decimal' => 'The Expected Amount field must contain a valid number.']] ]; - if (!$this->validate($rules)) { + + $isValid = $this->validate($rules); + + // $Date_of_commencement = $this->request->getPost('policy_start_date'); + // $Date_of_expiry = $this->request->getPost('policy_end_date'); + + // if ($Date_of_commencement && $Date_of_expiry && ($Date_of_expiry < $Date_of_commencement)) { + // $this->validator->setError('policy_end_date', '$Date of Commencement and Date of Expiry are mismatched (Date of Expiry cannot be before $Date of Commencement).'); + // $isValid = false; + // } + + $start_dates = $this->request->getPost('policy_start_date'); + $end_dates = $this->request->getPost('policy_end_date'); + + if ($start_dates && $end_dates) { + // Standardize: If it's a single string (Type 2), wrap it in an array + $starts = is_array($start_dates) ? $start_dates : [$start_dates]; + $ends = is_array($end_dates) ? $end_dates : [$end_dates]; + + foreach ($starts as $index => $s_date) { + $e_date = $ends[$index] ?? null; + + if ($s_date && $e_date) { + + $f_start = change_date_format($s_date, 'Y-m-d', 'Y-m-d'); // be carefully here we made so many times mistakes on here + $f_end = change_date_format($e_date, 'Y-m-d', 'Y-m-d');// be carefully here we made so many times mistakes on here + + if ($f_start && $f_end && ($f_end < $f_start)) { + $isValid = false; + + // Determine the error key name + // If it's an array, we use index (e.g., policy_end_date.0) + $errorKey = is_array($start_dates) ? "policy_end_date.$index" : "policy_end_date"; + + $this->validator->setError($errorKey, 'D.O.E(Date of Expiry) cannot be before D.O.C(Date of Commencement).'); + } + } + } + } + + if (!$isValid) { return $this->response->setStatusCode(400)->setJSON([ 'status' => false, 'message' => 'Input validation failed', diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index b1d2ab8a..055a0e33 100755 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -221,6 +221,7 @@ input:checked + .slider:before { $(document).ready(function() { $('#client_logo').change(function() { validateFile(this); + return; }); $('#parent_client_id').select2(); }); diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index 8f5a82f8..6456935a 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -1027,7 +1027,7 @@
- $year"; @@ -1036,27 +1036,27 @@
- +
- +
- +
- +
- +
- +
@@ -1072,6 +1072,16 @@ referenceDiv.insertAdjacentHTML('beforeend', claimsFields); + let isChecked = $("#claim_history").length > 0 ? $("#claim_history").prop("checked") : true; + let lastRow = $(".claim-row").last(); + if (isChecked) { + lastRow.show(); + lastRow.find(".claim-input").attr("required", true); + } else { + lastRow.hide(); + lastRow.find(".claim-input").removeAttr("required"); + } + // Increment claim index increment = increment + 1; @@ -1143,9 +1153,15 @@ // No rows yet, so create them appendThreeYearsClaims(); } + $(".claim-input").attr("required", true); } else { $(".claim-row").hide(); + $(".claim-input").removeAttr("required"); // Required Attributes Remove + $(".claim-input").val(""); // Value Reset + $(".claim-input").each(function() { + $(this).parsley().reset(); // Validation Reset + }); } }