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

This commit is contained in:
velz 2025-01-21 14:05:19 +05:30
commit db5ce068e5
23 changed files with 967 additions and 636 deletions

View File

@ -14,6 +14,7 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
$routes->get("reminder_mail", "NotificationController::reminder_mail");
$routes->get("getClientData", "ClientController::getClientData");
$routes->get("testing_for_review_mail/(:any)", "ClientController::testingForReviewMail/$1");
$routes->get("sendMemberReviewConfirmationMail/(:any)", "ClientController::sendMemberReviewConfirmationMail/$1");
$routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections");
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
$routes->get("updatajson", "EmpDataServiceController::updatajson");
@ -428,7 +429,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("logined", "RestAuthenticationController::logined");
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
});
// $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");

View File

@ -44,8 +44,7 @@ use App\Controllers\EmpDataServiceController;
use App\Controllers\GoogleDriveController;
use App\Helpers\sendMailNotification;
use App\Models\RFQModel;
class ClientController extends AdminController
{
@ -183,9 +182,12 @@ class ClientController extends AdminController
print_rr($attachments);
}
//Function for Testing Member Review and Summery Confirmation Mail
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0) //this function for only tsesting some logics not use for business logic
{
// dd($client_id, $emp_code, $mail_active);
$client_policy_ids = $this->employeeModel
->select('employee_polices.client_policy_id')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
@ -213,7 +215,7 @@ class ClientController extends AdminController
{
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
// dd($empData);
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
// dd($filteredEmpData);
@ -254,7 +256,7 @@ class ClientController extends AdminController
// print_r($wholeData); die;
if($mail_active > 0){
$mail_send_return = MailHelper::send_email($wholeData[0]);
// $mail_send_return = MailHelper::send_email($wholeData[0]);
$this->myLogger->logme("info", $mail_send_return);
}
@ -269,7 +271,7 @@ class ClientController extends AdminController
if($mail_active > 0){
foreach ($account_manager_wholeData as $key => $value) {
$mail_send_return1 = MailHelper::send_email($value);
// $mail_send_return1 = MailHelper::send_email($value);
$this->myLogger->logme("info", $mail_send_return1);
}
@ -288,7 +290,7 @@ class ClientController extends AdminController
if($mail_active > 0){
foreach ($client_hr_wholeData as $key => $value) {
$mail_send_return2 = MailHelper::send_email($value);
// $mail_send_return2 = MailHelper::send_email($value);
$this->myLogger->logme("info", $mail_send_return2);
}
}
@ -317,6 +319,123 @@ class ClientController extends AdminController
// return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
}
//Function for Send Member Review and Summery Confirmation Mail
public function sendMemberReviewConfirmationMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0)
{
$client_policy_ids = $this->employeeModel
->select('employee_polices.client_policy_id')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->where('employees.client_id', $client_id)
->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1)
->where('employees.is_active', 1)
->findAll();
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
$client_policy_id = array_unique($client_policy_ids2);
if (!is_null($client_policy_id) && is_array($client_policy_id)) {
$empData = $this->employeeModel
->where('emp_code', $emp_code)
->where('client_id', $client_id)
->where('is_active', 1)
->findAll();
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
if (empty($filteredEmpData)) {
return $this->respond([
'status' => 'error',
'code' => 404,
'message' => 'No active employee data found for the given criteria.',
], 404);
}
$array_list = [];
foreach ($client_policy_id as $value) {
$find = $this->employeeModel->getEmpFamilybyEmpCode(
client_policy_id: $value,
emp_code: $emp_code,
client_id: $client_id,
emp_status: ['draft', 'enrolled'],
policy_status: ['draft', 'enrolled']
);
if (count($find) > 0) {
$array_list[] = $find;
}
}
$notification = $this->notificationModel
->where('client_id', $client_id)
->where('template_name', 'member_review_and_summary_mail')
->first();
if ($notification && $notification['enabled'] == 1) {
$params = [
'array_list' => $array_list,
'client_policy_id' => $client_policy_id,
'emp_code' => $emp_code,
'client_id' => $client_id,
'notification' => $notification,
'common' => [
'client_id' => $filteredEmpData[0]['client_id'],
'client_branch_id' => $filteredEmpData[0]['client_branch_id'],
'client_policy_id' => null,
'employee_policy_id' => null,
'employee_id' => $filteredEmpData[0]['id'],
'mail_type' => 'member_review_and_summary_mail',
],
];
$wholeData = sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
if ($mail_active > 0) {
$mail_send_result = MailHelper::send_email($wholeData[0]);
if ($mail_send_result['status'] === 'success') {
return $this->respond([
'status' => 'success',
'code' => 200,
'message' => 'Email sent successfully.',
'response' => $mail_send_result,
], 200);
} else {
return $this->respond([
'status' => 'error',
'code' => 500,
'message' => 'Failed to send email.',
'details' => $mail_send_result,
], 500);
}
}
return $this->respond([
'status' => 'success',
'code' => 200,
'message' => 'Notification prepared but email not sent as mail_active is 0.',
'data' => $wholeData,
], 200);
}
return $this->respond([
'status' => 'error',
'code' => 400,
'message' => 'Member Review Mail configuration is not enabled for this client.',
], 400);
}
return $this->respond([
'status' => 'error',
'code' => 404,
'message' => 'No active client policy IDs found.',
], 404);
}
//--------------------------------------------------------------------------------------------------------
public function index()
@ -1056,6 +1175,7 @@ class ClientController extends AdminController
$data['disclaimer'] = $this->request->getPost('disclaimer');
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
$data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0;
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0;
@ -1188,6 +1308,7 @@ class ClientController extends AdminController
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0;
if ($data['inception_type'] == 2) {
$data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d');
$data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d');
@ -3831,24 +3952,27 @@ class ClientController extends AdminController
public function sendextraparam()
{
$batch_data = [
'client_id' => 17,
'client_policy_id' => 30,
'client_branch_id' => 18,
'event_type' => "inception",
];
// $batch_data['insurer_or_tpa'] = 'insurer';
$batch_data['insurer_or_tpa'] = 'tpa';
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
// dd($this->request);
// $employeeRestController = new EmployeeServiceController();
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 721]);
$employeeRestController = new EmployeeServiceController();
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 823]);
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
// $batch_data = [
// 'client_id' => 17,
// 'client_policy_id' => 30,
// 'client_branch_id' => 18,
// 'event_type' => "inception",
// ];
// $batch_data['insurer_or_tpa'] = 'insurer';
// $batch_data['insurer_or_tpa'] = 'tpa';
// $dashBoardController = new DashboardController();
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
// $dashBoardController->sendRemainderMail($client_policy_data);
@ -3877,33 +4001,47 @@ class ClientController extends AdminController
// $EmpDataServiceController = new EmpDataServiceController();
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
$EmpDataServiceController = new EmpDataServiceController();
// $EmpDataServiceController = new EmpDataServiceController();
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
// $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
$array = [
"employeeIds" => ["12800", "12798", "12797", "12799"],
"client_id" => "159",
"client_policy_id" => "336",
"client_branch_id" => "126",
"cd_ac_no" => "Apple_123",
"endorsement_no" => "ENDORSEMENT_ID",
"count" => 4,
"event_name" => "deletion",
"policy_name" => "GMC",
"user_id" => "1"
];
// $array = [
// "employeeIds" => ["12800", "12798", "12797", "12799"],
// "client_id" => "159",
// "client_policy_id" => "336",
// "client_branch_id" => "126",
// "cd_ac_no" => "Apple_123",
// "endorsement_no" => "ENDORSEMENT_ID",
// "count" => 4,
// "event_name" => "deletion",
// "policy_name" => "GMC",
// "user_id" => "1"
// ];
// $EmpDataServiceController->cashDepositCalculationForDeletion($array);
// $employeeRestController = new EmployeeServiceController();
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 757]);
// $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data);
// dd(db_connect()->getLastQuery());
// ------------- LEADS CONTROLLER ----------------------------------------------------------
// $LeadsController = new LeadsController();
// $RFQModel = new RFQModel();
// $data = $RFQModel->where('is_active', 1)->where('lead_id', 40)->first();
// // dd($data);
// $policy_type = 2;
// $proposel_name = "Proposal 2";
// $insurer_name = "ICICI-P-ICICI002-V1";
// $jsonArray = json_decode($data['json'], true);
// // dd($jsonArray);
// $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
// dd($returndata);
}
// -------------------------------------------------------------------------------------------------------

