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

This commit is contained in:
velz 2025-04-18 12:27:56 +05:30
commit 8d9d8ddb27
56 changed files with 5979 additions and 1400 deletions

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ build/
composer.lock
.env
.phpunit*
phpqueue.sh

View File

@ -103,6 +103,8 @@ define('BUSINESS_TEAM_ID', '3');
define('FINANCE_TEAM_ID', '4');
define('SALES_TEAM_ID', '5');
define('MANAGEMENT_TEAM_ID', '6');
define('BUSINESS_SUPPORT_TEAM_ID', '7');
define('POS_TEAM_ID', '8');
/**
* @User Teams Constant

View File

@ -52,6 +52,10 @@ $routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyS
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
$routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1');
$routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2");
$routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1");
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "UserController::create");
@ -348,6 +352,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
});
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
@ -440,6 +445,9 @@ $routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyM
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
$routes->post("/employeeRest/updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
$routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::updateEmpMPIN");
// $routes->post("/employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
//HR login api's
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
@ -460,6 +468,11 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
});
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
@ -467,8 +480,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
// $routes->post("updateMpin", "RestAuthenticationController::updateMpin");
$routes->post("getChatResponse", "ChatBotController::getChatResponse");
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
@ -526,6 +538,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
//New Tickets
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
$routes->get('feedback-list','TicketController::feedbackList');
$routes->get('new/(:any)','TicketController::ticket_form/$1');
$routes->post('create','TicketController::createTicket');
$routes->post('update','TicketController::updateTicket');

View File

@ -17,10 +17,14 @@ class EcardDownloadConversation extends Conversation
protected function showEcardMenu()
{
log_message('error', ('showEcardMenu function called'));
$chat_session_info = get_chatbot_session_info();
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
$buttons = [];
$question = 'Choose Policy to Download Ecard:';
log_message('error', ('policy_list : ' . json_encode($policy_list)));
if(is_array($policy_list) && count($policy_list))
{
foreach($policy_list as $policy)

View File

@ -46,9 +46,16 @@ class MainMenuConversation extends Conversation
$this->bot->reply($message);
}
log_message('error', ('user_reponse before: ' . $user_reponse));
if (!$answer->isInteractiveMessageReply()) {
$user_reponse = null;
}
log_message('error', ('user_reponse is interactive: ' . $answer->isInteractiveMessageReply()));
// Get just the existing path array
$path = $this->bot->userStorage()->get('path') ?? [];
@ -60,25 +67,35 @@ class MainMenuConversation extends Conversation
'path' => $path
]);
log_message('error', ('user_reponse after: ' . $user_reponse));
switch ($user_reponse) {
case "ecard_download":
$this->bot->startConversation(new EcardDownloadConversation());
log_message('error', 'ecard_download clicked ');
break;
case "network_hospital":
$this->bot->startConversation(new NetworkHospitalConversation());
log_message('error', 'network_hospital clicked ');
break;
case "reimbursement_claim":
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
log_message('error', 'reimbursement_claim clicked ');
break;
case "reimbursement_status":
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
log_message('error', 'reimbursement_status clicked ');
break;
case "new_policy":
case "renew_policy":
$this->bot->startConversation(new policyConversation());
log_message('error', 'renew_policy || new_policy clicked ');
break;
default:
log_message('error', 'default shown ');
$this->say("Invalid selection. Please choose an option.");
$this->bot->startConversation(new MainMenuConversation());
break;

View File

@ -59,7 +59,10 @@ class NetworkHospitalConversation extends Conversation
$this->bot->userStorage()->save([
'path' => $path
]);
log_message('error', ('user_reponse : ' . $answer->getValue()));
switch ($answer->getValue()) {
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
$client_poilicy_id = explode('#',$answer->getValue())[1];

View File

@ -46,6 +46,9 @@ class policyConversation extends Conversation
if (!$answer->isInteractiveMessageReply()) {
$user_reponse = null;
}
log_message('error', ('user_reponse : ' . $answer->getValue()));
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()

View File

@ -84,12 +84,13 @@ class ChatbotControllerNew extends BaseController
public function index()
{
if($this->session->get('CHATBOT_RANDOM_USER_ID') == '-' || $this->session->get('CHATBOT_RANDOM_USER_ID') == '')
{
$user = $this->botman->getUser();
$id = $user->getId();
// $this->myLogger->logme('error', ('TEST' . $id));
$this->myLogger->logme('error', ('TEST' . $id));
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
}
@ -100,6 +101,7 @@ class ChatbotControllerNew extends BaseController
}
$this->botman->hears('.*', function ($bot) {
log_message("error","Inside Bot Type Function");
$bot->types(); // Typing indicator for the first message
sleep(0.5); // Delay
@ -128,14 +130,14 @@ class ChatbotControllerNew extends BaseController
$this->botman->listen();
}
private function registerHandlers()
{
// Handling Policy and Claims
$this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
$this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
// private function registerHandlers()
// {
// // Handling Policy and Claims
// $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
// $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
}
// }
public function chatbot()
{

View File

@ -594,7 +594,7 @@ class ClientController extends AdminController
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
$data['state'] = $this->stateModel->getAllStates();
$data['RM'] = $this->userModel->findAll();
$data['RM'] = $this->userModel->where('is_active', 1)->findAll();
$data['policyGridData'] = $this->policyGridModel->findAll();
$data['policy_types'] = $this->policyTypeModel->findAll();
$data['policy_type'] = ['1' => 'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon'];
@ -717,7 +717,7 @@ class ClientController extends AdminController
$this->myLogger->logme('error', 'Edit Client Onboarding function called');
$headerData['page_name'] = 'Edit Client Onboarding';
$editData['RM'] = $this->userModel->findAll();
$editData['RM'] = $this->userModel->where('is_active', 1)->findAll();
$editData['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
$editData['state'] = $this->stateModel->getAllStates();
$editData['police'] = $this->policesModel->findAll();
@ -1994,9 +1994,22 @@ class ClientController extends AdminController
if ($id) {
$client_policy_data = $this->clientPolicyModel->where(['id' => $id, 'is_active' => 1])->first();
$insurer_id = $client_policy_data['insurer_id'];
$client_id = $client_policy_data['client_id'];
if (!empty($client_policy_data['policy_start_date'])) {
$client_policy_data['source_policy_start_date'] = change_date_format($client_policy_data['policy_start_date'], 'Y-m-d', 'd/m/Y');
} else {
$client_policy_data['source_policy_start_date'] = null;
}
if (!empty($client_policy_data['policy_end_date'])) {
$client_policy_data['source_policy_end_date'] = change_date_format($client_policy_data['policy_end_date'], 'Y-m-d', 'd/m/Y');
} else {
$client_policy_data['source_policy_end_date'] = null;
}
$polices = $this->policesModel
->select('policies.*, policy_type.policy_type')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
@ -2022,7 +2035,7 @@ class ClientController extends AdminController
'policy' => $polices,
'client_policy_list' => $client_policy_list,
'end_date' => $newDate,
'new_start_date' => date('d/m/Y', strtotime($client_policy_data['policy_end_date']))
'new_start_date' => date('d/m/Y', strtotime($client_policy_data['policy_end_date'] . ' +1 day')),
], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
@ -3675,6 +3688,7 @@ class ClientController extends AdminController
}
}
//Function for get all client, branch and policy data
public function getClientAndBranchAndPolicy()
{
// ---------for client-----------------------------------------------------------------------------
@ -3725,6 +3739,7 @@ class ClientController extends AdminController
policy_type.iep,
policy_type.itp,
policy_type.bap,
policy_type.allocg,
DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
")
@ -4713,8 +4728,64 @@ class ClientController extends AdminController
// dd($data);
// $LeadsController = new LeadsController();
// $LeadsController->constructNonEbExcelToSaveTemp(92, 2, "Proposal 2-ICICIPRU-ICICI001");
$LeadsController = new LeadsController();
$RFQModel = new RFQModel();
// $path = $LeadsController->constructNonEbExcelToSaveTemp(106, 2, "Proposal 2-ICICIPRU-ICICI001");
// $filepath = $path['filePath'];
// if (file_exists($filepath)) {
// // Set headers to force download
// header('Content-Description: File Transfer');
// header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
// header('Content-Disposition: attachment; filename="' . basename($filepath) . '"');
// header('Content-Length: ' . filesize($filepath));
// header('Pragma: public');
// // Output the file content
// readfile($filepath);
// // Delete the file after download
// unlink($filepath);
// exit;
// } else {
// echo "File does not exist.";
// }
// $data = $this->leadsModel->where('leads.id', 125)->where('leads.is_active', 1)->first();
// $RFQdata = $RFQModel->getRFQTableDataWithLeadIDAndType(145, 2);
// $returnData = $LeadsController->getPlacementJson($data);
// Kint::dump($returnData);
// $policy_terms = $LeadsController->convertNonEbQCRJsonToPolicyTerms(json_decode($returnData, true));
// Kint::dump($policy_terms);
// // $this->clientPolicyModel->where('id', 6050)->set('placement_json', $returnData)->update();
// $this->clientPolicyModel->where('id', 6050)->set('policy_terms', $policy_terms)->update();
// dd($returnData);
// Kint::dump($RFQdata['json']);
// $inputJson = json_decode($RFQdata['json'], true);
// Kint::dump($inputJson);
// // print_rr($inputJson['table_data']);
// $sortedJson = $this->reorderProposalsByInsurerTotal($inputJson);
// // If you want to convert back to JSON string
// $finalJson = json_encode($sortedJson, JSON_PRETTY_PRINT);
// // $RFQModel->insert(['lead_id' => 145, 'json' => $finalJson, 'type' => 1]);
// dd($finalJson);
// $baseWhere = [
// 'client_id' => 159,
// 'client_policy_id' => 336,
// 'insurer_id' => 1,
// 'cd_ac_pk' => 56,
// 'event_name' => "addition",
// ];
// $return_value = check_cd_entry_exist($baseWhere);
// dd($return_value);
}
// -------------------------------------------------------------------------------------------------------
@ -5420,6 +5491,207 @@ class ClientController extends AdminController
$id = $InsurerModel->insert($insurerData);
return $id;
}
private function reorderProposalsByInsurerTotal(array $data): array {
Kint::dump($data);
if (!isset($data['premium_data']['data'])) return $data;
$original = $data['premium_data']['data'];
$proposals = [];
$others = [];
$emptyKeyData = [];
foreach ($original as $key => $value) {
// Match only keys that look like 'Proposal X'
if (preg_match('/^Proposal\s+\d+$/', $key)) {
// Get the insurer entry (not 'Quote Asked')
foreach ($value as $subKey => $subVal) {
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
$proposals[$key] = $value;
break;
}else{
$proposals[$key] = $value;
}
}
} else {
if ($key === '' && isset($value['']) && is_array($value[''])) {
// Capture empty key to push it later
$emptyKeyData[$key] = $value;
}else{
$others[$key] = $value;
}
}
}
// dd($proposals, $others, $emptyKeyData);
// Sort proposals by their insurer's total
uasort($proposals, function($a, $b) {
$totalA = 0;
$totalB = 0;
foreach ($a as $key => $val) {
if ($key !== 'Quote Asked' && isset($val['Total'])) {
$totalA = floatval($val['Total']);
break;
}
}
foreach ($b as $key => $val) {
if ($key !== 'Quote Asked' && isset($val['Total'])) {
$totalB = floatval($val['Total']);
break;
}
}
return $totalA <=> $totalB;
});
// Merge back the sorted proposals into the full structure
$data['premium_data']['data'] = array_merge($others, $proposals, $emptyKeyData);
$data = $this->reorderProposalDataByPremiumOrder($data);
return $data;
}
private function reorderProposalDataByPremiumOrder(array $data): array {
if (!isset($data['premium_data']['data'], $data['proposal_data']['over_all_column_data'])) {
return $data;
}
$premiumProposals = array_keys($data['premium_data']['data']);
$filteredProposals = [];
// Collect proposal keys that match the pattern "Proposal X"
foreach ($premiumProposals as $key) {
if (preg_match('/^Proposal\s+\d+$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) {
$filteredProposals[$key] = $data['proposal_data']['over_all_column_data'][$key];
}
}
// dd($premiumProposals, $filteredProposals);
$data['proposal_data']['over_all_column_data'] = $filteredProposals;
$data = $this->reorderProposalInHeaderAndData($data);
return $data;
}
private function reorderProposalInHeaderAndData(array $data): array {
// Kint::dump($data);
$tableData = $data['table_data'];
$sortedProposalOrder = $data['proposal_data']['over_all_column_data'];
$headers = $tableData['headers'] ?? [];
$dataRows = $tableData['data'] ?? [];
// Step 1: Separate static and proposal headers
$staticHeaders = [];
$proposalHeaders = [];
$actionHeader = [];
foreach ($headers as $header) {
if (in_array($header['parentHeader'], array_keys($sortedProposalOrder))) {
$proposalHeaders[$header['parentHeader']] = $header;
} else {
if($header['parentHeader'] == "Action"){
$actionHeader[] = $header;
}else{
$staticHeaders[] = $header;
}
}
}
// dd($staticHeaders, $proposalHeaders, $sortedProposalOrder);
// Step 2: Reorder headers
$reorderedHeaders = [];
foreach ($sortedProposalOrder as $proposalKey => $proposalValue) {
if (isset($proposalHeaders[$proposalKey])) {
$reorderedHeaders[] = $proposalHeaders[$proposalKey];
}
}
// print_rr($reorderedHeaders); die;
foreach ($reorderedHeaders as $key => &$value) {
$value['parentHeader'] = 'Proposal ' . ($key + 1);
}
unset($value);
$reorderedHeaders = array_merge($staticHeaders, $reorderedHeaders, $actionHeader);
// Step 3: Reorder each row's `data` by matching parentth
foreach ($dataRows as $dataRowIndex => &$row) {
$staticData = [];
$proposalData = [];
$actionData = [];
foreach ($row['data'] as $entry) {
if (in_array($entry['parentth'], array_keys($sortedProposalOrder))) {
$proposalData[$entry['parentth']][] = $entry;
} else {
if($entry['parentth'] == "Action"){
$actionData[] = $entry;
}else{
$staticData[] = $entry;
}
}
}
$reorderedProposalData = [];
foreach ($sortedProposalOrder as $proposalKey => $proposalValue) {
if (isset($proposalData[$proposalKey])) {
foreach ($proposalData[$proposalKey] as $entry) {
$reorderedProposalData[] = $entry;
}
}
}
$dubParTh = "";
$increament = 0;
foreach ($reorderedProposalData as $key => &$value) {
if($dubParTh == $value['parentth']){
$value['parentth'] = 'Proposal ' . ($increament);
}else{
$dubParTh = $value['parentth'];
$increament = $increament + 1;
$value['parentth'] = 'Proposal ' . ($increament);
}
}
unset($value);
$row['data'] = array_merge($staticData, $reorderedProposalData, $actionData);
}
$data['table_data']['headers'] = $reorderedHeaders;
$data['table_data']['data'] = $dataRows;
// dd('-----', $data);
$renumberedArray = $this->renumberProposalKeys($data['proposal_data']['over_all_column_data']);
$updatedDataSet = $this->renumberProposalKeys($data['premium_data']['data']);
$data['proposal_data']['over_all_column_data'] = !empty($renumberedArray) ? $renumberedArray : $data['proposal_data']['over_all_column_data'];
$data['premium_data']['data'] = !empty($updatedDataSet) ? $updatedDataSet : $data['premium_data']['data'];
return $data;
}
private function renumberProposalKeys(array $input): array {
$result = [];
$counter = 1;
foreach ($input as $key => $value) {
if (strpos($key, 'Proposal') === 0) {
$newKey = 'Proposal ' . $counter++;
$result[$newKey] = $value;
} else {
$result[$key] = $value;
}
}
return $result;
}
}

View File

@ -100,8 +100,10 @@ class DashboardController extends AdminController
$data = [];
$db = db_connect();
$sql = "SELECT
if (in_array(get_role_id(), [1,2,3,5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) {
$db = db_connect();
$sql = "SELECT
clients.id AS client_id,
clients.client_name,
clients.short_name,
@ -144,30 +146,32 @@ class DashboardController extends AdminController
GROUP BY clients.id, client_branch.id";
$query = $db->query($sql);
$results = $query->getResultArray();
$query = $db->query($sql);
$results = $query->getResultArray();
$pendingActionsController = new PendingActionsController;
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
$businessTeamData = $this->policyTransactionModel->getBusinessReportList();
$financeTeamData = $this->policyTransactionModel->getFinanceReportList();
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
$pendingActionsController = new PendingActionsController;
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
$businessTeamData = $this->policyTransactionModel->getBusinessReportList();
$financeTeamData = $this->policyTransactionModel->getFinanceReportList();
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
$data['client_branch_emp_list'] = $results;
$session = \Config\Services::session();
$session->set('enrollment_data', json_encode($data));
// echo "<pre>";
$data['pendingActionsData'] = $pendingActionsData;
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
$data['businessTeamStatusData'] = $businessTeamStatusData;
$data['financeTeamStatusData'] = $financeTeamStatusData;
$data['policyStatus'] = $this->policyStatus;
$data['colorShades'] = $this->colorShades;
// print_r($data);die;
$data['client_branch_emp_list'] = $results;
$session = \Config\Services::session();
$session->set('enrollment_data', json_encode($data));
// echo "<pre>";
$data['pendingActionsData'] = $pendingActionsData;
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
$data['businessTeamStatusData'] = $businessTeamStatusData;
$data['financeTeamStatusData'] = $financeTeamStatusData;
$data['policyStatus'] = $this->policyStatus;
$data['colorShades'] = $this->colorShades;
// print_r($data);die;
}
$data['page_name'] = 'Dashboard';

View File

@ -4105,6 +4105,9 @@ class EmpDataServiceController extends BaseController
AND emp_endorsement.pk IN (" . implode(',', $arrayData['employeeIds']) . ")
AND employee_polices.claim_status = 0
AND emp_endorsement.field_name = 'date_of_exit'
AND emp_endorsement.is_active = 1
AND emp_endorsement.actions = 'd'
AND emp_endorsement.status != 'truncated';
")->getRow();
// dd(db_connect()->getLastQuery(), $amount);

View File

@ -360,12 +360,13 @@ class EmployeeController extends AdminController
batch_files.status,
batch_files.client_branch_id,
CASE
WHEN batch_files.status = 'partially success' THEN
batch_files.error_data
CASE
WHEN batch_files.status = 'partially success' OR batch_files.status = 'in-progress-partially' THEN
batch_files.error_data
ELSE
error_data = null
END AS error_data,
NULL
END AS error_data,
clients.short_name as client_short_name,
client_branch.branch_name,

View File

@ -2532,10 +2532,6 @@ class EmployeeRestController extends AdminController
$result = [];
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
if($ClientPolicyValue['policy_type_id'] == 1)
{
$policyGroup = 'gpa';
@ -2555,11 +2551,7 @@ class EmployeeRestController extends AdminController
}
$terms = json_decode($ClientPolicyValue['policy_terms'] , true);
$data['policy_terms'] = isset($terms['enrollment_display_key'])
&& !empty($terms['enrollment_display_key'])
? $terms['enrollment_display_key']
: $this->policyTermsFiter($terms, $policyGroup);
$terms = json_decode($ClientPolicyValue['policy_terms']);
$data['policy_terms'] = isset($terms['enrollment_display_key']) && !empty($terms['enrollment_display_key']) ? $terms['enrollment_display_key'] : $this->policyTermsFiter($terms, $policyGroup);
$data['client_id'] = $ClientPolicyValue['client_id'];
@ -3120,6 +3112,8 @@ class EmployeeRestController extends AdminController
}
// ---------------- TICKET API's ---------------------------------------------------------------------------------------------------
//Get Data from post for inserting ticket and message
public function initiateClaim()
{
@ -3130,6 +3124,18 @@ class EmployeeRestController extends AdminController
$client_policy_id = $received_data['client_policy_id'];
$insured_emp_id = $received_data['insured_emp_id'];
if (empty($received_data['doa'])) {
$received_data['doa'] = null;
} else{
$ticket_data['doa'] = change_date_format($received_data['doa']);
}
if (empty($received_data['dod'])) {
$received_data['dod'] = null;
} else{
$ticket_data['dod'] = change_date_format($received_data['dod']);
}
$sql = "
select
cp.policy_type_id,
@ -3172,29 +3178,42 @@ class EmployeeRestController extends AdminController
if(!empty($emp_ticket_data)){
$fetchData = $emp_ticket_data[0];
$fetchData['claim_status_id'] = $this->claimStatusModel
->select('id')
->where('ticket_type', $fetchData['ticket_type_id'])
->orderBy('id', 'asc')
->first()['id'];
$claimStatusQuery = $this->claimStatusModel
->select('id')
->where('ticket_type', $fetchData['ticket_type_id'])
->orderBy('id', 'asc');
if ($fetchData['ticket_type_id'] == 1 && !empty($fetchData['tpa_no'])) {
$results = $claimStatusQuery->findAll(2);
$fetchData['claim_status_id'] = $results[1]['id'] ?? $results[0]['id'];
} else {
$fetchData['claim_status_id'] = $claimStatusQuery->first()['id'];
}
$fetchData['priority'] = 1;
$fetchData['mode_of_intimation'] = 1;
$fetchData['mode_of_intimation'] = 3;
$fetchData['claim_type'] = 1;
$fetchData = array_merge($fetchData, $received_data);
$fetchData['relationship'] = strtolower($fetchData['relationship']) ?? $fetchData['relationship'];
// print_r($fetchData); die;
$insert_status = $this->ticketMaster->insert($fetchData);
$ticket_id = $this->ticketMaster->insertID();
if ($insert_status && !empty($ticket_id)) {
//insert first history
$this->ticketController->putHistoryAfterInsert($fetchData, $ticket_id);
$messagesData = [
'ticket_id' => $ticket_id ?? null,
'sender' => 'user',
'claim_status' => $fetchData['claim_status_id'] ?? null,
'emp_mail' => $fetchData['emp_mail'] ?? null,
'mail_subject' => $fetchData['subject'] ?? null,
'mail_content' => $fetchData['message'] ?? null,
'mail_subject' => $fetchData['subject'] ?? "New Claim",
'mail_content' => $fetchData['message'] ?? "New Claim",
];
if (!empty($messagesData['ticket_id'])) {

File diff suppressed because it is too large Load Diff

View File

@ -1422,11 +1422,12 @@ class MasterController extends AdminController
if ($insert) {
//for CD Tranction Table
$cd_tranction_data['cd_ac_pk'] = $this->CDMasterModel->insertID();
$response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
$cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll();
return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully'], 200);
return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully', "FOR BDS PURPOSE"], 200);
}else{
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
}

View File

@ -306,6 +306,12 @@ class PolicyTransactionController extends BaseController
$data['policy_with_corr'] = 1;
}
if (!isset($data['is_cd_reduce_from_bds'])) {
$data['is_cd_reduce_from_bds'] = 0;
} elseif ($data['is_cd_reduce_from_bds']) {
$data['is_cd_reduce_from_bds'] = 1;
}
if($data['ct_type'] == ""){
$data['ct_type'] = 1;
}
@ -342,7 +348,7 @@ class PolicyTransactionController extends BaseController
$this->policyTransactionModel->update($insert, ['client_policy_id' => $client_policy_id]);
$emp_policy_insert = $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
if ($data['client_type'] == 1 && $data['status'] == 'completed') {
if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) {
$this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']);
}
}
@ -362,6 +368,7 @@ class PolicyTransactionController extends BaseController
private function updateInceptionPolicy($id, $data)
{
// print_r($data); die;
if ($this->policyTransactionModel->update($id, $data)) {
$this->insertTransactionStatus($id, $data, 1);
@ -391,7 +398,7 @@ class PolicyTransactionController extends BaseController
}
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
if($data['client_type'] == 1){
if($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1){
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
}
}
@ -418,7 +425,7 @@ class PolicyTransactionController extends BaseController
// die;
if(isset($data['co_share_id']) && !empty($data['co_share_id'])){
$this->removePtCoShareRecords($data['co_share_id']);
$this->removePtCoShareRecords($data['co_share_id'], $pt_id);
}
if(isset($data['follow_insurer_id'])){
@ -426,7 +433,12 @@ class PolicyTransactionController extends BaseController
foreach ($data['follow_insurer_id'] as $index => $insurer) {
// Separate the insurer and insurer branch
list($insurer_branch_id, $insurer_id) = explode('-', $insurer);
if(isset($insurer) && !empty($insurer)){
list($insurer_branch_id, $insurer_id) = explode('-', $insurer);
}else{
$insurer_branch_id = null;
$insurer_id = null;
}
// Prepare each co-share detail entry
$coShareDetails[] = [
@ -547,7 +559,7 @@ class PolicyTransactionController extends BaseController
private function processCompletedStatus($data, $client_policy_id, $insurer_id)
{
$totalAmount = (int)$data['total'][0] ?? 0;
$description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited for the ' . $data['emp_count'] . ' employees at Inception.';
$description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited for the ' . $data['emp_count'] . ' employees at Inception (BDS).';
$cdTransactionData = [
'amount' => $totalAmount,
@ -562,8 +574,9 @@ class PolicyTransactionController extends BaseController
'updated_by' => get_session_userid(),
'event_name' => 'inception',
'is_active' => 1,
'cd_ac_pk' => $data['cd_ac_pk']
];
DepositHelper::saveDeposit($cdTransactionData, get_session_userid());
}
@ -790,13 +803,24 @@ class PolicyTransactionController extends BaseController
->whereIn('client_policy.policy_type_id', [2, 3])
->where('client_policy.is_active', 1)
->findAll();
$data['pt_files'] = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $id)
->where('pt_files.is_active', 1)
->findAll();
$ptFileQuery = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $id)
->where('pt_files.is_active', 1);
if (!in_array(get_role_id(), [1, 5]) && empty(array_intersect(user_team(), [MANAGEMENT_TEAM_ID, FINANCE_TEAM_ID, BUSINESS_TEAM_ID]))) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$ptFileQuery->where('pt_files.created_by', get_session_userid());
}
}
$data['pt_files'] = $ptFileQuery->findAll();
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel
->select("
pt_co_share_details.*,
@ -956,22 +980,26 @@ class PolicyTransactionController extends BaseController
}
//function for soft delete for pt_co_share_details records
public function removePtCoShareRecords($primaryKeys)
public function removePtCoShareRecords($primaryKeys, $pt_id)
{
// print_r($primaryKeys); die;
if (empty($primaryKeys)) {
return false;
}
// Convert array to a comma-separated string for query binding
// Convert array to a comma-separated string of placeholders for query binding
$placeholders = implode(',', array_fill(0, count($primaryKeys), '?'));
$sql = "UPDATE pt_co_share_details SET is_active = 0 WHERE id NOT IN ($placeholders)";
return db_connect()->query($sql, $primaryKeys);
// Prepare the query with proper binding
$sql = "UPDATE pt_co_share_details SET is_active = 0 WHERE pt_id = ? AND id NOT IN ($placeholders)";
// Merge pt_id with primary keys for binding
$params = array_merge([$pt_id], $primaryKeys);
// Execute the query with bound parameters
return db_connect()->query($sql, $params);
}
//------------------------------------------------------------------------------------------------
// Policy Transaction Endorsement
@ -1086,6 +1114,12 @@ class PolicyTransactionController extends BaseController
$data['policy_with_corr'] = 1;
}
if (!isset($data['is_cd_reduce_from_bds'])) {
$data['is_cd_reduce_from_bds'] = 0;
} elseif ($data['is_cd_reduce_from_bds']) {
$data['is_cd_reduce_from_bds'] = 1;
}
if(empty($data['data_received_date'])){
$data['data_received_date'] = null;
}else{
@ -1155,8 +1189,8 @@ class PolicyTransactionController extends BaseController
'policy_type_id' => $issue_type['policy_type_id'] ?? null,
'issue_type' => $issue_type['issue_type'] ?? null,
'source_client_policy_id' => $issue_type['source_client_policy_id'] ?? null,
'cd_ac_no' => $issue_type['cd_ac_no'] ?? null,
'cd_ac_pk' => $issue_type['cd_ac_pk'] ?? null,
'cd_ac_no' => isset( $data['cd_ac_no']) && !empty($data['cd_ac_no']) ? $data['cd_ac_no'] : $issue_type['cd_ac_no'] ?? null,
'cd_ac_pk' => isset( $data['cd_ac_pk']) && !empty($data['cd_ac_pk']) ? $data['cd_ac_pk'] : $issue_type['cd_ac_pk'] ?? null,
// 'policy_issue_date' => $issue_type['policy_issue_date'] ?? null,
'policy_start_date' => $issue_type['policy_start_date'] ?? null,
'policy_end_date' => $issue_type['policy_end_date'] ?? null,
@ -1215,6 +1249,7 @@ class PolicyTransactionController extends BaseController
$update = $this->policyTransactionModel->where('id', $id)->set($data)->update();
if ($update) {
$this->insertTransactionStatus($id, $data, 1);
$this->handleCompletedStatus($data, $id);
$this->insertOrUpdateCoShareDetails($data, $id);
@ -1227,13 +1262,13 @@ class PolicyTransactionController extends BaseController
}
private function handleCompletedStatus($data, $policy_tran_id)
{
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
{
if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) {
$tolamt = $data['total'][0] ?? 0;
$description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' .
($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction';
($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction (BDS)';
$cd_tranction_data = [
'amount' => $tolamt,
@ -1248,6 +1283,7 @@ class PolicyTransactionController extends BaseController
'updated_by' => get_session_userid(),
'event_name' => $data['action_type'],
'is_active' => 1,
'cd_ac_pk' => $data['cd_ac_pk'] ?? null,
];
DepositHelper::saveDeposit($cd_tranction_data, get_session_userid());
@ -1501,11 +1537,19 @@ class PolicyTransactionController extends BaseController
if (!empty($uploadData)) {
$data['pt_files'] = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $pt_id)
->where('pt_files.is_active', 1)
->findAll();
$ptFileQuery = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $pt_id)
->where('pt_files.is_active', 1);
if (!in_array(get_role_id(), [1, 5]) && empty(array_intersect(user_team(), [MANAGEMENT_TEAM_ID, FINANCE_TEAM_ID, BUSINESS_TEAM_ID]))) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$ptFileQuery->where('pt_files.created_by', get_session_userid());
}
}
$data['pt_files'] = $ptFileQuery->findAll();
return $this->respond(['status' => true, 'message' => 'File uploaded successfully in G-Drive', 'data' => $data]);
} else {
@ -1565,6 +1609,7 @@ class PolicyTransactionController extends BaseController
->select("
pt_co_share_details.*,
policy_transaction.bro_payable_by,
policy_transaction.cd_ac_pk,
(
select cd_ac_no
from cd_master
@ -1592,9 +1637,12 @@ class PolicyTransactionController extends BaseController
->where('is_active', 1)
->first();
$cd_ac_no = db_connect()->table('cd_master')->where('id', $is_copay_yes['cd_ac_pk'] ?? null)->get()->getRowArray();
if ($totalCount) {
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes], 200);
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes, "cd_master_data" => $cd_ac_no], 200);
} else {
$insurer_data = $this->clientPolicyModel->where('id', $client_policy_id)->where('is_active', 1)->first();
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to get data'], 200);
}

View File

@ -118,7 +118,7 @@ class RestAuthenticationController extends AdminController
->where('employees.emp_status !=', 'truncated')
->where('employees.email_corporate', $email)
->where('EP.is_active', 1)
->whereIn('EP.status', ['draft', 'enrolled'])
->whereIn('EP.status', ['active'])
->first();
if (isset($employeeData['employee_id'])) {
@ -178,6 +178,46 @@ class RestAuthenticationController extends AdminController
}
public function updateEmpMPIN()
{
$requestData = $this->request->getJSON();
$mobile_number = $requestData->mobile_number ?? null;
$email_id = $requestData->email_id ?? null;
$new_mpin = $requestData->new_mpin ?? $requestData->mpin ?? null;
$old_mpin = $requestData->old_mpin ?? null;
if (!$new_mpin) {
return $this->response->setJSON(['status' => false, 'message' => 'MPIN is required.']);
}
$query = $this->employeeModel->where('relationship', 'self');
if ($mobile_number) {
$query->where('mobile', $mobile_number);
} elseif ($email_id) {
$query->where('email_corporate', $email_id);
} else {
return $this->response->setJSON(['status' => false, 'message' => 'Mobile number or Email ID is required.']);
}
if (!empty($old_mpin)) {
$query->where('mpin', $old_mpin);
}
// Fetch employee data
$employeeData = $query->first();
if (!$employeeData) {
return $this->response->setJSON(['status' => false, 'message' => 'Employee not found or invalid MPIN.']);
}
// Update MPIN
$updated = $this->employeeModel->update($employeeData['id'], ['mpin' => $new_mpin]);
return true;
}
public function getVerifiedUserData()
{
@ -401,15 +441,14 @@ class RestAuthenticationController extends AdminController
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
$mpin = $this->request->getJSON()->mpin;
if (isset($mobile_number))
{
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
}else{
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first();
}
if ($employeeData && $mpin == $employeeData["mpin"]) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
@ -427,6 +466,7 @@ class RestAuthenticationController extends AdminController
$result = JWTToken::encode($employeeData);
// $result = $employeeData;
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
@ -441,7 +481,7 @@ class RestAuthenticationController extends AdminController
try {
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
$mpin = $this->request->getJSON()->mpin;
// $mpin = $this->request->getJSON()->mpin;
if (isset($mobile_number))
{

View File

@ -120,6 +120,9 @@ class TicketController extends BaseController
'((POLICY_TYPE))' => 'policy_type',
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
'((CLAIM_FORM_LINK))' => 'claim_form_link',
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
'((SETTLED_LETTER))' => 'settle_letter',
'((APPROVED_LETTER))' => 'approved_letter',
];
$this->extraFields = [
1 => ['non_id_reason'],
@ -232,7 +235,9 @@ class TicketController extends BaseController
'tcs.claim_status AS status',
'tm.claim_number AS claim_no',
'tm.tpa_id',
'tm.tpa_no',
'tm.emp_name',
'tm.emp_code',
'i.name AS insurer_name',
'c.client_name',
'tm.insured_name',
@ -272,7 +277,9 @@ class TicketController extends BaseController
'tm.claim_status_id',
'tm.is_head_approved',
'tm.tpa_id',
'tm.tpa_no',
'tm.emp_name',
'tm.emp_code',
'i.name AS insurer_name',
'c.client_name',
'tm.insured_name',
@ -456,7 +463,18 @@ class TicketController extends BaseController
$data['placeHolders'] = $this->placeHolders;
$data['message_data'] = $this->getTicketMessage($ticket_id);
$data['view_ticket_page'] = [];
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
if($ticket_data['ticket_type_id'] == 1){
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
}else{
$data['member_data'] = array_filter(
$this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']),
function ($member) {
return isset($member['emp_relationship']) && $member['emp_relationship'] == 'Self';
}
);
}
$data['ticket_history'] = $this->ticketHistory($ticket_id);
$data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray();
if (!empty($ticket_data['client_policy_id'])){
@ -578,7 +596,9 @@ class TicketController extends BaseController
$return_value = $this->ticketMasterModel->insert($ticket_data);
if ($return_value) {
//mail trigger part
$this->putHistoryAfterInsert($ticket_data, $return_value);
$mail_responce = $this->sendAutoMailTrigger($return_value);
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $return_value);
return $this->respond(['status' => true, 'ticket_id' => $return_value, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
@ -601,8 +621,12 @@ class TicketController extends BaseController
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
if ($return_value) {
//mail trigger part
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
$mail_responce = null;
if($old_ticket_data['claim_status_id'] != $ticket_data['claim_status_id']){
//mail trigger part
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $ticket_id);
}
//send mail to the head for rejected ticket approvel
if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){
@ -751,13 +775,20 @@ class TicketController extends BaseController
{
// log_message('error','Function called');die();
// $ticket_master_id = $this->request->getPost('id');
$user_id = get_session_userid();
$logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
$dataToSend = [];
$dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
$dataToSend['messages'] = $this->ticketMessageModel->where('is_active', 1)
->where('ticket_id', $ticket_master_id)->orderBy('created_at', 'DESC')
$user_id = get_session_userid();
// $logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
// $dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
$dataToSend['messages'] = $this->ticketMessageModel
->select('ticket_messages.*,up.first_name as user_name')
->join('user_profiles up', 'up.id = ticket_messages.created_by', 'left')
->where('ticket_messages.is_active', 1)
->where('ticket_messages.ticket_id', $ticket_master_id)
->orderBy('ticket_messages.created_at', 'DESC')
->findAll();
foreach ($dataToSend['messages'] as $message) {
$mail_content_converted = $this->convertHtmlToText($message['mail_content']);
$message['mail_content'] = $mail_content_converted;
@ -837,7 +868,7 @@ class TicketController extends BaseController
}
// Construct Mail Data
$mailData = [
$mailData[] = [
'mail' => $ticket_data['emp_mail'],
'subject' => $subject,
'message' => $message,
@ -845,6 +876,17 @@ class TicketController extends BaseController
'attachments' => []
];
// if the employee personal mail is not empty then send the mail to the employee personal mail
if(!empty($ticket_data['emp_personal_mail'])){
$mailData[] = [
'mail' => $ticket_data['emp_personal_mail'],
'subject' => $subject,
'message' => $message,
'cc' => $ticket_data['common_mails'] ?? '',
'attachments' => []
];
}
// print_r($mailData); die;
$this->myLogger->logme('error', "Final Email Data");
@ -869,6 +911,12 @@ class TicketController extends BaseController
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
} else if ($value == "claim_form_link"){
$replaceData = '<a href="' . base_url('claim-form-download/' . md5($ticket_data['insurer_id'])) . '" target="_blank">Click here to download Claim Form</a>';
} else if ($value == "claim_feedback_form" && $ticket_data['ticket_type_id'] == 1){
$replaceData = '<a href="' . base_url('claims-feedback-form/' . md5($ticket_data['id'])) . '" target="_blank">Click to open Claim Feedback Form</a>';
} else if ($value == "settle_letter"){
$replaceData = '<a href="' . $ticket_data['settle_letter'] . '" target="_blank"> View Settlement Letter </a>';
}else if ($value == "approved_letter"){
$replaceData = '<a href="' . $ticket_data['approved_letter'] . '" target="_blank"> View Approved Letter </a>';
}else {
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
}
@ -927,6 +975,27 @@ class TicketController extends BaseController
$this->myLogger->logme('error', "Fetched ACM emails");
if(!empty($ticket_data['emp_personal_mail'])){
$this->myLogger->logme('error', "Send employee personal mail start");
$emailPersonalData = [
'mail' => $ticket_data['emp_personal_mail'],
'subject' => $mail_data['mail_subject'],
'message' => $mail_data['mail_content'],
'common' => [],
'cc' => $acm_mails['common_mails'],
'attachments' => []
];
$this->sendTrigger($emailPersonalData);
$this->myLogger->logme('error', "Send employee personal mail successfully");
}else{
$this->myLogger->logme('error', "Send employee personal mail is empty");
}
$emailData = [
'mail' => $mail_data['emp_mail'],
'subject' => $mail_data['mail_subject'],
@ -950,7 +1019,10 @@ class TicketController extends BaseController
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
$mail_content = $this->constructMailContent($ticket_id);
// print_r($mail_content); die;
$mail_responce = $this->sendTrigger($mail_content);
foreach ($mail_content as $key => $value) {
$mail_responce = $this->sendTrigger($value);
$this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
}
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
} else {
@ -972,7 +1044,7 @@ class TicketController extends BaseController
th.old_value,
th.new_value,
th.created_at,
CONCAT(creator.first_name, ' ', creator.last_name) as modified_by,
CONCAT_WS(' ', creator.first_name, creator.last_name) AS modified_by,
-- Claim Status
old_status.claim_status as old_status_value,
new_status.claim_status as new_status_value,
@ -1032,6 +1104,7 @@ class TicketController extends BaseController
ORDER BY
th.created_at DESC";
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
// dd(db_connect()->getLastQuery());
$priorityType = $this->priorityType;
$relationshipType = $this->relationshipType;
$modeOFIntimate = $this->modeOFIntimate;
@ -1166,7 +1239,7 @@ class TicketController extends BaseController
if ($policy_type == 1){
$viewData['column_order'] = [
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
'UNDER PROCESS - CLAIM NO. UPDATION',
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
'TOTAL'
];
@ -1185,7 +1258,7 @@ class TicketController extends BaseController
}else{
$viewData['column_order'] = [
'ACM_NAME', 'CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING',
'INSURER PENDING','INVESTIGATION','APPROVED','ON HOLD','TOTAL', 'NOT COVERED',
'INSURER PENDING','INVESTIGATION','APPROVED','TOTAL', 'NOT COVERED',
'CLOSED', 'SETTLED', 'CLEARED_TOTAL'
];
$ordered_data = [];
@ -1207,7 +1280,7 @@ class TicketController extends BaseController
$viewData['column_order'] = [
'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED',
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
'UNDER PROCESS - CLAIM NO. UPDATION',
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
];
@ -1371,7 +1444,8 @@ class TicketController extends BaseController
}
}
public function getPoliciesbyEmpID() {
public function getPoliciesbyEmpID()
{
$received_data = $this->request->getPost();
$emp_id = $received_data['emp_id'];
@ -1443,5 +1517,121 @@ class TicketController extends BaseController
return $this->response->setStatusCode(500)->setBody('An error occurred while downloading the file.');
}
}
// -------------------------------------------------------------------------------------------------------------------------
public function autoMessageInsertBasedOnMailResponse($mail_sent_status, $ticket_id)
{
if (gettype($mail_sent_status) == 'array') {
$this->myLogger->logme('error', "auto Message Insert Based On Mail Response Failed because is array :$ticket_id ");
} else {
$mail_sent_status = json_decode($mail_sent_status);
$this->myLogger->logme('error', "mail_sent_status is object :$ticket_id ");
}
if (!empty($mail_sent_status) && isset($mail_sent_status->status) && $mail_sent_status->status == 'success') {
$sent_message_data['ticket_id'] = $ticket_id;
$sent_message_data['sender'] = 'staff';
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
$message_insert_status = $this->ticketMessageModel->insert($sent_message_data);
if ($message_insert_status) {
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, successfully store message:$ticket_id ");
} else {
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
}
return true;
} else {
$this->myLogger->logme('error', "Failed to send Mail :$ticket_id ");
return true;
}
}
public function putHistoryAfterInsert($ticket_data, $ticket_id)
{
$this->myLogger->logme('error', "Put History After Insert function called : $ticket_id");
if(!empty($ticket_data)){
$history_data = [
'ticket_id' => $ticket_id,
'field_name' => 'claim_status_id',
'display_name' => 'Ticket Created',
'old_value' => null,
'new_value' => $ticket_data['claim_status_id'],
'created_by' => get_session_userid(),
'is_active' => 1
];
$this->myLogger->logme('error', "Put History After Insert function called : " . json_encode($history_data));
$history_insert = $this->ticketHistoryModel->insert($history_data);
if($history_insert){
$this->myLogger->logme('error', "Put History After Insert Ticket Data Successfully");
}else{
$this->myLogger->logme('error', "Put History After Insert Ticket Data Failed");
}
}else{
$this->myLogger->logme('error', "Put History After Insert Ticket Data is empty");
}
return true;
}
public function viewClaimFeedbackForm($md5_ticket_id,$empView = null)
{
if ($this->request->is("get")){
$data['ticket_id'] = $md5_ticket_id;
$data['ticket_data'] = $this->ticketMasterModel->select('ticket_master.*,clients.client_name')->join('clients','clients.id = ticket_master.client_id')->where('MD5(ticket_master.id)',$md5_ticket_id)->where('ticket_master.is_active',1)->first();
$data['form_submitted'] = !empty($data['ticket_data']['feedback_json'])? 1 : 0;
$data['viewer'] = !empty($empView) ? $empView : 0;
// dd($data);
return view('ticket_feedback_form', $data);
}else{
$formDataJson = json_encode($this->request->getPost());
// log_message("error","Form data : ".$formDataJson);
$data_to_store = [
'feedback_json' => $formDataJson
];
if (!empty($formDataJson)){
// $this->ticketMasterModel->save($data_to_store);
$this->ticketMasterModel->where('MD5(id)', $md5_ticket_id)->set($data_to_store)->update();
return $this->respond(['status' => true,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200);
}else{
return $this->respond(['status' => false,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200);
}
}
}
public function feedbackList(){
$data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll();
// dd($data);
$this->loadLayout("ticket_feedback_list",$data);
}
}

View File

@ -32,8 +32,11 @@ class DepositHelper
*/
public static function saveDeposit(array $data, int $loggedInUserID): array
{
log_message("error", 'saveDeposit function called '. json_encode($data));
// Retrieve the last known balance
$lastBalance = self::calculateLastBalance($data['client_id'], $data['insurer_id'], $data['cd_ac_no']);
$lastBalance = self::calculateLastBalance($data['client_id'], $data['insurer_id'], $data['cd_ac_no'], $data['cd_ac_pk'] ?? null);
// Calculate the new balance based on the transaction type
$newBalance = self::calculateBalance(
@ -91,15 +94,21 @@ class DepositHelper
*
* @return float The last known balance.
*/
public static function calculateLastBalance(int $clientId, int $insurerId, $cd_ac_no): float
public static function calculateLastBalance(int $clientId, int $insurerId, $cd_ac_no, $cd_ac_pk): 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 cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
$getLastBalanceParams = [$cd_ac_no];
if(empty($cd_ac_pk)){
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
$getLastBalanceParams = [$cd_ac_no];
}else{
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_pk = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
$getLastBalanceParams = [$cd_ac_pk];
}
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;

View File

@ -17,10 +17,13 @@ class ExcelMergeHelper {
{
try {
log_message('debug', 'Attempting merge with original file order');
// echo "Attempting merge with original file order\n";
return self::processFiles($filePaths, $outputPath);
} catch (Exception $e) {
log_message('error', 'First attempt failed: ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
// echo "First attempt failed: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
log_message('debug', 'Retrying with reversed file order');
// echo "Retrying with reversed file order\n";
// Reverse the file order and try again
$reversedFiles = array_reverse($filePaths);
@ -29,6 +32,7 @@ class ExcelMergeHelper {
return self::processFiles($reversedFiles, $outputPath);
} catch (Exception $e2) {
log_message('error', 'Both attempts failed. Last error: ' . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine());
// echo "Both attempts failed. Last error: " . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine() . "\n";
return null;
}
}
@ -45,7 +49,9 @@ class ExcelMergeHelper {
private static function processFiles(array $filePaths, string $outputPath): string
{
log_message('debug', 'Starting Excel merge process');
// echo "Starting Excel merge process\n";
log_message('debug', 'Files to process: ' . json_encode($filePaths));
// echo "Files to process: " . json_encode($filePaths) . "\n";
if (empty($filePaths)) {
throw new Exception("No files provided to merge");
@ -66,6 +72,7 @@ class ExcelMergeHelper {
// Save the merged file
log_message('debug', "Saving merged file to: {$outputPath}");
// echo "Saving merged file to: {$outputPath}\n";
$writer = IOFactory::createWriter($mergedSpreadsheet, 'Xlsx');
$writer->setPreCalculateFormulas(false);
$writer->save($outputPath);
@ -76,6 +83,7 @@ class ExcelMergeHelper {
gc_collect_cycles();
log_message('debug', 'Excel merge process completed successfully');
// echo "Excel merge process completed successfully\n";
return $outputPath;
}
@ -87,15 +95,17 @@ class ExcelMergeHelper {
* @param int|null $index
* @throws Exception
*/
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, int $index = null)
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, ?int $index = null)
{
if (!isset($fileInfo['file_path']) || !file_exists($fileInfo['file_path'])) {
$path = $fileInfo['file_path'] ?? 'undefined';
log_message('error', "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}");
// echo "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}\n";
return;
}
log_message('debug', "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path']);
// echo "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path'] . "\n";
try {
// Load the source spreadsheet
@ -105,6 +115,7 @@ class ExcelMergeHelper {
$worksheets = $sourceSpreadsheet->getAllSheets();
$totalSheets = count($worksheets);
log_message('debug', "Total sheets in file: " . $totalSheets);
// echo "Total sheets in file: " . $totalSheets . "\n";
$sheetsToMerge = $fileInfo['sheets'] ?? [];
@ -114,26 +125,30 @@ class ExcelMergeHelper {
try {
$sheetName = $worksheet->getTitle();
log_message('debug', "Processing sheet: {$sheetName}");
// echo "Processing sheet: {$sheetName}\n";
// Generate unique sheet name before cloning
$newName = $sheetName;
$counter = 1;
while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
$newName = $sheetName . "_" . $counter++;
// $newName = $sheetName . "_" . $counter++;
log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
// echo "Sheet name already exists. Trying new name: {$newName}\n";
}
// Clone the worksheet and set the new name
$clonedSheet = clone $worksheet;
$clonedSheet->setTitle($newName);
// $clonedSheet = clone $worksheet;
// $clonedSheet->setTitle($newName);
// Add as external sheet
$mergedSpreadsheet->addExternalSheet($clonedSheet);
$mergedSpreadsheet->addExternalSheet($worksheet);
log_message('debug', "Successfully added sheet: {$newName}");
// echo "Successfully added sheet: {$newName}\n";
} catch (Exception $e) {
log_message('error', "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
// echo "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
}
}
}
@ -145,6 +160,7 @@ class ExcelMergeHelper {
} catch (Exception $e) {
log_message('error', "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
// echo "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
}
}
}

View File

@ -29,6 +29,7 @@ class ExcelSanitizeHelper
$cleanData[$key] = self::sanitizeArrayData($value); // Recursive call for nested arrays
} elseif (is_string($value)) {
// Remove non-printable characters and trim whitespace from strings
$value = str_replace("\u00a0", " ", $value);
$cleanData[$key] = trim(preg_replace(self::$nonPrintablePattern, '', $value));
} else {
$cleanData[$key] = $value; // Keep non-string/non-array data as is

View File

@ -665,3 +665,81 @@ if (!function_exists('check_pay_by_employee_or_company')) {
}
if (!function_exists('is_json_string')) {
function is_json_string($string)
{
if (!is_string($string)) {
return false;
}
$decoded = json_decode($string, true);
return (json_last_error() === JSON_ERROR_NONE && is_array($decoded));
}
}
if (!function_exists('check_cd_entry_exist')) {
function check_cd_entry_exist($params)
{
$db = db_connect();
$client_id = $params['client_id'];
$client_policy_id = $params['client_policy_id'];
$insurer_id = $params['insurer_id'];
$cd_ac_pk = $params['cd_ac_pk'];
$event_name = $params['event_name'];
// Check if truncated entry (sub_type = 8) exists
$has_truncated = $db->table('cash_deposit')
->where('client_id', $client_id)
->where('insurer_id', $insurer_id)
->where('cd_ac_pk', $cd_ac_pk)
->where('client_policy_id', $client_policy_id)
->where('event_name', $event_name)
->where('sub_type', 8)
->where('is_active', 1)
->countAllResults();
if ($has_truncated) {
echo "has_truncated";
// Get all entries with same details (including truncated)
$entries = $db->table('cash_deposit')
->where('client_id', $client_id)
->where('insurer_id', $insurer_id)
->where('cd_ac_pk', $cd_ac_pk)
->where('client_policy_id', $client_policy_id)
->where('event_name', $event_name)
->where('is_active', 1)
->where('sub_type !=', 8)
->get()
->getResultArray();
if (count($entries) > 1) {
// Only one entry found (truncated)
return true;
}else{
return false;
}
} else {
// Check if any other entry exists
$entry = $db->table('cash_deposit')
->where('client_id', $client_id)
->where('insurer_id', $insurer_id)
->where('cd_ac_pk', $cd_ac_pk)
->where('client_policy_id', $client_policy_id)
->where('event_name', $event_name)
->where('is_active', 1)
->get()
->getRowArray();
if (!empty($entry)) {
return true;
}
}
return false;
}
}

View File

@ -54,6 +54,7 @@ class ClientPolicyModel extends Model
"is_member_modify_allowed",
"cd_ac_pk",
"is_lgbtq",
"placement_json",
];
// Callbacks

View File

@ -81,6 +81,146 @@ class EmployeePolicyModel extends Model
}
// ----------------------------------------------------------------------------------------------------------
// public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "")
// {
// // dd($status);
// $result = $this->select([
// 'employee_polices.*',
// 'policy_type.policy_type as policy_name',
// 'im.short_name as insurer_short_name',
// 'ib.branch_name as insurer_branch_name',
// 'ib.branch_code as insurer_branch_code',
// 'tpam.name as tpa_name',
// 'tpam.short_name as tpa_short_name',
// 'tpab.branch_code as tpa_branch_code',
// 'cm.client_name',
// 'cm.short_name as client_short_name',
// // 'emp.id as employee_primary_id',
// 'emp.relationship',
// 'emp.relationship_code',
// 'emp.change_event',
// 'emp.emp_code',
// 'emp.name',
// 'emp.email_corporate',
// 'emp.dob',
// 'DATE_FORMAT(emp.dob, "%d/%m/%Y") AS formatted_dob',
// 'emp.gender',
// 'emp.emp_status',
// 'emp.is_active as emp_is_active',
// 'emp.mobile as mobile',
// 'emp.doj',
// 'emp.basic_pay',
// 'emp.band as grade',
// 'policy_type.policy_type',
// 'client_branch.branch_name as client_branch_name',
// 'client_branch.branch_code as client_branch_code',
// 'cp.policy_no',
// 'cp.policy_type_id',
// // Name audit trail
// '(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "name" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS name_first_old',
// '(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "name" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS name_last_new',
// // DOB audit trail
// '(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "dob" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS dob_first_old',
// '(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "dob" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS dob_last_new',
// // Gender audit trail
// '(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "gender" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS gender_first_old',
// '(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "gender" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS gender_last_new',
// '(CASE
// WHEN emp.relationship = "Self"
// THEN (SELECT COUNT(id) FROM employees WHERE emp_code = emp.emp_code AND is_active = 0 AND emp_status != "truncated")
// ELSE NULL
// END) AS removed_count',
// '(CASE
// WHEN emp.relationship != "Self" AND emp.created_at != (
// SELECT created_at
// FROM employees
// WHERE emp_code = emp.emp_code AND relationship = "Self" AND is_active = 1
// LIMIT 1
// )
// THEN "Newly Added"
// ELSE NULL
// END) AS newly_added',
// ])
// ->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', 'left') //pm - policy master
// ->join('policy_type', 'policy_type.id = cp.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
// ->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
// ->join('clients cm', 'cp.client_id = cm.id') //cm - client master
// ->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
// ->orderBy('emp.emp_code', 'ASC')
// ->orderBy('employee_polices.employee_id', 'ASC');
// // Conditionally add where clauses
// if ($client_id != 0 && !empty($client_id)) {
// $result->where('emp.client_id', $client_id);
// }
// if ($branch_id != 0 && !empty($branch_id)) {
// $result->where('emp.client_branch_id', $branch_id);
// }
// if ($policy_id != 0 && !empty($policy_id)) {
// $result->where('employee_polices.client_policy_id', $policy_id);
// }
// if (is_array($status) && count($status) > 0) {
// $result->where('employee_polices.status !=', 'expired');
// if (in_array("active", $status)) {
// $result->where('employee_polices.tpa_id IS NOT NULL');
// $result->where('employee_polices.uhid IS NOT NULL');
// $result->whereIn('employee_polices.status', $status);
// } elseif (in_array("pending", $status)) {
// $result->where('employee_polices.tpa_id IS NULL');
// $result->where('employee_polices.uhid IS NULL');
// $result->whereIn('employee_polices.status', array_merge($status, ['active']));
// } else {
// $result->whereIn('employee_polices.status', $status);
// }
// // if($status == 'active'){
// // $result->where('employee_polices.tpa_id IS NOT NULL');
// // $result->where('employee_polices.uhid IS NOT NULL');
// // }else if($status == 'pending'){
// // $status = 'active';
// // $result->where('employee_polices.status', $status);
// // }else{
// // $result->where('employee_polices.status', $status);
// // }
// }
// if (!empty($emp_code)) {
// $result->where('emp.emp_code', $emp_code);
// }
// if (!empty($emp_name)) {
// $result->like('emp.name', $emp_name);
// }
// // Always check these conditions
// $result->where('employee_polices.is_active', 1)
// ->where('emp.is_active', 1);
// $res = $result->findAll();
// // dd($this->db->getLastQuery());
// return $res;
// } // remarks do not remove
public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "")
{
// dd($status);
@ -179,9 +319,11 @@ class EmployeePolicyModel extends Model
}
// Always check these conditions
$result->where('employee_polices.is_active', 1)
->where('emp.is_active', 1);
$result
->where('employee_polices.is_active', 1)
->where('emp.is_active', 1)
->where('employee_polices.status !=', 'inactive');
$res = $result->findAll();
// dd($this->db->getLastQuery());

View File

@ -0,0 +1,55 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class LeadFilesModel extends Model
{
protected $table = 'lead_files';
protected $primaryKey = 'id';
protected $allowedFields = [
'id',
'lead_id',
'docs_name',
'file_name',
'created_by',
'updated_by',
'created_at',
'updated_at',
'is_active'
];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
}

View File

@ -87,6 +87,12 @@ class LeadsModel extends Model
'lead_form_type',
'custom_fields',
'source_policy_start_date',
'source_policy_end_date',
'payment_date',
'is_cd'
];

View File

@ -79,6 +79,7 @@ class PolicyTransactionModel extends Model
'cd_ac_pk',
'install_due_date',
'policy_with_corr',
'is_cd_reduce_from_bds',
];
@ -783,6 +784,19 @@ class PolicyTransactionModel extends Model
->join('user_profiles AS service_user', 'policy_transaction.serviced_by = service_user.id', 'left')
->where('policy_transaction.is_active', 1)
->where('pt_co_share_details.is_active', 1);
if (
(!in_array(get_role_id(), [1, 5])) &&
!(
in_array(MANAGEMENT_TEAM_ID, user_team()) ||
in_array(FINANCE_TEAM_ID, user_team()) ||
in_array(BUSINESS_TEAM_ID, user_team())
)
) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$builder->where('policy_transaction.created_by', get_session_userid());
}
}
// Check if the start date and end date are provided
if ($start_date != 0 && $end_date != 0 && $date_type != 0 && $date_type != 'statement_month') {
@ -973,6 +987,19 @@ class PolicyTransactionModel extends Model
->where('policy_transaction.is_active', 1)
->where('policy_transaction.action_type', 'inception');
if (
(!in_array(get_role_id(), [1, 5])) &&
!(
in_array(MANAGEMENT_TEAM_ID, user_team()) ||
in_array(FINANCE_TEAM_ID, user_team()) ||
in_array(BUSINESS_TEAM_ID, user_team())
)
) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$builder->where('policy_transaction.created_by', get_session_userid());
}
}
// Optimize Date Filtering
if (!empty($start_date) && !empty($end_date) && !empty($date_type)) {
$builder->where("policy_transaction.$date_type >=", date('Y-m-d 00:00:00', strtotime($start_date)))
@ -1034,6 +1061,19 @@ class PolicyTransactionModel extends Model
->where('policy_transaction.is_active', 1)
->where('policy_transaction.action_type !=', 'inception');
if (
(!in_array(get_role_id(), [1, 5])) &&
!(
in_array(MANAGEMENT_TEAM_ID, user_team()) ||
in_array(FINANCE_TEAM_ID, user_team()) ||
in_array(BUSINESS_TEAM_ID, user_team())
)
) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$builder->where('policy_transaction.created_by', get_session_userid());
}
}
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {

View File

@ -68,6 +68,7 @@ class RFQModel extends Model
tpa_branch.branch_name as tpa_branch_name,
policy_type.policy_type,
rfq.json,
rfq.registration_json
')
->join('leads', 'rfq.lead_id = leads.id')
->join('policy_type', 'leads.policy_type_id = policy_type.id')

View File

@ -12,7 +12,7 @@ class TicketHistoryModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['id','field_name','display_name','old_value',
protected $allowedFields = ['id', "ticket_id", 'field_name','display_name','old_value',
'new_value','created_by','created_at','updated_by','updated_at','is_active'];
// Callbacks

View File

@ -15,6 +15,7 @@ class TicketMasterModel extends Model
protected $allowedFields = [
'id',
'ticket_type_id',
'feedback_json',
'claim_status_id',
'acm_id',
'insurer_id',
@ -689,6 +690,7 @@ class TicketMasterModel extends Model
$query = $this->select('ticket_master.*, tms.mail_subject as subject')
->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left')
->where('ticket_master.is_active', 1)
->where('tms.sender', "user")
->where('ticket_master.emp_id', $emp_id);
if (!empty($ticket_id)) {

View File

@ -134,5 +134,20 @@ class UserModel extends Model
->getResultArray();
}
public function getexclusiveUserListForRFQ(){
$data = $this->db->table('user_profiles')
->select('user_profiles.*,user_teams.team_id')
->select('roles.role as user_role')
->join('roles', 'roles.id = user_profiles.role')
->join('user_teams', 'user_teams.user_id = user_profiles.id')
->get()
->getResultArray();
// dd($data);
return $data;
}
}
?>

View File

@ -139,40 +139,41 @@
<style>
body {
.multiselect-native-select {
position: relative;
/* bottom: 32px; */
select {
border: 0 !important;
clip: rect(0 0 0 0) !important;
height: 1px !important;
margin: -1px -1px -1px -3px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
width: 1px !important;
left: 50%;
top: 30px;
body {
.multiselect-native-select {
position: relative;
/* bottom: 32px; */
select {
border: 0 !important;
clip: rect(0 0 0 0) !important;
height: 1px !important;
margin: -1px -1px -1px -3px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
width: 1px !important;
left: 50%;
top: 30px;
}
}
.multiselect-container{
width: 100% !important;
}
.multiselect-selected-text{
float: left !important;
}
}
}
.multiselect-container{
width: 100% !important;
}
.multiselect-selected-text{
float: left !important;
}
}
.navtab-bg .nav-link {
margin: 0 5px 10px!important;
}
.navtab-bg .nav-link {
margin: 0 5px 10px!important;
}
</style>
<?php if(in_array(get_role_id(), [1,2,3,5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<div class="row" id="client_add" style="margin-top: -32px;">
<div class="col-12">
@ -188,21 +189,25 @@ body {
<br>
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#pending-actions-dash-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active" id="pending_actions_tab">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">Pending Actions</span>
</a>
</li>
<li class="nav-item">
<a href="#enrollment-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="enrollemnt_tab">
<span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">Enrolment</span>
</a>
</li>
<?php if(in_array(get_role_id(), [1,2,3,5])) { ?>
<?php if(get_role_id() == 1 || get_role_id() == 5 && (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li class="nav-item">
<a href="#pending-actions-dash-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active" id="pending_actions_tab">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">Pending Actions</span>
</a>
</li>
<li class="nav-item">
<a href="#enrollment-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="enrollemnt_tab">
<span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">Enrolment</span>
</a>
</li>
<?php } ?>
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<li class="nav-item">
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab">
@ -215,15 +220,23 @@ body {
</ul>
<div class="tab-content">
<?php include('endorsement_dash.php'); ?>
<?php include('bds_dash.php'); ?>
<?php include('enrollment_dash.php'); ?>
<?php if(in_array(get_role_id(), [1,2,3,5])) { ?>
<?php include('endorsement_dash.php'); ?>
<?php include('enrollment_dash.php'); ?>
<?php } ?>
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<?php include('bds_dash.php'); ?>
<?php } ?>
</div>
</div>
<!-- </div> -->
</div>
</div>
<?php } ?>

View File

@ -90,6 +90,17 @@
&nbsp;
<?php } ?>
<?php } else if ($file['status'] == 'in-progress-partially') { ?>
<?php echo $file['status']; ?>
<?php if (!is_json_string($file['error_data'])) { ?>
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top" title="<?= $file['error_data'] ?>"></a>
&nbsp;
<?php } ?>
<?php } else if ($file['status'] == 'failed-1') { ?>
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
@ -146,7 +157,7 @@
onclick="getBatchFileData(this)" class="dropdown-item upload_button" ><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
<?php } ?>
<?php if (str_starts_with($file['status'], 'failed')) { ?>
<?php if ($file['actions'] == "import") { ?>
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<?php } ?>

View File

@ -125,7 +125,12 @@ body{
}
</style>
<div class="tab-pane fade" id="bds-dash-tab" style="padding-right: 35px;">
<?php if((get_role_id() == 4 ) && (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<?php $add_active_calss = "active show" ?>
<?php } ?>
<div class="tab-pane <?= isset($add_active_calss) ? $add_active_calss : 'fade' ?>" id="bds-dash-tab" style="padding-right: 35px;">
<div class="StatusTileHide" style="display: none; position: relative; bottom: 15px;">
<a href="#" onclick="hide_status_show_pending_tile()" >show all pending Tile</a>

View File

@ -41,7 +41,7 @@
origin: "mobile", // origin
emp_code:"HTL-007",
client_id:159,
client_branch_id:125
client_branch_id:126
}
};

View File

@ -71,13 +71,10 @@ $(document).ready(function(){
$('#client_rm_edit').hide()
$('#account_manager').multiselect({
nonSelectedText: 'Select Account Manager',
enableFiltering: false,
enableCaseInsensitiveFiltering: false,
includeSelectAllOption : false,
buttonWidth:'100%'
});
$('#account_manager').prop('disabled', true);
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
var data = <?= isset($client_relation) ? json_encode($client_relation) : '[]' ?>;
@ -94,10 +91,16 @@ $(document).ready(function(){
}
});
$('#account_manager').multiselect('refresh');
$('#account_manager').select2({
placeholder: "Select Account Manager",
}).prop('disabled', true);
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
$('#head').prop('disabled', true);
$('#manager').prop('disabled', true);
$('#account_manager').multiselect('disable');
}
@ -172,14 +175,25 @@ $(document).ready(function(){
$('#manager').prop('disabled', !isDisabled);
if (isDisabled) {
$('#account_manager').multiselect('enable');
$('#account_manager').select2({
placeholder: "Select Account Manager",
}).prop('disabled', false);
$('#client_rm_btnSubmit').show();
$(this).html('<span id="rm_icons" class="fa fa-times-circle"></span> Close Edit ');
} else {
$('#account_manager').multiselect('disable');
$('#account_manager').select2({
placeholder: "Select Account Manager"
}).prop('disabled', true);
$('#client_rm_btnSubmit').hide();
$(this).html('<span id="rm_icons" class="mdi mdi-lead-pencil"></span> Edit ');
}
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
});

View File

@ -80,7 +80,17 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<!-- srinivas -->
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
<script src="https://editor.unlayer.com/embed.js"></script>
<!-- MD5 Hash Start -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
<!-- MD5 Hash End -->
<!-- <script src="<?= base_url('public/unlayer/js/embed.js') . '' ?>"></script> -->
<!-- srinivas -->
<style>
@ -514,10 +524,9 @@
</div>
<!-- end Topbar -->
<!-- ========== Left Sidebar Start ========== -->
<!-- ========== Left Sidebar Start ========== -->
<div class="left-side-menu">
<!-- LOGO -->
<div class="logo-box">
<a href="<?= base_url('/dashboard/view') ?>" class="logo logo-dark text-center">
@ -542,7 +551,6 @@
</div>
<div class="h-100" data-simplebar>
<!--- Sidemenu -->
<div id="sidebar-menu">
<ul id="side-menu">
@ -554,41 +562,48 @@
</a>
</li>
<li>
<a href="<?= base_url('/client/list') ?>">
<i class="mdi mdi-domain"></i>
<span> Clients </span>
</a>
</li>
<!-- client -->
<?php if (in_array(get_role_id(), [1,2,3,5])) { ?>
<li>
<a href="<?= base_url('/client/list') ?>">
<i class="mdi mdi-domain"></i>
<span> Clients </span>
</a>
</li>
<?php } ?>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="fas fa-user-tie"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Action on Policies </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<!-- Enrollment process -->
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(ENROLLMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="fas fa-user-tie"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Action on Policies </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/employee/upload') ?>">View Inception</a>
</li>
<li>
<a href="<?= base_url('/employee/list') ?>">View Members</a>
</li>
<li>
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
</li>
<li>
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrolment</a>
</li>
<li>
<a href="<?= base_url('/employee/test_members_list') ?>">Test Members List</a>
</li>
</ul>
</div>
</li>
<li>
<a href="<?= base_url('/employee/upload') ?>">View Inception</a>
</li>
<li>
<a href="<?= base_url('/employee/list') ?>">View Members</a>
</li>
<li>
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
</li>
<li>
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrolment</a>
</li>
<li>
<a href="<?= base_url('/employee/test_members_list') ?>">Test Members List</a>
</li>
</ul>
</div>
</li>
<?php } ?>
<!-- Masters -->
<?php if (get_role_id() == 1 || get_role_id() == 5) { ?>
<li>
@ -625,8 +640,8 @@
</li>
<?php } ?>
<!--
<li>
<!-- <li>
<?php
$sessionData = get_session_userdata();
$currentUrl = base_url();
@ -641,181 +656,201 @@
</a>
</li> -->
<li>
<a href="#sidebarDashboardsTicket" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-lifebuoy"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Claims </span>
</a>
<div class="collapse" id="sidebarDashboardsTicket">
<ul class="nav-second-level">
<li>
<a href="#" onclick="openTicketTypeAskModal()">New claim</a>
</li>
<li>
<a href="<?= base_url('/ticket/list') ?>">Claim List</a>
</li>
<li>
<a href="<?= base_url('/ticket/mail_template') ?>">Mail Template</a>
</li>
<li>
<a href="<?= base_url('/ticket/ticket_reports') ?>">Claim Reports</a>
</li>
</ul>
</div>
</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>
</ul>
</div>
</li>
<!-- Claims -->
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
<li>
<a href="#sidebarDashboardsTicket" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-lifebuoy"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Claims </span>
</a>
<div class="collapse" id="sidebarDashboardsTicket">
<ul class="nav-second-level">
<li>
<a href="#" onclick="openTicketTypeAskModal()">New claim</a>
</li>
<li>
<a href="<?= base_url('/ticket/list') ?>">Claim List</a>
</li>
<li>
<a href="<?= base_url('/ticket/mail_template') ?>">Mail Template</a>
</li>
<li>
<a href="<?= base_url('/ticket/ticket_reports') ?>">Claim Reports</a>
</li>
<li>
<a href="<?= base_url('/ticket/feedback-list') ?>">Claim Feedback List</a>
</li>
</ul>
</div>
</li>
<?php } ?>
<!-- leads -->
<li>
<a href="<?= base_url('/leads/list') ?>">
<i class="mdi mdi-chart-bar"></i>
<span> Leads </span>
</a>
</li>
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/leads/list') ?>">
<i class="mdi mdi-chart-bar"></i>
<span> Leads </span>
</a>
</li>
<?php } ?>
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<!-- BDS -->
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<li>
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Policy Transactions </span>
</a>
<div class="collapse" id="policyTransactions">
<ul class="nav-second-level">
<li>
<a href="#policyTransactionsSub" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<span>Policy Transactions</span>
</a>
<div class="collapse" id="policyTransactionsSub">
<ul>
<li>
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Policy Transactions </span>
</a>
<div class="collapse" id="policyTransactions">
<ul class="nav-second-level">
<li>
<a href="#policyTransactionsSub" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<span>Policy Transactions</span>
</a>
<div class="collapse" id="policyTransactionsSub">
<ul>
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<?php if (in_array(get_role_id(), [1,5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<?php } ?>
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i>
<span> Policy Reports </span>
</a>
<div class="collapse" id="policyReports">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
</li>
</ul>
</div>
</li>
<?php } ?>
<li>
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-timer-sand"></i>
<span> Policy Pending Actions </span>
</a>
<div class="collapse" id="policyPendingActions">
<ul class="nav-third-level">
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li>
<?php } ?>
<?php if (in_array(get_role_id(), [1,5]) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()) ) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i>
<span> Policy Reports </span>
</a>
<div class="collapse" id="policyReports">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php } ?>
<li>
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i>
<span> Masters </span>
</a>
<div class="collapse" id="policyMasters">
<ul class="nav-third-level">
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) )) { ?>
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-timer-sand"></i>
<span> Policy Pending Actions </span>
</a>
<div class="collapse" id="policyPendingActions">
<ul class="nav-third-level">
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li>
<?php } ?>
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php } ?>
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) )) { ?>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i>
<span> Masters </span>
</a>
<div class="collapse" id="policyMasters">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<?php } ?>
<li>
<a href="<?= base_url('/dmsSearch') ?>">
<i class="ri-book-open-line"></i>
<span> Documents</span>
</a>
</li>
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<li>
<a href="<?= base_url('/dmsSearch') ?>">
<i class="ri-book-open-line"></i>
<span> Documents</span>
</a>
</li>
<?php } ?>
</ul>
</div>
</li>
</div>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php } ?>
<!-- Ad -->
<?php if (in_array(get_role_id(), [1,2,3,5])) { ?>
<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>
</ul>
</div>
</li>
<?php } ?>
<?php } ?>
</ul>
</div>
<!-- End Sidebar -->
</div>
<!-- Sidebar -left -->
</ul>
</div>
<!-- End Sidebar -->
</div>
<!-- Sidebar -left -->
</div>
<!-- Left Sidebar End -->
<!-- Left Sidebar End -->
<!-- ============================================================== -->
<!-- Start Page Content here -->

