Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-07-01 14:25:32 +05:30
commit ad96e3cbb8
27 changed files with 966 additions and 284 deletions

View File

@ -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
@ -271,7 +279,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("getChatResponse", "ChatBotController::getChatResponse");

View 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');
}
}

View File

@ -73,31 +73,69 @@ class ChatBotController extends AdminController
public function getChatResponse()
{
// try {
try {
$request_for = $this->request->getGet('request_for');
$option = $this->request->getGet('option');
$is_option = $this->request->getGet('is_option');
$custom_options = $this->request->getGet('custom_options');
$requestData = $this->ChatBotModel->where('request', $request_for)
$responseData = $this->ChatBotModel->where('request', $request_for)
->where('is_active', 1 )
->first();
if ($requestData) {
if ($responseData) {
if($option != 0){
if(isset($option) && $option != 0){
$decodedData = json_decode($requestData['options'],true);
$decodedData = json_decode($responseData['options'],true);
$requestFor = $decodedData[$request_for][$option];
$requestFor = $decodedData[$option];
$requestData = $this->ChatBotModel->where('request', $requestFor)
$responseData = $this->ChatBotModel->where('request', $requestFor)
->where('is_active', 1 )
->first();
}
if(isset($custom_options))
{
$result = ['request_for'=>$requestData['request'],'options'=>json_decode($requestData['options'],true)];
}
if(isset($is_option) && $is_option == 0){
$text = $this->request->getGet('text');
$value = $this->request->getGet('value');
$Data = $this->ChatBotModel->where('options', $text)->where('is_active', 1 )->first();
if($Data){
if($Data['options'] == 'Please Enter Your Mobile Number To View Your Policies')
{
$result = $this->getAllPolicyByMobileNumber($value,'text');
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}else if($Data['options'] == 'Please Enter Your Mobile Number To Raise Ticket'){
$result = $this->getAllPolicyByMobileNumber($value,'options');
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}
}else{
$result = $this->sendDefaultMessage();
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}
}
$result = [
'request_for' => $responseData['request'],
'options' => json_decode($responseData['options'], true),
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
'is_option' => $responseData['is_option']
];
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
@ -107,12 +145,123 @@ class ChatBotController extends AdminController
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
}
// } catch (\Throwable $th) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
// }
} catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
}
public function sendDefaultMessage()
{
$responseData = $this->ChatBotModel->where('id', 1)->where('is_active', 1 )->first();
return [
'request_for' => $responseData['request'],
'options' => json_decode($responseData['options'], true),
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
'is_option' => $responseData['is_option']
];
}
public function getAllPolicyByMobileNumber($mobileNo,$action)
{
$employee = $this->employeeModel->where('mobile', $mobileNo)->where('is_active', 1 )->first();
if($employee){
$employeeData = $this->employeeModel->where('emp_code', $employee['emp_code'])
->where('client_id',$employee['client_id'])
->where('client_branch_id',$employee['client_branch_id'])
->where('is_active', 1 )->findAll();
$whereArrayForId = [];
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
->join('policies', 'client_policy.policy_id = policies.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('client_policy.client_id', $employee['client_id'] )
->where('client_policy.client_branch_id', $employee['client_branch_id'] )
->where('client_policy.is_active', 1 )
->where('client_policy.policy_status', 1)
->orderby('client_policy.id' , 'ASC')
->findAll();
$options = [];
$text = '';
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
{
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
$data['policy_name'] = $ClientPolicyValue['policy_name'];
$data['policy_type'] = $ClientPolicyValue['policy_type'];
$data['policy_no'] = $ClientPolicyValue['policy_no'];
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->whereIn('employee_polices.employee_id',$whereArrayForId)
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
->where('employee_polices.is_active', 1 )->findAll();
if(count($employee_policy) > 0)
{
$policy[$ClientPolicyValue['id']] = $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].")";
array_push($options, $policy);
$text .= $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].") % ";
}else{
$text .= "There is no any active policies ";
}
}
if($action == 'options'){
return [
'request_for' => $this->request->getGet('request_for'),
'options' => $options[count($options) - 1],
'text' => null,
'is_option' => "1",
'custom_options'=>'create_ticket'
];
}else{
return [
'request_for' => $this->request->getGet('request_for'),
'options' => null,
'text' => $text,
'is_option' => "0"
];
}
}else{
return [
'request_for' => $this->request->getGet('request_for'),
'options' => null,
'text' => "Dear ".$employee['name'].", % Policy not yet bound for you.",
'is_option' => "0"
];
}
}else{
return [
'request_for' => $this->request->getGet('request_for'),
'options' => null,
'text' => "Invalid Mobile Number",
'is_option' => "0"
];
}
}
}