View File

@ -2171,6 +2171,9 @@ class EmployeeController extends AdminController
//get policy details
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
$policy_terms = (array)$policy_details[0];
$is_lgbtq = $policy_terms['is_lgbtq'];
// dd($policy_terms);
$policy_terms = json_decode($policy_terms['policy_terms']);
$policy_terms = (array) $policy_terms;// convert obj to array
@ -2178,7 +2181,7 @@ class EmployeeController extends AdminController
//get file array or construnct dummy file array here
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $policy_id,'action' => 'inception','client_branch_id' => $branch_id,'created_by' => 1];
//get familiy details in inception file format array from post method
$result = check_dependent_conflict($family_details, $policy_terms, $file['action']);
$result = check_dependent_conflict($family_details, $policy_terms, $file['action'],$is_lgbtq);
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['policy_terms' => $policy_terms['family_floaters'],'result' => $result] ], 200);

View File

@ -1085,7 +1085,7 @@ class EmployeeRestController extends AdminController
$keysToRemove = ["removable_keys"];
// Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
// dd($empPolicy);
// Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
->where('client_id',$client_id)
@ -1123,11 +1123,18 @@ class EmployeeRestController extends AdminController
{
$si_value = 0;
$si_premium_value = 0;
$si_gst_value = 0;
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
$si_gst_value = $si_gst_value + $employee_policy->gst;
}
$self['is_value_exist'] = true;
$self['data']['family_floater_key'] = 'self';
@ -1142,6 +1149,8 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $self;
$array->type = 'GPA';
$array->si_value = $si_value;
$array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_value;
@ -1201,8 +1210,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1404,8 +1416,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1504,16 +1519,25 @@ class EmployeeRestController extends AdminController
$decodedArray = json_decode($array->Policy_Terms);
$array->Policy_Terms = $decodedArray;
$si_value = 0;
$si_premium_value = 0;
$si_gst_value = 0;
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
$si_gst_value = $si_gst_value + $employee_policy->gst;
}
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
$array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name;
$array->si_value = $si_value;
$array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_value;
if($employee_policy){
@ -1808,8 +1832,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1929,8 +1956,11 @@ class EmployeeRestController extends AdminController
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
@ -1982,8 +2012,11 @@ class EmployeeRestController extends AdminController
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];

View File

@ -977,6 +977,9 @@ class EmployeeServiceController extends AdminController
// get policy and rack details
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
$policy_details = (array)$policy_terms[0];
$is_lgbtq = $policy_details['is_lgbtq'];
// dd($this->clientPolicyModel->getLastQuery());
$policy_terms = json_decode($policy_terms[0]->policy_terms);
$policy_terms = (array) $policy_terms;// convert obj to array
@ -1071,7 +1074,7 @@ class EmployeeServiceController extends AdminController
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception'|| $file['action'] == 'missed_inception' || $file['action'] == 'enrollment')
{
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
$res = check_dependent_conflict($family,$policy_terms,$file['action'],$is_lgbtq);
// dd($res);
if(!$res['status'])
{
@ -1159,7 +1162,6 @@ class EmployeeServiceController extends AdminController
}
// calculate data points and premium
public function employeesOnboardPreprocess($params)
{
@ -1240,8 +1242,9 @@ class EmployeeServiceController extends AdminController
// dd($family);
}
// Kint::dump($family);die();
// Kint::dump($family);
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
}