View File

@ -162,6 +162,16 @@
</select>
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="source_policy_start_date">Source Policy Start Date<span class="text-danger"></span></label>
<input type="text" class="form-control readonly-select" id="source_policy_start_date" name="source_policy_start_date" readonly>
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="source_policy_end_date">Source Policy End Date<span class="text-danger"></span></label>
<input type="text" class="form-control" id="source_policy_end_date" name="source_policy_end_date" readonly>
</div>
<div class="form-group col-md-3">
<label for="pan">PAN<span class="text-danger"></span></label>
<input type="text" class="form-control" id="pan" placeholder="Enter PAN Number"
@ -228,9 +238,9 @@
<div class="form-row">
<div class="form-group col-md-3">
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
<label for="salse_person_id">Salse Person<span class="text-danger">*</span></label>
<select class="form-control" id="salse_person_id" name="salse_person_id" multiple required>
<option value="">Select Sales Person</option>
<option value="">Select Salse Person</option>
<?php if (isset($salse_team)) { ?>
<?php foreach ($salse_team as $value) { ?>
<option value="<?= $value['id']; ?>">
@ -343,24 +353,24 @@
1); // Set end date to last day of selected year
policy_end_datePicker.setDate(policy_end_date);
console.log('this object', this);
console.log('id of this element:', this.element);
console.log('id of this element:', this.element.id);
// console.log('this object', this);
// console.log('id of this element:', this.element);
// console.log('id of this element:', this.element.id);
let increment = this.element.id.split('_').pop();
console.log(increment); // Outputs: 1
// let increment = this.element.id.split('_').pop();
// console.log(increment); // Outputs: 1
console.log('increment', increment);
console.log('policy_start_datePicker selectedDates', selectedDates);
console.log('policy_start_datePicker incurred_claim_date_', $(
"#incurred_claim_date_" + increment).val());
// console.log('increment', increment);
// console.log('policy_start_datePicker selectedDates', selectedDates);
// console.log('policy_start_datePicker incurred_claim_date_', $(
// "#incurred_claim_date_" + increment).val());
// Recalculate policy_run_days if incurred claim date is already selected
if ($("#incurred_claim_date_" + increment).val()) {
console.log('policy_start_datePicker selectedDates', selectedDates);
calculatePolicyRunDays(increment);
}
// if ($("#incurred_claim_date_" + increment).val()) {
// console.log('policy_start_datePicker selectedDates', selectedDates);
// calculatePolicyRunDays(increment);
// }
}
});
}
@ -369,6 +379,11 @@
dateFormat: "d/m/Y",
allowInput: false
});
document.getElementById('source_policy_start_date').readOnly = true;
document.getElementById('source_policy_end_date').readOnly = true;
$('#source_policy_start_date, #source_policy_end_date').addClass('readonly-select');
});
console.log('increment count for insurer and tpa ', increment);
@ -453,7 +468,7 @@
updateRenewalFields(dataIncrement);
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
let premium_date_id = 'premium_date_' + dataIncrement;
// let premium_date_id = 'premium_date_' + dataIncrement;
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
dateFormat: "d/m/Y",
@ -466,11 +481,7 @@
let increment = this.input.id.split('_').pop();
console.log('Extracted increment:', increment);
var policyStartDate = $("#policy_start_date_" + increment)
.length ?
$("#policy_start_date_" + increment) :
$("#policy_start_date");
var policyStartDate = $("#source_policy_start_date");
console.log('Selected Dates:', selectedDates);
console.log('policy start date instance', policyStartDate)
console.log('Policy Start Date:', policyStartDate.val());
@ -482,10 +493,10 @@
}
});
var premium_date_datepicker = flatpickr("#" + premium_date_id, {
dateFormat: "d/m/Y",
allowInput: false
});
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
// dateFormat: "d/m/Y",
// allowInput: false
// });
$('#proposed_insurer_' + dataIncrement).select2();
$('#proposed_tpa_' + dataIncrement).select2();
@ -651,6 +662,12 @@
if (res.status === true && res.data) {
console.log("res.data.source_policy_start_date", res.data.source_policy_start_date)
console.log("res.data.source_policy_end_date", res.data.source_policy_end_date)
$('#source_policy_start_date').val(res.data.source_policy_start_date);
$('#source_policy_end_date').val(res.data.source_policy_end_date);
for (let i = 1; i <= increment_count; i++) {
$(`#policy_type_id`).removeClass('readonly-select ').select2();
@ -682,6 +699,7 @@
$(`#proposed_tpa_${i}`).addClass('readonly-select ').select2('destroy');
}
} else {
console.warn('Invalid response:', res.message || 'Unknown error');
// Reset fields if response is invalid
@ -694,6 +712,7 @@
}
}
// Hide loader
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
@ -787,7 +806,7 @@
updateRenewalFields(dataIncrement);
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
let premium_date_id = 'premium_date_' + dataIncrement;
// let premium_date_id = 'premium_date_' + dataIncrement;
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
dateFormat: "d/m/Y",
@ -800,10 +819,7 @@
let increment = this.input.id.split('_').pop();
console.log('Extracted increment:', increment);
var policyStartDate = $("#policy_start_date_" + increment).length ?
$("#policy_start_date_" + increment) :
$("#policy_start_date");
var policyStartDate = $("#source_policy_start_date");
console.log('Selected Dates:', selectedDates);
console.log('policy start date instance', policyStartDate)
console.log('Policy Start Date:', policyStartDate.val());
@ -815,10 +831,10 @@
}
});
var premium_date_datepicker = flatpickr("#" + premium_date_id, {
dateFormat: "d/m/Y",
allowInput: false
});
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
// dateFormat: "d/m/Y",
// allowInput: false
// });
$('#proposed_insurer_' + dataIncrement).select2();
$('#proposed_tpa_' + dataIncrement).select2();
@ -917,12 +933,8 @@
<div id="appendArea_${increment}" class = "form-group col-md-12 appendArea"></div>
<div class="form-group col-md-3">
<label for="file_upload">File Upload<span class="text-danger"></span></label>
<input type="file" class="form-control" id="file_name_${increment}" name="file_name[]" accept=".xls,.xlsx">
<span class="text-danger" id="file_name_display"></span>
</div>
<div id="multiFileAppendArea_${increment}"></div>
<div class="form-group col-md-12 btnDiv" style="position: relative;top: 28px;float: right;text-align: end;">
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(1)">+</a>
@ -931,6 +943,8 @@
container.appendChild(newRow);
//append mutli file html
addFileField(increment);
var lead_type = $('#lead_type').val();
leadTypeBsedHideAndShow(lead_type)
@ -970,16 +984,16 @@
console.log(increment); // Outputs: 1
console.log('increment', increment);
console.log('policy_start_datePicker selectedDates', selectedDates);
console.log('policy_start_datePicker incurred_claim_date_', $("#incurred_claim_date_" +
increment).val());
// console.log('increment', increment);
// console.log('policy_start_datePicker selectedDates', selectedDates);
// console.log('policy_start_datePicker incurred_claim_date_', $("#incurred_claim_date_" +
// increment).val());
// Recalculate policy_run_days if incurred claim date is already selected
if ($("#incurred_claim_date_" + increment).val()) {
console.log('policy_start_datePicker selectedDates', selectedDates);
calculatePolicyRunDays(increment);
}
// if ($("#incurred_claim_date_" + increment).val()) {
// console.log('policy_start_datePicker selectedDates', selectedDates);
// calculatePolicyRunDays(increment);
// }
}
});
}
@ -1053,10 +1067,7 @@
console.log('calculatePolicyRunDays function called');
console.log('increment', increment);
var policyStartDate = $("#policy_start_date_" + increment).length ?
$("#policy_start_date_" + increment) :
$("#policy_start_date");
var policyStartDate = $("#source_policy_start_date");
var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y");
var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y");
@ -1064,9 +1075,9 @@
console.log('incurredClaimDate', incurredClaimDate)
if (policyStartDate && incurredClaimDate) {
var timeDiff = incurredClaimDate - policyStartDate; // Time difference in milliseconds
var timeDiff = Math.abs(policyStartDate - incurredClaimDate); // Time difference in milliseconds
console.log('timeDiff', timeDiff);
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); // Convert to days and add 1
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1); // Convert to days and add 1
console.log('daysDiff', daysDiff);
$("#policy_run_days_" + increment).val(daysDiff); // Set value in the policy_run_days_ input
}
@ -1106,7 +1117,8 @@
// ------------------------------------------------------------------------------------------
// Prevent division by zero in incurred claim ratio calculation
let incurred_claim_ratio = annualised_claims > 0 ? incurred_claims / annualised_claims : 0;
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
let incurred_claim_ratio = annualised_claims > 0 ? annualised_claims / premium_as_on_date : 0;
let incurred_claim_ratio_roundoff = Math.round(incurred_claim_ratio);
console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff);
@ -1118,7 +1130,7 @@
console.log('earned_premium', earned_premium);
// Prevent division by zero in earned claims ratio calculation
let earned_claims_ratio = earned_premium > 0 ? incurred_claims / earned_premium : 0;
let earned_claims_ratio = earned_premium > 0 ? annualised_claims / earned_premium : 0;
let earned_claims_ration_roundoff = Math.round(earned_claims_ratio);
console.log('earned_claims_ratio', earned_claims_ratio);
@ -1130,6 +1142,8 @@
let increment = input.id.split('_').pop(); // Extract the increment part
console.log('increment', increment);
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
// Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
let premium_at_inception = Number($('#premium_at_inception_' + increment).val()) || 0;
console.log('premium_at_inception', premium_at_inception);
@ -1138,13 +1152,76 @@
console.log('policy_run_days', policy_run_days);
// Prevent division by zero and calculate earned premium
let earned_premium = policy_run_days > 0 ? premium_at_inception / policy_run_days : 0;
let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * 364 : 0;
console.log('earned_premium', earned_premium);
let earned_premium_roundoff = Math.round(earned_premium);
// Set the calculated value with two decimal places
$('#earned_premium_' + increment).val(earned_premium_roundoff);
}
$(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() {
calculateTotalLives(this);
});
function calculateTotalLives(input) {
var lead_type = $('#lead_type').val();
if (lead_type == 1) {
let formRow = input.closest('.form-row');
if (formRow) {
// Get the employee count and dependent count within the same row
let empCountInput = formRow.querySelector('[name="incept_emp_count[]"]');
let depCountInput = formRow.querySelector('[name="incept_dept_count[]"]');
let totalLivesInput = formRow.querySelector('[name="incept_no_of_lives[]"]');
// Parse the input values as integers, defaulting to 0 if empty
let empCount = empCountInput ? parseInt(empCountInput.value) || 0 : 0;
let depCount = depCountInput ? parseInt(depCountInput.value) || 0 : 0;
// Calculate total lives
let totalLives = empCount + depCount;
// Set the total lives input value
if (totalLivesInput) {
totalLivesInput.value = totalLives;
}
}
} else {
console.log("Function Called");
if (input.id === "incept_emp_count" || input.id === "incept_dept_count") {
var incept_emp_count = parseInt($("#incept_emp_count").val()) || 0;
var incept_dept_count = parseInt($("#incept_dept_count").val()) || 0;
var totalCount = incept_emp_count + incept_dept_count;
$("#incept_no_of_lives").val(totalCount);
} else if (input.id === "renewal_emp_count" || input.id === "renewal_dept_count") {
var renewal_emp_count = parseInt($("#renewal_emp_count").val()) || 0;
var renewal_dept_count = parseInt($("#renewal_dept_count").val()) || 0;
var totalCount = renewal_emp_count + renewal_dept_count;
$("#renewal_no_of_lives").val(totalCount);
} else {
var exp_emp_count = parseInt($("#exp_emp_count").val()) || 0;
var exp_dept_count = parseInt($("#exp_dept_count").val()) || 0;
var totalCount = exp_emp_count + exp_dept_count;
$("#exp_no_of_lives").val(totalCount);
}
}
}
//------------------------ FORM SUBMIT ---------------------------------------------------------------------------------
$("#leads_form_id").submit(function(event) {
@ -1452,7 +1529,7 @@
$('.freshFields').find('select, input').attr('required', 'required');
$('.freshFields').show();
$('.proposed_div').hide().find('select, input').removeAttr('required');
// $('.proposed_div').hide().find('select, input').removeAttr('required');
if (resetValues) {
@ -1486,11 +1563,15 @@
$('.renewalFields').show();
$('.renewalFields').find('select, input').attr('required', 'required');
$('.proposed_div').show().find('select, input').attr('required', 'required');
// $('.proposed_div').show().find('select, input').attr('required', 'required');
$('#policy_end_date').removeAttr('required');
$('#policy_start_date').removeAttr('required');
$('#claims').removeAttr('required');
$('#source_policy_start_date').attr('readonly', 'readonly');
$('#source_policy_end_date').attr('readonly', 'readonly');
console.log('readonly set', $('#source_policy_start_date').prop('readonly')); // should print true
if (resetValues) {
@ -1540,4 +1621,8 @@
}
});
}
//-----------------------------------------------------------------------------------------------------------
</script>

