diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 9a762179..f7626dad 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -678,8 +678,8 @@ $routes->get("ticketHistoryList", "ThzController::ticketHistoryList");
$routes->group('test', function($routes) {
$routes->post('api/saveForm', 'TestingController::saveForm');
$routes->get('insurerRFQRemainder', 'LeadsController::remainderForQcr');
- $routes->get('ecard/generate-pdf', 'TestingController::generatePDF');
- $routes->get('view-pdf', 'TestingController::viewPDF');
+ $routes->get('generatePDF', 'TestingController::generatePDF');
+ $routes->get('viewPDF', 'TestingController::viewPDF');
$routes->get('generate-pdf-view', 'TestingController::generatePDFWithView');
});
$routes->cli('cli/testcli', 'TestingController::testcli');
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 5a5039f6..339a18a7 100755
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -1180,8 +1180,10 @@ class EmployeeController extends AdminController
return $response;
}
- //E-CARD DOWNLOAD FUNCTION
- public function generateIDCardForEmployee($rand_string, $people = 0)
+ // --------------- For E-Card Download -----------------------------------------------------------------------------------------------------
+
+ //E-CARD DOWNLOAD FUNCTION USING HTML PRINT
+ public function generateIDCardForEmployeeUsingHtml($rand_string, $people = 0)
{
// dd($rand_string, $people);
try {
@@ -1316,6 +1318,241 @@ class EmployeeController extends AdminController
}
+ // Preview E-Card Template function
+ public function previewTemplate($id = null)
+ {
+ $value = [
+ 'tpa_id' => 'TPA12345',
+ 'name' => 'John Doe',
+ 'uhid' => 'UHID67890',
+ 'gender' => 'Male',
+ 'dob' => '1985-05-15',
+ 'self' => 'John Doe',
+ 'policy_end_date' => '2024-12-31',
+ 'policy_start_date' => '2023-01-01',
+ 'policy_no' => 'POL1234567890',
+ 'insurer_name' => 'Example Insurance Company',
+ 'emp_code' => 'EMP001122',
+ 'client_name' => 'Corporate Client Inc.',
+ 'emp_age' => 39,
+ 'tpa_name' => 'Example TPA',
+ 'insurer_branch_city' => 'New York',
+ 'relationship' => 'Self',
+ 'basic_cover_si' => '5,00,000',
+ ];
+
+ $tpa_id = $this->TPAModel->where('id', $id)->first();
+
+ $template_data_path = WRITEPATH . 'e_card_template/';
+ $tpa_short_name = strtolower(str_replace(' ', '_', $tpa_id['short_name'])) . '.html';
+ $final_path = $template_data_path . $tpa_short_name;
+
+ if (!file_exists($final_path)) {
+
+ $data['message'] = 'Record Not Found';
+ return view('errors/404', $data);
+ }
+
+ $tmplt_data = file_get_contents($final_path);
+
+ $placeholders = [
+ '{TPA_ID}' => $value['tpa_id'],
+ '{NAME}' => $value['name'],
+ '{UHID}' => $value['uhid'],
+ '{GENDER}' => $value['gender'],
+ '{DOB}' => date('d-M-Y', strtotime($value['dob'])),
+ '{SELF_NAME}' => $value['self'] ?? $value['name'],
+ '{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
+ '{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
+ '{POLICY_NO}' => $value['policy_no'],
+ '{INSURER_NAME}' => strtoupper($value['insurer_name']),
+ '{EMP_ID}' => $value['emp_code'],
+ '{SI_AMT}' => $value['basic_cover_si'],
+ '{CORPORATE_NAME}' => $value['client_name'],
+ '{AGE}' => $value['emp_age'],
+ '{TPA_NAME}' => $value['tpa_name'],
+ '{INSURER_BRANCH}' => $value['insurer_branch_city'],
+ '{RELATION}' => $value['relationship'],
+ '{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['front_card'],
+ '{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['back_card'],
+ '{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $tpa_id['tpa_logo'],
+ '{INSURER_LOGO}' => base_url() . 'public/assets/images/sample_logo_3.png',
+ '{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
+ '{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
+ '{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
+ '{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
+ '{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
+ '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
+ '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
+
+ ];
+
+ $placeholders['{LEVELS}'] = '
+ Level 1
+ 1. Gowtham / 8754081806 / gowtham@gmail.com
+ 2. Gowtham / 8754081806 / gowtham@gmail.com
';
+
+ // dd($placeholders);
+
+ // Get the values to replace the placeholders
+ $replaceValues = array_values($placeholders);
+
+ // Get the placeholders to search for
+ $searchPlaceholders = array_keys($placeholders);
+
+ // Replace placeholders with values in HTML content
+ $htmlContent = str_replace($searchPlaceholders, $replaceValues, $tmplt_data);
+
+
+ echo $htmlContent;
+ }
+
+ //E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS )
+ public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0)
+ {
+ // dd($rand_string, $people);
+ $this->myLogger->logme('error', 'generateIDCardForEmployee params .' . json_encode(["rand_string" => $rand_string, "people" => $people, "mode" => $mode]));
+ try {
+ $this->myLogger->logme('error', 'generateIDCardForEmployee function started.');
+
+ // Step 1: Attempt to fetch employee code and client policy ID
+ $this->myLogger->logme('error', 'Fetching employee code and client policy ID.');
+
+ $get_emp_code_and_client_policy_id = $this->employeePolicyModel
+ ->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
+ ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
+ ->join('employees', 'employees.id = employee_polices.employee_id')
+ ->join('tpa', 'tpa.id = client_policy.tpa_id')
+ ->where('employees.emp_status', 'active')
+ ->where('employees.is_active', '1')
+ ->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
+ ->where('employee_polices.status', 'active')
+ ->where('employee_polices.is_active', '1')
+ ->where('employee_polices.rand_string', $rand_string)
+ ->first();
+
+ // dd($this->employeePolicyModel->getLastQuery());
+
+ // dd($rand_string, $get_emp_code_and_client_policy_id);
+
+ if ($get_emp_code_and_client_policy_id == null || $get_emp_code_and_client_policy_id == "") {
+ $this->myLogger->logme('error', 'Member not found in this rand_string: ' . $rand_string);
+ $data['message'] = 'Record Not Found';
+ return view('errors/404', $data);
+ }
+
+ $this->myLogger->logme('error', 'Member found. Client policy ID: ' . $get_emp_code_and_client_policy_id['client_policy_id']);
+
+ $client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
+ $emp_code = $get_emp_code_and_client_policy_id['emp_code'];
+ $client_id = $get_emp_code_and_client_policy_id['client_id'];
+
+ // Step 2: Fetch ECard data
+ $this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code);
+ $data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
+
+ if ($people == 0) {
+ $this->myLogger->logme('error', 'Fetching single ECard data using rand_string: ' . $rand_string . ' and emp_code: ' . $emp_code);
+ $data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code,$client_id);
+ }
+
+ // Step 3: Prepare template path
+ $template_data_path = WRITEPATH . 'e_card_template/';
+ // $tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
+ $tpa_short_name = 'common.html';
+ $final_path = $template_data_path . $tpa_short_name;
+
+ $this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path);
+
+ if (!file_exists($final_path)) {
+ $this->myLogger->logme('error', 'Template file not found: ' . $final_path);
+ $data['message'] = 'Template File Not Found';
+ return view('errors/404', $data);
+ }
+
+ $this->myLogger->logme('error', 'Template file found. Reading template data.');
+ $tmplt_data = file_get_contents($final_path);
+
+ // Step 4: Generate HTML content
+ $this->myLogger->logme('error', 'Generating HTML content from template.');
+ $html = "";
+ foreach ($data as $key => $value) {
+ $htmlContent = $tmplt_data;
+
+ $value['front_card'] = "Nhance_Ecard_working_1_front.png";
+ $value['back_card'] = "Nhance_Ecard_working_1_Back.png";
+
+ $placeholders = [
+ '{CLIENT_NAME}' => $value['client_name'],
+ '{TPA_ID}' => $value['tpa_id'],
+ '{NAME}' => $value['name'],
+ '{UHID}' => $value['uhid'],
+ '{GENDER}' => $value['gender'],
+ '{DOB}' => date('d-M-Y', strtotime($value['dob'])),
+ '{SELF_NAME}' => $value['self'] ?? $value['name'],
+ '{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
+ '{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
+ '{POLICY_NO}' => $value['policy_no'],
+ '{INSURER_NAME}' => strtoupper($value['insurer_name']),
+ '{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
+ '{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
+ '{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
+ '{EMP_ID}' => $value['emp_code'],
+ '{SI_AMT}' => $value['basic_cover_si'],
+ '{CORPORATE_NAME}' => $value['client_name'],
+ '{AGE}' => $value['emp_age'],
+ '{TPA_NAME}' => $value['tpa_name'],
+ '{INSURER_BRANCH}' => $value['insurer_branch_city'],
+ '{RELATION}' => $value['relationship'],
+ '{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
+ '{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
+ '{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
+ '{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
+ '{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
+ '{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
+ '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
+ '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
+ ];
+
+ $placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id);
+
+ foreach ($placeholders as $placeholder => $replaceValue) {
+ $htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
+ }
+
+ $html .= $htmlContent;
+ }
+
+ // DomPdf
+ $options = new Options();
+ $options->set('isRemoteEnabled', true);
+ $options->set('isHtml5ParserEnabled', true);
+
+ $dompdf = new Dompdf($options);
+ $dompdf->loadHtml('' . $html); // remove the margin
+ $dompdf->setPaper('A4', 'portrait');
+ $dompdf->render();
+
+ $filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
+
+ if($mode == 1){
+ $dompdf->stream($filename, ['Attachment' => false]); // Inline view
+ }else{
+ $dompdf->stream($filename, ['Attachment' => true]); // Force download
+ }
+
+ $this->myLogger->logme('error', 'generateIDCardForEmployee function completed successfully.');
+
+ } catch (\Exception $e) {
+ $this->myLogger->logme('error', 'Exception occurred: ' . $e->getMessage());
+ $data['message'] = 'Record Not Found';
+ return view('errors/404', $data);
+ }
+
+ }
+
+ // --------------------------------------------------------------------------------------------------------------------
+
public function viewECard()
{
@@ -1883,95 +2120,6 @@ class EmployeeController extends AdminController
}
}
- // Preview E-Card Template function
- public function previewTemplate($id = null)
- {
- $value = [
- 'tpa_id' => 'TPA12345',
- 'name' => 'John Doe',
- 'uhid' => 'UHID67890',
- 'gender' => 'Male',
- 'dob' => '1985-05-15',
- 'self' => 'John Doe',
- 'policy_end_date' => '2024-12-31',
- 'policy_start_date' => '2023-01-01',
- 'policy_no' => 'POL1234567890',
- 'insurer_name' => 'Example Insurance Company',
- 'emp_code' => 'EMP001122',
- 'client_name' => 'Corporate Client Inc.',
- 'emp_age' => 39,
- 'tpa_name' => 'Example TPA',
- 'insurer_branch_city' => 'New York',
- 'relationship' => 'Self',
- 'basic_cover_si' => '5,00,000',
- ];
-
- $tpa_id = $this->TPAModel->where('id', $id)->first();
-
- $template_data_path = WRITEPATH . 'e_card_template/';
- $tpa_short_name = strtolower(str_replace(' ', '_', $tpa_id['short_name'])) . '.html';
- $final_path = $template_data_path . $tpa_short_name;
-
- if (!file_exists($final_path)) {
-
- $data['message'] = 'Record Not Found';
- return view('errors/404', $data);
- }
-
- $tmplt_data = file_get_contents($final_path);
-
- $placeholders = [
- '{TPA_ID}' => $value['tpa_id'],
- '{NAME}' => $value['name'],
- '{UHID}' => $value['uhid'],
- '{GENDER}' => $value['gender'],
- '{DOB}' => date('d-M-Y', strtotime($value['dob'])),
- '{SELF_NAME}' => $value['self'] ?? $value['name'],
- '{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
- '{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
- '{POLICY_NO}' => $value['policy_no'],
- '{INSURER_NAME}' => strtoupper($value['insurer_name']),
- '{EMP_ID}' => $value['emp_code'],
- '{SI_AMT}' => $value['basic_cover_si'],
- '{CORPORATE_NAME}' => $value['client_name'],
- '{AGE}' => $value['emp_age'],
- '{TPA_NAME}' => $value['tpa_name'],
- '{INSURER_BRANCH}' => $value['insurer_branch_city'],
- '{RELATION}' => $value['relationship'],
- '{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['front_card'],
- '{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['back_card'],
- '{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $tpa_id['tpa_logo'],
- '{INSURER_LOGO}' => base_url() . 'public/assets/images/sample_logo_3.png',
- '{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
- '{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
- '{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
- '{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
- '{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
- '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
- '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
-
- ];
-
- $placeholders['{LEVELS}'] = '
- Level 1
- 1. Gowtham / 8754081806 / gowtham@gmail.com
- 2. Gowtham / 8754081806 / gowtham@gmail.com
';
-
- // dd($placeholders);
-
- // Get the values to replace the placeholders
- $replaceValues = array_values($placeholders);
-
- // Get the placeholders to search for
- $searchPlaceholders = array_keys($placeholders);
-
- // Replace placeholders with values in HTML content
- $htmlContent = str_replace($searchPlaceholders, $replaceValues, $tmplt_data);
-
-
- echo $htmlContent;
- }
-
public function errorListExportImport($file_id)
{
diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php
index b2d6968b..2975e3e1 100644
--- a/app/Controllers/TestingController.php
+++ b/app/Controllers/TestingController.php
@@ -32,7 +32,8 @@ class TestingController extends BaseController
}
public function testcli()
- { echo "hi";
+ {
+ echo "hi";
$this->myLogger->logme('error', "test log");
echo "hi 2";
log_message('error', 'test message for log_message_function');
@@ -97,6 +98,22 @@ class TestingController extends BaseController
{
// Same as generatePDF but with inline view
$data = [
+ 'NAME' => 'Korukonda Naga Venkata Ramalinga Satya Swarna Kumari',
+ 'GENDER' => 'Male',
+ 'DOB' => '01/01/1990',
+ 'RELATION' => 'Self',
+ 'POLICY_NO' => '97000034230400000109_EX_Parental',
+ 'TPA_ID' => 'TPA987654321',
+ 'POLICY_START_DATE' => '01/01/2024',
+ 'POLICY_DATE' => '31/12/2024',
+ 'INSURER_NAME' => 'ZURICH KOTAK GTNERAL INSURANCE COIIPANY lNDlA LIMITED',
+ 'TPA_NAME' => 'HealthIndia Insurance TPA Services Pvt. Ltd.',
+ 'FRONT_CARD' => base_url() .('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
+ 'BACK_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
+ 'LEVELS' => 'Level 1: 1800-XXX-XXXX
Level 2: support@company.com'
+ ];
+
+ $data2 = [
'NAME' => 'John Doe',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
@@ -107,23 +124,30 @@ class TestingController extends BaseController
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ABC Insurance Co.',
'TPA_NAME' => 'XYZ TPA Ltd.',
- 'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
- 'BACK_CARD' => base_url('assets/images/back-card.jpg'),
+ 'FRONT_CARD' => base_url() .('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
+ 'BACK_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX
Level 2: support@company.com'
];
- $html = $this->loadTemplate($data);
+ $employeeController = new EmployeeController();
+ // $html = $employeeController->generateIDCardForEmployeeUsingDom('LfpH3R');
+ $html = $this->loadTemplate($data2);
+ // print_r($html); die;
$options = new Options();
$options->set('isRemoteEnabled', true);
$options->set('isHtml5ParserEnabled', true);
-
+
$dompdf = new Dompdf($options);
- $dompdf->loadHtml($html);
+ // $dompdf->loadHtml($html);
+ $dompdf->loadHtml('' . $html);
$dompdf->setPaper('A4', 'portrait');
+ // $dompdf->setPaper('A4', 'landscape');
$dompdf->render();
-
+
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
- $dompdf->stream($filename, ['Attachment' => false]); // Inline view
+ // $dompdf->stream($filename, ['Attachment' => true]); // Inline view
+ $dompdf->stream($filename, ['Attachment' => false]); // Force download
+
}
private function loadTemplate($data)
@@ -139,79 +163,57 @@ class TestingController extends BaseController
return $template;
}
- // Alternative method using CodeIgniter's view system
- public function generatePDFWithView()
+ // not using and not working
+ public function viewPdfUsingMpdf()
{
$data = [
- 'NAME' => 'John Doe',
+ 'NAME' => 'Korukonda Naga Venkata Ramalinga Satya Swarna Kumari',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
- 'POLICY_NO' => 'POL123456789',
+ 'POLICY_NO' => '97000034230400000109_EX_Parental',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
- 'INSURER_NAME' => 'ABC Insurance Co.',
- 'TPA_NAME' => 'XYZ TPA Ltd.',
- 'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
- 'BACK_CARD' => base_url('assets/images/back-card.jpg'),
+ 'INSURER_NAME' => 'ZURICH KOTAK GTNERAL INSURANCE COIIPANY lNDlA LIMITED',
+ 'TPA_NAME' => 'HealthIndia Insurance TPA Services Pvt. Ltd.',
+ 'FRONT_CARD' => base_url('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
+ 'BACK_CARD' => base_url('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX
Level 2: support@company.com'
];
- // Load view with data
- $html = view('ecard_template', $data);
-
- $options = new Options();
- $options->set('isRemoteEnabled', true);
- $options->set('isHtml5ParserEnabled', true);
-
- $dompdf = new Dompdf($options);
- $dompdf->loadHtml($html);
- $dompdf->setPaper('A4', 'portrait');
- $dompdf->render();
-
- $filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
- $dompdf->stream($filename, ['Attachment' => true]);
+ $html = $this->loadTemplate($data);
+
+ // Load mPDF
+ $mpdf = "";
+
+ // $mpdf = new \Mpdf\Mpdf([
+ // 'mode' => 'utf-8',
+ // 'format' => 'A4',
+ // 'margin_left' => 0,
+ // 'margin_right' => 0,
+ // 'margin_top' => 0,
+ // 'margin_bottom' => 0,
+ // 'tempDir' => __DIR__ . '/writable/mpdf'
+ // ]);
+
+ // Optional: Stretch background or images fully
+ // $html = '
+ // ' . $html;
+
+ // $mpdf->WriteHTML($html);
+
+ // // Output inline (no download prompt)
+ // $filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
+ // $mpdf->Output($filename, 'D');
+ /*
+ 'I' = inline view in browser (no download prompt).
+ 'D' = force download.
+ 'F' = save to file.
+ 'S' = return as string.
+ */
}
-
- public function generatePDFById($id)
- {
- // Get data from database
- $ecardData = [];
-
- if (!$ecardData) {
- throw new \CodeIgniter\Exceptions\PageNotFoundException('E-card not found');
- }
-
- $data = [
- 'NAME' => $ecardData['name'],
- 'GENDER' => $ecardData['gender'],
- 'DOB' => $ecardData['dob'],
- 'RELATION' => $ecardData['relation'],
- 'POLICY_NO' => $ecardData['policy_no'],
- 'TPA_ID' => $ecardData['tpa_id'],
- 'POLICY_START_DATE' => $ecardData['policy_start_date'],
- 'POLICY_DATE' => $ecardData['policy_end_date'],
- 'INSURER_NAME' => $ecardData['insurer_name'],
- 'TPA_NAME' => $ecardData['tpa_name'],
- 'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
- 'BACK_CARD' => base_url('assets/images/back-card.jpg'),
- 'LEVELS' => 'Level 1: 1800-XXX-XXXX
Level 2: support@company.com'
- ];
-
- $html = view('ecard_template', $data);
-
- $options = new Options();
- $options->set('isRemoteEnabled', true);
- $options->set('isHtml5ParserEnabled', true);
-
- $dompdf = new Dompdf($options);
- $dompdf->loadHtml($html);
- $dompdf->setPaper('A4', 'landscape');
- $dompdf->render();
-
- $filename = 'ecard_' . $ecardData['policy_no'] . '_' . date('Y-m-d') . '.pdf';
- $dompdf->stream($filename, ['Attachment' => true]);
- }
-
}
diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php
index 9cda5b32..d4507c26 100755
--- a/app/Views/employee_data_list.php
+++ b/app/Views/employee_data_list.php
@@ -195,7 +195,7 @@
- View E-Card
+ " class="dropdown-item" target="_blank">View E-Card