View File

@ -461,7 +461,8 @@ class LeadsController extends BaseController
$this->loadLayout('view_rfq.php', $data);
}
public function createRFQ(){
public function createRFQ()
{
// print_r($this->request->getPost('json')); die();
@ -1542,7 +1543,8 @@ class LeadsController extends BaseController
}
}
public function transformProposelData($data, $proposel, $insurer){
public function transformProposelData($data, $proposel, $insurer)
{
// print_r($data['premium_data']['data']); die;
@ -1933,107 +1935,23 @@ class LeadsController extends BaseController
return $this->convertQCRJsonToPolicyTerms($converted_json, $data['policy_type_id'], $proposel_data['proposel_name'], $proposel_data['insurer_name']);
}
private function convertQCRJsonToPolicyTerms($data, $policy_type, $proposel_name, $insurer_name)
{
$GMC_Keys = [
"sum_insured",
"family_floater",
"family_floaters",
"age_ratio",
"waiverofpreexistingdiseases",
"maternitycoverage",
"twindelivery",
"preandpostnatal",
"babyday1cover",
"9monthwaitingperiodwaived",
"coverfromthedateofjoining",
"waiverof1,2,3&4thyearexclusions",
"waiverof30dayswaitingperiod",
"prehospitalizationcover",
"congenitaldiseasesinternal",
"copayzonewisecopay",
"bioabsorbablestenttoriclensmultifocallens",
"roomrentlimit",
"proportionatedeductionclause",
"ailmentcapping",
"ambulancecharges",
"airambulance",
"familytransportationbenefit",
"reasonableandcustomarycharges",
"ayudhtreatmentcover",
"congenitaldiseasesexternal",
"optionalparentalcopay",
"posthospitalizationcover",
"corporatebuffer",
"sublimitofcorporatebuffer",
"ayushTreatmentCoverData",
"armdcovered",
"suminsuredenhancement",
"automaticsuminsuredreinstatement",
"additionalsicknessbenefit",
"lasiksurgery",
"midterminclusion",
"capd",
"organdonorexpenses",
"moderntreatmentsasperirdai",
"Wellness",
"days_of_discharge",
"days_from_dod",
"special_condition_label",
"special_condition_input",
"multiple_sum_insured",
"cataract",
"cataractData"
];
$GPA_Keys = [
"sumInsured2",
"totalSumInsured",
"age_ratio",
"accidentalDeathBenefit",
"permanentTotalDisablement",
"permanentPartialDisablement",
"temporaryTotalDisablementBenefit",
"accidentalHospitalizationExpenses",
"childrenEducationWelfareFund",
"compassionateVisitExpenses",
"compassionateVisitExpensesData",
"brokenBoneExpenses",
"brokenBoneExpensesData",
"ambulanceCharges",
"ambulanceChargesData",
"burnExpenses",
"burnExpensesData",
"carriageOfDeadBody",
"carriageOfDeadBodyData",
"animalSnakeInsectBite",
"terrorism",
"worldwideCover",
"gpa_special_condition_label",
"gpa_special_condition_input",
"multiple_sum_insured"
];
// Select keys based on policy type
$termsKey = $policy_type == 1 ? $GPA_Keys : $GMC_Keys;
// Initialize terms_array with default empty values
$terms_array = array_fill_keys($termsKey, "");
$specialKeys = ['special_condition_label', 'special_condition_input', 'gpa_special_condition_label', 'gpa_special_condition_input', 'multiple_sum_insured'];
foreach ($specialKeys as $key) {
$terms_array[$key] = [];
}
//Function for convert the RFQ and QCR Json to Policy Terms Json
public function convertQCRJsonToPolicyTerms($data, $policy_type, $proposel_name, $insurer_name)
{
//transform the data into the currernt proposel and insurere ( get single proposel )
$data = $this->transformProposelData($data, $proposel_name, $insurer_name);
// Initialize age_ratio based on policy type
$terms_array['age_ratio'] = $policy_type == 2 ? [
"self" => ["min" => "18", "max" => "60"],
"spouse" => ["min" => 0, "max" => 0],
"child" => ["min" => 0, "max" => "25"],
"elders" => ["min" => 0, "max" => 0],
] : ["self" => ["min" => "18", "max" => "60"]];
$age_ratio = $policy_type == 2 ? [
'self' => ['min' => '18', 'max' => '60'],
'spouse' => ['min' => 0, 'max' => 0],
'child' => ['min' => 0, 'max' => '25'],
'elders' => ['min' => 0, 'max' => 0],
] : [
'self' => ['min' => '18', 'max' => '60']
];
foreach ($data['table_data']['data'] as $dataRow) {
$item = $dataRow['items'] ?? '';
foreach ($dataRow['data'] as $cellData) {
@ -2043,45 +1961,52 @@ class LeadsController extends BaseController
$value = $cellData['value'] ?? '';
// Skip unwanted keys
if (
in_array($parentth, ['Sno', 'Item Key', 'Particulars', 'Action']) ||
in_array($subth, ['Quote Asked'])
) {
if (in_array($parentth, ['Sno', 'Item Key', 'Particulars', 'Action']) || in_array($subth, ['Quote Asked'])) {
continue;
}
// Handle special conditions
if (str_starts_with($item, "special_condition") && $parentth === $proposel_name && $subth === $insurer_name) {
switch (true) {
$parts = explode("-", $input_value);
$question = $parts[0] ?? '';
$answer = $parts[1] ?? '';
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
// CASE 1: Handle special conditions
case str_starts_with($item, 'special_condition') && $parentth === $proposel_name && $subth === $insurer_name:
$parts = explode('-', $input_value);
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
$terms_array[$labelKey][] = $question;
$terms_array[$inputKey][] = $answer;
continue;
$terms_array[$labelKey][] = $parts[0] ?? '';
$terms_array[$inputKey][] = $parts[1] ?? '';
break;
// CASE 2: Handle sum insured
case in_array($item, ['sum_insured', 'sumInsured2']):
$si_amt = explode(',', $value);
$terms_array[$item] = $si_amt[0] ?? '';
$terms_array['multiple_sum_insured'] = array_slice($si_amt, 1);
// Add age_ratio after Sum insured
if ($policy_type == 1) {
$terms_array['age_ratio'] = $age_ratio;
}
break;
// CASE 3: Handle family floaters
case $item === 'family_composition':
$terms_array['family_floaters'] = isJsonString($input_value) ? json_decode($input_value, true) : $input_value;
// Add age_ratio after family floaters
if ($policy_type == 2) {
$terms_array['age_ratio'] = $age_ratio;
}
break;
// DEFAULT CASE :
default:
// $terms_array[$item] = isJsonString($input_value) ? (json_decode($input_value, true)['key'] ?? '') : $value;
$terms_array[$item] = $value;
break;
}
// Handle sum insured
if (in_array($item, ['sum_insured', 'sumInsured2'])) {
$si_amt = explode(",", $value);
$terms_array[$item] = $si_amt[0] ?? "";
$terms_array['multiple_sum_insured'] = array_slice($si_amt, 1);
continue;
}
// Handle family floaters
if ($item === 'family_composition') {
$terms_array['family_floaters'] = isJsonString($input_value) ? json_decode($input_value, true) : $input_value;
continue;
}
// Decode JSON if valid
$terms_array[$item] = isJsonString($input_value) ?
(json_decode($input_value, true)['key'] ?? '') :
$input_value;
}
}

View File

@ -225,6 +225,7 @@ class MasterController extends AdminController
'New Basic Cover SI' => 'new_basic_cover_si',
'New SI Premium' => 'new_si_premium',
'Date of Coverage' => 'date_of_coverage',
'Age Band' => 'age_band',
];

View File

@ -52,6 +52,7 @@ class NotificationController extends AdminController
$form_data['subject'] = $this->request->getPost('subject');
$form_data['mail_content'] = $this->request->getPost('mailContent');
$form_data['client_id'] = $this->request->getPost('client_id');
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
$notificationModel = new NotificationModel();
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();

View File

@ -194,6 +194,11 @@ class MailHelper
} else {
$bcc = '';
}
if(isset($params['cc'])){
$cc = $params['cc'];
}else{
$cc = '';
}
$from_address = getenv('email.fromEmail');
@ -255,7 +260,6 @@ class MailHelper
}
$apiResponse = json_decode($response, true);
if ($httpCode === 200) {
return json_encode(['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $emaill], 200);
} else {
@ -289,116 +293,141 @@ class MailHelper
}
public static function send_email($params)
{
$myLogger = \Config\Services::mylogger();
{
$myLogger = \Config\Services::mylogger();
$emaill = $params['mail'];
$subject = $params['subject'];
$message = $params['message'];
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
$common = isset($params['common']) ? $params['common'] : '';
$bcc = isset($params['bcc']) ? $params['bcc'] : '';
$cc = isset($params['cc']) ? $params['cc'] : '';
$from_address = getenv('email.fromEmail');
try {
$curl = curl_init();
$emaill = $params['mail'];
$subject = $params['subject'];
$message = $params['message'];
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
$common = isset($params['common']) ? $params['common'] : '';
$from_address = getenv('email.fromEmail');
try {
$curl = curl_init();
$postData = [
'from' => [
'address' => $from_address
],
'to' => [
[
'email_address' => [
'address' => $emaill
]
$postData = [
'from' => [
'address' => $from_address
],
'to' => [
[
'email_address' => [
'address' => $emaill
]
],
'subject' => $subject,
'htmlbody' => $message
];
]
],
'subject' => $subject,
'htmlbody' => $message
];
// Handle attachments
if (!empty($attachments)) {
$postData['attachments'] = [];
foreach ($attachments as $attachment) {
if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) {
// Determine MIME type dynamically
$fileMimeType = mime_content_type($attachment['filePath']);
$postData['attachments'][] = [
'content' => base64_encode(file_get_contents($attachment['filePath'])),
'name' => $attachment['fileName'],
'mime_type' => $fileMimeType, // Add mime_type field
];
}
// Add CC recipients if provided
if (!empty($cc)) {
$postData['cc'] = [];
// Handle both string and array inputs for CC
$ccEmails = is_array($cc) ? $cc : [$cc];
foreach ($ccEmails as $ccEmail) {
$postData['cc'][] = [
'email_address' => [
'address' => $ccEmail
]
];
}
}
// Add BCC recipients if provided
if (!empty($bcc)) {
$postData['bcc'] = [];
// Handle both string and array inputs for BCC
$bccEmails = is_array($bcc) ? $bcc : [$bcc];
foreach ($bccEmails as $bccEmail) {
$postData['bcc'][] = [
'email_address' => [
'address' => $bccEmail
]
];
}
}
// Handle attachments
if (!empty($attachments)) {
$postData['attachments'] = [];
foreach ($attachments as $attachment) {
if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) {
// Determine MIME type dynamically
$fileMimeType = mime_content_type($attachment['filePath']);
$postData['attachments'][] = [
'content' => base64_encode(file_get_contents($attachment['filePath'])),
'name' => $attachment['fileName'],
'mime_type' => $fileMimeType,
];
}
}
}
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zeptomail.in/v1.1/email",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($postData),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'),
"cache-control: no-cache",
"content-type: application/json",
],
]);
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zeptomail.in/v1.1/email",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($postData),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'),
"cache-control: no-cache",
"content-type: application/json",
],
]);
$mail_result = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
// log_message('error','inside mail helper');
// log_message('error', $response.' error->'.$err);die();
$res['params'] = $params;
$MailDataHelper = new GmailResponseHandler();
$apiResponse = json_decode($mail_result, true);
$res['zepto_api'] = $apiResponse;
if (isset($apiResponse['error'])) {
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode([
'status' => 'failed',
'code' => 404,
'message' => 'Email Sent Failed...' . $emaill,
'data' => $res
], 404);
}
$mail_result = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
// $apiResponse = json_decode($response, true);
// Check if request_id exists in response (indicates success)
if (isset($apiResponse['data'])) {
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode([
'status' => 'success',
'code' => 200,
'message' => 'Email Sent Successfully...' . $emaill,
'data' => $res
], 200);
}
} catch (\Exception $e) {
$msg['error'] = $e->getMessage();
$msg['params'] = $params;
$res['params'] = $params;
$MailDataHelper = new GmailResponseHandler();
$apiResponse = json_decode($mail_result, true);
$res['zepto_api'] = $apiResponse;
if (isset($apiResponse['error'])) {
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode([
'status' => 'failed',
'code' => 500,
'data' => $msg
], 500);
'code' => 404,
'message' => 'Email Sent Failed...' . $emaill,
'data' => $res
], 404);
}
}
if (isset($apiResponse['data'])) {
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode([
'status' => 'success',
'code' => 200,
'message' => 'Email Sent Successfully...' . $emaill,
'data' => $res
], 200);
}
} catch (\Exception $e) {
$msg['error'] = $e->getMessage();
$msg['params'] = $params;
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode([
'status' => 'failed',
'code' => 500,
'data' => $msg
], 500);
}
}
public static function bulk_mail(array $mails = [])
{
$model = new JobModel();

View File

@ -532,8 +532,10 @@ if (!function_exists('name_and_empid_check_in_db'))
if (!function_exists('check_dependent_conflict'))
{
function check_dependent_conflict($family_data,$policy_terms,$actionArr)
{
function check_dependent_conflict($family_data,$policy_terms,$actionArr,$is_lgbtq)
{
// dd($family_data,$policy_terms,$actionArr,$is_lgbtq);
$result = ['status' => true];
$self_gender = null;
@ -622,10 +624,14 @@ if (!function_exists('check_dependent_conflict'))
// print_r(array_values(array_count_values($overall_famility_relationships)));
// print_r(in_array(2,array_values(array_count_values($overall_famility_relationships))));
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
//check if this policy is allowed LGBTQ
if($is_lgbtq == 0)
{
$result['status'] = false;
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
{
$result['status'] = false;
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
}
}
if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) )
@ -1072,7 +1078,9 @@ if (!function_exists('transform_excel_data_to_db'))
if (!function_exists('premium_calculation_manager'))
{
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
{
{
// dd($emp_data,$policy_terms,$slab_details,$default_si);
$myLogger = \Config\Services::mylogger();
// grid type
// 1 = premium => si
@ -1238,6 +1246,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['premium'] = $slab_value['premium'];
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
$is_match_found = true;
break;
}
@ -1246,12 +1255,12 @@ if (!function_exists('premium_calculation_manager'))
case "5":
//GMC - Employees Age + SI
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
$temp_date = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$age = calculate_days_bw_dates(from_date: $emp_data['dob'],to_date: $temp_date)->y;
$temp_date = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$age = calculate_days_bw_dates(from_date: $emp_data['dob'],to_date: $temp_date)->y;
// kint::dump($age);
foreach ($temp_slab_rates as $skey => $slab_value)
{
// dd($slab_value);
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3 ) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1261,6 +1270,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['premium'] = $slab_value['premium'];
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
$is_match_found = true;
break;
}
@ -1276,7 +1286,7 @@ if (!function_exists('premium_calculation_manager'))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
// echo $emp_data['name'];
// echo $emp_data['name']; die;
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
@ -1284,6 +1294,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['premium'] = $slab_value['premium'];
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
$is_match_found = true;
break;
}
@ -1307,6 +1318,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['premium'] = $slab_value['premium'];
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
$is_match_found = true;
break;
@ -1378,6 +1390,8 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['premium'] = $slab_value['premium'];
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
$is_match_found = true;
break;
}
@ -1459,6 +1473,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['premium'] = $slab_value['premium'];
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days);
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
$is_match_found = true;
break;
}