View File

@ -85,6 +85,9 @@ if (isset($selected_lead_type)) {
var policy_list = ''; // local variable for storing the client policy list
var temp_client_id = 0;
var temp_branch_id = 0;
var selected_lead_form_type = <?= isset($selected_lead_type) ? $selected_lead_type : 0 ?>;
var fileIndex = 1; // Initialize index
// select2 document ready
$(document).ready(function() {
@ -188,7 +191,9 @@ if (isset($selected_lead_type)) {
}
function appendRenewalPolicies(data) {
console.log('appendRenewalPolicies', data);
console.log('selected_lead_form_type', selected_lead_form_type);
$('#source_policy_id').empty();
@ -196,16 +201,27 @@ if (isset($selected_lead_type)) {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
let shouldAppend = false;
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
if (selected_lead_form_type == 1) {
shouldAppend = (item.allocg !== "Non-EB" && item.allocg !== "Marine");
} else if (selected_lead_form_type == 2) {
shouldAppend = (item.allocg === "Non-EB" || item.allocg === "Marine");
} else {
shouldAppend = true;
}
$('#source_policy_id').append(option);
if (shouldAppend) {
const option = $('<option>', {
value: item.id,
text: item.policy_type + ' - ' + item.policy_no,
});
$('#source_policy_id').append(option);
}
});
}
//--------------------------------------------------------------------------------------------------------
@ -294,6 +310,146 @@ if (isset($selected_lead_type)) {
$('#salse_person_id').trigger('change');
}
function validateInput(input, table, field){
let value = $(input).val();
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
let message = "Value is duplicate!";
if(label){
message = label + " already exists!";
}
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
if (isDuplicate) {
toastr.warning(message, 'WARNING');
$(input).val('')
}
});
}
// --------------------------------------------------------------------------------------------------------
function addFileField(increment) {
console.log('addFileField function called');
const container = document.getElementById(`multiFileAppendArea_${increment}`);
if (!container) return;
const div = document.createElement("div");
div.className = "form-row d-flex align-items-end";
div.setAttribute("id", `fileField_${fileIndex}`);
let isFirstField = container.childElementCount === 0; // Check if it's the first field
let placeholder = isFirstField ? 'First file must be Demography.' : '';
let accept = isFirstField ? '.xls,.xlsx' : '';
if(selected_lead_form_type != 1){
placeholder = '';
accept = '';
}
div.innerHTML = `
<div class="form-group col-md-5">
<label>Document Name<span class="text-danger"></span></label>
<input type="text" class="form-control" name="docs_name_${increment}[]" placeholder="${placeholder}">
</div>
<div class="form-group col-md-5">
<label>File Upload<span class="text-danger"></span></label>
<input type="file" class="form-control" id="file_name_${fileIndex}" name="file_name_${increment}[]" accept="${accept}">
</div>
<div class="col-md-2" style="position: relative; bottom: 16px;">
<button type="button" class="btn btn-danger" onclick="removeFileField(${fileIndex})">x</button>
<button type="button" class="btn btn-primary" onclick="addFileField(${increment})">+</button>
</div>
`;
container.appendChild(div);
fileIndex++;
}
function removeFileField(index, lead_file_id = null) {
if(index == 1){
toastr.warning("You can't remove the first file field", 'WARNING');
return false;
}
if(lead_file_id != null) {
Swal.fire({
title: "Do you want to remove this file?",
// text: "Do you want Save this!",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, Procced!"
}).then((result) => {
if (result.isConfirmed) {
let url = '<?= base_url('util/removeMultiFile') ?>';
let requestData = {
lead_file_id: lead_file_id
};
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// Send AJAX request
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
if (response.status == true) {
toastr.success(response.message, 'SUCCESS');
//remove the file field
const field = document.getElementById(`fileField_${index}`);
if(index != 1){
if (field) field.remove();
}
} else {
toastr.error(response.message, 'WARNING');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, function(xhr, status, error) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
});
}else{
return false;
}
});
}else{
const field = document.getElementById(`fileField_${index}`);
if(index != 1){
if (field) field.remove();
}
}
}
function showFileName(input, index) {
if (input.files.length > 0) {
document.getElementById(`file_name_display_${index}`).textContent = input.files[0].name;
} else {
document.getElementById(`file_name_display_${index}`).textContent = "No file chosen";
}
}
</script>
@ -301,10 +457,11 @@ if (isset($selected_lead_type)) {
<?php if (isset($lead_edit_data)) { ?>
<script>
setTimeout(function(){
$(document).ready(async function () {
handleEbAndNonEbEdit(
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>);
}, 1000)
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>
);
});
function handleEbAndNonEbEdit(data){
if(data.lead_form_type == 1){
@ -316,10 +473,15 @@ if (isset($selected_lead_type)) {
function dynamicLeadsDataForEdit(data) {
try {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
console.log('########### THIS IS EB LEAD ###############')
console.log('Received data:', data);
let dataIncrement = 1;
fileIndex = data.lead_file_count + 1;
if (!data || typeof data !== 'object') {
console.error('Invalid data received for editing.');
@ -328,6 +490,7 @@ if (isset($selected_lead_type)) {
$('.btnDiv').hide();
$('#appendArea_' + dataIncrement).empty();
if (data.html) {
$('#appendArea_' + dataIncrement).append(data.html);
@ -335,6 +498,15 @@ if (isset($selected_lead_type)) {
console.warn('HTML content missing in data.');
}
if (data.multi_file_html && data.multi_file_html != '') {
$('#multiFileAppendArea_' + dataIncrement).empty();
setTimeout(function(){
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
}, 2000)
} else {
console.warn('MULTI FILE HTML content missing in data.');
}
let policy_type_id = data.policy_type_id || null;
let lead_type = data.lead_type || null;
@ -345,6 +517,10 @@ if (isset($selected_lead_type)) {
leadTypeBsedHideAndShow(lead_type);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
if (lead_type == 1) {
$('.claim-row').hide();
} else {
@ -356,10 +532,10 @@ if (isset($selected_lead_type)) {
$('.gpaClaimFileds').hide();
$('.lifeClaimFields').show();
} else {
updateRenewalFields(dataIncrement);
// updateRenewalFields(dataIncrement);
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
let premium_date_id = 'premium_date_' + dataIncrement;
// let premium_date_id = 'premium_date_' + dataIncrement;
if ($('#' + incurred_claim_date_id).length) {
flatpickr("#" + incurred_claim_date_id, {
@ -368,10 +544,7 @@ if (isset($selected_lead_type)) {
onChange: function (selectedDates) {
try {
let increment = this.input.id.split('_').pop();
let policyStartDate = $("#policy_start_date_" + increment).length
? $("#policy_start_date_" + increment)
: $("#policy_start_date");
let policyStartDate = $("#source_policy_start_date");
if (policyStartDate.val()) {
calculatePolicyRunDays(increment);
}
@ -384,15 +557,16 @@ if (isset($selected_lead_type)) {
console.warn(`Incurred claim date field #${incurred_claim_date_id} not found.`);
}
if ($('#' + premium_date_id).length) {
flatpickr("#" + premium_date_id, {
dateFormat: "d/m/Y",
allowInput: false
});
} else {
console.warn(`Premium date field #${premium_date_id} not found.`);
}
// if ($('#' + premium_date_id).length) {
// flatpickr("#" + premium_date_id, {
// dateFormat: "d/m/Y",
// allowInput: false
// });
// } else {
// console.warn(`Premium date field #${premium_date_id} not found.`);
// }
// console.log($('#proposed_insurer_' + dataIncrement).length);
$('#proposed_insurer_' + dataIncrement).select2();
$('#proposed_tpa_' + dataIncrement).select2();
}
@ -418,6 +592,8 @@ if (isset($selected_lead_type)) {
$('#client_branch_id').val(data.client_branch_id || '').change();
setTimeout(() => {
$('#source_policy_id').val(data.source_policy_id || '');
$('#source_policy_end_date').val(data.source_policy_end_date || '');
$('#source_policy_start_date').val(data.source_policy_start_date || '');
$('#pan').val(data.pan || '');
$('#gst').val(data.gst || '');
$('#branch_name').val(data.branch_name || '');
@ -430,7 +606,7 @@ if (isset($selected_lead_type)) {
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
}, 1000);
}, 1000);
}, 5000);
let insurer = (data.insurer_branch_id && data.insurer_id)
? `${data.insurer_branch_id}-${data.insurer_id}`
@ -457,6 +633,8 @@ if (isset($selected_lead_type)) {
}
} catch (error) {
console.error('Error in dynamicLeadsDataForEdit function:', error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
}
@ -465,6 +643,7 @@ if (isset($selected_lead_type)) {
console.log('########### THIS IS NON EB LEAD ###############')
console.log('Received data:', data);
let dataIncrement = 1;
fileIndex = data.lead_file_count + 1;
if (!data || typeof data !== 'object') {
console.error('Invalid data received for editing.');
@ -472,6 +651,8 @@ if (isset($selected_lead_type)) {
}
$('#appendArea').empty();
$('#multiFileAppendArea_' + dataIncrement).empty();
if (data.html) {
$('#appendArea').append(data.html);
@ -479,6 +660,15 @@ if (isset($selected_lead_type)) {
console.warn('HTML content missing in data.');
}
if (data.multi_file_html) {
console.log(data.multi_file_html);
setTimeout(function(){
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
}, 2000)
} else {
console.warn('MULTI FILE HTML content missing in data.');
}
let policy_type_id = data.policy_type_id || null;
let lead_type = data.lead_type || null;

View File

@ -290,14 +290,18 @@ hr.solid {
<hr>
<div id="multiFileAppendArea_1"></div>
<hr>
<!-- other row -->
<div class="form-row">
<div class="form-group col-md-3">
<!-- <div class="form-group col-md-3">
<label for="file_upload">File Upload<span class="text-danger"></span></label>
<input type="file" class="form-control" id="file_name" name="file_name" accept=".xls,.xlsx">
<span class="text-danger" id="file_name_display"></span>
</div>
</div> -->
<div class="form-group col-md-3">
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
@ -370,6 +374,8 @@ $(document).ready(function(){
dateFormat: "d/m/Y",
allowInput: false
});
addFileField(1);
})
function getPolicyTypeFields(input) {

View File

@ -10,9 +10,9 @@
overflow-y: auto !important;
}
#editor-container {
width: 100%;
min-height: 600px;
}
width: 100%;
min-height: 600px;
}
.modal-dialog {
max-width: 90% !important;
@ -264,7 +264,7 @@
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="member_welcome_mail_editor_container" style="height: 600px;width:max-content"></div>
<div id="member_welcome_mail_editor_container" style="height: 600px"></div>
</div>
</div>
@ -360,7 +360,7 @@
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="member_reminder_mail_editor_container" style="height: 600px;width:max-content"></div>
<div id="member_reminder_mail_editor_container" style="height: 600px"></div>
</div>
</div>
@ -426,7 +426,7 @@
<select id="member_ecard_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?>
<?php if ($value) { ?>
<?php $valueChange = str_replace('_', ' ', $value);
$valueChange = ucwords($valueChange); ?>
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
@ -440,7 +440,7 @@
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="member_ecard_mail_editor_container" style="height: 600px;width:max-content"></div>
<div id="member_ecard_mail_editor_container" style="height: 600px"></div>
</div>
</div>
@ -542,7 +542,7 @@
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;"></div>
</div>
</div>
@ -615,7 +615,7 @@
<!-- Unlayer editor -->
<!-- <div class="form-row" id="rac_rate_dropdown"> -->
<div class="form-group col-md-12">
<div id="account_maneger_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
<div id="account_maneger_summary_mail_editor_container" style="height: 600px"></div>
</div>
<!-- </div> -->
<div class="form-group text-right m-b-0">
@ -702,7 +702,7 @@
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="client_hr_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
<div id="client_hr_summary_mail_editor_container" style="height: 600px"></div>
</div>
</div>

View File

@ -238,19 +238,19 @@
<script>
var totalSI;
var finalData = {};
console.log("policyName : ", $('#policyName').val());
// console.log("policyName : ", $('#policyName').val());
var policyName = $('#policyName').val();
const occupancyMaster = <?= json_encode($occupancy) ?>;
console.log("Occupancy : ", occupancyMaster);
// console.log("Occupancy : ", occupancyMaster);
var storedPolicyData = {};
storedPolicyData = JSON.parse(localStorage.getItem('policyData'));
$(document).ready(function() {
// resetAllform();
console.log("Stored date Found : ", typeof(storedPolicyData));
// console.log("Stored date Found : ", typeof(storedPolicyData));
if (!$.isEmptyObject(storedPolicyData)) {
// prepareDataForEdit(storedPolicyData);
} else {
console.log("inside else trying to open product sleection tab");
// console.log("inside else trying to open product sleection tab");
// const productSelectionTab = new bootstrap.Tab(document.getElementById);
const productSelectionTab = new bootstrap.Tab(document.getElementById('product-selection-tab'));
productSelectionTab.show();
@ -306,22 +306,22 @@
});
$('#productSelectionForm').submit(function(event) {
console.log("Submit function called");
// console.log("Submit function called");
event.preventDefault();
var isValid = $('#productSelectionForm').parsley().validate();
console.log('isValid', isValid)
// console.log('isValid', isValid)
if (!isValid) {
$('#productSelectionForm').find('input, select, textarea').each(function() {
if ($(this).parsley().isValid() === false && !$(this).val()) {
console.log('Empty field ID:', this.id);
// console.log('Empty field ID:', this.id);
}
});
console.log('Form is Empty', 'Warning');
// console.log('Form is Empty', 'Warning');
return;
}
productSelectionData = {};
// console.log("submit function is clicked");
// // console.log("submit function is clicked");
// event.preventDefault();
var formDataProductSelection = $("#productSelectionForm").serializeArray();
@ -340,14 +340,14 @@
policydetailsOpen();
}
console.log("form data product selection : ", productSelectionData);
// console.log("form data product selection : ", productSelectionData);
})
function policydetailsOpen() {
// PolicyTabOpened();
console.log("function is called");
// console.log("function is called");
// Use the ID for the Policy Details tab button.
// const policyDetailsTab = new bootstrap.Tab(document.getElementById('policy-details-tab'));
const policyDetailsTab = new bootstrap.Tab(document.getElementById('policy-details-tab'));
@ -361,15 +361,15 @@
var isValid = $('#policyRiskSplitUpForm').parsley().validate();
console.log('isValid', isValid);
// console.log('isValid', isValid);
if (!isValid) {
$('#policyRiskSplitUpForm').find('input, select, textarea').each(function() {
if ($(this).parsley().isValid() === false && !$(this).val()) {
console.log('Empty field ID:', this.id);
// console.log('Empty field ID:', this.id);
}
});
console.log('Form is Empty', 'Warning');
// console.log('Form is Empty', 'Warning');
return;
}
@ -393,7 +393,7 @@
value: $(`#lossIN3Years_${i}`).is(':checked') ? 'on' : 'off'
});
}
console.log("form from : ", formDataSplitUp);
// console.log("form from : ", formDataSplitUp);
if (productSelectionData.multipleProduct == 'on') {
let selectionType = productSelectionData.multilocation_type;
@ -413,11 +413,19 @@
toastr.error("Sum Insured Exceeds Allowed Limit", "ERROR");
return false;
}
console.log("Total SI: ", totalSI);
// console.log("Total SI: ", totalSI);
}else{
let InProcess = [...document.querySelectorAll('[id^="stockInProcess_"]')].map(el => Number(el.value) || 0);
let rawMaterial = [...document.querySelectorAll('[id^="rawMaterial_"]')].map(el => Number(el.value) || 0);
let findMaterial = [...document.querySelectorAll('[id^="finishedStock_"]')].map(el => Number(el.value) || 0);
totalSI = InProcess.reduce((acc, val) => acc + val, 0) +
rawMaterial.reduce((acc, val) => acc + val, 0) +
findMaterial.reduce((acc, val) => acc + val, 0);
}
}
console.log("Form is trying to submit : ", formDataSplitUp);
// console.log("Form is trying to submit : ", formDataSplitUp);
const groupData = [];
@ -454,7 +462,7 @@
policyRiskSplitUpData = groupData;
console.log("Grouped Data as Objects: ", policyRiskSplitUpData);
// console.log("Grouped Data as Objects: ", policyRiskSplitUpData);
savePolicyDataLocal();
});
@ -464,15 +472,15 @@
$("#policyRiskAddressForm").submit(function(event) {
event.preventDefault();
var isValid = $('#policyRiskAddressForm').parsley().validate();
console.log('isValid', isValid)
// console.log('isValid', isValid)
if (!isValid) {
$('#policyRiskAddressForm').find('input, select, textarea').each(function() {
if ($(this).parsley().isValid() === false && !$(this).val()) {
console.log('Empty field ID:', this.id);
// console.log('Empty field ID:', this.id);
}
});
console.log('Form is Empty', 'Warning');
// console.log('Form is Empty', 'Warning');
return;
}
const formData = $("#policyRiskAddressForm").serializeArray();
@ -505,7 +513,7 @@
});
policyRiskAddress = groupedData;
console.log("Grouped Data as Objects: ", policyRiskAddress);
// console.log("Grouped Data as Objects: ", policyRiskAddress);
if (productSelectionData.singleProduct == 'on') {
savePolicyDataLocal();
@ -518,25 +526,25 @@
event.preventDefault();
var isValid = $('#policyDetailsForm').parsley().validate();
console.log('isValid', isValid)
// console.log('isValid', isValid)
if (!isValid) {
$('#policyDetailsForm').find('input, select, textarea').each(function() {
if ($(this).parsley().isValid() === false && !$(this).val()) {
console.log('Empty field ID:', this.id);
// console.log('Empty field ID:', this.id);
}
});
console.log('Form is Empty', 'Warning');
// console.log('Form is Empty', 'Warning');
return;
}
var formData = $("#policyDetailsForm").serializeArray();
$.each(formData, function(i, field) {
policyDetailsData[field.name] = field.value;
});
// console.log("form data", policyDetailsData.location_no);
// // console.log("form data", policyDetailsData.location_no);
if (formData !== null && formData !== '') {
console.log("form submitted trying to open the ris info tab");
// console.log("form submitted trying to open the ris info tab");
// riskInfoTabOpened();
const riskTab = new bootstrap.Tab(document.getElementById('risk-info-tab'));
riskTab.show();
@ -567,11 +575,11 @@
}
} else if (e.target.id === 'risk-splitup-tab') {
contianertoCheck = document.getElementById("addRiskSplitUp");
console.log("policy det", policyRiskAddress.length)
// console.log("policy det", policyRiskAddress.length)
if (!$.isEmptyObject(policyRiskAddress)) {
if (increment2 == 1) {
policyRiskAddress.forEach(function() {
console.log("increment count is ", increment2)
// console.log("increment count is ", increment2)
addHTMLInputForRiskSplitUP();
validatePolicyBasedOnProductSelection();
hideAndShowBurglary();
@ -585,20 +593,20 @@
}
} else if (e.target.id === 'risk-info-tab') {
console.log("function called ");
// console.log("function called ");
contianertoCheck = document.getElementById("addRiskInfo");
// console.log("policy details data ", policyDetailsData);
// // console.log("policy details data ", policyDetailsData);
if (!$.isEmptyObject(policyDetailsData)) {
if (increment == 1) {
console.log("inside if ");
// console.log("inside if ");
addHTMLInputForRiskAddress();
$('select[id^="occupancy_"]').select2();
validatePolicyBasedOnProductSelection();
}
} else {
console.log("inside else ");
// console.log("inside else ");
if (contianertoCheck.innerHTML == "") {
addHTMLInputForRiskAddressWarninig();
@ -624,11 +632,11 @@
}
function addHTMLInputForRiskSplitUP() {
// console.log("Function called ", increment2, " times");
// // console.log("Function called ", increment2, " times");
const container = document.getElementById("addRiskSplitUp");
// container.innerHTML = '';
const newRowRisk = document.createElement("div");
// console.log("Risk Split Up for address : ", policyRiskAddress.length)
// // console.log("Risk Split Up for address : ", policyRiskAddress.length)
// policyRiskAddress
newRowRisk.innerHTML += `
@ -743,7 +751,7 @@
const container = document.getElementById('addRiskInfo');
// container.innerHTML = "";
const newRow = document.createElement('div');
// console.log("policy details ", policyDetailsData);
// // console.log("policy details ", policyDetailsData);
newRow.className = 'form-row dynamic-form-row mb-3';
newRow2 = document.createElement("div");
@ -882,8 +890,8 @@
$(document).on('click', '.duplicate-btn', function() {
console.log("button is clicked");
console.log("increment cout ", increment);
// console.log("button is clicked");
// console.log("increment cout ", increment);
if (policyDetailsData.location_no >= increment) {
@ -933,7 +941,7 @@
})
function addOrRemoveAdd() {
console.log("chceck box clicked");
// console.log("chceck box clicked");
if ($("#sameAsCommunicationAddress").is(":checked")) {
$("#pin_code_1").val(policyDetailsData.pin_code);
$("#address1_1").val(policyDetailsData.address1);
@ -952,7 +960,7 @@
if (selectedProduct.singleProduct == 'on') {
console.log("inside if ");
// console.log("inside if ");
$('[class*="single_location"]').show();
$("#locationNoDIV").hide();
$("#location_no").removeAttr("required", false);
@ -970,7 +978,7 @@
} else if (selectedProduct.multipleProduct == 'on') {
console.log("inside elseif");
// console.log("inside elseif");
$('[class*="single_location"]').hide().removeAttr('required');
// $('[class*="single_location_occupancy"]').hide().removeAttr('required');
$('[class*="multi_location_company"]').show();
@ -1002,28 +1010,28 @@
// alert(element);
var selectedOccupancy = $(`#${element}`).val();
var selectedOccupancyMasterRow = occupancyMaster.find(iib => iib.id == selectedOccupancy);
console.log("selected occupancy masater ", selectedOccupancyMasterRow)
console.log("selected occupancy masater ", occupancyMaster)
// console.log("selected occupancy masater ", selectedOccupancyMasterRow)
// console.log("selected occupancy masater ", occupancyMaster)
var iibCODE = selectedOccupancyMasterRow.iib_code;
console.log("selected occupancy masater ", iibCODE)
// console.log("selected occupancy masater ", iibCODE)
var elementID = element;
let increment = elementID.split("_").pop();
console.log("selected occupancy masater increment ", increment)
console.log("selected occupancy masater element ", $(`#iibCode_${increment}`))
// console.log("selected occupancy masater increment ", increment)
// console.log("selected occupancy masater element ", $(`#iibCode_${increment}`))
setTimeout(function() {
$(`#iibCode_${increment}`).val(iibCODE); // Set the value
console.log("Selected --------------------", $(`#iibCode_${increment}`).val()); // Log the value
// console.log("Selected --------------------", $(`#iibCode_${increment}`).val()); // Log the value
}, 1000);
}
console.log("onchange occupancy function called ");
// console.log("onchange occupancy function called ");
// console.log("onchange occupancy function called ", selectedOccupancy);
// console.log("onchange occupancy function called ", selectedOccupancyMasterRow);
// console.log("onchange occupancy function called ", iibCODE);
// console.log("onchange occupancy function called ", increment);
// // console.log("onchange occupancy function called ", selectedOccupancy);
// // console.log("onchange occupancy function called ", selectedOccupancyMasterRow);
// // console.log("onchange occupancy function called ", iibCODE);
// // console.log("onchange occupancy function called ", increment);
$('[class*="common_location_occupancy"]').show().prop("required", "required");
@ -1032,22 +1040,22 @@
$('[class*="single_location_occupancy"]').show().prop("required", "required");
} else if (selectedProduct.multipleProduct == 'on') {
// console.log("Muliple location");f
// // console.log("Muliple location");f
$('[class*="multiLocationOccupancy"]').show().prop('required', 'required');
if (selectedProduct.multilocation_type == "multiLocation") {
// console.log("multiple location without Floater");
// // console.log("multiple location without Floater");
$('[class*="multiLocationOccupancyWithoutFloater"]').show().prop('required', 'required');
} else if (selectedProduct.multilocation_type == "multiFloater") {
// console.log("Muliple location With Floater");
// // console.log("Muliple location With Floater");
$('[class*="multiLocationOccupancyWithoutFloater"]').hide().removeAttr('required', false);
} else if (selectedProduct.multilocation_type == "stockFloater") {
// console.log("multiple location with stock floater");
// // console.log("multiple location with stock floater");
$('[class*="multiLocationOccupancyWithoutFloater"]').show().prop('required', 'required');
$('[class*="stockSI"]').hide().removeAttr('required', false);
}
@ -1109,7 +1117,7 @@
// Ensure policyName is correctly retrieved
var policyName = $('#policyName').val();
if (!policyName) {
console.error("Policy name is undefined. Cannot save data.");
// console.error("Policy name is undefined. Cannot save data.");
return;
}
policyName = policyName.toLowerCase();
@ -1120,7 +1128,7 @@
localStorage.setItem('policyData', JSON.stringify(existingData));
if (!$.isEmptyObject(existingData)) {
console.log("DATA FROM DB : ", (existingData));
// console.log("DATA FROM DB : ", (existingData));
let data = (existingData);
Object.keys(data).forEach(key => {
@ -1128,8 +1136,12 @@
prependTable(policySummary[key],key);
});
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
toastr.success("Policy Information Collected ","SUCCESS");
console.log("Updated policy data in localStorage:", existingData);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
// console.log("Updated policy data in localStorage:", existingData);
}
function saveTODB(data, leadID) {
@ -1137,7 +1149,7 @@
var url = '<?= base_url('rfq/savePolicyInfo') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
console.log("trying to submit data : ", data, " with this lead id : ", leadID);
// console.log("trying to submit data : ", data, " with this lead id : ", leadID);
$.ajax({
url: url,
data: {
@ -1159,8 +1171,8 @@
error: function(xhr, status, error) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.error(xhr.responseText);
console.error(status, error);
// console.error(xhr.responseText);
// console.error(status, error);
}
})
}
@ -1184,14 +1196,14 @@
// alert("Data restored to original variables.");
} else {
console.log("No policy data found in local storage.");
// console.log("No policy data found in local storage.");
}
}
function prepareDataForEdit(data) {
// alert(policyName);
console.log("Prepare data : ",data);
// console.log("Prepare data : ",data);
if (policyName == "Fire") {
data = data.fire;
if (!data) {
@ -1211,7 +1223,7 @@
}else{
// alert("nothing");
}
console.log("policy data : ", data);
// console.log("policy data : ", data);
// Populate Product Selection
// Show first tab
@ -1229,7 +1241,7 @@
$('#singleProduct').prop('checked', data.productSelection.singleProduct === 'on');
$('#multipleProduct').prop('checked', data.productSelection.multipleProduct === 'on');
console.log($('#multipleProduct').is(":checked") ? "yes" : "no");
// console.log($('#multipleProduct').is(":checked") ? "yes" : "no");
$('#multipleProduct').is(":checked") ? $('#multilocation_type').show() : $('#multilocation_type').hide();
$('#multilocation_type').val(data.productSelection.multilocation_type);
$("#client_type").val(data.productSelection.client_type);
@ -1243,7 +1255,7 @@
const policyDetails = data.policyDetails;
Object.keys(policyDetails).forEach(key => {
$(`#${key}`).val(policyDetails[key]);
// console.log("Key ",key," set value : ",policyDetails[key]);
// // console.log("Key ",key," set value : ",policyDetails[key]);
});
// Populate Risk Addresses
@ -1320,18 +1332,19 @@
function assignLeadData() {
const lead_data = <?= json_encode(json_decode($lead_data['custom_fields'])) ?>;
var clientName = <?= isset($lead_data['client_name']) ? json_encode($lead_data['client_name']) : ""?>;
var client_type = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
var mobile = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
var email = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
var panNo = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
console.log("client_type : ".client_type);
// console.log("client_type : ".client_type);
if (lead_data) {
// lead_data = JSON.parse(lead_data);
console.log("Lead Data : ", typeof(lead_data));
// console.log("Lead Data : ", typeof(lead_data));
if (lead_data.risk_location == "Single") {
console.log("single ");
// console.log("single ");
$("#singleProduct").prop("checked", true).trigger("change");
} else if (lead_data.risk_location.startsWith("multi")) {
@ -1346,15 +1359,15 @@
}
$("#client_type").val(client_type).trigger("change");
$("#insured_name").val(insured_name);
$("#insured_name").val(clientName);
$("#address1").val(lead_data.address);
}
}
function hideAndShowBurglary() {
console.log("hide and show function called ");
// console.log("hide and show function called ");
policyName = $("#policyName").val();
console.log("hiding the other policy not ths : ", policyName);
// console.log("hiding the other policy not ths : ", policyName);
if (policyName == "Burglary") {
$('[class*="burglary"]').show();
$('[class*="fire"]').hide().removeAttr('required', false);
@ -1365,7 +1378,7 @@
}
function resetAllform() {
console.log("FORM RESETED SUCCESSFULLY");
// console.log("FORM RESETED SUCCESSFULLY");
$("#productSelectionForm")[0].reset();
$("#policyDetailsForm")[0].reset();
$("#policyRiskAddressForm")[0].reset();
@ -1398,7 +1411,7 @@
})
function copyFirePolicy() {
console.log("Copying Fire Policy Data...");
// console.log("Copying Fire Policy Data...");
storedPolicyData = JSON.parse(localStorage.getItem('policyData'));
if (storedPolicyData.fire) {

View File

@ -119,6 +119,7 @@
<input type="hidden" name="client_id" id="client_id_for_edit">
<input type="hidden" name="insurer_id" id="insurer_id">
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
<input type="hidden" name="ct_type" id="ct_type">
<input type="hidden" name="" id="bro_payable_by">
<input type="hidden" name="" id="cop_yes">
@ -310,6 +311,15 @@
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
</div>
<div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 32px;left: 20px;">
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD &nbsp;&nbsp; <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
</div>
</div>
<hr>
@ -585,6 +595,14 @@ $(document).ready(function(){
var cd_ac_no = $(this).find('option:selected').attr('data-cd');
var start_date = $(this).find('option:selected').attr('data-sd');
var end_date = $(this).find('option:selected').attr('data-ed');
var policy_type_id = $(this).find('option:selected').attr('data-ptid');
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
}else{
$('#is_cd_reduce_from_bds').prop('disabled',false)
}
// console.log('client_id', client_id);
// console.log('client_policy_id', client_policy_id);
@ -596,7 +614,7 @@ $(document).ready(function(){
$('#policy_no').val(policy_no);
$('#insurer_id').val(insurer);
$('#tpa').val(tpa).change();
$('#cd_ac_no').val(cd_ac_no);
// $('#cd_ac_no').val(cd_ac_no);
$('#policy_start_date').val(start_date);
$('#policy_end_date').val(end_date);
@ -619,6 +637,9 @@ $(document).ready(function(){
if(res.status == true){
if(res.data.length > 0){
$('#ct_type').val(2)
$('#cd_ac_pk').val(res.is_copay_yes.cd_ac_pk);
$('#cd_ac_no').val(res.cd_master_data.cd_ac_no ?? "");
$('#bro_payable_by').val(res.data[0].bro_payable_by)
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){
@ -633,9 +654,11 @@ $(document).ready(function(){
}else{
$('#ct_type').val(1)
addInsurerColumn()
}
}else{
$('#ct_type').val(1)
addInsurerColumn()
}
},
@ -914,6 +937,9 @@ function getPolicyTransactionDataForEndorsementEdit(input){
$('#last_action_date').val(res.data.last_action_date);
$('#install_due_date').val(res.data.install_due_date);
$('#bro_payable_by').val(res.data.bro_payable_by);
$('#cd_ac_pk').val(res.data.cd_ac_pk);
$('#cd_ac_no').val(res.data.cd_ac_no);
$('#ct_type').val(res.data.ct_type);
if (res.data.policy_with_corr == 1) {
$('#policy_with_corr').prop('checked', true);
@ -921,6 +947,12 @@ function getPolicyTransactionDataForEndorsementEdit(input){
$('#policy_with_corr').prop('checked', false);
}
if (res.data.is_cd_reduce_from_bds == 1) {
$('#is_cd_reduce_from_bds').prop('checked', true).prop('checked', false);
} else {
$('#is_cd_reduce_from_bds').prop('checked', false);
}
if (res.data.action_type == 'policy_instalment') {
$('.install_due_date_div').show()
}else{
@ -937,6 +969,13 @@ function getPolicyTransactionDataForEndorsementEdit(input){
addInsurerColumn();
}
if(res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7){
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false);
}else{
$('#is_cd_reduce_from_bds').prop('disabled',false);
}
}else{
console.log('No data found');
}
@ -1769,7 +1808,7 @@ function addInsurerColumn() {
break;
}
}else if(team_id.includes('3')){
}else if(team_id.includes('3') || team_id.includes('8')){
switch(index) {
case 0: // Insurer selection
@ -2155,7 +2194,7 @@ function populateTable(dataArray, status = false) {
cell.find('input[type="hidden"]').val(status ? data.id : '');
break;
}
}else if(team_id.includes('3')){
}else if(team_id.includes('3') || team_id.includes('8')){
switch (rowIndex) {
case 0: // Insurer selection
cell.find('select').val(insurer);

View File

@ -698,6 +698,7 @@ document.addEventListener("DOMContentLoaded", function () {
'data-itp' : item.itp,
'data-bap' : item.bap,
'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id,
'data-ptid' : item.policy_type_id,
});
$('#client_policy_id').append(option);
});

View File

@ -123,6 +123,12 @@
color: white !important;
margin-right: 5px;
}
:disabled {
background-color: #e0e0e0;
color: #666;
}
</style>
<div class="tab-pane fade active show" id="form">
@ -422,6 +428,16 @@
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
</div>
<div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 32px;left: 20px;">
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD &nbsp;&nbsp; <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
</label>
</div>
<!-- <div class="form-group col-md-3 current_date" style="display: none;">
<label for="bp_igst">Process Start Date</label>
<input id="process_start_date" type="text" class="form-control" name="process_start_date" placeholder="DD/MM/YYYY">
@ -1352,6 +1368,11 @@ $(document).ready(function(){
$('#tpa_div').show();
}
if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 6 || value == 7){
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
}else{
$('#is_cd_reduce_from_bds').prop('disabled',false)
}
});
@ -1527,6 +1548,12 @@ function getPolicyTransactionDataForEdit(input) {
$('#tpa_div').show();
}
if(policy_type_id_for_hide_tpa == 1 || policy_type_id_for_hide_tpa == 2 || policy_type_id_for_hide_tpa == 3 || policy_type_id_for_hide_tpa == 4 || policy_type_id_for_hide_tpa == 5 || policy_type_id_for_hide_tpa == 6 || policy_type_id_for_hide_tpa == 7){
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
}else{
$('#is_cd_reduce_from_bds').prop('disabled',false)
}
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
$('#hide_file_upload').show();
}else{
@ -1744,6 +1771,12 @@ function getPolicyTransactionDataForEdit(input) {
$('#policy_with_corr').prop('checked', false);
}
if (res.data.is_cd_reduce_from_bds == 1) {
$('#is_cd_reduce_from_bds').prop('checked', true).prop('checked', false);
} else {
$('#is_cd_reduce_from_bds').prop('checked', false);
}
} else {
console.log('No data found');
}
@ -3917,7 +3950,7 @@ function addInsurerColumn() {
}
}else if(team_id.includes('3')){
}else if(team_id.includes('3') || team_id.includes('8')){
switch(index) {
case 0: // Insurer selection
@ -4312,7 +4345,7 @@ function populateTable(dataArray, cd_ac_pk) {
cell.find('input[type="hidden"]').val(data.id);
break;
}
}else if(team_id.includes('3')){
}else if(team_id.includes('3') || team_id.includes('8')){
switch (rowIndex) {
case 0: // Insurer selection

View File

@ -0,0 +1,14 @@
<?php if (!empty($multi_file_data)) : ?>
<div class="form-group col-md-12">
<label>Select Files:</label>
<?php foreach ($multi_file_data as $file) : ?>
<div class="form-check">
<input type="checkbox" class="form-check-input multi_file_attachment" id="file_<?= $file['id'] ?>" name="selected_attachment_files[]" value="<?= $file['id'] ?>" checked>
<label class="form-check-label" for="file_<?= $file['id'] ?>">
<?= htmlspecialchars($file['docs_name']) ?> - <?= htmlspecialchars($file['file_name']) ?>
</label>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@ -1,80 +1,80 @@
<?php $increment = isset($lead_edit_data) ? "_1" : ''; ?>
<hr>
<div class="form-row renewalCalculation">
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger"></span></label>
<input value="<?= isset($lead_edit_data['incurred_claim_date']) ? $lead_edit_data['incurred_claim_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date"
<input value="<?= isset($lead_edit_data['incurred_claims_date']) ? $lead_edit_data['incurred_claims_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date<?= $increment ?>"
name="incurred_claim_date[]" placeholder="Enter DOE">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="paid_claims">Paid Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims" name="paid_claims[]"
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims<?= $increment ?>" name="paid_claims[]"
placeholder="Enter Paid Claims" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="outstanding_claims">Outstanding Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims" name="outstanding_claims[]"
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims<?= $increment ?>" name="outstanding_claims[]"
placeholder="Enter Outstanding Claims" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claims">Incurred Claim<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims" name="incurred_claims[]"
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims<?= $increment ?>" name="incurred_claims[]"
placeholder="Enter Incurred Claim" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days" name="policy_run_days[]"
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" name="policy_run_days[]"
placeholder="Enter Policy Run Days" oninput="earnedPremiumCalc(this)" onkeyup="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="premium_at_inception">Premium Paid at Inception<span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception" name="premium_at_inception[]"
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception<?= $increment ?>" name="premium_at_inception[]"
placeholder="Enter Premium Paid" oninput="earnedPremiumCalc(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="premium_date">Premium Date<span class="text-danger"></span></label>
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date" name="premium_date[]"
<label for="premium_date">Premium as on Date<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date<?= $increment ?>" name="premium_date[]"
placeholder="Enter Premium Date">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="earned_premium">Earned Premium<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium" name="earned_premium[]"
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium<?= $increment ?>" name="earned_premium[]"
placeholder="Enter Earned Premium" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims" name="annualised_claims[]"
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" name="annualised_claims[]"
placeholder="Enter Annualised Claims">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claims_ratio">Incurred Claims Ratio<span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio"
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio<?= $increment ?>"
name="incurred_claims_ratio[]" placeholder="Enter Incurred Claims Ratio">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="earned_claims_ratio">Earned Claims Ratio<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio" name="earned_claims_ratio[]"
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio<?= $increment ?>" name="earned_claims_ratio[]"
placeholder="Enter Earned Claims Ratio">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<!-- <div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="location">Location <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
</div>
<input value="<?php //echo isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
</div> -->
<div class="form-group col-md-3 proposed_div" style="display: none;">
<label for="proposed_insurer">Proposed Insurer <span class="text-danger"></span></label>
@ -116,14 +116,14 @@
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]"
placeholder="Enter Lives" required>
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
</div>
<div class="form-group col-md-3">
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_dept_count']) ? $lead_edit_data['incept_dept_count'] : '' ?>" type="text" class="form-control" id="incept_dept_count" name="incept_dept_count[]"
placeholder="Enter Lives" required>
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
</div>
<div class="form-group col-md-3">

View File

@ -0,0 +1,50 @@
<?php
$fileIndex = 1; // Initialize index
$increment = 1; // Example increment value
?>
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
$isFirstField = ($index === 0); // First file must be Demography
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
$accept = $isFirstField ? '.xls,.xlsx' : '';
$index = $index + 1;
?>
<div class="form-row d-flex align-items-end" id="fileField_<?= $index ?>">
<input type="hidden" name="leads_file_id[]"
value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $index ?>">
<!-- Document Name Input -->
<div class="form-group col-md-5">
<label>Document Name<span class="text-danger"></span></label>
<input type="text" class="form-control" name="docs_name_<?= $increment ?>[]"
placeholder="<?= $placeholder ?>"
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $index ?>">
</div>
<!-- File Upload Input -->
<div class="form-group col-md-5">
<label>
File Upload
<span class="text-danger"></span><br>
<small id="file_name_display_<?= $index ?>" class="text-muted">
<?= !empty($value['file_name']) ? htmlspecialchars($value['file_name']) : 'No file chosen' ?>
</small>
</label>
<input type="file" class="form-control" id="file_name_<?= $index ?>"
name="file_name_<?= $increment ?>[]" accept="<?= $accept ?>"
onchange="showFileName(this, <?= $index ?>)">
</div>
<!-- Add/Remove Buttons -->
<div class="col-md-2" style="position: relative; bottom: 16px;">
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $index ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
<button type="button" class="btn btn-primary" onclick="addFileField(<?= $increment ?>)">+</button>
</div>
</div>
<?php } } ?>

View File

@ -49,7 +49,7 @@
<div class="row">
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['user_name'] ?></div>
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message['user_name'] ?? "Auto Mail" ?></div>
</div>
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-primary">Staff</span>

View File

@ -0,0 +1,837 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg">
<title>Nhance Experience Form</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/parsleyjs@2.9.2/dist/parsley.min.js"></script>
<style>
.navbar-custom {
top: -10px !important;
height: 61px !important;
/* background-color: #02a8b5;
*/
background-color: #02a8b5;
}
.logo-box {
top: -10px !important;
height: 50px !important;
}
body {
background-color: #f0f0f0;
font-family: 'Roboto', sans-serif;
}
.nhance-form-card {
max-width: 740px;
margin: 32px auto;
background: #fff;
border-radius: 30px;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
padding: 32px 24px;
}
.nhance-form-card-details {
max-width: 740px;
margin: 20px auto;
/* Reduced vertical margin */
background: #fff;
border-radius: 20px;
/* Slightly smaller radius */
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
padding: 20px 16px;
/* Reduced padding */
}
/* Adjust form group spacing */
.nhance-form-card-details .form-group {
margin-bottom: 12px;
/* Reduced spacing between rows */
}
/* Compact label styling */
.nhance-form-card-details label {
font-size: 14px;
/* Smaller font size */
margin-bottom: 0;
}
/* Compact input styling */
.nhance-form-card-details .form-control-plaintext {
font-size: 14px;
/* Smaller font size */
padding-top: 4px !important;
padding-bottom: 4px !important;
}
/* Adjust grid columns spacing */
.nhance-form-card-details .col-md-4 {
padding-right: 8px;
}
.nhance-form-card-details .col-md-8 {
padding-left: 8px;
}
.nhance-form-header {
font-size: 32px;
font-weight: 400;
color: #202124;
margin-bottom: 8px;
}
.nhance-form-subtitle {
font-size: 14px;
color: #5f6368;
margin-bottom: 24px;
}
.divider {
border-top: 1px solid #dadce0;
margin: 24px 0;
}
.form-group {
margin-bottom: 24px;
}
label {
font-size: 16px;
font-weight: 400;
color: #202124;
display: block;
}
.form-control {
height: 48px;
border: 1px solid #dadce0;
border-radius: 4px;
padding: 12px 14px;
font-size: 14px;
color: #202124;
transition: border-color 0.2s;
}
.form-control:focus {
border-color: #1a73e8;
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
outline: none;
}
textarea.form-control {
height: auto;
min-height: 100px;
resize: vertical;
}
.required-asterisk {
color: #d93025;
margin-left: 4px;
}
.btn-nhance {
background-color: #1a73e8;
color: white;
border-radius: 4px;
padding: 12px 24px;
border: none;
font-size: 14px;
font-weight: 500;
letter-spacing: 0.25px;
text-transform: uppercase;
transition: background-color 0.2s, box-shadow 0.2s;
}
.btn-nhance:hover {
background-color: #1557b0;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.half-framed-textbox {
position: relative;
margin: 20px 0;
}
.border-animation {
position: absolute;
bottom: -2px;
/* Align with input bottom */
height: 2px;
background: #6200ea;
width: 0;
transition: width 0.3s ease;
}
.col-md-9 {
position: relative;
/* Contain the animation within the input column */
}
.half-framed-textbox input {
width: 100%;
padding: 8px;
font-size: 16px;
outline: none;
background: transparent;
position: relative;
text-align: left !important;
height: auto !important;
/* padding-left: 0 !important; */
/* padding-bottom: 0 !important; */
}
.half-framed-textbox .form-control {
border: none !important;
border-bottom: 2px solid #dadce0 !important;
box-shadow: none !important;
text-align: left !important;
height: auto !important;
height: auto !important;
padding-top: 18px !important;
padding-bottom: 0px !important;
line-height: 1.5 !important;
margin-bottom: 21px;
/* padding-left: 0 !important; */
/* padding-bottom: 0 !important; */
}
.form-control {
height: auto !important;
min-height: 48px;
}
.navbar-custom {
position: fixed;
top: 0;
width: 100%;
height: 61px;
background-color: #02a8b5;
display: flex;
align-items: center;
/* Center vertically */
justify-content: space-between;
/* Align logo and header properly */
padding: 0 20px;
/* Add some spacing */
z-index: 1000;
/* Ensure it stays above other content */
}
.logo-box img {
margin-top: auto;
height: 35px;
}
main {
flex: 1;
}
.feedback-header {
flex-grow: 1;
/* Allow it to take remaining space */
text-align: center;
font-size: 18px;
font-weight: bold;
color: white;
font-size: 32px;
font-weight: 400;
margin-top: auto;
font-family: 'sans-serif', serif;
}
</style>
<style>
.swal-modal {
background-color: white;
width: 80%;
max-width: 400px;
padding: 30px;
border-radius: 10px;
text-align: center;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}
.swal-title {
color: #595959;
font-size: 24px;
margin: 0 0 10px 0;
}
.swal-text {
color: #545454;
font-size: 16px;
margin: 15px 0;
}
.swal-icon {
width: 80px;
height: 80px;
border-radius: 50%;
margin: 0 auto 20px;
background-color: #a5dc86;
display: flex;
align-items: center;
justify-content: center;
animation: scaleIn 0.4s ease-out;
}
.swal-icon::after {
content: '';
display: block;
width: 30px;
height: 50px;
border: solid white;
border-width: 0 4px 4px 0;
transform: rotate(45deg);
margin-top: -8px;
}
@keyframes scaleIn {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
@media (max-width: 480px) {
.swal-modal {
width: 90%;
padding: 20px;
}
}
</style>
<!-- Style for Loader -->
<style>
.loader-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #00000069;
z-index: 99999;
}
.loader {
position: absolute;
left: 50%;
top: 50%;
width: 50px;
height: 50px;
font-size: 0;
color: #00c9d0;
display: inline-block;
margin: -25px 0 0 -25px;
text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
.loader div {
background-color: #6ad9cf;
display: inline-block;
float: none;
position: absolute;
top: 0;
left: 0;
width: 50px;
height: 50px;
opacity: .5;
border-radius: 50%;
-webkit-animation: ballPulseDouble 2s ease-in-out infinite;
animation: ballPulseDouble 2s ease-in-out infinite;
}
.loader div:last-child {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
</style>
<style>
.parsley-required{
color: red !important;
}
.swal-icon-error {
background-color: #f27474;
}
.swal-icon-error::before,
.swal-icon-error::after {
content: '';
position: absolute;
width: 40px;
height: 4px;
background-color: white;
}
.swal-icon-error::before {
transform: rotate(45deg);
}
.swal-icon-error::after {
transform: rotate(-45deg);
}
.swal-button-error {
background-color: #dc3545;
}
.swal-button-error:hover {
background-color: #bb2d3b;
}
</style>
</head>
<body>
<!-- Topbar Start -->
<div class="navbar-custom">
<div class="logo-box d-flex align-items-center">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="Logo">
</div>
<div class="feedback-header">
Nhance Experience Form
</div>
</div>
<!-- end Topbar -->
<input type="hidden" id="ticket_id" value="<?= $ticket_id ?>">
<input type="hidden" id="login_type" value="<?= $viewer ?>">
<input type="hidden" id="form_submission_state" value="<?= $form_submitted ?>">
<!-- <div class="nhance-form-card">
<div class="nhance-form-header">Nhance Experience Form</div>
<div class="nhance-form-subtitle">Fill in the details to enhance your experience</div>
</div> -->
<form id="feedbackForm" data-parsley-validate>
<div class="nhance-form-card-details" style="margin-top : 70px;">
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="email" class="mb-0 mr-2">Email &nbsp; </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : "" ?>" class="form-control-plaintext" id="email" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="name">Your name </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : "" ?>" class="form-control-plaintext" id="name" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="client_name">Your Employer </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : "" ?>" class="form-control-plaintext" id="client_name" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center ">
<div class="col-md-4">
<label for="emp_code">Your Employer ID </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : "" ?>" class="form-control-plaintext" id="emp_code" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="claim_number">Your Claim ID</label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : "" ?>" class="form-control-plaintext" id="claim_number" readonly>
</div>
</div>
</div>
<div class="nhance-form-card">
<div class="form-group">
<label for="satisfaction_level">Your satisfaction level with Nhance in explanation of the claims settlement process<span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="highly_satisfied" required data-parsley-errors-container="#responsiveness-error">
<label class="form-check-label" for="highly_satisfied">
Highly satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="satisfied" required>
<label class="form-check-label" for="satisfied">
Satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="neutral" required>
<label class="form-check-label" for="neutral">
Neutral
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="dissatisfied" required>
<label class="form-check-label" for="dissatisfied">
Dissatisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="highly_dissatisfied" required>
<label class="form-check-label" for="highly_dissatisfied">
Highly dissatisfied
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">Your satisfaction level with Nhance responsiveness & professionalism throughout the process<span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error_1"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="highly_satisfied_1" required data-parsley-errors-container="#responsiveness-error_1">
<label class="form-check-label" for="highly_satisfied_1">
Highly satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="satisfied_1" required>
<label class="form-check-label" for="satisfied_1">
Satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="neutral_1" required>
<label class="form-check-label" for="neutral_1">
Neutral
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="dissatisfied_1" required>
<label class="form-check-label" for="dissatisfied_1">
Dissatisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="highly_dissatisfied_1" required>
<label class="form-check-label" for="highly_dissatisfied_1">
Highly dissatisfied
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">How satisfied were you with the time taken for Claim settlement? <span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error_2"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_were_you_with_the_time_taken_for_claim_settlement" id="claim_was_settled_on_time" required data-parsley-errors-container="#responsiveness-error_2">
<label class="form-check-label" for="claim_was_settled_on_time">
Claim was settled on time
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_were_you_with_the_time_taken_for_claim_settlement" id="claim_settlement_took_longer_than_expected">
<label class="form-check-label required" for="claim_settlement_took_longer_than_expected">
Claim settlement took longer than expected
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">How satisfied are you with the Policy's terms and coverage<span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error_3"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="highly_satisfied_2" required data-parsley-errors-container="#responsiveness-error_3">
<label class="form-check-label" for="highly_satisfied_2">
Highly satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="satisfied_2" required>
<label class="form-check-label" for="satisfied_2">
Satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="neutral_2" required>
<label class="form-check-label" for="neutral_2">
Neutral
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="dissatisfied_2" required>
<label class="form-check-label" for="dissatisfied_2">
Dissatisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="highly_dissatisfied_2" required>
<label class="form-check-label" for="highly_dissatisfied_2">
Highly dissatisfied
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">Would you recommend us? <span class="text-danger">*</span></label>
<div class="error-container" id="responsiveness-error_4"></div>
<div class="form-check">
<input class="form-check-input" type="radio" id="absolutely" name="would_you_recommend_us" required data-parsley-errors-container="#responsiveness-error_4">
<label class="form-check-label" for="absolutely">
Absolutely!
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="would_you_recommend_us" id="maybe_depends_on_improvements" required>
<label class="form-check-label" for="maybe_depends_on_improvements">
May be, depends on improvements.
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="would_you_recommend_us" id="no" required>
<label class="form-check-label" for="no">
No
</label>
</div>
</div>
<div class="form-group half-framed-textbox">
<label for="feedback"> Tell us how we can do better!</label>
<input type="text" class="form-control" id="feedback" name="feedback">
</div>
</div>
<div class="d-flex justify-content-center mt-3">
<button type="submit" id="feedbackFormSubmitButton" class="btn-nhance">Submit</button>
</div>
</form>
<div id="formSuccessPage">
</div>
<!-- Loader start -->
<div class="loader-mask">
<div class="loader">
<img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
</div>
</div>
<!-- Loader end -->
<footer class="text-center py-3 mt-auto" style="background-color: #f8f9fa; color: #5f6368;">
<p class="mb-0">© 2025 Nhance India Pvt Ltd. All Rights Reserved.</p>
</footer>
<script>
$(document).ready(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
var form_submitted_state = $("#form_submission_state").val();
var login_type = $("#login_type").val();
if (form_submitted_state == 1 && login_type != 1) {
$("#feedbackForm").hide();
const container = document.getElementById("formSuccessPage");
container.innerHTML = `
<div class = "nhance-form-card" style="margin-top : 70px;">
<div class="swal-icon"></div>
<h2 class="swal-title d-flex justify-content-center">Success!</h2>
<div class="swal-text d-flex justify-content-center">Your Feedback has been Received Successfully.</div>
</div>
`;
} else if (form_submitted_state == 1 && login_type == 1) {
$("#feedbackFormSubmitButton").hide();
var formData = <?= !empty($ticket_data['feedback_json']) ? $ticket_data['feedback_json'] : '{}' ?>;
console.log("Form data received : ", formData);
var feedbackText = formData.feedback;
$("#feedback").val(feedbackText).prop("readonly", true);
delete formData.feedback;
Object.values(formData).forEach((data, key) => {
console.log("key : ", data);
if (data.length > 1) {
$(`#${data}`).prop("checked", true);
}
})
} else if (form_submitted_state == 0 && login_type == 1) {
$("#feedbackForm").hide();
const container = document.getElementById("formSuccessPage");
container.innerHTML = `
<div class="nhance-form-card" style="margin-top: 70px;">
<div class="swal-icon swal-icon-error"></div>
<h2 class="swal-title d-flex justify-content-center">Error!</h2>
<div class="swal-text d-flex justify-content-center" id="errorMessage">User has not Submitted the Feedback Yet</div>
</div>
`;
}
})
$("#feedbackForm").submit(function(event) {
event.preventDefault();
if (!$(this).parsley().isValid()) {
return;
}
formData = $("#feedbackForm").serializeArray();
var would_you_recommend_us_id = $("[name='would_you_recommend_us']:checked").attr("id") || "";
var how_satisfied_are_you_with_the_policys_terms_and_coverage_id = $("[name='how_satisfied_are_you_with_the_policys_terms_and_coverage']:checked").attr("id") || "";
var how_satisfied_were_you_with_the_time_taken_for_claim_settlement_id = $("[name='how_satisfied_were_you_with_the_time_taken_for_claim_settlement']:checked").attr("id") || "";
var your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process_id = $("[name='your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process']:checked").attr("id") || "";
var your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process_id = $("[name='your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process']:checked").attr("id") || "";
formData.push({
name: "your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process",
value: your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process_id
});
formData.push({
name: "would_you_recommend_us",
value: would_you_recommend_us_id
});
formData.push({
name: "your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process",
value: your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process_id
});
formData.push({
name: "how_satisfied_were_you_with_the_time_taken_for_claim_settlement",
value: how_satisfied_were_you_with_the_time_taken_for_claim_settlement_id
});
formData.push({
name: "how_satisfied_are_you_with_the_policys_terms_and_coverage",
value: how_satisfied_are_you_with_the_policys_terms_and_coverage_id
});
var data = filterFormData(formData);
var ticket_id = $("#ticket_id").val();
console.log("Form Data : ", data);
console.log("Form Dataticket_id : ", ticket_id);
var url = "<?= base_url('claims-feedback-form') ?>" + `/${ticket_id}`;
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: url,
data: data,
type: 'POST',
success: function(response) {
if (response.status) {
console.log("Success:", response);
} else {
console.log("Failure");
}
location.reload(true);
},
error: function(xhr, status, error) {
console.error("AJAX Error:", error);
}
})
$("#feedbackForm")[0].reset();
});
function filterFormData(data) {
return data.filter(entry => entry.value !== "on");
}
</script>
</body>
</html>

View File

@ -0,0 +1,148 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
.addbtnStyle {
margin-left: 20px !important;
}
</style>
<style>
.table th:nth-child(1),
.table td:nth-child(1) {
max-width: 200px !important;
min-width: 100px !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
</style>
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Claim Feedback List </h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>Claim Number</th>
<th>Emp Code</th>
<th>Emp name</th>
<th>Corporate name</th>
</tr>
</thead>
<tbody>
<?php if (isset($feedback_data)) { ?>
<?php foreach($feedback_data as $data){ ?>
<tr onclick="viewFeedbackForm(<?php echo $data['id']; ?>)">
<td><?php echo $data['claim_number']; ?></td>
<td><?php echo $data['emp_code']; ?></td>
<td><?php echo $data['emp_name']; ?></td>
<td><?php echo $data['client_name']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<!-------------------------------------------------------------------------------------------------->
<script>
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Claim-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'claim-List',
exportOptions: {
orthogonal: 'sort'
},
},
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
});
} else {
console.error("Table atet found.");
}
});
function viewFeedbackForm(ticket_id){
console.log("Ticket ID : ",ticket_id);
var md5Hash_ticket_id = md5(ticket_id);
console.log("MD5 Ticket ID : ",md5Hash_ticket_id);
// alert(md5Hash);
feedbackPage = `<?= base_url("claims-feedback-form/") ?>${md5Hash_ticket_id}/1`
// window.location.href = feedbackPage;
window.open(feedbackPage, "_blank");
}
</script>

View File

@ -20,8 +20,9 @@
<td><?php echo $row['display_name']; ?></td>
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
<!-- <td><?php //echo $row['new_value']; ?></td> -->
<td><?php echo $row['modified_by']; ?></td>
<td><?php echo $row['created_at']; ?></td>
<td><?php echo !empty($row['modified_by'])? $row['modified_by'] : "Created by employee"; ?></td>
<!-- <td><?php //echo $row['created_at']; ?></td> -->
<td><?php echo date("d-m-Y H:i:s a", strtotime($row['created_at'])) ?? " - "; ?></td>
</tr>
<?php } ?>
<?php } ?>

View File

@ -35,6 +35,10 @@ table.dataTable tbody td {
white-space: nowrap !important;
}
#scroll-horizontal-datatable tbody tr:hover {
background-color: #e0e0e0;
}
</style>
@ -57,6 +61,7 @@ table.dataTable tbody td {
<th>Policy Type</th>
<th>Claim number</th>
<th>TPA ID</th>
<th>Emp ID</th>
<th>Emp name</th>
<th>Insured Name</th>
<th>Corporate name</th>
@ -66,7 +71,7 @@ table.dataTable tbody td {
<tbody>
<?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?>
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
<tr onclick="viewTicket(<?php echo $row['id']; ?>)" style="cursor: pointer;">
<td data-toggle="tooltip" data-placement="top"
@ -109,7 +114,8 @@ table.dataTable tbody td {
<td><?php echo str_replace("Claim-", "", $ticket_type[$row['ticket_type_id']] ?? ""); ?></td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['tpa_no']; ?></td>
<td><?php echo $row['emp_code']; ?></td>
<td><?php echo $row['emp_name']; ?></td>
<td><?php echo $row['insured_name']; ?></td>
<td><?php echo $row['short_name']; ?></td>
@ -184,8 +190,12 @@ $(document).ready(function() {
function viewTicket(ticket_id){
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id
window.location.href = url
}
</script>

View File

@ -225,12 +225,18 @@
<button id="addQuote" class="btn btn-custom">Add New Proposal</button>
<button id="submitData" class="btn btn-primary">Save RFQ</button>
<button id="submitQCRData" onclick="checkTheTableDataChanged(5)" class="btn btn-primary">Procced to QCR</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php if (in_array(get_role_id(), [1,2,5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team())) { ?>
<button id="submitQCRData" onclick="checkTheTableDataChanged(5)" class="btn btn-primary">Procced to QCR</button>
<?php } ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a id="submitExcel" onclick="checkTheTableDataChanged(2)" class="btn btn-primary" id>Export Excel</a>
<button id="submitInternalMail" class="btn btn-primary" onclick="checkTheTableDataChanged(4)">Send Internal Mail</button>
<button id="submitMail" class="btn btn-primary" onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
<?php if (get_role_id() == 1 || in_array($user_team,[6,7])) { ?>
<button id="submitMail" class="btn btn-primary"
onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
<?php } ?>
<button id="submitPlacement" class="btn btn-primary" onclick="checkTheTableDataChanged(6)">Placement</button>
<input type="hidden" id="lead_id" name="lead_id" value="<?= isset($lead_id) ? $lead_id : '' ?>">
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
<input type="hidden" id="qcr_count" value="<?= isset($qcr_count) ? $qcr_count : 0 ?>">
<!-- <button id="openDialogBtn">Open Dialog</button> -->
@ -371,6 +377,16 @@
<div class="form-row" id="input_for_row">
</div>
</div>
<br>
<h4>Attachments Files</h4>
<hr>
<div class="form-group" id="insurer_or_clinet_mail_attachment">
<div class="form-row" >
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
</div>
</div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
@ -392,47 +408,61 @@
<div class="modal-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label for="to">To </label>
<select class="form-control" id="to" name="to" required>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<option value="<?= $user['email'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<div class="form-group col-md-4">
<label for="to">To </label>
<select class="form-control" id="to" name="to" required>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<option value="<?= $user['email'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-4">
<label for="cc">CC </label>
<select class="form-control" id="cc" name="cc" required multiple>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-12">
<label for="subject">Subject</label>
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
</div>
<div class="form-group col-md-12">
<label for="internal_mail_content">Mail Content</label>
<textarea id="internal_mail_content" class="form-control" name="internal_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea>
</div>
<?php } ?>
</select>
</div>
<div class="form-group col-md-4">
<label for="cc">CC </label>
<select class="form-control" id="cc" name="cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-12">
<label for="subject">Subject</label>
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
</div>
<div class="form-group col-md-12">
<label for="internal_mail_content">Mail Content</label>
<textarea id="internal_mail_content" class="form-control" name="internal_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea>
</div>
</div>
</div>
<br>
<br>
<h4>Attachments Files</h4>
<hr>
<div class="form-group" id="internal_mail_attachment">
<div class="form-row" >
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
</div>
</div>
<br>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
</div>
@ -461,30 +491,45 @@
<div class="form-row">
<div class="form-group col-md-3">
<label for="payment_date">Payment Date</label>
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>">
</div>
<div class="form-group col-md-3">
<label for="utr_no">UTR No.</label>
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No.">
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
</div>
<div class="form-group col-md-3">
<label for="placement_date">Placement Date</label>
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY">
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>">
</div>
<div class="form-group col-md-3">
<label style = "padding-left: 15px;padding-top: 33px;" for="is_cd_switch">CD </label>
<input id="is_cd_switch" type="checkbox" name = "is_cd" value = "1" data-toggle="toggle" data-on="With CD" data-off="Without CD" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="150" <?= isset($lead_data['is_cd']) && $lead_data['is_cd'] != 1 ? '' : 'checked' ?>
>
</div>
<div class="form-group col-md-3">
<label for="premium_amount">Premium Amount</label>
<input type="text" class="form-control" id="premium_amount" name="premium_amount" placeholder="Enter Premium Amount">
<input type="text" class="form-control" id="premium_amount" name="premium_amount" placeholder="Enter Premium Amount" value="<?= isset($lead_data['premium_amount']) ? $lead_data['premium_amount'] : "" ?>">
</div>
<?php if (isset($lead_data['is_cd']) && $lead_data['is_cd'] == 1 || !isset($lead_data['is_cd'])) { ?>
<div class="form-group col-md-3">
<label for="cd_amount">CD Amount</label>
<input type="text" class="form-control" id="cd_amount" name="cd_amount" placeholder="Enter CD Amount" value="<?= isset($lead_data['cd_amount']) ? $lead_data['cd_amount'] : "" ?>">
</div>
<div class="form-group col-md-3">
<label for="total_amount">Total Amount</label>
<input type="text" class="form-control" id="total_amount" name="total_amount" placeholder="Enter Total Amount">
<input type="text" class="form-control" id="total_amount" name="total_amount" placeholder="Enter Total Amount" value="<?= isset($lead_data['cd_amount']) ? $lead_data['cd_amount'] : "" ?>">
</div>
<div class="form-group col-md-3">
<label for="cd_amount">CD Amount</label>
<input type="text" class="form-control" id="cd_amount" name="cd_amount" placeholder="Enter CD Amount">
</div>
<?php } ?>
</div>
<hr>
@ -507,12 +552,15 @@
<div class="form-group col-md-6">
<label for="placement_cc">CC </label>
<select class="form-control" id="placement_cc" name="placement_cc" required multiple>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if (isset($exclusiveUserList)) { ?>
>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } }?>
<?php } ?>
</select>
</div>
@ -533,6 +581,16 @@
</div>
<br>
<h4>Attachments Files</h4>
<hr>
<div class="form-group" id="placement_mail_attachment">
<div class="form-row" >
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
</div>
</div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
</div>
@ -555,6 +613,7 @@
var premium_data_check = false;
var user_role_id = <?= get_role_id(); ?>;
var jsonDataForHide = null;
var multi_file_data = [];
const editorConfig = {
buttons: [
@ -593,7 +652,8 @@
console.log('Type:', type);
let titile_client_name = "<?= isset($lead_data) ? $lead_data['client_name'] : '' ?>";
multi_file_data = <?= isset($multi_file_data) ? json_encode($multi_file_data) : '[]' ?>;
appendMultiFileData(multi_file_data)
RFQ_or_QCR = type;
var type_for_url = 1;
@ -762,6 +822,11 @@
allowInput: false,
});
var payment_date_datePicker = flatpickr("#payment_date", {
dateFormat: "d/m/Y",
allowInput: false,
});
})
@ -769,6 +834,13 @@
<script>
$(document).ready(function () {
setInterval(function () {
submitData(1);
}, 15000);
});
const openDialogBtn = document.getElementById('openDialogBtn');
const closeDialogBtn = document.getElementById('closeDialogBtn');
@ -795,6 +867,24 @@ var over_all_column_data = {
'insurers': []
}
};
document.addEventListener('DOMContentLoaded', function () {
const textarea = document.getElementById('placement_mail_content');
const textarea2 = document.getElementById("placement_subject");
if (textarea) {
let content = textarea.value;
if (content.includes('QCR')) {
textarea.value = content.replace(/QCR/g, 'Placement');
}
}
if (textarea2){
let content = textarea2.value;
if (content.includes('QCR')) {
textarea2.value = content.replace(/QCR/g, 'Placement');
}
}
});
// document.addEventListener("DOMContentLoaded", function () {
const rfqTable = document.getElementById('rfqTable');
@ -1248,19 +1338,34 @@ function moveAddRowButton() {
rfqTable.addEventListener('click', function(e) {
if (e.target.classList.contains('removeRow')) {
const row = e.target.closest('tr'); // Get the row to be removed
const rowKey = row.getAttribute('id');
Swal.fire({
title: 'Are you sure?',
text: "Do you want to remove the row?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, remove it!',
cancelButtonText: 'Cancel'
}).then((result) => {
if (result.isConfirmed) {
const row = e.target.closest('tr'); // Get the row to be removed
const rowKey = row.getAttribute('id');
console.log(suggestionKeys);
// Remove the key from suggestionKeys
suggestionKeys = suggestionKeys.filter(key => key !== rowKey);
row.remove();
console.log(suggestionKeys);
updateRowNumbers(); // Update row numbers
moveAddRowButton(); // Move the add row button to the last row
realignSpecialConditions();
console.log(suggestionKeys);
// Remove the key from suggestionKeys
suggestionKeys = suggestionKeys.filter(key => key !== rowKey);
row.remove();
console.log(suggestionKeys);
updateRowNumbers(); // Update row numbers
moveAddRowButton(); // Move the add row button to the last row
realignSpecialConditions();
isFormDataModified = true; // if any value changeing in the table to set true
isFormDataModified = true; // if any value changeing in the table to set true
}
})
}
});
@ -1406,7 +1511,6 @@ function showSuggestions(input) {
// Function to handle answers suggestion box
function showAnswersSuggestions(input) {
console.log(input.parentElement.id);
console.log(input);
//return;
@ -2107,7 +2211,17 @@ function removeProposal(event) {
let rfqTable = document.getElementById('rfqTable');
console.log(rfqTable)
if (confirm("Are you sure you want to remove this column?")) {
Swal.fire({
title: 'Are you sure?',
text: "Do you want to remove the Proposal?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, remove it!',
cancelButtonText: 'Cancel'
}).then((result) => {
if (result.isConfirmed) {
const headerRows = rfqTable.querySelectorAll('thead tr');
const parentTh = headerRows[0].children[colIndex];
@ -2152,69 +2266,83 @@ function removeProposal(event) {
console.log(`${proposal_name} does not exist.`);
}
}
})
}
function removeInsurer(event) {
if (confirm("Are you sure you want to remove this column?")) {
// function removeSubColumnByIndex(tableId, subThIndex) {
const table = document.getElementById('rfqTable');
const headerRows = table.querySelectorAll('thead tr');
Swal.fire({
title: 'Are you sure?',
text: "Do you want to remove the insurer?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, remove it!',
cancelButtonText: 'Cancel'
}).then((result) => {
if (result.isConfirmed) {
// function removeSubColumnByIndex(tableId, subThIndex) {
const table = document.getElementById('rfqTable');
const headerRows = table.querySelectorAll('thead tr');
const closestTh = event.target.closest('th');
let insurerName = closestTh.innerText.split('⋮')[0]
// alert(insurerName);return;
let subThIndex = closestTh.cellIndex;
console.log('subThIndex', subThIndex);
const closestTh = event.target.closest('th');
let insurerName = closestTh.innerText.split('⋮')[0]
// alert(insurerName);return;
let subThIndex = closestTh.cellIndex;
console.log('subThIndex', subThIndex);
// Get the sub TH from the second header row
const subTh = headerRows[1].children[subThIndex];
console.log('subTh', subTh);
// Get the sub TH from the second header row
const subTh = headerRows[1].children[subThIndex];
console.log('subTh', subTh);
let accumulatedColspan = 0;
let parentTh = null;
const firstHeaderRow = headerRows[0];
// Find the parent TH for the specified sub TH index
for (let i = 0; i < firstHeaderRow.children.length; i++) {
const currentParentTh = firstHeaderRow.children[i];
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
let accumulatedColspan = 0;
let parentTh = null;
const firstHeaderRow = headerRows[0];
// Find the parent TH for the specified sub TH index
for (let i = 0; i < firstHeaderRow.children.length; i++) {
const currentParentTh = firstHeaderRow.children[i];
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
accumulatedColspan += currentColspan;
accumulatedColspan += currentColspan;
if (subThIndex < accumulatedColspan) {
parentTh = currentParentTh;
break;
if (subThIndex < accumulatedColspan) {
parentTh = currentParentTh;
break;
}
}
console.log('parentth' + parentTh);
console.log('sub col indexOf' + subThIndex);
// Get the starting position of the sub TH
const startIndex = Array.from(headerRows[1].children).indexOf(subTh);
// Remove the sub TH
headerRows[1].removeChild(subTh);
// Reduce colspan of parent TH
const parentColspan = parseInt(parentTh.getAttribute('colspan')) || 1;
console.log('existing colspan' + parentColspan);
parentTh.setAttribute('colspan', parentColspan - 1);
console.log('new colspan' + (parentColspan - 1));
// Remove the corresponding TDs from each row
table.querySelectorAll('tbody tr').forEach(row => {
row.removeChild(row.children[startIndex]);
});
removeInsurerFromPremiumTable(event, subThIndex)
//remove the insurer from gobal array
let proposal_name = parentTh.innerText.split('⋮')[0];
popInsurerInArray(proposal_name, insurerName);
isFormDataModified = true; // if any value changeing in the table to set true
}
}
console.log('parentth' + parentTh);
console.log('sub col indexOf' + subThIndex);
// Get the starting position of the sub TH
const startIndex = Array.from(headerRows[1].children).indexOf(subTh);
// Remove the sub TH
headerRows[1].removeChild(subTh);
// Reduce colspan of parent TH
const parentColspan = parseInt(parentTh.getAttribute('colspan')) || 1;
console.log('existing colspan' + parentColspan);
parentTh.setAttribute('colspan', parentColspan - 1);
console.log('new colspan' + (parentColspan - 1));
// Remove the corresponding TDs from each row
table.querySelectorAll('tbody tr').forEach(row => {
row.removeChild(row.children[startIndex]);
});
removeInsurerFromPremiumTable(event, subThIndex)
//remove the insurer from gobal array
let proposal_name = parentTh.innerText.split('⋮')[0];
popInsurerInArray(proposal_name, insurerName);
isFormDataModified = true; // if any value changeing in the table to set true
}
})
}
function showThreeDottedMenu(event) {
@ -2704,8 +2832,8 @@ function handleChildQuestions(target) {
let childCell = childRow.cells[currentColumnIndex];
if (childCell) {
console.log('found cell');
console.log('found cell',inputValue);
if (inputValue.key == disable_at.key) {
childCell.innerHTML = '';
childCell.innerText = '';
@ -2724,6 +2852,21 @@ function handleChildQuestions(target) {
console.log(child.default_answer.display_value)
childCell.contentEditable = false;
} else {
childCell.innerHTML = '';
childCell.innerText = '';
//hidden text box for store choosed answers object
const hiddenInputBox = document.createElement('input');
hiddenInputBox.type = 'hidden';
hiddenInputBox.value = JSON.stringify(inputValue.display_value);
childCell.appendChild(hiddenInputBox);
// alert(input.innerText);
childCell.appendChild(document.createTextNode(inputValue.display_value));
// Set the default answer in the child cell
// childCell.innerHTML = child.default_answer.display_value;
// console.log('setting default value');
// console.log(child.default_answer.display_value)
childCell.contentEditable = true;
}
}
@ -3101,7 +3244,7 @@ function ajaxRequestForGetMailData(url) {
function appendInput(data) {
console.log(data);
console.log("append data:",data);
var lead_id = $('#lead_id').val();
$('#input_for_row').empty();
let html = '';
@ -3111,9 +3254,9 @@ function appendInput(data) {
const url = '<?= base_url('leads/list') ?>?lead_id=' + lead_id;
html += `
<div class="form-group col-md-4">
<div class="form-group col-md-12">
<label for="contact_mail">Client Contact Mail</label>
<input value="${data.contact_person_email || ''}" type="text" id="contact_mail" class="form-control" placeholder="Contact Mail" readonly>
<input value="${data.contact_person_email || ''}" type="text" id="contact_mail" class="form-control" placeholder="Contact Mail">
</div>
`;
@ -3129,29 +3272,33 @@ function appendInput(data) {
html += `
<div class="form-group col-md-4">
<div class="form-group col-md-6">
<label for="client_cc">CC </label>
<select class="form-control" id="client_cc" name="client_cc" required multiple>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-6">
<label for="client_bcc">BCC </label>
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } ?>
<?php } } ?>
<?php } ?>
</select>
</div>
`;
@ -3161,7 +3308,7 @@ function appendInput(data) {
html += `
<div class="form-group col-md-12">
<label for="mail_subject">Subject</label>
<input type="text" id="mail_subject" class="form-control" value="'<?= isset($subject) ? $subject : " " ?>'" placeholder="Subject">
<input type="text" id="mail_subject" class="form-control" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Subject">
</div>
`;
@ -3194,25 +3341,28 @@ function appendInput(data) {
<div class="form-group col-md-4">
<label for="client_cc">CC </label>
<select class="form-control" id="client_cc" name="client_cc" required multiple>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } ?>
<?php } }?>
</select>
</div>
<div class="form-group col-md-4">
<label for="client_bcc">BCC </label>
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
<?php if (isset($userList)) { ?>
<?php foreach ($userList as $user) { ?>
<option value="<?= $user['id'];?>">
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } ?>
<?php } } ?>
<?php } ?>
</select>
</div>
@ -3272,7 +3422,13 @@ function appendInput(data) {
function constructURL(url_type) {
if(url_type == 1){
constructURL_ForInsurerAndClientMailSend()
var validationStatus = checkMailValidation();
if (validationStatus){
constructURL_ForInsurerAndClientMailSend();
}else{
toastr.error("All Client Mail ID's Should Contain Same Domain","ERROR");
}
}else if(url_type == 2){
constructURL_ForInternalMailSend()
}else if(url_type == 3){
@ -3435,6 +3591,7 @@ function constructURL_ForInsurerAndClientMailSend() {
var subject = $('#mail_subject').val();
var bcc = $('#client_bcc').val();
var cc = $('#client_cc').val();
var contact_mail = $("#contact_mail").val();
console.log('lead_id', lead_id)
console.log('subject', subject)
@ -3450,6 +3607,11 @@ function constructURL_ForInsurerAndClientMailSend() {
bcc = bcc.map(Number);
bcc = JSON.stringify(bcc);
var selectedFiles = [];
$('#insurer_or_clinet_mail_attachment .multi_file_attachment:checked').each(function () {
selectedFiles.push($(this).val());
});
// Prepare FormData object
var formData = new FormData();
formData.append('lead_id', lead_id);
@ -3457,8 +3619,11 @@ function constructURL_ForInsurerAndClientMailSend() {
formData.append('subject', subject);
formData.append('cc', cc);
formData.append('bcc', bcc);
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
if (RFQ_or_QCR == 2) {
formData.append('contact_mail',contact_mail);
formData.append('file_type', 'qcr');
formData.append('recipient_type', 'client');
formData.append('recipient_mail', '');
@ -3491,6 +3656,11 @@ function constructURL_ForInternalMailSend() {
// Determine file type
var file_type = RFQ_or_QCR == 2 ? 'qcr' : 'rfq';
var selectedFiles = [];
$('#internal_mail_attachment .multi_file_attachment:checked').each(function () {
selectedFiles.push($(this).val());
});
// Create FormData
var formData = new FormData();
formData.append('lead_id', lead_id);
@ -3501,6 +3671,7 @@ function constructURL_ForInternalMailSend() {
formData.append('subject', subject);
formData.append('mail_content', mail_content);
formData.append('recipient_mail', ''); // Empty value as per logic
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
ajaxRequest(formData)
@ -3512,6 +3683,8 @@ function constructURL_ForPlacementMailSend() {
var lead_id = $('#lead_id').val();
let to = $('#placement_to').val();
let placement_date = $('#placement_date').val();
let payment_date = $('#payment_date').val();
let is_cd = $("#is_cd_switch").is(":checked") ? 1 : 0;
let utr_no = $('#utr_no').val();
let premium_amount = $('#premium_amount').val();
let total_amount = $('#total_amount').val();
@ -3526,6 +3699,11 @@ function constructURL_ForPlacementMailSend() {
to = to.split(',').map(email => email.trim());
cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
var selectedFiles = [];
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
selectedFiles.push($(this).val());
});
// Prepare FormData
var formData = new FormData();
formData.append('lead_id', lead_id);
@ -3537,11 +3715,15 @@ function constructURL_ForPlacementMailSend() {
formData.append('proposal_insurer', proposal_insurer);
formData.append('insurer_and_branch', insurer_and_branch);
formData.append('placement_date', placement_date);
formData.append('payment_date', payment_date);
formData.append("is_cd",is_cd);
formData.append('utr_no', utr_no);
formData.append('premium_amount', premium_amount);
formData.append('total_amount', total_amount);
formData.append('cd_amount', cd_amount);
formData.append('mail_content', mail_content);
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
ajaxRequest(formData);
@ -3606,7 +3788,7 @@ function ajaxRequest(formData) {
$('#placement_cc').val('').select2({
placeholder : 'select CC Mail'
});
$('#placement_subject').val('');
// $('#placement_subject').val('');
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
@ -3683,7 +3865,7 @@ $('.close').click(function(){
$('#placement_cc').val('').select2({
placeholder : 'select CC Mail'
});
$('#placement_subject').val('');
// $('#placement_subject').val('');
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
@ -5155,12 +5337,18 @@ function autoCaluculationForPremiumChildTable(input) {
}
function appendMultiFileData(data) {
console.log('appendMultiFileData function called');
console.log(data)
}
</script>
<script>
async function submitData(json) {
async function submitData(input) {
console.log(over_all_column_data);
try {
@ -5175,6 +5363,7 @@ function autoCaluculationForPremiumChildTable(input) {
// Create a FormData object
const formData = new FormData();
let lead_id = $('#lead_id').val();
let rfq_primaryKey = $('#rfq_primaryKey').val();
let submit_type = "RFQ"
if(RFQ_or_QCR == 2){submit_type = 'QCR'}
@ -5183,6 +5372,10 @@ function autoCaluculationForPremiumChildTable(input) {
formData.append('lead_id', lead_id);
formData.append('submit_type', submit_type);
if(input == 1){
formData.append('rfq_primaryKey', rfq_primaryKey);
}
const postUrl = '<?= base_url('rfq/create')?>';
console.log(postUrl);
@ -5198,11 +5391,14 @@ function autoCaluculationForPremiumChildTable(input) {
if (response.status == true) {
toastr.success(response.message, 'SUCCESS');
$('#rfq_primaryKey').val(response.id);
} else {
toastr.warning(response.message, 'WARNING');
}
window.location.reload();
if(input != 1){
window.location.reload();
}
} catch (error) {
console.error('An error occurred during the AJAX request:');
@ -5673,4 +5869,65 @@ function autoCaluculationForPremiumChildTable(input) {
}
$("#is_cd_switch").change(function (){
var switch_status = ($("#is_cd_switch").is(":checked")? "on" : "off");
console.log("Switch status",switch_status);
if (switch_status == "on"){
$("#cd_amount").show();
$("#total_amount").show();
$("#cd_amount").closest('.form-group').show();
$("#total_amount").closest('.form-group').show();
}else{
$("#cd_amount").hide();
$("#total_amount").hide();
$("#cd_amount").closest('.form-group').hide();
$("#total_amount").closest('.form-group').hide();
}
})
$(document).on("input", "#cd_amount, #premium_amount", function() {
// alert("Function called");
var cd_amount = parseInt($("#cd_amount").val()) || 0;
var premium_amount = parseInt($("#premium_amount").val()) || 0;
var total_amount = (cd_amount + premium_amount);
$("#total_amount").val(total_amount);
});
function checkMailValidation(){
emailString = $("#contact_mail").val();
if (RFQ_or_QCR == 1){
if (typeof emailString !== 'string' || !emailString.includes(',')) return true;
}else{
if (typeof emailString !== 'string') return false;
}
const invalidChars = /[;|]/;
if (invalidChars.test(emailString)) return false;
const emails = emailString.split(',').map(email => email.trim());
if (emails.length === 0) return false;
const getDomain = email => email.split('@')[1]?.toLowerCase();
const firstDomain = getDomain(emails[0]);
if (!firstDomain) return false;
return emails.every(email => getDomain(email) === firstDomain);
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ class ExcelSanitizeHelperTest extends TestCase
"validString" => "HelloWorld",
"withNonPrintable" => "71030034240400000016",
"withWhitespace" => " Trim me ",
"withNonInBetween" => "Santosh\u00a0Badatya",
"nonStringValue" => 'Hello
World',
];
@ -23,6 +24,7 @@ World',
"validString" => "HelloWorld",
"withNonPrintable" => "71030034240400000016",
"withWhitespace" => "Trim me",
"withNonInBetween" => "Santosh Badatya",
"nonStringValue" => 'HelloWorld',
];
$result = ExcelSanitizeHelper::sanitizeArrayData($input);