View File

@ -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;
@ -660,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');
@ -756,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) {

View File

@ -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();

View File

@ -29,7 +29,6 @@ use App\Models\FEContentModel;
use App\Models\AddImgModel;
use App\Controllers\Jobs ;
use App\Controllers\JobWorker ;
@ -435,7 +434,7 @@ class EmployeeRestController extends AdminController
->findAll();
// dd($checkIfExist);
if ($checkIfExist) {
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
@ -626,13 +625,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');
@ -643,17 +636,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();
@ -668,12 +656,12 @@ class EmployeeRestController extends AdminController
$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' =>$employee_id, 'status' => 'inprogress', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
$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);
@ -712,23 +700,23 @@ class EmployeeRestController extends AdminController
$file_data =$this->fileModel->insert($extractData);
$extra = [];
// if (count($data[0]) == 11) {
// $value = ['Sno','Emp_Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI','Grade'];
// $check_miss_match = [];
// for ($i=0; $i <count($value) ; $i++) {
// if ($data[0][$i] != $value[$i]) {
// $check_miss_match[]=$data[0][$i];
// }
// }
if (count($data[0]) == 11) {
$value = ['Sno','Emp_Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI','Grade'];
$check_miss_match = [];
for ($i=0; $i <count($value) ; $i++) {
if ($data[0][$i] != $value[$i]) {
$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($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 $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not 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);
}
//this change the column name into index number
for ($i = 0; $i < count($data[0]); $i++) {
@ -753,18 +741,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') {
@ -956,6 +932,7 @@ class EmployeeRestController extends AdminController
//-------------------------------------
public function getAgeRange($terms,$familyFloatesValue)
{
$ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ];
$ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
@ -970,7 +947,7 @@ public function getAgeRange($terms,$familyFloatesValue)
public function getEmployeePolicy()
{
try {
// try {
$id = $this->request->getGet('id');
$emp_code = $this->request->getGet('emp_code');
@ -989,7 +966,7 @@ public function getEmployeePolicy()
->where('is_active', 1 )
->where('is_addon_value',0)->findAll();
if ($empPolicy) {
$result = [];
@ -1058,12 +1035,17 @@ public function getEmployeePolicy()
$array->floter_text_description = '';
}
// Convert familyFloaters terms data to plain array
// remove parent and parent-in-law from familyFloaters
if($familyFloates->{'either-parents-pil'} != 0){
unset($familyFloates->parents);
unset($familyFloates->parents_in_law);
}
$floters = $this->FloterConvertion($familyFloates);
$data = [];
foreach ($floters as $familyFloatesValue) {
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
if(count($empData)){
foreach ($empData as $key => $value) {
if ($value['family_floater_key'] === $dependent) {
@ -1089,8 +1071,8 @@ public function getEmployeePolicy()
}
}
}
// Remove Unwanted floter key from floters array based on either-parents-pil term value
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
@ -1108,7 +1090,21 @@ public function getEmployeePolicy()
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
}
}
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
{
$count_parent = 0;
$count_parent_in_law = 0;
foreach ($floters as $value) {
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
}
if(($count_parent + $count_parent_in_law) == 2) {
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
}
}
// Add family floter buttons placement data for FE validation
if(count($floters)){
foreach ($floters as $familyFloatesValue) {
@ -1161,9 +1157,9 @@ public function getEmployeePolicy()
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
// } catch (\Exception $e) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
// }
}
@ -1229,6 +1225,13 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
$array->floter_text_description = '';
}
// remove parent and parent-in-law from familyFloaters
if($familyFloates->{'either-parents-pil'} != 0){
unset($familyFloates->parents);
unset($familyFloates->parents_in_law);
}
// Convert familyFloaters terms data to plain array
$floters = $this->FloterConvertion($familyFloates);
$data = [];
@ -1278,6 +1281,19 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
}
}
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
{
$count_parent = 0;
$count_parent_in_law = 0;
foreach ($floters as $value) {
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
}
if(($count_parent + $count_parent_in_law) == 2) {
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
}
}
// Add family floter buttons placement data for FE validation
if(count($floters)){
@ -1306,8 +1322,9 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
public function FloterConvertion($array){
$result = [];
foreach ($array as $key => $value) {
if ($value > 0) {
if ($value > 0 && $key != 'elders_count') {
if ($value != 0 && $key === 'childrens') {
for ($i = 1; $i <= $value; $i++) {
$result[] = "child" . $i;
@ -1477,6 +1494,11 @@ public function getAddOnPolicy()
// Map family floaters that already exist in the employee table
$familyFloates = $policy_terms->family_floaters;
// remove parent and parent-in-law from familyFloaters
if($familyFloates->{'either-parents-pil'} != 0){
unset($familyFloates->parents);
unset($familyFloates->parents_in_law);
}
// Convert familyFloaters terms data to plain array
$floters = $this->FloterConvertion($familyFloates);
@ -1551,6 +1573,34 @@ public function getAddOnPolicy()
}
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
{
if(count($addOnEmployeeData) == 0)
{
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('is_addon_value',0)
->where('is_active', 1 )
->where('family_floater_key','parent')
->findAll();
if(count($GMCEmpData) > 0){
$floters = array_diff($floters, ["parent1","parent2"]);
}else{
$floters = array_diff($floters, ["parent_in_law1","parent_in_law2"]);
}
}else{
$count_parent = 0;
$count_parent_in_law = 0;
foreach ($floters as $value) {
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
}
if(($count_parent + $count_parent_in_law) == 2) {
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
}
}
}

View File

@ -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'],

View File

@ -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');

View File

@ -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;
}

View File

@ -11,6 +11,7 @@ class ChatBotModel extends Model
"id",
"request",
"options",
"is_option",
"created_by",
"updated_by",
"is_active",

View File

@ -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',
])

View File

@ -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){

View File

@ -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);

View File

@ -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()
})
}

View 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>

View File

@ -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>

View File

@ -130,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">
@ -260,10 +266,12 @@
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)} / ${(item.policy_end_date)}</td>
@ -318,6 +326,7 @@
$('#base_policy_id').hide();
$('#policy_PrimaryKey').val("");
$('#insurer_policy_id').val("");
$('#gst_no').val(18);
$('#first').hide();
@ -660,27 +669,28 @@
var url = '<?php echo base_url('util/check_policy_type/') ?>' + dataId + '/' + branch_id + '/' + client_id;
if (dataId && branch_id && client_id) { // Check if all parameters exist
if ($('#policy_PrimaryKey').val() == "" || id != $('#insurer_policy_id').val()) {
$.get(url, function(response) {
console.log(response);
console.log(response.count);
// 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);
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);
});
}
} else {
console.log('Missing parameter(s): dataId, branch_id, or client_id');
}
// }).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) {
@ -752,6 +762,10 @@
success: function(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();
@ -789,6 +803,7 @@
$('#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();

View File

@ -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>

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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>

View File

@ -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);

View File

@ -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>

View File

@ -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);

View File

@ -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:

View File

@ -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
},