View File

@ -52,7 +52,8 @@ class ClientPolicyModel extends Model
"disclaimer",
"is_active",
"is_member_modify_allowed",
"cd_ac_pk"
"cd_ac_pk",
"is_lgbtq",
];
// Callbacks

View File

@ -35,7 +35,8 @@ class EmployeePolicyModel extends Model
"claim_status",
'ecard_sent_status',
'payable_employee',
'file_id'
'file_id',
"age_band",
];
// Callbacks
@ -286,7 +287,10 @@ class EmployeePolicyModel extends Model
employee_polices.premium,
employee_polices.rata_premimum as pro_rata_premium,
employee_polices.gst,
employee_polices.age_band,
(employee_polices.rata_premimum + employee_polices.gst) AS total,
batch_data.emp_policy_id,
batch_data.bl AS batch_list_batch_code,
batch_data.bf AS batch_files_batch_code,
@ -486,10 +490,13 @@ class EmployeePolicyModel extends Model
employee_polices.pre_existing_alignments,
employee_polices.policy_end_date,
employee_polices.basic_cover_si as old_basic_cover_si,
employee_polices.rata_premimum as old_si_premium,
employee_polices.rata_premimum as old_si_premium,
employee_polices.age_band,
batch_data.emp_policy_id,
batch_data.bl AS batch_list_batch_code,
batch_data.bf AS batch_files_batch_code,
sidata.new_basic_cover_si,
sidata.new_si_premium,
sidata.date_of_coverage,
@ -818,6 +825,8 @@ class EmployeePolicyModel extends Model
employee_polices.uhid as uhid,
employee_polices.rata_premimum as premium,
employee_polices.claim_status,
employee_polices.age_band,
batch_data.emp_policy_id AS emp_policy_id,
batch_data.bl AS batch_list_batch_code,

