'MERGE_EMP_REST_CON_FILE'

This commit is contained in:
velz 2026-02-05 11:45:01 +05:30
commit 77fe5aa2c7
18 changed files with 1161 additions and 572 deletions

View File

@ -37,7 +37,6 @@ $routes->get("view", "EmployeeController::viewECard/$1");
$routes->get("checkWellnessOnboardStatus/(:any)", "EmployeeController::checkWellnessOnboardStatus/$1");
$routes->get("initiateWellnessOnboard/(:any)", "EmployeeController::initiateWellnessOnboard/$1");
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
$routes->get("smapletest", "ClientController::smapletest");
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
$routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
@ -560,6 +559,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->get("getSSORedirectUrl", "ApiServiceController::getSSORedirectUrl");
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("downloadCdSplitUpFile", "EmployeeRestController::downloadCdSplitUpFile");
$routes->group("employeeRest", ['filter' => ['appSignature'] ], function ($routes) {
@ -604,7 +605,7 @@ $routes->group("employeeRest", ['filter' => ['appSignature'] ], function ($route
});
$routes->group("employeeRest", ["filter" => ['GlobalPostFileUploadGuard', 'appSignature', 'authJWT']], function ($routes) {
$routes->group("employeeRest", ["filter" => ['GlobalPostFileUploadGuard', 'appSignature', 'authJWT']], function ($routes) {
$routes->post('logout', 'RestAuthenticationController::logout');
@ -687,8 +688,10 @@ $routes->group("employeeRest", ['filter' => ['appSignature'] ], function ($route
// get insurer and policy type
$routes->get("getPolicyTypeAndInsurer", "EmployeeRestController::getPolicyTypeAndInsurer");
$routes->get("downloadCdSplitUpFile", "EmployeeRestController::downloadCdSplitUpFile");
$routes->get("getExcelFileErrors/(:any)", "EmployeeController::getExcelFileErrors/$1");
$routes->get("getPolicyAndEndorsementFiles", "EmployeeRestController::getPolicyAndEndorsementFiles");
$routes->get("downloadPolicyFiles", "EmployeeRestController::downloadPolicyFiles");
$routes->post("bulkEcardDownloadAsZip", "EmployeeRestController::bulkEcardDownloadAsZip");
});
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");

View File

@ -141,6 +141,7 @@ class ClientController extends AdminController
$isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $field, $clientId, $branchId);
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
}
public function checkDuplicateTableFieldValue()
{
$table = $this->request->getPost('table');
@ -162,35 +163,6 @@ class ClientController extends AdminController
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
}
public function smapletest()
{
$headers = [
'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'
];
$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 data-custom-table-css="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>';
@ -510,7 +482,6 @@ class ClientController extends AdminController
// $this->loadLayout('client_onboarding', $data);
}
public function typeList($id = null)
{
try {
@ -547,7 +518,6 @@ class ClientController extends AdminController
}
}
public function updateEmpAndPolicyStatus()
{
$return = $this->clientPolicyModel->updateStatus();
@ -678,7 +648,7 @@ class ClientController extends AdminController
// echo "<pre>";
// print_r($data); die;
$data['placeHolders'] = ['member_name', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
$data['placeHolders'] = ['hr_name', 'member_name', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
// dd($data['placeHolders']);
@ -982,7 +952,7 @@ class ClientController extends AdminController
}, $rawList)) : [];
$editData['client_policy']['role'] = get_role_id();
$editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll();
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
$editData['placeHolders'] = ['hr_name', 'member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
$editData['api_data'] = $this->clientApi->where("client_id", $id)->where("is_active", 1)->first();
// dd($editData);
@ -2088,6 +2058,7 @@ class ClientController extends AdminController
$sanitized_post_data['enrolment_visibility'] = $sanitized_post_data['enrolment_visibility'] ?? null ? 1 : 0;
$sanitized_post_data['is_lgbtq'] = $sanitized_post_data['is_lgbtq'] ?? null ? 1 : 0;
$sanitized_post_data['wellness_vendor_id'] = !empty($sanitized_post_data['wellness_vendor_id']) ? $sanitized_post_data['wellness_vendor_id'] : null;
$sanitized_post_data['cd_ac_pk'] = $sanitized_post_data['cd_ac_no'] ?? null;
if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) {
@ -2126,6 +2097,8 @@ class ClientController extends AdminController
$insert = $this->clientPolicyModel->insert($sanitized_post_data);
if ($insert) {
// this function to create a policy transaction entry at the time of client policy create
$this->createPolicyTransactionInceptionEntry($insert, $sanitized_post_data);
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($sanitized_post_data['client_id']);
$clientPoliceData['role'] = get_role_id();
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'client_id' => $client_id, 'method' => 'CERATE', 'post_data' => $insert], 200);
@ -2310,6 +2283,29 @@ class ClientController extends AdminController
}
}
public function createPolicyTransactionInceptionEntry($client_policy_id, $data)
{
$data['action_type'] = 'inception';
$data['client_policy_id'] = $client_policy_id;
$data['entry_from'] = 3;
$data['issuer_branch'] = 1;
$data['issuer'] = 2;
$data['status'] = 'completed';
$data['renewal_date'] = $data['policy_end_date'];
$data['bro_payable_by'] = 1;
$insert = $this->policyTransactionModel->insert($data);
if($insert){
$pcsd_data['pt_id'] = $insert;
$pcsd_data['insurer_id'] = $data['insurer_id'] ?? null;
$pcsd_data['insurer_branch_id'] = $data['insurer_branch_id'] ?? null;
$this->PTCOShareDetailsModel->insert($pcsd_data);
}
return $insert;
}
// Save Rack Rate function
@ -2843,7 +2839,6 @@ class ClientController extends AdminController
}
}
private function updatePTCoShareTableEntry($policy_transaction_data, $old_client_policy_data, $data)
{
$updated_ids = [];
@ -2889,9 +2884,6 @@ class ClientController extends AdminController
];
}
public function uploadVehicleFile($params = null)
{
$this->myLogger->logme('error', 'uploadVehicleFile function called');
@ -6463,7 +6455,7 @@ class ClientController extends AdminController
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 310]); dd($res);//for live
// $res = $EmpDataServiceController->getInceptionBasePremium(["13332","13333","13334","13335","13336"]); dd($res);//for live
// $res = $EmpDataServiceController->getDeletionBasePremium(["13248","13250","13249","13247"], json_decode('{"employeeIds":["13248","13250","13249","13247"],"client_id":"3927","client_policy_id":"6183","client_branch_id":"1874","cd_ac_no":"CD9751909505","endorsement_no":"END1238","count":4,"event_name":"deletion","policy_name":"GMC","user_id":"48"}', true)); dd($res);//for live
// $res = $EmpDataServiceController->makeEntryForBDSPolicyTransaction(json_decode('{"client_policy_id":"6187","endorsement_no":null,"emp_count":5,"action_type":"inception","no_of_insured":3,"no_of_dependent":0}', true)); dd($res);//for live
// $res = $EmpDataServiceController->makeEntryForBDSPolicyTransaction(json_decode('{"client_policy_id":"6187","endorsement_no":"000000001","emp_count":5,"action_type":"addition","no_of_insured":3,"no_of_dependent":0, "base_premium" : "1000", "gst" : "180", "policy_issue_date" : "2025-12-31"}', true)); dd($res);//for live
// $res = $EmpDataServiceController->sendMailForDownloadingECard(['ids' => $ids, 'client_policy_id' => $client_policy_id]);
// $res = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data, 1); dd($result);
// $res = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data, 1);
@ -8737,6 +8729,8 @@ class ClientController extends AdminController
$member_ecard_mail_template = $this->notificationModel->where('client_id', NULL)->where('template_name', 'member_ecard_mail')->get()->getResultArray()[0] ?? [];
$member_common_mail_template = $this->notificationModel->where('client_id', NULL)->where('template_name', 'member_common_mail')->get()->getResultArray()[0] ?? [];
$hr_cd_insufficient_balance_mail_template = $this->notificationModel->where('client_id', NULL)->where('template_name', 'hr_cd_insufficient_balance_mail')->get()->getResultArray()[0] ?? [];
$default_member_welcome_mail_template = [
'client_id' => $client_id,
@ -8808,6 +8802,20 @@ class ClientController extends AdminController
'mail_content_copy' => null
];
$hr_cd_insufficient_balance_mail_template = [
'client_id' => $client_id,
'template_name' => 'hr_cd_insufficient_balance_mail',
'subject' => $hr_cd_insufficient_balance_mail_template['subject'] ?? '',
'mail_content' => $hr_cd_insufficient_balance_mail_template['mail_content'] ?? '',
'mail_content_json' => $hr_cd_insufficient_balance_mail_template['mail_content_json'] ?? '',
'created_by' => get_session_userid(),
'created_at' => date('Y-m-d H:i:s'),
'updated_by' => null,
'updated_at' => date('Y-m-d H:i:s'),
'mail_content_copy' => null
];
$this->myLogger->logme('error', 'Default Mail Template Data ' . json_encode([
$default_member_welcome_mail_template,
$default_member_remainder_mail_template,
@ -8821,7 +8829,8 @@ class ClientController extends AdminController
$default_member_remainder_mail_template,
$default_member_review_and_summary_mail_template,
$default_member_ecard_mail_template,
$default_member_common_mail_template
$default_member_common_mail_template,
$hr_cd_insufficient_balance_mail_template,
]);

View File

@ -734,17 +734,23 @@ class EmpDataServiceController extends BaseController
if($export_data['insurer_or_tpa'] == 'insurer')
{
if (!empty($cash_balance)) {
if ((int) $cash_balance['balance'] < (int) $rounded_totals) {
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
session()->set('cd_balance', false);
session()->set('cd_amount', $cash_balance['balance']);
session()->set('excel_file_amt', $rounded_totals);
if ((int) $cash_balance['balance'] < (int) $totals) {
clear_cd_balance_session(); // Clear old junk first
$cd_session_data = json_encode([
'cd_balance' => false,
'cd_amount' => $cash_balance['balance'],
'excel_file_amt' => $totals
]);
session()->set('cd_balance_info', $cd_session_data);
session()->set('cd_balance', 'insufficient'); // Use a string status for clarity
$hr_data = $this->getHrdataForInsufficientMailSend($export_data['client_branch_id']);
session()->set('hr_data', json_encode(['client_id' => $export_data['client_id'], 'hr_data' => $hr_data]));
}else{
session()->set('cd_balance', true);
session()->set('cd_amount', $cash_balance['balance']);
session()->set('excel_file_amt', $rounded_totals);
session()->set('cd_balance', 'sufficient'); // Use a string status for clarity
session()->set('cd_balance_info', null);
}
}
}
@ -1065,17 +1071,23 @@ class EmpDataServiceController extends BaseController
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 ((int) $cash_balance['balance'] < (int) $totals) {
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
session()->set('cd_balance', false);
session()->set('cd_amount', $cash_balance['balance']);
session()->set('excel_file_amt', $totals);
if ((int) $cash_balance['balance'] < (int) $totals) {
clear_cd_balance_session(); // Clear old junk first
$cd_session_data = json_encode([
'cd_balance' => false,
'cd_amount' => $cash_balance['balance'],
'excel_file_amt' => $totals
]);
session()->set('cd_balance_info', $cd_session_data);
session()->set('cd_balance', 'insufficient'); // Use a string status for clarity
$hr_data = $this->getHrdataForInsufficientMailSend($export_data['client_branch_id']);
session()->set('hr_data', json_encode(['client_id' => $export_data['client_id'], 'hr_data' => $hr_data]));
}else{
session()->set('cd_balance', true);
session()->set('cd_amount', $cash_balance['balance']);
session()->set('excel_file_amt', $totals);
session()->set('cd_balance', 'sufficient'); // Use a string status for clarity
session()->set('cd_balance_info', null);
}
}
}
@ -2218,7 +2230,7 @@ class EmpDataServiceController extends BaseController
//send ecard mail if the event is tpa only
if ($file['insurer_or_tpa'] == 'tpa') {
if ($get_policy_type['policy_type_id'] != 1) {
if (in_array($get_policy_type['policy_type_id'], [2, 3])) {
// generate e-card and store S3
$r = Jobs::addJob(['job_name' => 'bulkGenerateEcardAndStoreinS3', 'payload' => ['client_policy_id' => $client_policy_id]]);
@ -2634,7 +2646,7 @@ class EmpDataServiceController extends BaseController
'status' => $status_val,
]);
if($client_policy_data['policy_type_id'] != 1){
if(in_array($client_policy_data['policy_type_id'], [2, 3])){
// re-generate e-card and store S3
$r = Jobs::addJob(['job_name' => 'bulkGenerateEcardAndStoreinS3', 'payload' => ['client_policy_id' => $client_policy_id]]);
}

View File

@ -31,6 +31,7 @@ use App\Models\UserModel;
use App\Models\PartnerEndorsementRequestModel;
use App\Models\TpaApiDataModel;
use App\Models\LevelContactModel;
use App\Models\NotificationModel;
use App\Controllers\Jobs;
@ -484,7 +485,17 @@ class EmployeeController extends AdminController
}
public function getExcelFileErrors($file_id, $retun_type = null)
{
{
$file_data = $this->fileModel->where('id', $file_id)->first();
$error = json_decode($file_data['reason'] ?? '{}', true);
if(!empty($error) && $retun_type == 'api'){
$send = isset($error['error_summary'][5]) || isset($error['error_summary'][6]) ? true : false;
if($send){
return $this->respond(['status' => false, 'code' => 404, 'message' => $error['error_data'] ?? 'System error', 'data' => []], 200);
}
}
// $file_id = $this->request->uri->getSegment(3);
$empServiceController = new EmployeeServiceController();
@ -4544,7 +4555,6 @@ class EmployeeController extends AdminController
}
}
public function insufficientCdBalanceHrMailSend()
{
$post_data = $this->request->getJson(true);
@ -4555,29 +4565,38 @@ class EmployeeController extends AdminController
$client_data = $this->clientModel->where('is_active', 1)->where('id', $post_data['client_id'])->first();
$common['mail_type'] = "insufficient_cd_balance_by_hr";
if(empty($client_data)){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No client found'], 200);
}
$notificationModal = new NotificationModel();
$notification_data = $notificationModal
->where('client_id', $post_data['client_id'])
->where('template_name', 'hr_cd_insufficient_balance_mail')
->first();
if(empty($notification_data)){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No template found'], 200);
}
if(empty($notification_data['subject']) || empty($notification_data['mail_content'])){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Template subject or mail content is empty'], 200);
}
if(empty($notification_data['enabled']) || $notification_data['enabled'] != 1){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Template is disabled'], 200);
}
$common['mail_type'] = "hr_cd_insufficient_balance_mail";
$common['client_id'] = $post_data['client_id'];
$subject = 'Insufficient CD Balance Notification';
$mail_content = '
Dear {{HR_NAME}},
Greetings from Nhance.
We would like to inform you that the CD balance for {{CLIENT_NAME}} is currently low / insufficient, which may impact further processing of insurance-related activities.
Kindly request you to credit the required amount at the earliest to avoid any service disruption.
Please let us know once the amount is credited, or if you need any clarification from our end.
Thank you for your support and cooperation.
';
$subject = $notification_data['subject'];
$mail_content = $notification_data['mail_content'];
foreach ($post_data['mails'] as $hr_id => $hr_data) {
$mail_content = str_ireplace('{{HR_NAME}}', $hr_data['name'], $mail_content);
$mail_content = str_ireplace('{{CLIENT_NAME}}', $client_data['client_name'], $mail_content);
$mail_content = str_ireplace('{{hr_name}}', $hr_data['name'], $mail_content);
$mail_content = str_ireplace('{{client_name}}', $client_data['client_name'], $mail_content);
$res = MailHelper::send_email(['mail' => $hr_data['mail'], 'subject' => $subject, 'message' => $mail_content, 'common' => $common]);
}

View File

@ -41,6 +41,8 @@ use App\Models\InsurerModel;
use App\Models\HrFileUploadModel;
use App\Models\EmployeeRetailPolicy;
use App\Models\BatchFileModel;
use App\Models\ClientDepositModel;
use App\Models\PTFileModel;
@ -2372,6 +2374,8 @@ class EmployeeRestController extends AdminController
$value['totalMembersCount'] = count($employeeDetails);
$value['membersCountOfActive'] = $activeCount;
$value['membersCountOfInactive'] = $inactiveCount;
$value['is_ecard_bulk_download'] = 0;
$value['is_ecard_bulk_download_for_employee'] = 0;
array_push($result, $value);
@ -3625,6 +3629,12 @@ class EmployeeRestController extends AdminController
$get_docs_name = $this->request->getPost('claim_doc_names') ?? [];
$policy_transaction_id = $this->request->getPost('policy_transaction_id') ?? null;
if (is_string($received_data['client_id']) && preg_match('/^[a-f0-9]{32}$/i', $received_data['client_id'])) {
$client_data = $this->clientModel->where('MD5(id)', $received_data['client_id'])->first();
$received_data['client_id'] = $client_data['id'] ?? null;
}
$client_policy_data = $this->clientPolicyModel->where('id', $received_data['client_policy_id'] ?? null)->first();
$isduplicate = checkDuplicateClaim([
@ -4578,15 +4588,15 @@ class EmployeeRestController extends AdminController
// Prepare data
$data = [
'client_id' => $this->request->getPost('client_id'),
'client_branch_id' => $this->request->getPost('client_branch_id'),
'policy_id' => $this->request->getPost('policy_id'),
'policy_no' => $this->request->getPost('policy_no'),
'client_id' => $post_data['client_id'],
'client_branch_id' => $post_data['client_branch_id'],
'policy_id' => $post_data['policy_id'],
'policy_no' => $post_data['policy_no'],
'file_name' => $newFileName,
'file_action' => $this->request->getPost('file_action'),
'file_action' => $post_data['file_action'],
'status' => 'Yet to start',
'created_by' => $this->request->getPost('created_by'),
'updated_by' => $this->request->getPost('created_by'),
'created_by' => $post_data['created_by'],
'updated_by' => $post_data['created_by'],
];
// Save into DB
@ -4609,14 +4619,16 @@ class EmployeeRestController extends AdminController
$responce = $employeeController->employeesUplodWithEvents($post_data);
// print_r($responce); die;
if($responce['status']){
$file_data = $this->getDataFromHrFilesTable(['file_id' => $responce['file_id']]);
$responce['data'] = $file_data;
return $responce;
}else{
$responce['data'] = [];
return $responce;
}
return $responce;
// if(isset($responce['file_id'])){
// $file_data = $this->getDataFromHrFilesTable(['hr_id' => $responce['created_by']]);
// $responce['data'] = $file_data;
// return $responce;
// }else{
// $responce['data'] = [];
// return $responce;
// }
}
private function giveNotificationToClientsAccountManager($data)
@ -4848,7 +4860,7 @@ class EmployeeRestController extends AdminController
THEN hr_file_upload.status
ELSE CONCAT(UCASE(LEFT(f.status, 1)), LCASE(SUBSTRING(f.status, 2)))
END AS status,
'1' as file_error_status
'0' as file_error_status
", false)
->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
@ -4883,6 +4895,7 @@ class EmployeeRestController extends AdminController
}
// Execute query
$builder->orderBy('hr_file_upload.id', 'DESC');
$data = $builder->get()->getResultArray();
if(!empty($data)){
@ -4903,7 +4916,7 @@ class EmployeeRestController extends AdminController
files.policy_id,
cp.policy_no,
files.file_name,
files.action,
files.action as file_action,
files.created_at,
files.created_by,
files.updated_at,
@ -4937,7 +4950,11 @@ class EmployeeRestController extends AdminController
}
if (isset($search_data['client_id']) && !empty($search_data['client_id'])) {
$builder->where("files.client_id", $search_data['client_id']);
if (is_string($search_data['client_id']) && preg_match('/^[a-f0-9]{32}$/i', $search_data['client_id'])) {
$builder->where("MD5(files.client_id)", $search_data['client_id']);
} else {
$builder->where("files.client_id", $search_data['client_id']);
}
}
if (isset($search_data['file_id']) && !empty($search_data['file_id'])) {
@ -4946,6 +4963,7 @@ class EmployeeRestController extends AdminController
// Execute query
$builder->orderBy('files.id', 'DESC');
$data = $builder->get()->getResultArray();
if (!empty($data)) {
@ -5412,6 +5430,7 @@ class EmployeeRestController extends AdminController
}
}
public function getHrDashboad()
{
// $dashboard_id = $this->request->getGet('dashboard_id') ?? null;
@ -5455,4 +5474,116 @@ class EmployeeRestController extends AdminController
}
// get policy files
public function getPolicyAndEndorsementFiles()
{
$cd_ac_pk = $this->request->getGet('cd_ac_pk') ?? null;
$cdModel = new ClientDepositModel();
$cd_data = $cdModel->where('id', $cd_ac_pk)
->where('is_active', 1)
->where('client_policy_id IS NOT NULL')
->first();
if(empty($cd_data)){
$this->myLogger->logme('error', 'getPolicyAndEndorsementFiles: No Client Deposit data found for cd_ac_pk=' . $cd_ac_pk);
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No file found', 'data' => []], 200);
}
$client_policy_data = $this->clientPolicyModel
->where('id', $cd_data['client_policy_id'])
->where('is_active', 1)
->first();
if(empty($client_policy_data)){
$this->myLogger->logme('error', 'getPolicyAndEndorsementFiles: No Client Policy data found for client_policy_id=' . $cd_data['client_policy_id']);
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No file found', 'data' => []], 200);
}
$policyTransactionModel = new PolicyTransactionModel();
$policy_transaction_data = $policyTransactionModel
->where('is_active', 1)
->where('policy_no', $client_policy_data['policy_no'])
->where('action_type', $cd_data['event_name'])
->findAll();
if(empty($policy_transaction_data)){
$this->myLogger->logme('error', 'getPolicyAndEndorsementFiles: No Policy Transaction data found for policy_no=' . $client_policy_data['policy_no']);
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No file found', 'data' => []], 200);
}
$policy_transaction_ids = array_column($policy_transaction_data, 'id');
$ptFilesModel = new PTFileModel();
$pt_files_data = $ptFilesModel->where('is_active', 1)->whereIn('pt_id', $policy_transaction_ids)->findAll();
if(empty($pt_files_data)){
$this->myLogger->logme('error', 'getPolicyAndEndorsementFiles: No PT Files data found for pt_ids=' . implode(',', $policy_transaction_ids));
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No file found', 'data' => []], 200);
}
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Files found', 'data' => $pt_files_data], 200);
}
// download policy file
public function downloadPolicyFiles()
{
$pt_file_id = $this->request->getGet('file_id') ?? null;
if(empty($pt_file_id)){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'File ID is required'], 200);
}
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$ptFilesModel = new PTFileModel();
$pt_files_data = $ptFilesModel->where('is_active', 1)->where('id', $pt_file_id)->first();
if(empty($pt_files_data)){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'The Physical File Not Found in server'], 200);
}
$filePath = $uploadFilePath . '/' . $pt_files_data['file_name'];
if (!file_exists($filePath)) {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'The Physical File Not Found in server'], 200);
}
// Force file download
return $this->response->download($filePath, null)->setFileName($pt_files_data['file_name']);
}
public function bulkEcardDownloadAsZip()
{
$received_data = $this->request->getJSON(true) ?? null;
$this->myLogger->logme('error', 'bulkEcardDownloadAsZip: Received payload = ' . json_encode($received_data ?? []));
if(empty($received_data['client_policy_id']) && empty($received_data['emp_policy_ids'])){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'client_policy_id or employee_policy_ids is required'], 200);
}
if(empty($received_data['hr_id'])){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'hr_id is required'], 200);
}
$employee_data = $this->employeePolicyModel->getEmployeeDataWithPolicyUsingClientPolicyIdOrEmployeePolicyIds($received_data);
if(empty($employee_data)){
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No employee data found for the policy'], 200);
}
$received_data['folder_name'] = 'bulk_ecards_' . $employee_data[0]['policy_no'] . '_' . date('Y-m-d_H-i-s');
// Dispatch background job to process the bulk e-card download
$r = Jobs::addJob(['job_name' => 'bulkEcardDownloadAsZipFromS3', 'payload' => $received_data]);
$this->myLogger->logme('error', 'bulkEcardDownloadAsZip: Job dispatched with result = ' . json_encode($r ?? []));
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Bulk E-card download process started. Link share your mail'], 200);
}
}

