Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
a2f85d77ac
@ -213,7 +213,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post("create", "MasterController::createCDMasterData");
|
$routes->post("create", "MasterController::createCDMasterData");
|
||||||
$routes->post("edit", "MasterController::editCDMasterData");
|
$routes->post("edit", "MasterController::editCDMasterData");
|
||||||
$routes->get("list/(:any)", "MasterController::getCDMasterDataByID/$1");
|
$routes->get("list/(:any)", "MasterController::getCDMasterDataByID/$1");
|
||||||
// $routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
|
$routes->get("remove/(:any)", "MasterController::removeCDMaster/$1");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -248,6 +248,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("check_policy_type/(:any)", "ClientController::checkPolicyType/$1");
|
$routes->get("check_policy_type/(:any)", "ClientController::checkPolicyType/$1");
|
||||||
$routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
$routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
||||||
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
||||||
|
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||||
@ -271,9 +272,9 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||||
|
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
||||||
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
||||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||||
@ -304,6 +305,9 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
118
app/Controllers/ChatBotController.php
Normal file
118
app/Controllers/ChatBotController.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
use App\Helpers\sendMailNotification;
|
||||||
|
|
||||||
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
use App\Models\ClientModel;
|
||||||
|
use App\Models\ClientRMModel;
|
||||||
|
use App\Models\PolicesModel;
|
||||||
|
use App\Models\RelationshipModel;
|
||||||
|
use App\Models\FileModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\PolicyPremium1Model;
|
||||||
|
use App\Models\PolicyPremium2Model;
|
||||||
|
use App\Models\PolicyTypeModel;
|
||||||
|
use App\Models\NotificationModel;
|
||||||
|
use App\Models\UserModel;
|
||||||
|
use App\Models\FEContentModel;
|
||||||
|
use App\Models\AddImgModel;
|
||||||
|
use App\Models\ChatBotModel;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
class ChatBotController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
protected $myLogger;
|
||||||
|
protected $employeeModel;
|
||||||
|
protected $employeePolicyModel;
|
||||||
|
protected $clientModel;
|
||||||
|
protected $clientRMModel;
|
||||||
|
protected $fileModel;
|
||||||
|
protected $policesModel;
|
||||||
|
protected $relationshipModel;
|
||||||
|
protected $clientPolicyModel;
|
||||||
|
protected $policyPremium1Model;
|
||||||
|
protected $policyPremium2Model;
|
||||||
|
protected $policyTypeModel;
|
||||||
|
protected $notificationModel;
|
||||||
|
protected $userModel;
|
||||||
|
protected $feContentModel;
|
||||||
|
protected $addImgModel;
|
||||||
|
protected $ChatBotModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
set_session_context('Employee');
|
||||||
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
|
$this->employeeModel = new EmployeeModel();
|
||||||
|
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||||
|
$this->clientModel = new ClientModel();
|
||||||
|
$this->clientRMModel = new ClientRMModel();
|
||||||
|
$this->policesModel = new PolicesModel();
|
||||||
|
$this->relationshipModel = new RelationshipModel();
|
||||||
|
$this->fileModel= new FileModel();
|
||||||
|
$this->clientPolicyModel = new ClientPolicyModel();
|
||||||
|
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||||
|
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||||
|
$this->policyTypeModel = new PolicyTypeModel();
|
||||||
|
$this->notificationModel = new NotificationModel();
|
||||||
|
$this->userModel = new UserModel();
|
||||||
|
$this->feContentModel = new FEContentModel();
|
||||||
|
$this->addImgModel = new AddImgModel();
|
||||||
|
$this->ChatBotModel = new ChatBotModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getChatResponse()
|
||||||
|
{
|
||||||
|
// try {
|
||||||
|
$request_for = $this->request->getGet('request_for');
|
||||||
|
$option = $this->request->getGet('option');
|
||||||
|
|
||||||
|
$requestData = $this->ChatBotModel->where('request', $request_for)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($requestData) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($option != 0){
|
||||||
|
|
||||||
|
$decodedData = json_decode($requestData['options'],true);
|
||||||
|
|
||||||
|
$requestFor = $decodedData[$request_for][$option];
|
||||||
|
|
||||||
|
$requestData = $this->ChatBotModel->where('request', $requestFor)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = ['request_for'=>$requestData['request'],'options'=>json_decode($requestData['options'],true)];
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
|
||||||
|
}
|
||||||
|
// } catch (\Throwable $th) {
|
||||||
|
// return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -301,9 +301,9 @@ class ClientController extends AdminController
|
|||||||
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
|
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
|
||||||
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||||
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||||
// dd('Hi');
|
$editData['client_branch']['role'] = get_role_id();
|
||||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
||||||
// dd($this->clientPolicyModel->getLastQuery());
|
|
||||||
foreach ($clientPoliceData as $key => $value) {
|
foreach ($clientPoliceData as $key => $value) {
|
||||||
|
|
||||||
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
||||||
@ -311,12 +311,10 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$editData['client_policy'] = $clientPoliceData;
|
$editData['client_policy'] = $clientPoliceData;
|
||||||
|
|
||||||
|
|
||||||
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
||||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||||
|
|
||||||
|
// dd($editData);
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('client_onboarding', $editData);
|
echo view('client_onboarding', $editData);
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
@ -565,6 +563,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
if($insert){
|
if($insert){
|
||||||
$branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll();
|
$branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll();
|
||||||
|
$branchData['role'] = get_role_id();
|
||||||
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
|
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||||
@ -1907,7 +1906,7 @@ class ClientController extends AdminController
|
|||||||
"sum_insured" => "Sum Insured",
|
"sum_insured" => "Sum Insured",
|
||||||
"family_floater" => "Family Floater",
|
"family_floater" => "Family Floater",
|
||||||
"family_floaters" => "Family Floaters",
|
"family_floaters" => "Family Floaters",
|
||||||
"member_count" => "Elders Count:",
|
"elders_count" => "Elders Count:",
|
||||||
"other_member_min_age" => "Min Age:",
|
"other_member_min_age" => "Min Age:",
|
||||||
"other_member_max_age" => "Min Age:",
|
"other_member_max_age" => "Min Age:",
|
||||||
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
||||||
@ -2068,18 +2067,26 @@ class ClientController extends AdminController
|
|||||||
$transformedData[$mapping[$key]] = $value;
|
$transformedData[$mapping[$key]] = $value;
|
||||||
} else if ($key == 'special_condition_label') {
|
} else if ($key == 'special_condition_label') {
|
||||||
|
|
||||||
|
if (is_array($value)) {
|
||||||
foreach ($value as $key => $value) {
|
foreach ($value as $key => $value) {
|
||||||
$transformedData[$value] = $data['special_condition_input'][$key];
|
$transformedData[$value] = $data['special_condition_input'][$key];
|
||||||
}
|
}
|
||||||
} else if ($key == 'gpa_special_condition_label') {
|
}
|
||||||
|
|
||||||
|
} else if ($key == 'gpa_special_condition_label') {
|
||||||
|
if (is_array($value)) {
|
||||||
foreach ($value as $key => $value) {
|
foreach ($value as $key => $value) {
|
||||||
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else if ($key == 'other_special_condition_label') {
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $key => $value) {
|
||||||
|
$transformedData[$value] = $data['other_special_condition_label'][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if ($key == 'age_ratio') {
|
} else if ($key == 'age_ratio') {
|
||||||
|
|
||||||
if (isset($data['sumInsured2'])) {
|
if (isset($data['sumInsured2'])) {
|
||||||
|
|
||||||
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2199,7 +2206,7 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function checkPolicyType($client_policy_id, $policy_type_id, $client_branch_id, $client_id){
|
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id){
|
||||||
|
|
||||||
$policyCount = $this->clientPolicyModel
|
$policyCount = $this->clientPolicyModel
|
||||||
->where('policy_type_id', $policy_type_id)
|
->where('policy_type_id', $policy_type_id)
|
||||||
@ -2217,24 +2224,53 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyTerms($client_policy_id){
|
public function getPolicyTerms($client_policy_id)
|
||||||
|
{
|
||||||
$policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
|
||||||
if(isset($policy_terms['policy_terms']) && $policy_terms['policy_terms'] != null){
|
if (!$policy_terms) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Policy not found'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($policy_terms)) {
|
||||||
|
if (!isset($policy_terms['policy_terms'])) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Policy terms not found in array'], 500);
|
||||||
|
}
|
||||||
$JSON = json_decode($policy_terms['policy_terms']);
|
$JSON = json_decode($policy_terms['policy_terms']);
|
||||||
$si = $JSON->sum_insured ?? $JSON->sumInsured2;
|
} elseif (is_object($policy_terms)) {
|
||||||
$multi_si = $JSON->multiple_sum_insured;
|
if (!isset($policy_terms->policy_terms)) {
|
||||||
$multi_si[] = $si;
|
return $this->respond(['status' => false, 'error' => 'Policy terms not found in object'], 500);
|
||||||
|
}
|
||||||
|
$JSON = json_decode($policy_terms->policy_terms);
|
||||||
} else {
|
} else {
|
||||||
$$multi_si = [];
|
return $this->respond(['status' => false, 'error' => 'Unexpected data type for policy terms'], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$JSON) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Invalid JSON format in policy terms'], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
$multi_si = [];
|
||||||
|
|
||||||
|
if (isset($JSON->sum_insured) && !empty($JSON->sum_insured)) {
|
||||||
|
$multi_si[] = $JSON->sum_insured;
|
||||||
|
} elseif (isset($JSON->sumInsured2) && !empty($JSON->sumInsured2)) {
|
||||||
|
$multi_si[] = $JSON->sumInsured2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($JSON->multiple_sum_insured) && is_array($JSON->multiple_sum_insured)) {
|
||||||
|
foreach ($JSON->multiple_sum_insured as $msi) {
|
||||||
|
if (!empty($msi)) {
|
||||||
|
$multi_si[] = $msi;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'data' => $multi_si], 200);
|
return $this->respond(['status' => true, 'data' => $multi_si], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyTermsFormJson($policy_type_id){
|
public function getPolicyTermsFormJson($policy_type_id){
|
||||||
|
|
||||||
$JSON = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
$JSON = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||||
@ -2246,4 +2282,24 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkHRNumber($mobileNumber)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$mobileNumberCount = $this->levelContactModel
|
||||||
|
->join('client_branch', 'client_branch.id = level_contacts.ref_id')
|
||||||
|
->join('clients', 'clients.id = client_branch.client_id')
|
||||||
|
->where('clients.is_active', 1)
|
||||||
|
->where('client_branch.is_active', 1)
|
||||||
|
->where('level_contacts.is_active', 1)
|
||||||
|
->where('level_contacts.contact_type', 'client')
|
||||||
|
->where('level_contacts.mobile', $mobileNumber)
|
||||||
|
->countAllResults();
|
||||||
|
return $this->respond(['status' => true, 'data' => $mobileNumberCount, 'message' => "try"], 200);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', 'Error checking mobile number: ' . $e->getMessage());
|
||||||
|
return $this->respond(['status' => false, 'data' => 0, 'message' => 'An error occurred while checking the mobile number. Please try again later.'], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -140,15 +140,30 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// Fetch employee data for export from the database
|
// Fetch employee data for export from the database
|
||||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
||||||
$insurer_id = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||||
$cash_balance = $this->clientDepositModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
|
|
||||||
|
// dd($export_data, $policy_details['cd_ac_no']);
|
||||||
|
|
||||||
|
if ($policy_details['cd_ac_no'] == null) {
|
||||||
|
// dd("The policy does not have a CD account number");
|
||||||
|
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cash_balance = $this->clientDepositModel->where('cd_ac_no', $policy_details['cd_ac_no'])->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
if ($cash_balance == null) {
|
if ($cash_balance == null) {
|
||||||
|
|
||||||
$balance = $this->CDMasterModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
|
$balance = $this->CDMasterModel
|
||||||
|
->where('client_id', $export_data['client_id'])
|
||||||
|
->where('insurer_id', $policy_details['insurer_id'])
|
||||||
|
->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||||
|
->first();
|
||||||
|
|
||||||
$cash_balance['balance'] = $balance['opening_bal'];
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dd($cash_balance);
|
||||||
|
|
||||||
// Calculate the total amount from the objects
|
// Calculate the total amount from the objects
|
||||||
$totals = array_reduce($objects, function ($carry, $item) {
|
$totals = array_reduce($objects, function ($carry, $item) {
|
||||||
@ -160,7 +175,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
if (!empty($cash_balance)) {
|
if (!empty($cash_balance)) {
|
||||||
|
|
||||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||||
return 0;
|
return 0;
|
||||||
@ -363,6 +377,26 @@ class EmpDataServiceController extends BaseController
|
|||||||
$ids = [];
|
$ids = [];
|
||||||
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
||||||
|
|
||||||
|
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||||
|
|
||||||
|
if ($policy_details['cd_ac_no'] == null) {
|
||||||
|
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cash_balance = $this->clientDepositModel->where('cd_ac_no', $policy_details['cd_ac_no'])->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
|
if ($cash_balance == null) {
|
||||||
|
|
||||||
|
$balance = $this->CDMasterModel
|
||||||
|
->where('client_id', $export_data['client_id'])
|
||||||
|
->where('insurer_id', $policy_details['insurer_id'])
|
||||||
|
->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$totals = 0;
|
$totals = 0;
|
||||||
foreach ($objects as $obj) {
|
foreach ($objects as $obj) {
|
||||||
@ -374,6 +408,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($ids); die;
|
// print_r($ids); die;
|
||||||
|
|
||||||
|
if (!empty($cash_balance)) {
|
||||||
|
if ((int) $cash_balance['balance'] < (int) $rounded_totals) {
|
||||||
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||||
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
$export_data['count'] = $count;
|
$export_data['count'] = $count;
|
||||||
$export_data['amount'] = $rounded_totals;
|
$export_data['amount'] = $rounded_totals;
|
||||||
@ -545,7 +587,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//not in use
|
||||||
public function generateExcelForAdditionAndDependentAddition($export_data)
|
public function generateExcelForAdditionAndDependentAddition($export_data)
|
||||||
{
|
{
|
||||||
$ids = [];
|
$ids = [];
|
||||||
@ -628,7 +670,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//end not in use
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The below functions are Imports data from an Excel file for :
|
* The below functions are Imports data from an Excel file for :
|
||||||
@ -2788,7 +2830,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
//Endorsement Addition and Dependent Addition
|
//Endorsement Addition and Dependent Addition
|
||||||
|
|
||||||
|
//not in use
|
||||||
public function AdditionAndDependentAddition($params)
|
public function AdditionAndDependentAddition($params)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -3179,6 +3221,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//end not in use
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The below functions are Calculates and records cash deposits for employee policies at inception.
|
* The below functions are Calculates and records cash deposits for employee policies at inception.
|
||||||
|
|||||||
@ -79,13 +79,16 @@ class EmployeeController extends AdminController
|
|||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||||
client_id: $filterData['client_id'],
|
client_id: $filterData['client_id'],
|
||||||
policy_id: $filterData['policy_id'],
|
policy_id: $filterData['policy_id'],
|
||||||
|
branch_id: $filterData['branch_id'],
|
||||||
|
emp_code : $filterData['emp_code'],
|
||||||
|
emp_name : $filterData['emp_name'],
|
||||||
status : $filterData['status'],
|
status : $filterData['status'],
|
||||||
branch_id: $filterData['branch_id']
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$data['getData'] = $filterData;
|
$data['getData'] = $filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dd($this->request->getGet());
|
||||||
$this->myLogger->logme('error', 'list called');
|
$this->myLogger->logme('error', 'list called');
|
||||||
$this->loadLayout('employee_list', $data);
|
$this->loadLayout('employee_list', $data);
|
||||||
}
|
}
|
||||||
@ -408,10 +411,15 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||||
|
|
||||||
if ($return == 0) {
|
if ($return === 0) {
|
||||||
|
|
||||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
|
||||||
|
}else if($return === 5){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
@ -439,10 +447,14 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForSIEnhancement($batch_data);
|
$return = $empDataServiceController->generateExcelForSIEnhancement($batch_data);
|
||||||
|
|
||||||
if ($return == 0) {
|
if ($return === 0) {
|
||||||
|
|
||||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}else if($return === 5){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
@ -1056,33 +1068,34 @@ class EmployeeController extends AdminController
|
|||||||
public function viewECard()
|
public function viewECard()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->loadLayout('ecard_template/default_ecard');
|
// $this->loadLayout('ecard_template/default_ecard');
|
||||||
|
|
||||||
// Load the session library if it's not autoloaded
|
$empDataServiceController = new EmpDataServiceController();
|
||||||
// $session = \Config\Services::session();
|
$file_name = generate_filename("TCS", 'inception', 'export', 'insurer', 'policy', 'branch');
|
||||||
|
|
||||||
// Access session data
|
$batch_data = [
|
||||||
$sessionData = session()->get();
|
'client_id' => 12,
|
||||||
|
'client_policy_id' => 12,
|
||||||
|
'client_branch_id' => 1,
|
||||||
|
'insurer_or_tpa' => 'insurer',
|
||||||
|
'event_type' => 'inception',
|
||||||
|
'actions' => 'export',
|
||||||
|
'file_name' => $file_name,
|
||||||
|
];
|
||||||
|
|
||||||
// Check if session data exists and if expiration time is set
|
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||||
if (!empty($sessionData) && isset($sessionData['isLoggedIn']) && isset($sessionData['session_expiration'])) {
|
|
||||||
// Get the session expiration timestamp
|
|
||||||
$expirationTimestamp = $sessionData['session_expiration'];
|
|
||||||
|
|
||||||
// Get the current timestamp
|
if ($return == 0) {
|
||||||
$currentTimestamp = time();
|
|
||||||
|
|
||||||
// Check if the current time is greater than the expiration time
|
dd('error', "Insufficient deposit amount.");
|
||||||
if ($currentTimestamp > $expirationTimestamp) {
|
|
||||||
// Session has expired
|
}else if($return == 1){
|
||||||
echo "Session has expired";
|
|
||||||
} else {
|
dd('error', "The policy does not have a CD account number.");
|
||||||
// Session is active
|
|
||||||
echo "Session is active";
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Session data is not set or session is not started
|
if (!$return) {
|
||||||
echo "Session is not started or data is not set";
|
dd('error', "No data was found");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1123,13 +1123,7 @@ class MasterController extends AdminController
|
|||||||
public function CDMasterList()
|
public function CDMasterList()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['CD_Master_Data'] = $this->CDMasterModel
|
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
||||||
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name as insurer_name, user_profiles.first_name as user_name')
|
|
||||||
->join('clients', 'clients.id = cd_master.client_id')
|
|
||||||
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
|
||||||
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
|
||||||
->where('cd_master.is_active', 1)
|
|
||||||
->findAll();
|
|
||||||
$data['insurers'] = $this->insurerModel->findAll();
|
$data['insurers'] = $this->insurerModel->findAll();
|
||||||
$data['clients'] = $this->clientModel->findAll();
|
$data['clients'] = $this->clientModel->findAll();
|
||||||
$this->loadLayout('cd_master_list', $data);
|
$this->loadLayout('cd_master_list', $data);
|
||||||
@ -1217,4 +1211,18 @@ class MasterController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function removeCDMaster($id){
|
||||||
|
|
||||||
|
$this->myLogger->logme('error','CDMaster Remove function called');
|
||||||
|
$data['updated_by'] = get_session_userid();
|
||||||
|
$data['is_active'] = 0;
|
||||||
|
$update = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
||||||
|
if($update){
|
||||||
|
return $this->respond(['status' => true,'code' => 200], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false,'code' => 404], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ class DepositHelper
|
|||||||
public static function saveDeposit(array $data, int $loggedInUserID): array
|
public static function saveDeposit(array $data, int $loggedInUserID): array
|
||||||
{
|
{
|
||||||
// Retrieve the last known balance
|
// Retrieve the last known balance
|
||||||
$lastBalance = self::calculateLastBalance($data['client_id'], $data['insurer_id']);
|
$lastBalance = self::calculateLastBalance($data['client_id'], $data['insurer_id'], $data['cd_ac_no']);
|
||||||
|
|
||||||
// Calculate the new balance based on the transaction type
|
// Calculate the new balance based on the transaction type
|
||||||
$newBalance = self::calculateBalance(
|
$newBalance = self::calculateBalance(
|
||||||
@ -87,24 +87,26 @@ class DepositHelper
|
|||||||
*
|
*
|
||||||
* @return float The last known balance.
|
* @return float The last known balance.
|
||||||
*/
|
*/
|
||||||
public static function calculateLastBalance(int $clientId, int $insurerId): float
|
public static function calculateLastBalance(int $clientId, int $insurerId, $cd_ac_no): float
|
||||||
{
|
{
|
||||||
$model = new ClientDepositModel();
|
$model = new ClientDepositModel();
|
||||||
|
|
||||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||||
$getLastBalanceParams = [$clientId, $insurerId];
|
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||||
|
|
||||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance;
|
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? ORDER BY created_at DESC LIMIT 1";
|
||||||
|
$getLastBalanceParams = [$cd_ac_no];
|
||||||
|
|
||||||
if(!$lastBalance){
|
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? null;
|
||||||
|
|
||||||
|
if(empty($lastBalance) && $lastBalance == null){
|
||||||
|
|
||||||
$cd_model = new ClientDepositModel();
|
$cd_model = new ClientDepositModel();
|
||||||
|
|
||||||
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? ORDER BY created_at DESC LIMIT 1";
|
||||||
$getLastBalanceParams = [$clientId, $insurerId];
|
$getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
|
||||||
|
|
||||||
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $lastBalance;
|
return $lastBalance;
|
||||||
|
|||||||
@ -239,3 +239,12 @@ if (!function_exists('get_username')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('get_role_id')) {
|
||||||
|
function get_role_id() {
|
||||||
|
|
||||||
|
$role_id = get_session_userdata()->role;
|
||||||
|
return $role_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -61,4 +61,26 @@ class CDMasterModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCDMasterList(){
|
||||||
|
|
||||||
|
$query = $this->db->table('cd_master')
|
||||||
|
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count')
|
||||||
|
->join('clients', 'clients.id = cd_master.client_id')
|
||||||
|
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
||||||
|
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
||||||
|
->join(
|
||||||
|
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
|
||||||
|
FROM cd_master
|
||||||
|
JOIN client_policy ON client_policy.cd_ac_no = cd_master.cd_ac_no
|
||||||
|
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts',
|
||||||
|
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
|
||||||
|
'left'
|
||||||
|
)
|
||||||
|
->where('cd_master.is_active', 1)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
22
app/Models/ChatBotModel.php
Normal file
22
app/Models/ChatBotModel.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ChatBotModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'chat_bot';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
"id",
|
||||||
|
"request",
|
||||||
|
"options",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"is_active",
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -77,12 +77,14 @@ class ClientPolicyModel extends Model
|
|||||||
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
||||||
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
||||||
->select('policy_type.policy_type as policy_type_name')
|
->select('policy_type.policy_type as policy_type_name')
|
||||||
|
->select('client_branch.branch_name as branch_name')
|
||||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||||
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
||||||
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
||||||
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left')
|
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||||
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
->where('client_policy.client_id', $client_id)
|
->where('client_policy.client_id', $client_id)
|
||||||
->where('client_policy.policy_status', 1)
|
->where('client_policy.policy_status', 1)
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
|
|||||||
@ -76,31 +76,68 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id,$policy_id,$status,$branch_id)
|
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="")
|
||||||
{
|
{
|
||||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
|
||||||
|
$result = $this->select([
|
||||||
|
'employee_polices.*',
|
||||||
|
'pm.name as policy_name',
|
||||||
|
'im.short_name as insurer_short_name',
|
||||||
|
'ib.branch_name as insurer_branch_name',
|
||||||
|
'ib.branch_code as insurer_branch_code',
|
||||||
|
'tpam.name as tpa_name',
|
||||||
|
'tpam.short_name as tpa_short_name',
|
||||||
|
'tpab.branch_code as tpa_branch_code',
|
||||||
|
'cm.client_name',
|
||||||
|
'cm.short_name as client_short_name',
|
||||||
|
'emp.relationship',
|
||||||
|
'emp.relationship_code',
|
||||||
|
'emp.change_event',
|
||||||
|
'emp.emp_code',
|
||||||
|
'emp.name',
|
||||||
|
'emp.email_corporate',
|
||||||
|
'emp.dob',
|
||||||
|
'emp.gender',
|
||||||
|
'emp.emp_status',
|
||||||
|
'emp.is_active as emp_is_active',
|
||||||
|
'emp.mobile as mobile'
|
||||||
|
])
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
|
->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
|
||||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
|
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch
|
||||||
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id','left') //tpab - tpa brach
|
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
|
||||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||||
->where('emp.client_id',$client_id)
|
->orderBy('emp.emp_code', 'ASC')
|
||||||
->where('emp.client_branch_id',$branch_id)
|
->orderBy('employee_polices.employee_id', 'ASC');
|
||||||
->where('employee_polices.is_active',1)
|
|
||||||
->where('emp.is_active',1)
|
|
||||||
->where('employee_polices.client_policy_id',$policy_id)
|
|
||||||
->orderBy('emp.emp_code','ASC')->orderBy('employee_polices.employee_id','ASC');
|
|
||||||
|
|
||||||
|
|
||||||
|
// Conditionally add where clauses
|
||||||
|
if ($client_id !=0 && !empty($client_id)) {
|
||||||
|
$result->where('emp.client_id', $client_id);
|
||||||
|
}
|
||||||
|
if ($branch_id !=0 && !empty($branch_id)) {
|
||||||
|
$result->where('emp.client_branch_id', $branch_id);
|
||||||
|
}
|
||||||
|
if ($policy_id !=0 && !empty($policy_id)) {
|
||||||
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
|
}
|
||||||
if ($status !=0 && !empty($status)) {
|
if ($status !=0 && !empty($status)) {
|
||||||
$result->where('employee_polices.status', $status);
|
$result->where('employee_polices.status', $status);
|
||||||
}
|
}
|
||||||
|
if (!empty($emp_code)) {
|
||||||
|
$result->where('emp.emp_code', $emp_code);
|
||||||
|
}
|
||||||
|
if (!empty($emp_name)) {
|
||||||
|
$result->like('emp.name', $emp_name);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $result->findAll();
|
// Always check these conditions
|
||||||
return ($result);
|
$result->where('employee_polices.is_active', 1)
|
||||||
|
->where('emp.is_active', 1);
|
||||||
|
|
||||||
|
return $result->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -58,12 +58,12 @@ table.dataTable thead th {
|
|||||||
<?php echo $row['user_name']; ?></td>
|
<?php echo $row['user_name']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
<a href="javascript: void(0);"
|
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
|
||||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<?php if($row['cd_ac_no_count'] == 0) { ?>
|
||||||
|
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeCDMaster(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -290,4 +290,50 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function removeCDMaster(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this CD.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
var id = element.getAttribute('data-id');
|
||||||
|
var form_action = '<?= base_url("master/cash_deposite/remove/") ?>' + id;
|
||||||
|
$.ajax({
|
||||||
|
url: form_action,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(res) {
|
||||||
|
// console.log(res.status == true);
|
||||||
|
if(res){
|
||||||
|
if (res.status == true) {
|
||||||
|
toastr.success('CD removed successfully.', 'success');
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
toastr.warning('Failed to remove CD.', 'warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.log('Something Wrong!', 'warning');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1,7 +1,8 @@
|
|||||||
<div class="tab-pane fade" id="branch-tab">
|
<div class="tab-pane fade" id="branch-tab">
|
||||||
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
|
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span
|
||||||
|
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive" id="branch_table">
|
<div class="table-responsive" id="branch_table">
|
||||||
@ -23,34 +24,35 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||||
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
<button type="button" id="btnBranchBack"
|
||||||
|
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list"
|
||||||
|
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<form role="form" class="parsley-examples" method="post" id="branch_form"
|
<form role="form" class="parsley-examples" method="post" id="branch_form" enctype="multipart/form-data">
|
||||||
enctype="multipart/form-data">
|
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="client_id" id="client_id_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
<input type="hidden" name="client_id" id="client_id_branch"
|
||||||
|
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_name">Branch Name<span class="text-danger">*</span></label>
|
<label for="branch_name">Branch Name<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="branch_name" placeholder="Enter Branch Name" name="branch_name" required>
|
<input type="text" class="form-control" id="branch_name" placeholder="Enter Branch Name"
|
||||||
|
name="branch_name" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_code">Branch Code<span
|
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input type="text" class="form-control" id="branch_code" placeholder="Enter Branch Code"
|
||||||
<input type="text" class="form-control" id="branch_code"
|
name="branch_code" required>
|
||||||
placeholder="Enter Branch Code" name="branch_code" required>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="state">State<span
|
<label for="state">State<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
|
||||||
<select class="form-control" id="state" name="state" required>
|
<select class="form-control" id="state" name="state" required>
|
||||||
<option value="">Select State</option>
|
<option value="">Select State</option>
|
||||||
<?php foreach($state as $value) { ?>
|
<?php foreach($state as $value) { ?>
|
||||||
@ -59,16 +61,14 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="district">District<span
|
<label for="district">District<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input type="text" class="form-control" id="district" placeholder="Enter District"
|
||||||
<input type="text" class="form-control" id="district"
|
name="district" required>
|
||||||
placeholder="Enter District" name="district" required>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="city">City<span
|
<label for="city">City<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input type="text" class="form-control" id="branch_city" placeholder="Enter City"
|
||||||
<input type="text" class="form-control" id="branch_city"
|
name="city" required>
|
||||||
placeholder="Enter City" name="city" required>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -79,26 +79,37 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="first_name">Name<span class="text-danger">*</span></label>
|
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Name"
|
||||||
|
name="name[]" id="name" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
<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" required>
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
||||||
|
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
|
||||||
|
name="mobile[]" id="mobile" onchange="checkMobileNumber(this)"
|
||||||
|
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
||||||
|
data-parsley-type-message="Please enter a valid 10-digit mobile number."
|
||||||
|
data-parsley-required-message="Please enter a valid 10-digit mobile number."
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="designation">Designation<span class="text-danger">*</span></label>
|
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
|
<input value="" type="text" class="form-control" placeholder="Enter Designation Name"
|
||||||
|
name="designation[]" id="designation" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="display: flex;">
|
<div class="form-group" style="display: flex;">
|
||||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="add">Add Contact</button>
|
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac"
|
||||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="remove_btn">Remove</button>
|
onclick="appendContactHtml()" id="add">Add Contact</button>
|
||||||
|
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)"
|
||||||
|
id="remove_btn">Remove</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
@ -119,7 +130,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var branch_form_action = '';
|
var branch_form_action = '';
|
||||||
var contactCount = 1;
|
var contactCount = 1;
|
||||||
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||||
@ -135,7 +145,13 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
var branchTable = '';
|
var branchTable = '';
|
||||||
var data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
|
var data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
|
||||||
|
var role = data.role
|
||||||
|
delete data.role;
|
||||||
|
console.log(role)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
if(role != 3 && role != 4){
|
||||||
|
|
||||||
branchTable += `
|
branchTable += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.branch_name}</td>
|
<td>${item.branch_name}</td>
|
||||||
@ -143,10 +159,22 @@ $(document).ready(function () {
|
|||||||
<td>
|
<td>
|
||||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeClientBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeClientBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
branchTable += `
|
||||||
|
<tr>
|
||||||
|
<td>${item.branch_name}</td>
|
||||||
|
<td>${item.branch_code}</td>
|
||||||
|
<td>
|
||||||
|
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#branch_list').append(branchTable);
|
$('#branch_list').append(branchTable);
|
||||||
}
|
}
|
||||||
@ -273,14 +301,25 @@ $(document).ready(function () {
|
|||||||
$('#branch_table').show();
|
$('#branch_table').show();
|
||||||
$('.btnBack').hide();
|
$('.btnBack').hide();
|
||||||
$('#btnBranchAdd').show();
|
$('#btnBranchAdd').show();
|
||||||
var message = (branch_PrimaryKey === '') ? 'Client Branch Created successfully' : 'Client Branch Updated successfully';
|
var message = (branch_PrimaryKey === '') ?
|
||||||
|
'Client Branch Created successfully' :
|
||||||
|
'Client Branch Updated successfully';
|
||||||
toastr.success(message, 'Success');
|
toastr.success(message, 'Success');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#branch_list tr').remove();
|
$('#branch_list tr').remove();
|
||||||
var branchTableInsert = ''
|
var branchTableInsert = ''
|
||||||
|
|
||||||
|
var role = res.data.role
|
||||||
|
delete res.data.role;
|
||||||
|
console.log(role)
|
||||||
$.each(res.data, function(index, item) {
|
$.each(res.data, function(index, item) {
|
||||||
|
|
||||||
|
console.log('client_branch_data', item)
|
||||||
|
|
||||||
|
if(role != 3 && role != 4){
|
||||||
|
|
||||||
branchTableInsert += `
|
branchTableInsert += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.branch_name}</td>
|
<td>${item.branch_name}</td>
|
||||||
@ -291,6 +330,21 @@ $(document).ready(function () {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
branchTableInsert += `
|
||||||
|
<tr>
|
||||||
|
<td>${item.branch_name}</td>
|
||||||
|
<td>${item.branch_code}</td>
|
||||||
|
<td>
|
||||||
|
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#branch_list').append(branchTableInsert);
|
$('#branch_list').append(branchTableInsert);
|
||||||
},
|
},
|
||||||
@ -423,7 +477,7 @@ $(document).ready(function () {
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onchange="checkMobileNumber(this)" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||||
@ -528,6 +582,17 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeClientBranch(element) {
|
function removeClientBranch(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this client branch.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("client/branch/remove/") ?>' + id;
|
var form_action = '<?= base_url("client/branch/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -540,12 +605,10 @@ $(document).ready(function () {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('Client branch removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove client branch', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -555,14 +618,42 @@ $(document).ready(function () {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
console.log('Something Wrong!', 'warning');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function checkMobileNumber(input) {
|
||||||
|
|
||||||
|
console.log('function called')
|
||||||
|
console.log(input);
|
||||||
|
console.log('Input Value', input.value);
|
||||||
|
|
||||||
|
var mobileNumber = input.value;
|
||||||
|
var url = '<?php echo base_url('util/checkHRNumber/') ?>' + mobileNumber;
|
||||||
|
|
||||||
|
$.get(url, function(response) {
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
console.log(response.data)
|
||||||
|
|
||||||
|
if (response.data > 0) {
|
||||||
|
toastr.warning('The Mobile Number Already Exist.', 'Warning');
|
||||||
|
input.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}).fail(function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -16,7 +16,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-6" style="position: relative;left: 455px;">
|
<div class="col-6" style="position: relative;left: 455px;">
|
||||||
<button id="close_btn" class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
|
<button id="close_btn"
|
||||||
|
class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1 float-right" style="position: relative;left: 255px;">
|
<div class="col-1 float-right" style="position: relative;left: 255px;">
|
||||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
|
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
|
||||||
@ -270,50 +271,71 @@ $(document).ready(function() {
|
|||||||
$(document).on('click', '.policy_terms', function() {
|
$(document).on('click', '.policy_terms', function() {
|
||||||
var terms = $(this).data('id');
|
var terms = $(this).data('id');
|
||||||
console.log(terms);
|
console.log(terms);
|
||||||
|
console.log(terms.length);
|
||||||
|
console.log(JSON.stringify(terms));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// terms = JSON.parse(terms);
|
// terms = JSON.parse(terms);
|
||||||
|
|
||||||
$('#modal_body').empty();
|
$('#modal_body').empty();
|
||||||
|
|
||||||
function createListItems(obj) {
|
function createListItems(obj) {
|
||||||
|
|
||||||
|
if (obj.length == 0) {
|
||||||
|
const message = document.createElement('div');
|
||||||
|
message.textContent = 'Policy Terms Not Available';
|
||||||
|
message.style.display = 'flex';
|
||||||
|
message.style.justifyContent = 'center';
|
||||||
|
message.style.alignItems = 'center';
|
||||||
|
message.style.height = '100%'; // Adjust as necessary to fit the context
|
||||||
|
message.style.textAlign = 'center';
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '' && key !=
|
if (
|
||||||
'family_floater' && key != 'gpa_special_condition_input' && key !=
|
obj.hasOwnProperty(key) &&
|
||||||
'gpa_special_condition_label' && key != 'special_condition_label' && key !=
|
obj[key] !== null &&
|
||||||
'special_condition_input' && key != 'age_ratio') {
|
obj[key] !== '' &&
|
||||||
|
key !== 'family_floater' &&
|
||||||
|
key !== 'gpa_special_condition_input' &&
|
||||||
|
key !== 'gpa_special_condition_label' &&
|
||||||
|
key !== 'special_condition_label' &&
|
||||||
|
key !== 'special_condition_input' &&
|
||||||
|
key !== 'age_ratio' &&
|
||||||
|
key !== 'multiple_sum_insured' &&
|
||||||
|
key !== 'other_special_condition_label' &&
|
||||||
|
key !== 'other_special_condition_input'
|
||||||
|
) {
|
||||||
const listItem = document.createElement('li');
|
const listItem = document.createElement('li');
|
||||||
|
let formattedKey = key.replace(/_/g, ' ');
|
||||||
|
|
||||||
var formattedKey = '';
|
console.log('type', typeof obj[key])
|
||||||
formattedKey = key.replace(/_/g, ' ');
|
|
||||||
|
// Strip HTML tags from values
|
||||||
|
if (typeof obj[key] === 'string') {
|
||||||
|
console.log('before', obj[key])
|
||||||
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
|
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
|
||||||
|
console.log('after', obj[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert 0 and 1 to 'No' and 'Yes'
|
||||||
if (obj[key] == 0) {
|
if (obj[key] == 0) {
|
||||||
obj[key] = 'No';
|
obj[key] = 'No';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj[key] == 1) {
|
if (obj[key] == 1) {
|
||||||
obj[key] = 'Yes';
|
obj[key] = 'Yes';
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(formattedKey)
|
// Handle nested objects
|
||||||
|
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
||||||
if (key == 'burnExpenses' && obj[key] == 'Yes') {
|
|
||||||
|
|
||||||
listItem.innerHTML =
|
|
||||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${obj['burnExpensesData']}`;
|
|
||||||
|
|
||||||
} else if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
|
||||||
|
|
||||||
listItem.innerHTML =
|
listItem.innerHTML =
|
||||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong>`;
|
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong>`;
|
||||||
const nestedList = document.createElement('ul');
|
const nestedList = document.createElement('ul');
|
||||||
|
|
||||||
nestedList.appendChild(createListItems(obj[key]));
|
nestedList.appendChild(createListItems(obj[key]));
|
||||||
|
|
||||||
listItem.appendChild(nestedList);
|
listItem.appendChild(nestedList);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
listItem.innerHTML =
|
listItem.innerHTML =
|
||||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${Array.isArray(obj[key]) ? JSON.stringify(obj[key]) : obj[key]}`;
|
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${Array.isArray(obj[key]) ? JSON.stringify(obj[key]) : obj[key]}`;
|
||||||
@ -325,7 +347,8 @@ $(document).on('click', '.policy_terms', function() {
|
|||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#modal_body').append(createListItems(terms));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
$('#modal_body').append(createListItems(terms));
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -59,7 +59,9 @@ table.dataTable thead th {
|
|||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>Deposit</a>
|
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>Deposit</a>
|
||||||
|
<?php if(get_role_id() != 3 && get_role_id() != 4) { ?>
|
||||||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -111,6 +113,17 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
|
|
||||||
function removeClient(element) {
|
function removeClient(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this client.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -123,26 +136,24 @@ table.dataTable thead th {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('Client removed successfully.', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove client.', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
console.log('Something Wrong!', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,14 +7,15 @@
|
|||||||
|
|
||||||
<div class="table-responsive" id="table_list">
|
<div class="table-responsive" id="table_list">
|
||||||
|
|
||||||
<table class="table table-borderless table-nowrap mb-0" id="table-client-policy">
|
<table class="table table-borderless table mb-0" id="table-client-policy">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Insurer</th>
|
<th>Insurer</th>
|
||||||
<th>Policy</th>
|
<th>Policy</th>
|
||||||
|
<th>Client Branch</th>
|
||||||
<th>TPA</th>
|
<th>TPA</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Enrollment <br> Status</th>
|
<th>Enrollment Status</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -39,6 +40,7 @@
|
|||||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||||
<input type="hidden" id="policy_form_action" />
|
<input type="hidden" id="policy_form_action" />
|
||||||
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
||||||
|
<input type="hidden" id="insurer_policy_id" />
|
||||||
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
@ -258,13 +260,13 @@
|
|||||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||||
|
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||||
<td>${tpaValue}</td>
|
<td>${tpaValue}</td>
|
||||||
<td>${(item.policy_start_date)} / <br> ${(item.policy_end_date)}</td>
|
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<td>
|
<td>
|
||||||
@ -314,6 +316,8 @@
|
|||||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||||
$('#policy_status_field').hide()
|
$('#policy_status_field').hide()
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
|
$('#policy_PrimaryKey').val("");
|
||||||
|
$('#insurer_policy_id').val("");
|
||||||
|
|
||||||
|
|
||||||
$('#first').hide();
|
$('#first').hide();
|
||||||
@ -481,8 +485,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||||
|
<td>${item.branch_name}</td>
|
||||||
<td>${tpaValue}</td>
|
<td>${tpaValue}</td>
|
||||||
<td>${rearrangeDateFormat(item.policy_start_date)} / <br> ${rearrangeDateFormat(item.policy_end_date)}</td>
|
<td>${rearrangeDateFormat(item.policy_start_date)} / ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<td>
|
<td>
|
||||||
@ -632,6 +637,7 @@
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -646,28 +652,35 @@
|
|||||||
console.log('client_id', client_id)
|
console.log('client_id', client_id)
|
||||||
console.log('branch_id', branch_id)
|
console.log('branch_id', branch_id)
|
||||||
console.log('policy_type_id', dataId)
|
console.log('policy_type_id', dataId)
|
||||||
|
console.log('client_policy_id', $('#policy_PrimaryKey').val())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#policy_type_id').val(dataId);
|
$('#policy_type_id').val(dataId);
|
||||||
|
|
||||||
var url = '<?php echo base_url('util/check_policy_type/') ?>' + id + '/' + dataId + '/' + branch_id + '/' + client_id
|
var url = '<?php echo base_url('util/check_policy_type/') ?>' + dataId + '/' + branch_id + '/' + client_id;
|
||||||
|
|
||||||
|
if (dataId && branch_id && client_id) { // Check if all parameters exist
|
||||||
|
if ($('#policy_PrimaryKey').val() == "" || id != $('#insurer_policy_id').val()) {
|
||||||
$.get(url, function(response) {
|
$.get(url, function(response) {
|
||||||
|
console.log(response);
|
||||||
console.log(response)
|
console.log(response.count);
|
||||||
//console.log(response.data)
|
|
||||||
|
|
||||||
if (response.count > 0) {
|
if (response.count > 0) {
|
||||||
console.log('Policy already exist in the branch')
|
console.log('Policy already exist in the branch');
|
||||||
toastr.error('Policy already exist in the branch', 'Error');
|
toastr.error('Policy already exist in the branch', 'Error');
|
||||||
$('#policy').val('').change();
|
$('#policy').val('').change();
|
||||||
}
|
}
|
||||||
console.log('outer')
|
console.log('outer');
|
||||||
|
|
||||||
|
|
||||||
}).fail(function(xhr, status, error) {
|
}).fail(function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Missing parameter(s): dataId, branch_id, or client_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dataId == 1) {
|
if (dataId == 1) {
|
||||||
@ -738,7 +751,7 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
//console.log('client_policy_res', res)
|
console.log('client_policy_res', res)
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -771,6 +784,7 @@
|
|||||||
|
|
||||||
$('#policy_type_id').val(res.data.policy_type_id);
|
$('#policy_type_id').val(res.data.policy_type_id);
|
||||||
$('#policy_PrimaryKey').val(res.data.id);
|
$('#policy_PrimaryKey').val(res.data.id);
|
||||||
|
$('#insurer_policy_id').val(res.data.policy_id);
|
||||||
$('#policy_no').val(res.data.policy_no);
|
$('#policy_no').val(res.data.policy_no);
|
||||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||||
@ -1302,8 +1316,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($(this).val() == 3) {
|
if ($(this).val() == 3) {
|
||||||
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'INFO');
|
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'INFO');
|
||||||
}
|
}
|
||||||
@ -1437,13 +1449,15 @@
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
//console.log(res)
|
console.log(res)
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
if(res.status == true){
|
||||||
|
|
||||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id)
|
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id)
|
||||||
.change();
|
.change();
|
||||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||||
@ -1487,6 +1501,8 @@
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="emp_code">Account Manager</label>
|
<label for="emp_code">Account Manager ( L2 )</label>
|
||||||
<select class="form-control" id="account_manager" name="account_manager[]" multiple>
|
<select class="form-control" id="account_manager" name="account_manager[]" multiple>
|
||||||
<?php foreach($RM as $value) { ?>
|
<?php foreach($RM as $value) { ?>
|
||||||
<?php if($value['role'] === '3') { ?>
|
<?php if($value['role'] === '3') { ?>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="profile">Manager</label>
|
<label for="profile">Manager ( L1 )</label>
|
||||||
<select class="form-control" id="manager" name="manager">user_id
|
<select class="form-control" id="manager" name="manager">user_id
|
||||||
<option value="">Select Manager</option>
|
<option value="">Select Manager</option>
|
||||||
<?php foreach($RM as $value) { ?>
|
<?php foreach($RM as $value) { ?>
|
||||||
|
|||||||
@ -59,6 +59,16 @@ table.dataTable tbody td {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Employee Code</label> <br />
|
||||||
|
<input type="text" class="form-control" id="emp_code" name="emp_code" value="<?= isset($getData['emp_code']) && !empty($getData['emp_code']) ? $getData['emp_code'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Employee Name</label> <br />
|
||||||
|
<input type="text" class="form-control" id="emp_name" name="emp_name" value="<?= isset($getData['emp_name']) && !empty($getData['emp_name']) ? $getData['emp_name'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
@ -318,18 +328,22 @@ function fetchEmpolyeeList(event) {
|
|||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
var status = $('#status2').val();
|
var status = $('#status2').val();
|
||||||
var branch_id = $('#branch_id').val();
|
var branch_id = $('#branch_id').val();
|
||||||
|
var emp_code = $('#emp_code').val();
|
||||||
|
var emp_name = $('#emp_name').val();
|
||||||
|
|
||||||
// console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
// if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
// alert('Please select values in both dropdowns.');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
|
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id,
|
policy_id: policy_id,
|
||||||
branch_id: branch_id,
|
branch_id: branch_id,
|
||||||
|
emp_code : emp_code,
|
||||||
|
emp_name : emp_name,
|
||||||
status : status,
|
status : status,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -587,16 +587,25 @@
|
|||||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
"buttons": [{
|
buttons: [{
|
||||||
"extend": 'csv',
|
extend: 'csv',
|
||||||
"text": 'CSV',
|
text: 'CSV',
|
||||||
"title": 'Endorsement-List',
|
title: 'Endorsement-List',
|
||||||
"className": 'my_class',
|
className: 'my_class',
|
||||||
"exportOptions": {
|
exportOptions: {
|
||||||
"columns": ':not(:last-child)'
|
columns: ':not(:last-child)',
|
||||||
},
|
format: {
|
||||||
|
body: function (data, row, column, node) {
|
||||||
|
// Convert data to string to avoid scientific notation in CSV
|
||||||
|
if (!isNaN(data) && parseFloat(data) > 1e20) {
|
||||||
|
return `'${data}`;
|
||||||
|
}
|
||||||
|
return data.toString();// Ensures all data is treated as strings
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
"initComplete": function(settings, json) {
|
initComplete: function(settings, json) {
|
||||||
$('.my_class').css({
|
$('.my_class').css({
|
||||||
"position": "relative",
|
"position": "relative",
|
||||||
"left": "79px"
|
"left": "79px"
|
||||||
@ -608,7 +617,12 @@
|
|||||||
},
|
},
|
||||||
paging: true,
|
paging: true,
|
||||||
// pagingType: 'full_numbers'
|
// pagingType: 'full_numbers'
|
||||||
|
columnDefs: [
|
||||||
|
{ type: 'scientific', targets: 0 } // Apply custom sorting type to the first column
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -473,6 +473,17 @@
|
|||||||
|
|
||||||
|
|
||||||
function removeInsurerBranch(element) {
|
function removeInsurerBranch(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this insurer branch.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/insurer/branch/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/insurer/branch/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -485,26 +496,25 @@
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('Insurer branch removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove insurer branch', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove insurer branch', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -134,6 +134,17 @@ class csvExport {
|
|||||||
|
|
||||||
|
|
||||||
function removeInsurer(element) {
|
function removeInsurer(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this insurer.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/insurer/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/insurer/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -146,26 +157,24 @@ class csvExport {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('Insurer removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove insurer', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove insurer', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -323,6 +323,17 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
function removeKYCDocs(element) {
|
function removeKYCDocs(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this!.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
|
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/kyc/kycdocs/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/kyc/kycdocs/remove/") ?>' + id;
|
||||||
@ -336,26 +347,26 @@ $(document).ready(function () {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('KYC docs removed successfully');
|
||||||
|
|
||||||
// location.reload();
|
// location.reload();
|
||||||
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
|
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove KYC docs', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove KYC docs', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -133,6 +133,16 @@ class csvExport {
|
|||||||
|
|
||||||
|
|
||||||
function removeKYC(element) {
|
function removeKYC(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this!",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/kyc/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/kyc/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -145,12 +155,12 @@ function removeKYC(element) {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('KYC entity removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove KYC entity', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -164,8 +174,8 @@ function removeKYC(element) {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -136,6 +136,7 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdn.datatables.net/plug-ins/2.0.8/sorting/scientific.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
toastr.options = {
|
toastr.options = {
|
||||||
|
|||||||
@ -78,7 +78,8 @@ label {
|
|||||||
|
|
||||||
<span id="otherPolicyTermsClose"
|
<span id="otherPolicyTermsClose"
|
||||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||||
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyOnOther"></span></label>
|
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span
|
||||||
|
id="nameOfThePolicyOnOther"></span></label>
|
||||||
</h5>
|
</h5>
|
||||||
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" enctype="multipart/form-data">
|
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" enctype="multipart/form-data">
|
||||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
@ -108,8 +109,6 @@ label {
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
$("#otherPolicyTerms").submit(function(event) {
|
$("#otherPolicyTerms").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -136,14 +135,19 @@ $("#otherPolicyTerms").submit(function(event) {
|
|||||||
// Convert the FormData object to a JSON object
|
// Convert the FormData object to a JSON object
|
||||||
const formObject = {};
|
const formObject = {};
|
||||||
formData.forEach((value, key) => {
|
formData.forEach((value, key) => {
|
||||||
if(key != 'csrf_test_name' && key != 'client_policy_id' && key != 'policy_id' && key != 'client_id'){
|
if (key != 'csrf_test_name' && key != 'client_policy_id' && key != 'policy_id' && key !=
|
||||||
|
'client_id') {
|
||||||
|
|
||||||
if (key.endsWith('[]')) {
|
if (key.endsWith('[]')) {
|
||||||
const baseKey = key.slice(0, -2);
|
const baseKey = key.slice(0, -2);
|
||||||
if (!formObject[baseKey]) {
|
if (!formObject[baseKey]) {
|
||||||
formObject[baseKey] = [];
|
formObject[baseKey] = [];
|
||||||
}
|
}
|
||||||
formObject[baseKey].push(value);
|
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||||
} else {
|
} else if(key == 'sum_insureds'){
|
||||||
|
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||||
|
}
|
||||||
|
else {
|
||||||
formObject[key] = value;
|
formObject[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,6 +159,8 @@ $("#otherPolicyTerms").submit(function(event) {
|
|||||||
const jsonString = JSON.stringify(formObject);
|
const jsonString = JSON.stringify(formObject);
|
||||||
console.log(jsonString);
|
console.log(jsonString);
|
||||||
|
|
||||||
|
// return;
|
||||||
|
|
||||||
// Append the JSON string to the FormData object
|
// Append the JSON string to the FormData object
|
||||||
formData.append('policy_terms', jsonString);
|
formData.append('policy_terms', jsonString);
|
||||||
|
|
||||||
@ -189,7 +195,6 @@ $("#otherPolicyTerms").submit(function(event) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||||
@ -287,7 +292,16 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.includes("multiple_sum_insured")) {
|
||||||
|
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||||
|
appendOtherSIAddMore(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -295,9 +309,15 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
Object.keys(jsonObject).forEach(function(key) {
|
Object.keys(jsonObject).forEach(function(key) {
|
||||||
|
|
||||||
|
console.log(key)
|
||||||
|
|
||||||
let elements = document.getElementsByName(key);
|
let elements = document.getElementsByName(key);
|
||||||
|
|
||||||
// console.log(elements)
|
if(key == 'sum_insured'){
|
||||||
|
elements = document.getElementsByName('sum_insureds')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(elements)
|
||||||
|
|
||||||
if (elements && elements.length > 0) {
|
if (elements && elements.length > 0) {
|
||||||
let element = elements[0];
|
let element = elements[0];
|
||||||
@ -309,7 +329,6 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
element.checked = jsonObject[key] === '1';
|
element.checked = jsonObject[key] === '1';
|
||||||
} else if (element.type === 'radio') {
|
} else if (element.type === 'radio') {
|
||||||
element.checked = element.value === jsonObject[key];
|
element.checked = element.value === jsonObject[key];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -317,7 +336,11 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
if (jsonObject[key] == undefined) {
|
if (jsonObject[key] == undefined) {
|
||||||
element.value = " ";
|
element.value = " ";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
element.value = jsonObject[key];
|
element.value = jsonObject[key];
|
||||||
|
console.log(element);
|
||||||
|
console.log(jsonObject[key]);
|
||||||
|
console.log(element.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,6 +350,10 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#sum_insured_others').trigger('keyup');
|
||||||
|
$(".multiple_sum_insured").trigger("keyup");
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -395,13 +422,14 @@ $(document).on('click', '#otherPolicyTermsClose', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#sumInsured2").on("keyup", function() {
|
$("#sum_insured_others").on("keyup", function() {
|
||||||
var inputNumber = $(this).val();
|
var inputNumber = $(this).val();
|
||||||
|
console.log('sum_insured_others keyup', inputNumber)
|
||||||
if (inputNumber) {
|
if (inputNumber) {
|
||||||
var result = convertCommaNumberToWords(inputNumber);
|
var result = convertCommaNumberToWords(inputNumber);
|
||||||
$("#numberToWordSumInsured").text(result);
|
$("#numberToWordOthers").text(result);
|
||||||
} else {
|
} else {
|
||||||
$("#numberToWordSumInsured").text("");
|
$("#numberToWordOthers").text("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -417,6 +445,20 @@ $("#totalSumInsured").on("keyup", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function si_keup_num_to_word2(input) {
|
||||||
|
|
||||||
|
console.log('keyup sum insured');
|
||||||
|
var inputNumber = $(input).val();
|
||||||
|
console.log(inputNumber)
|
||||||
|
if (inputNumber) {
|
||||||
|
var result = convertCommaNumberToWords(inputNumber);
|
||||||
|
|
||||||
|
$("#numberToWordOthers").text(result);
|
||||||
|
} else {
|
||||||
|
$("#numberToWordOthers").text("");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function appendPolicyTermsHTML(policy_type) {
|
function appendPolicyTermsHTML(policy_type) {
|
||||||
|
|
||||||
@ -429,6 +471,25 @@ function appendPolicyTermsHTML(policy_type) {
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="sumInsured">Sum Insured</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="sum_insured_add_more" ></div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">Policy Type</label>
|
<label for="totalSumInsured">Policy Type</label>
|
||||||
@ -528,6 +589,25 @@ function appendPolicyTermsHTML(policy_type) {
|
|||||||
|
|
||||||
<div class="form-group EDLI">
|
<div class="form-group EDLI">
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="sumInsured">Sum Insured</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4" >
|
||||||
|
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="sum_insured_add_more" ></div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">Existing Insurer</label>
|
<label for="totalSumInsured">Existing Insurer</label>
|
||||||
@ -592,28 +672,31 @@ function appendPolicyTermsHTML(policy_type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendOtherTermsSIAddMore(data = null){
|
function appendOtherSIAddMore(data = null) {
|
||||||
|
|
||||||
console.log('function called')
|
const addMoreContainer = document.getElementById('sum_insured_add_more');
|
||||||
|
|
||||||
var html = `
|
console.log(addMoreContainer)
|
||||||
|
|
||||||
|
const html = `
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="sumInsured">Additional Sum Insured</label>
|
<label for="sumInsured">Additional Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
<input style="width: 128%;" value="${data ? data : ''}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="text-danger-2 numberToWordSumInsured"></div>
|
<div class="text-danger-2 numberToWordSumInsured"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
$('#other_si_add_more').append(html);
|
addMoreContainer.insertAdjacentHTML('beforeend', html);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -396,6 +396,17 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
function removePolicies(element) {
|
function removePolicies(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this Policy.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var policy_id_for_reload = $('#policy_type_id').val()
|
var policy_id_for_reload = $('#policy_type_id').val()
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/policy/policies/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/policy/policies/remove/") ?>' + id;
|
||||||
@ -409,29 +420,28 @@ function removePolicies(element) {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('Policy removed successfully', 'success');
|
||||||
|
|
||||||
// $('#branch_table').empty();
|
// $('#branch_table').empty();
|
||||||
|
|
||||||
// location.reload();
|
// location.reload();
|
||||||
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
|
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove policy', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove policy', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -111,9 +111,9 @@
|
|||||||
<label for="sumInsured">Sum Insured</label>
|
<label for="sumInsured">Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)">
|
<input style="width: 128%;" type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -141,14 +141,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;;" type="number" name="self_max_age" id="self_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;;" type="number" name="self_max_age" id="self_max_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 11%;"><span for="children">Children:</span></td>
|
<td style="width: 11%;"><span for="children">Children:</span></td>
|
||||||
@ -190,8 +190,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%; width: 30%;background: lightgray;" type="number" name="elder_member_count" id="member_count" readonly></div></td>
|
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%; width: 30%;background: lightgray;" type="number" name="elder_member_count" id="member_count" readonly></div></td>
|
||||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -507,7 +507,7 @@
|
|||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">AYUSH treatment cover Data</label>
|
<label for="totalSumInsured">AYUSH treatment cover Limit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
|
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
|
||||||
@ -637,7 +637,7 @@
|
|||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">Cataract Data</label>
|
<label for="totalSumInsured">Cataract Limit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="cataractData" id="cataractData" class="form-control">
|
<input type="text" name="cataractData" id="cataractData" class="form-control">
|
||||||
@ -929,10 +929,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (key.includes("multiple_sum_insured")) {
|
// if (key.includes("multiple_sum_insured")) {
|
||||||
|
// jsonObject[key].forEach((value, index) => {
|
||||||
|
// appendGMCSIAddMore(value);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (key.includes("multiple_sum_insured") && key != "") {
|
||||||
|
|
||||||
|
if (Array.isArray(jsonObject[key])) {
|
||||||
jsonObject[key].forEach((value, index) => {
|
jsonObject[key].forEach((value, index) => {
|
||||||
appendGMCSIAddMore(value);
|
appendGMCSIAddMore(value);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.error(`${key} is not an array.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.includes("family_floaters")) {
|
if (key.includes("family_floaters")) {
|
||||||
@ -1418,9 +1429,9 @@
|
|||||||
<label for="sumInsured">Additional Sum Insured</label>
|
<label for="sumInsured">Additional Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
<input style="width: 128%;" value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -91,9 +91,9 @@
|
|||||||
<label for="sumInsured">Sum Insured</label>
|
<label for="sumInsured">Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -137,13 +137,13 @@
|
|||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Min Age:</span>
|
<span style="margin-right: 20px;">Min Age:</span>
|
||||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" oninput="lowerIsEighteen(this)">
|
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" onchange="lowerIsEighteen(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Max Age:</span>
|
<span style="margin-right: 20px;">Max Age:</span>
|
||||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" oninput="lowerIsEighteen(this)">
|
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" onchange="lowerIsEighteen(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td ></td>
|
<td ></td>
|
||||||
@ -575,11 +575,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.includes("multiple_sum_insured")) {
|
if (key.includes("multiple_sum_insured") && key != "") {
|
||||||
|
|
||||||
|
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
||||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||||
appendGPASIAddMore(value);
|
appendGPASIAddMore(value);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.error(`${key} is not an array.`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
@ -792,9 +798,9 @@
|
|||||||
<label for="sumInsured">Additional Sum Insured</label>
|
<label for="sumInsured">Additional Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
<input style="width: 128%;" value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -63,8 +63,7 @@
|
|||||||
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
||||||
Individual </label>
|
Individual </label>
|
||||||
<input type="radio" id="single" name="premium_type" value="1">
|
<input type="radio" id="single" name="premium_type" value="1">
|
||||||
<label for="single" style="position: relative;top: 5px;left: 5px;"> Single
|
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
|
||||||
Insurance </label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -123,8 +122,7 @@
|
|||||||
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
||||||
Individual </label>
|
Individual </label>
|
||||||
<input type="radio" id="single_2" name="premium_type" value="1">
|
<input type="radio" id="single_2" name="premium_type" value="1">
|
||||||
<label for="single" style="position: relative;top: 5px;left: 5px;"> Single
|
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
|
||||||
Insurance </label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -827,12 +825,16 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$("#GridForm").submit(async function(event) {
|
$("#GridForm").submit(function(event) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
var check = checkDuplicate(0);
|
var check = checkDuplicate(0);
|
||||||
console.log(check)
|
console.log(check)
|
||||||
|
if(check){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
if ($('#grid_emp_count').val() == 'false') {
|
if ($('#grid_emp_count').val() == 'false') {
|
||||||
toastr.warning('Client has active employees', 'Warning');
|
toastr.warning('Client has active employees', 'Warning');
|
||||||
@ -854,9 +856,16 @@ $("#GridForm").submit(async function(event) {
|
|||||||
|
|
||||||
|
|
||||||
checkPolicyTermsSI(function(result) {
|
checkPolicyTermsSI(function(result) {
|
||||||
|
|
||||||
|
console.log('checkPolicyTermsSI callback')
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
|
||||||
if (check) {
|
console.log('after result');
|
||||||
|
|
||||||
|
|
||||||
|
if (check = false) {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
} else {
|
} else {
|
||||||
@ -901,14 +910,13 @@ $("#GridForm").submit(async function(event) {
|
|||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning(`Value does not exist in the Policy Terms.`);
|
toastr.warning(`Sum Insured Amount does not exist in the Policy Terms.`);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
console.error('Error checking policy terms:', error);
|
console.error('Error checking policy terms:', error);
|
||||||
// Handle error if necessary
|
// Handle error if necessary
|
||||||
toastr.error(`Error checking policy terms: ${error}`);
|
console.log(`Error checking policy terms: ${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -941,6 +949,9 @@ $("#AdditionalGridForm").submit(function(event) {
|
|||||||
var formData = new FormData($('#AdditionalGridForm')[0]);
|
var formData = new FormData($('#AdditionalGridForm')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/premimum/create") ?>';
|
var policy_form_action = '<?= base_url("client/premimum/create") ?>';
|
||||||
|
|
||||||
|
checkPolicyTermsSI(function(result) {
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -982,6 +993,18 @@ $("#AdditionalGridForm").submit(function(event) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
toastr.warning(`Sum Insured Amount does not exist in the Policy Terms.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(function(error) {
|
||||||
|
console.error('Error checking policy terms:', error);
|
||||||
|
// Handle error if necessary
|
||||||
|
console.log(`Error checking policy terms: ${error}`);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -2574,6 +2597,8 @@ function si_orbp_change_function() {
|
|||||||
// $('.gpa_sum_insure_remove').remove();
|
// $('.gpa_sum_insure_remove').remove();
|
||||||
var selectedValue = $('#si_or_bp').val();
|
var selectedValue = $('#si_or_bp').val();
|
||||||
|
|
||||||
|
console.log('selectedValue', selectedValue)
|
||||||
|
|
||||||
if (selectedValue == 2) {
|
if (selectedValue == 2) {
|
||||||
|
|
||||||
$('.gpa_sum_insure_remove').hide();
|
$('.gpa_sum_insure_remove').hide();
|
||||||
@ -2659,8 +2684,8 @@ function si_orbp_change_function() {
|
|||||||
$('#basic_multiplier').removeAttr('required', false);
|
$('#basic_multiplier').removeAttr('required', false);
|
||||||
$('#premium_multiplier').removeAttr('required', false);
|
$('#premium_multiplier').removeAttr('required', false);
|
||||||
$('#basic_pay').removeAttr('required', false);
|
$('#basic_pay').removeAttr('required', false);
|
||||||
$('#gpa_basic_si').removeAttr('required', false);
|
$('#gpa_basic_si_first').removeAttr('required', false);
|
||||||
$('#gpa_basic_premium').removeAttr('required', false);
|
$('#gpa_basic_premium_first').removeAttr('required', false);
|
||||||
|
|
||||||
$('#gpa_sum_multiplier2').removeAttr('required', false);
|
$('#gpa_sum_multiplier2').removeAttr('required', false);
|
||||||
$('#gpa_sum_si2').removeAttr('required', false);
|
$('#gpa_sum_si2').removeAttr('required', false);
|
||||||
@ -2711,8 +2736,8 @@ function si_orbp_change_function() {
|
|||||||
$('#basic_multiplier').removeAttr('required', false);
|
$('#basic_multiplier').removeAttr('required', false);
|
||||||
$('#premium_multiplier').removeAttr('required', false);
|
$('#premium_multiplier').removeAttr('required', false);
|
||||||
$('#basic_pay').removeAttr('required', false);
|
$('#basic_pay').removeAttr('required', false);
|
||||||
$('#gpa_basic_si').removeAttr('required', false);
|
$('#gpa_basic_si_first').removeAttr('required', false);
|
||||||
$('#gpa_basic_premium').removeAttr('required', false);
|
$('#gpa_basic_premium_first').removeAttr('required', false);
|
||||||
|
|
||||||
$('#gpa_sum_multiplier').attr('required', false);
|
$('#gpa_sum_multiplier').attr('required', false);
|
||||||
$('#gpa_sum_si').attr('required');
|
$('#gpa_sum_si').attr('required');
|
||||||
@ -2938,8 +2963,7 @@ function checkTermsSISameAsRackRateSI(input) {
|
|||||||
|
|
||||||
function checkPolicyTermsSI(callback) {
|
function checkPolicyTermsSI(callback) {
|
||||||
|
|
||||||
|
console.log('checkPolicyTermsSI function called');
|
||||||
console.log('r function called');
|
|
||||||
|
|
||||||
var id = $('#additional_grid')[0];
|
var id = $('#additional_grid')[0];
|
||||||
var container = $('#additional_grid_content_input');
|
var container = $('#additional_grid_content_input');
|
||||||
@ -2951,111 +2975,116 @@ function checkTermsSISameAsRackRateSI(input) {
|
|||||||
container = $('#grid_content_input');
|
container = $('#grid_content_input');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log(id);
|
console.log(id);
|
||||||
console.log(container);
|
console.log(container);
|
||||||
|
|
||||||
var siInputs = 0;
|
var siInputs = null;
|
||||||
|
|
||||||
if (id.value === '2') {
|
switch (id.value) {
|
||||||
siInputs = container.find('input[name="gpa_si"]');
|
case '1':
|
||||||
} else if (id.value === '3') {
|
|
||||||
siInputs = container.find('input[name="3_si[]"]');
|
|
||||||
} else if (id.value === '4') {
|
|
||||||
siInputs = container.find('input[name="4_si[]"]');
|
|
||||||
} else if (id.value === '5') {
|
|
||||||
siInputs = container.find('input[name="5_si[]"]');
|
|
||||||
} else if (id.value === '6') {
|
|
||||||
siInputs = container.find('input[name="6_si[]"]');
|
|
||||||
} else if (id.value === '7') {
|
|
||||||
siInputs = container.find('input[name="7_si[]"]');
|
|
||||||
} else if (id.value === '8') {
|
|
||||||
siInputs = container.find('input[name="8_si[]"]');
|
|
||||||
} else if (id.value === '9') {
|
|
||||||
siInputs = container.find('input[name="9_si[]"]');
|
|
||||||
} else if (id.value === '10') {
|
|
||||||
siInputs = container.find('input[name="10_si[]"]');
|
|
||||||
} else if (id.value === '11') {
|
|
||||||
siInputs = container.find('input[name="11_si[]"]');
|
|
||||||
} else if (id.value === '1') {
|
|
||||||
var selectedValue = $('#si_or_bp').val();
|
var selectedValue = $('#si_or_bp').val();
|
||||||
|
|
||||||
if (selectedValue == 1) {
|
if (selectedValue == 1) {
|
||||||
siInputs = container.find('input[name="gpa_sum_si[]"]');
|
siInputs = container.find('input[name="gpa_sum_si[]"]');
|
||||||
} else if (selectedValue == 3) {
|
} else if (selectedValue == 3) {
|
||||||
siInputs = container.find('input[name="gpa_sum_si2[]"]');
|
siInputs = container.find('input[name="gpa_sum_si2[]"]');
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
siInputs = container.find('input[name="gpa_si"]');
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
siInputs = container.find('input[name="3_si[]"]');
|
||||||
|
break;
|
||||||
|
case '4':
|
||||||
|
siInputs = container.find('input[name="4_si"]');
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
siInputs = container.find('input[name="5_si[]"]');
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
siInputs = container.find('input[name="6_si"]');
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
siInputs = container.find('input[name="7_si[]"]');
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
siInputs = container.find('input[name="8_si[]"]');
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
siInputs = container.find('input[name="gpa_si"]');
|
||||||
|
break;
|
||||||
|
case '10':
|
||||||
|
siInputs = container.find('input[name="10_si[]"]');
|
||||||
|
break;
|
||||||
|
case '11':
|
||||||
|
siInputs = container.find('input[name="11_si[]"]');
|
||||||
|
break;
|
||||||
|
case '12':
|
||||||
|
siInputs = container.find('input[name="12_si[]"]');
|
||||||
|
break;
|
||||||
|
case '13':
|
||||||
|
siInputs = container.find('input[name="13_si[]"]');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
siInputs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('siInputs', siInputs);
|
||||||
|
|
||||||
var client_policy_id = $('#client_policy_id').val();
|
var client_policy_id = $('#client_policy_id').val();
|
||||||
console.log('client_policy_id', client_policy_id)
|
console.log('client_policy_id', client_policy_id);
|
||||||
|
|
||||||
var url = '<?php echo base_url('util/getPolicyTerms/') ?>' + client_policy_id;
|
var url = '<?php echo base_url('util/getPolicyTerms/') ?>' + client_policy_id;
|
||||||
|
|
||||||
var arrayLength = 0;
|
console.log('url', url);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
|
|
||||||
var array1 = response.data;
|
var policy_terms_si = response.data;
|
||||||
var array2 = [];
|
var rack_rate_si = [];
|
||||||
|
|
||||||
siInputs.each(function() {
|
siInputs.each(function() {
|
||||||
var input = $(this).val();
|
var input = $(this).val();
|
||||||
array2.push(input.replace(/,/g, ''));
|
console.log('input value', input);
|
||||||
|
rack_rate_si.push(input.replace(/,/g, ''));
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('array1', array1)
|
console.log('policy_terms_si', policy_terms_si);
|
||||||
console.log('array2', array2)
|
console.log('rack_rate_si', rack_rate_si);
|
||||||
|
|
||||||
|
let new_array = [];
|
||||||
|
|
||||||
function intersection(arr1, arr2) {
|
rack_rate_si.forEach(element => {
|
||||||
return arr1.filter(value => arr2.includes(value));
|
if (!policy_terms_si.includes(element)) {
|
||||||
|
new_array.push(element);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var commonElements = intersection(array1, array2);
|
console.log('filtered array', new_array);
|
||||||
|
|
||||||
function removeCommonElements(arr, common) {
|
var arrayLength = new_array.length;
|
||||||
return arr.filter(value => !common.includes(value));
|
console.log('arrayLength', arrayLength);
|
||||||
}
|
|
||||||
|
|
||||||
array1 = removeCommonElements(array1, commonElements);
|
|
||||||
array2 = removeCommonElements(array2, commonElements);
|
|
||||||
|
|
||||||
console.log('array1', array1)
|
|
||||||
console.log('array2', array2)
|
|
||||||
|
|
||||||
|
|
||||||
// var result = array1.concat(array2);
|
|
||||||
var result = array1;
|
|
||||||
|
|
||||||
console.log('result', result)
|
|
||||||
|
|
||||||
arrayLength = result.length;
|
|
||||||
|
|
||||||
console.log('arrayLength', arrayLength)
|
|
||||||
|
|
||||||
if (arrayLength > 0) {
|
if (arrayLength > 0) {
|
||||||
callback(true);
|
callback(true);
|
||||||
} else {
|
} else {
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.log(xhr.responseText);
|
||||||
console.error(status, error);
|
console.log(status, error);
|
||||||
toastr.error(`Failed to retrieve Policy Terms. Error: ${error}`);
|
console.log(`Failed to retrieve Policy Terms. Error: ${error}`);
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -377,12 +377,17 @@ function generateTable(rack_rate_type) {
|
|||||||
$('#excel_table').html(table);
|
$('#excel_table').html(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(secondKey != 2){
|
||||||
|
console.log(secondKey)
|
||||||
if ($('.duplicate').length > 0) {
|
if ($('.duplicate').length > 0) {
|
||||||
//console.log('test');
|
//console.log('test');
|
||||||
toastr.warning("Duplicates found!", "warning");
|
toastr.warning("Duplicates found!", "warning");
|
||||||
$('.excel_table_class').empty();
|
$('.excel_table_class').empty();
|
||||||
$('.excel_textarea').val('');
|
$('.excel_textarea').val('');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (emptyCellCount > 0) {
|
if (emptyCellCount > 0) {
|
||||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||||
@ -566,4 +571,5 @@ function submitData(rack_rate_type) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -138,6 +138,17 @@ class csvExport {
|
|||||||
|
|
||||||
|
|
||||||
function removePolciyType(element) {
|
function removePolciyType(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this!",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/policy/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/policy/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -150,26 +161,24 @@ function removePolciyType(element) {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('Policy type removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove policy type', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove policy type', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -507,6 +507,17 @@ function validateForm() {
|
|||||||
|
|
||||||
|
|
||||||
function removeTPABranch(element) {
|
function removeTPABranch(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this TPA branch.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/tpa/branch/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/tpa/branch/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -519,24 +530,23 @@ function validateForm() {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('TPA branch removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove TPA branch', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove TPA branch', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -132,6 +132,17 @@ class csvExport {
|
|||||||
|
|
||||||
|
|
||||||
function removeTPA(element) {
|
function removeTPA(element) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this TPA",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
var id = element.getAttribute('data-id');
|
||||||
var form_action = '<?= base_url("master/tpa/remove/") ?>' + id;
|
var form_action = '<?= base_url("master/tpa/remove/") ?>' + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -144,27 +155,24 @@ function removeTPA(element) {
|
|||||||
// console.log(res.status == true);
|
// console.log(res.status == true);
|
||||||
if(res){
|
if(res){
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Remove Done!', 'success');
|
toastr.success('TPA removed successfully', 'success');
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Remove Not Done!', 'warning');
|
toastr.warning('Failed to remove TPA', 'warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Failed to remove TPA', 'warning');
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
"laminas/laminas-escaper": "^2.9",
|
"laminas/laminas-escaper": "^2.9",
|
||||||
"php-amqplib/php-amqplib": "^2.8",
|
"php-amqplib/php-amqplib": "^2.8",
|
||||||
"phpmailer/phpmailer": "^6.9",
|
"phpmailer/phpmailer": "^6.9",
|
||||||
"phpoffice/phpspreadsheet": "^2.0",
|
"phpoffice/phpspreadsheet": "^2.1",
|
||||||
"psr/log": "^1.1",
|
"psr/log": "^1.1",
|
||||||
"slim/slim": "^4.13",
|
"slim/slim": "^4.13",
|
||||||
"zircote/swagger-php": "^4.8"
|
"zircote/swagger-php": "^4.8"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user