diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c65a956a..9bda7547 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -194,11 +194,28 @@ $routes->cli('processjob', 'JobWorker::processJob'); // $routes->get("/api", "RestAuthenticationController::index"); -$routes->post("/api/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); -$routes->post("/api/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); +$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); +$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); $routes->group("/api", ["filter" => "authJWT"], function($routes){ $routes->post("logined", "RestAuthenticationController::logined"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); +}); + + +$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1"); +$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile"); + +$routes->get("/getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); +$routes->post("/employeeUpload", "EmployeeRestController::employeeUpload"); + + +$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ + $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); + $routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence"); + $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); + $routes->get("/relationshipList", "EmployeeRestController::relationshipList"); +}); + + -}); \ No newline at end of file diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 8575d6b0..bf7767d4 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -592,18 +592,85 @@ class ClientController extends AdminController public function createClientPolicyPremium() { + // print_r($this->request->getPost());die(); $policy_type = $this->request->getPost('policy_type'); $client_id = $this->request->getPost('client_id'); $client_policy_id = $this->request->getPost('client_policy_id'); $policy_grid_id = $this->request->getPost('policy_grid_id'); + $multiplier = $this->request->getPost('multiplier'); + $si_or_bp = $this->request->getPost('si_or_bp'); + $basic_multiplier = $this->request->getPost('basic_multiplier'); + $premium_multiplier =$this->request->getPost('premium_multiplier'); + $basic_pay = $this->request->getPost('basic_pay'); if($policy_type !== null && $policy_type !== ''){ - $data = $this->request->getPost(); - $data['created_by'] = get_session_userid(); $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); - $insert = $this->policyPremium1Model->insert($data); + $premiumData = $this->request->getPost('premium'); + for ($i = 0; $i < count($premiumData); $i++) { + $data = [ + 'client_id' => $client_id, + 'client_policy_id' => $client_policy_id, + 'policy_grid_id' => $policy_grid_id, + 'created_by' => get_session_userid(), + ]; + + if(is_array($this->request->getPost('si'))){ + $si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null; + }else{ + $si = $this->request->getPost('si'); + } + + if(is_array($this->request->getPost('premium'))){ + $premium = isset($this->request->getPost('premium')[$i]) ? $this->request->getPost('premium')[$i] : null; + }else{ + $premium = $this->request->getPost('premium'); + } + // $basic_gpa_premium = isset($basic_gpa_premium[$i]) ? $basic_gpa_premium[$i] : null; + if ($si !== null) { + $data['si'] = $si; + } + if ($premium !== null) { + $data['premium'] = $premium; + } + + if ($multiplier !== null) { + $data['multiplier'] = $multiplier; + } + + if ($si_or_bp !== null) { + $data['si_or_bp'] = $si_or_bp; + } + + if ($premium_multiplier !== null) { + $data['multiplier'] = $premium_multiplier; + } + + if ($basic_multiplier !== null) { + $data['basic_multiplier'] = $basic_multiplier; + } + + if ($basic_pay !== null) { + $data['basic_pay'] = $basic_pay; + } + + $this->policyPremium1Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + + if($insert){ + return $this->respond(['status' => true,'code' => 200,'data' => $data], 200); + }else{ + return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200); + + } + // print_r($data); + // die(); + // $data['created_by'] = get_session_userid(); + // $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); + // $insert = $this->policyPremium1Model->insert($data); }else{ $this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); @@ -752,9 +819,9 @@ class ClientController extends AdminController $search_term = 'GPA'; } $results = $this->policyGridModel->like('policy_type', $search_term)->findAll(); - if($search_term === 'GPA'){ $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); + }else{ $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } @@ -763,6 +830,8 @@ class ClientController extends AdminController // echo '
';
// print_r($results);
// print_r($data[0]->policy_type); die;
+ // echo "hello";
+ // print_r($premiumData);
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData, 'count' => $emp_count, 'policy_name' => $policy_name], 200);
}
@@ -887,8 +956,7 @@ class ClientController extends AdminController
}
public function policyGPATerms()
- {
-
+ {
try {
$this->myLogger->logme('error','Policy GPA Terms CREATE function called');
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
new file mode 100644
index 00000000..8692e2df
--- /dev/null
+++ b/app/Controllers/EmployeeRestController.php
@@ -0,0 +1,284 @@
+myLogger = \Config\Services::mylogger();
+ $this->employeeModel = new EmployeeModel();
+ $this->employeePolicyModel = new EmployeePolicyModel();
+ $this->clientModel = new ClientModel();
+ $this->policesModel = new PolicesModel();
+ $this->relationshipModel = new RelationshipModel();
+ }
+
+
+ public function getEmployeeProfile()
+ {
+ try {
+ $emp_code = $this->request->getGet('emp_code');
+ if ($emp_code) {
+ $relationship = 'self';
+ $employee = $this->employeeModel->where('emp_code', $emp_code)
+ ->where('relationship', $relationship)
+ ->first();
+ $result = $employee;
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+ }
+ } catch (\Throwable $th) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+ }
+ }
+
+
+ public function editEmployeeProfile()
+ {
+ try {
+ $data = $this->request->getJSON();
+ if ($data) {
+ $id = $data->id;
+ $employee = $this->employeeModel->update($id, $data);
+
+ if ($employee) {
+ $result = [];
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+ }
+ }
+ } catch (\Throwable $th) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+ }
+
+ }
+
+
+ public function getEmployeeAndDependence()
+ {
+ try {
+ $emp_code = $this->request->getGet('emp_code');
+ if ($emp_code) {
+ $employee = $this->employeeModel->where('emp_code', $emp_code)
+ ->findAll();
+
+ $result = $employee;
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+ }
+ } catch (\Throwable $th) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+ }
+
+ }
+
+
+ public function editEmployeeAndDependence()
+ {
+ try {
+ $data = $this->request->getJSON();
+ if ($data) {
+ $updatedCount = 0;
+ foreach ($data as $item) {
+ $id = $item->id;
+ $employee = $this->employeeModel->update($id, (array)$item);
+ if ($employee) {
+ $updatedCount++;
+ }
+ }
+
+ if ($updatedCount > 0) {
+ $result = [];
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
+ } else {
+ $result = "No Matches";
+ return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
+ }
+ }
+ } catch (\Throwable $th) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $th], 500);
+ }
+
+ }
+
+
+ public function addEmployeeAndDependence()
+ {
+ try {
+ $data = $this->request->getJSON();
+
+
+ if ($data) {
+ $updatedCount = 0;
+ foreach ($data as $item) {
+ $extractData['name'] = $item->name;
+ $extractData['emp_code']= $item->emp_code;
+ $extractData['email_corporate']=$item->email_corporate;
+ $extractData['relationship_code']=$item->relationship_code;
+ $extractData['mobile']=$item->mobile;
+ $extractData['gender']=$item->gender;
+ $extractData['dob']=$item->dob;
+ $extractData['client_id']=$item->client_id;
+ // print_r($extractData);die();
+ $employee = $this->employeeModel->insert($extractData);
+ if ($employee) {
+ $updatedCount++;
+ }
+ }
+
+ if ($updatedCount > 0) {
+ $result = [];
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
+ } else {
+ $result = "No Matches";
+ return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
+ }
+ }
+ } catch (\Exception $e) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+ }
+
+ }
+
+
+ public function getEmployeePolicy()
+ {
+ $id= 1;
+ try {
+ $keysToRemove = ["sum_insured","family_floater","corporatebuffer","family_floaters"];
+
+ $empPolicy = $this->employeeModel->getEmployeePolicy($id);
+ if ($empPolicy) {
+
+ $result = [];
+ foreach ($empPolicy as $array) {
+ $decodedArray = json_decode($array->Policy_Terms);
+ $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
+
+ // $client_id =$array->ClientId;
+ // $policy_id =$array->PolicyId;
+
+ // $rackRate = $this->policesModel->getPolicySlabRatesForEmpOnboard($policy_id, $client_id);
+
+ // $array->Policy_Terms = json_encode($refusingData);
+ $array->Policy_Terms = $refusingData;
+
+ $result[] = $array;
+ }
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
+ }else{
+ return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
+ }
+ } catch (\Exception $e) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+ }
+ }
+
+
+ public function relationshipList()
+ {
+ try {
+
+ $relation_ships= $this->relationshipModel->findAll();
+
+ if(count($relation_ships) > 0){
+ return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
+ }else{
+ return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
+ }
+
+ } catch (\Exception $e) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+ }
+ }
+
+
+ public function employeeUpload()
+ {
+ if ($this->request->getFile('file')) {
+ // Load PHPExcel library
+ require_once APPPATH . 'third_party/PHPExcel/PHPExcel.php';
+
+ // Load the uploaded file
+ $file = $this->request->getFile('file');
+
+ // Load file into PHPExcel
+ $inputFileType = PHPExcel_IOFactory::identify($file->getPathname());
+ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+ $objPHPExcel = $objReader->load($file->getPathname());
+
+ // Get the active sheet
+ $sheet = $objPHPExcel->getActiveSheet();
+
+ // Get the highest row number
+ $highestRow = $sheet->getHighestRow();
+
+ // Assuming your data starts from the second row (after headers)
+ for ($row = 2; $row <= $highestRow; $row++) {
+ // Get cell values
+ $name = $sheet->getCellByColumnAndRow(0, $row)->getValue();
+ $email = $sheet->getCellByColumnAndRow(1, $row)->getValue();
+ // Assuming you have more columns, adjust indexes accordingly
+
+ // Store data into database (Example using CodeIgniter's database methods)
+ $data = array(
+ 'name' => $name,
+ 'email' => $email,
+ // Add more fields as necessary
+ );
+ // Insert data into the database table
+ $this->db->insert('employees', $data);
+ }
+
+ // Optionally, you can delete the uploaded file after processing
+ unlink($file->getPathname());
+
+ // Optionally, you can redirect the user to a success page
+ redirect('employee/success');
+ } else {
+ // Handle case when no file was uploaded
+ echo 'No file uploaded!';
+ }
+
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php
index 1dc8fb89..d1cc950c 100644
--- a/app/Controllers/LoginController.php
+++ b/app/Controllers/LoginController.php
@@ -46,7 +46,8 @@ class LoginController extends BaseController
set_session_data($session_data);
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
log_message('error', 'Is User Login Sucessfully');
- $this->getUserDeviceInfo($user->id);
+
+ // $this->getUserDeviceInfo($user->id);
return redirect()->to(base_url('/dashboard/view'));
}else{
@@ -79,7 +80,7 @@ class LoginController extends BaseController
}
- public function getUserDeviceInfo($userId){
+ public function getUserDeviceInfo($userId, $type_of_user){
// Load the UserAgent library
$userAgent = $this->request->getUserAgent();
@@ -93,16 +94,19 @@ class LoginController extends BaseController
// Get the user's IP address
$ipAddress = $this->request->getIPAddress();
+
$datd = [
- 'user_id' => $userId,
+ 'user_id' => $userId,
+ 'user_type' => $type_of_user,
'ip' => $ipAddress,
'platform' => $platform,
'broswer' => $browser,
];
-
+ // print_r($datd);
+ // die();
$AuthHistoryModel = new AuthHistoryModel;
$insertAuthHistory = $AuthHistoryModel->insert($datd);
-
+ return $datd;
}
diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index e56cffb7..ac43c791 100644
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -4,8 +4,12 @@
namespace App\Controllers;
+
+use App\Controllers\LoginController;
use App\Helpers\DepositHelper;
use App\Helpers\JWTToken;
+use App\Helpers\HttpRequestHelper;
+
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@@ -15,7 +19,7 @@ use CodeIgniter\API\ResponseTrait;
use App\Models\EmployeeModel;
-
+use App\Models\AuthHistoryModel;
use Firebase\JWT\JWT;
// require_once('../vendor/autoload.php');
@@ -28,6 +32,7 @@ class RestAuthenticationController extends AdminController
protected $myLogger;
protected $employeeModel;
+ protected $authHistoryModel;
public function __construct()
@@ -36,6 +41,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger = \Config\Services::mylogger();
$this->employeeModel = new EmployeeModel();
+ $this->authHistoryModel = new AuthHistoryModel();
}
@@ -60,17 +66,22 @@ class RestAuthenticationController extends AdminController
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
-
- $employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
+ $randomNumber = rand(100000, 999999);
+
+ $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
+
if ($employeeData) {
- $result = ['user_verification' => true];
- return ['status' => 'success','code' => 200,'data' => $result];
+ $id= $employeeData["id"];
+ $otp = $this->employeeModel->where('id', $id)->set('otp', $randomNumber)->update();
+ $result = ['user_verification' => true , 'otp'=>$randomNumber];
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
$result = ['user_verification' => false];
- return ['status' => 'failed','code' => 404,'data' => $result];
+ return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+
}
} catch (\Throwable $th) {
- return ['status' => 'failed','code' => 505,'data' => $th];
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
}
@@ -79,16 +90,34 @@ class RestAuthenticationController extends AdminController
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
+ $otp = $this->request->getJSON()->otp;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
- if ($employeeData) {
+ if ($employeeData && $otp == $employeeData["otp"]) {
+ $auth = HttpRequestHelper::getRequestInfo();
+ if ($auth) {
+ $data = [
+ 'user_id' => $employeeData['id'],
+ 'user_type' => 'employee',
+ 'ip' => $auth['ip'],
+ 'platform' => $auth['platform'],
+ 'broswer' => $auth['browser'],
+ ];
+
+ $authdata= $this->authHistoryModel->insert($data);
+
+ }
+ $otp_null = $this->employeeModel->where('id', $employeeData["id"])->set('otp', null)->update();
+
+
+
$result = JWTToken::encode($employeeData);
- return ['status' => 'success','code' => 200,'data' => $result];
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
- return ['status' => 'failed','code' => 404,'data' => "No data"];
+ return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404);
}
- } catch (\Throwable $th) {
- return ['status' => 'failed','code' => 500,'data' => $th];
+ } catch (\Exception $e) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
}
}
diff --git a/app/Models/AuthHistoryModel.php b/app/Models/AuthHistoryModel.php
index 17c83357..ae91aed8 100644
--- a/app/Models/AuthHistoryModel.php
+++ b/app/Models/AuthHistoryModel.php
@@ -10,6 +10,7 @@ class AuthHistoryModel extends Model
protected $allowedFields = [
"id",
"user_id",
+ "user_type",
"ip",
"platform",
"broswer",
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index e6955601..b8dbc9d9 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -32,6 +32,7 @@ class ClientPolicyModel extends Model
"earned_premium_amount",
"claims_incurred_amount",
"policy_terms",
+ "open_for_enrollment",
"created_by",
"updated_by",
"Is_active",
@@ -226,5 +227,4 @@ public function getDepositlistsummary($id)
->getResult();
}
-
}
diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php
index 78cd79f4..17991b8a 100644
--- a/app/Models/EmployeeModel.php
+++ b/app/Models/EmployeeModel.php
@@ -10,9 +10,11 @@ class EmployeeModel extends Model
protected $primaryKey = 'id';
protected $allowedFields = [
"id",
+ "client_id",
"employee_id",
"change_event",
"relationship_id",
+ "relationship",
"batch_id",
"emp_code",
"name",
@@ -21,9 +23,24 @@ class EmployeeModel extends Model
"mobile",
"gender",
"dob",
+ "otp",
"emp_status",
"created_by",
"updated_by",
"is_active",
];
+
+
+
+ public function getEmployeePolicy($id)
+ {
+
+ return $this->db->table('employee_polices')
+ ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
+ ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
+ ->join('policies', 'policies.id = client_policy.policy_id')
+ ->where('employee_polices.employee_id', $id)
+ ->get()
+ ->getResult();
+ }
}
diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php
index 23b47f0e..074575f3 100644
--- a/app/Models/PolicesModel.php
+++ b/app/Models/PolicesModel.php
@@ -28,4 +28,24 @@ class PolicesModel extends Model
->get()
->getResult();
}
+
+
+
+ public function getPolicySlabRatesForEmpOnboard($policy_id,$client_id)
+ {
+
+ $premium_slab_data = null;
+ $policyPremium1Model = new policyPremium1Model();
+
+ $premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
+ if((isset($premium_slab_data)))
+ {
+ $policyPremium2Model = new policyPremium2Model();
+ $premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
+ }
+ $grid_id = $premium_slab_data[0]['policy_grid_id'];
+ $policyGridModel = new policyGridModel();
+ $results = $policyGridModel->find($grid_id);
+ return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
+ }
}
diff --git a/app/Models/PolicyPremium1Model.php b/app/Models/PolicyPremium1Model.php
index 517127b0..ec5d5b65 100644
--- a/app/Models/PolicyPremium1Model.php
+++ b/app/Models/PolicyPremium1Model.php
@@ -15,6 +15,10 @@ class PolicyPremium1Model extends Model
'client_policy_id',
'policy_grid_id',
'si',
+ 'si_or_bp',
+ 'basic_multiplier',
+ 'premium_multiplier',
+ 'basic_pay',
'premium',
'multiplier',
"created_by",
diff --git a/app/Models/RelationshipModel.php b/app/Models/RelationshipModel.php
new file mode 100644
index 00000000..ff0a103f
--- /dev/null
+++ b/app/Models/RelationshipModel.php
@@ -0,0 +1,23 @@
+';
$.ajax({
@@ -301,6 +309,10 @@ $(document).ready(function () {
dataType: 'json',
success: function (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res)
$('#add_branch').show();
$('#branch_table').hide();
@@ -329,6 +341,11 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
console.log(branch_form_action);
diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php
index 9ea8fbea..c21e07c0 100644
--- a/app/Views/client_kyc.php
+++ b/app/Views/client_kyc.php
@@ -144,6 +144,9 @@
return;
}
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
+
$.ajax({
url: '= base_url("client/kyc/create"); ?>',
type: 'POST',
@@ -151,6 +154,10 @@
processData: false,
contentType: false,
success: function (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
// res = JSON.parse(res)
// console.log(res);
form.trigger('reset')
@@ -166,12 +173,20 @@
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
});
if(kycPrimaryKey !== ''){
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: '= base_url("client/kyc/list/"); ?>' + '= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
type: "GET",
@@ -179,6 +194,10 @@
processData: false,
contentType: false,
success: function (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
var tbody = $('#tbody');
tbody.empty();
@@ -200,6 +219,12 @@
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
@@ -263,6 +288,9 @@
}
var formData = new FormData($('#kyc_form')[0]);
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
+
$.ajax({
data: formData,
url: '= base_url("client/kyc/create"); ?>',
@@ -272,6 +300,10 @@
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
$('#kyc_form').trigger('reset')
var message = (kycPrimaryKey === '') ? 'KYC Docs Uploaded successfully' : 'KYC Docs Uploaded successfully';
@@ -296,6 +328,12 @@
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 116a8467..c40d7200 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -330,7 +330,7 @@
$.get(url, function(res) {
// res = JSON.parse(res)//
- console.log(res)
+ // console.log(res)
var OptionsHTML = '';
OptionsHTML += '';
$.each(res.data, function(index, item) {
@@ -348,7 +348,7 @@
$('#policy').change(function(){
var dataId = $(this).children('option:selected').attr('data-id');
- console.log('dataId', dataId)
+ // console.log('dataId', dataId)
$('#policy_type_id').val(dataId);
// if(dataId == 1){
@@ -366,15 +366,20 @@
// var policy_id = $(this).data('id');
// console.log('1', policy_id)
var policy_id = $(this).attr('data-id');
- console.log('2', policy_id)
+ // console.log('2', policy_id)
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: '= base_url("client/policy/list/") ?>' + policy_id,
type: "GET",
dataType: 'json',
success: function (res) {
-
- console.log('clientPolicy : ', res);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
+ // console.log('clientPolicy : ', res);
$('#policy_form_action').val('= base_url("client/policy/edit"); ?>');
if (res.status === false) {
@@ -409,7 +414,7 @@
var policeOptionHTML = '';
$.each(res.policy, function(index, item) {
- console.log(item)
+ // console.log(item)
policeOptionHTML += '';
});
$('#policy').html(policeOptionHTML);
@@ -417,6 +422,11 @@
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
});
@@ -428,7 +438,7 @@
var client_id = $('#client_id_policy').val()
- console.log('client_policy_id', client_policy_id);
+ // console.log('client_policy_id', client_policy_id);
if(client_policy_id){
$('.loader').fadeIn();
@@ -442,7 +452,7 @@
client_policy_id : client_policy_id,
},
success: function(res) {
- console.log(res);
+ // console.log(res);
if(res) {
setTimeout(function() {
$('.loader').fadeOut();
@@ -694,6 +704,7 @@
}
function convertCommaNumberToWords(input) {
+ // console.log(input);
const number = parseInt(input.replace(/,/g, ''), 10);
return convertNumberToWords(number);
}
@@ -706,11 +717,23 @@
}
- function formatNumber(input) {
- var value = input.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
- input.value = value;
- }
+ function formatNumber(input, maxLength) {
+ maxLength=16;
+ let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters
+
+ // Limit the number of digits
+ value = value.slice(0, maxLength);
+
+ // Format the number with commas using Indian numbering system
+ value = Number(value).toLocaleString('en-IN');
+ input.value = value;
+ basicPayMultiple(input)
+ if (input.id == 'gpa_si') {
+ gpaSumInsureMultiplier();
+ }
+ return ;
+}
\ No newline at end of file
diff --git a/app/Views/client_rm.php b/app/Views/client_rm.php
index fa7a7b52..fc8dbdae 100644
--- a/app/Views/client_rm.php
+++ b/app/Views/client_rm.php
@@ -151,6 +151,11 @@ $(document).ready(function(){
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php
index 9acef300..8abe76d4 100644
--- a/app/Views/insurer_basic_info.php
+++ b/app/Views/insurer_basic_info.php
@@ -79,6 +79,10 @@ $(document).ready(function () {
var formData = new FormData($('#insurer_general_form')[0]);
var OptionsHTML1 = ''
+
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
+
$.ajax({
data: formData,
url: form_action,
@@ -87,7 +91,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
-
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
$('#insurer_id').val(res.data.id);
$('#insurer_id_branch').val(res.data.id);
@@ -108,6 +115,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
diff --git a/app/Views/insurer_branch.php b/app/Views/insurer_branch.php
index 44c276f0..638abe01 100644
--- a/app/Views/insurer_branch.php
+++ b/app/Views/insurer_branch.php
@@ -222,6 +222,8 @@ $(document).ready(function () {
var formData = new FormData($('#insurer_branch_form')[0]);
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
data: formData,
url: insurer_branch_form_action,
@@ -230,6 +232,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
// $('#insurer_branch_list tr').remove();
var insurerBranchTableInsert = ''
@@ -254,6 +260,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
@@ -266,12 +278,19 @@ $(document).ready(function () {
contactCount =1;
var branch_id = $(this).attr('data-id');
insurer_branch_form_action = '= base_url("master/insurer/branch/edit"); ?>';
+
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: ''+branch_id,
type: "GET",
dataType: 'json',
success: function (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
@@ -300,6 +319,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
});
@@ -317,10 +342,17 @@ $(document).ready(function () {
var insurer_branch_action = base_url + insurer_Branch_PrimaryKey;
if ($('#insurer_id_branch').val() != '') {
+
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: insurer_branch_action,
type: 'GET',
success: function(response) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
var branchTable = '';
$.each(response.insuer_branch, function(index, item) {
branchTable += `
@@ -336,6 +368,12 @@ $(document).ready(function () {
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
diff --git a/app/Views/kyc_docs.php b/app/Views/kyc_docs.php
index 4e4be6f3..94fef8af 100644
--- a/app/Views/kyc_docs.php
+++ b/app/Views/kyc_docs.php
@@ -155,6 +155,8 @@ $(document).ready(function () {
var formData = new FormData($('#kyc_docs_form')[0]);
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
data: formData,
url: kyc_docs_form_action,
@@ -163,6 +165,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
$('#insurer_branch_list tr').remove();
var insurerBranchTableInsert = ''
@@ -183,6 +189,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
@@ -191,11 +203,17 @@ $(document).ready(function () {
$('body').on('click', '.btnBranchEdit', function () {
var branch_id = $(this).attr('data-id');
kyc_docs_form_action = '= base_url("master/kyc/kycdocs/edit"); ?>';
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: ''+branch_id,
type: "GET",
dataType: 'json',
success: function (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log("right.........");
$('#add_branch').show();
$('#branch_table').hide();
@@ -211,6 +229,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
});
@@ -228,6 +252,8 @@ $(document).ready(function () {
var kyc_docs_action = base_url + kyc_Docs_PrimaryKey;
console.log(kyc_docs_action);
if (kyc_Docs_PrimaryKey != '') {
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: kyc_docs_action,
type: "GET",
@@ -235,6 +261,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
var insurerBranchTableInsert = '';
$.each(res.kyc_docs, function(index, item) {
insurerBranchTableInsert += `
@@ -249,6 +279,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
diff --git a/app/Views/kyc_entity_type_basic_info.php b/app/Views/kyc_entity_type_basic_info.php
index 18cff9f4..081803cc 100644
--- a/app/Views/kyc_entity_type_basic_info.php
+++ b/app/Views/kyc_entity_type_basic_info.php
@@ -54,7 +54,9 @@ $(document).ready(function () {
}
var formData = new FormData($('#kyc_general_form')[0]);
- var OptionsHTML1 = ''
+ var OptionsHTML1 = '';
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
data: formData,
url: form_action,
@@ -63,6 +65,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
$('#kyc_type_id').val(res.data.PrimaryKey);
$('#kyc_id_docs').val(res.data.PrimaryKey);
@@ -73,6 +79,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index 21d677aa..d9b9f461 100644
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -200,6 +200,22 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/policy_type_basic_info.php b/app/Views/policy_type_basic_info.php
index 2ce5ae8c..f11a109c 100644
--- a/app/Views/policy_type_basic_info.php
+++ b/app/Views/policy_type_basic_info.php
@@ -71,7 +71,9 @@ $(document).ready(function () {
}
var formData = new FormData($('#policytype_general_form')[0]);
- var OptionsHTML1 = ''
+ var OptionsHTML1 = '';
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
data: formData,
url: form_action,
@@ -80,6 +82,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
$('#policy_type_id').val(res.data.PrimaryKey);
$('#policy_id_type').click();
@@ -90,6 +96,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
diff --git a/app/Views/tpa_basic_info.php b/app/Views/tpa_basic_info.php
index 7ebe2c1c..0a103bc7 100644
--- a/app/Views/tpa_basic_info.php
+++ b/app/Views/tpa_basic_info.php
@@ -56,7 +56,9 @@ $(document).ready(function () {
}
var formData = new FormData($('#tpa_general_form')[0]);
- var OptionsHTML1 = ''
+ var OptionsHTML1 = '';
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
data: formData,
url: form_action,
@@ -65,6 +67,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
$('#tpa_id').val(res.data.id);
@@ -86,6 +92,11 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
diff --git a/app/Views/tpa_branch.php b/app/Views/tpa_branch.php
index d1eb9977..7c99a4d3 100644
--- a/app/Views/tpa_branch.php
+++ b/app/Views/tpa_branch.php
@@ -231,6 +231,10 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log(res);
$('#tpa_branch_list tr').remove();
var tpaBranchTableInsert = ''
@@ -253,6 +257,11 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}
@@ -263,11 +272,17 @@ $(document).ready(function () {
contactCount =1;
var branch_id = $(this).attr('data-id');
tpa_branch_form_action = '= base_url("master/tpa/branch/edit"); ?>';
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: ''+branch_id,
type: "GET",
dataType: 'json',
success: function (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
console.log("tpa.............");
console.log(res)
$('#add_branch').show();
@@ -297,6 +312,12 @@ $(document).ready(function () {
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
});
@@ -310,10 +331,16 @@ $(document).ready(function () {
var tpa_branch_action = base_url + tpa_Branch_PrimaryKey;
if ($('#tpa_id_branch').val() != '') {
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
$.ajax({
url: tpa_branch_action,
type: 'GET',
success: function(response) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
var branchTable = '';
$.each(response.tpa_branch, function(index, item) {
branchTable += `
@@ -329,6 +356,11 @@ $(document).ready(function () {
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
}
});
}