View File

@ -94,7 +94,8 @@ class NotificationController extends AdminController
'member_ecard_mail_btn',
'member_review_and_summary_mail_btn',
'account_maneger_summary_mail_btn',
'client_hr_summary_mail_btn'
'client_hr_summary_mail_btn',
'hr_cd_insufficient_balance_mail_btn',
];
$data = [];
$emptyTemplate = [];

View File

@ -2273,6 +2273,9 @@
// print_r($data);
// die;
$file_data = $this->request->getFiles() ?? null;
$data['file_data'] = $file_data ?? null;
if (!isset($data['policy_with_corr'])) {
$data['policy_with_corr'] = 0;
} elseif ($data['policy_with_corr']) {
@ -2416,6 +2419,11 @@
$this->handleCompletedStatus($data, $insert);
$this->insertOrUpdateCoShareDetails($data, $insert);
// policy file upload
if(isset($data['doc_name']) && isset($data['file_data']) && !empty($data['doc_name']) && !empty($data['file_data'])){
$this->uploadFile($data['doc_name'], $data['file_data'], $insert);
}
return $this->respond(['status' => true, 'message' => 'Endorsement transaction created successfully'], 200);
}
@ -2688,6 +2696,20 @@
// dd(db_connect()->getLastQuery() ,$pt_bp_amt);
$data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
$ptFileQuery = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $id)
->where('pt_files.is_active', 1);
if (!in_array(get_role_id(), [1, 5]) && empty(array_intersect(user_team(), [MANAGEMENT_TEAM_ID, FINANCE_TEAM_ID, BUSINESS_TEAM_ID]))) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$ptFileQuery->where('pt_files.created_by', get_session_userid());
}
}
$data['pt_files'] = $ptFileQuery->findAll();
if ($data) {
return $this->respond(['status' => true, 'data' => $data, 'pt_id' => $pt_id], 200);
} else {

View File

@ -1151,9 +1151,9 @@ class TicketController extends BaseController
'errors' => ['required' => 'Employee Email is required']
],
'client_name' => [
'client_id' => [
'rules' => 'required',
'errors' => ['required' => 'Client Name is required']
'errors' => ['required' => 'Client ID is required']
],
'insurer_id' => [
@ -1335,9 +1335,9 @@ class TicketController extends BaseController
'errors' => ['required' => 'Employee Email is required']
],
'client_name' => [
'client_id' => [
'rules' => 'required',
'errors' => ['required' => 'Client Name is required']
'errors' => ['required' => 'Client ID is required']
],
'insurer_id' => [

View File

@ -947,21 +947,37 @@ if (!function_exists('validateExcelFile')) {
function validateExcelFile($file)
{
$allowed = [
// 1. Check if the file was uploaded without errors
if (! $file->isValid() || $file->hasMoved()) {
return false;
}
// 2. Size check (16MB)
if ($file->getSizeByUnit('mb') > 16) {
return false;
}
// 3. Define allowed types
$allowedMimes = [
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.oasis.opendocument.spreadsheet'
'application/vnd.oasis.opendocument.spreadsheet',
'application/zip',
'application/octet-stream'
];
// if ($file->getError() !== UPLOAD_ERR_OK) return 'Upload error';
// if ($file->getSize() > (16 * 1024 * 1024)) return 'File too large';
// if (!in_array($file->getClientMimeType(), $allowed, true)) return 'Invalid file type';
if ($file->getError() !== UPLOAD_ERR_OK) return false;
if ($file->getSize() > (16 * 1024 * 1024)) return false;
if (!in_array($file->getClientMimeType(), $allowed, true)) return false;
$allowedExtensions = ['xls', 'xlsx', 'ods', 'xlsm'];
return true;
// Get the actual values using CI4 methods
$mime = $file->getClientMimeType();
$extension = $file->getExtension(); // This is the CI4 method
// 4. Validate
if (in_array($mime, $allowedMimes) || in_array($extension, $allowedExtensions)) {
return true;
}
return false;
}
}

View File

@ -303,7 +303,7 @@ class ClientPolicyModel extends Model
$caseSql = "";
}
$url = base_url('employeeRest/downloadCdSplitUpFile?id=');
$url = base_url('downloadCdSplitUpFile?id=');
// Fetch the deposit data based on client and insurer IDs
$query = $this->db->table('cash_deposit')

View File

@ -280,6 +280,14 @@ class EmployeePolicyModel extends Model
'cp.policy_no',
'cp.policy_type_id',
'cp.is_addon',
'(
select id from employees
where emp_code = emp.emp_code
and client_id = emp.client_id
and lower(relationship) = "self"
and is_active = 1
limit 1
) as self_employee_id',
$ecard_download_link
])
->join('employees emp', 'employee_polices.employee_id = emp.id')

