Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
1638da3e74
@ -18,8 +18,9 @@ $routes->get("update-policy-terms-for-corrections", "ClientController::updatePol
|
|||||||
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
||||||
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
||||||
$routes->get("view", "EmployeeController::viewECard/$1");
|
$routes->get("view", "EmployeeController::viewECard/$1");
|
||||||
|
// $routes->get("exportQCRandRFQ", "LeadsController::exportQCRandRFQ");
|
||||||
|
$routes->get("smapletest", "ClientController::smapletest");
|
||||||
|
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
|
||||||
|
|
||||||
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
||||||
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
|
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
|
||||||
@ -73,7 +74,9 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
||||||
$routes->post("create", "NotificationController::createNotification");
|
$routes->post("create", "NotificationController::createNotification");
|
||||||
$routes->post("update_enable", "NotificationController::update_enable");
|
$routes->post("update_enable", "NotificationController::update_enable");
|
||||||
|
$routes->post("add_attachment", "NotificationController::insertAttachmentsForMailTemplates");
|
||||||
$routes->get("getMailTemplateData/(:any)/(:any)", "NotificationController::getMailTemplateData/$1/$2");
|
$routes->get("getMailTemplateData/(:any)/(:any)", "NotificationController::getMailTemplateData/$1/$2");
|
||||||
|
$routes->get("removeAttachment/(:any)", "NotificationController::removeAttachmentsForMailTemplates/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("general", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("general", ["filter" => "authMVC"], function ($routes) {
|
||||||
@ -297,8 +300,14 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
||||||
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
||||||
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
||||||
|
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
|
||||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||||
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
||||||
|
$routes->get("getLevelContects", "LeadsController::getLevelContects");
|
||||||
|
$routes->get("get_emp_master_data_for_update/(:any)", "EmployeeController::get_emp_master_data_for_update/$1");
|
||||||
|
$routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1");
|
||||||
|
$routes->post("update_emp_data", "EmployeeController::update_emp_data");
|
||||||
|
$routes->get("checkDeletionGetDataFunction", "EmployeeController::checkDeletionGetDataFunction");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -343,8 +352,18 @@ $routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("list", "LeadsController::viewLeadsList");
|
$routes->get("list", "LeadsController::viewLeadsList");
|
||||||
$routes->post("create", "LeadsController::createLead");
|
$routes->post("create", "LeadsController::createLead");
|
||||||
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
||||||
|
$routes->get("sendMail", "LeadsController::sendMailWithAttachement");
|
||||||
|
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
||||||
|
$routes->get("featchLeadDataAndInsertClient/(:any)", "LeadsController::featchLeadDataAndInsertClient/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$routes->group("rfq", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
$routes->post("create", "LeadsController::createRFQ");
|
||||||
|
$routes->post("createQCR", "LeadsController::createQCR");
|
||||||
|
$routes->get("list/(:any)", "LeadsController::viewRFQ/$1");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$routes->get("driveListFiles", "GoogleDriveController::listFiles");
|
$routes->get("driveListFiles", "GoogleDriveController::listFiles");
|
||||||
$routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
$routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||||
$routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
$routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||||
@ -355,16 +374,17 @@ $routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
|||||||
|
|
||||||
$routes->get("processjob", "JobWorker::processJob");
|
$routes->get("processjob", "JobWorker::processJob");
|
||||||
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
||||||
$routes->cli('cli/send_mail_cli(/:any)?', 'MasterController::testGmailAPIViaCLI$1');
|
$routes->cli('cli/send_mail_cli', 'MasterController::testGmailAPIViaCLI');
|
||||||
|
$routes->cli('cli/check_bounce_mail_cli', 'MasterController::testCheckBounceMails');
|
||||||
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
||||||
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
||||||
|
|
||||||
|
|
||||||
//Employee login api's
|
//Employee login api's
|
||||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||||
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
||||||
|
|
||||||
//HR login api's
|
//HR login api's
|
||||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||||
@ -374,9 +394,6 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||||
|
|
||||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||||
@ -419,17 +436,9 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Ticketing System
|
// Ticketing System
|
||||||
|
|
||||||
// Ticketing System End's
|
// Ticketing System End's
|
||||||
|
|||||||
@ -38,6 +38,7 @@ use App\Models\PolicyTypeModel;
|
|||||||
use App\Models\PolicyTransactionModel;
|
use App\Models\PolicyTransactionModel;
|
||||||
use App\Models\PolicyTransactionStatusModel;
|
use App\Models\PolicyTransactionStatusModel;
|
||||||
use App\Models\VehicleModel;
|
use App\Models\VehicleModel;
|
||||||
|
use App\Models\LeadsModel;
|
||||||
|
|
||||||
use App\Controllers\EmpDataServiceController;
|
use App\Controllers\EmpDataServiceController;
|
||||||
use App\Controllers\GoogleDriveController;
|
use App\Controllers\GoogleDriveController;
|
||||||
@ -78,6 +79,7 @@ class ClientController extends AdminController
|
|||||||
protected $policyTransactionModel;
|
protected $policyTransactionModel;
|
||||||
protected $policyTransactionStatusModel;
|
protected $policyTransactionStatusModel;
|
||||||
protected $vehicleModel;
|
protected $vehicleModel;
|
||||||
|
protected $leadsModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -113,6 +115,31 @@ class ClientController extends AdminController
|
|||||||
$this->policyTransactionModel = new PolicyTransactionModel();
|
$this->policyTransactionModel = new PolicyTransactionModel();
|
||||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||||
$this->vehicleModel = new VehicleModel();
|
$this->vehicleModel = new VehicleModel();
|
||||||
|
$this->leadsModel = new LeadsModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function smapletest()
|
||||||
|
{
|
||||||
|
$headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID'];
|
||||||
|
$filePath = generateExcelWithHeader($headers);
|
||||||
|
echo "Excel file created at: $filePath";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMailAttachments($email = 'venkateshraman786@gmail.com')
|
||||||
|
{
|
||||||
|
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
|
||||||
|
$attachments = [
|
||||||
|
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||||
|
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||||
|
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||||
|
];
|
||||||
|
|
||||||
|
$res = MailHelper::send_email(['mail' => $email, 'subject' => 'Mail Via Attachment Testing URL', 'message' => $message,'attachments' => $attachments]);
|
||||||
|
|
||||||
|
print_rr($res);
|
||||||
|
echo '------------------------------------------------------------------------------------------';
|
||||||
|
print_rr($attachments);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testingForReviewMail($client_id = 77, $emp_code = 'MGL-004', $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
public function testingForReviewMail($client_id = 77, $emp_code = 'MGL-004', $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
||||||
@ -238,6 +265,7 @@ class ClientController extends AdminController
|
|||||||
$headerData['page_name'] = 'Client List';
|
$headerData['page_name'] = 'Client List';
|
||||||
$data['clientList'] = $this->clientModel->getCreatedByUserName();
|
$data['clientList'] = $this->clientModel->getCreatedByUserName();
|
||||||
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
||||||
|
// $data['lead_data'] = $this->leadsModel->getLeadForInsertClientList();
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
@ -1705,15 +1733,6 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function editUploadVehicleFile() {}
|
|
||||||
|
|
||||||
public function listVehicleFiles() {}
|
|
||||||
|
|
||||||
public function deleteVehicleFiles() {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getKycDocsById($id = null)
|
public function getKycDocsById($id = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,6 +20,7 @@ use App\Models\ClientPolicyModel;
|
|||||||
use App\Models\NotificationModel;
|
use App\Models\NotificationModel;
|
||||||
use App\Models\EmployeePolicyModel;
|
use App\Models\EmployeePolicyModel;
|
||||||
use App\Controllers\PendingActionsContrller;
|
use App\Controllers\PendingActionsContrller;
|
||||||
|
use App\Controllers\EmpDataServiceController;
|
||||||
|
|
||||||
class DashboardController extends AdminController
|
class DashboardController extends AdminController
|
||||||
{
|
{
|
||||||
@ -544,6 +545,35 @@ class DashboardController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendManualEcard($client_id, $client_branch_id, $policy_id)
|
||||||
|
{
|
||||||
|
$this->myLogger->logme('error', "sendManualEcard called with client_id: {$client_id}, client_branch_id: {$client_branch_id}, policy id : {$policy_id}");
|
||||||
|
|
||||||
|
$notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first();
|
||||||
|
// print_r(($notification)); die;
|
||||||
|
if($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '')
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
||||||
|
if(count($emp_data) == 0)
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found','message2' => 'Failed' ], 200);
|
||||||
|
}
|
||||||
|
$ids = array_column($emp_data, 'id');
|
||||||
|
// print_r(($ids)); die;
|
||||||
|
// print_r($this->clientPolicyModel->getLastQuery()); die;
|
||||||
|
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));
|
||||||
|
Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => $ids]);
|
||||||
|
// $empEmpDataServiceController = new EmpDataServiceController();
|
||||||
|
// $empEmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function data_construct_for_bds($data){
|
public function data_construct_for_bds($data){
|
||||||
|
|
||||||
$groupedData = [
|
$groupedData = [
|
||||||
|
|||||||
@ -176,6 +176,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$totals = round($totals, 2);
|
$totals = round($totals, 2);
|
||||||
|
|
||||||
|
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||||
|
{
|
||||||
if (!empty($cash_balance)) {
|
if (!empty($cash_balance)) {
|
||||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||||
@ -183,6 +186,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Log the count of exported data
|
// Log the count of exported data
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
@ -298,7 +302,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'column_index' => 18,
|
'column_index' => 18,
|
||||||
'column_name' => 'PR0 RATA PREMIUM',
|
'column_name' => 'PRO RATA PREMIUM',
|
||||||
'db_column_name' => 'rata_premimum'
|
'db_column_name' => 'rata_premimum'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -408,7 +412,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'column_index' => 18,
|
'column_index' => 18,
|
||||||
'column_name' => 'PR0 RATA PREMIUM',
|
'column_name' => 'PRO RATA PREMIUM',
|
||||||
'db_column_name' => 'pro_rata_premium'
|
'db_column_name' => 'pro_rata_premium'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -636,6 +640,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($ids); die;
|
// print_r($ids); die;
|
||||||
|
|
||||||
|
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||||
|
{
|
||||||
if (!empty($cash_balance)) {
|
if (!empty($cash_balance)) {
|
||||||
if ((int) $cash_balance['balance'] < (int) $rounded_totals) {
|
if ((int) $cash_balance['balance'] < (int) $rounded_totals) {
|
||||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||||
@ -643,6 +649,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
$export_data['count'] = $count;
|
$export_data['count'] = $count;
|
||||||
@ -704,7 +711,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$excel_data_info = generate_insurer_based_excel($excel_header_columns, $objects);
|
$excel_data_info = generate_insurer_based_excel($excel_header_columns, $objects);
|
||||||
|
|
||||||
// Generate Excel file
|
// Generate Excel file
|
||||||
@ -921,13 +927,17 @@ class EmpDataServiceController extends BaseController
|
|||||||
$cash_balance['balance'] = $balance['opening_bal'];
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate the total amount from the objects
|
// Calculate the total amount from the objects
|
||||||
$totals = 0;
|
$totals = 0;
|
||||||
foreach ($inceptionData as $item) {
|
foreach ($inceptionData as $item) {
|
||||||
$totals = $totals + $item->total;
|
$totals = $totals + $item->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
$totals = round($totals, 2);
|
$totals = round($totals, 2);
|
||||||
|
|
||||||
|
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||||
|
{
|
||||||
if (!empty($cash_balance)) {
|
if (!empty($cash_balance)) {
|
||||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||||
@ -936,6 +946,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->removeOldExportInfoFromBatchFile($export_data);
|
$this->removeOldExportInfoFromBatchFile($export_data);
|
||||||
|
|
||||||
@ -1272,7 +1283,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
// array_pop($excel_data);
|
// array_pop($excel_data);
|
||||||
|
|
||||||
$inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL AMOUNT'];
|
$inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PRO RATA PREMIUM','GST','TOTAL AMOUNT'];
|
||||||
|
|
||||||
foreach ($inceptionHeader as $key => $value) {
|
foreach ($inceptionHeader as $key => $value) {
|
||||||
if($excel_header[$key] != $value){
|
if($excel_header[$key] != $value){
|
||||||
@ -1658,6 +1669,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$file_id = $params['file_id'];
|
$file_id = $params['file_id'];
|
||||||
$file = $this->batchFileModel->find($file_id);
|
$file = $this->batchFileModel->find($file_id);
|
||||||
|
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -1688,7 +1700,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
->where('insurer_id', $insurer_id['insurer_id'])
|
->where('insurer_id', $insurer_id['insurer_id'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
$get_policy_type = $this->clientPolicyModel
|
$get_policy_type = $this->clientPolicyModel
|
||||||
->select('policy_type.policy_type, policies.policy_type_id as policy_type_id')
|
->select('policy_type.policy_type, policies.policy_type_id as policy_type_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
@ -1771,12 +1782,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
'amount' => $totals,
|
'amount' => $totals,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- employee count : {data}', ['data' => $emp_count]);
|
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- employee count : {data}', ['data' => $emp_count]);
|
||||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- batch file status : {data}', ['data' => $status_val]);
|
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- batch file status : {data}', ['data' => $status_val]);
|
||||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- total amount for cash deposite : {data}', ['data' => $totals]);
|
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- total amount for cash deposite : {data}', ['data' => $totals]);
|
||||||
|
|
||||||
|
//update CD transaction entry if only insurer
|
||||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
||||||
@ -1808,15 +1818,20 @@ class EmpDataServiceController extends BaseController
|
|||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
]]);
|
]]);
|
||||||
|
|
||||||
|
// $this->cashDepositCalculationForInception($depositeData);
|
||||||
|
// $this->sendMailForDownloadingECard($emp_policy_ids);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//send ecard mail if the event is tpa only
|
||||||
|
if ($file['insurer_or_tpa'] == 'tpa') {
|
||||||
|
|
||||||
if ($get_policy_type['policy_type_id'] != 1) {
|
if ($get_policy_type['policy_type_id'] != 1) {
|
||||||
|
|
||||||
$job_details = new Jobs();
|
$job_details = new Jobs();
|
||||||
$r = Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => $emp_policy_ids]);
|
$r = Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => $emp_policy_ids]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->cashDepositCalculationForInception($depositeData);
|
|
||||||
// $this->sendMailForDownloadingECard($emp_policy_ids);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_data = $this->getDataByFileId($file_id, 'success');
|
$file_data = $this->getDataByFileId($file_id, 'success');
|
||||||
@ -2845,11 +2860,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||||
|
|
||||||
|
|
||||||
$file_data = $this->getDataByFileId($file_id, 'success');
|
|
||||||
$this->setPullNotification($file_data);
|
|
||||||
|
|
||||||
//call the cash deposite function
|
//call the cash deposite function
|
||||||
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
|
|
||||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||||
$job_details = new Jobs();
|
$job_details = new Jobs();
|
||||||
@ -2866,6 +2878,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
]]);
|
]]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_data = $this->getDataByFileId($file_id, 'success');
|
||||||
|
$this->setPullNotification($file_data);
|
||||||
|
|
||||||
//import file to upload Google Drive
|
//import file to upload Google Drive
|
||||||
// if(excelFileGDriveUpload($file_id, 'batch_file')){
|
// if(excelFileGDriveUpload($file_id, 'batch_file')){
|
||||||
// $this->myLogger->logme('error', 'SI Enhancement File Update Google Drive File Upload -- File Uploaded Successfully');
|
// $this->myLogger->logme('error', 'SI Enhancement File Update Google Drive File Upload -- File Uploaded Successfully');
|
||||||
@ -3372,14 +3389,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||||
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||||
|
|
||||||
|
|
||||||
$file_data = $this->getDataByFileId($file_id, 'success');
|
|
||||||
$this->setPullNotification($file_data);
|
|
||||||
|
|
||||||
//call the cash deposite function
|
//call the cash deposite function
|
||||||
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||||
|
|
||||||
$job_details = new Jobs();
|
$job_details = new Jobs();
|
||||||
$r = Jobs::addJob(['job_name' => 'cashDepositCalculationForDeletion', 'payload' => [
|
$r = Jobs::addJob(['job_name' => 'cashDepositCalculationForDeletion', 'payload' => [
|
||||||
'employeeIds' => $employee_policy_table_primaryKey,
|
'employeeIds' => $employee_policy_table_primaryKey,
|
||||||
@ -3393,6 +3405,10 @@ class EmpDataServiceController extends BaseController
|
|||||||
'policy_name' => $policy_name['policy_name'],
|
'policy_name' => $policy_name['policy_name'],
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
]]);
|
]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_data = $this->getDataByFileId($file_id, 'success');
|
||||||
|
$this->setPullNotification($file_data);
|
||||||
|
|
||||||
//import file to upload Google Drive
|
//import file to upload Google Drive
|
||||||
// if(excelFileGDriveUpload($file_id, 'batch_file')){
|
// if(excelFileGDriveUpload($file_id, 'batch_file')){
|
||||||
@ -4215,7 +4231,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendMailForDownloadingECard(array $ids)
|
public function sendMailForDownloadingECard(array $ids, $single_mail = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - function called');
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - function called');
|
||||||
@ -4260,7 +4276,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function inside if condition ',);
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function inside if condition ',);
|
||||||
|
|
||||||
|
|
||||||
$rand_string = $get_emp_email_and_other_details['rand_string'];
|
$rand_string = $get_emp_email_and_other_details['rand_string'];
|
||||||
$tpa_id = $get_emp_email_and_other_details['tpa_id'];
|
$tpa_id = $get_emp_email_and_other_details['tpa_id'];
|
||||||
|
|
||||||
@ -4275,14 +4290,21 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] == 'Self') {
|
if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] == 'Self') {
|
||||||
$wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
|
$wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
|
||||||
|
|
||||||
// print_r($wholeData);die;
|
// print_r($wholeData);die;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$counts++;
|
$counts++;
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - counts : {data}', ['data' => $counts]);
|
||||||
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - count : {data}', ['data' => $count]);
|
||||||
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - ids count : {data}', ['data' => count($ids)]);
|
||||||
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - whole count : {data}', ['data' => count($wholeData)]);
|
||||||
|
|
||||||
if ($count == 20 || $counts == count($ids) - 1) {
|
if ($count == 20 || $counts == count($ids) - 1) {
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - ids count : {data}', ['data' => count($ids)]);
|
||||||
|
|
||||||
if(count($wholeData) > 0){
|
if(count($wholeData) > 0){
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',);
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',);
|
||||||
@ -4293,6 +4315,27 @@ class EmpDataServiceController extends BaseController
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// for view member individual employee send self and self family ecard
|
||||||
|
if($single_mail){
|
||||||
|
|
||||||
|
if(count($wholeData) > 0){
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job for single mail to bulk mail function',);
|
||||||
|
|
||||||
|
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
||||||
|
$this->myLogger->logme("info", $mail_send_return);
|
||||||
|
return $mail_send_return;
|
||||||
|
|
||||||
|
// $job_details = new Jobs();
|
||||||
|
// $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]);
|
||||||
|
// $wholeData = [];
|
||||||
|
// $count = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4313,6 +4356,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - the client notification setup not created or not enabled the E-Card Notification');
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - the client notification setup not created or not enabled the E-Card Notification');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - employee_policy_ids are empty');
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - employee_policy_ids are empty');
|
||||||
|
|||||||
@ -87,22 +87,33 @@ class EmployeeController extends AdminController
|
|||||||
{
|
{
|
||||||
// $model = new UserModel();
|
// $model = new UserModel();
|
||||||
$data = [];
|
$data = [];
|
||||||
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending'];
|
$data['status'] = ['draft' => 'Draft', 'enrolled' => 'Enrolled', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending'];
|
||||||
|
|
||||||
if (count($this->request->getGet())) {
|
if (count($this->request->getGet())) {
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
|
||||||
client_id: $filterData['client_id'],
|
|
||||||
policy_id: $filterData['policy_id'],
|
|
||||||
branch_id: $filterData['branch_id'],
|
|
||||||
emp_code : $filterData['emp_code'],
|
|
||||||
emp_name : $filterData['emp_name'],
|
|
||||||
status : $filterData['status'],
|
|
||||||
);
|
|
||||||
// dd($this->employeePolicyModel->getLastQuery());
|
|
||||||
|
|
||||||
|
// Convert the status field to an array if it exists in the request data
|
||||||
|
if (isset($filterData['status']) && !empty($filterData['status'])) {
|
||||||
|
$filterData['status'] = explode(",", $filterData['status']);
|
||||||
|
}else{
|
||||||
|
$filterData['status'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch employees with the modified $filterData array
|
||||||
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||||
|
client_id: $filterData['client_id'] ?? null,
|
||||||
|
policy_id: $filterData['policy_id'] ?? null,
|
||||||
|
branch_id: $filterData['branch_id'] ?? null,
|
||||||
|
emp_code : $filterData['emp_code'] ?? null,
|
||||||
|
emp_name : $filterData['emp_name'] ?? null,
|
||||||
|
status : $filterData['status'] ?? [],
|
||||||
|
);
|
||||||
|
|
||||||
|
// Set getData in $data array with the processed $filterData
|
||||||
$data['getData'] = $filterData;
|
$data['getData'] = $filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dd($this->employeeModel->getLastQuery());
|
||||||
// dd( $data['getData']);
|
// dd( $data['getData']);
|
||||||
|
|
||||||
// dd($this->request->getGet());
|
// dd($this->request->getGet());
|
||||||
@ -263,7 +274,7 @@ class EmployeeController extends AdminController
|
|||||||
//for TPA/insurer upload
|
//for TPA/insurer upload
|
||||||
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||||
//for inception upload
|
//for inception upload
|
||||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addtion' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
||||||
|
|
||||||
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
||||||
@ -279,7 +290,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$data['fileList'] = $this->fileModel
|
$data['fileList'] = $this->fileModel
|
||||||
->select([
|
->select([
|
||||||
'files.*',
|
'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by',
|
||||||
'up.emp_code',
|
'up.emp_code',
|
||||||
'up.first_name',
|
'up.first_name',
|
||||||
'c.short_name',
|
'c.short_name',
|
||||||
@ -301,9 +312,10 @@ class EmployeeController extends AdminController
|
|||||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||||
->where('files.created_by', get_session_userid())
|
// ->where('files.created_by', get_session_userid())
|
||||||
->orderBy('files.created_at', 'desc')
|
->orderBy('files.created_at', 'desc')
|
||||||
->findAll();
|
->limit(100)
|
||||||
|
->find();
|
||||||
// dd($data['fileList']);
|
// dd($data['fileList']);
|
||||||
|
|
||||||
$data['batch_list'] = $this->batchFileModel->select(
|
$data['batch_list'] = $this->batchFileModel->select(
|
||||||
@ -318,7 +330,8 @@ class EmployeeController extends AdminController
|
|||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('clients', 'clients.id = client_policy.client_id')
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
->orderBy('batch_files.id', 'desc')
|
->orderBy('batch_files.id', 'desc')
|
||||||
->findAll();
|
->limit(100)
|
||||||
|
->find();
|
||||||
|
|
||||||
|
|
||||||
// dd($data['fileList']);die();
|
// dd($data['fileList']);die();
|
||||||
@ -443,15 +456,12 @@ class EmployeeController extends AdminController
|
|||||||
'actions' => $actions,
|
'actions' => $actions,
|
||||||
'file_name' => $file_name,
|
'file_name' => $file_name,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($actions == 'export') {
|
if ($actions == 'export') {
|
||||||
|
|
||||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception') {
|
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception' || ($event_type == 'MultipleEvents' && $insurer_or_tpa == 'tpa')) {
|
||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||||
|
|
||||||
if ($return === 0) {
|
if ($return === 0) {
|
||||||
|
|
||||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
|
||||||
@ -825,7 +835,7 @@ class EmployeeController extends AdminController
|
|||||||
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
|
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
$count = count($res);
|
$count = ($res);
|
||||||
$message = $count . ' Employees are Initiate Onboard Process againts Client ' . $client_data['client_name'] . ' and the Policy is ' . $client_data['policy_name'];
|
$message = $count . ' Employees are Initiate Onboard Process againts Client ' . $client_data['client_name'] . ' and the Policy is ' . $client_data['policy_name'];
|
||||||
session()->setFlashdata('success1', $message);
|
session()->setFlashdata('success1', $message);
|
||||||
return redirect()->to(base_url('/employee/upload'));
|
return redirect()->to(base_url('/employee/upload'));
|
||||||
@ -1109,6 +1119,7 @@ class EmployeeController extends AdminController
|
|||||||
$htmlContent = $tmplt_data;
|
$htmlContent = $tmplt_data;
|
||||||
|
|
||||||
$placeholders = [
|
$placeholders = [
|
||||||
|
'{CLIENT_NAME}' => $value['client_name'],
|
||||||
'{TPA_ID}' => $value['tpa_id'],
|
'{TPA_ID}' => $value['tpa_id'],
|
||||||
'{NAME}' => $value['name'],
|
'{NAME}' => $value['name'],
|
||||||
'{UHID}' => $value['uhid'],
|
'{UHID}' => $value['uhid'],
|
||||||
@ -1415,7 +1426,11 @@ class EmployeeController extends AdminController
|
|||||||
$excelErrorData['excel_header'] = $excel_data[0];
|
$excelErrorData['excel_header'] = $excel_data[0];
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
|
|
||||||
if($event_type == 'inception' || $event_type == 'deletion'){
|
// if($event_type == 'inception' || $event_type == 'deletion'){
|
||||||
|
// array_pop($excel_data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if($event_type == 'deletion'){
|
||||||
array_pop($excel_data);
|
array_pop($excel_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1696,4 +1711,79 @@ class EmployeeController extends AdminController
|
|||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $policies], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $policies], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------- Edit individual employee and View & Send E-card -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public function get_emp_master_data_for_update($id)
|
||||||
|
{
|
||||||
|
$employee_data = $this->employeeModel->select("employees.*, DATE_FORMAT(dob, '%d/%m/%Y') AS formatted_dob,")->where('id', $id)->first();
|
||||||
|
|
||||||
|
if ($employee_data) {
|
||||||
|
return $this->respond(['status' => true,'code' => 200,'data' => $employee_data,], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found.'], 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_emp_data()
|
||||||
|
{
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
|
$data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
||||||
|
|
||||||
|
// Fetch current employee data
|
||||||
|
$employee_data = $this->employeeModel->where('id', $data['employee_primary_id'])->first();
|
||||||
|
|
||||||
|
if ($employee_data['relationship'] == 'Self') {
|
||||||
|
|
||||||
|
if ($employee_data['gender'] != $data['gender']) {
|
||||||
|
|
||||||
|
$spouse_gender = ($data['gender'] == 'M') ? 'F' : 'M';
|
||||||
|
$this->employeeModel
|
||||||
|
->where('emp_code', $employee_data['emp_code'])
|
||||||
|
->where('relationship', 'Spouse')
|
||||||
|
->set(['gender' => $spouse_gender])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the employee data
|
||||||
|
$result = $this->employeeModel->where('id', $data['employee_primary_id'])->set($data)->update();
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $data, 'message' => 'Employee updated successfully'], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update employee.'], 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function send_mail_for_individual_employee_ecard($id)
|
||||||
|
{
|
||||||
|
$ids[] = $id;
|
||||||
|
$empDataServiceController = new EmpDataServiceController();
|
||||||
|
$result = $empDataServiceController->sendMailForDownloadingECard($ids, 1);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true,'code' => 200,'message' => 'Mail sent successfully', 'result' => $result,], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to sent mail.'], 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkDeletionGetDataFunction()
|
||||||
|
{
|
||||||
|
$batch_data = [
|
||||||
|
'client_id' => 77,
|
||||||
|
'client_policy_id' => 203,
|
||||||
|
'client_branch_id' => 53,
|
||||||
|
'insurer_or_tpa' => 'tpa',
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
||||||
|
|
||||||
|
print_rr($result); die;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -709,7 +709,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
|
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
|
||||||
|
|
||||||
//make an entry in DB
|
//make an entry in DB
|
||||||
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $employee_id, 'status' => 'draft', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $employee_id, 'status' => 'inprogress', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
||||||
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
|
||||||
|
|
||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
@ -840,7 +840,8 @@ class EmployeeRestController extends AdminController
|
|||||||
'band'=> $extra['10'][$index],
|
'band'=> $extra['10'][$index],
|
||||||
'basic_pay'=> $extra['11'][$index],
|
'basic_pay'=> $extra['11'][$index],
|
||||||
'unit'=> isset($extra['12'][$index]) ? $extra['12'][$index] : null,
|
'unit'=> isset($extra['12'][$index]) ? $extra['12'][$index] : null,
|
||||||
'client_branch_id' => $client_branch_id
|
'client_branch_id' => $client_branch_id,
|
||||||
|
'date_coverage' => $extra['13'][$index]
|
||||||
|
|
||||||
];
|
];
|
||||||
$basic_cover_si_value = null;
|
$basic_cover_si_value = null;
|
||||||
@ -877,6 +878,8 @@ class EmployeeRestController extends AdminController
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||||
{
|
{
|
||||||
|
$date_coverage = $dataToInsert[$a]['date_coverage'];
|
||||||
|
unset($dataToInsert[$a]['date_coverage']);
|
||||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a],$client_branch_id);
|
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a],$client_branch_id);
|
||||||
$emp_id =0;
|
$emp_id =0;
|
||||||
|
|
||||||
@ -928,6 +931,7 @@ class EmployeeRestController extends AdminController
|
|||||||
'employee_id'=>$emp_id,
|
'employee_id'=>$emp_id,
|
||||||
'client_policy_id'=>$policy_id,
|
'client_policy_id'=>$policy_id,
|
||||||
'status'=> 'draft',
|
'status'=> 'draft',
|
||||||
|
'date_coverage' => $date_coverage,
|
||||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -969,6 +973,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => '','error_data' => ''])->update();
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
||||||
|
|||||||
@ -594,6 +594,15 @@ class EmployeeServiceController extends AdminController
|
|||||||
'data_type' => 'str',
|
'data_type' => 'str',
|
||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null
|
'allowed_values' => null
|
||||||
|
],
|
||||||
|
'doc' => [
|
||||||
|
'col_idx' => 13,
|
||||||
|
'col_cell_name' => 'N',
|
||||||
|
'col_name' => 'DOC',
|
||||||
|
'is_mandatory' => false,
|
||||||
|
'data_type' => 'str',
|
||||||
|
'format' => 'd-M-Y',
|
||||||
|
'allowed_values' => null
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -605,7 +614,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
4 => 4, // inception: gender (Gender) -> enrollment: gender (Gender)
|
4 => 4, // inception: gender (Gender) -> enrollment: gender (Gender)
|
||||||
5 => 5, // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
5 => 5, // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
||||||
6 => 9, // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
6 => 9, // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
||||||
7 => null, // inception: doc (Date of Coverage) -> No match in enrollment
|
7 => 13, // inception: doc (Date of Coverage)
|
||||||
8 => 3, // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
8 => 3, // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
||||||
9 => 11, // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
9 => 11, // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
||||||
10 => 10, // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
10 => 10, // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
||||||
@ -1040,7 +1049,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
//check self avaialbe either same policy DB level(i.e.) gMC parents
|
//check self avaialbe either same policy DB level(i.e.) gMC parents
|
||||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
|
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
|
||||||
{
|
{
|
||||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: trim($emp_id),client_id: $file['client_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ],relationship:['self']);
|
||||||
// dd($self_details);
|
// dd($self_details);
|
||||||
if(!count($self_details))
|
if(!count($self_details))
|
||||||
{
|
{
|
||||||
@ -1088,7 +1097,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
}// end of foreach
|
}// end of foreach
|
||||||
}// end of if current action I,DA,A
|
}// end of if current action I,DA,A
|
||||||
|
|
||||||
// s($result);
|
// return $result;
|
||||||
// die();
|
// die();
|
||||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||||
{
|
{
|
||||||
@ -1249,7 +1258,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
//get policy slab rates
|
//get policy slab rates
|
||||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
|
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
|
||||||
|
|
||||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
|
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled'],policy_status:['enrolled']);
|
||||||
|
|
||||||
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
||||||
@ -1613,6 +1622,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
$value['emp_status'] = 'active';
|
$value['emp_status'] = 'active';
|
||||||
$value['created_by'] = $file['created_by'];
|
$value['created_by'] = $file['created_by'];
|
||||||
$value['client_branch_id'] = $file['client_branch_id'];
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
|
$value['family_floater_key'] = generate_family_floater_key($value['relationship']);
|
||||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||||
// echo 'update emp';
|
// echo 'update emp';
|
||||||
@ -1983,7 +1993,7 @@ public function employeesEnrollmentInsert($params)
|
|||||||
$value['file_id'] = $file_id;
|
$value['file_id'] = $file_id;
|
||||||
|
|
||||||
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
||||||
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'Father') {
|
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'father') {
|
||||||
$relation = 'parent';
|
$relation = 'parent';
|
||||||
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
|
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
|
||||||
$relation = 'child';
|
$relation = 'child';
|
||||||
@ -1997,6 +2007,7 @@ public function employeesEnrollmentInsert($params)
|
|||||||
$value['family_floater_key'] = $relation;
|
$value['family_floater_key'] = $relation;
|
||||||
|
|
||||||
$policy_data['basic_cover_si'] = $row[9];
|
$policy_data['basic_cover_si'] = $row[9];
|
||||||
|
$policy_data['date_coverage'] = $row[13];
|
||||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||||
|
|
||||||
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class Jobs extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$uuid = generate_uuid();
|
$uuid = generate_uuid();
|
||||||
$jobid = $jobModel->insert(['name' => $payload['job_name'],'uuid' => $uuid,'payload' => json_encode($payload['payload'])]);
|
$jobid = $jobModel->insert(['name' => $payload['job_name'],'uuid' => $uuid,'payload' => json_encode($payload['payload']), 'status' => isset($payload['status']) ? $payload['status'] : 'queued']);
|
||||||
// echo $jobid;
|
// echo $jobid;
|
||||||
$myLogger->logme('error','new job {jobid} added to queue',['jobid' => $jobid]);
|
$myLogger->logme('error','new job {jobid} added to queue',['jobid' => $jobid]);
|
||||||
return ['id' => $jobid,'uuid' => $uuid,'job_name' => $payload['job_name']];
|
return ['id' => $jobid,'uuid' => $uuid,'job_name' => $payload['job_name']];
|
||||||
|
|||||||
@ -4,6 +4,9 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use CodeIgniter\API\ResponseTrait;
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
use App\Models\ClientModel;
|
use App\Models\ClientModel;
|
||||||
use App\Models\ClientBranchModel;
|
use App\Models\ClientBranchModel;
|
||||||
@ -15,6 +18,12 @@ use App\Models\KYCEntityTypeModel;
|
|||||||
use App\Models\PolicyTransactionStatusModel;
|
use App\Models\PolicyTransactionStatusModel;
|
||||||
use App\Models\InsurerBranchModel;
|
use App\Models\InsurerBranchModel;
|
||||||
use App\Models\TPABranchModel;
|
use App\Models\TPABranchModel;
|
||||||
|
use App\Models\RFQModel;
|
||||||
|
use App\Models\InsurerModel;
|
||||||
|
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
use Kint;
|
||||||
|
|
||||||
|
|
||||||
class LeadsController extends BaseController
|
class LeadsController extends BaseController
|
||||||
{
|
{
|
||||||
@ -35,6 +44,8 @@ class LeadsController extends BaseController
|
|||||||
protected $policyTransactionStatusModel;
|
protected $policyTransactionStatusModel;
|
||||||
protected $insurerBranchModel;
|
protected $insurerBranchModel;
|
||||||
protected $tpaBranchModel;
|
protected $tpaBranchModel;
|
||||||
|
protected $RFQModel;
|
||||||
|
protected $insurerModel;
|
||||||
|
|
||||||
//variables for storing array
|
//variables for storing array
|
||||||
protected $issuer;
|
protected $issuer;
|
||||||
@ -58,6 +69,8 @@ class LeadsController extends BaseController
|
|||||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||||
$this->insurerBranchModel = new InsurerBranchModel();
|
$this->insurerBranchModel = new InsurerBranchModel();
|
||||||
$this->tpaBranchModel = new TPABranchModel();
|
$this->tpaBranchModel = new TPABranchModel();
|
||||||
|
$this->RFQModel = new RFQModel();
|
||||||
|
$this->insurerModel = new InsurerModel();
|
||||||
|
|
||||||
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
||||||
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
||||||
@ -202,6 +215,7 @@ class LeadsController extends BaseController
|
|||||||
'branch_code' => $data['branch_code'],
|
'branch_code' => $data['branch_code'],
|
||||||
'contact_person_name' => $data['contact_person_name'],
|
'contact_person_name' => $data['contact_person_name'],
|
||||||
'contact_person_mobile' => $data['contact_person_mobile'],
|
'contact_person_mobile' => $data['contact_person_mobile'],
|
||||||
|
'contact_person_email' => $data['contact_person_email'],
|
||||||
'client_id' => $data['client_id'] ?? 0,
|
'client_id' => $data['client_id'] ?? 0,
|
||||||
'client_branch_id' => $data['client_branch_id'] ?? 0,
|
'client_branch_id' => $data['client_branch_id'] ?? 0,
|
||||||
'source_policy_id' => $data['source_policy_id'] ?? 0,
|
'source_policy_id' => $data['source_policy_id'] ?? 0,
|
||||||
@ -296,4 +310,514 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------RFQ-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
public function viewRFQ($id, $type = 1){
|
||||||
|
|
||||||
|
$data['rfq_data'] = $this->RFQModel
|
||||||
|
->where('lead_id', $id)
|
||||||
|
->where('type', $type)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$data['rfq_count'] = $this->RFQModel
|
||||||
|
->where('lead_id', $id)
|
||||||
|
->where('type', 1)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
$data['qcr_count'] = $this->RFQModel
|
||||||
|
->where('lead_id', $id)
|
||||||
|
->where('type', 2)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
// dd(count($data['rfq_data']));
|
||||||
|
|
||||||
|
$data['lead_id'] = $id;
|
||||||
|
$lead_data = $this->leadsModel
|
||||||
|
->select('policy_type.question_json')
|
||||||
|
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||||
|
->where('leads.id', $id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$data['question_json'] = $lead_data['question_json'];
|
||||||
|
$data['page_name'] = isset($data['rfq_data']['type']) && $data['rfq_data']['type'] == 2 ? 'QCR' : 'RFQ';
|
||||||
|
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||||
|
|
||||||
|
$data['lead_data'] = $this->leadsModel->where('leads.id', $id)->where('leads.is_active', 1)->first();
|
||||||
|
// dd($data);
|
||||||
|
$this->loadLayout('view_rfq.php', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createRFQ(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$lead_id = $data['lead_id'];
|
||||||
|
$data['type'] = 1;
|
||||||
|
$this->RFQModel
|
||||||
|
->where('lead_id', $lead_id)
|
||||||
|
->where('type', 1)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->set('is_active', 0)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$result = $this->RFQModel->insert($data);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true, 'id' => $result, 'message' => 'New RFQ created successfully', 'data' =>$data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'id' => $result, 'message' => "Failed to create RFQ", 'data' =>$data], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createQCR(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$lead_id = $data['lead_id'];
|
||||||
|
$data['type'] = 2;
|
||||||
|
|
||||||
|
$this->RFQModel
|
||||||
|
->where('lead_id', $lead_id)
|
||||||
|
->where('type', 2)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->set('is_active', 0)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$result = $this->RFQModel->insert($data);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true, 'id' => $result, 'message' => 'New QCR created successfully', 'data' =>$data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'id' => $result, 'message' => "Failed to create QCR", 'data' =>$data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//export main route function
|
||||||
|
public function exportQCRandRFQ($lead_id, $type, $export_type){
|
||||||
|
|
||||||
|
if($export_type == 'mail'){
|
||||||
|
$this-> exportMailForQCRandRFQ($lead_id, $type);
|
||||||
|
}else{
|
||||||
|
$this-> exportExcelForQCRandRFQ($lead_id, $type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//FOR EXCEL
|
||||||
|
public function exportExcelForQCRandRFQ($lead_id, $type)
|
||||||
|
{
|
||||||
|
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
|
||||||
|
$filepath = $filepath['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.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//FOR MAIL
|
||||||
|
public function exportMailForQCRandRFQ($lead_id, $type){
|
||||||
|
|
||||||
|
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
|
||||||
|
|
||||||
|
if ($filepath) {
|
||||||
|
return $this->respond(['status' => true, 'file_path' => $filepath, 'message' => 'Mail send successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'file_path' => $filepath, 'message' => "Mail send failed"], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Construct excel file and save the file to the folder and return file path
|
||||||
|
public function constructExcelToSaveTemp($lead_id, $type)
|
||||||
|
{
|
||||||
|
$rfq_data = $this->RFQModel
|
||||||
|
->select('
|
||||||
|
leads.client_name,
|
||||||
|
leads.client_short_name,
|
||||||
|
insurers.name as insurer_name,
|
||||||
|
insurer_branch.branch_name as insurer_branch_name,
|
||||||
|
tpa.name as tpa_name,
|
||||||
|
tpa_branch.branch_name as tpa_branch_name,
|
||||||
|
policy_type.policy_type,
|
||||||
|
rfq.json
|
||||||
|
')
|
||||||
|
->join('leads', 'rfq.lead_id = leads.id')
|
||||||
|
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||||
|
->join('insurers', 'leads.insurer_id = insurers.id')
|
||||||
|
->join('insurer_branch', 'leads.insurer_branch_id = insurer_branch.id')
|
||||||
|
->join('tpa', 'leads.tpa_id = tpa.id')
|
||||||
|
->join('tpa_branch', 'leads.tpa_branch_id = tpa_branch.id')
|
||||||
|
->where('rfq.lead_id', $lead_id)
|
||||||
|
->where('rfq.type', $type)
|
||||||
|
->where('rfq.is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$lead_data = [
|
||||||
|
'Insured' => $rfq_data['client_name'],
|
||||||
|
'Insurer' => $rfq_data['insurer_name'] . ' - ' . $rfq_data['insurer_branch_name'],
|
||||||
|
'TPA' => $rfq_data['tpa_name'] . ' - ' . $rfq_data['tpa_branch_name'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$jsonData = $rfq_data['json'];
|
||||||
|
$data = json_decode($jsonData, true);
|
||||||
|
|
||||||
|
// Initialize PhpSpreadsheet
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// Start with lead_data at the top
|
||||||
|
$rowNumber = 1;
|
||||||
|
foreach ($lead_data as $key => $value) {
|
||||||
|
$sheet->setCellValue("A{$rowNumber}", $key);
|
||||||
|
$sheet->setCellValue("B{$rowNumber}", $value);
|
||||||
|
|
||||||
|
// Apply bold style to the key
|
||||||
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rowNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leave two blank rows
|
||||||
|
$rowNumber += 2;
|
||||||
|
|
||||||
|
// Set headers and subheaders starting from current row
|
||||||
|
$headers = $data['table_data']['headers'];
|
||||||
|
$subHeaderRow = $rowNumber + 1;
|
||||||
|
$columnLetter = 'A';
|
||||||
|
|
||||||
|
// Set column width and apply word wrap to headers and subheaders
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if ($header['parentHeader'] === 'Item Key' || $header['parentHeader'] == 'Action') {
|
||||||
|
continue; // Skip "Item Key" and "Action" columns
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($header['parentHeader'] === 'Sno') {
|
||||||
|
$header['parentHeader'] = 'S.No.';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the header cell value
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $header['parentHeader']);
|
||||||
|
|
||||||
|
// Set column width for header
|
||||||
|
$sheet->getColumnDimension($columnLetter)->setWidth(20); // Adjust width as needed
|
||||||
|
$sheet->getStyle("{$columnLetter}{$rowNumber}")->getAlignment()->setWrapText(true);
|
||||||
|
|
||||||
|
// Apply bold style to the header
|
||||||
|
$sheet->getStyle("{$columnLetter}{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Add subheaders in the second row
|
||||||
|
foreach ($header['subHeaders'] as $subHeader) {
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
||||||
|
|
||||||
|
// Enable word wrap for subheaders
|
||||||
|
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->getAlignment()->setWrapText(true);
|
||||||
|
|
||||||
|
// Apply bold style to the subheader
|
||||||
|
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$columnLetter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move to next row for data entries
|
||||||
|
$rowNumber = $subHeaderRow + 1;
|
||||||
|
|
||||||
|
// Add data rows and enable word wrap for data cells
|
||||||
|
foreach ($data['table_data']['data'] as $dataRow) {
|
||||||
|
$columnLetter = 'A';
|
||||||
|
foreach ($dataRow['data'] as $cellData) {
|
||||||
|
if ($cellData['parentth'] === 'Item Key' || $cellData['parentth'] == 'Action') {
|
||||||
|
continue; // Skip "Item Key" data
|
||||||
|
}
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['value']);
|
||||||
|
|
||||||
|
// Enable word wrap for data cells
|
||||||
|
$sheet->getStyle("{$columnLetter}{$rowNumber}")->getAlignment()->setWrapText(true);
|
||||||
|
|
||||||
|
$columnLetter++;
|
||||||
|
}
|
||||||
|
$rowNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-size all columns after data is entered
|
||||||
|
foreach ($sheet->getColumnIterator() as $column) {
|
||||||
|
$sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set filename based on type
|
||||||
|
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||||
|
$filename = $string . '_' . $rfq_data['client_short_name'] . '_' . $rfq_data['policy_type'] . '_' . date('Ymdhis') . '.xlsx';
|
||||||
|
|
||||||
|
// Save to temporary location
|
||||||
|
$uploadFilePath = WRITEPATH . 'tmp/' . $filename;
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($uploadFilePath);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'filePath' => $uploadFilePath,
|
||||||
|
'fileName' => $filename,
|
||||||
|
]; // Return file path and file name
|
||||||
|
}
|
||||||
|
|
||||||
|
//this funciton for send mail to insurer and client with either RFQ/QCR
|
||||||
|
public function sendMailWithAttachement()
|
||||||
|
{
|
||||||
|
helper('excel_util_helper');
|
||||||
|
helper('MailHelper');
|
||||||
|
|
||||||
|
$params = $this->request->getGet();
|
||||||
|
// dd($params);
|
||||||
|
$lead_id = $params['lead_id'];
|
||||||
|
$file_type = $params['file_type']; //rfq or qcr
|
||||||
|
$recipient_type = $params['recipient_type'];//insurer or client
|
||||||
|
$recipient_mail = $params['recipient_mail'];// - only primary key of contacts
|
||||||
|
$recipient_mail = json_decode($params['recipient_mail'], true);;// - only primary key of contacts
|
||||||
|
// $cc = 'velz1990@gmail.com,vitvelz@gmail.com';
|
||||||
|
$cc = "";
|
||||||
|
|
||||||
|
$result_data = [];
|
||||||
|
// dd($recipient_mail);
|
||||||
|
if($recipient_type == 'insurer' && (!is_array($recipient_mail) || count($recipient_mail) == 0))
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 400,'data' => '','messgae' => 'Recipient mail not found ! ' ], 200);
|
||||||
|
}
|
||||||
|
// dd();
|
||||||
|
//gather lead info
|
||||||
|
$lead_data = $this->leadsModel
|
||||||
|
->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
|
||||||
|
->join('policy_type','leads.policy_type_id = policy_type.id')
|
||||||
|
->join('user_profiles','leads.created_by = user_profiles.id')
|
||||||
|
->where('leads.id', $lead_id)
|
||||||
|
->first();
|
||||||
|
if( $recipient_type == 'client' && ($lead_data['contact_person_email'] == '' || $lead_data['contact_person_email'] == null))
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 400,'data' => '','messgae' => 'Recipient mail not found ! ' ], 200);
|
||||||
|
}
|
||||||
|
// dd($lead_data);
|
||||||
|
$reply_to = $lead_data['created_person_email'];
|
||||||
|
//get file path to attach
|
||||||
|
$file_info = $this->constructExcelToSaveTemp($lead_id, ( $file_type == 'rfq' ? 1 : 2) );
|
||||||
|
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
||||||
|
// $file_name = $file_type.'.xlsx';
|
||||||
|
// !dd($file_info);
|
||||||
|
$file_path = $file_info['filePath'];
|
||||||
|
$file_name = $file_info['fileName'];
|
||||||
|
$attachments = [['fileName' => $file_name,'filePath' => $file_path]];
|
||||||
|
|
||||||
|
//get recipient address
|
||||||
|
if($recipient_type == 'insurer')
|
||||||
|
{
|
||||||
|
$recipient_data = $this->levelContactModel
|
||||||
|
->where(['contact_type' => $recipient_type, 'is_active' => 1])
|
||||||
|
->whereIn('id', $recipient_mail)
|
||||||
|
->findAll();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$recipient_data = [['name' => $lead_data['contact_person_name'],'email' => $lead_data['contact_person_email']] ];
|
||||||
|
}
|
||||||
|
// !dd($recipient_data);
|
||||||
|
|
||||||
|
$subject = $file_type == 'rfq' ? 'Request for Quotation from '. $lead_data['client_name'] . ' for '.$lead_data['policy_type'] : 'Quotation Comparison Report for ' .$lead_data['policy_type'];
|
||||||
|
$original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
|
||||||
|
|
||||||
|
foreach($recipient_data as $recipient)
|
||||||
|
{
|
||||||
|
$message = $original_message;
|
||||||
|
$message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'], $message);
|
||||||
|
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
|
||||||
|
$message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'], $message);
|
||||||
|
$message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'],'Y-m-d','d-m-Y'), $message);
|
||||||
|
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'],$lead_data['policy_start_date'])->days, $message);
|
||||||
|
|
||||||
|
// print_rr($message);
|
||||||
|
|
||||||
|
$res = MailHelper::send_email(['mail' => $recipient['email'], 'subject' => $subject, 'message' => $message,'attachments' => $attachments,'reply_to' => $reply_to]);
|
||||||
|
// !dd($res);
|
||||||
|
|
||||||
|
$result_data[] = ['mail' => $recipient['email'],'status' => $res];
|
||||||
|
}
|
||||||
|
//delete attachment file
|
||||||
|
unlink($file_path);
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result_data ], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLevelContects()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = $this->levelContactModel->getContectForRFQ();
|
||||||
|
|
||||||
|
if($data){
|
||||||
|
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----- Featch Lead data and insert Client -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function featchLeadDataAndInsertClient($lead_id)
|
||||||
|
{
|
||||||
|
$data = $this->leadsModel->where('leads.id', $lead_id)->where('leads.is_active', 1)->first();
|
||||||
|
|
||||||
|
if (!$data) {
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Failed to create Client', 'data' => null], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->createClientWithLeadData($data);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true, 'message' => 'New Client created successfully', 'client_id' => $result, 'data' => $data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Failed to create client', 'data' => $data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createClientWithLeadData($data)
|
||||||
|
{
|
||||||
|
$client_data = $this->prepareClientData($data);
|
||||||
|
$client_id = $this->clientModel->insert($client_data);
|
||||||
|
|
||||||
|
if ($client_id) {
|
||||||
|
$this->createClientBranchAndContactWithLeadData($data, $client_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $client_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepareClientData($data)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'client_type' => $data['client_type'],
|
||||||
|
'entity_type_id' => $data['entity_type_id'],
|
||||||
|
'client_code' => $data['client_code'],
|
||||||
|
'client_name' => $data['client_name'],
|
||||||
|
'short_name' => $data['client_short_name'],
|
||||||
|
'pan' => $data['pan'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createClientBranchAndContactWithLeadData($data, $client_id)
|
||||||
|
{
|
||||||
|
$branch_data = $this->prepareClientBranchData($data, $client_id);
|
||||||
|
$branch_id = $this->clientBranchModel->insert($branch_data);
|
||||||
|
|
||||||
|
if ($branch_id) {
|
||||||
|
|
||||||
|
$contact_data = $this->prepareContactData($data, $branch_id);
|
||||||
|
$this->levelContactModel->insert($contact_data);
|
||||||
|
|
||||||
|
$this->createClientPolicyWithLeadData($data, $client_id, $branch_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $branch_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function prepareClientBranchData($data, $client_id)
|
||||||
|
{
|
||||||
|
$default_unit = trim(($data['client_short_name'] ?? '') . '-' . ($data['branch_code'] ?? ''), '-');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'client_id' => $client_id,
|
||||||
|
'branch_name' => $data['branch_name'],
|
||||||
|
'branch_code' => $data['branch_code'],
|
||||||
|
'gst' => $data['gst'],
|
||||||
|
'units' => json_encode([$default_unit]),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepareContactData($data, $branch_id)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $data['contact_person_name'],
|
||||||
|
'mobile' => $data['contact_person_mobile'],
|
||||||
|
'email' => $data['contact_person_email'],
|
||||||
|
'contact_type' => 'client',
|
||||||
|
'ref_id' => $branch_id,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createClientPolicyWithLeadData($data, $client_id, $branch_id)
|
||||||
|
{
|
||||||
|
$client_policy_data = $this->prepareClientPolicyData($data, $client_id, $branch_id);
|
||||||
|
return $this->clientPolicyModel->insert($client_policy_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepareClientPolicyData($data, $client_id, $branch_id)
|
||||||
|
{
|
||||||
|
$client_policy_data = [
|
||||||
|
'client_id' => $client_id,
|
||||||
|
'client_branch_id' => $branch_id,
|
||||||
|
'policy_type_id' => $data['policy_type_id'],
|
||||||
|
'insurer_id' => $data['insurer_id'],
|
||||||
|
'insurer_branch_id' => $data['insurer_branch_id'],
|
||||||
|
'tpa_id' => $data['tpa_id'],
|
||||||
|
'tpa_branch_id' => $data['tpa_branch_id'],
|
||||||
|
'policy_start_date' => $data['policy_start_date'],
|
||||||
|
'policy_end_date' => $data['policy_end_date'],
|
||||||
|
'policy_status' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$policy_type_id = $data['policy_type_id'];
|
||||||
|
if (in_array($policy_type_id, [1, 2, 6, 7])) {
|
||||||
|
$client_policy_data['is_addon'] = 1; // Base Policy
|
||||||
|
} elseif (in_array($policy_type_id, [4, 5])) {
|
||||||
|
$client_policy_data['is_addon'] = 2; // SI TOPUP
|
||||||
|
} elseif ($policy_type_id == 3) {
|
||||||
|
// if ($base_policy) {
|
||||||
|
// $data['is_addon'] = 3; // Dependent Addon
|
||||||
|
// } else {
|
||||||
|
$data['is_addon'] = 1;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
return $client_policy_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function preparePolicyTermsFromRFQ($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,8 @@ use App\Models\InsurerExcelExportTemplateModel;
|
|||||||
use App\Models\SettingsModel;
|
use App\Models\SettingsModel;
|
||||||
use App\Models\VehicleModel;
|
use App\Models\VehicleModel;
|
||||||
|
|
||||||
|
use CodeIgniter\CLI\CLI;
|
||||||
|
|
||||||
class MasterController extends AdminController
|
class MasterController extends AdminController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
@ -1603,13 +1605,42 @@ class MasterController extends AdminController
|
|||||||
//testing a sample mail from cli
|
//testing a sample mail from cli
|
||||||
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
|
||||||
// print_r($email_id);die();
|
// print_r($email_id);die();
|
||||||
// $gmailapi = \Config\Services::gmailapi();
|
// $gmailapi = \Config\Services::gmailapi();
|
||||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => 'This is sample mail sent via CLI mode']);
|
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
|
||||||
|
// $attachments = [
|
||||||
|
// ["filePath" => WRITEPATH."uploads/excel/sample/correction.xls","fileName" => "correction.xls"],
|
||||||
|
// ["filePath" => WRITEPATH."uploads/excel/sample/deletion.xls","fileName" => "deletion.xls"],
|
||||||
|
// ["filePath" => "C:\\Users\\Venba\\Desktop\\IQ.pdf","fileName" => "Questions.pdf"],
|
||||||
|
// ["filePath" => "C:\\Users\\Venba\\Desktop\\config_age.png","fileName" => "config_age.png"]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
$attachments = [
|
||||||
|
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||||
|
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||||
|
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
|
||||||
|
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments]);
|
||||||
print_r($res);
|
print_r($res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCheckBounceMails()
|
||||||
|
{
|
||||||
|
$gmailapi = \Config\Services::gmailapi();
|
||||||
|
$from_date = CLI::getOption('from') ? CLI::getOption('from') : null;
|
||||||
|
$to_date = CLI::getOption('to') ? CLI::getOption('to') : null;
|
||||||
|
$count = CLI::getOption('count') ? CLI::getOption('count') : null;
|
||||||
|
$page = CLI::getOption('page') ? CLI::getOption('page') : null;
|
||||||
|
$res = $gmailapi->checkBounceStatus(from_date:$from_date,to_date:$to_date,count:$count,page:$page);
|
||||||
|
print_r($res);
|
||||||
|
}
|
||||||
|
|
||||||
public function appCheckList()
|
public function appCheckList()
|
||||||
{
|
{
|
||||||
@ -1638,7 +1669,9 @@ class MasterController extends AdminController
|
|||||||
'uploads' => ROOTPATH . 'public/uploads',
|
'uploads' => ROOTPATH . 'public/uploads',
|
||||||
'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/',//adverdisement images for enrollment app
|
'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/',//adverdisement images for enrollment app
|
||||||
'logo' => ROOTPATH . 'public/uploads/logo/',
|
'logo' => ROOTPATH . 'public/uploads/logo/',
|
||||||
'template_bg' => ROOTPATH . 'public/uploads/template_bg/'
|
'template_bg' => ROOTPATH . 'public/uploads/template_bg/',
|
||||||
|
'attachments' => WRITEPATH . 'uploads/attachments/',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($folders as $folderName => $folderPath) {
|
foreach ($folders as $folderName => $folderPath) {
|
||||||
@ -1672,7 +1705,7 @@ class MasterController extends AdminController
|
|||||||
echo "Check the following..!\n";
|
echo "Check the following..!\n";
|
||||||
echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n";
|
echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n";
|
||||||
echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n";
|
echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n";
|
||||||
echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n";
|
echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli --to someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,6 +16,7 @@ use App\Models\NotificationModel;
|
|||||||
use App\Models\ClientModel;
|
use App\Models\ClientModel;
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
|
use App\Models\MailAttachmentModel;
|
||||||
|
|
||||||
use App\Helpers\sendMailNotification;
|
use App\Helpers\sendMailNotification;
|
||||||
use App\Helpers\MailHelper;
|
use App\Helpers\MailHelper;
|
||||||
@ -26,12 +27,14 @@ class NotificationController extends AdminController
|
|||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
protected $notificationModel;
|
protected $notificationModel;
|
||||||
protected $clientModel;
|
protected $clientModel;
|
||||||
|
protected $MailAttachmentModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
$this->notificationModel = new NotificationModel();
|
$this->notificationModel = new NotificationModel();
|
||||||
$this->clientModel = new ClientModel();
|
$this->clientModel = new ClientModel();
|
||||||
|
$this->MailAttachmentModel = new MailAttachmentModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is for Template Name Camel Case to Snake Case for store in DB
|
// This is for Template Name Camel Case to Snake Case for store in DB
|
||||||
@ -52,16 +55,21 @@ class NotificationController extends AdminController
|
|||||||
$notificationModel = new NotificationModel();
|
$notificationModel = new NotificationModel();
|
||||||
|
|
||||||
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
||||||
|
|
||||||
if ($find_notification) {
|
if ($find_notification) {
|
||||||
|
|
||||||
$id = $find_notification['id'];
|
$id = $find_notification['id'];
|
||||||
$form_data['updated_by'] = get_session_userid();
|
$form_data['updated_by'] = get_session_userid();
|
||||||
$notificationModel->update($id,$form_data);
|
$notificationModel->update($id,$form_data);
|
||||||
$complete = "Update";
|
$complete = "Update";
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$form_data['created_by'] = get_session_userid();
|
$form_data['created_by'] = get_session_userid();
|
||||||
$notificationModel->insert($form_data);
|
$notificationModel->insert($form_data);
|
||||||
$complete = "Inserted";
|
$complete = "Inserted";
|
||||||
}
|
}
|
||||||
|
|
||||||
return json_encode($complete);
|
return json_encode($complete);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -111,8 +119,11 @@ class NotificationController extends AdminController
|
|||||||
public function getMailTemplateData($template_name,$client_id)
|
public function getMailTemplateData($template_name,$client_id)
|
||||||
{
|
{
|
||||||
$notificationModel = new NotificationModel();
|
$notificationModel = new NotificationModel();
|
||||||
|
|
||||||
$value = $notificationModel->where('client_id',$client_id)->where('template_name',$template_name)->first();
|
$value = $notificationModel->where('client_id',$client_id)->where('template_name',$template_name)->first();
|
||||||
|
if($value){
|
||||||
|
$value['data'] = $this->MailAttachmentModel->where('notification_id', $value['id'])->where('is_active', 1)->findAll();
|
||||||
|
}
|
||||||
|
// return $this->respond(['status' => true, 'code' => 200, '' => 'Attachment deleted successfully'], 200);
|
||||||
|
|
||||||
return json_encode($value);
|
return json_encode($value);
|
||||||
}
|
}
|
||||||
@ -198,4 +209,74 @@ class NotificationController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function insertAttachmentsForMailTemplates()
|
||||||
|
{
|
||||||
|
$form_data = $this->request->getPost();
|
||||||
|
|
||||||
|
// Check if client_id and template_name are provided
|
||||||
|
if (empty($form_data['client_id']) || empty($form_data['template_name'])) {
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Client ID and template name are required.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to find the notification
|
||||||
|
$find_notification = $this->notificationModel->where('client_id', $form_data['client_id'])
|
||||||
|
->where('template_name', $form_data['template_name'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$find_notification) {
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Notification data not found.'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define upload path and attempt file upload
|
||||||
|
$uploadFilePath = WRITEPATH . 'uploads/attachments';
|
||||||
|
$uploadedFile = $this->request->getFile('file');
|
||||||
|
$fileName = file_Upload($uploadedFile, $uploadFilePath); // Assume file_Upload handles file saving
|
||||||
|
|
||||||
|
if ($fileName) {
|
||||||
|
// Prepare data for insertion
|
||||||
|
$data = [
|
||||||
|
'notification_id' => $find_notification['id'],
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'file_path' => 'uploads/attachments/' . $fileName,
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Insert file attachment record
|
||||||
|
if ($this->MailAttachmentModel->insert($data)) {
|
||||||
|
// Retrieve active attachments to return in response
|
||||||
|
$attachment_data = $this->MailAttachmentModel->where('is_active', 1)->findAll();
|
||||||
|
return $this->respond([
|
||||||
|
'status' => true,
|
||||||
|
'code' => 200,
|
||||||
|
'data' => $attachment_data,
|
||||||
|
'message' => 'File uploaded successfully'
|
||||||
|
], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'code' => 500, 'message' => 'Failed to save file attachment data.'], 500);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'File upload failed.'], 400);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeAttachmentsForMailTemplates($id, $client_id, $template_name)
|
||||||
|
{
|
||||||
|
$attachment_data_for_unlink_file = $this->MailAttachmentModel->where('id', $id)->first();
|
||||||
|
$file_path = WRITEPATH . $attachment_data_for_unlink_file['file_path'];
|
||||||
|
|
||||||
|
if ($this->MailAttachmentModel->where('id', $id)->delete()) {
|
||||||
|
|
||||||
|
unlink($file_path);
|
||||||
|
|
||||||
|
$find_notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', $template_name)->first();
|
||||||
|
$attachmentDatas = $this->MailAttachmentModel->where('notification_id', $find_notification['id'])->where('is_active', 1)->findAll();
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Attachment deleted successfully', 'data' => $attachmentDatas], 200);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'The Client has active policy'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -93,6 +93,7 @@ class MailHelper
|
|||||||
$emaill = $params['mail'];
|
$emaill = $params['mail'];
|
||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
|
$attachments = isset($params['attachments']) && count($params['attachments']) ? $params['attachments'] : [];
|
||||||
|
|
||||||
//check BCC mail
|
//check BCC mail
|
||||||
if (isset($params['bcc'])) {
|
if (isset($params['bcc'])) {
|
||||||
@ -118,7 +119,7 @@ class MailHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc);
|
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc,$attachments);
|
||||||
|
|
||||||
if($res['status'])
|
if($res['status'])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -972,3 +972,39 @@ if(!function_exists('query_construct_second_stage')){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('generateExcelWithHeader')) {
|
||||||
|
/**
|
||||||
|
* Generate an Excel file with the specified headers
|
||||||
|
*
|
||||||
|
* @param array $header The header row for the Excel file
|
||||||
|
* @param string $filename The name of the Excel file to be created
|
||||||
|
* @return string Path to the generated Excel file
|
||||||
|
*/
|
||||||
|
function generateExcelWithHeader(array $header, string $filename = 'InceptionHeader.xlsx')
|
||||||
|
{
|
||||||
|
// Create a new Spreadsheet
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// Set header row
|
||||||
|
$column = 'A';
|
||||||
|
foreach ($header as $headerText) {
|
||||||
|
$sheet->setCellValue($column . '1', $headerText);
|
||||||
|
$column++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Style the header row (optional)
|
||||||
|
// $sheet->getStyle('A1:' . $column . '1')->getFont()->setBold(true);
|
||||||
|
// $sheet->getStyle('A1:' . $column . '1')->getAlignment()->setHorizontal('center');
|
||||||
|
|
||||||
|
// Define the file path
|
||||||
|
$filePath = WRITEPATH . 'uploads/' . $filename; // WRITEPATH is typically for writable directories
|
||||||
|
|
||||||
|
// Save the file
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($filePath);
|
||||||
|
|
||||||
|
return $filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1646,7 +1646,7 @@ if(!function_exists('get_premium_for_si'))
|
|||||||
// dd($slab_details);
|
// dd($slab_details);
|
||||||
foreach ($slab_details as $skey => $slab_value)
|
foreach ($slab_details as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['unit'] == $unit && $slab_value['max_si'] == 0)
|
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['unit'] == $unit)
|
||||||
{
|
{
|
||||||
return $slab_value['premium'];
|
return $slab_value['premium'];
|
||||||
}
|
}
|
||||||
@ -1800,7 +1800,7 @@ if(!function_exists('transform_enrollment_row_to_inception_row'))
|
|||||||
$res[4] = $row[4]; // inception: gender (Gender) -> enrollment: gender (Gender)
|
$res[4] = $row[4]; // inception: gender (Gender) -> enrollment: gender (Gender)
|
||||||
$res[5] = $row[5]; // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
$res[5] = $row[5]; // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
||||||
$res[6] = $row[9]; // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
$res[6] = $row[9]; // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
||||||
$res[7] = null; // inception: doc (Date of Coverage) -> No match in enrollment
|
$res[7] = $row[13]; // inception: doc (Date of Coverage) -> No match in enrollment
|
||||||
$res[8] = $row[3]; // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
$res[8] = $row[3]; // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
||||||
$res[9] = $row[11]; // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
$res[9] = $row[11]; // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
||||||
$res[10] = $row[10]; // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
$res[10] = $row[10]; // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
||||||
@ -2120,3 +2120,23 @@ if(!function_exists('group_slab_rates_basedon_name'))
|
|||||||
return $temp_slab_rates;
|
return $temp_slab_rates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//this key generating mandantory for display employee info in enrolment app w/o error
|
||||||
|
if(!function_exists('generate_family_floater_key'))
|
||||||
|
{
|
||||||
|
function generate_family_floater_key($relationship)
|
||||||
|
{
|
||||||
|
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
||||||
|
$relation = 'parent';
|
||||||
|
} else if(strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter'){
|
||||||
|
$relation = 'child';
|
||||||
|
}else if(strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law'){
|
||||||
|
$relation = 'parent_in_law';
|
||||||
|
}else if(strtolower(trim($relationship)) === 'spouse'){
|
||||||
|
$relation = 'spouse';
|
||||||
|
}else{
|
||||||
|
$relation = 'self';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ use App\Models\UserModel;
|
|||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
use App\Models\PolicyPremium1Model;
|
use App\Models\PolicyPremium1Model;
|
||||||
use App\Models\PolicyPremium2Model;
|
use App\Models\PolicyPremium2Model;
|
||||||
|
use App\Models\MailAttachmentModel;
|
||||||
|
|
||||||
class sendMailNotification
|
class sendMailNotification
|
||||||
{
|
{
|
||||||
@ -22,6 +23,21 @@ class sendMailNotification
|
|||||||
$notification = $params['notification'];
|
$notification = $params['notification'];
|
||||||
$client_data = $params['client_data'];
|
$client_data = $params['client_data'];
|
||||||
|
|
||||||
|
$mailAttachmentModel = new MailAttachmentModel();
|
||||||
|
$attachment_data = $mailAttachmentModel
|
||||||
|
->select('file_path, file_name')
|
||||||
|
->where('notification_id', $notification['id'])
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$attachments = [];
|
||||||
|
foreach ($attachment_data as $data) {
|
||||||
|
$attachments[] = [
|
||||||
|
"filePath" => WRITEPATH . $data['file_path'],
|
||||||
|
"fileName" => $data['file_name']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$mail = $dataToInsert['email_corporate'];
|
$mail = $dataToInsert['email_corporate'];
|
||||||
$subject = $notification['subject'];
|
$subject = $notification['subject'];
|
||||||
$app_link = $_ENV['App_Url'];
|
$app_link = $_ENV['App_Url'];
|
||||||
@ -37,7 +53,7 @@ class sendMailNotification
|
|||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
@ -801,6 +817,23 @@ class sendMailNotification
|
|||||||
$mail_content = $notification['mail_content'];
|
$mail_content = $notification['mail_content'];
|
||||||
$subject = $notification['subject'];
|
$subject = $notification['subject'];
|
||||||
|
|
||||||
|
$mailAttachmentModel = new MailAttachmentModel();
|
||||||
|
$attachment_data = $mailAttachmentModel
|
||||||
|
->select('file_path, file_name')
|
||||||
|
->where('notification_id', $notification['id'])
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$attachments = [];
|
||||||
|
foreach ($attachment_data as $data) {
|
||||||
|
$attachments[] = [
|
||||||
|
"filePath" => WRITEPATH . $data['file_path'],
|
||||||
|
"fileName" => $data['file_name']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($attachments); die;
|
||||||
|
|
||||||
$employee_name = 'John Doe';
|
$employee_name = 'John Doe';
|
||||||
|
|
||||||
$app_link = $_ENV['App_Url'];
|
$app_link = $_ENV['App_Url'];
|
||||||
@ -816,7 +849,7 @@ class sendMailNotification
|
|||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
if ($mail != null || $mail != '') {
|
if ($mail != null || $mail != '') {
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|||||||
@ -26,18 +26,20 @@ class GmailAPI
|
|||||||
'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
|
'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
|
||||||
'https://www.googleapis.com/auth/gmail.readonly',
|
'https://www.googleapis.com/auth/gmail.readonly',
|
||||||
'https://www.googleapis.com/auth/gmail.labels',
|
'https://www.googleapis.com/auth/gmail.labels',
|
||||||
'https://www.googleapis.com/auth/gmail.send'
|
'https://www.googleapis.com/auth/gmail.send',
|
||||||
|
'https://mail.google.com/'
|
||||||
]);
|
]);
|
||||||
$this->setAuthConfig();
|
$this->setAuthConfig();
|
||||||
//die();
|
//die();
|
||||||
$this->client->setAccessType('offline');
|
$this->client->setAccessType('offline');
|
||||||
$this->client->setPrompt('select_account consent');
|
$this->client->setPrompt('select_account consent');
|
||||||
|
// echo uri_string();//die();
|
||||||
if (php_sapi_name() !== 'cli' || (uri_string() == 'cli/send_mail_cli' || uri_string() == 'cli/processjob') )
|
if (php_sapi_name() !== 'cli' || (uri_string() == 'cli/send_mail_cli' || uri_string() == 'cli/processjob' || uri_string() == 'cli/check_bounce_mail_cli') )
|
||||||
{
|
{
|
||||||
|
// echo 'getting token';die();
|
||||||
$this->setTokenFromDB(); // Call only if not in CLI
|
$this->setTokenFromDB(); // Call only if not in CLI
|
||||||
}
|
}
|
||||||
|
// die();
|
||||||
$this->service = new Gmail($this->client);
|
$this->service = new Gmail($this->client);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -99,10 +101,12 @@ class GmailAPI
|
|||||||
$settingsModel->where('id', 1)->set([$this->tokenField => $token])->update();
|
$settingsModel->where('id', 1)->set([$this->tokenField => $token])->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [])
|
public function createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [], $attachments = [])
|
||||||
{
|
{
|
||||||
$boundary = uniqid(rand(), true);
|
// print_r($to);die();
|
||||||
|
$boundary = uniqid(rand(), true); // Unique boundary for separating parts
|
||||||
|
|
||||||
|
// Initialize raw message headers
|
||||||
$rawMessageString = "From: $from\r\n";
|
$rawMessageString = "From: $from\r\n";
|
||||||
$rawMessageString .= "To: $to\r\n";
|
$rawMessageString .= "To: $to\r\n";
|
||||||
$rawMessageString .= "Reply-To: $replyTo\r\n";
|
$rawMessageString .= "Reply-To: $replyTo\r\n";
|
||||||
@ -117,26 +121,53 @@ class GmailAPI
|
|||||||
|
|
||||||
$rawMessageString .= "Subject: $subject\r\n";
|
$rawMessageString .= "Subject: $subject\r\n";
|
||||||
$rawMessageString .= "MIME-Version: 1.0\r\n";
|
$rawMessageString .= "MIME-Version: 1.0\r\n";
|
||||||
$rawMessageString .= "Content-Type: multipart/alternative; boundary=\"$boundary\"\r\n\r\n";
|
$rawMessageString .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n\r\n";
|
||||||
|
|
||||||
|
// Add HTML content as an alternative part
|
||||||
$rawMessageString .= "--$boundary\r\n";
|
$rawMessageString .= "--$boundary\r\n";
|
||||||
$rawMessageString .= "Content-Type: text/html; charset=UTF-8\r\n";
|
$rawMessageString .= "Content-Type: text/html; charset=UTF-8\r\n";
|
||||||
$rawMessageString .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
|
$rawMessageString .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
|
||||||
$rawMessageString .= $htmlContent . "\r\n";
|
$rawMessageString .= $htmlContent . "\r\n\r\n";
|
||||||
|
|
||||||
|
// Process each attachment
|
||||||
|
foreach ($attachments as $attachment) {
|
||||||
|
$filePath = $attachment['filePath'];
|
||||||
|
$fileName = $attachment['fileName'];
|
||||||
|
$fileData = file_get_contents($filePath);
|
||||||
|
|
||||||
|
if ($fileData === false) {
|
||||||
|
continue; // Skip this attachment if file cannot be read
|
||||||
|
}
|
||||||
|
|
||||||
|
$base64File = base64_encode($fileData);
|
||||||
|
|
||||||
|
// Add each attachment with appropriate headers
|
||||||
|
$rawMessageString .= "--$boundary\r\n";
|
||||||
|
$rawMessageString .= "Content-Type: application/octet-stream; name=\"$fileName\"\r\n";
|
||||||
|
$rawMessageString .= "Content-Disposition: attachment; filename=\"$fileName\"\r\n";
|
||||||
|
$rawMessageString .= "Content-Transfer-Encoding: base64\r\n\r\n";
|
||||||
|
$rawMessageString .= chunk_split($base64File) . "\r\n\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// End boundary to signify the end of the message
|
||||||
$rawMessageString .= "--$boundary--";
|
$rawMessageString .= "--$boundary--";
|
||||||
|
|
||||||
|
// Encode the final raw message in base64 for Gmail API
|
||||||
$rawMessage = base64_encode($rawMessageString);
|
$rawMessage = base64_encode($rawMessageString);
|
||||||
$rawMessage = str_replace(['+', '/', '='], ['-', '_', ''], $rawMessage);
|
$rawMessage = str_replace(['+', '/', '='], ['-', '_', ''], $rawMessage);
|
||||||
|
|
||||||
|
// Create Gmail message object
|
||||||
$message = new Message();
|
$message = new Message();
|
||||||
$message->setRaw($rawMessage);
|
$message->setRaw($rawMessage);
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [])
|
|
||||||
|
public function sendMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [],$attachments = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$message = $this->createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc, $bcc);
|
$message = $this->createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc, $bcc,$attachments);
|
||||||
$res = $this->service->users_messages->send('me', $message);
|
$res = $this->service->users_messages->send('me', $message);
|
||||||
return array('status' => true, 'data' => $res);
|
return array('status' => true, 'data' => $res);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -177,4 +208,59 @@ class GmailAPI
|
|||||||
$this->myLogger->logme('error', 'New token generated and stored in the database.');
|
$this->myLogger->logme('error', 'New token generated and stored in the database.');
|
||||||
print 'New token generated and stored in the database.';
|
print 'New token generated and stored in the database.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function checkBounceStatus( string $userId = 'me',string $from_date = null,string $to_date = null,int $count = null,string $page = null)
|
||||||
|
{
|
||||||
|
$query = 'from:mailer-daemon OR "delivery failed" OR "failure notice"';
|
||||||
|
if($from_date != '' && $to_date != '')
|
||||||
|
{
|
||||||
|
$query .= 'after:' . $from_date . ' before:' . $to_date;
|
||||||
|
}
|
||||||
|
$maxResults = $count ? $count : 20;
|
||||||
|
$pageToken = $page ? $page : null;
|
||||||
|
|
||||||
|
$params = ['q' => $query,'maxResults' => $maxResults];
|
||||||
|
if(isset($pageToken)){ $params['pageToken'] = $pageToken; }
|
||||||
|
$messages = $this->service->users_messages->listUsersMessages($userId, $params);
|
||||||
|
|
||||||
|
$bounceDetails = [];
|
||||||
|
$pageToken = $messages->getNextPageToken();
|
||||||
|
$bounceDetails['pageToken'] = $pageToken;
|
||||||
|
if (count($messages->getMessages()) > 0) {
|
||||||
|
foreach ($messages->getMessages() as $message) {
|
||||||
|
// Get full message details
|
||||||
|
$msg = $this->service->users_messages->get($userId, $message->getId(), ['format' => 'full']);
|
||||||
|
|
||||||
|
// Extract important headers and content
|
||||||
|
$headers = $msg->getPayload()->getHeaders();
|
||||||
|
$subject = null;
|
||||||
|
$date = null;
|
||||||
|
$to = null;
|
||||||
|
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if ($header->getName() === 'Subject') {
|
||||||
|
$subject = $header->getValue();
|
||||||
|
}
|
||||||
|
if ($header->getName() === 'Date') {
|
||||||
|
$date = $header->getValue();
|
||||||
|
}
|
||||||
|
if ($header->getName() === 'To') {
|
||||||
|
$to = $header->getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$bounceDetails['data'][] = [
|
||||||
|
'subject' => $subject,
|
||||||
|
'date' => $date,
|
||||||
|
'to' => $to,
|
||||||
|
'snippet' => $msg->getSnippet(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bounceDetails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,8 +76,9 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="")
|
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=[], $branch_id=0, $emp_code="", $emp_name="")
|
||||||
{
|
{
|
||||||
|
// dd($status);
|
||||||
|
|
||||||
$result = $this->select([
|
$result = $this->select([
|
||||||
'employee_polices.*',
|
'employee_polices.*',
|
||||||
@ -90,6 +91,7 @@ class EmployeePolicyModel extends Model
|
|||||||
'tpab.branch_code as tpa_branch_code',
|
'tpab.branch_code as tpa_branch_code',
|
||||||
'cm.client_name',
|
'cm.client_name',
|
||||||
'cm.short_name as client_short_name',
|
'cm.short_name as client_short_name',
|
||||||
|
'emp.id as employee_primary_id',
|
||||||
'emp.relationship',
|
'emp.relationship',
|
||||||
'emp.relationship_code',
|
'emp.relationship_code',
|
||||||
'emp.change_event',
|
'emp.change_event',
|
||||||
@ -97,6 +99,7 @@ class EmployeePolicyModel extends Model
|
|||||||
'emp.name',
|
'emp.name',
|
||||||
'emp.email_corporate',
|
'emp.email_corporate',
|
||||||
'emp.dob',
|
'emp.dob',
|
||||||
|
'DATE_FORMAT(emp.dob, "%d/%m/%Y") AS formatted_dob',
|
||||||
'emp.gender',
|
'emp.gender',
|
||||||
'emp.emp_status',
|
'emp.emp_status',
|
||||||
'emp.is_active as emp_is_active',
|
'emp.is_active as emp_is_active',
|
||||||
@ -132,17 +135,39 @@ class EmployeePolicyModel extends Model
|
|||||||
if ($policy_id !=0 && !empty($policy_id)) {
|
if ($policy_id !=0 && !empty($policy_id)) {
|
||||||
$result->where('employee_polices.client_policy_id', $policy_id);
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
}
|
}
|
||||||
if ($status !=0 && !empty($status)) {
|
|
||||||
if($status == 'active'){
|
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.tpa_id IS NOT NULL');
|
||||||
$result->where('employee_polices.uhid IS NOT NULL');
|
$result->where('employee_polices.uhid IS NOT NULL');
|
||||||
}else if($status == 'pending'){
|
$result->whereIn('employee_polices.status', $status);
|
||||||
$status = 'active';
|
|
||||||
$result->where('employee_polices.status', $status);
|
} elseif (in_array("pending", $status)) {
|
||||||
}else{
|
|
||||||
$result->where('employee_polices.status', $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)) {
|
if (!empty($emp_code)) {
|
||||||
$result->where('emp.emp_code', $emp_code);
|
$result->where('emp.emp_code', $emp_code);
|
||||||
}
|
}
|
||||||
@ -157,6 +182,27 @@ class EmployeePolicyModel extends Model
|
|||||||
return $result->findAll();
|
return $result->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmployeePolicyForEcard($policy_id = 0)
|
||||||
|
{
|
||||||
|
$result = $this->select([
|
||||||
|
'employee_polices.id'
|
||||||
|
])
|
||||||
|
->join('employees emp', 'employee_polices.employee_id = emp.id AND emp.relationship = "Self" ');
|
||||||
|
if ($policy_id !=0 && !empty($policy_id)) {
|
||||||
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
|
}
|
||||||
|
// Always check these conditions
|
||||||
|
$result->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.tpa_id is not null')
|
||||||
|
->where('emp.relationship','Self');
|
||||||
|
|
||||||
|
return $result->findAll();
|
||||||
|
// $result->findAll();
|
||||||
|
// print_r($this->db->getLastQuery());die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//for emp onboard do not change
|
//for emp onboard do not change
|
||||||
public function checkExistingEmpPolicy($arr)
|
public function checkExistingEmpPolicy($arr)
|
||||||
{
|
{
|
||||||
@ -508,6 +554,27 @@ class EmployeePolicyModel extends Model
|
|||||||
$client_branch_id = $ref_data['client_branch_id'];
|
$client_branch_id = $ref_data['client_branch_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
|
|
||||||
|
$get_insurer_id_from_client_policy = $this->db->table('client_policy')
|
||||||
|
->select('insurer_id')
|
||||||
|
->where('id', $client_policy_id)
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
$add_one_day = 0;
|
||||||
|
|
||||||
|
if (!empty($get_insurer_id_from_client_policy)) {
|
||||||
|
|
||||||
|
$get_the_insurer_add_one_for_delete = $this->db->table('insurers')
|
||||||
|
->select('deletion_add_day')
|
||||||
|
->where('id', $get_insurer_id_from_client_policy['insurer_id'])
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
if (!empty($get_the_insurer_add_one_for_delete) && $get_the_insurer_add_one_for_delete['deletion_add_day'] == 1) {
|
||||||
|
$add_one_day = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
a.id as endorsement_primarykey,
|
a.id as endorsement_primarykey,
|
||||||
@ -547,10 +614,10 @@ class EmployeePolicyModel extends Model
|
|||||||
deletiondata.reasonforexit,
|
deletiondata.reasonforexit,
|
||||||
deletiondata.status,
|
deletiondata.status,
|
||||||
|
|
||||||
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days,
|
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + '$add_one_day' AS no_of_days,
|
||||||
ROUND((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
|
ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2) AS pro_rata_premium,
|
||||||
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
|
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2) AS gst,
|
||||||
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
|
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) + (((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2) AS total
|
||||||
FROM
|
FROM
|
||||||
emp_endorsement a
|
emp_endorsement a
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
@ -806,8 +873,8 @@ class EmployeePolicyModel extends Model
|
|||||||
->where('emp.client_id',$client_id)
|
->where('emp.client_id',$client_id)
|
||||||
->where('employee_polices.client_policy_id',$policy_id);
|
->where('employee_polices.client_policy_id',$policy_id);
|
||||||
|
|
||||||
$result->whereIn('employee_polices.status', ['draft', 'enrolled']);
|
$result->whereIn('employee_polices.status', ['enrolled']);
|
||||||
$result->whereIn('emp.emp_status', ['draft', 'enrolled']);
|
$result->whereIn('emp.emp_status', ['enrolled']);
|
||||||
$result = $result->findAll();
|
$result = $result->findAll();
|
||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
@ -845,7 +912,7 @@ class EmployeePolicyModel extends Model
|
|||||||
e.doj,
|
e.doj,
|
||||||
e.band,
|
e.band,
|
||||||
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||||
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
|
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.' LIMIT 1) AS self,
|
||||||
|
|
||||||
|
|
||||||
ep.tpa_id,
|
ep.tpa_id,
|
||||||
@ -910,7 +977,7 @@ class EmployeePolicyModel extends Model
|
|||||||
e.doj,
|
e.doj,
|
||||||
e.band,
|
e.band,
|
||||||
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||||
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
|
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.' LIMIT 1) AS self,
|
||||||
|
|
||||||
|
|
||||||
ep.tpa_id,
|
ep.tpa_id,
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class LeadsModel extends Model
|
|||||||
'branch_code',
|
'branch_code',
|
||||||
'contact_person_name',
|
'contact_person_name',
|
||||||
'contact_person_mobile',
|
'contact_person_mobile',
|
||||||
|
'contact_person_email',
|
||||||
'client_id',
|
'client_id',
|
||||||
'client_branch_id',
|
'client_branch_id',
|
||||||
'source_policy_id',
|
'source_policy_id',
|
||||||
@ -85,24 +86,46 @@ class LeadsModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLeadDataForLising(){
|
public function getLeadDataForLising()
|
||||||
|
{
|
||||||
|
|
||||||
return $this->select('
|
return $this->select('
|
||||||
leads.*,
|
leads.*,
|
||||||
kyc_entity_type.name as entity_type,
|
kyc_entity_type.name as entity_type,
|
||||||
policy_type.policy_type,
|
policy_type.policy_type,
|
||||||
user_profiles.first_name as salse_person_name
|
user_profiles.first_name as salse_person_name,
|
||||||
|
|
||||||
|
(
|
||||||
|
SELECT COUNT(*) AS qcr_count
|
||||||
|
FROM rfq
|
||||||
|
WHERE type = 2
|
||||||
|
AND is_active = 1 and lead_id = leads.id
|
||||||
|
) AS qcr_count,
|
||||||
|
|
||||||
|
(
|
||||||
|
SELECT COUNT(*) AS rfq_count
|
||||||
|
FROM rfq
|
||||||
|
WHERE type = 1
|
||||||
|
AND is_active = 1 and lead_id = leads.id
|
||||||
|
|
||||||
|
) AS rfq_count
|
||||||
')
|
')
|
||||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||||
->where('leads.is_active', 1)
|
->where('leads.is_active', 1)
|
||||||
->where('leads.is_active', 1)
|
|
||||||
->where('leads.is_active', 1)
|
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLeadForInsertClientList()
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->where('leads.is_active', 1)
|
||||||
|
->where('leads.status', 'won')
|
||||||
|
->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,4 +25,28 @@ class LevelContactModel extends Model
|
|||||||
"token_time_out"
|
"token_time_out"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function getContectForRFQ(){
|
||||||
|
|
||||||
|
$result = $this
|
||||||
|
|
||||||
|
->select('
|
||||||
|
level_contacts.id,
|
||||||
|
insurers.short_name as insurer_name,
|
||||||
|
insurer_branch.branch_code,
|
||||||
|
level_contacts.name as contect_person_name,
|
||||||
|
level_contacts.email as contect_person_email,
|
||||||
|
')
|
||||||
|
->join('insurer_branch', 'level_contacts.ref_id = insurer_branch.id')
|
||||||
|
->join('insurers', 'insurer_branch.insurer_id = insurers.id')
|
||||||
|
->where('level_contacts.contact_type', 'insurer')
|
||||||
|
->where('level_contacts.is_active', 1)
|
||||||
|
->where('insurer_branch.is_active', 1)
|
||||||
|
->where('insurers.is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
56
app/Models/MailAttachmentModel.php
Normal file
56
app/Models/MailAttachmentModel.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class MailAttachmentModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'mail_attachments';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id',
|
||||||
|
'notification_id',
|
||||||
|
'file_name',
|
||||||
|
'file_path',
|
||||||
|
'created_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_at',
|
||||||
|
'updated_by',
|
||||||
|
'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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,5 +22,6 @@ class PolicyTypeModel extends Model
|
|||||||
"etp",
|
"etp",
|
||||||
"iep",
|
"iep",
|
||||||
"itp",
|
"itp",
|
||||||
|
"question_json",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
60
app/Models/RFQModel.php
Normal file
60
app/Models/RFQModel.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class RFQModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'rfq';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id',
|
||||||
|
'type',
|
||||||
|
'lead_id',
|
||||||
|
'json',
|
||||||
|
'created_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_at',
|
||||||
|
'updated_by',
|
||||||
|
'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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||||
<td class="reload">
|
<td class="reload">
|
||||||
<?php echo date('d-M-Y H:i:a', strtotime($file['created_at'])) ?> by <?php echo get_username($file['created_by']) ?>
|
<?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') ?> by <?php echo get_username($file['created_by']) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($file['status'] == 'failed') { ?>
|
<?php if ($file['status'] == 'failed') { ?>
|
||||||
|
|||||||
@ -26,8 +26,11 @@ table.dataTable thead th {
|
|||||||
<div class="col-6" style="align-self: center;">
|
<div class="col-6" style="align-self: center;">
|
||||||
<h4 style="position: relative;">Client List</h4>
|
<h4 style="position: relative;">Client List</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
<div class="col-2" style="text-align: right; position: relative;top: 56px; left: 303px;">
|
||||||
<a href="<?= base_url("client/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
<a class="btn btn-primary waves-effect waves-light" onclick="showModal()">Add From Lead</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-1" style="text-align: right; position: relative;top: 56px; left: 294px;">
|
||||||
|
<a href="<?= base_url("client/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">Add</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||||
@ -81,13 +84,47 @@ table.dataTable thead th {
|
|||||||
<div id="append_client_info"></div>
|
<div id="append_client_info"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Center modal content -->
|
||||||
|
<div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="myCenterModalLabel">Lead List</h4>
|
||||||
|
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="lead_id"> Lead List <span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="lead_id" name="lead_id" required>
|
||||||
|
<option value="">Select Lead</option>
|
||||||
|
<?php if(isset($lead_data)) { ?>
|
||||||
|
<?php foreach ($lead_data as $value) { ?>
|
||||||
|
<option value="<?= $value['id']?>"><?= $value['client_name'] ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||||
|
<button type="submit" class="btn btn-primary" onclick="featchClient()">Featch Client</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#lead_id').select2();
|
||||||
|
})
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
|
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
buttons: [{
|
buttons: [{
|
||||||
@ -214,8 +251,47 @@ $(document).on('click', '.client_info_close', function() {
|
|||||||
$('#client_list').show();
|
$('#client_list').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function showModal(){
|
||||||
|
var myModal = new bootstrap.Modal(document.getElementById('lead_modal'));
|
||||||
|
myModal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function featchClient(){
|
||||||
|
|
||||||
|
let lead_id = $('#lead_id').val();
|
||||||
|
console.log('lead_id : ', lead_id)
|
||||||
|
let url = '<?= base_url('leads/featchLeadDataAndInsertClient/') ?>' + lead_id
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
console.log(res);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == true){
|
||||||
|
let client_url = '<?= base_url('client/list/') ?>'+res.client_id;
|
||||||
|
toastr.success(res.message, 'SUCCESS')
|
||||||
|
window.location.href = client_url
|
||||||
|
}else{
|
||||||
|
toastr.success(res.message, 'WARNING')
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.close').click()
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
$('.close').click()
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -67,6 +67,7 @@
|
|||||||
<th class="font-weight-medium">Name</th>
|
<th class="font-weight-medium">Name</th>
|
||||||
<th class="font-weight-medium">EMP Code</th>
|
<th class="font-weight-medium">EMP Code</th>
|
||||||
<th class="font-weight-medium">Relationship</th>
|
<th class="font-weight-medium">Relationship</th>
|
||||||
|
<th class="font-weight-medium">Gender</th>
|
||||||
<th class="font-weight-medium">Date of Birth</th>
|
<th class="font-weight-medium">Date of Birth</th>
|
||||||
<th class="font-weight-medium">Policy name</th>
|
<th class="font-weight-medium">Policy name</th>
|
||||||
<th class="font-weight-medium">Insurer name</th>
|
<th class="font-weight-medium">Insurer name</th>
|
||||||
@ -77,6 +78,7 @@
|
|||||||
<th class="font-weight-medium">(₹)Premium</th>
|
<th class="font-weight-medium">(₹)Premium</th>
|
||||||
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">(₹)Pro Rata <br> Premium</th>
|
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">(₹)Pro Rata <br> Premium</th>
|
||||||
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST</th>
|
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST</th>
|
||||||
|
<th class="font-weight-medium" > Action </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -100,6 +102,7 @@
|
|||||||
<td><?php echo $employee['name']; ?></td>
|
<td><?php echo $employee['name']; ?></td>
|
||||||
<td><?php echo $employee['emp_code']; ?></td>
|
<td><?php echo $employee['emp_code']; ?></td>
|
||||||
<td><?php echo $employee['relationship']; ?></td>
|
<td><?php echo $employee['relationship']; ?></td>
|
||||||
|
<td><?php echo $employee['gender']; ?></td>
|
||||||
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
||||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||||
<td><?php echo $employee['insurer_short_name']; ?></td>
|
<td><?php echo $employee['insurer_short_name']; ?></td>
|
||||||
@ -133,6 +136,26 @@
|
|||||||
<td><?php echo format_indian_number($employee['premium']); ?></td>
|
<td><?php echo format_indian_number($employee['premium']); ?></td>
|
||||||
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
|
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
|
||||||
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
|
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group dropdown">
|
||||||
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
|
||||||
|
<?php if(($employee['emp_status'] == 'draft' || $employee['emp_status'] == 'enrolled') && ($employee['status'] == 'draft' || $employee['status'] == 'enrolled')) { ?>
|
||||||
|
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_primary_id'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if($employee['policy_type'] == 'GMC' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||||
|
<a href="<?= base_url('download-e-card/'). $employee['rand_string'] ?>" class="dropdown-item" target="_blank"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View E-Card</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if($employee['policy_type'] == 'GMC' && $employee['relationship'] == 'Self' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||||
|
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } } ?>
|
<?php } } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -157,9 +180,11 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
<th></th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
<th><?php echo format_indian_number($pro_rata_total); ?></th>
|
<th><?php echo format_indian_number($pro_rata_total); ?></th>
|
||||||
<th><?php echo format_indian_number($gst_total); ?></th>
|
<th><?php echo format_indian_number($gst_total); ?></th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@ -168,7 +193,82 @@
|
|||||||
</div><!-- end col -->
|
</div><!-- end col -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- modal content -->
|
||||||
|
|
||||||
|
<div id="emp_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Edit Employee</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body p-4">
|
||||||
|
<form role="form" class="parsley-examples" id="empForm" onsubmit="update_emp_master_data_submit_function(event, this)" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<input type="hidden" name="employee_primary_id" id="employee_primary_id"/>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="emp_code">Employee Code<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="emp_code_for_edit" placeholder="Enter Code" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-8">
|
||||||
|
<label for="name">Name<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="name" placeholder="Ente Name" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="gender">Gender <span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="gender" name="gender" required disabled>
|
||||||
|
<option value="">Select Gender</option>
|
||||||
|
<option value="M">Male</option>
|
||||||
|
<option value="F">Female</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="dob">Date of Birth<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="dob" placeholder="Enter DOB" name="dob" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="email">Email<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="mobile">Mobile Number<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group text-right m-b-0">
|
||||||
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
var dob = flatpickr("#dob", {
|
||||||
|
dateFormat: "d/m/Y",
|
||||||
|
allowInput: false
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var ticketsTable = $('#tickets-table');
|
var ticketsTable = $('#tickets-table');
|
||||||
|
|
||||||
@ -198,4 +298,183 @@
|
|||||||
console.error("Table not found.");
|
console.error("Table not found.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function get_emp_master_data_for_update(input, id){
|
||||||
|
|
||||||
|
get_emp_master_data_for_update_ajax(id)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_emp_master_data_for_update_ajax(id){
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('util/get_emp_master_data_for_update/');?>'+id,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
console.log('get_emp_master_data_for_update response', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
let data = res.data
|
||||||
|
|
||||||
|
if(res.status == true){
|
||||||
|
|
||||||
|
if(data.relationship == 'Self'){
|
||||||
|
$('#gender').prop('disabled', false)
|
||||||
|
}else{
|
||||||
|
$('#gender').prop('disabled', true)
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#employee_primary_id').val(data.id);
|
||||||
|
$('#emp_code_for_edit').val(data.emp_code);
|
||||||
|
$('#name').val(data.name);
|
||||||
|
$('#gender').val(data.gender);
|
||||||
|
$('#dob').val(data.formatted_dob);
|
||||||
|
$('#email_corporate').val(data.email_corporate);
|
||||||
|
$('#mobile').val(data.mobile);
|
||||||
|
|
||||||
|
var myModal = new bootstrap.Modal(document.getElementById('emp_modal'));
|
||||||
|
myModal.show();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$('#employee_primary_id').val('');
|
||||||
|
$('#emp_code_for_edit').val('');
|
||||||
|
$('#name').val('');
|
||||||
|
$('#gender').val('');
|
||||||
|
$('#dob').val('');
|
||||||
|
$('#email_corporate').val('');
|
||||||
|
$('#mobile').val('');
|
||||||
|
|
||||||
|
toastr.warning(res.message, 'WARNING');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_emp_master_data_submit_function(event, form){
|
||||||
|
|
||||||
|
event.preventDefault(); // Prevent the default form submission
|
||||||
|
|
||||||
|
var isValid = $(form).parsley().validate();
|
||||||
|
if (!isValid) {
|
||||||
|
console.log('Form is Empty', 'Warning');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = new FormData(form);
|
||||||
|
|
||||||
|
const submitButton = form.querySelector('button[type="submit"]');
|
||||||
|
submitButton.disabled = true;
|
||||||
|
submitButton.innerText = 'Updating...';
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
// AJAX request to update the individual employee
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url('/util/update_emp_data') ?>',
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(response) {
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(response.status == true){
|
||||||
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
|
||||||
|
$('.close').click();
|
||||||
|
|
||||||
|
$('#employee_primary_id').val('');
|
||||||
|
$('#emp_code_for_edit').val('');
|
||||||
|
$('#name').val('');
|
||||||
|
$('#gender').val('');
|
||||||
|
$('#dob').val('');
|
||||||
|
$('#email_corporate').val('');
|
||||||
|
$('#mobile').val('');
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
toastr.error(response.message, 'ERROR');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// Handle error
|
||||||
|
console.error('Upload error occurred:');
|
||||||
|
console.error('Status: ', status); // Status of the request
|
||||||
|
console.error('Error: ', error); // Specific error message
|
||||||
|
console.error('XHR Object: ', xhr); // Full XHR object with response details
|
||||||
|
|
||||||
|
// Optionally log server response, if available
|
||||||
|
if (xhr.responseText) {
|
||||||
|
console.error('Response Text: ', xhr.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
|
toastr.warning('Error uploading file', 'WARNING');
|
||||||
|
console.error('Upload error:', error);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// Re-enable the submit button and reset its text
|
||||||
|
submitButton.disabled = false;
|
||||||
|
submitButton.innerText = 'Submit';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function send_mail_for_individual_employee_ecard(id){
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: '<?php echo base_url('util/send_mail_for_individual_employee_ecard/');?>'+id,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
console.log('send_mail_for_individual_employee_ecard response', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == true){
|
||||||
|
toastr.success(res.message, 'SUCCESS');
|
||||||
|
}else{
|
||||||
|
toastr.error(res.message, 'ERROR');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -7,6 +7,17 @@
|
|||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select2-selection__choice {
|
||||||
|
background-color: #0a8794 !important;
|
||||||
|
color: white !important;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-selection__choice__remove {
|
||||||
|
color: white !important;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -48,17 +59,22 @@ table.dataTable tbody td {
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Status</label> <br />
|
<label>Status</label> <br />
|
||||||
<select class="form-control" id="status2">
|
<select class="form-control" name="status2[]" id="status2" multiple>
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
<?php foreach($status as $key => $value) { ?>
|
<?php foreach($status as $key => $value) { ?>
|
||||||
<option value="<?= $key ?>"
|
<option value="<?= $key ?>"
|
||||||
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
<?php
|
||||||
|
if ((!isset($getData) || count($getData['status']) == 0) && $key == 'active') {
|
||||||
|
echo 'selected';
|
||||||
|
}
|
||||||
|
?>>
|
||||||
<?= $value ?>
|
<?= $value ?>
|
||||||
</option>
|
</option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Employee Code</label> <br />
|
<label>Employee Code</label> <br />
|
||||||
<input type="text" class="form-control" id="emp_code" name="emp_code" value="<?= isset($getData['emp_code']) && !empty($getData['emp_code']) ? $getData['emp_code'] : '' ?>">
|
<input type="text" class="form-control" id="emp_code" name="emp_code" value="<?= isset($getData['emp_code']) && !empty($getData['emp_code']) ? $getData['emp_code'] : '' ?>">
|
||||||
@ -70,8 +86,13 @@ table.dataTable tbody td {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row justify-content-end">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-auto">
|
||||||
|
<!-- <div id="categoryFilter_12"> -->
|
||||||
|
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualEcard(this)">Send Ecard</a>
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
<a href="<?= base_url("employee/list"); ?>"
|
<a href="<?= base_url("employee/list"); ?>"
|
||||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||||
@ -101,6 +122,13 @@ $(document).ready(function() {
|
|||||||
$("#policies").select2();
|
$("#policies").select2();
|
||||||
$("#branch_id").select2();
|
$("#branch_id").select2();
|
||||||
|
|
||||||
|
$("#status2").select2({
|
||||||
|
placeholder : 'Select Status'
|
||||||
|
});
|
||||||
|
|
||||||
|
$("textarea.select2-search__field").attr('rows', '1');
|
||||||
|
$("textarea.select2-search__field").css('resize', 'none');
|
||||||
|
|
||||||
// if ($('.select2-selection__arrow').length > 0) {
|
// if ($('.select2-selection__arrow').length > 0) {
|
||||||
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
|
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
|
||||||
// }
|
// }
|
||||||
@ -114,11 +142,22 @@ var clientPoliciesWithBranch = {
|
|||||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
|
var statusData = <?= json_encode(isset($getData['status']) ? $getData['status'] : []) ?>;
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Loop through each item in statusData and set the option as selected.
|
||||||
|
statusData.forEach(function(status) {
|
||||||
|
$('#status2 option[value="' + status + '"]').prop('selected', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Refresh the select element (necessary if you are using a plugin like Select2).
|
||||||
|
$('#status2').trigger('change');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
console.log("document loaded");
|
console.log("document loaded");
|
||||||
//fetchClientPolicies();
|
//fetchClientPolicies();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
@ -325,6 +364,11 @@ function fetchEmpolyeeList(event) {
|
|||||||
var emp_code = $('#emp_code').val();
|
var emp_code = $('#emp_code').val();
|
||||||
var emp_name = $('#emp_name').val();
|
var emp_name = $('#emp_name').val();
|
||||||
|
|
||||||
|
var statusArray = [];
|
||||||
|
$('#status2 option:selected').each(function() {
|
||||||
|
statusArray.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
// console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
// if (client_id == '0' || policy_id == '0') {
|
// if (client_id == '0' || policy_id == '0') {
|
||||||
// alert('Please select values in both dropdowns.');
|
// alert('Please select values in both dropdowns.');
|
||||||
@ -338,7 +382,7 @@ function fetchEmpolyeeList(event) {
|
|||||||
branch_id: branch_id,
|
branch_id: branch_id,
|
||||||
emp_code : emp_code,
|
emp_code : emp_code,
|
||||||
emp_name : emp_name,
|
emp_name : emp_name,
|
||||||
status : status,
|
status : statusArray,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
@ -371,4 +415,69 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
|
|||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function sendManualEcard(input)
|
||||||
|
{
|
||||||
|
console.log('sendManualEcard function called');
|
||||||
|
|
||||||
|
var client_id = $('#clients').val()
|
||||||
|
var client_branch_id = $('#branch_id').val()
|
||||||
|
var policy_id = $('#policies').val()
|
||||||
|
|
||||||
|
console.log('input', input);
|
||||||
|
console.log('client_id', client_id);
|
||||||
|
console.log('client_branch_id', client_branch_id);
|
||||||
|
|
||||||
|
if(client_id == 0 || client_branch_id == 0 || policy_id == 0)
|
||||||
|
{
|
||||||
|
Swal.fire({
|
||||||
|
title: "warning!",
|
||||||
|
text: 'Please select the Client, Client Branch and Policy.',
|
||||||
|
icon: "warning"
|
||||||
|
});
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to send Ecard Mail?",
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: "Yes,Send",
|
||||||
|
denyButtonText: "Don't Send"
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("util/send_manual_ecard/") ?>' + client_id + '/' + client_branch_id+'/'+policy_id,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('send_manual_ecard', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == false){
|
||||||
|
toastr.info(res.message, 'INFO');
|
||||||
|
}else{
|
||||||
|
toastr.success(res.message, 'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Swal.fire("Saved!", "", "success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -66,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
<div id="categoryFilter_11">
|
<div id="categoryFilter_11">
|
||||||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Search</a>
|
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);"><i class="fa fa-search" aria-hidden="true"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
@ -74,17 +74,22 @@
|
|||||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-1">
|
||||||
<div id="categoryFilter_13">
|
<div id="categoryFilter_13">
|
||||||
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" >Upload File</a>
|
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" ><i class="fas fa-file-upload" ></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
|
<!-- <div class="row" style="margin-bottom: 44px;"> -->
|
||||||
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
||||||
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
|
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
|
||||||
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
||||||
|
|
||||||
@ -713,6 +718,16 @@
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to send reminder mail?",
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: "Yes,Send",
|
||||||
|
denyButtonText: "Don't Send"
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
|
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@ -738,6 +753,9 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Swal.fire("Saved!", "", "success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -53,7 +53,7 @@
|
|||||||
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
||||||
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||||
<td><?php echo $file['action'] ?></td>
|
<td><?php echo $file['action'] ?></td>
|
||||||
<td><?php echo fancy_date_time_format($file['created_at']) . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -458,8 +458,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||||
|
|
||||||
appendPolicies2(foundPolicies);
|
appendPolicies2(foundPolicies);
|
||||||
@ -551,15 +549,27 @@
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
$('#insurer_or_tpa').change(function(){
|
$('#insurer_or_tpa').change(function(){
|
||||||
|
|
||||||
var insurer_or_tpa = $(this).val()
|
var insurer_or_tpa = $(this).val()
|
||||||
var policy_value = $('#policy').val()
|
var policy_value = $('#policy').val()
|
||||||
var event_type_data = $('#event_type_data').val();
|
var event_type_data = $('#event_type_data').val();
|
||||||
|
var action_type = $('#action_type').val()
|
||||||
|
|
||||||
console.log('policy_value', policy_value)
|
console.log('policy_value', policy_value)
|
||||||
|
|
||||||
if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
// if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
||||||
|
if(insurer_or_tpa == 'tpa'){
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
$("#event_type").removeAttr("multiple");
|
||||||
$("#event_type").attr("name", "event_type");
|
$("#event_type").attr("name", "event_type");
|
||||||
$("#event_type").select2('destroy');
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
}else if(insurer_or_tpa == 'insurer' && action_type == 'import'){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(policy_value != 0){
|
if(policy_value != 0){
|
||||||
$("#event_type").attr("multiple", "multiple");
|
$("#event_type").attr("multiple", "multiple");
|
||||||
@ -570,15 +580,26 @@
|
|||||||
}) ;
|
}) ;
|
||||||
|
|
||||||
$('#action_type').change(function(){
|
$('#action_type').change(function(){
|
||||||
var insurer_or_tpa = $(this).val()
|
var action_type = $(this).val()
|
||||||
var policy_value = $('#policy').val()
|
var policy_value = $('#policy').val()
|
||||||
|
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||||
|
|
||||||
var event_type_data = $('#event_type_data').val();
|
var event_type_data = $('#event_type_data').val();
|
||||||
|
|
||||||
console.log('policy_value', policy_value)
|
console.log('policy_value', policy_value)
|
||||||
if(insurer_or_tpa == 'import' || event_type_data == 0){
|
// if(insurer_or_tpa == 'import' || event_type_data == 0){
|
||||||
|
if(action_type == 'import'){
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
$("#event_type").removeAttr("multiple");
|
||||||
$("#event_type").attr("name", "event_type");
|
$("#event_type").attr("name", "event_type");
|
||||||
$("#event_type").select2('destroy');
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
} else if(action_type == 'export' && insurer_or_tpa == 'tpa'){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(policy_value != 0){
|
if(policy_value != 0){
|
||||||
$("#event_type").attr("multiple", "multiple");
|
$("#event_type").attr("multiple", "multiple");
|
||||||
@ -588,12 +609,15 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$('#policy').change(function(){
|
$('#policy').change(function(){
|
||||||
|
|
||||||
var policy_value = $(this).val()
|
var policy_value = $(this).val()
|
||||||
if(policy_value == 0){
|
var insurer_or_tpa = $('insurer_or_tpa').val()
|
||||||
|
var action_type = $('action_type').val()
|
||||||
|
|
||||||
|
if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){
|
||||||
$("#event_type").removeAttr("multiple");
|
$("#event_type").removeAttr("multiple");
|
||||||
$("#event_type").attr("name", "event_type");
|
$("#event_type").attr("name", "event_type");
|
||||||
$("#event_type").select2('destroy');
|
$("#event_type").select2('destroy');
|
||||||
|
|||||||
@ -656,12 +656,12 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- leads -->
|
<!-- leads -->
|
||||||
<!-- <li>
|
<li>
|
||||||
<a href="<?= base_url('/leads/list') ?>">
|
<a href="<?= base_url('/leads/list') ?>">
|
||||||
<i class="mdi mdi-chart-bar"></i>
|
<i class="mdi mdi-chart-bar"></i>
|
||||||
<span> Leads </span>
|
<span> Leads </span>
|
||||||
</a>
|
</a>
|
||||||
</li> -->
|
</li>
|
||||||
|
|
||||||
<?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()))) { ?>
|
<?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()))) { ?>
|
||||||
|
|
||||||
|
|||||||
@ -193,24 +193,30 @@
|
|||||||
placeholder="Enter Branch Name" required>
|
placeholder="Enter Branch Name" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-3">
|
||||||
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
|
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="branch_code" name="branch_code"
|
<input type="text" class="form-control" id="branch_code" name="branch_code"
|
||||||
placeholder="Enter Branch Code" required>
|
placeholder="Enter Branch Code" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-3">
|
||||||
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
|
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
|
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
|
||||||
placeholder="Enter Contact Name" required>
|
placeholder="Enter Contact Name" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-3">
|
||||||
<label for="client_branch">Contact Person Mobile<span class="text-danger">*</span></label>
|
<label for="contact_person_mobile">Contact Person Mobile<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="contact_person_mobile" name="contact_person_mobile"
|
<input type="text" class="form-control" id="contact_person_mobile" name="contact_person_mobile"
|
||||||
placeholder="Enter Contact Mobile" required>
|
placeholder="Enter Contact Mobile" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="contact_person_email">Contact Person Email<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="contact_person_email" name="contact_person_email"
|
||||||
|
placeholder="Enter Contact Email" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- policy row -->
|
<!-- policy row -->
|
||||||
@ -278,6 +284,8 @@
|
|||||||
|
|
||||||
//SELECT2 document ready function
|
//SELECT2 document ready function
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
getURLParamsForReport()
|
||||||
addHTMLInput()
|
addHTMLInput()
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$("textarea.select2-search__field").attr('rows', '1');
|
$("textarea.select2-search__field").attr('rows', '1');
|
||||||
@ -372,10 +380,9 @@ function getLeadsDataForEdit(input) {
|
|||||||
$('#gst').val(res.data.gst);
|
$('#gst').val(res.data.gst);
|
||||||
$('#branch_name').val(res.data.branch_name);
|
$('#branch_name').val(res.data.branch_name);
|
||||||
$('#branch_code').val(res.data.branch_code);
|
$('#branch_code').val(res.data.branch_code);
|
||||||
$('#contact_person_name').val(res.data
|
$('#contact_person_name').val(res.data.contact_person_name);
|
||||||
.contact_person_name);
|
$('#contact_person_mobile').val(res.data.contact_person_mobile);
|
||||||
$('#contact_person_mobile').val(res.data
|
$('#contact_person_email').val(res.data.contact_person_email);
|
||||||
.contact_person_mobile);
|
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -459,6 +466,7 @@ function getBranchData(input) {
|
|||||||
$('#branch_code').val(res.data.branch_code);
|
$('#branch_code').val(res.data.branch_code);
|
||||||
$('#contact_person_name').val(res.contact.name);
|
$('#contact_person_name').val(res.contact.name);
|
||||||
$('#contact_person_mobile').val(res.contact.mobile);
|
$('#contact_person_mobile').val(res.contact.mobile);
|
||||||
|
$('#contact_person_email').val(res.contact.email);
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -471,6 +479,7 @@ function getBranchData(input) {
|
|||||||
$('#branch_code').val('');
|
$('#branch_code').val('');
|
||||||
$('#contact_person_name').val('');
|
$('#contact_person_name').val('');
|
||||||
$('#contact_person_mobile').val('');
|
$('#contact_person_mobile').val('');
|
||||||
|
$('#contact_person_email').val('');
|
||||||
|
|
||||||
console.log(res.message, 'warning');
|
console.log(res.message, 'warning');
|
||||||
}
|
}
|
||||||
@ -510,6 +519,7 @@ function getPolicyData(input) {
|
|||||||
$('#branch_code').val(res.data.branch_code);
|
$('#branch_code').val(res.data.branch_code);
|
||||||
$('#contact_person_name').val(res.contact.name);
|
$('#contact_person_name').val(res.contact.name);
|
||||||
$('#contact_person_mobile').val(res.contact.mobile);
|
$('#contact_person_mobile').val(res.contact.mobile);
|
||||||
|
$('#contact_person_email').val(res.contact.email);
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -522,6 +532,7 @@ function getPolicyData(input) {
|
|||||||
$('#branch_code').val('');
|
$('#branch_code').val('');
|
||||||
$('#contact_person_name').val('');
|
$('#contact_person_name').val('');
|
||||||
$('#contact_person_mobile').val('');
|
$('#contact_person_mobile').val('');
|
||||||
|
$('#contact_person_email').val('');
|
||||||
|
|
||||||
console.log(res.message, 'warning');
|
console.log(res.message, 'warning');
|
||||||
}
|
}
|
||||||
@ -825,6 +836,7 @@ $('#lead_type').change(function() {
|
|||||||
$('#branch_code').val('');
|
$('#branch_code').val('');
|
||||||
$('#contact_person_name').val('');
|
$('#contact_person_name').val('');
|
||||||
$('#contact_person_mobile').val('');
|
$('#contact_person_mobile').val('');
|
||||||
|
$('#contact_person_email').val('');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -840,6 +852,7 @@ $('#lead_type').change(function() {
|
|||||||
$('#branch_code').val('');
|
$('#branch_code').val('');
|
||||||
$('#contact_person_name').val('');
|
$('#contact_person_name').val('');
|
||||||
$('#contact_person_mobile').val('');
|
$('#contact_person_mobile').val('');
|
||||||
|
$('#contact_person_email').val('');
|
||||||
|
|
||||||
$('#client_type').val('');
|
$('#client_type').val('');
|
||||||
$('#client_name').val('');
|
$('#client_name').val('');
|
||||||
@ -870,19 +883,20 @@ function tpaChange(input, unique_id) {
|
|||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function getURLParamsForReport() {
|
function getURLParamsForReport() {
|
||||||
const params = new URLSearchParams(window.location.search);
|
|
||||||
const pt_id = params.get('pt_id') ?? 0;
|
|
||||||
|
|
||||||
if (pt_id != 0) {
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const lead_id = params.get('lead_id') ?? 0;
|
||||||
|
|
||||||
|
if (lead_id != 0) {
|
||||||
hide_list_show_add();
|
hide_list_show_add();
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
getPolicyTransactionDataForEdit(pt_id),
|
getLeadsDataForEdit(lead_id),
|
||||||
1500); // Reduced timeout
|
1500); // Reduced timeout
|
||||||
} else {
|
} else {
|
||||||
show_list_hide_add();
|
show_list_hide_add();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('pt_id', pt_id); // Retain the log if necessary
|
console.log('lead_id', lead_id); // Retain the log if necessary
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -98,9 +98,14 @@ table.dataTable tbody td {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||||
</a>
|
</a>
|
||||||
|
<?php if($row['qcr_count'] > 0) { ?>
|
||||||
|
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 2; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||||
|
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>QCR
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -197,7 +197,7 @@
|
|||||||
<div class="modal-dialog modal-full-width scrollb" >
|
<div class="modal-dialog modal-full-width scrollb" >
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="myLargeModalLabel">Member welcome mail <span id="nameOfThePolicy"></span></h4>
|
<h4 class="modal-title" id="myLargeModalLabel">Template Name : Member welcome mail <span id="nameOfThePolicy"></span></h4>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@ -206,19 +206,13 @@
|
|||||||
|
|
||||||
<form role="form" class="parsley-examples" method="post" id="member_welcome_mail_form" enctype="multipart/form-data">
|
<form role="form" class="parsley-examples" method="post" id="member_welcome_mail_form" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<input type="hidden" class="form-control" id="template_name" name="template_name" value="Member Welcome Mail" readonly>
|
||||||
|
<input type="hidden" id="member_welcome_mail_template_name" value="member_welcome_mail">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-1">
|
||||||
<label for="emp_code">Template Name</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<input type="text" id="template_name" name="template_name" class="form-control" value="Member Welcome Mail" readonly placeholder="Template Name">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label for="emp_code">Subject</label>
|
<label for="emp_code">Subject</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
@ -229,6 +223,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="accordion_2" class="mb-0">
|
||||||
|
<div class="card mb-0" style="border: 2px dotted;">
|
||||||
|
<h5 class="m-1"> Editor
|
||||||
|
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseThree" aria-expanded="true">
|
||||||
|
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||||
|
</a>
|
||||||
|
</h5>
|
||||||
|
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_2" style="margin-top: -10px;">
|
||||||
|
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<select id="member_welcome_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
<select id="member_welcome_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||||
@ -243,12 +246,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="member_welcome_mail_snow_editor" name="content" style="height: 300px;">
|
<div id="member_welcome_mail_snow_editor" name="content" style="height: 300px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="file" id="Question_title_fileInput" style="display: none;">
|
<input type="file" id="Question_title_fileInput" style="display: none;">
|
||||||
|
|
||||||
|
<table id="attachment_table" class="table table-sm mb-0" style="margin-top: 30px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Attachments</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="attachment_tbody">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
@ -685,7 +700,6 @@
|
|||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="modal fade" id="preview_modal" tabindex="-1" role="dialog" aria-hidden="false" aria-modal="true" data-backdrop="static">
|
<div class="modal fade" id="preview_modal" tabindex="-1" role="dialog" aria-hidden="false" aria-modal="true" data-backdrop="static">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -1204,18 +1218,27 @@
|
|||||||
$(`#${template_name}_form`).find('.jodit-wysiwyg').html(res.mail_content);
|
$(`#${template_name}_form`).find('.jodit-wysiwyg').html(res.mail_content);
|
||||||
|
|
||||||
console.log(res.id)
|
console.log(res.id)
|
||||||
|
console.log(res.data)
|
||||||
|
|
||||||
|
if(res.data){
|
||||||
|
addHTMLInput(res.data);
|
||||||
|
}else{
|
||||||
|
addHTMLInput();
|
||||||
|
}
|
||||||
|
|
||||||
if(res.id){
|
if(res.id){
|
||||||
$('.testmail').show();
|
$('.testmail').show();
|
||||||
|
$('#attachment_table').show();
|
||||||
$('.setid').attr('data-id', res.id);
|
$('.setid').attr('data-id', res.id);
|
||||||
}else{
|
}else{
|
||||||
$('.testmail').hide();
|
$('.testmail').hide();
|
||||||
|
$('#attachment_table').hide();
|
||||||
$('.setid').attr('data-id', '');
|
$('.setid').attr('data-id', '');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$('.testmail').hide();
|
$('.testmail').hide();
|
||||||
|
$('#attachment_table').hide();
|
||||||
$('.setid').attr('data-id', '');
|
$('.setid').attr('data-id', '');
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1340,4 +1363,190 @@
|
|||||||
return emailPattern.test(email);
|
return emailPattern.test(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addHTMLInput(data = null) {
|
||||||
|
|
||||||
|
console.log('addHTMLInput function called');
|
||||||
|
|
||||||
|
const container = document.getElementById('attachment_tbody');
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
|
||||||
|
$(container).empty();
|
||||||
|
|
||||||
|
data.forEach(item => {
|
||||||
|
const newRow = document.createElement('tr');
|
||||||
|
newRow.className = 'dynamic-form-row';
|
||||||
|
|
||||||
|
newRow.innerHTML = `
|
||||||
|
<td> ${item.file_name} </td>
|
||||||
|
<td> <a class="fa fa-trash" data-id="${item.id}" onclick="removeAttachment('${item.id}')"></a></td>
|
||||||
|
`;
|
||||||
|
|
||||||
|
container.appendChild(newRow);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Creating another row for the form with file input
|
||||||
|
const newFormRow = document.createElement('tr');
|
||||||
|
newFormRow.className = 'dynamic-form-row';
|
||||||
|
|
||||||
|
newFormRow.innerHTML = `
|
||||||
|
<td>
|
||||||
|
<form class="ajax" onsubmit="submitAttachmentForm(event, this)">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<input type="file" class="file-input__input" name="file" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-2">
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
`;
|
||||||
|
|
||||||
|
container.appendChild(newFormRow);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// If no data is passed, create a new empty row
|
||||||
|
const newRow = document.createElement('tr');
|
||||||
|
newRow.className = 'dynamic-form-row';
|
||||||
|
|
||||||
|
newRow.innerHTML = `
|
||||||
|
<td>
|
||||||
|
<form class="ajax" onsubmit="submitAttachmentForm(event, this)">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<input type="file" class="file-input__input" name="file" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-2">
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
`;
|
||||||
|
container.appendChild(newRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeHTMLInput(element) {
|
||||||
|
const container = document.getElementById('attachment_tbody');
|
||||||
|
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||||
|
|
||||||
|
if (rows.length > 1) {
|
||||||
|
const row = element.closest('.dynamic-form-row');
|
||||||
|
row.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitAttachmentForm(event, form) {
|
||||||
|
|
||||||
|
event.preventDefault(); // Prevent the default form submission
|
||||||
|
|
||||||
|
var template_name = $('#member_welcome_mail_template_name').val();
|
||||||
|
var client_id = $('#general_PrimaryKey').val();
|
||||||
|
|
||||||
|
const formData = new FormData(form);
|
||||||
|
formData.append('template_name', template_name);
|
||||||
|
formData.append('client_id', client_id);
|
||||||
|
|
||||||
|
const fileInput = form.querySelector('input[type="file"]');
|
||||||
|
|
||||||
|
// Check if a file is selected
|
||||||
|
if (!fileInput.files.length) {
|
||||||
|
toastr.warning("Please select a file to upload.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: Display a loading indicator
|
||||||
|
const submitButton = form.querySelector('button[type="submit"]');
|
||||||
|
submitButton.disabled = true;
|
||||||
|
submitButton.innerText = 'Uploading...';
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
// AJAX request to upload the file
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url('client/notification/add_attachment') ?>', // Replace with your actual upload URL
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(response) {
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(response.status == true){
|
||||||
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
addHTMLInput(response.data);
|
||||||
|
}else{
|
||||||
|
toastr.error(response.message, 'ERROR');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// Handle error
|
||||||
|
console.error('Upload error occurred:');
|
||||||
|
console.error('Status: ', status); // Status of the request
|
||||||
|
console.error('Error: ', error); // Specific error message
|
||||||
|
console.error('XHR Object: ', xhr); // Full XHR object with response details
|
||||||
|
|
||||||
|
// Optionally log server response, if available
|
||||||
|
if (xhr.responseText) {
|
||||||
|
console.error('Response Text: ', xhr.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
|
toastr.warning('Error uploading file', 'WARNING');
|
||||||
|
console.error('Upload error:', error);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// Re-enable the submit button and reset its text
|
||||||
|
submitButton.disabled = false;
|
||||||
|
submitButton.innerText = 'Submit';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAttachment(id){
|
||||||
|
|
||||||
|
var template_name = $('#member_welcome_mail_template_name').val();
|
||||||
|
var client_id = $('#general_PrimaryKey').val();
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('client/notification/removeAttachment/');?>'+ id + '/' + client_id + '/' + template_name,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
console.log('removeAttachment response', res)
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == true){
|
||||||
|
toastr.success(res.message, 'SUCCESS')
|
||||||
|
addHTMLInput(res.data);
|
||||||
|
}else{
|
||||||
|
toastr.warning(res.message, 'WARNING')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -604,53 +604,53 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('input', '[name="cgst[]"]', function() {
|
// $(document).on('input', '[name="cgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="cgst[]"]').val(val);
|
// $('[name="cgst[]"]').val(val);
|
||||||
$('[name="sgst[]"]').val(val);
|
// $('[name="sgst[]"]').val(val);
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('');
|
// $('[name="sgst[]"]').val('');
|
||||||
}
|
// }
|
||||||
console.log('cgst value', val);
|
// console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="sgst[]"]', function() {
|
// $(document).on('input', '[name="sgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="sgst[]"]').val(val)
|
// $('[name="sgst[]"]').val(val)
|
||||||
$('[name="cgst[]"]').val(val)
|
// $('[name="cgst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('')
|
// $('[name="sgst[]"]').val('')
|
||||||
$('[name="cgst[]"]').val('')
|
// $('[name="cgst[]"]').val('')
|
||||||
}
|
// }
|
||||||
console.log('cgst value', val);
|
// console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="igst[]"]', function() {
|
// $(document).on('input', '[name="igst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val(0);
|
// $('[name="cgst[]"], [name="sgst[]"]').val(0);
|
||||||
$('[name="igst[]"]').val(val)
|
// $('[name="igst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val('');
|
// $('[name="cgst[]"], [name="sgst[]"]').val('');
|
||||||
$('[name="igst[]"]').val('')
|
// $('[name="igst[]"]').val('')
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
console.log('igst value', val);
|
// console.log('igst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||||
|
|
||||||
@ -924,6 +924,30 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
|||||||
}
|
}
|
||||||
//end edit function
|
//end edit function
|
||||||
|
|
||||||
|
function checkAndDistributeTax(input)
|
||||||
|
{
|
||||||
|
const event = window.event;
|
||||||
|
// console.log("Event type:", event.type);
|
||||||
|
// console.log("Event target:", event.target);
|
||||||
|
console.log("Event id:", event.target.id);
|
||||||
|
|
||||||
|
let cgst = parseFloat($('#cgst_' + input).val());
|
||||||
|
let sgst = parseFloat($('#sgst_' + input).val());
|
||||||
|
let igst = parseFloat($('#igst_' + input).val());
|
||||||
|
if(((event.target.id).startsWith('cgst') || (event.target.id).startsWith('sgst') ))
|
||||||
|
{
|
||||||
|
if(cgst !== 0) { $('#sgst_' + input).val(cgst.toFixed(2)); }
|
||||||
|
else if(sgst !== 0) { $('#cgst_' + input).val(sgst.toFixed(2)); }
|
||||||
|
|
||||||
|
$('#igst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#cgst_' + input).val(0.00);
|
||||||
|
$('#sgst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function amountCalculation(input) {
|
function amountCalculation(input) {
|
||||||
|
|
||||||
// console.log(input);
|
// console.log(input);
|
||||||
@ -945,6 +969,7 @@ function amountCalculation(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
||||||
|
checkAndDistributeTax(input);
|
||||||
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
||||||
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
||||||
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
||||||
|
|||||||
@ -748,14 +748,14 @@
|
|||||||
<!-- end form row -->
|
<!-- end form row -->
|
||||||
|
|
||||||
<!-- Client form content modal-->
|
<!-- Client form content modal-->
|
||||||
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false" data-backdrop="static" data-keyboard="false">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="myCenterModalLabel">Add New Client</h4>
|
<h4 class="modal-title" id="myCenterModalLabel">Add New Client</h4>
|
||||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body" style="overflow-y: auto;height: 90vh;">
|
||||||
<form class="parsley-examples" method="post" id="client_form" enctype="multipart/form-data">
|
<form class="parsley-examples" method="post" id="client_form" enctype="multipart/form-data">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
@ -799,7 +799,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="aadhar">Aadhar<span class="text-danger">*</span></label>
|
<label for="aadhar">Aadhar<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter PAN No" name="aadhar">
|
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -858,7 +858,7 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Client form content modal-->
|
<!-- Vehicle form content modal-->
|
||||||
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -998,11 +998,31 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
var team_id = [];
|
var team_id = [];
|
||||||
|
let isClientFormSubmitting = false;
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
// hidePermiumDetailsBasedOnTheTeam()
|
// hidePermiumDetailsBasedOnTheTeam()
|
||||||
|
|
||||||
|
// $('#upload_enrollment_model').modal({
|
||||||
|
// backdrop: 'static',
|
||||||
|
// keyboard: false
|
||||||
|
// })
|
||||||
|
|
||||||
|
$('#upload_enrollment_model').on('hide.bs.modal', function (e) {
|
||||||
|
if (!isClientFormSubmitting) {
|
||||||
|
// Ask for confirmation
|
||||||
|
if (confirm("Are you sure you want to close? Unsaved changes will be lost.")) {
|
||||||
|
// If confirmed, reset the form
|
||||||
|
$('#client_form')[0].reset();
|
||||||
|
} else {
|
||||||
|
// If not confirmed, prevent the modal from closing
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
team_id = <?php echo json_encode(user_team()); ?>;
|
team_id = <?php echo json_encode(user_team()); ?>;
|
||||||
console.log('team_id', team_id);
|
console.log('team_id', team_id);
|
||||||
|
|
||||||
@ -1203,53 +1223,53 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('input', '[name="cgst[]"]', function() {
|
// $(document).on('input', '[name="cgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="cgst[]"]').val(val);
|
// $('[name="cgst[]"]').val(val);
|
||||||
$('[name="sgst[]"]').val(val);
|
// $('[name="sgst[]"]').val(val);
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('');
|
// $('[name="sgst[]"]').val('');
|
||||||
}
|
// }
|
||||||
// console.log('cgst value', val);
|
// // console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="sgst[]"]', function() {
|
// $(document).on('input', '[name="sgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="sgst[]"]').val(val)
|
// $('[name="sgst[]"]').val(val)
|
||||||
$('[name="cgst[]"]').val(val)
|
// $('[name="cgst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('')
|
// $('[name="sgst[]"]').val('')
|
||||||
$('[name="cgst[]"]').val('')
|
// $('[name="cgst[]"]').val('')
|
||||||
}
|
// }
|
||||||
// console.log('cgst value', val);
|
// // console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="igst[]"]', function() {
|
// $(document).on('input', '[name="igst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val(0);
|
// $('[name="cgst[]"], [name="sgst[]"]').val(0);
|
||||||
$('[name="igst[]"]').val(val)
|
// $('[name="igst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val('');
|
// $('[name="cgst[]"], [name="sgst[]"]').val('');
|
||||||
$('[name="igst[]"]').val('')
|
// $('[name="igst[]"]').val('')
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
// console.log('igst value', val);
|
// // console.log('igst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||||
|
|
||||||
@ -1595,8 +1615,8 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#policy_start_date').prop('required', true);
|
$('#policy_start_date').prop('required', true);
|
||||||
$('#policy_end_date').prop('required', true);
|
$('#policy_end_date').prop('required', true);
|
||||||
// $('#tpa').prop('required', true);
|
// $('#tpa').prop('required', true);
|
||||||
$('#emp_count').prop('required', true);
|
// $('#emp_count').prop('required', true);
|
||||||
$('#dependent_count').prop('required', true);
|
// $('#dependent_count').prop('required', true);
|
||||||
$('.follow_insurer').prop('required', true);
|
$('.follow_insurer').prop('required', true);
|
||||||
} else {
|
} else {
|
||||||
$('#sales_row').hide();
|
$('#sales_row').hide();
|
||||||
@ -1605,8 +1625,8 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#policy_start_date').prop('required', false);
|
$('#policy_start_date').prop('required', false);
|
||||||
$('#policy_end_date').prop('required', false);
|
$('#policy_end_date').prop('required', false);
|
||||||
// $('#tpa').prop('required', false);
|
// $('#tpa').prop('required', false);
|
||||||
$('#emp_count').prop('required', false);
|
// $('#emp_count').prop('required', false);
|
||||||
$('#dependent_count').prop('required', false);
|
// $('#dependent_count').prop('required', false);
|
||||||
$('.follow_insurer').prop('required', false);
|
$('.follow_insurer').prop('required', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1650,9 +1670,33 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
checkInvoiceStatusToHideSubmitBtn(id)
|
checkInvoiceStatusToHideSubmitBtn(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkAndDistributeTax(input)
|
||||||
|
{
|
||||||
|
const event = window.event;
|
||||||
|
// console.log("Event type:", event.type);
|
||||||
|
// console.log("Event target:", event.target);
|
||||||
|
console.log("Event id:", event.target.id);
|
||||||
|
|
||||||
|
let cgst = parseFloat($('#cgst_' + input).val());
|
||||||
|
let sgst = parseFloat($('#sgst_' + input).val());
|
||||||
|
let igst = parseFloat($('#igst_' + input).val());
|
||||||
|
if(((event.target.id).startsWith('cgst') || (event.target.id).startsWith('sgst') ))
|
||||||
|
{
|
||||||
|
if(cgst !== 0) { $('#sgst_' + input).val(cgst.toFixed(2)); }
|
||||||
|
else if(sgst !== 0) { $('#cgst_' + input).val(sgst.toFixed(2)); }
|
||||||
|
|
||||||
|
$('#igst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#cgst_' + input).val(0.00);
|
||||||
|
$('#sgst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function amountCalculation(input) {
|
function amountCalculation(input) {
|
||||||
|
|
||||||
// console.log(input);
|
console.log('amountCalculation - ' + input);
|
||||||
let selectedOption = $('#policy_type_id').find('option:selected');
|
let selectedOption = $('#policy_type_id').find('option:selected');
|
||||||
let bap = selectedOption.data('bap');
|
let bap = selectedOption.data('bap');
|
||||||
|
|
||||||
@ -1671,9 +1715,12 @@ function amountCalculation(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
||||||
|
checkAndDistributeTax(input);
|
||||||
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
||||||
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
||||||
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
||||||
|
|
||||||
|
|
||||||
let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0;
|
let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0;
|
||||||
let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0;
|
let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0;
|
||||||
|
|
||||||
@ -1697,7 +1744,10 @@ function amountCalculation(input) {
|
|||||||
// Calculate GST percentage
|
// Calculate GST percentage
|
||||||
let gst_per = igst;
|
let gst_per = igst;
|
||||||
if (igst === 0) {
|
if (igst === 0) {
|
||||||
gst_per = cgst + sgst;
|
console.log('called' + cgst + sgst);
|
||||||
|
gst_per = parseFloat(cgst) + parseFloat(sgst);
|
||||||
|
// gst_per = (cgst) + (sgst);
|
||||||
|
console.log(gst_per);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the total premium (Base + TP + Co-Premium)
|
// Calculate the total premium (Base + TP + Co-Premium)
|
||||||
@ -2658,7 +2708,7 @@ $("#inception_form_id").submit(function(event) {
|
|||||||
$("#client_form").submit(function(event) {
|
$("#client_form").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
isClientFormSubmitting = true;
|
||||||
var isValid = $('#client_form').parsley().validate();
|
var isValid = $('#client_form').parsley().validate();
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
console.log('Form is Empty', 'Warning');
|
console.log('Form is Empty', 'Warning');
|
||||||
@ -2703,7 +2753,9 @@ $("#client_form").submit(function(event) {
|
|||||||
toastr.error(res.message, 'Error');
|
toastr.error(res.message, 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#client_form')[0].reset();
|
||||||
$('.close').click();
|
$('.close').click();
|
||||||
|
isClientFormSubmitting = false;
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -2771,6 +2823,7 @@ $("#vehicle_form").submit(function(event) {
|
|||||||
toastr.error(res.message, 'Error');
|
toastr.error(res.message, 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#vehicle_form')[0].reset();
|
||||||
$('.close').click();
|
$('.close').click();
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
@ -2830,6 +2883,7 @@ $("#CDMasterForm").submit(function(event) {
|
|||||||
toastr.error(res.message, 'Error');
|
toastr.error(res.message, 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#CDMasterForm')[0].reset();
|
||||||
$('.close').click();
|
$('.close').click();
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
@ -3024,8 +3078,8 @@ $('#policy_status').change(function(){
|
|||||||
$('#policy_start_date').prop('required', true);
|
$('#policy_start_date').prop('required', true);
|
||||||
$('#policy_end_date').prop('required', true);
|
$('#policy_end_date').prop('required', true);
|
||||||
// $('#tpa').prop('required', true);
|
// $('#tpa').prop('required', true);
|
||||||
$('#emp_count').prop('required', true);
|
// $('#emp_count').prop('required', true);
|
||||||
$('#dependent_count').prop('required', true);
|
// $('#dependent_count').prop('required', true);
|
||||||
$('.follow_insurer').prop('required', true);
|
$('.follow_insurer').prop('required', true);
|
||||||
|
|
||||||
if(policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){
|
if(policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){
|
||||||
@ -3053,8 +3107,8 @@ $('#policy_status').change(function(){
|
|||||||
$('#policy_start_date').prop('required', false)
|
$('#policy_start_date').prop('required', false)
|
||||||
$('#policy_end_date').prop('required', false)
|
$('#policy_end_date').prop('required', false)
|
||||||
// $('#tpa').prop('required', false)
|
// $('#tpa').prop('required', false)
|
||||||
$('#emp_count').prop('required', false)
|
// $('#emp_count').prop('required', false)
|
||||||
$('#dependent_count').prop('required', false)
|
// $('#dependent_count').prop('required', false)
|
||||||
$('.follow_insurer').prop('required', false)
|
$('.follow_insurer').prop('required', false)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3125,6 +3179,12 @@ $('#policy_no').change(function(){
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
$('.close').on('click', function(){
|
||||||
|
$('#client_form')[0].reset();
|
||||||
|
$('#vehicle_form')[0].reset();
|
||||||
|
$('#CDMasterForm')[0].reset();
|
||||||
|
});
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
var insurerCount = 0;
|
var insurerCount = 0;
|
||||||
|
|||||||
@ -116,14 +116,18 @@
|
|||||||
var PrimaryKey = $('#tpa_General_PrimaryKey').val();
|
var PrimaryKey = $('#tpa_General_PrimaryKey').val();
|
||||||
var form_action = '';
|
var form_action = '';
|
||||||
|
|
||||||
|
console.log('tpa_General_PrimaryKey', PrimaryKey);
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
|
||||||
if (PrimaryKey === '') {
|
if (PrimaryKey === "") {
|
||||||
form_action = '<?= base_url("master/tpa/createpost"); ?>';
|
form_action = '<?= base_url("master/tpa/createpost"); ?>';
|
||||||
} else {
|
} else {
|
||||||
form_action = '<?= base_url("master/tpa/edit"); ?>';
|
form_action = '<?= base_url("master/tpa/edit"); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('tpa_General_form_action', form_action);
|
||||||
|
|
||||||
var formData = new FormData($('#tpa_general_form')[0]);
|
var formData = new FormData($('#tpa_general_form')[0]);
|
||||||
var OptionsHTML1 = '';
|
var OptionsHTML1 = '';
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -138,7 +142,6 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
if($('#tpa_General_PrimaryKey').val() == ""){
|
if($('#tpa_General_PrimaryKey').val() == ""){
|
||||||
|
|
||||||
window.location.href = '<?= base_url("master/tpa/list/"); ?>' + res.data.id;
|
window.location.href = '<?= base_url("master/tpa/list/"); ?>' + res.data.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +152,6 @@
|
|||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
$('#tpa_id').val(res.data.id);
|
$('#tpa_id').val(res.data.id);
|
||||||
$('#tpa_General_PrimaryKey').val(res.data.id);
|
|
||||||
$('#tpa_id_branch').val(res.data.id);
|
$('#tpa_id_branch').val(res.data.id);
|
||||||
$('#tpa_branch_contacts_id').click();
|
$('#tpa_branch_contacts_id').click();
|
||||||
|
|
||||||
@ -157,14 +159,6 @@
|
|||||||
var message = "TPA General Info";
|
var message = "TPA General Info";
|
||||||
toastr.success(message, 'Success');
|
toastr.success(message, 'Success');
|
||||||
|
|
||||||
// $.toast({
|
|
||||||
// text: 'Insurer General Info',
|
|
||||||
// heading: "Submitted Sucessfully",
|
|
||||||
// position: 'top-right',
|
|
||||||
// icon: 'success',
|
|
||||||
// bgColor: !1,
|
|
||||||
// });
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -172,7 +166,8 @@
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log('Something Wrong!', 'warning'); }, 1000);
|
console.log('Something Wrong!', 'warning');
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -228,7 +223,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function PreviewImage3() {
|
function PreviewImage3() {
|
||||||
var oFReader = new FileReader();
|
var oFReader = new FileReader();
|
||||||
oFReader.readAsDataURL(document.getElementById("bc").files[0]);
|
oFReader.readAsDataURL(document.getElementById("bc").files[0]);
|
||||||
@ -238,8 +232,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#preview').click(function() {
|
$('#preview').click(function() {
|
||||||
var ecardContent = $('#ecard_content').val();
|
var ecardContent = $('#ecard_content').val();
|
||||||
$('#Preview_data').html(ecardContent);
|
$('#Preview_data').html(ecardContent);
|
||||||
|
|||||||
3142
app/Views/view_rfq.php
Normal file
3142
app/Views/view_rfq.php
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user