View File

@ -4,9 +4,9 @@ namespace App\Models;
use CodeIgniter\Model;
class NotificationModel extends Model
class NotificationModel extends Model
{
protected $table = 'notifications';
protected $primaryKey = 'id';
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",];
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json'];
}

View File

@ -175,14 +175,14 @@
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
</div>
<!-- <div class="form-group col-md-4">
<div class="form-group col-md-4">
<label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="is_member_modify_allowed" type="checkbox" name="is_member_modify_allowed" checked>
<input id="is_lgbtq" type="checkbox" name="is_lgbtq">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_member_modify_allowed" style="position: relative;bottom: 5px;left: 85px;"> In Enrollment Member Data Modification Allowed</label>
</div> -->
<label for="is_lgbtq" style="position: relative;bottom: 5px;left: 85px;"> Is LGBTQ Enable</label>
</div>
</div>
<div id="policy_fields"></div>
@ -825,6 +825,13 @@
$('#policy_visibility').prop('checked', false);
}
if (res.data.is_lgbtq == 1) {
$('#is_lgbtq').prop('checked', true);
} else {
$('#is_lgbtq').prop('checked', false);
}
// Member Modify Data Enable or Disable
// if (res.data.is_member_modify_allowed == 1) {
// $('#is_member_modify_allowed').prop('checked', true);
@ -1886,6 +1893,19 @@
$('#policy_visibility').prop('checked', false);
}
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
console.log(res.data.is_lgbtq)
if (res.data.is_lgbtq == 1) {
$('#is_lgbtq').prop('checked', true);
} else {
$('#is_lgbtq').prop('checked', false);
}
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
if (res.data.policy_type_id == '4' || res.data.policy_type_id == '5') {

View File

@ -147,13 +147,12 @@
<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 (
(in_array($employee['emp_status'], ['draft', 'enrolled']) && in_array($employee['status'], ['draft', 'enrolled'])) ||
($employee['status'] == 'active' && $employee['emp_status'] == 'active' && (empty($employee['email_corporate']) || empty($employee['mobile'])))
) {
?>
<?php
if
(
(in_array($employee['emp_status'], ['draft', 'enrolled', 'active']) && in_array($employee['status'], ['draft', 'enrolled', 'active']))
) {
?>
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<?php } ?>

View File

@ -1,70 +1,31 @@
<style>
custom-dropdown-menu {
.custom-dropdown-menu {
display: none;
position: fixed;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
clear: both !important;
font-weight: 400 !important;
color: #212529 !important;
text-align: inherit !important;
white-space: nowrap !important;
background-color: transparent !important;
border: 0 !important;
text-decoration: none !important;
position: relative !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
.custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important;
vertical-align: middle !important;
}
.table tbody tr {
cursor: pointer;
}
/* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffffff;
z-index: -1;
}
/* Add a subtle backdrop effect */
.custom-dropdown-menu::after {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.05);
z-index: -2;
pointer-events: none;
}
}
</style>
<div class="row" id="insurer_list">
<div class="col-12">

View File

@ -108,75 +108,32 @@ table.dataTable tbody td {
color: gray;
}
custom-dropdown-menu {
.custom-dropdown-menu {
display: none;
position: fixed;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
clear: both !important;
font-weight: 400 !important;
color: #212529 !important;
text-align: inherit !important;
white-space: nowrap !important;
background-color: transparent !important;
border: 0 !important;
text-decoration: none !important;
position: relative !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
.custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important;
vertical-align: middle !important;
}
.table tbody tr {
cursor: pointer;
}
/* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffffff;
z-index: -1;
}
/* Add a subtle backdrop effect */
.custom-dropdown-menu::after {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.05);
z-index: -2;
pointer-events: none;
}
}
</style>
<div class="row" id="inception_list">

