Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
c806097615
@ -10,8 +10,16 @@ use CodeIgniter\Router\RouteCollection;
|
||||
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
|
||||
// Reminder Mail Notification
|
||||
|
||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||
|
||||
|
||||
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
||||
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
|
||||
$routes->get("getAdvertiseImage/(:any)", "AppContentManagementController::getAdvertiseImage/$1");
|
||||
$routes->get("frontend_content", "AppContentManagementController::frontend_content");
|
||||
|
||||
|
||||
// $routes->get('/', 'LoginController::index');
|
||||
$routes->get('/test', 'Home::index');
|
||||
$routes->get('/login', 'LoginController::index'); ///auth/google
|
||||
@ -213,7 +221,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "MasterController::createCDMasterData");
|
||||
$routes->post("edit", "MasterController::editCDMasterData");
|
||||
$routes->get("list/(:any)", "MasterController::getCDMasterDataByID/$1");
|
||||
// $routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::removeCDMaster/$1");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
96
app/Controllers/AppContentManagementController.php
Normal file
96
app/Controllers/AppContentManagementController.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
// declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
use App\Models\AddImgModel;
|
||||
use App\Models\FEContentModel;
|
||||
|
||||
class AppContentManagementController extends AdminController
|
||||
{
|
||||
use ResponseTrait;
|
||||
protected $myLogger;
|
||||
protected $addImgModel;
|
||||
protected $feContentModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->addImgModel = new AddImgModel();
|
||||
$this->feContentModel = new FEContentModel();
|
||||
}
|
||||
public function add_image_index()
|
||||
{
|
||||
$this->myLogger->logme('error','Addvertisement Image list function called');
|
||||
$headerData['page_name'] = 'Addvertisement Image List';
|
||||
$data['addImageList'] = $this->addImgModel->findAll();
|
||||
|
||||
// dd($data);
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('add_image_list', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
// $this->loadLayout('client_onboarding', $data);
|
||||
}
|
||||
|
||||
public function add_advertise_image(){
|
||||
|
||||
// print_r($this->request->getPost());die;
|
||||
$uploadFilePath = ROOTPATH . 'public/uploads/advertiseImage/';
|
||||
$file_name = file_Upload($this->request->getFile('advertise_image'), $uploadFilePath);
|
||||
$data['id'] = $this->request->getPost('add_image_id');
|
||||
// $data['created_by'] = get_session_userid();
|
||||
$data['name'] = $file_name;
|
||||
|
||||
if($data['id'] == 0){
|
||||
$insert = $this->addImgModel->insert($data);
|
||||
if($insert){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => "success"], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
|
||||
}
|
||||
}else{
|
||||
$id = $data['id'];
|
||||
$update = $this->addImgModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => "success"], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getAdvertiseImage($image_id){
|
||||
|
||||
$image_data = $this->addImgModel->select('name')->where(['id' => $image_id])->first();
|
||||
|
||||
if($image_data){
|
||||
return $image_data['name'];
|
||||
}else{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Front End Content Area
|
||||
public function frontend_content(){
|
||||
|
||||
$data['test'] = $this->feContentModel->findAll();
|
||||
$headerData['page_name'] = 'Front-End Content';
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('frontend_content_list', $data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
}
|
||||
@ -217,11 +217,13 @@ class ClientController extends AdminController
|
||||
// 3 => 'Refund',
|
||||
// 4 => 'Debit',
|
||||
// ];
|
||||
|
||||
$subTypeOptions = [
|
||||
1 => 'Replenishment',
|
||||
2 => 'Adjustment',
|
||||
3 => 'Refund From Deletion',
|
||||
4 => 'Debit',
|
||||
5 => 'Asset Policy',
|
||||
];
|
||||
|
||||
$data['subTypeOptions'] = $subTypeOptions;
|
||||
@ -301,9 +303,9 @@ class ClientController extends AdminController
|
||||
$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_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);
|
||||
// dd($this->clientPolicyModel->getLastQuery());
|
||||
|
||||
foreach ($clientPoliceData as $key => $value) {
|
||||
|
||||
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
||||
@ -311,12 +313,10 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
$editData['client_policy'] = $clientPoliceData;
|
||||
|
||||
|
||||
$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'];
|
||||
|
||||
|
||||
// dd($editData);
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $editData);
|
||||
echo view('layout/footer');
|
||||
@ -565,6 +565,7 @@ class ClientController extends AdminController
|
||||
|
||||
if($insert){
|
||||
$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);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -661,6 +662,7 @@ class ClientController extends AdminController
|
||||
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['cd_ac_no'] = $this->request->getPost('cd_ac_no');
|
||||
$data['gst'] = $this->request->getPost('gst');
|
||||
|
||||
|
||||
|
||||
@ -757,9 +759,9 @@ class ClientController extends AdminController
|
||||
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['cd_ac_no'] = $this->request->getPost('cd_ac_no');
|
||||
$data['gst'] = $this->request->getPost('gst');
|
||||
|
||||
|
||||
|
||||
|
||||
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
||||
|
||||
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
|
||||
@ -2207,7 +2209,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
|
||||
->where('policy_type_id', $policy_type_id)
|
||||
|
||||
@ -140,15 +140,30 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// Fetch employee data for export from the database
|
||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
||||
$insurer_id = $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();
|
||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||
|
||||
if($cash_balance == null){
|
||||
// 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) {
|
||||
|
||||
$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();
|
||||
|
||||
$balance = $this->CDMasterModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// dd($cash_balance);
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = array_reduce($objects, function ($carry, $item) {
|
||||
@ -158,9 +173,8 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = round($totals, 2);
|
||||
|
||||
if (!empty($cash_balance)) {
|
||||
|
||||
|
||||
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. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
@ -363,6 +377,26 @@ class EmpDataServiceController extends BaseController
|
||||
$ids = [];
|
||||
$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;
|
||||
foreach ($objects as $obj) {
|
||||
@ -374,6 +408,14 @@ class EmpDataServiceController extends BaseController
|
||||
// echo '<pre>';
|
||||
// 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);
|
||||
$export_data['count'] = $count;
|
||||
$export_data['amount'] = $rounded_totals;
|
||||
@ -545,7 +587,7 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
//not in use
|
||||
public function generateExcelForAdditionAndDependentAddition($export_data)
|
||||
{
|
||||
$ids = [];
|
||||
@ -628,7 +670,7 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//end not in use
|
||||
|
||||
/**
|
||||
* The below functions are Imports data from an Excel file for :
|
||||
@ -2788,7 +2830,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
//Endorsement Addition and Dependent Addition
|
||||
|
||||
|
||||
//not in use
|
||||
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.
|
||||
|
||||
@ -268,22 +268,33 @@ class EmployeeController extends AdminController
|
||||
'(SELECT SUM(ep.rata_premimum) + SUM(ep.gst)
|
||||
FROM employees e
|
||||
JOIN employee_polices ep ON e.id = ep.employee_id
|
||||
WHERE e.file_id = files.id AND ep.client_policy_id = files.policy_id) as total'
|
||||
WHERE e.file_id = files.id AND ep.client_policy_id = files.policy_id) as total',
|
||||
'policy_type.policy_type' ,
|
||||
'cp.policy_no' ,
|
||||
])
|
||||
->join('user_profiles up', 'files.created_by = up.id')
|
||||
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||
->join('policies pm', 'cp.policy_id = pm.id', 'left')
|
||||
->join('policy_type', 'policy_type.id = pm.policy_type_id')
|
||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
->where('files.created_by', get_session_userid())
|
||||
->orderBy('files.created_at', 'desc')
|
||||
->findAll();
|
||||
// dd($data['fileList']);
|
||||
|
||||
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name, client_branch.branch_name')
|
||||
$data['batch_list'] = $this->batchFileModel->select(
|
||||
'batch_files.*,
|
||||
policies.name as policy_name,
|
||||
clients.short_name as client_short_name,
|
||||
client_branch.branch_name,
|
||||
client_policy.policy_no,
|
||||
policy_type.policy_type
|
||||
')
|
||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
->findAll();
|
||||
@ -411,10 +422,15 @@ class EmployeeController extends AdminController
|
||||
|
||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||
|
||||
if ($return == 0) {
|
||||
if ($return === 0) {
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
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) {
|
||||
@ -442,10 +458,14 @@ class EmployeeController extends AdminController
|
||||
|
||||
$return = $empDataServiceController->generateExcelForSIEnhancement($batch_data);
|
||||
|
||||
if ($return == 0) {
|
||||
if ($return === 0) {
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
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) {
|
||||
@ -1059,33 +1079,34 @@ class EmployeeController extends AdminController
|
||||
public function viewECard()
|
||||
{
|
||||
|
||||
$this->loadLayout('ecard_template/default_ecard');
|
||||
// $this->loadLayout('ecard_template/default_ecard');
|
||||
|
||||
// Load the session library if it's not autoloaded
|
||||
// $session = \Config\Services::session();
|
||||
|
||||
// Access session data
|
||||
$sessionData = session()->get();
|
||||
|
||||
// Check if session data exists and if expiration time is set
|
||||
if (!empty($sessionData) && isset($sessionData['isLoggedIn']) && isset($sessionData['session_expiration'])) {
|
||||
// Get the session expiration timestamp
|
||||
$expirationTimestamp = $sessionData['session_expiration'];
|
||||
|
||||
// Get the current timestamp
|
||||
$currentTimestamp = time();
|
||||
|
||||
// Check if the current time is greater than the expiration time
|
||||
if ($currentTimestamp > $expirationTimestamp) {
|
||||
// Session has expired
|
||||
echo "Session has expired";
|
||||
} else {
|
||||
// Session is active
|
||||
echo "Session is active";
|
||||
}
|
||||
} else {
|
||||
// Session data is not set or session is not started
|
||||
echo "Session is not started or data is not set";
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
$file_name = generate_filename("TCS", 'inception', 'export', 'insurer', 'policy', 'branch');
|
||||
|
||||
$batch_data = [
|
||||
'client_id' => 12,
|
||||
'client_policy_id' => 12,
|
||||
'client_branch_id' => 1,
|
||||
'insurer_or_tpa' => 'insurer',
|
||||
'event_type' => 'inception',
|
||||
'actions' => 'export',
|
||||
'file_name' => $file_name,
|
||||
];
|
||||
|
||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||
|
||||
if ($return == 0) {
|
||||
|
||||
dd('error', "Insufficient deposit amount.");
|
||||
|
||||
}else if($return == 1){
|
||||
|
||||
dd('error', "The policy does not have a CD account number.");
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
dd('error', "No data was found");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ use App\Models\NotificationModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\FEContentModel;
|
||||
use App\Models\AddImgModel;
|
||||
use App\Models\FileModel;
|
||||
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
@ -40,6 +41,8 @@ use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
|
||||
|
||||
class EmployeeRestController extends AdminController
|
||||
{
|
||||
@ -83,6 +86,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->userModel = new UserModel();
|
||||
$this->feContentModel = new FEContentModel();
|
||||
$this->addImgModel = new AddImgModel();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -622,13 +626,7 @@ class EmployeeRestController extends AdminController
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// echo $this->request->getPost('client_id');
|
||||
// die;
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||
@ -639,17 +637,12 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$jwt = $this->request->getHeader('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
// print_r($jwtParts);die;
|
||||
$token = $jwtParts[2];
|
||||
// return "hello";
|
||||
|
||||
|
||||
$token = $jwtParts[2];
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
// get the employee id from token
|
||||
$employee_id = $decodedPayload['id'];
|
||||
|
||||
|
||||
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
|
||||
if ($client_policy) {
|
||||
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
||||
@ -659,9 +652,24 @@ class EmployeeRestController extends AdminController
|
||||
$sum_insured_amount_for_check_employee_1 = isset($policy_permium_1['si']) ? $policy_permium_1['si'] : null;
|
||||
$sum_insured_amount_for_check_employee_2 = isset($policy_permium_2['si']) ? $policy_permium_2['si'] : null;
|
||||
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/excel');
|
||||
$filename = $file->getName();
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$filename;
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
|
||||
|
||||
//make an entry in DB
|
||||
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
||||
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
|
||||
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
|
||||
// dd($result);
|
||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||
{
|
||||
$result = $empServiceController->getExcelErrorData($file_id);
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "file upload failed with errors",'data' => $result], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
@ -701,13 +709,13 @@ class EmployeeRestController extends AdminController
|
||||
$check_miss_match[]=$data[0][$i];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($check_miss_match) > 0) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
|
||||
}
|
||||
}
|
||||
|
||||
if(count($data[0]) != 11){
|
||||
return json_encode($data[0]);
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
|
||||
}
|
||||
|
||||
@ -734,18 +742,6 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
$dataToInsert = [];
|
||||
$basic_cover_si= [];
|
||||
// if ($extra[9]) {
|
||||
// $new_array = [];
|
||||
// for ($i=0; $i < count($extra[9]); $i++) {
|
||||
// if ($sum_insured_amount_for_check_employee_2 != $extra[9][$i] || $sum_insured_amount_for_check_employee_1 != $extra[9][$i]) {
|
||||
// $new_array[] = $i+1;
|
||||
// }
|
||||
// }
|
||||
// if (count($new_array) > 0) {
|
||||
// $count =count($new_array);
|
||||
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "$count Employee Sum Insured is Not Match.. " , 'data' => $new_array], 200);
|
||||
// }
|
||||
// }
|
||||
foreach ($extra['0'] as $index => $id) {
|
||||
$relation ='';
|
||||
if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') {
|
||||
|
||||
@ -35,14 +35,576 @@ class EmployeeServiceController extends AdminController
|
||||
protected $policiesModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $messageModel;
|
||||
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship','default_age_ratio']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>null,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom' => 'check_doc','params' => ['row','policy_details']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_dup_mobileno','params' => ['row','existing_mobilenos']],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $general_relationships = [
|
||||
'self' => [
|
||||
'name' => 'Self',
|
||||
'gender' => 'M',
|
||||
'age_min' => 18,
|
||||
'age_max' => null
|
||||
],
|
||||
'spouse' => [
|
||||
'name' => 'Spouse',
|
||||
'gender' => 'F',
|
||||
'age_min' => 18,
|
||||
'age_max' => null
|
||||
],
|
||||
'son' => [
|
||||
'name' => 'Son',
|
||||
'gender' => 'M',
|
||||
'age_min' => null,
|
||||
'age_max' => 25
|
||||
],
|
||||
'daughter' => [
|
||||
'name' => 'Daughter',
|
||||
'gender' => 'F',
|
||||
'age_min' => null,
|
||||
'age_max' => 25
|
||||
],
|
||||
'father' => [
|
||||
'name' => 'Father',
|
||||
'gender' => 'M',
|
||||
'age_min' => 18,
|
||||
'age_max' => null
|
||||
],
|
||||
'mother' => [
|
||||
'name' => 'Mother',
|
||||
'gender' => 'F',
|
||||
'age_min' => 18,
|
||||
'age_max' => null
|
||||
],
|
||||
'father-in-law' => [
|
||||
'name' => 'Father in Law',
|
||||
'gender' => 'M',
|
||||
'age_min' => 18,
|
||||
'age_max' => null
|
||||
],
|
||||
'mother-in-law' => [
|
||||
'name' => 'Mother in Law',
|
||||
'gender' => 'F',
|
||||
'age_min' => 18,
|
||||
'age_max' => null
|
||||
]
|
||||
];
|
||||
|
||||
protected $inception_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'S.No',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_id' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'EMP ID',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name_of_emp_dep' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'NAME OF EMP/DEP',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'dob' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'DOB',
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_dob_diff',
|
||||
'params' => ['row', 'relationship', 'default_age_ratio']
|
||||
],
|
||||
'gender' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Gender',
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F']
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 5,
|
||||
'col_cell_name' => 'F',
|
||||
'col_name' => 'RELATIONSHIP',
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_relationship',
|
||||
'params' => ['row', 'relationship', 'policy_terms']
|
||||
],
|
||||
'basic_cover_si' => [
|
||||
'col_idx' => 6,
|
||||
'col_cell_name' => 'G',
|
||||
'col_name' => 'BASIC COVER SI',
|
||||
'is_mandatory' => null,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_si',
|
||||
'params' => ['row', 'policy_terms', 'slab_details']
|
||||
],
|
||||
'doc' => [
|
||||
'col_idx' => 7,
|
||||
'col_cell_name' => 'H',
|
||||
'col_name' => 'Date of Coverage',
|
||||
'is_mandatory' => ['A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_doc',
|
||||
'params' => ['row', 'policy_details']
|
||||
],
|
||||
'doj' => [
|
||||
'col_idx' => 8,
|
||||
'col_cell_name' => 'I',
|
||||
'col_name' => 'DOJ',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_doj',
|
||||
'params' => ['row']
|
||||
],
|
||||
'basic_pay' => [
|
||||
'col_idx' => 9,
|
||||
'col_cell_name' => 'J',
|
||||
'col_name' => 'Basic Pay',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_basic_pay',
|
||||
'params' => ['row', 'policy_terms', 'slab_details']
|
||||
],
|
||||
'band_grade' => [
|
||||
'col_idx' => 10,
|
||||
'col_cell_name' => 'K',
|
||||
'col_name' => 'Band/Grade',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_employee_band',
|
||||
'params' => ['row', 'policy_terms', 'slab_details']
|
||||
],
|
||||
'designation' => [
|
||||
'col_idx' => 11,
|
||||
'col_cell_name' => 'L',
|
||||
'col_name' => 'Designation',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'phone' => [
|
||||
'col_idx' => 12,
|
||||
'col_cell_name' => 'M',
|
||||
'col_name' => 'Phone',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_dup_mobileno',
|
||||
'params' => ['row', 'existing_mobilenos']
|
||||
],
|
||||
'email' => [
|
||||
'col_idx' => 13,
|
||||
'col_cell_name' => 'N',
|
||||
'col_name' => 'Email',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'pre_existing_ailments' => [
|
||||
'col_idx' => 14,
|
||||
'col_cell_name' => 'O',
|
||||
'col_name' => 'PRE EXISTING AILMENTS',
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['0', '1']
|
||||
],
|
||||
'change_event' => [
|
||||
'col_idx' => 15,
|
||||
'col_cell_name' => 'P',
|
||||
'col_name' => 'Change event',
|
||||
'is_mandatory' => ['A', 'DA', 'D'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'date_of_exit' => [
|
||||
'col_idx' => 16,
|
||||
'col_cell_name' => 'Q',
|
||||
'col_name' => 'Date of exit',
|
||||
'is_mandatory' => ['D'],
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null
|
||||
],
|
||||
'reason_for_exit' => [
|
||||
'col_idx' => 17,
|
||||
'col_cell_name' => 'R',
|
||||
'col_name' => 'Reason for exit',
|
||||
'is_mandatory' => ['D'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
]
|
||||
];
|
||||
|
||||
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
protected $deletion_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'S.No',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_id' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'EMP ID',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name_of_emp_dep' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'NAME OF EMP/DEP',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'change_event' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'Change event',
|
||||
'is_mandatory' => ['D'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'date_of_exit' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Date of exit',
|
||||
'is_mandatory' => ['D'],
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null
|
||||
],
|
||||
'reason_for_exit' => [
|
||||
'col_idx' => 5,
|
||||
'col_cell_name' => 'F',
|
||||
'col_name' => 'Reason for exit',
|
||||
'is_mandatory' => ['D'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
]
|
||||
];
|
||||
|
||||
protected $correction_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'field'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Field','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>['name','dob','relationship']],'value'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Value','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_correction'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Date of Correction','is_mandatory'=>true,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'change_event'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'Change event','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'remarks'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Remarks','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
protected $correction_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'S.No',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_id' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'EMP ID',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name_of_emp_dep' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'NAME OF EMP/DEP',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'field' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'Field',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['name', 'dob', 'relationship']
|
||||
],
|
||||
'value' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Value',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'date_of_correction' => [
|
||||
'col_idx' => 5,
|
||||
'col_cell_name' => 'F',
|
||||
'col_name' => 'Date of Correction',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null
|
||||
],
|
||||
'change_event' => [
|
||||
'col_idx' => 6,
|
||||
'col_cell_name' => 'G',
|
||||
'col_name' => 'Change event',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'remarks' => [
|
||||
'col_idx' => 7,
|
||||
'col_cell_name' => 'H',
|
||||
'col_name' => 'Remarks',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
]
|
||||
];
|
||||
|
||||
protected $si_enhance_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'augmented_si'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Augmented SI','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'date_of_enhancement'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of SI Enhancement','is_mandatory'=>true,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null]];
|
||||
protected $si_enhance_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'S.No',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_id' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'EMP ID',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name_of_emp_dep' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'NAME OF EMP/DEP',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'augmented_si' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'Augmented SI',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => 'check_si',
|
||||
'params' => ['row', 'policy_terms', 'slab_details']
|
||||
],
|
||||
'date_of_enhancement' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Date of SI Enhancement',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null
|
||||
]
|
||||
];
|
||||
|
||||
protected $enrollment_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'Sno',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_id' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'Emp code',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name_of_emp_dep' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'Name',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'doj' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'DOJ',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'custom' => null
|
||||
],
|
||||
'gender' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Gender',
|
||||
'is_mandatory' => ['I', 'A', 'DA','E'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F']
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 5,
|
||||
'col_cell_name' => 'F',
|
||||
'col_name' => 'Relation',
|
||||
'is_mandatory' => ['I', 'A', 'DA','E'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null
|
||||
],
|
||||
'dob' => [
|
||||
'col_idx' => 6,
|
||||
'col_cell_name' => 'G',
|
||||
'col_name' => 'DOB',
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
],
|
||||
'email' => [
|
||||
'col_idx' => 7,
|
||||
'col_cell_name' => 'H',
|
||||
'col_name' => 'Mail',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'phone' => [
|
||||
'col_idx' => 8,
|
||||
'col_cell_name' => 'I',
|
||||
'col_name' => 'Mobile',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null
|
||||
],
|
||||
'basic_cover_si' => [
|
||||
'col_idx' => 9,
|
||||
'col_cell_name' => 'J',
|
||||
'col_name' => 'SI',
|
||||
'is_mandatory' => null,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null
|
||||
],
|
||||
'band_grade' => [
|
||||
'col_idx' => 10,
|
||||
'col_cell_name' => 'K',
|
||||
'col_name' => 'Grade',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null
|
||||
],
|
||||
'basic_pay' => [
|
||||
'col_idx' => 11,
|
||||
'col_cell_name' => 'L',
|
||||
'col_name' => 'Basic Pay',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null
|
||||
]
|
||||
];
|
||||
|
||||
protected $incetion_to_enrollment_mapping = [
|
||||
0 => 0, // inception: sno (S.No) -> enrollment: sno (Sno)
|
||||
1 => 1, // inception: emp_id (EMP ID) -> enrollment: emp_code (Emp_Code)
|
||||
2 => 2, // inception: name_of_emp_dep (NAME OF EMP/DEP) -> enrollment: name (NAME OF EMP/DEP)
|
||||
3 => 6, // inception: dob (DOB) -> enrollment: dob (DOB)
|
||||
4 => 4, // inception: gender (Gender) -> enrollment: gender (Gender)
|
||||
5 => 5, // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
||||
6 => 9, // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
||||
7 => null, // inception: doc (Date of Coverage) -> No match in enrollment
|
||||
8 => 3, // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
||||
9 => 11, // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
||||
10 => 10, // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
||||
11 => null, // inception: designation (Designation) -> No match in enrollment
|
||||
12 => 8, // inception: phone (Phone) -> enrollment: phone (Mobile)
|
||||
13 => 7, // inception: email (Email) -> enrollment: email (Email)
|
||||
14 => null, // inception: pre_existing_ailments (PRE EXISTING AILMENTS) -> No match in enrollment
|
||||
15 => null, // inception: change_event (Change event) -> No match in enrollment
|
||||
16 => null, // inception: date_of_exit (Date of exit) -> No match in enrollment
|
||||
17 => null // inception: reason_for_exit (Reason for exit) -> No match in enrollment
|
||||
];
|
||||
|
||||
protected $enrollment_to_inception_mapping = [
|
||||
0 => 0, // enrollment: sno (Sno) -> inception: sno (S.No)
|
||||
1 => 1, // enrollment: emp_code (Emp_Code) -> inception: emp_id (EMP ID)
|
||||
2 => 2, // enrollment: name (NAME OF EMP/DEP) -> inception: name_of_emp_dep (NAME OF EMP/DEP)
|
||||
3 => 8, // enrollment: doj (DOJ) -> inception: doj (DOJ)
|
||||
4 => 4, // enrollment: gender (Gender) -> inception: gender (Gender)
|
||||
5 => 5, // enrollment: relationship (Relation) -> inception: relationship (RELATIONSHIP)
|
||||
6 => 3, // enrollment: dob (DOB) -> inception: dob (DOB)
|
||||
7 => 13, // enrollment: email (Email) -> inception: email (Email)
|
||||
8 => 12, // enrollment: phone (Mobile) -> inception: phone (Phone)
|
||||
9 => 6, // enrollment: basic_cover_si (SI) -> inception: basic_cover_si (BASIC COVER SI)
|
||||
10 => 10, // enrollment: band_grade (Grade) -> inception: band_grade (Band/Grade)
|
||||
11 => 9 // enrollment: basic_pay (Basic Pay) -> inception: basic_pay (Basic Pay)
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -100,6 +662,7 @@ class EmployeeServiceController extends AdminController
|
||||
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
||||
|
||||
|
||||
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
|
||||
@ -162,7 +725,6 @@ class EmployeeServiceController extends AdminController
|
||||
// dd($existing_mobilenos);
|
||||
foreach ($excel_data as $row_key => $row)
|
||||
{
|
||||
|
||||
//define row wise action/event in temporary variable
|
||||
$current_column_action = null;
|
||||
if($file['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
@ -171,25 +733,44 @@ class EmployeeServiceController extends AdminController
|
||||
else if($file['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
||||
//1. avoid empty rows
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Kint::dump($keys);
|
||||
if ($file['action'] == 'enrollment')
|
||||
{
|
||||
$row = transform_enrollment_row_to_inception_row($row);
|
||||
$columns_to_check = $this->inception_excel_columns;
|
||||
$keys = array_keys($columns_to_check);
|
||||
$enrollment_columns_to_check = $this->enrollment_excel_columns;
|
||||
$enrollment_keys = array_keys($enrollment_columns_to_check);
|
||||
}
|
||||
|
||||
//iterate each row for columns validations
|
||||
foreach ($row as $col_key => $col)
|
||||
{
|
||||
|
||||
|
||||
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||
$format = $columns_to_check[$keys[$col_key]]['format'];
|
||||
$allowed_values = $columns_to_check[$keys[$col_key]]['allowed_values'];
|
||||
$custom_function = isset($columns_to_check[$keys[$col_key]]['custom']) ? $columns_to_check[$keys[$col_key]]['custom'] : null;
|
||||
$binding_params = isset($columns_to_check[$keys[$col_key]]['params']) ? $columns_to_check[$keys[$col_key]]['params'] : null;
|
||||
|
||||
$column_dispaly_name = $columns_to_check[$keys[$col_key]]['col_name'];
|
||||
$column_index = $columns_to_check[$keys[$col_key]]['col_idx'];
|
||||
$column_cell = $columns_to_check[$keys[$col_key]]['col_cell_name'];
|
||||
if($file['action'] == 'enrollment')
|
||||
{
|
||||
if(isset($enrollment_keys[$this->incetion_to_enrollment_mapping[$col_key]]) && $enrollment_keys[$this->incetion_to_enrollment_mapping[$col_key]] != null && $enrollment_keys[$this->incetion_to_enrollment_mapping[$col_key]] != "")
|
||||
{
|
||||
$column_dispaly_name = $enrollment_columns_to_check[$enrollment_keys[$this->incetion_to_enrollment_mapping[$col_key]]]['col_name'];
|
||||
$column_index = $enrollment_columns_to_check[$enrollment_keys[$this->incetion_to_enrollment_mapping[$col_key]]]['col_idx'];
|
||||
$column_cell = $enrollment_columns_to_check[$enrollment_keys[$this->incetion_to_enrollment_mapping[$col_key]]]['col_cell_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$row['current_action'] = $current_column_action;
|
||||
|
||||
//mandatory check
|
||||
@ -278,20 +859,27 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
//set failure msg to pull notifications
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id,'failure'));
|
||||
|
||||
}
|
||||
else //trigger next data validation via job queue server
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
if($file['action'] == 'enrollment') // if current action is enrollment call next validation and return result
|
||||
{
|
||||
$res = $this->excelFileDataValidation(['file_id' => $file['id']]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
// JobWorker::processJob($r);s
|
||||
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function excelFileDataValidation($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
@ -325,6 +913,7 @@ class EmployeeServiceController extends AdminController
|
||||
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
@ -347,13 +936,14 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
//remove header
|
||||
unset($excel_data[0]);
|
||||
// dd($columns_to_check);
|
||||
$relationship = $this->general_relationships;
|
||||
|
||||
|
||||
if(in_array($file['action'],['inception','addition','dependent_addition','deletion','correction','si_enhancement']))// the below funcitons are only for I,DA,A
|
||||
if(in_array($file['action'],['inception','addition','dependent_addition','deletion','correction','si_enhancement','enrollment']))// the below funcitons are only for I,DA,A
|
||||
{
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data,'excel','enrollment');
|
||||
// dd($employee_data_group_by_family);
|
||||
$is_self_available_in_policy_terms = false;
|
||||
if($policy_details['policy_type_id'] == 3) // GMC parents
|
||||
{
|
||||
@ -381,9 +971,9 @@ class EmployeeServiceController extends AdminController
|
||||
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
}
|
||||
// kint::dump($family);//die();
|
||||
|
||||
//check name dup within a family
|
||||
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition' || $file['action'] == 'enrollment')
|
||||
{
|
||||
$res = name_dup_check_within_family($family,$file['action']);//in both file data & DB data
|
||||
// dd($res);
|
||||
@ -398,11 +988,9 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
//check self availbale in uploaded file
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
// dd('file check');
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(!$res['is_self_found'])
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
@ -423,7 +1011,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception')
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception' || $file['action'] == 'enrollment')
|
||||
{
|
||||
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
|
||||
// dd($res);
|
||||
@ -494,7 +1082,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesCorrectionProcess','payload' => ['file_id' => $file_id]]);
|
||||
}
|
||||
else //inception OR addition OR dependent addition
|
||||
else if ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')//inception OR addition OR dependent addition
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
@ -502,6 +1090,8 @@ class EmployeeServiceController extends AdminController
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
@ -1123,13 +1123,7 @@ class MasterController extends AdminController
|
||||
public function CDMasterList()
|
||||
{
|
||||
|
||||
$data['CD_Master_Data'] = $this->CDMasterModel
|
||||
->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['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
||||
$data['insurers'] = $this->insurerModel->findAll();
|
||||
$data['clients'] = $this->clientModel->findAll();
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -71,7 +71,8 @@ class UserController extends AdminController
|
||||
$admin = 0;
|
||||
}
|
||||
foreach ($temp_team as $key => $value) {
|
||||
if($value == 2){
|
||||
$team = $this->teamModel->where('id' , $value)->first();
|
||||
if($team['name'] == 'Claims'){
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
|
||||
@ -13,6 +13,7 @@ use ReflectionClass;
|
||||
require_once('../vendor/autoload.php');
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\LevelContactModel;
|
||||
|
||||
|
||||
class AuthJWT implements FilterInterface
|
||||
@ -20,7 +21,6 @@ class AuthJWT implements FilterInterface
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
$jwt = $request->getHeader('Authorization');
|
||||
$model = new EmployeeModel();
|
||||
|
||||
if ($jwt) {
|
||||
if (JWTToken::validateJWT($jwt)) {
|
||||
@ -28,22 +28,44 @@ class AuthJWT implements FilterInterface
|
||||
$data = json_decode($data);
|
||||
|
||||
$id = $data->decoded->id;
|
||||
$user_data = $model->where('id', $id)->first();
|
||||
if(isset($data->decoded->emp_code)){
|
||||
$model = new EmployeeModel();
|
||||
$user_data = $model->where('id', $id)->first();
|
||||
|
||||
if($user_data['token_time_out'] > time()){
|
||||
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||
$model->update($id, $data);
|
||||
return true;
|
||||
if($user_data['token_time_out'] > time()){
|
||||
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||
$model->update($id, $data);
|
||||
return true;
|
||||
}else{
|
||||
$data =["token_time_out" => ''];
|
||||
$model->update($id, $data);
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(401);
|
||||
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||
echo $error;
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
$data =["token_time_out" => ''];
|
||||
$model->update($id, $data);
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(401);
|
||||
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||
echo $error;
|
||||
exit;
|
||||
$model = new LevelContactModel();
|
||||
$hr_data = $model->where('id', $id)->first();
|
||||
|
||||
if($hr_data['token_time_out'] > time()){
|
||||
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||
$model->update($id, $data);
|
||||
return true;
|
||||
}else{
|
||||
$data =["token_time_out" => ''];
|
||||
$model->update($id, $data);
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(401);
|
||||
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||
echo $error;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
|
||||
@ -33,7 +33,7 @@ class DepositHelper
|
||||
public static function saveDeposit(array $data, int $loggedInUserID): array
|
||||
{
|
||||
// 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
|
||||
$newBalance = self::calculateBalance(
|
||||
@ -87,24 +87,26 @@ class DepositHelper
|
||||
*
|
||||
* @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();
|
||||
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$clientId, $insurerId];
|
||||
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||
// $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();
|
||||
|
||||
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$clientId, $insurerId];
|
||||
$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, $cd_ac_no];
|
||||
|
||||
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
||||
|
||||
}
|
||||
|
||||
return $lastBalance;
|
||||
|
||||
@ -13,6 +13,7 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use ReflectionClass;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\LevelContactModel;
|
||||
|
||||
|
||||
class JWTToken
|
||||
@ -25,13 +26,20 @@ class JWTToken
|
||||
|
||||
try{
|
||||
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
||||
|
||||
$model = new EmployeeModel();
|
||||
$id = $request_data['id'];
|
||||
$data =[
|
||||
"token_time_out" => time() + getenv('TOKENTIMEOUT')
|
||||
];
|
||||
$model->update($id, $data);
|
||||
if(isset($data['emp_code'])){
|
||||
$model = new EmployeeModel();
|
||||
$model->update($id, $data);
|
||||
|
||||
}else{
|
||||
$models = new LevelContactModel();
|
||||
$models->update($id, $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
@ -65,10 +65,19 @@ if (!function_exists('check_excel_date_format')) {
|
||||
if($dateString == ""){ return array('status' => true); }
|
||||
$date = DateTime::createFromFormat('d-M-Y', $dateString);
|
||||
|
||||
if ($date !== false && !is_array($date::getLastErrors())) {
|
||||
if ($date && $date->format('d-M-Y') == $dateString) {
|
||||
return array('status' => true);
|
||||
} else {
|
||||
return array('status' => false,'error' => "wrong date format: Expected 'd-M-Y' and received $dateString");
|
||||
|
||||
$res = convert_string_to_date($dateString);
|
||||
if(!$res)
|
||||
{
|
||||
return array('status' => false,'error' => "wrong date format: Expected 'd-M-Y' and received $dateString");
|
||||
}
|
||||
else
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,14 +160,22 @@ if(!function_exists('check_doc'))
|
||||
if($row['current_action'] != null && $row[7] != null && $row[7] != '' && in_array(strtoupper($row['current_action']), ['A','DA']))// check rule only of action column data available
|
||||
{
|
||||
// dd($policy_details);
|
||||
$date = new DateTime($row[7]);
|
||||
$startDate = new DateTime($policy_details[0]->policy_start_date);
|
||||
$endDate = new DateTime($policy_details[0]->policy_end_date);
|
||||
$dateString = convert_string_to_date($row[7]);
|
||||
if($dateString)
|
||||
{
|
||||
$date = new DateTime($dateString);
|
||||
$startDate = new DateTime($policy_details[0]->policy_start_date);
|
||||
$endDate = new DateTime($policy_details[0]->policy_end_date);
|
||||
|
||||
if ($date >= $startDate && $date <= $endDate) {
|
||||
return array('status' => true);
|
||||
} else {
|
||||
return array('status' => false,'error' => 'the given date of coverage is not between policy start/end date');
|
||||
if ($date >= $startDate && $date <= $endDate) {
|
||||
return array('status' => true);
|
||||
} else {
|
||||
return array('status' => false,'error' => 'the given date of coverage is not between policy start/end date');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return array('status' => false,'error' => 'date format error');
|
||||
}
|
||||
}
|
||||
else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
@ -173,6 +190,7 @@ if(!function_exists('check_employee_band'))
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
$is_emp_band_needed = $slab_details['grid_master']['emp_band'];
|
||||
// $is_emp_band_needed = true;
|
||||
if($slab_details['grid_master']['ui_type'] == 1) //gpa rack rate 1
|
||||
{
|
||||
if($slab_details['slab_rates'][0]['si_or_bp'] == 3)
|
||||
@ -230,28 +248,31 @@ if(!function_exists('check_si'))
|
||||
// check age slab
|
||||
if(in_array(strtoupper($row['current_action']), ['I','A','DA']) && strtolower($row['5']) == 'self')
|
||||
{
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
if($row[3] != '' && $row[3] != null)// dob
|
||||
{
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
if(!$is_age_slab_found)
|
||||
{
|
||||
if(isset($slab_value['age_from']) && isset($slab_value['age_to']))
|
||||
$dob = convert_string_to_date($row[3]);
|
||||
if($dob !== false)
|
||||
{
|
||||
if($slab_value['age_from'] !== null && $slab_value['age_to'] !== null && $slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y && $slab_value['si'] == $received_si)
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
if(!$is_age_slab_found)
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age slab found
|
||||
if(isset($slab_value['age_from']) && isset($slab_value['age_to']))
|
||||
{
|
||||
if($slab_value['age_from'] !== null && $slab_value['age_to'] !== null && $slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y && $slab_value['si'] == $received_si)
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age slab found
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -292,6 +313,7 @@ if(!function_exists('check_basic_pay'))
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
$is_basic_pay_needed = $slab_details['grid_master']['basicpay'];
|
||||
// $is_basic_pay_needed = true;
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
// echo $relationship;echo $row[7];
|
||||
@ -310,12 +332,13 @@ if (!function_exists('check_dob_diff'))
|
||||
{
|
||||
if($row[3] != null && $row[5] != null)
|
||||
{
|
||||
if (DateTime::createFromFormat('d-M-Y', $row[3]) === false)
|
||||
$dateString = convert_string_to_date($row[3]);
|
||||
if ($dateString === false)
|
||||
{
|
||||
return array('status' => false,'error' => 'Not a valid Date');
|
||||
}
|
||||
// return array('status' => true);
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
$dob = $dateString;
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
// print_r($currentDateTime);
|
||||
@ -354,7 +377,7 @@ if (!function_exists('check_dob_diff'))
|
||||
|
||||
if (!function_exists('data_group_by_family'))
|
||||
{
|
||||
function data_group_by_family($emp_data,$data_source = 'excel')
|
||||
function data_group_by_family($emp_data,$data_source = 'excel',$action = '')
|
||||
{
|
||||
$result = [];
|
||||
// Kint::dump($emp_data);
|
||||
@ -364,6 +387,11 @@ if (!function_exists('data_group_by_family'))
|
||||
{
|
||||
if(!check_row_is_empty_or_null($row))
|
||||
{
|
||||
if($action == 'enrollment') //if action is enrollment transform current row into inception row, becoz we treat enrollment as inception
|
||||
{
|
||||
$row = transform_enrollment_row_to_inception_row($row);
|
||||
}
|
||||
|
||||
if(strtolower($row[5]) == 'self' && isset($result[$row[1]]))
|
||||
{
|
||||
array_unshift($result[$row[1]],$row);
|
||||
@ -474,7 +502,7 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
{
|
||||
array_push($result['del'],$row[0]);
|
||||
}
|
||||
if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition') && count($res))
|
||||
if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition' || $current_action == 'enrollment') && count($res))
|
||||
{
|
||||
array_push($result['i'],$row[0]);
|
||||
}
|
||||
@ -842,7 +870,7 @@ if (!function_exists('transform_excel_data_to_db'))
|
||||
// $policy['date_of_exit'] = isset($memArr[16]) ? change_date_format($memArr[16],'d-M-Y','Y-m-d') : NULL;
|
||||
// $policy['reason_for_exit'] = $memArr[17];
|
||||
$policy['client_policy_id'] = $actionArr['policy_id'];
|
||||
$policy['date_coverage'] = isset($memArr[7]) ? change_date_format($memArr[7],'d-M-Y','Y-m-d') : NULL;;
|
||||
$policy['date_coverage'] = isset($memArr[7]) ? convert_string_to_date($memArr[7],'Y-m-d') : NULL;
|
||||
$policy['policy_end_date'] = null;
|
||||
$policy['days'] = null;
|
||||
$policy['premium'] = null;
|
||||
@ -852,11 +880,11 @@ if (!function_exists('transform_excel_data_to_db'))
|
||||
|
||||
$result['emp_code'] = $memArr[1];
|
||||
$result['name'] = $memArr[2];
|
||||
$result['dob'] = isset($memArr[3]) ? change_date_format($memArr[3],'d-M-Y','Y-m-d') : NULL;
|
||||
$result['dob'] = isset($memArr[3]) ? convert_string_to_date($memArr[3],'Y-m-d') : NULL;
|
||||
$result['gender'] = $memArr[4];
|
||||
$result['relationship'] = $memArr[5];
|
||||
$result['relationship_code'] = $memArr[5];
|
||||
$result['doj'] = isset($memArr[8]) ? change_date_format($memArr[8],'d-M-Y','Y-m-d') : NULL;
|
||||
$result['doj'] = isset($memArr[8]) ? convert_string_to_date($memArr[8],'Y-m-d') : NULL;
|
||||
$result['basic_pay'] = $memArr[9];
|
||||
$result['band'] = $memArr[10];
|
||||
$result['designation'] = $memArr[11];
|
||||
@ -926,7 +954,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$slug = \Config\Services::slug();
|
||||
$grid_type = $emp_data['temp']['grid_id'];
|
||||
$temp_slab_rates = $emp_data['temp']['grid_type'] == 'primary' ? $slab_details['slab_rates'] : $slab_details['additional_slab_info']['slab_rates'];
|
||||
|
||||
|
||||
//if curent action is dependent addition OR addition then pull insurer master to set whether add one day from employee date of coverage
|
||||
if($emp_data['temp']['action'] == 'DA' || $emp_data['temp']['action'] == 'A')
|
||||
{
|
||||
@ -1534,4 +1562,57 @@ if(!function_exists('generate_family_relationship_array'))
|
||||
|
||||
return $family_relationships;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('convert_string_to_date'))
|
||||
{
|
||||
function convert_string_to_date($dateString,$defaultFormat = 'd-M-Y')
|
||||
{
|
||||
$formats = [
|
||||
'd-M-Y', // 03-APr-2024
|
||||
'd M Y', // 03 Apr 2024
|
||||
'd/M/Y', // 03/Apr/2024
|
||||
'j M Y', // 3 Apr 2024
|
||||
'j/M/Y', // 3/Apr/2024
|
||||
'j-M-Y', // 3-Apr-2024
|
||||
'Y-m-d' // 2024-04-04
|
||||
];
|
||||
|
||||
foreach ($formats as $format) {
|
||||
$date = DateTime::createFromFormat($format, $dateString);
|
||||
if ($date && $date->format($format) == $dateString) {
|
||||
return $date->format($defaultFormat);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('transform_enrollment_row_to_inception_row'))
|
||||
{
|
||||
function transform_enrollment_row_to_inception_row($row)
|
||||
{
|
||||
$res = [];
|
||||
$res[0] = $row[0]; // inception: sno (S.No) -> enrollment: sno (Sno)
|
||||
$res[1] = $row[1]; // inception: emp_id (EMP ID) -> enrollment: emp_code (Emp_Code)
|
||||
$res[2] = $row[2]; // inception: name_of_emp_dep (NAME OF EMP/DEP) -> enrollment: name (NAME OF EMP/DEP)
|
||||
$res[3] = $row[6]; // inception: dob (DOB) -> enrollment: dob (DOB)
|
||||
$res[4] = $row[4]; // inception: gender (Gender) -> enrollment: gender (Gender)
|
||||
$res[5] = $row[5]; // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
||||
$res[6] = $row[9]; // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
||||
$res[7] = null; // inception: doc (Date of Coverage) -> No match in enrollment
|
||||
$res[8] = $row[3]; // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
||||
$res[9] = $row[11]; // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
||||
$res[10] = $row[10]; // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
||||
$res[11] = null; // inception: designation (Designation) -> No match in enrollment
|
||||
$res[12] = $row[8]; // inception: phone (Phone) -> enrollment: phone (Mobile)
|
||||
$res[13] = $row[7]; // inception: email (Email) -> enrollment: email (Email)
|
||||
$res[14] = 1; // inception: pre_existing_ailments (PRE EXISTING AILMENTS) -> No match in enrollment
|
||||
$res[15] = null; // inception: change_event (Change event) -> No match in enrollment
|
||||
$res[16] = null; // inception: date_of_exit (Date of exit) -> No match in enrollment
|
||||
$res[17] = null; // inception: reason_for_exit (Reason for exit) -> No match in enrollment
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,9 +36,25 @@ class ClientModel extends Model
|
||||
//get client and its associated policies in same array
|
||||
public function clientsWithPolicies()
|
||||
{
|
||||
|
||||
$role_id = get_role_id();
|
||||
$user_id = get_session_userid();
|
||||
|
||||
$columns = ['clients.id ', 'client_name','short_name'];
|
||||
$clients = $this->select($columns)
|
||||
->where('is_active',1)
|
||||
->findAll();
|
||||
|
||||
// if($role_id == 2 || $role_id == 3){
|
||||
|
||||
// $clients = $this->select($columns)
|
||||
// ->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
// ->where('client_rm.user_id', $user_id)
|
||||
// ->where('clients.is_active',1)
|
||||
// ->findAll();
|
||||
// }
|
||||
|
||||
$columns = ['id', 'client_name','short_name'];
|
||||
$clients = $this->select($columns)->where('is_active',1)->findAll();
|
||||
|
||||
|
||||
foreach ($clients as &$client) {
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
@ -51,6 +67,7 @@ class ClientModel extends Model
|
||||
'client_branch.client_id',
|
||||
'client_policy.id as client_policy_id',
|
||||
'client_policy.policy_terms',
|
||||
'client_policy.policy_no',
|
||||
'p.name',
|
||||
'pt.policy_type',
|
||||
])
|
||||
|
||||
@ -43,7 +43,8 @@ class ClientPolicyModel extends Model
|
||||
"reason_for_exit",
|
||||
"policy_no",
|
||||
"client_branch_id",
|
||||
"cd_ac_no"
|
||||
"cd_ac_no",
|
||||
"gst",
|
||||
];
|
||||
|
||||
public function getClientPolicyById($id){
|
||||
@ -77,12 +78,14 @@ class ClientPolicyModel extends Model
|
||||
->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('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('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
||||
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
||||
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left')
|
||||
->join('policies', 'policies.id = client_policy.policy_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.policy_status', 1)
|
||||
->where('client_policy.is_active', 1)
|
||||
|
||||
@ -100,11 +100,14 @@ class EmployeePolicyModel extends Model
|
||||
'emp.gender',
|
||||
'emp.emp_status',
|
||||
'emp.is_active as emp_is_active',
|
||||
'emp.mobile as mobile'
|
||||
'emp.mobile as mobile',
|
||||
'policy_type.policy_type',
|
||||
'cp.policy_no',
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->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('policy_type', 'policy_type.id = pm.policy_type_id')
|
||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
|
||||
->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
|
||||
@ -702,7 +705,9 @@ class EmployeePolicyModel extends Model
|
||||
e.endorsement_id,
|
||||
ep.client_policy_id,
|
||||
policies.name as policy_name,
|
||||
insurers.short_name as insurer_short_name
|
||||
insurers.short_name as insurer_short_name,
|
||||
client_policy.policy_no,
|
||||
policy_type.policy_type
|
||||
');
|
||||
$query1->distinct();
|
||||
$query1->join('employee_polices ep', 'ep.id = e.pk');
|
||||
@ -710,6 +715,7 @@ class EmployeePolicyModel extends Model
|
||||
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id');
|
||||
$query1->join('client_branch', 'client_branch.id = employees.client_branch_id');
|
||||
$query1->join('policies', 'policies.id = client_policy.policy_id');
|
||||
$query1->join('policy_type', 'policy_type.id = policies.policy_type_id');
|
||||
$query1->join('insurers', 'insurers.id = policies.insurer_id');
|
||||
$query1->whereIn('e.actions', ['c']);
|
||||
$query1->where('ep.client_policy_id', $policy_id);
|
||||
@ -736,18 +742,21 @@ class EmployeePolicyModel extends Model
|
||||
e.remarks,
|
||||
ep.client_policy_id,
|
||||
policies.name as policy_name,
|
||||
insurers.short_name as insurer_short_name
|
||||
insurers.short_name as insurer_short_name,
|
||||
client_policy.policy_no,
|
||||
policy_type.policy_type
|
||||
');
|
||||
$query2->join('employee_polices ep', 'ep.id = e.pk');
|
||||
$query2->join('employees', 'employees.id = ep.employee_id');
|
||||
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id');
|
||||
$query2->join('client_branch', 'client_branch.id = employees.client_branch_id');
|
||||
$query2->join('policies', 'policies.id = client_policy.policy_id');
|
||||
$query2->join('policy_type', 'policy_type.id = policies.policy_type_id');
|
||||
$query2->join('insurers', 'insurers.id = policies.insurer_id');
|
||||
$query2->whereIn('e.actions', ['si', 'd']);
|
||||
$query2->where('ep.client_policy_id', $policy_id);
|
||||
$query2->where('employees.client_id', $client_id);
|
||||
$query1->where('employees.client_branch_id', $branch_id);
|
||||
$query2->where('employees.client_branch_id', $branch_id);
|
||||
if($status != 0 && !empty($status)){
|
||||
|
||||
$query2->where('e.status', $status);
|
||||
|
||||
@ -269,20 +269,19 @@ $(document).ready(function () {
|
||||
$('body').on('click', '.btnDelete', function () {
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You won't be able to revert this!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, delete it!"
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this user",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
var student_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('user/deactive/');?>'+student_id, function (data) {
|
||||
console.log(data);
|
||||
// $('#tickets-table tbody #'+ student_id).remove();
|
||||
toastr.success('User removed successfully', 'success');
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
|
||||
210
app/Views/add_image_list.php
Normal file
210
app/Views/add_image_list.php
Normal file
@ -0,0 +1,210 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
table.dataTable thead th {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12{
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Advertisement Image List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 5px;">
|
||||
<a data-toggle="modal" data-target="#bike_make_login-modal" href="#" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Advertisement Image Name</th>
|
||||
<th class="font-weight-medium">Status</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($addImageList as $row){ ?>
|
||||
<tr >
|
||||
<td class="client_info" data-id="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></td>
|
||||
<td>
|
||||
<?php echo $row['is_active']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<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>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item advertise_image_edit" href="#" data-toggle="modal" data-id="<?php echo $row['id']; ?>" data-target="#bike_make_login-modal"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</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>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
|
||||
<div id="append_client_info"></div>
|
||||
|
||||
<div id="bike_make_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4 id="advertise_add_edit">Add Advertise Image </h4>
|
||||
</div>
|
||||
<form id="model_form_data" class="px-4">
|
||||
|
||||
<input type="text" name="add_image_id" id="add_image_id" value="0" hidden>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="branchname">Image</label>
|
||||
<input class="form-control" name="advertise_image" id="advertise_image" type="file" accept="image/*" onchange="PreviewImage();" required="">
|
||||
</div>
|
||||
<div class="form-group col-md-6 float-left" style="position: relative;top: 0px;">
|
||||
<img src=" " width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitBranch(this)">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function submitBranch(params) {
|
||||
|
||||
// if ($('#add_image_id').val()) {
|
||||
// var url = '<?= base_url("edit_advertise_image/"); ?>'+$('#add_image_id').val();
|
||||
// }else{
|
||||
var url = '<?= base_url("add_advertise_image"); ?>';
|
||||
// }
|
||||
|
||||
var formData = new FormData($('#model_form_data')[0]);
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function PreviewImage() {
|
||||
console.log('function called');
|
||||
var fileInput = document.getElementById("advertise_image");
|
||||
var file = fileInput.files[0];
|
||||
|
||||
if (file) {
|
||||
var allowedExtensions = ["jpg", "jpeg", "png"];
|
||||
var fileExtension = file.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (!allowedExtensions.includes(fileExtension) || file.size > 200 * 1024) {
|
||||
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
|
||||
fileInput.value = ""; // Clear the file input
|
||||
document.getElementById("uploadPreview").src = "<?= base_url()."public/assets/images/avatar_2x.png" ?>"; // Remove the preview image
|
||||
return;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
reader.onload = function (event) {
|
||||
var img = new Image();
|
||||
img.src = event.target.result;
|
||||
|
||||
img.onload = function () {
|
||||
if (img.width !== 1640 || img.height !== 664) {
|
||||
toastr.warning('Image dimensions must be 1640x664 pixels.', 'Invalid image dimensions.');
|
||||
fileInput.value = ""; // Clear the file input
|
||||
document.getElementById("uploadPreview").src = "<?= base_url()."public/assets/images/avatar_2x.png" ?>"; // Remove the preview image
|
||||
} else {
|
||||
document.getElementById("uploadPreview").src = img.src;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#btnAdd').click(function () {
|
||||
$('#add_image_id').val(0);
|
||||
$('#advertise_add_edit').html('Add Advertise Image');
|
||||
$('#uploadPreview').attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||
|
||||
})
|
||||
|
||||
$('.advertise_image_edit').click(function (params) {
|
||||
// console.log($(this).data('id'));
|
||||
$('#add_image_id').val($(this).data('id'));
|
||||
var url = '<?= base_url("getAdvertiseImage/"); ?>'+$(this).data('id') ;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
$('#advertise_add_edit').html('Edit Advertise Image');
|
||||
$('#uploadPreview').attr('src', '<?= base_url() . "public/uploads/advertiseImage/"?>' + response)
|
||||
.on('error', function() {
|
||||
$(this).attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
@ -6,6 +6,13 @@
|
||||
.reload:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
max-width: 80px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -22,13 +29,13 @@
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Batch <br> Code</th>
|
||||
<th class="font-weight-medium">Batch Code</th>
|
||||
<th class="font-weight-medium">File Name</th>
|
||||
<th class="font-weight-medium">Client</th>
|
||||
<th class="font-weight-medium">Client <br> Branch</th>
|
||||
<th class="font-weight-medium">Client Branch</th>
|
||||
<th class="font-weight-medium">Client Policy</th>
|
||||
<th class="font-weight-medium">Event <br> Type</th>
|
||||
<th class="font-weight-medium">Insurer/ <br> TPA</th>
|
||||
<th class="font-weight-medium">Event Type</th>
|
||||
<th class="font-weight-medium">Insurer/ TPA</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
<th class="font-weight-medium">Count</th>
|
||||
<th class="font-weight-medium">(₹)Amount</th>
|
||||
@ -46,13 +53,12 @@
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $file['batch_code'] ?></td>
|
||||
<td class="reload" data-toggle="tooltip" data-placement="top"
|
||||
title="<?php echo $file['file_name'] ?>">
|
||||
<?php echo $file['file_name'] ?>
|
||||
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
|
||||
<?php echo $file['file_name']?>
|
||||
</td>
|
||||
<td><?php echo $file['client_short_name'] ?></td>
|
||||
<td><?php echo $file['branch_name'] ?></td>
|
||||
<td><?php echo $file['policy_name'] ?></td>
|
||||
<td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td>
|
||||
<td><?php echo $file['event_type'] ?></td>
|
||||
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
||||
<td><?php echo $file['actions'] ?></td>
|
||||
|
||||
@ -58,12 +58,12 @@ table.dataTable thead th {
|
||||
<?php echo $row['user_name']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<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>
|
||||
<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>
|
||||
<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
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<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>
|
||||
<?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>
|
||||
</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>
|
||||
@ -1,11 +1,12 @@
|
||||
<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;">
|
||||
<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 class="table-responsive" id="branch_table" >
|
||||
|
||||
<div class="table-responsive" id="branch_table">
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
@ -23,52 +24,51 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<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>
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="branch_form"
|
||||
enctype="multipart/form-data">
|
||||
<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="branch_id_primarykey" id="branch_id_primarykey"/>
|
||||
<form role="form" class="parsley-examples" method="post" id="branch_form" enctype="multipart/form-data">
|
||||
<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="branch_id_primarykey" id="branch_id_primarykey" />
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<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 class="form-group col-md-6">
|
||||
<label for="branch_code">Branch Code<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code"
|
||||
placeholder="Enter Branch Code" name="branch_code" required>
|
||||
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code" placeholder="Enter Branch Code"
|
||||
name="branch_code" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="state">State<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="state">State<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="state" name="state" required>
|
||||
<option value="">Select State</option>
|
||||
<?php foreach($state as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
|
||||
<?php } ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="district">District<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="district"
|
||||
placeholder="Enter District" name="district" required>
|
||||
<label for="district">District<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="district" placeholder="Enter District"
|
||||
name="district" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="city">City<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_city"
|
||||
placeholder="Enter City" name="city" required>
|
||||
<label for="city">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_city" placeholder="Enter City"
|
||||
name="city" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -79,26 +79,37 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<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 class="form-group col-md-6">
|
||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" 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 class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<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" 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>
|
||||
<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 class="form-group col-md-6">
|
||||
<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 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 type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="remove_btn">Remove</button>
|
||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac"
|
||||
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 id="container"></div>
|
||||
@ -119,168 +130,196 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var branch_form_action = '';
|
||||
var contactCount = 1;
|
||||
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
if(branch_PrimaryKey !== ''){
|
||||
|
||||
if (branch_PrimaryKey !== '') {
|
||||
|
||||
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) {
|
||||
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>
|
||||
<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>
|
||||
</tr>
|
||||
`;
|
||||
if(role != 3 && role != 4){
|
||||
|
||||
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>
|
||||
<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>
|
||||
</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);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
$('#btnBranchAdd').click(function() {
|
||||
|
||||
branch_form_action = '<?= base_url("client/branch/create"); ?>';
|
||||
branch_form_action = '<?= base_url("client/branch/create"); ?>';
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
var addButton = document.getElementById('add');
|
||||
if (addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
var addButton = document.getElementById('add');
|
||||
if (addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
$('.btnBack').click(function() {
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
$('.parsley-errors-list').remove();
|
||||
$('#branch_form').parsley().reset();
|
||||
contactCount = 1
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
$('.parsley-errors-list').remove();
|
||||
$('#branch_form').parsley().reset();
|
||||
contactCount = 1
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
$("#branch_form").submit(function(event) {
|
||||
$("#branch_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
if (branch_PrimaryKey === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
return;
|
||||
}
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
var isValid = $('#branch_form').parsley().validate();
|
||||
if (branch_PrimaryKey === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
var isValid = $('#branch_form').parsley().validate();
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#branch_form')[0]);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: branch_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
var formData = new FormData($('#branch_form')[0]);
|
||||
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
var message = (branch_PrimaryKey === '') ? 'Client Branch Created successfully' : 'Client Branch Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
}
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: branch_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
if (res) {
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
var message = (branch_PrimaryKey === '') ?
|
||||
'Client Branch Created successfully' :
|
||||
'Client Branch Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
$('#branch_list tr').remove();
|
||||
var branchTableInsert = ''
|
||||
|
||||
var role = res.data.role
|
||||
delete res.data.role;
|
||||
console.log(role)
|
||||
$.each(res.data, function(index, item) {
|
||||
|
||||
console.log('client_branch_data', item)
|
||||
|
||||
if(role != 3 && role != 4){
|
||||
|
||||
$('#branch_list tr').remove();
|
||||
var branchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
branchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
@ -290,92 +329,26 @@ $(document).ready(function () {
|
||||
<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>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#branch_list').append(branchTableInsert);
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
contactCount = 1
|
||||
});
|
||||
`;
|
||||
|
||||
}else{
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
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>
|
||||
`;
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
}
|
||||
|
||||
contactCount = 1
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var branch_id = $(this).attr('data-id');
|
||||
$('#branch_id_primarykey').val(branch_id);
|
||||
|
||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('client/branch/list/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
// console.log('branch contact : ',res.contact)
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#state option[value="' + res.data.state + '"]').prop('selected', true);
|
||||
$('#district').val(res.data.district);
|
||||
$('#branch_city').val(res.data.city);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
|
||||
$('#name').val(res.contact[0].name);
|
||||
$('#email').val(res.contact[0].email);
|
||||
$('#mobile').val(res.contact[0].mobile);
|
||||
$('#designation').val(res.contact[0].designation);
|
||||
|
||||
res.contact.shift();
|
||||
// console.log(res.contact.length)
|
||||
for (let index = 0; index < res.contact.length; index++) {
|
||||
const contact = res.contact[index];
|
||||
if (contact !== undefined) {
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
$('#branch_list').append(branchTableInsert);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
@ -383,29 +356,110 @@ $(document).ready(function () {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(branch_form_action);
|
||||
}
|
||||
contactCount = 1
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function() {
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
}
|
||||
|
||||
contactCount = 1
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var branch_id = $(this).attr('data-id');
|
||||
$('#branch_id_primarykey').val(branch_id);
|
||||
|
||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('client/branch/list/');?>' + branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
// console.log('branch contact : ',res.contact)
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#state option[value="' + res.data.state + '"]').prop('selected', true);
|
||||
$('#district').val(res.data.district);
|
||||
$('#branch_city').val(res.data.city);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
|
||||
$('#name').val(res.contact[0].name);
|
||||
$('#email').val(res.contact[0].email);
|
||||
$('#mobile').val(res.contact[0].mobile);
|
||||
$('#designation').val(res.contact[0].designation);
|
||||
|
||||
res.contact.shift();
|
||||
// console.log(res.contact.length)
|
||||
for (let index = 0; index < res.contact.length; index++) {
|
||||
const contact = res.contact[index];
|
||||
if (contact !== undefined) {
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
$("#remove_btn").click(function(){
|
||||
$("#name").val('');
|
||||
$("#email").val('');
|
||||
$("#mobile").val('');
|
||||
$("#designation").val('');
|
||||
})
|
||||
$("#remove_btn").click(function() {
|
||||
$("#name").val('');
|
||||
$("#email").val('');
|
||||
$("#mobile").val('');
|
||||
$("#designation").val('');
|
||||
})
|
||||
|
||||
// Initialize the contact count
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
// Initialize the contact count
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
|
||||
var container = document.getElementById('container');
|
||||
var uniqueId = Date.now().toString();
|
||||
var container = document.getElementById('container');
|
||||
var uniqueId = Date.now().toString();
|
||||
|
||||
var html = `
|
||||
var html = `
|
||||
<div id="${uniqueId}">
|
||||
<hr>
|
||||
<h6 class="header-title">Contact ${contactCount}</h6>
|
||||
@ -437,159 +491,169 @@ $(document).ready(function () {
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(reset == false){
|
||||
console.log(reset)
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
storeButtonId(uniqueId + '_add');
|
||||
if (reset == false) {
|
||||
console.log(reset)
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
storeButtonId(uniqueId + '_add');
|
||||
|
||||
if (contactCount >= 3) {
|
||||
hideStoredAddButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function removeContact(button) {
|
||||
var uniqueId = button.id.split("_")[0];
|
||||
var contactSection = document.getElementById(uniqueId);
|
||||
|
||||
if (contactSection) {
|
||||
contactSection.parentNode.removeChild(contactSection);
|
||||
contactCount --;
|
||||
|
||||
if (contactCount < 3) {
|
||||
var addButton = document.querySelector('.ac');
|
||||
if (addButton) {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
}
|
||||
if (contactCount >= 3) {
|
||||
hideStoredAddButtons();
|
||||
}
|
||||
}
|
||||
|
||||
function storeButtonId(id) {
|
||||
}
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
function removeContact(button) {
|
||||
var uniqueId = button.id.split("_")[0];
|
||||
var contactSection = document.getElementById(uniqueId);
|
||||
|
||||
if (contactSection) {
|
||||
contactSection.parentNode.removeChild(contactSection);
|
||||
contactCount--;
|
||||
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
var addButton = document.getElementById(id);
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (contactCount < 3) {
|
||||
var addButton = document.querySelector('.ac');
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
function storeButtonId(id) {
|
||||
|
||||
// Iterate through the stored IDs to find the next "Add" button to show
|
||||
storedIds.forEach(function(id) {
|
||||
if (!addButtonShown) {
|
||||
var addButton = document.getElementById(id);
|
||||
if (addButton && addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
addButtonShown = true; // Set to true once an "Add" button is shown
|
||||
}
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
|
||||
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
var addButton = document.getElementById(id);
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
|
||||
// Iterate through the stored IDs to find the next "Add" button to show
|
||||
storedIds.forEach(function(id) {
|
||||
if (!addButtonShown) {
|
||||
var addButton = document.getElementById(id);
|
||||
if (addButton && addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
addButtonShown = true; // Set to true once an "Add" button is shown
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
$('#branch_form input, #branch_form select').each(function() {
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
$('#branch_form input, #branch_form select').each(function() {
|
||||
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function onlyNumbers(event){
|
||||
function onlyNumbers(event) {
|
||||
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeClientBranch(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/branch/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('Remove Done!', 'success');
|
||||
function removeClientBranch(element) {
|
||||
|
||||
location.reload();
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this client branch.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
if (result.isConfirmed) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/branch/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('Client branch removed successfully', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove client branch', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function checkMobileNumber(input){
|
||||
function checkMobileNumber(input) {
|
||||
|
||||
console.log('function called')
|
||||
console.log(input);
|
||||
console.log('Input Value', input.value);
|
||||
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;
|
||||
var mobileNumber = input.value;
|
||||
var url = '<?php echo base_url('util/checkHRNumber/') ?>' + mobileNumber;
|
||||
|
||||
$.get(url, function(response){
|
||||
$.get(url, function(response) {
|
||||
|
||||
console.log(response)
|
||||
console.log(response.data)
|
||||
|
||||
if(response.data > 0){
|
||||
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);
|
||||
});
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -59,7 +59,9 @@ table.dataTable thead th {
|
||||
<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/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>Deposit</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 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>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -111,38 +113,47 @@ table.dataTable thead th {
|
||||
|
||||
|
||||
function removeClient(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/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('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this client.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
if (result.isConfirmed) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/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('Client removed successfully.', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove client.', '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');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -7,14 +7,15 @@
|
||||
|
||||
<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">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
<th>Client Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Date</th>
|
||||
<th>Enrollment <br> Status</th>
|
||||
<th>Enrollment Status</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -39,6 +40,7 @@
|
||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||
<input type="hidden" id="policy_form_action" />
|
||||
<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'] : '' ?>" />
|
||||
<div class="form-group">
|
||||
|
||||
@ -128,6 +130,12 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">GST ( % )<span id="tpa_danger" class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<input id="inception_type" type="checkbox" name="inception_type">
|
||||
@ -258,13 +266,15 @@
|
||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||
}
|
||||
|
||||
var policy_name_data = `${item.policy_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}` + ' - ' + `${item.policy_type_name ?? ''}`;
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</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>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -314,6 +324,9 @@
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
$('#policy_status_field').hide()
|
||||
$('#base_policy_id').hide();
|
||||
$('#policy_PrimaryKey').val("");
|
||||
$('#insurer_policy_id').val("");
|
||||
$('#gst_no').val(18);
|
||||
|
||||
|
||||
$('#first').hide();
|
||||
@ -481,8 +494,9 @@
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.branch_name}</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>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -632,6 +646,7 @@
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -646,28 +661,36 @@
|
||||
console.log('client_id', client_id)
|
||||
console.log('branch_id', branch_id)
|
||||
console.log('policy_type_id', dataId)
|
||||
console.log('client_policy_id', $('#policy_PrimaryKey').val())
|
||||
|
||||
|
||||
|
||||
$('#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;
|
||||
|
||||
$.get(url, function(response){
|
||||
// if (dataId && branch_id && client_id) {
|
||||
// // Check if all parameters exist
|
||||
// if ($('#policy_PrimaryKey').val() == "" || id != $('#insurer_policy_id').val()) {
|
||||
// $.get(url, function(response) {
|
||||
// console.log(response);
|
||||
// console.log(response.count);
|
||||
|
||||
console.log(response)
|
||||
//console.log(response.data)
|
||||
// if (response.count > 0) {
|
||||
// console.log('Policy already exist in the branch');
|
||||
// toastr.error('Policy already exist in the branch', 'Error');
|
||||
// $('#policy').val('').change();
|
||||
// }
|
||||
// console.log('outer');
|
||||
|
||||
if(response.count > 0){
|
||||
console.log('Policy already exist in the branch')
|
||||
toastr.error('Policy already exist in the branch', 'Error');
|
||||
$('#policy').val('').change();
|
||||
}
|
||||
console.log('outer')
|
||||
|
||||
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
// }).fail(function(xhr, status, error) {
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// console.log('Missing parameter(s): dataId, branch_id, or client_id');
|
||||
// }
|
||||
|
||||
|
||||
if (dataId == 1) {
|
||||
@ -738,7 +761,11 @@
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
//console.log('client_policy_res', res)
|
||||
console.log('client_policy_res', res)
|
||||
console.log('gst', res.data.gst);
|
||||
|
||||
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
|
||||
console.log(gst);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -771,10 +798,12 @@
|
||||
|
||||
$('#policy_type_id').val(res.data.policy_type_id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#insurer_policy_id').val(res.data.policy_id);
|
||||
$('#policy_no').val(res.data.policy_no);
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||
$('#gst_no').val(gst);
|
||||
$('#policy_status_field').show();
|
||||
|
||||
|
||||
@ -1302,8 +1331,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($(this).val() == 3) {
|
||||
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'INFO');
|
||||
}
|
||||
@ -1437,54 +1464,58 @@
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
//console.log(res)
|
||||
console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
if(res.status == true){
|
||||
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id)
|
||||
.change();
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||
$('#policy_no').val(res.data.policy_no).change();
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date))
|
||||
.change();
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id)
|
||||
.change();
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||
$('#policy_no').val(res.data.policy_no).change();
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date))
|
||||
.change();
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
|
||||
|
||||
var policeOptionHTML = '';
|
||||
$policy_type_value = $('#policy_type').val();
|
||||
$.each(res.policy, function(index, item) {
|
||||
var policeOptionHTML = '';
|
||||
$policy_type_value = $('#policy_type').val();
|
||||
$.each(res.policy, function(index, item) {
|
||||
|
||||
// //console.log(item);
|
||||
// //console.log(item);
|
||||
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.policy_id === item
|
||||
.id ?
|
||||
'selected="selected"' : '') + '>' + item.name +
|
||||
'</option>';
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.policy_id === item
|
||||
.id ?
|
||||
'selected="selected"' : '') + '>' + item.name +
|
||||
'</option>';
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$('#policy').html(policeOptionHTML);
|
||||
$('#policy').html(policeOptionHTML);
|
||||
|
||||
if (dataId == 3 || policy_type == 1) {
|
||||
if (dataId == 3 || policy_type == 1) {
|
||||
|
||||
// //console.log('step 1')
|
||||
// //console.log('step 1')
|
||||
|
||||
setTimeout(function() {
|
||||
// //console.log('step 2')
|
||||
var $option = $('#policy').find('option[data-id="3"]');
|
||||
if ($option.length > 0) {
|
||||
// //console.log('step 3')
|
||||
$option.prop('selected', true).change();
|
||||
} else {
|
||||
// //console.log('step 4');
|
||||
toastr.warning(
|
||||
'The insurer does not have a GMC-Parents policy.',
|
||||
'Warning');
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
// //console.log('step 2')
|
||||
var $option = $('#policy').find('option[data-id="3"]');
|
||||
if ($option.length > 0) {
|
||||
// //console.log('step 3')
|
||||
$option.prop('selected', true).change();
|
||||
} else {
|
||||
// //console.log('step 4');
|
||||
toastr.warning(
|
||||
'The insurer does not have a GMC-Parents policy.',
|
||||
'Warning');
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<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>
|
||||
<?php foreach($RM as $value) { ?>
|
||||
<?php if($value['role'] === '3') { ?>
|
||||
@ -26,7 +26,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<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
|
||||
<option value="">Select Manager</option>
|
||||
<?php foreach($RM as $value) { ?>
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> - <?php echo $employee['relationship']?> )</td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></td>
|
||||
|
||||
@ -253,7 +253,7 @@ function appendPolicies(data) {
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name + ' - ' + item.policy_type
|
||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
});
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
|
||||
@ -443,6 +443,7 @@ function fetchClientPolicies() {
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
@ -644,7 +645,7 @@ function appendPolicies(data) {
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name + ' - ' + item.policy_type
|
||||
text:`${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
});
|
||||
if (client_policy_param == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
@ -110,7 +110,7 @@
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
|
||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td>
|
||||
<td><?php echo $employee['endorsement_id'] ?></td>
|
||||
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||
</td>
|
||||
@ -326,7 +326,7 @@
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name
|
||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
});
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
|
||||
@ -45,10 +45,12 @@
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $file['file_name'] ?></td>
|
||||
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
|
||||
<?php echo $file['file_name']?>
|
||||
</td>
|
||||
<td><?php echo $file['short_name'] ?></td>
|
||||
<td><?php echo $file['branch_name'] ?></td>
|
||||
<td><?php echo $file['policy_name'] ?></td>
|
||||
<td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td>
|
||||
<td><?php echo $file['action'] ?></td>
|
||||
<td><?php echo fancy_date_time_format($file['created_at']) . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
||||
</td>
|
||||
|
||||
@ -473,38 +473,48 @@
|
||||
|
||||
|
||||
function removeInsurerBranch(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/insurer/branch/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('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
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 form_action = '<?= base_url("master/insurer/branch/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('Insurer branch removed successfully', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove insurer branch', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove insurer branch', 'warning');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -134,38 +134,47 @@ class csvExport {
|
||||
|
||||
|
||||
function removeInsurer(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/insurer/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('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this insurer.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
if (result.isConfirmed) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/insurer/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('Insurer removed successfully', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove insurer', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove insurer', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -415,7 +415,7 @@
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name + ' - ' + item.policy_type
|
||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
});
|
||||
if (client_policy_param2 == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
|
||||
@ -323,38 +323,49 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
function removeKYCDocs(element) {
|
||||
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/kyc/kycdocs/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('Remove Done!', 'success');
|
||||
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this!.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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 (result.isConfirmed) {
|
||||
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/kyc/kycdocs/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('KYC docs removed successfully');
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
|
||||
|
||||
} else {
|
||||
toastr.warning('Failed to remove KYC docs', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove KYC docs', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -133,39 +133,49 @@ class csvExport {
|
||||
|
||||
|
||||
function removeKYC(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/kyc/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('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
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 form_action = '<?= base_url("master/kyc/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('KYC entity removed successfully', 'success');
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Failed to remove KYC entity', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
|
||||
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-editable.css" rel="stylesheet" type="text/css" /> -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/remixicon/fonts/remixicon.css" rel="stylesheet">
|
||||
|
||||
<!-- Jodit Css -->
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||
@ -69,6 +70,8 @@
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
||||
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
|
||||
min-height: 0;
|
||||
}
|
||||
@ -288,6 +291,10 @@
|
||||
bottom: 5px;
|
||||
left: 60px;
|
||||
}
|
||||
|
||||
#app_content_management:hover {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@ -607,6 +614,28 @@
|
||||
<span> Users </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
|
||||
<i class="fa fa-info-circle" aria-hidden="true"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> App Content Management </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboardsmenu">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/add_image_index') ?>"> Advertisement Images </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/frontend_content') ?>">Front-end Content</a>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<!-- <li class="menu-title mt-2">Apps</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -396,42 +396,52 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
function removePolicies(element) {
|
||||
var policy_id_for_reload = $('#policy_type_id').val()
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/policies/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('Remove Done!', 'success');
|
||||
|
||||
// $('#branch_table').empty();
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this Policy.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
|
||||
if (result.isConfirmed) {
|
||||
var policy_id_for_reload = $('#policy_type_id').val()
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/policies/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('Policy removed successfully', 'success');
|
||||
// $('#branch_table').empty();
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
} else {
|
||||
toastr.warning('Failed to remove policy', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove policy', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -346,7 +346,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-4" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si[]" id="gpa_sum_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si[]" id="gpa_sum_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='gpa_sum_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -369,12 +369,12 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
<div class="form-col col-md-6">
|
||||
<label for="mobile">Basic Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_multiplier : '') : ''}" type="text" class="form-control basic_multiplier" placeholder="Basic Multiplier" name="basic_multiplier" id="basic_multiplier" onchange='' required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_multiplier : '') : ''}" type="text" class="form-control basic_multiplier" placeholder="Basic Multiplier" name="basic_multiplier" id="basic_multiplier" onchange='basicMultiplierAndPremiumMultipiler(this)' required>
|
||||
</div>
|
||||
|
||||
<div class="form-col col-md-6">
|
||||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.multiplier : '') : ''}" type="text" class="form-control premium_multiplier" placeholder="Premium Multiplier" name="premium_multiplier" id="premium_multiplier" onchange='' required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.multiplier : '') : ''}" type="text" class="form-control premium_multiplier" placeholder="Premium Multiplier" name="premium_multiplier" id="premium_multiplier" onchange='basicMultiplierAndPremiumMultipiler(this)' required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -383,13 +383,13 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
<div class="form-col col-md-3">
|
||||
<label for="mobile">Basic Pay<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control basic_pay" placeholder="Enter Basic Pay" name="basic_pay[]" id="basic_pay" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this); basicPayMultipleforfirstone(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control basic_pay" placeholder="Enter Basic Pay" name="basic_pay[]" id="basic_pay" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this); basicPayMultiple(this)" required>
|
||||
<div id='gpa_basic_pay_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" id="" style="width:84%">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_first" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required readonly>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_first" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required readonly>
|
||||
<div id='basic_gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
@ -419,7 +419,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<input value="1" type="hidden" name="policy_type">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
@ -464,7 +464,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}4" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="4_si" id="4_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="4_si" id="4_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -499,7 +499,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}5" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="5_si[]" id="5_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="5_si[]" id="5_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -532,7 +532,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}6" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="6_si" id="6_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="6_si" id="6_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -567,7 +567,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}7" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="7_si[]" id="7_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="7_si[]" id="7_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -602,7 +602,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}8" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="8_si[]" id="8_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="8_si[]" id="8_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -631,7 +631,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<input value="1" type="hidden" name="policy_type">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
@ -652,7 +652,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}10" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="10_si[]" id="10_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="10_si[]" id="10_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -685,7 +685,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}11" style="width:84%">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="11_si[]" id="11_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="11_si[]" id="11_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -719,7 +719,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}12" style="width:84%">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -757,7 +757,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div class="form-row" id="${id_var}13" style="width:84%">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -1594,7 +1594,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-4" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si[]" id="gpa_sum_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si[]" id="gpa_sum_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -1622,7 +1622,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
|
||||
<div class="form-group col-md-4" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si2[]" id="gpa_sum_si2" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si2[]" id="gpa_sum_si2" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
@ -1651,7 +1651,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)(this)" required readonly>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required readonly>
|
||||
<div id='basic_gpa_si_number_word' class="text-danger-2"></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -1722,7 +1722,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="5_si[]" id="5_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="5_si[]" id="5_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -1773,7 +1773,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="7_si[]" id="7_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="7_si[]" id="7_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -1801,7 +1801,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="8_si[]" id="8_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="8_si[]" id="8_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -1825,7 +1825,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -1849,7 +1849,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="10_si[]" id="10_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="10_si[]" id="10_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -1877,7 +1877,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="11_si[]" id="11_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="11_si[]" id="11_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -1905,7 +1905,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
@ -1937,7 +1937,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
@ -2470,13 +2470,18 @@ function basicPayMultiple(input) {
|
||||
|
||||
var inputId = input.id;
|
||||
var inputValue = input.value.replace(/,/g, '');
|
||||
var count = inputId.split('_')[2]; // Extract the count from the id
|
||||
console.log('input', input);
|
||||
console.log('input id ', input.id);
|
||||
console.log('input class ', input.className);
|
||||
var count = inputId.split('_')[2];
|
||||
console.log('count :', count)
|
||||
console.log('input :', input);
|
||||
console.log('input_id :', input.id);
|
||||
console.log('input_class :', input.className);
|
||||
|
||||
if (input.className.includes('basic_pay')) {
|
||||
|
||||
if(!count){
|
||||
count = 'first'
|
||||
}
|
||||
|
||||
// Sum insured
|
||||
var basicMultiplier = $('#basic_multiplier').val().replace(/,/g, '');
|
||||
var multi = basicMultiplier * inputValue;
|
||||
@ -2490,56 +2495,74 @@ function basicPayMultiple(input) {
|
||||
console.log('multi_2', multi_2);
|
||||
$('#gpa_basic_premium_' + count).val(multi_2).trigger('keyup');
|
||||
|
||||
} else if (input.className.includes('basic_multiplier')) {
|
||||
|
||||
var multi = inputValue * $('#basic_pay_' + count).val().replace(/,/g, '');
|
||||
$('#gpa_basic_si_' + count).val(multi).trigger('keyup');
|
||||
var multi_2 = multi * $('#premium_multiplier').val().replace(/,/g, '') / 1000;
|
||||
$('#gpa_basic_premium_' + count).val(multi_2).trigger('keyup');
|
||||
|
||||
} else if (input.className.includes('premium_multiplier')) {
|
||||
|
||||
// Sum insured
|
||||
var basicMultiplier = $('#basic_multiplier').val().replace(/,/g, '');
|
||||
var multi = basicMultiplier * inputValue;
|
||||
console.log('multi', multi);
|
||||
$('#gpa_basic_si_' + count).val(multi).trigger('keyup');
|
||||
|
||||
// Premium
|
||||
var gpaBasicSiValue = multi; // We just calculated this value
|
||||
var premiumMultiplier = $('#premium_multiplier').val().replace(/,/g, '');
|
||||
var multi_2 = gpaBasicSiValue * premiumMultiplier / 1000;
|
||||
console.log('multi_2', multi_2); } else if (input.className.includes('gpa_basic_si')) {
|
||||
var multi = inputValue * $('#premium_multiplier').val().replace(/,/g, '');
|
||||
$('#gpa_basic_premium_' + count).val(multi).trigger('keyup');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function basicPayMultipleforfirstone(input){
|
||||
function basicMultiplierAndPremiumMultipiler(input){
|
||||
|
||||
console.log('basicPayMultipleforfirstone function called')
|
||||
|
||||
var inputId = input.id;
|
||||
var inputValue = input.value.replace(/,/g, '');
|
||||
|
||||
console.log('basicPayMultipleforfirstone')
|
||||
console.log('input', input);
|
||||
console.log('input id ', input.id);
|
||||
console.log('input class ', input.className);
|
||||
console.log('inputValue', inputValue);
|
||||
|
||||
// Sum insured
|
||||
var basicMultiplier = $('#basic_multiplier').val().replace(/,/g, '');
|
||||
var multi = basicMultiplier * inputValue;
|
||||
console.log('multi', multi);
|
||||
$('#gpa_basic_si_first').val(multi).trigger('keyup');
|
||||
if (input.className.includes('basic_multiplier')) {
|
||||
|
||||
// Premium
|
||||
var gpaBasicSiValue = multi; // We just calculated this value
|
||||
var premiumMultiplier = $('#premium_multiplier').val().replace(/,/g, '');
|
||||
var multi_2 = gpaBasicSiValue * premiumMultiplier / 1000;
|
||||
console.log('multi_2', multi_2);
|
||||
$('#gpa_basic_premium_first').val(multi_2).trigger('keyup');
|
||||
console.log('basic_multiplier called')
|
||||
|
||||
var basic_pay = $('input[name="basic_pay[]"]');
|
||||
var basic_multiplier = input.value;
|
||||
var premium_multiplier = $('#premium_multiplier').val();
|
||||
|
||||
var sum_insured = $('input[name="gpa_basic_si[]"]');
|
||||
var premium = $('input[name="gpa_basic_premium[]"]');
|
||||
|
||||
|
||||
basic_pay.each(function(index) {
|
||||
|
||||
var basic_pay_amount = $(this).val().replace(/,/g, '');
|
||||
console.log('basic_pay_amount', basic_pay_amount)
|
||||
|
||||
var sum_insured_amount = basic_pay_amount * basic_multiplier;
|
||||
console.log('sum_insured_amount', sum_insured_amount);
|
||||
$(sum_insured[index]).val(sum_insured_amount);
|
||||
$(sum_insured[index]).trigger('keyup');
|
||||
|
||||
var premium_amount = (sum_insured_amount / 1000) * premium_multiplier;
|
||||
console.log('premium_amount', premium_amount);
|
||||
$(premium[index]).val(premium_amount);
|
||||
$(premium[index]).trigger('keyup');
|
||||
|
||||
});
|
||||
|
||||
|
||||
} else if (input.className.includes('premium_multiplier')) {
|
||||
|
||||
console.log('premium_multiplier called')
|
||||
|
||||
var premium_multiplier = input.value;
|
||||
var sum_insured = $('input[name="gpa_basic_si[]"]');
|
||||
var premium = $('input[name="gpa_basic_premium[]"]');
|
||||
|
||||
|
||||
sum_insured.each(function(index) {
|
||||
|
||||
var sum_insured_amount = $(this).val().replace(/,/g, '');
|
||||
console.log('sum_insured_amount', sum_insured_amount)
|
||||
|
||||
var premium_amount = (sum_insured_amount / 1000) * premium_multiplier;
|
||||
console.log('premium_amount', premium_amount);
|
||||
$(premium[index]).val(premium_amount);
|
||||
$(premium[index]).trigger('keyup');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3046,15 +3069,18 @@ function checkPolicyTermsSI(callback) {
|
||||
|
||||
console.log(response);
|
||||
console.log(response.data);
|
||||
console.log(siInputs);
|
||||
|
||||
var policy_terms_si = response.data;
|
||||
var rack_rate_si = [];
|
||||
|
||||
siInputs.each(function() {
|
||||
var input = $(this).val();
|
||||
console.log('input value', input);
|
||||
rack_rate_si.push(input.replace(/,/g, ''));
|
||||
});
|
||||
if(siInputs != null) {
|
||||
siInputs.each(function() {
|
||||
var input = $(this).val();
|
||||
console.log('input value', input);
|
||||
rack_rate_si.push(input.replace(/,/g, ''));
|
||||
});
|
||||
}
|
||||
|
||||
console.log('policy_terms_si', policy_terms_si);
|
||||
console.log('rack_rate_si', rack_rate_si);
|
||||
|
||||
@ -38,17 +38,13 @@ const excel_headers = {
|
||||
1: {
|
||||
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
2: {
|
||||
"basic_pay": "Basic Pay",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
3: {
|
||||
"band_or_grade": "Band or Grade",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
},
|
||||
@ -306,11 +302,11 @@ function generateTable(rack_rate_type) {
|
||||
|
||||
case 1:
|
||||
if (si_or_bp == 1) {
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
key = cells[0] // Sum Insured,
|
||||
} else if (si_or_bp == 2) {
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] //Basic Pay, Sum Insured, Premium
|
||||
key = cells[0] //Basic Pay
|
||||
} else if (si_or_bp == 3) {
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] //Band or Grade, Sum Insured, Premium
|
||||
key = cells[0] + "|" + cells[1] //Band or Grade, Sum Insured
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@ -138,38 +138,47 @@ class csvExport {
|
||||
|
||||
|
||||
function removePolciyType(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/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('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this!",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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 (result.isConfirmed) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/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('Policy type removed successfully', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove policy type', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove policy type', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -507,36 +507,46 @@ function validateForm() {
|
||||
|
||||
|
||||
function removeTPABranch(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/tpa/branch/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('Remove Done!', 'success');
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this TPA branch.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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 (result.isConfirmed) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/tpa/branch/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('TPA branch removed successfully', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove TPA branch', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove TPA branch', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@ -132,39 +132,47 @@ class csvExport {
|
||||
|
||||
|
||||
function removeTPA(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/tpa/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('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this TPA",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
if (result.isConfirmed) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/tpa/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('TPA removed successfully', 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove TPA', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Failed to remove TPA', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -149,31 +149,43 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="transactionMode" class="control-label">Transaction Mode</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="addMode"
|
||||
value="add" checked>
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="addMode"value="1" checked>
|
||||
<label class="form-check-label" for="addMode">Replenishment</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentMode"
|
||||
value="adjustment">
|
||||
<label class="form-check-label" for="adjustmentMode">Adjustment</label>
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentModeadd"value="2">
|
||||
<label class="form-check-label" for="adjustmentMode">Adjustment Add</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentModereduce"value="3">
|
||||
<label class="form-check-label" for="adjustmentMode">Adjustment Reduce</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="assetpolicyadd"value="4">
|
||||
<label class="form-check-label" for="adjustmentMode">Asset policy Add</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="assetpolicyreduce"value="5">
|
||||
<label class="form-check-label" for="adjustmentMode">Asset policy Reduce</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Amount</label>
|
||||
<input type="number" class="form-control" id="amount" placeholder="Amount">
|
||||
<label for="field-1" class="control-label">Amount<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="amount" placeholder="Amount" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row" id="transactionTypeRow" style="display:none;">
|
||||
|
||||
<!-- <div class="row" id="transactionTypeRow" style="display:none;">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="transactionType" class="control-label">Transaction Type</label>
|
||||
@ -183,29 +195,32 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group no-margin">
|
||||
<label for="description" class="control-label">Description</label>
|
||||
<label for="description" class="control-label">Description<span class="text-danger">*</span></label>
|
||||
<textarea class="form-control" id="description"
|
||||
placeholder="Write something about the transaction"></textarea>
|
||||
placeholder="Write something about the transaction" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
<!-- <div class="form-group">
|
||||
<label for="subType" class="control-label" style="display: none;">Transaction Sub Type</label>
|
||||
<select class="form-control" id="subType" name="sub_type" style="display: none;">
|
||||
<option value="Deposit" hidden>Replenishment</option>
|
||||
<option value="Adjustment" hidden>Adjustment</option>
|
||||
<!-- Add more options as needed -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="saveTransactionBtn">Save Transaction</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -257,60 +272,67 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Event listener for radio buttons
|
||||
$('input[name="transactionMode"]').change(function() {
|
||||
if ($(this).val() === 'add') {
|
||||
// Set the hidden input value to 'Deposit' when 'Deposit' radio button is selected
|
||||
$('#subType').val('Deposit');
|
||||
} else if ($(this).val() === 'adjustment') {
|
||||
// Set the hidden input value to 'Adjustment' when 'Adjustment' radio button is selected
|
||||
$('#subType').val('Adjustment');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// // Event listener for radio buttons
|
||||
// $('input[name="transactionMode"]').change(function() {
|
||||
// if ($(this).val() === 'add') {
|
||||
// // Set the hidden input value to 'Deposit' when 'Deposit' radio button is selected
|
||||
// $('#subType').val('Deposit');
|
||||
// } else if ($(this).val() === 'adjustment') {
|
||||
// // Set the hidden input value to 'Adjustment' when 'Adjustment' radio button is selected
|
||||
// $('#subType').val('Adjustment');
|
||||
// }
|
||||
// });
|
||||
|
||||
$('#saveTransactionBtn').on('click', function() {
|
||||
// Collect data from modal fields
|
||||
|
||||
var amount = $('#amount').val();
|
||||
var description = $('#description').val();
|
||||
var clientId = '<?php echo $clientData->id; ?>';
|
||||
var insurerId = '<?php echo $insurerName->id; ?>';
|
||||
var transactionType;
|
||||
if ($('#addMode').is(':checked')) {
|
||||
transactionType =
|
||||
'Credit'; // Assuming 'Credit' is the default when the 'Deposit' radio button is selected
|
||||
} else if ($('#adjustmentMode').is(':checked') && $('#transactionTypeRow').is(':visible')) {
|
||||
transactionType = $('#transactionType').val();
|
||||
} else {
|
||||
transactionType = ''; // You might want to handle this case based on your requirements
|
||||
}
|
||||
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
|
||||
var subType = "";
|
||||
|
||||
// Fetch sub_type_id based on the selected sub_type
|
||||
var subTypeOptions = {
|
||||
'Deposit': 1,
|
||||
'Adjustment': 2,
|
||||
'Deletion': 3,
|
||||
// Add more options as needed
|
||||
};
|
||||
|
||||
|
||||
var subType = $('#subType').val();
|
||||
var subTypeId = subTypeOptions[subType] || null;
|
||||
|
||||
if (subTypeId === null) {
|
||||
// Handle the case where sub_type is not found in the options
|
||||
toastr.warning('Invalid sub_type selected.', "Warning");
|
||||
if(amount == ""){
|
||||
toastr.warning('Amount field is required')
|
||||
return;
|
||||
}
|
||||
|
||||
if(description == ""){
|
||||
toastr.warning('Description field is required')
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//tranction type
|
||||
if(transactionTypeValue == 1){
|
||||
transactionType = 'Credit';
|
||||
subType = '1'; // Replenishment or Deposite
|
||||
}else if(transactionTypeValue == 2){
|
||||
transactionType = 'Credit'
|
||||
subType = '2'; // Adjustment add
|
||||
}else if(transactionTypeValue == 3){
|
||||
transactionType = 'Debit'
|
||||
subType = '2'; // Adjustment reduce
|
||||
}else if(transactionTypeValue == 4){
|
||||
transactionType = 'Credit'
|
||||
subType = '5'; // Asset Policy add
|
||||
}else if(transactionTypeValue == 5){
|
||||
transactionType = 'Debit'
|
||||
subType = '5'; // Asset Policy reduce
|
||||
}
|
||||
|
||||
// console.log('transactionType ', transactionType)
|
||||
// console.log('description ', description)
|
||||
// console.log('amount ', amount)
|
||||
// console.log('subType ', subType)
|
||||
// console.log('sub_type_id ', sub_type_id)
|
||||
// console.log('clientId ', clientId)
|
||||
// console.log('insurerId ', insurerId)
|
||||
|
||||
console.log('transactionTypeValue', transactionTypeValue)
|
||||
console.log('transactionType', transactionType)
|
||||
console.log('description ', description)
|
||||
console.log('amount ', amount)
|
||||
console.log('clientId ', clientId)
|
||||
console.log('insurerId ', insurerId)
|
||||
console.log('subType ', subType)
|
||||
|
||||
|
||||
// Send data to the server using Ajax
|
||||
$.ajax({
|
||||
@ -320,8 +342,7 @@ $(document).ready(function() {
|
||||
amount: amount,
|
||||
description: description,
|
||||
transaction_type: transactionType,
|
||||
sub_type: subType,
|
||||
sub_type_id: subTypeId, // Include sub_type_id
|
||||
sub_type_id: subType, // Include sub_type_id
|
||||
client_id: clientId,
|
||||
insurer_id: insurerId
|
||||
},
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
"laminas/laminas-escaper": "^2.9",
|
||||
"php-amqplib/php-amqplib": "^2.8",
|
||||
"phpmailer/phpmailer": "^6.9",
|
||||
"phpoffice/phpspreadsheet": "^2.0",
|
||||
"phpoffice/phpspreadsheet": "^2.1",
|
||||
"psr/log": "^1.1",
|
||||
"slim/slim": "^4.13",
|
||||
"zircote/swagger-php": "^4.8"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user