View File

@ -1,54 +1,90 @@
<form action="<?= base_url('fedeploy'); ?>" method="post" enctype="multipart/form-data">
<!-- Single zip upload -->
<div>
<label for="zip_file">Zip File</label>
<input type="file" name="zip_file" id="zip_file" required>
</div>
<div class="container-fluid-min">
<div class="card mb-1">
<!---- new ----->
<div class="row">
<div class="col-12">
<div class="card-body">
<div class="custom-form">
<form role="form" class="parsley-examples" action="<?= base_url('fedeploy'); ?>" method="post" enctype="multipart/form-data">
<!-- Single zip upload -->
<div class="form-group row">
<label for="zip_file" class="col-md-4 col-form-label">Zip File</label>
<div class="col-md-5">
<div class="input-icon">
<input type="file" class="form-control" id="zip_file" name="zip_file" >
<i class="mdi mdi-upload additional-icon"></i>
</div>
</div>
</div>
<div>
<label for="zip_folder">Zip Folder (inside zip to deploy)</label>
<select name="zip_folder" id="zip_folder">
<option value="web/">web/</option>
<!-- <option value="dist/">dist/</option> -->
</select>
</div>
<!-- Zip Folder-->
<div class="form-group row">
<label for="zip_folder" class="col-md-4 col-form-label">Zip Folder (inside zip to deploy)</label>
<div class="col-md-5">
<select name="zip_folder" id="zip_folder" class="form-control">
<option value="web/">web/</option>
<!-- <option value="dist/">dist/</option> -->
</select>
</div>
</div>
<div>
<label for="s3_bucket">S3 Bucket</label>
<select name="s3_bucket" id="s3_bucket">
<option value="uat-benefits-app-bucket">UAT Benefits</option>
<option value="uat-hr-app-bucket">UAT HR</option>
<option value="benefits-app-bucket">Live Benefits</option>
<option value="live-hr-app-bucket">Live HR</option>
</select>
</div>
<div class="form-group row">
<label class="col-md-4 col-form-label" for="s3_bucket">S3 Bucket</label>
<div class="col-md-5">
<select name="s3_bucket" id="s3_bucket" class="form-control">
<option value="uat-benefits-app-bucket">UAT Benefits</option>
<option value="uat-hr-app-bucket">UAT HR</option>
<option value="benefits-app-bucket">Live Benefits</option>
<option value="live-hr-app-bucket">Live HR</option>
</select>
</div>
</div>
<div>
<label for="s3_prefix">S3 Prefix</label>
<input type="text" name="s3_prefix" id="s3_prefix" value="/*">
</div>
<!-- S3 Prefix -->
<div class="form-group row">
<label class="col-md-4 col-form-label" for="s3_prefix">S3 Prefix</label>
<div class="col-md-5">
<input type="text" name="s3_prefix" id="s3_prefix" value="/*" class="form-control">
</div>
</div>
<div>
<label for="cf_distribution_id">CloudFront Distribution ID (optional)</label>
<!-- <input type="text" name="cf_distribution_id" id="cf_distribution_id" value="E1MKRK4U5MZ3BD"> -->
<select name="cf_distribution_id" id="cf_distribution_id">
<option value="EUBZ8CDSV9KZZ">UAT Benefits</option>
<option value="E9TNPRI9ITM1M">UAT HR</option>
<option value="E1MKRK4U5MZ3BD">Live Benefits</option>
<option value="E3TE01DPKHTD8B">Live HR</option>
</select>
</div>
<!-- CloudFront Distribution -->
<div class="form-group row">
<label for="cf_distribution_id" class="col-md-4 col-form-label">CloudFront Distribution ID (optional)</label>
<div class="col-md-5">
<select name="cf_distribution_id" id="cf_distribution_id" class="form-control">
<option value="EUBZ8CDSV9KZZ">UAT Benefits</option>
<option value="E9TNPRI9ITM1M">UAT HR</option>
<option value="E1MKRK4U5MZ3BD">Live Benefits</option>
<option value="E3TE01DPKHTD8B">Live HR</option>
</select>
</div>
</div>
<div>
<label for="cf_paths">
CloudFront Invalidation Paths (comma or newline separated, e.g. <code>/hr/*,/hr/special/*</code>)
</label>
<input type="text" name="cf_paths" id="cf_paths" value="/*">
<!-- If you prefer multi-line, use <textarea> instead of <input> -->
</div>
<!-- CloudFront Invalidation -->
<div class="form-group row">
<label class="col-md-4 col-form-label" for="cf_paths"> CloudFront Invalidation Paths (comma or newline separated, e.g. <code>/hr/*,/hr/special/*</code>) </label>
<div class="col-md-5 d-flex align-items-center">
<input type="text" name="cf_paths" id="cf_paths" value="/*" class="form-control">
</div>
</div>
<!-- Buttons -->
<div class="form-group row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Deploy</button>
</div>
</div>
</form>
</div>
</div>
</div> <!-- end col-->
</div>
<!---- ends ------>
</div>
</div>
<button type="submit">Deploy</button>
</form>
<script>
document.addEventListener('DOMContentLoaded', function () {
const bucketToDistributionMap = {

View File

@ -131,6 +131,8 @@
$member_review_and_summary_mail = 0;
$account_maneger_summary_mail = 0;
$client_hr_summary_mail = 0;
$hr_cd_insufficient_balance_mail = 0;
if (isset($notification)) {
foreach ($notification as $value) {
@ -161,6 +163,10 @@
if ($value['template_name'] == 'client_hr_summary_mail') {
$client_hr_summary_mail = $value['enabled'];
}
if ($value['template_name'] == 'hr_cd_insufficient_balance_mail') {
$hr_cd_insufficient_balance_mail = $value['enabled'];
}
}
}
?></p>
@ -265,6 +271,7 @@
</div>
</div>
</div>
<!-- member review and summary mail -->
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
@ -283,6 +290,26 @@
</div>
</div>
<!-- Hr cd insifficient mail -->
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
<input id="hr_cd_insufficient_balance_mail_btn" type="checkbox" name="hr_cd_insufficient_balance_mail_btn" <?= $hr_cd_insufficient_balance_mail == 1 ? 'checked' : '' ?>>
<span class="slider round"></span>
</label>
<span class="ml-2"> HR CD Insufficient Balance Mail</span>
</div>
<div class="right">
<a href="" data-toggle="modal" id="hr_cd_insufficient_balance_mail" onclick="getMailTemplateData(this)" data-target="#hr_cd_insufficient_balance_mail_modal">
<i class="mdi mdi-pencil"></i>
</a>
</div>
</div>
</div>
</div>
@ -988,6 +1015,89 @@
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
<!-- 7 Modal content for the Large example => CD balance insufficent HR mail sent -->
<div class="modal fade" id="hr_cd_insufficient_balance_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"> HR CD Insufficient Balance 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="hr_cd_insufficient_balance_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="template_name">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" value="HR CD Insufficient Balance 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="subject">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-5 testmail" style="display: none;">
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this,'send')">Test Mail</a>
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="PreviewTheMail(this,'preview','client_hr_summary_mail')">Preview Mail</a>
</div>
</div>
<div class="hr_cd_insufficient_balance_mail_section">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="hr_cd_insufficient_balance_mail_customButton" class="form-control" style="border:none; right:6px; width:auto; position:absolute; z-index:1; top:17px; height:32px; float:right;" onchange="copyToClipboard(this)">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php if (in_array($value, ['hr_name', 'client_name'])): ?>
<?php $valueChange = ucwords(str_replace('_',' ',$value)); ?>
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<span id="copy-feedback" style="display: none; position: absolute; top:50px; right:10px; color:green; font-size:12px;">Copied to clipboard!</span>
</div>
</div>
<hr>
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="hr_cd_insufficient_balance_mail_editor_container" style="height:600px;"></div>
</div>
</div>
<div id="editor"></div>
<input type="file" id="Question_title_fileInput" style="display:none;">
</div>
</div> <!-- /.form-group -->
<div class="form-group text-right m-b-0 hr_cd_insufficient_balance_mail_action">
<button type="button" class="btn btn-primary waves-effect waves-light mr-1 preview_button">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button>
</div>
<div class="hr_cd_insufficient_balance_mail_preview"></div>
</form>
</div> <!-- /.modal-body -->
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</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-dialog modal-dialog-centered">
<div class="modal-content">
@ -1841,7 +1951,14 @@
function getMailTemplateData(element) {
template_name = element.id;
const validTemplates = [
"account_maneger_summary_mail", "member_reminder_mail","member_common_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail"
"account_maneger_summary_mail",
"member_reminder_mail",
"member_common_mail",
"member_ecard_mail",
"member_welcome_mail",
"member_review_and_summary_mail",
"client_hr_summary_mail",
"hr_cd_insufficient_balance_mail"
];
console.log(`:) getMailTemplateData function called for ${template_name}`); // REF : PS
if (!validTemplates.includes(template_name)) {
@ -2347,6 +2464,61 @@
});
});
$('#hr_cd_insufficient_balance_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 = new FormData($('#hr_cd_insufficient_balance_mail_form')[0]);
// Append Unlayer data
formData.append('mailContent', data.html);
formData.append('client_id', $('#general_PrimaryKey').val());
formData.append('mailJson', JSON.stringify(data.design));
console.log([...formData.entries()]);
// 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',
processData: false,
contentType: false,
success: function(res) {
$('#client_hr_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);
}
});
});
});
function hideBranding() {
$('iframe').on('load', function() {
console.log('Iframe loaded.');
@ -2445,6 +2617,10 @@
name: 'client_hr_summary_mail_btn',
value: $('#client_hr_summary_mail_btn').prop('checked')
});
formData.push({
name: 'hr_cd_insufficient_balance_mail_btn',
value: $('#hr_cd_insufficient_balance_mail_btn').prop('checked')
});
var form_action = '<?= base_url("client/notification/update_enable") ?>';
$('.loader').fadeIn();

View File

@ -151,427 +151,450 @@
</style>
<div class="row" id="endorsement_form" style="display: none;">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Add Endorsement</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url('policy_tranction/endorsement/list') ?>" id="btnAdd" class="btn btn-primary waves-effect waves-light"
>Back</a>
</div>
</div>
<form role="form" class="parsley-examples" method="post" id="endorsement_form_id" enctype="multipart/form-data">
<input type="hidden" name="id" id="policy_tranction_primarykey">
<input type="hidden" name="client_id" id="client_id_for_edit">
<input type="hidden" name="insurer_id" id="insurer_id">
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
<input type="hidden" name="ct_type" id="ct_type">
<input type="hidden" name="bro_payable_by" id="bro_payable_by">
<input type="hidden" name="cop_yes" id="cop_yes">
<input type="hidden" name="base_cd_amount" id="base_cd_amount">
<input type="hidden" name="cd_amt_changed" id="cd_amt_changed" disabled>
<!-- Client Row -->
<div class="row">
<!-- Section 1 -->
<div class="col-md-12">
<div id="accordion_0" class="mb-0">
<label id="policyAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Client Details</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</label>
<div class="card mb-1">
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_0">
<div class="card-body">
<div class="row">
<div class="form-group col-md-3">
<label for="client_type">Client Type<span class="text-danger"></span></label>
<select class="form-control" id="client_type" name="client_type" >
<option value="">Select Client type</option>
<option value="1">Group</option>
<option value="2">Individual</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger">*</span></label>
<select class="form-control" id="client_id" name="client_id" required>
<option value="">Select Client</option>
<!-- <option value="add_client"> + Add Client</option> -->
</select>
</div>
<div class="form-group col-md-3 branchdiv">
<label for="client_branch">Branch<span class="text-danger"></span></label>
<select class="form-control" id="client_branch_id" name="client_branch_id">
<option value="">Select Branch</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy <span class="text-danger">*</span></label>
<select class="form-control" id="client_policy_id" name="client_policy_id" required>
<option value="">Select Policy</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade active show" id="form">
<div class="row" id="endorsement_form">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Add Endorsement</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url('policy_tranction/endorsement/list') ?>" id="btnAdd" class="btn btn-primary waves-effect waves-light"
>Back</a>
</div>
</div>
<form role="form" class="parsley-examples" method="post" id="endorsement_form_id" enctype="multipart/form-data">
<input type="hidden" name="id" id="policy_tranction_primarykey">
<input type="hidden" name="client_id" id="client_id_for_edit">
<input type="hidden" name="insurer_id" id="insurer_id">
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
<input type="hidden" name="ct_type" id="ct_type">
<input type="hidden" name="bro_payable_by" id="bro_payable_by">
<input type="hidden" name="cop_yes" id="cop_yes">
<input type="hidden" name="base_cd_amount" id="base_cd_amount">
<input type="hidden" name="cd_amt_changed" id="cd_amt_changed" disabled>
<!-- Endorsement details -->
<div class="row">
<div class="col-md-12">
<div id="accordion_2" class="mb-0">
<!-- Client Row -->
<div class="row">
<!-- Section 1 -->
<div class="col-md-12">
<div id="accordion_0" class="mb-0">
<label id="policyAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Endorsement</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseThree"
<span class="font-color-black">Client Details</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</label>
<div class="card mb-1">
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_2">
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_0">
<div class="card-body">
<div class="row">
<!-- <div class="form-group col-md-3" id="tpa_endorse_div">
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
<select class="form-control readonly-select" id="tpa" name="tpa" >
<option value="" selected>Select TPA</option>
<?php foreach ($tpa as $value) { ?>
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?>
</option>
<?php } ?>
</select>
</div> -->
<div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly>
</div>
<div class="row">
<div class="form-group col-md-3">
<label for="bp_cgst">D.O.C <span id="base_danger" class="text-danger"></span></label>
<input id="policy_start_date" type="text" class="form-control" placeholder="DD/MM/YYYY" readonly>
</div>
<div class="form-group col-md-3">
<label for="bp_igst">D.O.E <span id="base_danger" class="text-danger"></span></label>
<input id="policy_end_date" type="text" class="form-control" placeholder="DD/MM/YYYY" readonly>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Endorsement Type <span id="base_danger" class="text-danger">*</span></label>
<select class="form-control" id="action_type" name="action_type" required>
<option value="" selected>Select Endorsement Type</option>
<?php
if (isset($action_type) && count($action_type)) {
foreach ($action_type as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" onchange="validateInput(this, 'policy_transaction', 'endorsement_no')">
</div>
<div class="form-group col-md-3">
<label for="addon_policy">Data Received Date<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control" id="data_received_date" name="data_received_date" placeholder="DD/MM/YYYY" required>
</div>
<div class="form-group col-md-3">
<label for="policy_issue_date">Endorsement Issue Date<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control" id="policy_issue_date" name="policy_issue_date" placeholder="DD/MM/YYYY" required>
</div>
<div class="form-group col-md-3">
<label for="month">Endorsement Issue Month<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control readonly-select" id="month" name="month" placeholder="MM/YYYY" required>
</div>
<div class="form-group col-md-3">
<label for="endorse_eff_date">Endorsement Effective Date<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorse_eff_date" name="endorse_eff_date" placeholder="DD/MM/YYYY" >
</div>
<div class="form-group col-md-3" id="no_of_insured_endorse_div">
<label for="addon_policy">No of Insured<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_count" name="emp_count" placeholder="Enter Employeee" onkeypress="return onlyNumbers(event)">
</div>
<div class="form-group col-md-3" id="no_of_dependents_endorse_div">
<label for="addon_policy">No of Dependents<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="dependent_count" name="dependent_count" placeholder="Enter Dependent" onkeypress="return onlyNumbers(event)">
</div>
<div class="form-group col-md-3">
<label for="client_type">Client Type<span class="text-danger"></span></label>
<select class="form-control" id="client_type" name="client_type" >
<option value="">Select Client type</option>
<option value="1">Group</option>
<option value="2">Individual</option>
</select>
</div>
<hr>
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger">*</span></label>
<select class="form-control" id="client_id" name="client_id" required>
<option value="">Select Client</option>
<!-- <option value="add_client"> + Add Client</option> -->
</select>
</div>
<div class="row">
<!-- <div class="form-group col-md-3">
<label for="addon_policy"> Status <span id="base_danger"class="text-danger">*</span></label>
<select class="form-control" id="policy_status" name="status" required>
<option value="" selected>Select Status</option>
<?php
if (isset($policy_status) && count($policy_status)) {
foreach ($policy_status as $key => $value) {
if($key == 'pending'){
echo "<option value=" . $key . " selected>" . $value . "</option>";
}else{
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
}
?>
</select>
</div> -->
<div class="form-group col-md-3">
<label for="last_action_date">Latest Action Date</label>
<input id="last_action_date" type="text" class="form-control" name="last_action_date" placeholder="DD/MM/YYYY">
</div>
<div class="form-group col-md-3 install_due_date_div" style="display: none;">
<label for="install_due_date">Installment due Date</label>
<input id="install_due_date" type="text" class="form-control" name="install_due_date" placeholder="DD/MM/YYYY">
</div>
<!-- <div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 32px;left: 20px;">
<input id="policy_with_corr" type="checkbox" name="policy_with_corr">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
</div> -->
<!-- <div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 32px;left: 20px;">
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD &nbsp;&nbsp; <i class="mdi mdi-information-outline" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
</div> -->
<div class="form-group col-md-3 branchdiv">
<label for="client_branch">Branch<span class="text-danger"></span></label>
<select class="form-control" id="client_branch_id" name="client_branch_id">
<option value="">Select Branch</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy <span class="text-danger">*</span></label>
<select class="form-control" id="client_policy_id" name="client_policy_id" required>
<option value="">Select Policy</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Premium Details -->
<div class="row">
<div class="col-md-12">
<div id="accordion_3" class="mb-0">
<label id="policyAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Premium Details</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</label>
<div class="card mb-0">
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_3">
<div class="card-body">
<div class="row d-none" id="add_more_row">
<div class="col-md-2">
<input type="number" id="setInsurerCount" class="form-control" placeholder="Enter count">
</div>
<!-- <div class="col-md-2">
<a id="addInsurer" class="btn btn-primary mb-3">Add Insurer</a>
</div> -->
<!-- <div class="col-md-1">
<a id="submitForm" class="btn btn-success mb-3">Submit</a>
</div> -->
</div>
<div id="insurerTableContainer" style="overflow: auto;">
<table data-custom-table-css="table" class="table co_share_table" id="insurerTable">
<thead>
<tr>
<th><span class="font-color-black">Premium Details</span></th>
</tr>
</thead>
<tbody>
<tr id="table_tr_1">
<td>Insurer</td>
</tr>
<tr id="table_tr_2" style="display: none;">
<td>Is Leader?</td>
</tr>
<tr id="table_tr_34">
<td>CD Acc No</td>
</tr>
<tr id="table_tr_37">
<td>CD Amount</td>
</tr>
<tr id="table_tr_35" style="display: none;">
<td>Follower Policy No</td>
</tr>
<tr id="table_tr_40" >
<td>Endorsement Issue Date</td>
</tr>
<tr id="table_tr_3" style="display: none;">
<td>Co-Share %</td>
</tr>
<tr id="table_tr_36">
<td>Non-Commissionable<br> Premium Amount</td>
</tr>
<tr id="table_tr_4">
<td>Base Premium</td>
</tr>
<tr class="hidetp" id="table_tr_5">
<td id="tp_premium_td">TP Premium</td>
</tr>
<tr class="hideter" id="table_tr_6" style="display: none;">
<td>TEP Premium</td>
</tr>
<tr class="hidecop" id="table_tr_7" style="display: none;">
<td>Co-Premium</td>
</tr>
<tr class="hidecotp" id="table_tr_38" style="display: none;">
<td>Co-TP Premium</td>
</tr>
<tr class="hidecoter" id="table_tr_39" style="display: none;">
<td>Co-TEP Premium</td>
</tr>
<tr id="table_tr_8">
<td>CGST</td>
</tr>
<tr id="table_tr_9">
<td>SGST</td>
</tr>
<tr id="table_tr_10">
<td>IGST</td>
</tr>
<tr id="table_tr_11">
<td>GST Amount</td>
</tr>
<tr id="table_tr_12">
<td>Stamp Duty</td>
</tr>
<tr id="table_tr_13">
<td>Total</td>
</tr>
<tr id="table_tr_14">
<td>Agreed BP %</td>
</tr>
<tr class="hidetp" id="table_tr_15">
<td id="agree_tp_td">Agreed TP %</td>
</tr>
<tr class="hideter" id="table_tr_16" style="display: none;">
<td id="agree_tp_td">Agreed TEP %</td>
</tr>
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
<tr id="table_tr_17">
<td>Agreed Amount</td>
</tr>
<?php } ?>
<tr id="table_tr_18">
<td>Standard BP %</td>
</tr>
<tr class="hidetp" id="table_tr_19">
<td>Standard TP %</td>
</tr>
<tr class="hideter" id="table_tr_20" style="display: none;">
<td>Standard TEP %</td>
</tr>
<?php if (in_array(in_array(get_role_id(), [1,5]) || FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<tr id="table_tr_21">
<td>Actual BP Amount</td>
</tr>
<tr class="hidetp" id="table_tr_22">
<td>Actual TP Amount</td>
</tr>
<tr class="hideter" id="table_tr_23" style="display: none;">
<td>Actual TEP Amount</td>
</tr>
<tr id="table_tr_24">
<td>Actual BP %</td>
</tr>
<tr class="hidetp" id="table_tr_25">
<td>Actual TP %</td>
</tr>
<tr class="hideter" id="table_tr_26" style="display: none;">
<td>Actual TEP %</td>
</tr>
<tr id="table_tr_27">
<td>Actual BP <br> Remuneration Amount</td>
</tr>
<tr class="hidetp" id="table_tr_28">
<td>Actual TP <br> Remuneration Amount</td>
</tr>
<tr class="hideter" id="table_tr_29" style="display: none;">
<td>Actual TEP <br> Remuneration Amount</td>
</tr>
<tr id="table_tr_30">
<td>Expected Amount</td>
</tr>
<!-- <tr id="table_tr_31">
<td>Variance</td>
</tr> -->
<!-- <tr id="table_tr_32">
<td>Reward</td>
</tr> -->
<?php } ?>
<tr id="table_tr_33" style="display: none;">
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group text-right mt-3 m-b-0" id="submitButton">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
</div>
</form>
<!-- Endorsement details -->
<div class="row">
<div class="col-md-12">
<div id="accordion_2" class="mb-0">
<label id="policyAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Endorsement</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseThree"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</label>
<div class="card mb-1">
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_2">
<div class="card-body">
<div class="row">
<!-- <div class="form-group col-md-3" id="tpa_endorse_div">
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
<select class="form-control readonly-select" id="tpa" name="tpa" >
<option value="" selected>Select TPA</option>
<?php foreach ($tpa as $value) { ?>
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?>
</option>
<?php } ?>
</select>
</div> -->
<div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly>
</div>
<div class="form-group col-md-3">
<label for="bp_cgst">D.O.C <span id="base_danger" class="text-danger"></span></label>
<input id="policy_start_date" type="text" class="form-control" placeholder="DD/MM/YYYY" readonly>
</div>
<div class="form-group col-md-3">
<label for="bp_igst">D.O.E <span id="base_danger" class="text-danger"></span></label>
<input id="policy_end_date" type="text" class="form-control" placeholder="DD/MM/YYYY" readonly>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Endorsement Type <span id="base_danger" class="text-danger">*</span></label>
<select class="form-control" id="action_type" name="action_type" required>
<option value="" selected>Select Endorsement Type</option>
<?php
if (isset($action_type) && count($action_type)) {
foreach ($action_type as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" onchange="validateInput(this, 'policy_transaction', 'endorsement_no')">
</div>
<div class="form-group col-md-3">
<label for="addon_policy">Data Received Date<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control" id="data_received_date" name="data_received_date" placeholder="DD/MM/YYYY" required>
</div>
<div class="form-group col-md-3">
<label for="policy_issue_date">Endorsement Issue Date<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control" id="policy_issue_date" name="policy_issue_date" placeholder="DD/MM/YYYY" required>
</div>
<div class="form-group col-md-3">
<label for="month">Endorsement Issue Month<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control readonly-select" id="month" name="month" placeholder="MM/YYYY" required>
</div>
<div class="form-group col-md-3">
<label for="endorse_eff_date">Endorsement Effective Date<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorse_eff_date" name="endorse_eff_date" placeholder="DD/MM/YYYY" >
</div>
<div class="form-group col-md-3" id="no_of_insured_endorse_div">
<label for="addon_policy">No of Insured<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_count" name="emp_count" placeholder="Enter Employeee" onkeypress="return onlyNumbers(event)">
</div>
<div class="form-group col-md-3" id="no_of_dependents_endorse_div">
<label for="addon_policy">No of Dependents<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="dependent_count" name="dependent_count" placeholder="Enter Dependent" onkeypress="return onlyNumbers(event)">
</div>
</div>
<hr>
<div class="row">
<!-- <div class="form-group col-md-3">
<label for="addon_policy"> Status <span id="base_danger"class="text-danger">*</span></label>
<select class="form-control" id="policy_status" name="status" required>
<option value="" selected>Select Status</option>
<?php
if (isset($policy_status) && count($policy_status)) {
foreach ($policy_status as $key => $value) {
if($key == 'pending'){
echo "<option value=" . $key . " selected>" . $value . "</option>";
}else{
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
}
?>
</select>
</div> -->
<div class="form-group col-md-3">
<label for="last_action_date">Latest Action Date</label>
<input id="last_action_date" type="text" class="form-control" name="last_action_date" placeholder="DD/MM/YYYY">
</div>
<div class="form-group col-md-3 install_due_date_div" style="display: none;">
<label for="install_due_date">Installment due Date</label>
<input id="install_due_date" type="text" class="form-control" name="install_due_date" placeholder="DD/MM/YYYY">
</div>
<!-- <div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 32px;left: 20px;">
<input id="policy_with_corr" type="checkbox" name="policy_with_corr">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
</div> -->
<!-- <div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 32px;left: 20px;">
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD &nbsp;&nbsp; <i class="mdi mdi-information-outline" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
</div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Policy Docs Row -->
<div class="row" id="policy_docs" style="display: none;">
<div class="col-md-12">
<div id="accordion_23" class="mb-0">
<label id="policyAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Policy Docs</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseTwentyTwo"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</label>
<div class="card mb-1">
<div id="collapseTwentyTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_23">
<div class="card-body" id="policy_docs_div" style="background-color: #F5FFFF !important; border-radius: 10px; box-shadow: 4px 4px 4px 4px #00000040;">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Premium Details -->
<div class="row">
<div class="col-md-12">
<div id="accordion_3" class="mb-0">
<label id="policyAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Premium Details</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</label>
<div class="card mb-0">
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_3">
<div class="card-body">
<div class="row d-none" id="add_more_row">
<div class="col-md-2">
<input type="number" id="setInsurerCount" class="form-control" placeholder="Enter count">
</div>
<!-- <div class="col-md-2">
<a id="addInsurer" class="btn btn-primary mb-3">Add Insurer</a>
</div> -->
<!-- <div class="col-md-1">
<a id="submitForm" class="btn btn-success mb-3">Submit</a>
</div> -->
</div>
<div id="insurerTableContainer" style="overflow: auto;">
<table data-custom-table-css="table" class="table co_share_table" id="insurerTable">
<thead>
<tr>
<th><span class="font-color-black">Premium Details</span></th>
</tr>
</thead>
<tbody>
<tr id="table_tr_1">
<td>Insurer</td>
</tr>
<tr id="table_tr_2" style="display: none;">
<td>Is Leader?</td>
</tr>
<tr id="table_tr_34">
<td>CD Acc No</td>
</tr>
<tr id="table_tr_37">
<td>CD Amount</td>
</tr>
<tr id="table_tr_35" style="display: none;">
<td>Follower Policy No</td>
</tr>
<tr id="table_tr_40" >
<td>Endorsement Issue Date</td>
</tr>
<tr id="table_tr_3" style="display: none;">
<td>Co-Share %</td>
</tr>
<tr id="table_tr_36">
<td>Non-Commissionable<br> Premium Amount</td>
</tr>
<tr id="table_tr_4">
<td>Base Premium</td>
</tr>
<tr class="hidetp" id="table_tr_5">
<td id="tp_premium_td">TP Premium</td>
</tr>
<tr class="hideter" id="table_tr_6" style="display: none;">
<td>TEP Premium</td>
</tr>
<tr class="hidecop" id="table_tr_7" style="display: none;">
<td>Co-Premium</td>
</tr>
<tr class="hidecotp" id="table_tr_38" style="display: none;">
<td>Co-TP Premium</td>
</tr>
<tr class="hidecoter" id="table_tr_39" style="display: none;">
<td>Co-TEP Premium</td>
</tr>
<tr id="table_tr_8">
<td>CGST</td>
</tr>
<tr id="table_tr_9">
<td>SGST</td>
</tr>
<tr id="table_tr_10">
<td>IGST</td>
</tr>
<tr id="table_tr_11">
<td>GST Amount</td>
</tr>
<tr id="table_tr_12">
<td>Stamp Duty</td>
</tr>
<tr id="table_tr_13">
<td>Total</td>
</tr>
<tr id="table_tr_14">
<td>Agreed BP %</td>
</tr>
<tr class="hidetp" id="table_tr_15">
<td id="agree_tp_td">Agreed TP %</td>
</tr>
<tr class="hideter" id="table_tr_16" style="display: none;">
<td id="agree_tp_td">Agreed TEP %</td>
</tr>
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
<tr id="table_tr_17">
<td>Agreed Amount</td>
</tr>
<?php } ?>
<tr id="table_tr_18">
<td>Standard BP %</td>
</tr>
<tr class="hidetp" id="table_tr_19">
<td>Standard TP %</td>
</tr>
<tr class="hideter" id="table_tr_20" style="display: none;">
<td>Standard TEP %</td>
</tr>
<?php if (in_array(in_array(get_role_id(), [1,5]) || FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<tr id="table_tr_21">
<td>Actual BP Amount</td>
</tr>
<tr class="hidetp" id="table_tr_22">
<td>Actual TP Amount</td>
</tr>
<tr class="hideter" id="table_tr_23" style="display: none;">
<td>Actual TEP Amount</td>
</tr>
<tr id="table_tr_24">
<td>Actual BP %</td>
</tr>
<tr class="hidetp" id="table_tr_25">
<td>Actual TP %</td>
</tr>
<tr class="hideter" id="table_tr_26" style="display: none;">
<td>Actual TEP %</td>
</tr>
<tr id="table_tr_27">
<td>Actual BP <br> Remuneration Amount</td>
</tr>
<tr class="hidetp" id="table_tr_28">
<td>Actual TP <br> Remuneration Amount</td>
</tr>
<tr class="hideter" id="table_tr_29" style="display: none;">
<td>Actual TEP <br> Remuneration Amount</td>
</tr>
<tr id="table_tr_30">
<td>Expected Amount</td>
</tr>
<!-- <tr id="table_tr_31">
<td>Variance</td>
</tr> -->
<!-- <tr id="table_tr_32">
<td>Reward</td>
</tr> -->
<?php } ?>
<tr id="table_tr_33" style="display: none;">
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group text-right mt-3 m-b-0" id="submitButton">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
@ -1017,6 +1040,8 @@
$('#cop_yes').val(0);
}
$('#policy_tranction_primarykey_for_file_upload').val(res.data.id);
$('#client_policy_id_for_file_upload').val(res.data.client_policy_id);
$('#policy_tranction_primarykey').val(res.data.id);
$('#client_type').val(res.data.client_type).trigger('change');
$('#client_id').val(res.data.client_id).change();
@ -1048,6 +1073,10 @@
$('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date);
$('#insurer_id').val(res.data.insurer_branch_id + '-' + res.data.insurer_id);
$('#client_type').addClass('readonly-select ');
$('#client_id').addClass('readonly-select ').select2('destroy');
$('#client_branch_id').addClass('readonly-select ').select2('destroy');
$('#client_policy_id').addClass('readonly-select ').select2('destroy');
}, 1500)
$('#policy_no').val(res.data.policy_no);
@ -1067,12 +1096,16 @@
$('#cd_ac_no').val(res.data.cd_ac_no);
$('#ct_type').val(res.data.ct_type);
$('#hide_file_upload').show()
if (res.data.policy_with_corr == 1) {
$('#policy_with_corr').prop('checked', true);
} else {
$('#policy_with_corr').prop('checked', false);
}
appendFileTableBody(res.data.pt_files);
// if (res.data.is_cd_reduce_from_bds == 1) {
// $('#is_cd_reduce_from_bds').prop('checked', true).prop('checked', false);
// } else {

View File

@ -363,10 +363,9 @@ table.dataTable thead th {
</div><!-- end col -->
</div>
<!-- end table row -->
<?php include('pt_endorsement_form_file_upload_tab.php'); ?>
<?php include('policy_transaction_endorsement_form.php'); ?>
<script>
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("tickets-table");
@ -448,6 +447,7 @@ table.dataTable thead th {
});
});
</script>
<script>
var client_list = '';
var branch_list = '';
@ -461,6 +461,7 @@ table.dataTable thead th {
$(document).ready(function() {
getClientAndBranchAndPolicy()
addHTMLInput();
<?php if (session()->has('create_failed')) : ?>
toastr.error('<?= session()->getFlashdata('create_failed') ?>', 'Failed');
@ -506,6 +507,8 @@ table.dataTable thead th {
className: 'btn app-btn-primary mr-2',
action: function (e, dt, node, config) {
hide_list_show_add();
addHTMLInput(null, 'policy_docs_div');
$('#policy_docs').show()
},
attr: { id: 'btnAdd' }
},
@ -614,15 +617,16 @@ table.dataTable thead th {
$('#endorsement_form_id')[0].reset();
$('#client_id').val('').change();
$('#client_policy_id').val('').change();
$('#endorsement_form').show();
$('#endorsement_list').hide();
$('#endorsement_filter').hide();
$('#invoice_no_div').hide();
$('#invoice_no').attr('required', false)
$('#pt_onboarding').show();
$('#endorsement_list').hide();
$('#endorsement_filter').hide();
}
function show_list_hide_add() {
$('#endorsement_form').hide()
$('#pt_onboarding').hide()
$('#endorsement_list').show()
$('#endorsement_filter').show()
@ -836,7 +840,6 @@ table.dataTable thead th {
})
</script>
<script>
$(document).ready(function() {
getURLParams()
@ -1034,4 +1037,87 @@ table.dataTable thead th {
});
}
function addHTMLInput(data = null, container_id = 'dynamic-form-container')
{
console.log('container_id', container_id);
const container = document.getElementById(container_id);
let required = ''
let required_star = ''
if(container_id == 'dynamic-form-container'){
required = 'required';
required_star = '*';
}
console.log('container', container);
const newRow = document.createElement('div');
newRow.className = 'form-row dynamic-form-row';
newRow.innerHTML = `
<div class="form-group col-md-5">
<label for="file_name">Document Name<span class="text-danger">${required_star}</span></label>
<input type="text" class="form-control" id="docs_name" name="doc_name[]" placeholder="Enter file name" ${required}>
</div>
<div class="form-group col-md-5">
<label for="file">Upload File<span class="text-danger">${required_star}</span></label>
<input type="file" class="form-control" id="file_name" name="file[]" ${required} accept=".pdf,.jpg,.jpeg,.png">
</div>
<div class="form-group col-md-2" style="position: relative;top: 28px;">
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this, '${container_id}')">x</a>
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(null, '${container_id}')">+</a>
</div>
`;
container.appendChild(newRow);
if (data !== null && data.db_column_name !== undefined) {
const selectElement = newRow.querySelector('.db-column-name-select');
selectElement.value = data.db_column_name;
}
}
function removeHTMLInput(element, container_id)
{
const container = document.getElementById(container_id);
const rows = container.querySelectorAll('.dynamic-form-row');
if (rows.length > 1) {
const row = element.closest('.dynamic-form-row');
row.remove();
}
}
function appendFileTableBody(data)
{
console.log(data);
$('#table_bd').empty();
$.each(data, function(index, item) {
var row = $('<tr>');
row.append($('<td>').text(index+1));
row.append($('<td>').text(item.doc_name));
row.append($('<td>').text(item.file_name));
// var url = "<?= base_url('/downloadGdriveFile'); ?>" +
// "?client_id=" + item.client_id +
// "&file_type=policy" +
// "&file_name=" + item.file_name +
// "&client_policy_id=" + item.client_policy_id;
var url = '<?= base_url('download-kyc-docs/') ?>' + item.file_name;
var link = $('<a>')
.attr('href', url)
.attr('target', '_blank') // Open in a new tab
.attr('style', 'font-size:18px;')
.attr('data-id', item.id)
.addClass('mdi mdi-download')
// Append the <a> tag inside the <td>
row.append($('<td>').append(link));
$('#table_bd').append(row);
});
}
</script>

View File

@ -2255,7 +2255,7 @@
var page_title = 'Edit Policy' + (res.data.client_short_name || res.data.policy_type || res.data.policy_no ?
' - ' + [res.data.client_short_name, res.data.policy_type, res.data.policy_no]
.filter(Boolean).join('-') : '');
$('#page_title').text(page_title);
$('#client_id_kyc').val(res.data.client_id);
$('#policy_tranction_primarykey_for_file_upload').val(res.data.id);
@ -2384,6 +2384,9 @@
$('#table_tr_37').hide();
}
$('#client_id').addClass('readonly-select ').select2('destroy');
$('#client_branch_id').addClass('readonly-select ').select2('destroy');
}, 4000)
// Set additional fields
@ -2485,7 +2488,7 @@
// } else {
// $('#bro_payable_by').prop('checked', false);
// }
$('#bro_payable_by').val(res.data.bro_payable_by);
$('#bro_payable_by').val(res.data.bro_payable_by ?? 1);
// Policy transaction status handling
if (res.data.status == "completed") {

View File

@ -316,7 +316,7 @@ table.dataTable tbody td {
<?php foreach($inception_data_list as $index => $row){ ?>
<tr>
<td class="text-center"><?php echo $index+1; ?></td>
<td><?php echo $issuer[$row['issuer']]; ?></td>
<td><?php echo $issuer[$row['issuer']] ?? 'Nhance'; ?></td>
<td><?php echo $issuing_type[$row['issue_type']] ?? 'N/A'; ?></td>
<td><?php echo $client_type[$row['client_type']] ?? 'N/A'; ?></td>
<td><?php echo $row['client_type'] == 2 ? $row['client_name'] . " - " . (!empty($row['pan']) ? $row['pan'] : 'N/A') : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td>

View File

@ -0,0 +1,34 @@
<div class="row" id="pt_onboarding" style="position: relative; bottom: 25px; display:none;">
<div class="col-xl-12">
<div class="card-body">
<div class="tab-wrapper position-relative">
<ul class="nav nav-pills navtab-bg" id="myTab">
<li class="nav-item d-flex justify-content-center align-items-center">
<button class="scroll-btn left-btn" type="button">&#9664;</button>
</li>
<li class="nav-item">
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active-tab active" id="general_tab">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">Policy</span>
</a>
</li>
<li class="nav-item" id="hide_file_upload" style="display: none;">
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
<span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">Policy Docs</span>
</a>
</li>
<li class="nav-item d-flex justify-content-center align-items-center">
<!-- Right Arrow -->
<button class="scroll-btn right-btn" type="button">&#9654;</button>
</li>
</ul>
</div>
<div class="tab-content">
<?php include('policy_transaction_endorsement_form.php'); ?>
<?php include('drive_file_upload.php'); ?>
</div>
</div>
</div>
</div>