View File

@ -1,70 +1,31 @@
<style>
custom-dropdown-menu {
.custom-dropdown-menu {
display: none;
position: fixed;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
clear: both !important;
font-weight: 400 !important;
color: #212529 !important;
text-align: inherit !important;
white-space: nowrap !important;
background-color: transparent !important;
border: 0 !important;
text-decoration: none !important;
position: relative !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
.custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important;
vertical-align: middle !important;
}
.table tbody tr {
cursor: pointer;
}
/* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffffff;
z-index: -1;
}
/* Add a subtle backdrop effect */
.custom-dropdown-menu::after {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.05);
z-index: -2;
pointer-events: none;
}
}
</style>
<div class="row" id="kyc_list">
<div class="col-12">

View File

@ -79,7 +79,10 @@
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
//srinivas
<script src="https://editor.unlayer.com/embed.js"></script>
<!-- <script src="<?= base_url('public/unlayer/js/embed.js').''?>"></script> -->
//srinivas
<style>

View File

@ -37,72 +37,33 @@ table.dataTable tbody td {
margin-bottom: 10px;
}
custom-dropdown-menu {
.custom-dropdown-menu {
display: none;
position: fixed;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
clear: both !important;
font-weight: 400 !important;
color: #212529 !important;
text-align: inherit !important;
white-space: nowrap !important;
background-color: transparent !important;
border: 0 !important;
text-decoration: none !important;
position: relative !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
.custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important;
vertical-align: middle !important;
}
.table tbody tr {
cursor: pointer;
}
/* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffffff;
z-index: -1;
}
/* Add a subtle backdrop effect */
.custom-dropdown-menu::after {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.05);
z-index: -2;
pointer-events: none;
}
}
</style>

View File

@ -9,6 +9,29 @@
.scrollb {
overflow-y: auto !important;
}
#editor-container {
width: 100%;
min-height: 600px;
}
#account_maneger_summary_mail_modal .modal-dialog,
#member_review_and_summary_mail_modal .modal-dialog {
max-width: 90% !important;
width: 90% !important;
}
/* Also ensure the modal body has proper height */
#account_maneger_summary_mail_modal .modal-body,
#member_review_and_summary_mail_modal .modal-body {
min-height: 600px;
padding: 20px;
}
/* If you're using Bootstrap's modal, you might also want to ensure proper positioning */
.modal-dialog {
margin: 1.75rem auto;
}
</style>
<div class="tab-pane fade" id="notification-tab">
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>"/>
@ -526,7 +549,7 @@
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
<!-- <div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
@ -561,7 +584,7 @@
<div class="form-group col-md-2 testmail" style="display: none;">
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
</div>
</div>
</div> -->
<!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
@ -574,7 +597,7 @@
</select>
</div>
</div> -->
<div class="form-row" id="rac_rate_dropdown">
<!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="account_maneger_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option>
@ -607,11 +630,61 @@
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div> -->
<!-- </div>/.modal-content -->
<!-- </div>/.modal-dialog -->
<!-- </div>/.modal -->
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="account_maneger_summary_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" value="Account Maneger Summary Mail" readonly class="form-control" 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>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
<div class="form-group col-md-2 testmail" style="display: none;">
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
</div>
</div><hr>
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="editor-container" style="height: 300px;width:max-content"></div>
</div>
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1 preview_button"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal content for the Large example -->
<div class="modal fade" id="client_hr_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
@ -1044,49 +1117,49 @@
}
})
$('#account_maneger_summary_mail_form').submit(function (event)
{
event.preventDefault();
var joditEditor = editor4;
if (joditEditor)
{
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray();
formData.push({ name: 'mailContent', value: mailContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
// $('#account_maneger_summary_mail_form').submit(function (event)
// {
// event.preventDefault();
// var joditEditor = editor4;
// if (joditEditor)
// {
// var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
// var formData = $(this).serializeArray();
// formData.push({ name: 'mailContent', value: mailContent });
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res)
{
$('#account_maneger_summary_mail_modal').find('.close').click();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error)
{
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function()
{
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
}
else
{
console.error("Jodit editor instance is not defined.");
}
})
// $('.loader').fadeIn();
// $('.loader-mask').fadeIn();
// var form_action = '<?= base_url("client/notification/create") ?>';
// $.ajax({
// url: form_action,
// type: "POST",
// data: formData,
// dataType: 'json',
// success: function(res)
// {
// $('#account_maneger_summary_mail_modal').find('.close').click();
// $('.loader').fadeOut();
// $('.loader-mask').delay(350).fadeOut('slow');
// },
// error: function (xhr, status, error)
// {
// console.error(xhr.responseText);
// console.error(status, error);
// setTimeout(function()
// {
// $('.loader').fadeOut();
// $('.loader-mask').delay(350).fadeOut('slow');
// toastr.warning('Something Wrong!', 'warning');
// }, 1000);
// }
// });
// }
// else
// {
// console.error("Jodit editor instance is not defined.");
// }
// })
$('#client_hr_summary_mail_form').submit(function (event)
{
@ -1207,7 +1280,7 @@
{
var template_name = $(element).attr('id');
if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "account_maneger_summary_mail" || template_name == "client_hr_summary_mail")
if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "client_hr_summary_mail")
{
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@ -1556,6 +1629,323 @@
});
}
</script>
</script>
<script>
// Global editor variable
let editor = null;
// Function to check if unlayer is loaded and available
function isUnlayerLoaded() {
return typeof unlayer !== 'undefined' && unlayer !== null;
}
// Enhanced waiting function with better error handling
function waitForUnlayer(callback, maxAttempts = 20) {
let attempts = 0;
const checkUnlayer = setInterval(function() {
attempts++;
console.log("Checking for Unlayer, attempt:", attempts);
if (isUnlayerLoaded()) {
clearInterval(checkUnlayer);
console.log("Unlayer loaded successfully");
callback(true);
} else if (attempts >= maxAttempts) {
clearInterval(checkUnlayer);
console.error("Unlayer failed to load after", attempts, "attempts");
callback(false);
}
}, 1000); // Increased interval to 1 second
}
// Improved editor initialization function
function initializeEditor(callback) {
console.log("Starting editor initialization...");
const editorContainer = document.getElementById('editor-container');
if (!editorContainer) {
console.error("Editor container not found");
if (callback) callback(null);
return;
}
// Ensure the script is loaded
if (!document.querySelector('script[src*="unlayer"]')) {
console.error("Unlayer script is not included in the page");
if (callback) callback(null);
return;
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
waitForUnlayer(function(unlayerLoaded) {
if (!unlayerLoaded) {
console.error("Unlayer not available");
if (callback) callback(null);
return;
}
try {
// Destroy existing instance if it exists
if (editor) {
console.log("Destroying existing editor...");
editor.destroy();
editor = null;
}
// Clear the container
editorContainer.innerHTML = '';
// Create new editor instance with error handling
console.log("Creating new editor instance...");
editor = unlayer.createEditor({
id: 'editor-container',
projectId: 263979,
displayMode: "email",
features: {
textEditor: {tables: true },
preview: {enabled: true,deviceOptions: ['desktop', 'mobile']},
// preview: { enabled: true },
imageEditor: { enabled: true },
appearance: {
theme: 'light',
panels: {
tools: { dock: "right" }
}
}
},
branding:false,
tools: {
// Configure any specific tools you need
text: {
enabled: true
},
image: {
enabled: true
}
}
});
// Verify editor initialization
if (!editor || typeof editor.loadDesign !== 'function') {
throw new Error("Editor initialization failed - editor instance is invalid");
}
console.log("Editor initialization completed successfully");
$('.loader').fadeOut();
$('.loader-mask').fadeOut();
if (callback) callback(editor);
} catch (error) {
console.error("Error in editor initialization:", error);
if (callback) callback(null);
$('.loader').fadeOut();
$('.loader-mask').fadeOut();
}
});
}
// Modified template data function with better error handling
function getMailTemplateData(element) {
const template_name = element.id;
const validTemplates = [
"account_maneger_summary_mail",
];
if (!validTemplates.includes(template_name)) {
console.error("Invalid template name:", template_name);
return;
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
const primaryKey = $('#general_PrimaryKey').val();
const baseUrl = '<?= base_url("client/notification/getMailTemplateData/") ?>';
const form_action = `${baseUrl}${template_name}/${primaryKey}`;
$.ajax({
url: form_action,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('get Mail Template Data', res);
if (res) {
// Set subject
$(`#${template_name}_form #subject`).val(res.subject || '');
// Initialize editor with retry mechanism
let retryCount = 0;
const initWithRetry = function() {
initializeEditor(function(editorInstance) {
if (!editorInstance && retryCount < 3) {
console.log(`Retrying editor initialization (${retryCount + 1}/3)...`);
retryCount++;
setTimeout(initWithRetry, 1000);
return;
}
if (!editorInstance) {
console.error("Editor initialization failed after retries");
toastr.error('Editor initialization failed. Please refresh the page.');
return;
}
if (res.mail_content_json) {
try {
const design = JSON.parse(res.mail_content_json);
editorInstance.loadDesign(design);
console.log("Design loaded successfully");
$('iframe').on('load', function() {
console.log('Iframe loaded.');
const iframe = $(this);
// Overlay the branding area
const overlay = $('<div>', {
css: {
position: 'absolute',
bottom: '0', // Adjust based on branding position
left: '0',
width: iframe.width(),
height: '50px', // Adjust height to cover branding
backgroundColor: 'white',
zIndex: '9999',
pointerEvents: 'none',
},
});
const iframeParent = iframe.parent();
if (iframeParent.css('position') === 'static') {
iframeParent.css('position', 'relative');
}
iframeParent.append(overlay);
console.log('Overlay added to hide branding.');
});
$(window).on('resize', function () {
overlay.css({
width: iframe.width(),
height: '50px', // Adjust height dynamically if necessary
});
});
} catch (error) {
console.error("Error parsing mail content JSON:", error);
toastr.error('Error loading email template');
}
}
});
};
initWithRetry();
if (res.data) {
addHTMLInput(res.data);
} else {
addHTMLInput();
}
// Update UI elements
$('.testmail').toggle(!!res.id);
$('#attachment_table').toggle(!!res.id);
$('.setid').attr('data-id', res.id || '');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function(xhr, status, error) {
console.error("Ajax error:", { status, error, response: xhr.responseText });
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.error('Failed to load template data');
}
});
}
$('#account_maneger_summary_mail_form').submit(function (event) {
event.preventDefault();
// Check if editor instance exists
if (!editor) {
console.error("Editor not initialized");
toastr.error("Editor not ready. Please try again.");
return;
}
// Use the editor instance instead of unlayer directly
editor.exportHtml(function (data) {
var formData = $('#account_maneger_summary_mail_form').serializeArray();
// Append Unlayer editor data
formData.push({
name: 'mailContent',
value: data.html
});
formData.push({
name: 'client_id',
value: $('#general_PrimaryKey').val()
});
formData.push({
name: 'mailJson',
value: JSON.stringify(data.design)
});
console.log(formData);
// Show loading indicators
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
$('#account_maneger_summary_mail_modal').find('.close').click();
toastr.success('Template saved successfully');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Went Wrong!', 'warning');
}, 1000);
}
});
});
});
document.addEventListener("DOMContentLoaded", function () {
const observer = new MutationObserver(() => {
const brandingElement = document.querySelector('#editor-container .blockbuilder-branding');
if (brandingElement) {
brandingElement.remove(); // Remove the branding element
}
});
// Start observing the editor container for changes
const editorContainer = document.getElementById('editor-container');
if (editorContainer) {
observer.observe(editorContainer, { childList: true, subtree: true });
}
});
</script>

View File

@ -45,73 +45,32 @@ table.dataTable tbody td {
.addbtnStyle{
margin-left: 20px !important;
}
custom-dropdown-menu {
.custom-dropdown-menu {
display: none;
position: fixed;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
clear: both !important;
font-weight: 400 !important;
color: #212529 !important;
text-align: inherit !important;
white-space: nowrap !important;
background-color: transparent !important;
border: 0 !important;
text-decoration: none !important;
position: relative !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
.custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important;
vertical-align: middle !important;
}
.table tbody tr {
cursor: pointer;
}
/* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffffff;
z-index: -1;
}
/* Add a subtle backdrop effect */
.custom-dropdown-menu::after {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.05);
z-index: -2;
pointer-events: none;
}
}
</style>
<style>

View File

@ -1,71 +1,31 @@
<style>
custom-dropdown-menu {
.custom-dropdown-menu {
display: none;
position: fixed;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
clear: both !important;
font-weight: 400 !important;
color: #212529 !important;
text-align: inherit !important;
white-space: nowrap !important;
background-color: transparent !important;
border: 0 !important;
text-decoration: none !important;
position: relative !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
.custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important;
vertical-align: middle !important;
}
.table tbody tr {
cursor: pointer;
}
/* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffffff;
z-index: -1;
}
/* Add a subtle backdrop effect */
.custom-dropdown-menu::after {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.05);
z-index: -2;
pointer-events: none;
}
</style>
} </style>
<div class="row" id="tpa_list">
<div class="col-12">
<div class="card">