diff --git a/.gitignore b/.gitignore
index e0e9251f..1ab80e5d 100755
--- a/.gitignore
+++ b/.gitignore
@@ -22,8 +22,8 @@ writable/debugbar/*
writable/**/*.db
writable/**/*.sqlite
-writable/e_card_template/*
-!writable/e_card_template/.gitkeep
+# writable/e_card_template/*
+# !writable/e_card_template/.gitkeep
writable/tmp/*
!writable/tmp/.gitkeep
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 8240c1c1..5e8e38ac 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -184,6 +184,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
$routes->get('test_members_list', 'EmployeeController::test_members_list');
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
+ $routes->get("retail-endorsement-list", "EmployeeController::retailendorsementList");
});
@@ -504,9 +505,6 @@ $routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("logined", "RestAuthenticationController::logined");
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
- $routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
- $routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
- $routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
});
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
@@ -579,6 +577,12 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("hrFileUpload", "EmployeeRestController::hrFileUpload");
$routes->post("updateHrFileUploadData", "EmployeeRestController::updateHrFileUploadData");
+ //claims
+ $routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
+ $routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
+ $routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
+
+
});
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
$routes->post("hrFileList", "EmployeeRestController::hrFileList");
@@ -680,8 +684,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/ClientController.php b/app/Controllers/ClientController.php
index b7a4d343..3ba36f45 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -2148,6 +2148,29 @@ class ClientController extends AdminController
}
}
+ public function generateKycPrimaryTable($client_id){
+
+ $db = db_connect();
+ $builder = $db->table('kyc_docs kd');
+ $builder->select('kd.*, ck.file_name AS upload_doc_name');
+ $builder->join('clients c', 'kd.kyc_type_id = c.entity_type_id');
+ $builder->join(
+ 'client_kyc_documents ck',
+ 'kd.id = ck.kyc_doc_type_id AND ck.client_id = c.id AND ck.is_active = 1',
+ 'left'
+ );
+ $builder->where('c.id', $client_id);
+ $builder->groupBy(['kd.id', 'ck.file_name']);
+
+ $query = $builder->get();
+ $result['data'] = $query->getResult();
+
+ $table = view('client_kyc_primary_table', $result);
+
+ print_r($table);
+
+ }
+
public function getPolicesByInsurerId($id = null)
{
$this->myLogger->logme('error', 'getPolicesByInsurerId function called');
@@ -2659,194 +2682,269 @@ class ClientController extends AdminController
}
}
+ // public function enrollmentGMCDisplayValueTransform()
+ // {
+ // $data = [];
+
+ // if ($this->request->getPost("waiverofpreexistingdiseases_display")) {
+ // $data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases");
+ // }
+
+ // if ($this->request->getPost("waiverof1234thyearexclusions_display")) {
+ // $data['Waiver of 1, 2, 3 & 4th year Exclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
+ // }
+
+ // if ($this->request->getPost("waiverof30dayswaitingperiod_display")) {
+ // $data['Waiver of 30 days waiting period'] = $this->request->getPost("waiverof30dayswaitingperiod");
+ // }
+
+ // if ($this->request->getPost("suminsuredenhancement_display")) {
+ // $data['Sum Insured Enhancement'] = $this->request->getPost("suminsuredenhancement");
+ // }
+
+ // if ($this->request->getPost("waiver_of_90_days_waiting_period_display")) {
+ // $data['Waiver of 90 Days Waiting Period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
+ // }
+
+ // if ($this->request->getPost("waiver_of_other_waiting_periods_display")) {
+ // $data['Waiver of Other Waiting Periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
+ // }
+
+ // if ($this->request->getPost("maternity_benefit_display")) {
+ // $data['Maternity Benefit'] = $this->request->getPost("maternity_benefit");
+ // }
+
+ // if ($this->request->getPost("9monthwaitingperiodwaived_display")) {
+ // $data['9-month waiting Period - waived'] = $this->request->getPost("9monthwaitingperiodwaived");
+ // }
+
+ // if ($this->request->getPost("maternitycoverage_display")) {
+ // $data['Maternity Coverage'] = $this->request->getPost("maternitycoverage");
+ // }
+
+ // if ($this->request->getPost("twindelivery_display")) {
+ // $data['Twin Delivery'] = $this->request->getPost("twindelivery");
+ // }
+
+ // if ($this->request->getPost("well_baby_well_mother_expenses_display")) {
+ // $data['Well baby / Well Mother Expenses'] = $this->request->getPost("well_baby_well_mother_expenses");
+ // }
+
+ // if ($this->request->getPost("preandpostnatal_display")) {
+ // $data['Pre and Post natal'] = $this->request->getPost("preandpostnatal");
+ // }
+
+ // if ($this->request->getPost("infertility_treatment_coverage_display")) {
+ // $data['Infertility Treatment Coverage'] = $this->request->getPost("infertility_treatment_coverage");
+ // }
+
+ // if ($this->request->getPost("babyday1cover_display")) {
+ // $data['Baby Day 1 Cover'] = $this->request->getPost("babyday1cover");
+ // }
+
+ // if ($this->request->getPost("coverfromthedateofjoining_display")) {
+ // $data['Cover from the date of Joining'] = $this->request->getPost("coverfromthedateofjoining");
+ // }
+
+ // if ($this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse_display")) {
+ // $data['Mid Term Addition of New Born / Newly Wedded Spouse'] = $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse");
+ // }
+
+ // if ($this->request->getPost("prehospitalizationcover_display")) {
+ // $data['Pre Hospitalization Cover'] = $this->request->getPost("prehospitalizationcover");
+ // }
+
+ // if ($this->request->getPost("posthospitalizationcover_display")) {
+ // $data['Post Hospitalization Cover'] = $this->request->getPost("posthospitalizationcover");
+ // }
+
+ // if ($this->request->getPost("congenitaldiseasesinternal_display")) {
+ // $data['Congenital Diseases - Internal'] = $this->request->getPost("congenitaldiseasesinternal");
+ // }
+
+ // if ($this->request->getPost("congenitaldiseasesexternal_display")) {
+ // $data['Congenital Diseases - External'] = $this->request->getPost("congenitaldiseasesexternal");
+ // }
+
+ // if ($this->request->getPost("copayzonewisecopay_display")) {
+ // $data['Co-Pay/Zone wise Co Pay'] = $this->request->getPost("copayzonewisecopay");
+ // }
+
+ // if ($this->request->getPost("roomrentlimit_display")) {
+ // $data['Room Rent Limit'] = $this->request->getPost("roomrentlimit");
+ // }
+
+ // if ($this->request->getPost("icu_limit_display")) {
+ // $data['ICU Limit'] = $this->request->getPost("icu_limit");
+ // }
+
+ // if ($this->request->getPost("proportionatedeductionclause_display")) {
+ // $data['Proportionate Deduction Clause'] = $this->request->getPost("proportionatedeductionclause");
+ // }
+
+ // if ($this->request->getPost("ailmentcapping_display")) {
+ // $data['Ailment capping'] = $this->request->getPost("ailmentcapping");
+ // }
+
+ // if ($this->request->getPost("ailment_capping_details_display")) {
+ // $data['Ailment capping Details'] = $this->request->getPost("ailment_capping_details");
+ // }
+
+ // if ($this->request->getPost("corporatebuffer_display")) {
+ // $data['Corporate Buffer'] = $this->request->getPost("corporatebuffer");
+ // }
+
+ // if ($this->request->getPost("non_admissible_contingency_corporate_buffer_display")) {
+ // $data['Non-Admissible / Contingency Corporate Buffer'] = $this->request->getPost("non_admissible_contingency_corporate_buffer");
+ // }
+
+ // if ($this->request->getPost("ambulancecharges_display")) {
+ // $data['Ambulance Charges'] = $this->request->getPost("ambulancecharges");
+ // }
+
+ // if ($this->request->getPost("airambulance_display")) {
+ // $data['Air Ambulance'] = $this->request->getPost("airambulance");
+ // }
+
+ // if ($this->request->getPost("reasonableandcustomarycharges_display")) {
+ // $data['Reasonable and Customary Charges'] = $this->request->getPost("reasonableandcustomarycharges");
+ // }
+
+ // if ($this->request->getPost("daycaretreatment_display")) {
+ // $data['Day Care Treatment'] = $this->request->getPost("daycaretreatment");
+ // }
+
+ // if ($this->request->getPost("lasiksurgery_display")) {
+ // $data['Lasik Surgery'] = $this->request->getPost("lasiksurgery");
+ // }
+
+ // if ($this->request->getPost("ayushtreatmentcover_display")) {
+ // $data['AYUSH treatment cover'] = $this->request->getPost("ayudhtreatmentcover");
+ // }
+
+ // if ($this->request->getPost("moderntreatmentsasperirdai_display")) {
+ // $data['Modern treatments as per IRDAI'] = $this->request->getPost("moderntreatmentsasperirdai");
+ // }
+
+ // if ($this->request->getPost("opd_treatment_display")) {
+ // $data['OPD Treatment'] = $this->request->getPost("opd_treatment");
+ // }
+
+ // if ($this->request->getPost("days_of_discharge_display")) {
+ // $data['Claim Intimation Clause'] = $this->request->getPost("days_of_discharge");
+ // }
+
+ // if ($this->request->getPost("days_from_dod_display")) {
+ // $data['Claim Submission'] = $this->request->getPost("days_from_dod");
+ // }
+
+ // if ($this->request->getPost("terrorism_display")) {
+ // $data['Terrorism'] = $this->request->getPost("terrorism");
+ // }
+
+ // if ($this->request->getPost("widower_cover_display")) {
+ // $data['Widower Cover'] = $this->request->getPost("widower_cover");
+ // }
+
+ // if ($this->request->getPost("breavement_cover_display")) {
+ // $data['Breavement Cover'] = $this->request->getPost("breavement_cover");
+ // }
+
+ // if ($this->request->getPost("special_condition_display_value")) {
+
+ // $specialConditionKeyValue = $this->request->getPost("special_condition_display_value") ?? [];
+ // $specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
+
+ // if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
+ // $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
+ // $data = array_merge($data, $mergedArray);
+ // }
+ // }
+
+ // if(isset($data) && !empty($data)){
+ // return $data;
+ // }else{
+ // $data = [];
+ // return $data;
+ // }
+
+ // }
+
public function enrollmentGMCDisplayValueTransform()
{
$data = [];
- if ($this->request->getPost("waiverofpreexistingdiseases_display")) {
- $data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases");
- }
-
- if ($this->request->getPost("waiverof1234thyearexclusions_display")) {
- $data['Waiver of 1, 2, 3 & 4th year Exclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
- }
-
- if ($this->request->getPost("waiverof30dayswaitingperiod_display")) {
- $data['Waiver of 30 days waiting period'] = $this->request->getPost("waiverof30dayswaitingperiod");
- }
+ // Mapping of POST keys to display labels
+ $fields = [
+ 'waiverofpreexistingdiseases' => 'Waiver of Pre-existing Diseases',
+ 'waiverof1,2,3&4thyearexclusions' => 'Waiver of 1, 2, 3 & 4th year Exclusions',
+ 'waiverof30dayswaitingperiod' => 'Waiver of 30 days waiting period',
+ 'suminsuredenhancement' => 'Sum Insured Enhancement',
+ 'waiver_of_90_days_waiting_period' => 'Waiver of 90 Days Waiting Period',
+ 'waiver_of_other_waiting_periods' => 'Waiver of Other Waiting Periods',
+ 'maternity_benefit' => 'Maternity Benefit',
+ '9monthwaitingperiodwaived' => '9-month waiting Period - waived',
+ 'maternitycoverage' => 'Maternity Coverage',
+ 'twindelivery' => 'Twin Delivery',
+ 'well_baby_well_mother_expenses' => 'Well baby / Well Mother Expenses',
+ 'preandpostnatal' => 'Pre and Post natal',
+ 'infertility_treatment_coverage' => 'Infertility Treatment Coverage',
+ 'babyday1cover' => 'Baby Day 1 Cover',
+ 'coverfromthedateofjoining' => 'Cover from the date of Joining',
+ 'mid_term_addition_of_new_born_newly_wedded_spouse' => 'Mid Term Addition of New Born / Newly Wedded Spouse',
+ 'prehospitalizationcover' => 'Pre Hospitalization Cover',
+ 'posthospitalizationcover' => 'Post Hospitalization Cover',
+ 'congenitaldiseasesinternal' => 'Congenital Diseases - Internal',
+ 'congenitaldiseasesexternal' => 'Congenital Diseases - External',
+ 'copayzonewisecopay' => 'Co-Pay/Zone wise Co Pay',
+ 'roomrentlimit' => 'Room Rent Limit',
+ 'icu_limit' => 'ICU Limit',
+ 'proportionatedeductionclause' => 'Proportionate Deduction Clause',
+ 'ailmentcapping' => 'Ailment capping',
+ 'ailment_capping_details' => 'Ailment capping Details',
+ 'corporatebuffer' => 'Corporate Buffer',
+ 'non_admissible_contingency_corporate_buffer' => 'Non-Admissible / Contingency Corporate Buffer',
+ 'ambulancecharges' => 'Ambulance Charges',
+ 'airambulance' => 'Air Ambulance',
+ 'reasonableandcustomarycharges' => 'Reasonable and Customary Charges',
+ 'daycaretreatment' => 'Day Care Treatment',
+ 'lasiksurgery' => 'Lasik Surgery',
+ 'ayudhtreatmentcover' => 'AYUSH treatment cover',
+ 'moderntreatmentsasperirdai' => 'Modern treatments as per IRDAI',
+ 'opd_treatment' => 'OPD Treatment',
+ 'days_of_discharge' => 'Claim Intimation Clause',
+ 'days_from_dod' => 'Claim Submission',
+ 'terrorism' => 'Terrorism',
+ 'widower_cover' => 'Widower Cover',
+ 'breavement_cover' => 'Breavement Cover'
+ ];
- if ($this->request->getPost("suminsuredenhancement_display")) {
- $data['Sum Insured Enhancement'] = $this->request->getPost("suminsuredenhancement");
- }
-
- if ($this->request->getPost("waiver_of_90_days_waiting_period_display")) {
- $data['Waiver of 90 Days Waiting Period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
- }
-
- if ($this->request->getPost("waiver_of_other_waiting_periods_display")) {
- $data['Waiver of Other Waiting Periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
- }
-
- if ($this->request->getPost("maternity_benefit_display")) {
- $data['Maternity Benefit'] = $this->request->getPost("maternity_benefit");
- }
-
- if ($this->request->getPost("9monthwaitingperiodwaived_display")) {
- $data['9-month waiting Period - waived'] = $this->request->getPost("9monthwaitingperiodwaived");
- }
-
- if ($this->request->getPost("maternitycoverage_display")) {
- $data['Maternity Coverage'] = $this->request->getPost("maternitycoverage");
- }
-
- if ($this->request->getPost("twindelivery_display")) {
- $data['Twin Delivery'] = $this->request->getPost("twindelivery");
- }
-
- if ($this->request->getPost("well_baby_well_mother_expenses_display")) {
- $data['Well baby / Well Mother Expenses'] = $this->request->getPost("well_baby_well_mother_expenses");
- }
-
- if ($this->request->getPost("preandpostnatal_display")) {
- $data['Pre and Post natal'] = $this->request->getPost("preandpostnatal");
- }
-
- if ($this->request->getPost("infertility_treatment_coverage_display")) {
- $data['Infertility Treatment Coverage'] = $this->request->getPost("infertility_treatment_coverage");
- }
-
- if ($this->request->getPost("babyday1cover_display")) {
- $data['Baby Day 1 Cover'] = $this->request->getPost("babyday1cover");
- }
-
- if ($this->request->getPost("coverfromthedateofjoining_display")) {
- $data['Cover from the date of Joining'] = $this->request->getPost("coverfromthedateofjoining");
- }
-
- if ($this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse_display")) {
- $data['Mid Term Addition of New Born / Newly Wedded Spouse'] = $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse");
- }
-
- if ($this->request->getPost("prehospitalizationcover_display")) {
- $data['Pre Hospitalization Cover'] = $this->request->getPost("prehospitalizationcover");
- }
-
- if ($this->request->getPost("posthospitalizationcover_display")) {
- $data['Post Hospitalization Cover'] = $this->request->getPost("posthospitalizationcover");
- }
-
- if ($this->request->getPost("congenitaldiseasesinternal_display")) {
- $data['Congenital Diseases - Internal'] = $this->request->getPost("congenitaldiseasesinternal");
- }
-
- if ($this->request->getPost("congenitaldiseasesexternal_display")) {
- $data['Congenital Diseases - External'] = $this->request->getPost("congenitaldiseasesexternal");
- }
-
- if ($this->request->getPost("copayzonewisecopay_display")) {
- $data['Co-Pay/Zone wise Co Pay'] = $this->request->getPost("copayzonewisecopay");
- }
-
- if ($this->request->getPost("roomrentlimit_display")) {
- $data['Room Rent Limit'] = $this->request->getPost("roomrentlimit");
- }
-
- if ($this->request->getPost("icu_limit_display")) {
- $data['ICU Limit'] = $this->request->getPost("icu_limit");
- }
-
- if ($this->request->getPost("proportionatedeductionclause_display")) {
- $data['Proportionate Deduction Clause'] = $this->request->getPost("proportionatedeductionclause");
- }
-
- if ($this->request->getPost("ailmentcapping_display")) {
- $data['Ailment capping'] = $this->request->getPost("ailmentcapping");
- }
-
- if ($this->request->getPost("ailment_capping_details_display")) {
- $data['Ailment capping Details'] = $this->request->getPost("ailment_capping_details");
- }
-
- if ($this->request->getPost("corporatebuffer_display")) {
- $data['Corporate Buffer'] = $this->request->getPost("corporatebuffer");
- }
-
- if ($this->request->getPost("non_admissible_contingency_corporate_buffer_display")) {
- $data['Non-Admissible / Contingency Corporate Buffer'] = $this->request->getPost("non_admissible_contingency_corporate_buffer");
- }
-
- if ($this->request->getPost("ambulancecharges_display")) {
- $data['Ambulance Charges'] = $this->request->getPost("ambulancecharges");
- }
-
- if ($this->request->getPost("airambulance_display")) {
- $data['Air Ambulance'] = $this->request->getPost("airambulance");
- }
-
- if ($this->request->getPost("reasonableandcustomarycharges_display")) {
- $data['Reasonable and Customary Charges'] = $this->request->getPost("reasonableandcustomarycharges");
- }
-
- if ($this->request->getPost("daycaretreatment_display")) {
- $data['Day Care Treatment'] = $this->request->getPost("daycaretreatment");
- }
-
- if ($this->request->getPost("lasiksurgery_display")) {
- $data['Lasik Surgery'] = $this->request->getPost("lasiksurgery");
- }
-
- if ($this->request->getPost("ayushtreatmentcover_display")) {
- $data['AYUSH treatment cover'] = $this->request->getPost("ayudhtreatmentcover");
- }
-
- if ($this->request->getPost("moderntreatmentsasperirdai_display")) {
- $data['Modern treatments as per IRDAI'] = $this->request->getPost("moderntreatmentsasperirdai");
- }
-
- if ($this->request->getPost("opd_treatment_display")) {
- $data['OPD Treatment'] = $this->request->getPost("opd_treatment");
- }
-
- if ($this->request->getPost("days_of_discharge_display")) {
- $data['Claim Intimation Clause'] = $this->request->getPost("days_of_discharge");
- }
-
- if ($this->request->getPost("days_from_dod_display")) {
- $data['Claim Submission'] = $this->request->getPost("days_from_dod");
- }
-
- if ($this->request->getPost("terrorism_display")) {
- $data['Terrorism'] = $this->request->getPost("terrorism");
- }
-
- if ($this->request->getPost("widower_cover_display")) {
- $data['Widower Cover'] = $this->request->getPost("widower_cover");
- }
-
- if ($this->request->getPost("breavement_cover_display")) {
- $data['Breavement Cover'] = $this->request->getPost("breavement_cover");
- }
-
- if ($this->request->getPost("special_condition_display_value")) {
-
- $specialConditionKeyValue = $this->request->getPost("special_condition_display_value") ?? [];
- $specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
-
- if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
- $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
- $data = array_merge($data, $mergedArray);
+ foreach ($fields as $postKey => $label) {
+ $displayKey = $postKey . '_display';
+ $value = $this->request->getPost($postKey);
+ if ($this->request->getPost($displayKey) && $value !== null && $value !== '') {
+ $data[$label] = $value;
}
}
-
- if(isset($data) && !empty($data)){
- return $data;
- }else{
- $data = [];
- return $data;
+
+ // Handle special conditions
+ if ($this->request->getPost("special_condition_display_value")) {
+ $specialConditionKeyValue = json_decode($this->request->getPost("special_condition_display_value"), true);
+ if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
+ $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
+ // Only add non-empty values
+ foreach ($mergedArray as $k => $v) {
+ if ($v !== null && $v !== '') {
+ $data[$k] = $v;
+ }
+ }
+ }
}
-
+
+ return $data;
}
+
public function getterms()
{
$client_policy_id = $this->request->getVar('client_policy_id');
@@ -3006,92 +3104,145 @@ class ClientController extends AdminController
}
}
+ // public function enrollmentGPADisplayValueTransform()
+ // {
+ // $data = [];
+
+ // if ($this->request->getPost("accidentalDeathBenefit_display")) {
+ // $data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit");
+ // }
+ // if ($this->request->getPost("permanentTotalDisablement_display")) {
+ // $data['Permanent Total Disablement'] = $this->request->getPost("permanentTotalDisablement");
+ // }
+ // if ($this->request->getPost("permanentPartialDisablement_display")) {
+ // $data['Permanent Partial Disablement'] = $this->request->getPost("permanentPartialDisablement");
+ // }
+ // if ($this->request->getPost("temporaryTotalDisablementBenefit_display")) {
+ // $data['Temporary Total Disablement Benefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
+ // }
+ // if ($this->request->getPost("medical_expenses_medical_extension_display")) {
+ // $data['Medical Expenses / Medical Extension (IPD)'] = $this->request->getPost("medical_expenses_medical_extension");
+ // }
+ // if ($this->request->getPost("opd_treatment_cover_display")) {
+ // $data['OPD Treatment Cover'] = $this->request->getPost("opd_treatment_cover");
+ // }
+ // if ($this->request->getPost("ambulanceCharges_display")) {
+ // $data['Ambulance Charges'] = $this->request->getPost("ambulanceCharges");
+ // }
+ // if ($this->request->getPost("repatriation_of_mortal_remains_display")) {
+ // $data['Repatriation of Mortal Remains'] = $this->request->getPost("repatriation_of_mortal_remains");
+ // }
+ // if ($this->request->getPost("childrenEducationWelfareFund_display")) {
+ // $data['Children Education Welfare Fund'] = $this->request->getPost("childrenEducationWelfareFund");
+ // }
+ // if ($this->request->getPost("terrorism_display")) {
+ // $data['Terrorism'] = $this->request->getPost("terrorism");
+ // }
+ // if ($this->request->getPost("worldwideCover_display")) {
+ // $data['Worldwide Cover'] = $this->request->getPost("worldwideCover");
+ // }
+ // if ($this->request->getPost("family_transportation_benefits_display")) {
+ // $data['Family Transportation Benefits'] = $this->request->getPost("family_transportation_benefits");
+ // }
+ // if ($this->request->getPost("fractures_dislocation_burns_display")) {
+ // $data['Fractures / Dislocation / Burns'] = $this->request->getPost("fractures_dislocation_burns");
+ // }
+ // if ($this->request->getPost("coma_display")) {
+ // $data['Coma'] = $this->request->getPost("coma");
+ // }
+ // if ($this->request->getPost("carriageofDeadBody_display")) {
+ // $data['Carriage of Dead Body'] = $this->request->getPost("carriageOfDeadBody");
+ // }
+ // if ($this->request->getPost("compassionateVisitExpenses_display")) {
+ // $data['Compassionate Visit Expenses'] = $this->request->getPost("compassionateVisitExpenses");
+ // }
+ // if ($this->request->getPost("travel_expenses_for_medical_treatment_display")) {
+ // $data['Travel expenses for Medical Treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
+ // }
+ // if ($this->request->getPost("daily_cash_allowance_display")) {
+ // $data['Daily cash Allowance'] = $this->request->getPost("daily_cash_allowance");
+ // }
+ // if ($this->request->getPost("artifical_limb_and_prosthesis_display")) {
+ // $data['Artifical Limb and Prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
+ // }
+ // if ($this->request->getPost("animalSnakeInsectBite_display")) {
+ // $data['Animal/Snake/Insect Bite'] = $this->request->getPost("animalSnakeInsectBite");
+ // }
+ // if ($this->request->getPost("air_ambulance_display")) {
+ // $data['Air Ambulance'] = $this->request->getPost("air_ambulance");
+ // }
+
+ // if ($this->request->getPost("gpa_special_condition_display_value")) {
+
+ // $specialConditionKeyValue = $this->request->getPost("gpa_special_condition_display_value") ?? [];
+ // $specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
+
+ // if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
+ // $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
+ // $data = array_merge($data, $mergedArray);
+ // }
+ // }
+ // // print_r($data); die;
+
+ // if (isset($data) && !empty($data)) {
+ // return $data;
+ // } else {
+ // $data = [];
+ // return $data;
+ // }
+ // }
+
public function enrollmentGPADisplayValueTransform()
- {
+ {
$data = [];
- if ($this->request->getPost("accidentalDeathBenefit_display")) {
- $data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit");
- }
- if ($this->request->getPost("permanentTotalDisablement_display")) {
- $data['Permanent Total Disablement'] = $this->request->getPost("permanentTotalDisablement");
- }
- if ($this->request->getPost("permanentPartialDisablement_display")) {
- $data['Permanent Partial Disablement'] = $this->request->getPost("permanentPartialDisablement");
- }
- if ($this->request->getPost("temporaryTotalDisablementBenefit_display")) {
- $data['Temporary Total Disablement Benefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
- }
- if ($this->request->getPost("medical_expenses_medical_extension_display")) {
- $data['Medical Expenses / Medical Extension (IPD)'] = $this->request->getPost("medical_expenses_medical_extension");
- }
- if ($this->request->getPost("opd_treatment_cover_display")) {
- $data['OPD Treatment Cover'] = $this->request->getPost("opd_treatment_cover");
- }
- if ($this->request->getPost("ambulanceCharges_display")) {
- $data['Ambulance Charges'] = $this->request->getPost("ambulanceCharges");
- }
- if ($this->request->getPost("repatriation_of_mortal_remains_display")) {
- $data['Repatriation of Mortal Remains'] = $this->request->getPost("repatriation_of_mortal_remains");
- }
- if ($this->request->getPost("childrenEducationWelfareFund_display")) {
- $data['Children Education Welfare Fund'] = $this->request->getPost("childrenEducationWelfareFund");
- }
- if ($this->request->getPost("terrorism_display")) {
- $data['Terrorism'] = $this->request->getPost("terrorism");
- }
- if ($this->request->getPost("worldwideCover_display")) {
- $data['Worldwide Cover'] = $this->request->getPost("worldwideCover");
- }
- if ($this->request->getPost("family_transportation_benefits_display")) {
- $data['Family Transportation Benefits'] = $this->request->getPost("family_transportation_benefits");
- }
- if ($this->request->getPost("fractures_dislocation_burns_display")) {
- $data['Fractures / Dislocation / Burns'] = $this->request->getPost("fractures_dislocation_burns");
- }
- if ($this->request->getPost("coma_display")) {
- $data['Coma'] = $this->request->getPost("coma");
- }
- if ($this->request->getPost("carriageofDeadBody_display")) {
- $data['Carriage of Dead Body'] = $this->request->getPost("carriageOfDeadBody");
- }
- if ($this->request->getPost("compassionateVisitExpenses_display")) {
- $data['Compassionate Visit Expenses'] = $this->request->getPost("compassionateVisitExpenses");
- }
- if ($this->request->getPost("travel_expenses_for_medical_treatment_display")) {
- $data['Travel expenses for Medical Treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
- }
- if ($this->request->getPost("daily_cash_allowance_display")) {
- $data['Daily cash Allowance'] = $this->request->getPost("daily_cash_allowance");
- }
- if ($this->request->getPost("artifical_limb_and_prosthesis_display")) {
- $data['Artifical Limb and Prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
- }
- if ($this->request->getPost("animalSnakeInsectBite_display")) {
- $data['Animal/Snake/Insect Bite'] = $this->request->getPost("animalSnakeInsectBite");
- }
- if ($this->request->getPost("air_ambulance_display")) {
- $data['Air Ambulance'] = $this->request->getPost("air_ambulance");
- }
+ // Map POST keys to display labels
+ $fields = [
+ 'accidentalDeathBenefit' => 'Accidental Death Benefit',
+ 'permanentTotalDisablement' => 'Permanent Total Disablement',
+ 'permanentPartialDisablement' => 'Permanent Partial Disablement',
+ 'temporaryTotalDisablementBenefit' => 'Temporary Total Disablement Benefit',
+ 'medical_expenses_medical_extension' => 'Medical Expenses / Medical Extension (IPD)',
+ 'opd_treatment_cover' => 'OPD Treatment Cover',
+ 'ambulanceCharges' => 'Ambulance Charges',
+ 'repatriation_of_mortal_remains' => 'Repatriation of Mortal Remains',
+ 'childrenEducationWelfareFund' => 'Children Education Welfare Fund',
+ 'terrorism' => 'Terrorism',
+ 'worldwideCover' => 'Worldwide Cover',
+ 'family_transportation_benefits' => 'Family Transportation Benefits',
+ 'fractures_dislocation_burns' => 'Fractures / Dislocation / Burns',
+ 'coma' => 'Coma',
+ 'carriageOfDeadBody' => 'Carriage of Dead Body',
+ 'compassionateVisitExpenses' => 'Compassionate Visit Expenses',
+ 'travel_expenses_for_medical_treatment' => 'Travel expenses for Medical Treatment',
+ 'daily_cash_allowance' => 'Daily cash Allowance',
+ 'artifical_limb_and_prosthesis' => 'Artifical Limb and Prosthesis',
+ 'animalSnakeInsectBite' => 'Animal/Snake/Insect Bite',
+ 'air_ambulance' => 'Air Ambulance'
+ ];
- if ($this->request->getPost("gpa_special_condition_display_value")) {
-
- $specialConditionKeyValue = $this->request->getPost("gpa_special_condition_display_value") ?? [];
- $specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
-
- if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
- $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
- $data = array_merge($data, $mergedArray);
+ foreach ($fields as $postKey => $label) {
+ $displayKey = $postKey . '_display';
+ $value = $this->request->getPost($postKey);
+ if ($this->request->getPost($displayKey) && $value !== null && $value !== '') {
+ $data[$label] = $value;
}
}
- // print_r($data); die;
- if (isset($data) && !empty($data)) {
- return $data;
- } else {
- $data = [];
- return $data;
+ // Handle GPA special conditions
+ if ($this->request->getPost("gpa_special_condition_display_value")) {
+ $specialConditionKeyValue = json_decode($this->request->getPost("gpa_special_condition_display_value"), true);
+ if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
+ $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
+ foreach ($mergedArray as $k => $v) {
+ if ($v !== null && $v !== '') {
+ $data[$k] = $v;
+ }
+ }
+ }
}
+
+ return $data;
}
public function getPolicyGPATerms()
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 5a5039f6..971be548 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,258 @@ 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();
+
+ // Set document title
+ $dompdf->addInfo("Title", "E-Card");
+
+ $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
+ // }
+
+ if ($mode == 1) {
+ // Inline view
+ return $this->response
+ ->setHeader('Content-Type', 'application/pdf')
+ ->setHeader('Content-Disposition', 'inline; filename="' . $filename . '"')
+ ->setBody($dompdf->output());
+ } else {
+ // Force download
+ return $this->response
+ ->setHeader('Content-Type', 'application/pdf')
+ ->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"')
+ ->setBody($dompdf->output());
+ }
+
+ $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 +2137,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)
{
@@ -2842,4 +3007,11 @@ class EmployeeController extends AdminController
}
+
+ public function retailendorsementList()
+ {
+ $data['message'] = 'File Not Found';
+ echo view('errors/404', $data);
+ }
+
}
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 4fc7d1c4..72ea2e99 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -51,7 +51,7 @@ use CodeIgniter\API\ResponseTrait;
use Illuminate\Http\Request;
use App\Controllers\EmployeeServiceController;
-
+use App\Models\ClaimFilesModel;
use Kreait\Firebase\Factory;
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;
@@ -2820,18 +2820,29 @@ class EmployeeRestController extends AdminController
{
$policyGroup = 'gpa';
$data['ticket_type_id'] = 2;
+ $data['claim_subject'] = "Claim GPA";
+ $data['sum_insured_label'] = "Sum Assured";
+
}else if($ClientPolicyValue['policy_type_id'] == 6)
{
$policyGroup = 'gpa';
$data['ticket_type_id'] = 3;
+ $data['claim_subject'] = "Claim EDLI";
+ $data['sum_insured_label'] = "Sum Assured";
+
}else if($ClientPolicyValue['policy_type_id'] == 7)
{
$policyGroup = 'gpa';
$data['ticket_type_id'] = 4;
+ $data['claim_subject'] = "Claim GTLI";
+ $data['sum_insured_label'] = "Sum Assured";
+
}else
{
$policyGroup = 'gmc';
$data['ticket_type_id'] = 1;
+ $data['claim_subject'] = "Claim GMC";
+ $data['sum_insured_label'] = "Sum Insured";
}
$terms = json_decode($ClientPolicyValue['policy_terms'] , true);
@@ -3406,11 +3417,19 @@ class EmployeeRestController extends AdminController
{
$received_data = $this->request->getPost();
- // print_r($received_data); die;
+ $get_file_data = $this->request->getFiles('claim_docs');
+ // print_r($get_file_data); die;
$employee_id = $received_data['emp_id'];
$client_policy_id = $received_data['client_policy_id'];
$insured_emp_id = $received_data['insured_emp_id'];
+ $file_data = "";
+ if(isset($get_file_data) && !empty($get_file_data)){
+ $file_path = WRITEPATH . 'uploads/claim_files/';
+ $file_data = multi_file_Upload($get_file_data, $file_path);
+ }
+
+
if (empty($received_data['doa'])) {
$received_data['doa'] = null;
} else{
@@ -3491,6 +3510,8 @@ class EmployeeRestController extends AdminController
if ($insert_status && !empty($ticket_id)) {
+ $this->handleCliamFiles($file_data, $ticket_id);
+
//insert first history
$this->ticketController->putHistoryAfterInsert($fetchData, $ticket_id);
@@ -3544,15 +3565,131 @@ class EmployeeRestController extends AdminController
}
}
+ public function handleCliamFiles($data, $ticket_id)
+ {
+ if(!empty($data) && !empty($ticket_id))
+ {
+ $insert_ids = [];
+ $claim_file = new ClaimFilesModel();
+ foreach ($data as $key => $value) {
+
+ $data = [
+ 'ticket_id' => $ticket_id,
+ 'doc_name' => $value['file_name'],
+ 'url' => $value['file_path'],
+ 'file_type' => 2,
+ ];
+
+ $insert_ids[] = $claim_file->insert($data);
+ }
+
+ return $insert_ids;
+ }
+
+ return [];
+ }
+
//department
+ // public function get_ticket_type()
+ // {
+ // $ticket_type = $this->ticketController->ticketType;
+ // $ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
+ // // print_r($ticket_type); die;
+ // return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200);
+ // }
+
public function get_ticket_type()
{
- $ticket_type = $this->ticketController->ticketType;
- $ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
- // print_r($ticket_type); die;
- return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200);
+ try {
+
+ $client_id = $this->request->getGet('client_id');
+ $emp_code = $this->request->getGet('emp_code');
+
+ if (empty($client_id) || empty($emp_code)) {
+
+ $this->myLogger->logme('error', "Missing required parameters: client_id={$client_id}, emp_code={$emp_code}");
+ // return $this->response->setJSON([
+ // 'status' => false,
+ // 'code' => 400,
+ // 'message' => 'client_id and emp_code are required'
+ // ])->setStatusCode(400);
+
+ $ticket_type = $this->ticketController->ticketType;
+ $ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
+ return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200);
+ }
+
+ // Get policy type ids
+ $policy_type_ids = $this->employeePolicyModel
+ ->select('client_policy.policy_type_id')
+ ->join('employees', 'employee_polices.employee_id = employees.id')
+ ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id')
+ ->where('employees.is_active', 1)
+ ->whereIn('employees.emp_status', ['active', 'expired'])
+ ->where('employee_polices.is_active', 1)
+ ->whereIn('employee_polices.status', ['active', 'expired'])
+ ->where('employees.client_id', $client_id)
+ ->where('employees.emp_code', $emp_code)
+ ->groupBy('employee_polices.client_policy_id')
+ ->findAll();
+
+ if (!$policy_type_ids) {
+ $this->myLogger->logme('error', "No policy types found for client_id={$client_id}, emp_code={$emp_code}");
+ return $this->response->setJSON([
+ 'status' => false,
+ 'code' => 404,
+ 'message' => 'No policy types found'
+ ])->setStatusCode(404);
+ }
+
+ $this->myLogger->logme('info', "Policy type IDs fetched: " . json_encode($policy_type_ids));
+
+ $ticket_type = $this->ticketController->ticketType;
+ $filtered = [];
+
+ $mapping = [
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 5 => 1,
+ 1 => 2,
+ 6 => 3,
+ 7 => 4,
+ ];
+
+ foreach ($policy_type_ids as $value) {
+ $ticketTypeId = $value['policy_type_id'] ?? null;
+
+ if (isset($mapping[$ticketTypeId]) && isset($ticket_type[$mapping[$ticketTypeId]])) {
+ $mappedId = $mapping[$ticketTypeId];
+ $mappedName = $ticket_type[$mappedId];
+
+ // Use mappedId as key to avoid duplicates
+ $filtered[$mappedId] = [
+ 'id' => $mappedId,
+ 'name' => $mappedName
+ ];
+
+ $this->myLogger->logme('info', "Ticket type resolved: ID={$ticketTypeId}, Name={$mappedName}");
+ } else {
+ $this->myLogger->logme('warning', "No valid ticket type mapping for policy_type_id={$ticketTypeId}");
+ }
+ }
+
+ $filtered = array_values($filtered);
+ return $this->response->setJSON(['status' => true,'code' => 200, 'ticket_type' => $filtered ])->setStatusCode(200);
+
+ } catch (\Throwable $e) {
+ $this->myLogger->logme('error', "Error in get_ticket_type: " . $e->getMessage() . " Trace: " . $e->getTraceAsString());
+ return $this->response->setJSON([
+ 'status' => false,
+ 'code' => 500,
+ 'message' => 'Internal Server Error'
+ ])->setStatusCode(500);
+ }
}
+
//ticket data
public function get_ticket_data()
{
@@ -3566,6 +3703,9 @@ class EmployeeRestController extends AdminController
$emp_id = $this->request->getGet('emp_id');
$ticket_type = $this->request->getGet('ticket_type') ?? null;
$ticket_id = $this->request->getGet('ticket_id') ?? null;
+ $request = \Config\Services::request();
+ $uri = $request->uri->getPath();
+ $returnType = (strpos($uri, 'api') !== false) ? 'api' : 'web';
// dd($emp_id);
if (empty($emp_id)) {
@@ -3573,7 +3713,7 @@ class EmployeeRestController extends AdminController
}
$TicketMasterModel = new TicketMasterModel();
- $ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $ticket_type, $ticket_id);
+ $ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $returnType, $ticket_type, $ticket_id);
if (!empty($ticket_data)) {
diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php
index 9838492c..60d3b955 100755
--- a/app/Controllers/MasterController.php
+++ b/app/Controllers/MasterController.php
@@ -1894,6 +1894,8 @@ class MasterController extends AdminController
'cache' => WRITEPATH . 'cache',
'sample_import_excel' => ROOTPATH . 'public/sample_import_excel',
'lead_files' => WRITEPATH . 'uploads/lead_files/',
+ 'claim_files' => WRITEPATH . 'uploads/claim_files/',
+ 'claim_dump_excel' => WRITEPATH . 'uploads/claim_dump_excel/',
'claim_sample_forms' => ROOTPATH . 'public/claim_sample_forms/',
];
diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php
index b2d6968b..d866cb7f 100644
--- a/app/Controllers/TestingController.php
+++ b/app/Controllers/TestingController.php
@@ -3,6 +3,7 @@
namespace App\Controllers;
use App\Controllers\BaseController;
+use App\Models\EmployeePolicyModel;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
use Dompdf\Dompdf;
@@ -32,7 +33,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 +99,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 +125,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 +164,76 @@ 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)
+ public function getEmployeePolicyTypes($client_id, $emp_code, $emp_id)
{
- // Get data from database
- $ecardData = [];
-
- if (!$ecardData) {
- throw new \CodeIgniter\Exceptions\PageNotFoundException('E-card not found');
- }
+ $employeePolicy = new EmployeePolicyModel();
- $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'
- ];
+ $data = $employeePolicy
+ ->select('client_policy.policy_type_id')
+ ->join('employees', 'employee_polices.employee_id = employees.id')
+ ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id')
+ ->where('employees.is_active', 1)
+ ->where('employees.emp_status', ['active', 'expired'])
+ ->where('employee_polices.is_active', 1)
+ ->where('employee_polices.status', ['active', 'expired'])
+ ->where('employees.client_id', $client_id)
+ ->where('employees.emp_code', $emp_code)
+ ->groupBy('employee_polices.client_policy_id')
+ ->findAll();
- $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/Controllers/TicketController.php b/app/Controllers/TicketController.php
index c9548469..828fc262 100644
--- a/app/Controllers/TicketController.php
+++ b/app/Controllers/TicketController.php
@@ -713,7 +713,10 @@ class TicketController extends BaseController
$claim_status_id = 25;
}else if($ticket_type == 4){
$claim_status_id = 35;
- }else{
+ }else if($ticket_type == 8){
+ $claim_status_id = 62;
+ }
+ else{
$claim_status_id = 1;
}
}
@@ -728,7 +731,7 @@ class TicketController extends BaseController
$data['claim_type'] = $this->claimType[2];
}
- $data['client_for_motor'] = $this->clientModel->select('id,client_name')->where('client_type', 2)->where('is_active', 1)->findAll();
+ $data['client_for_motor'] = $this->clientModel->select('id,client_name,phone')->where('client_type', 2)->where('is_active', 1)->findAll();
$this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type");
@@ -750,9 +753,10 @@ class TicketController extends BaseController
->where('owner', $id)
->findAll();
- $data['partner_policy_list'] = $this->partnerPolicyModel
- ->where('is_active', 1)
- ->findAll();
+ // $data['partner_policy_list'] = $this->partnerPolicyModel
+ // ->where('is_active', 1)
+ // ->findAll();
+ $data['partner_policy_list'] = $this->partnerPolicyModel->partnerPolicyList();
$client = $this->clientModel
->where('is_active', 1)
@@ -868,9 +872,10 @@ class TicketController extends BaseController
}
public function view_ticket($ticket_id)
- {
+ {
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
+
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) {
@@ -929,6 +934,14 @@ class TicketController extends BaseController
// print_rr($data); die;
}
+ // 8TH TYPE is Motor - so do not remove it....
+ if($ticket_data['ticket_type_id'] == 8){
+ $claim_status_id = $ticket_data['claim_status_id'];
+ $ticket_type = $ticket_data['ticket_type_id'];
+ $data['claim_status'] = $this->transFormClaimStatus($claim_status_id, $ticket_type);
+ $data['client_for_motor'] = $this->clientModel->select('id,client_name,phone')->where('client_type', 2)->where('is_active', 1)->findAll();
+ }
+
return $this->loadLayout('ticket_edit_onbording', $data);
}
@@ -2274,7 +2287,8 @@ class TicketController extends BaseController
'url' => $data['url'][$key]??'',
'ticket_id'=> $data['ticket_id_url']??'',
'created_by' => get_session_userid(),
- 'is_active' => 1
+ 'is_active' => 1,
+ 'file_type' => 1
];
$insertArr[] = $insertData;
@@ -2311,6 +2325,7 @@ class TicketController extends BaseController
$urlData = $this->claimFilesModel
->where('ticket_id', $ticket_id)
->where('is_active',1)
+ ->where('file_type',1)
->findAll();
return $this->response->setJSON([
diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php
index eae819ea..d65d7e6b 100755
--- a/app/Helpers/utility_helper.php
+++ b/app/Helpers/utility_helper.php
@@ -64,6 +64,42 @@ if (!function_exists('file_Upload')) {
}
}
+if (!function_exists('multi_file_Upload')) {
+ function multi_file_Upload($fileToUpload, $filepath)
+ {
+ $uploadedFiles = [];
+
+ // Handle multiple files
+ if (is_array($fileToUpload)) {
+ foreach ($fileToUpload as $file) {
+ if ($file !== null && $file->isValid() && !$file->hasMoved()) {
+ $file->move($filepath);
+ $fileName = $file->getName(); // safer unique name
+ $uploadedFiles[] = [
+ 'file_name' => $fileName,
+ 'file_path' => $filepath . $fileName
+ ];
+ }
+ }
+ }
+ // Handle single file
+ else {
+ if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
+ $fileToUpload->move($filepath);
+ $fileName = $fileToUpload->getName();
+ $uploadedFiles[] = [
+ 'file_name' => $fileName,
+ 'file_path' => $filepath . $fileName
+ ];
+ }
+ }
+
+ return $uploadedFiles; // always return array of files
+ }
+}
+
+
+
if (!function_exists('file_unlink')) {
function file_unlink($filepath)
{
diff --git a/app/Models/ClaimFilesModel.php b/app/Models/ClaimFilesModel.php
index 2a5ec138..31c950a5 100644
--- a/app/Models/ClaimFilesModel.php
+++ b/app/Models/ClaimFilesModel.php
@@ -11,6 +11,7 @@ class ClaimFilesModel extends Model
protected $allowedFields = [
'id',
'ticket_id',
+ 'file_type',
'doc_name',
'url',
'created_by',
diff --git a/app/Models/PartnerEndorsementRequestModel.php b/app/Models/PartnerEndorsementRequestModel.php
new file mode 100755
index 00000000..d8b162b4
--- /dev/null
+++ b/app/Models/PartnerEndorsementRequestModel.php
@@ -0,0 +1,40 @@
+db->table('partner_policy as pp')
+ ->select('
+ pp.id,
+ pp.id as partner_policy_id,
+ pp.enquiry_id,
+ pp.insured_name,
+ pp.policy_number,
+ pp.agent_id,
+ pp.manager_id,
+ pp.client_id,
+ pp.client_policy_id,
+ pp.is_active as partner_policy_is_active,
+ pe.insurer_id,
+ pe.is_active as partner_enquiry_is_active,
+ i.name as insurer_name,
+ i.short_name as insurer_short_name,
+ i.is_active as insurer_is_active
+ ')
+ ->join('partner_enquiry as pe', 'pe.id = pp.enquiry_id', 'left')
+ ->join('insurers as i', 'i.id = pe.insurer_id', 'left')
+ ->where('pp.is_active', 1)
+ ->get()
+ ->getResultArray();
+ }
+ // $data['partner_policy_list'] = $this->partnerPolicyModel
+ // ->where('is_active', 1)
+ // ->findAll();
}
diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php
index ab733a4b..3027fe5e 100644
--- a/app/Models/TicketMasterModel.php
+++ b/app/Models/TicketMasterModel.php
@@ -79,7 +79,10 @@ class TicketMasterModel extends Model
'approved_description',
'file_id',
'denial_letter',
-
+
+ 'manager_id',
+ 'agent_id' ,
+ 'vehicle_id',
];
@@ -788,13 +791,19 @@ class TicketMasterModel extends Model
}
//api
- public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null)
+ public function get_ticket_data($emp_id, $returnType,$ticket_type = null, $ticket_id = null)
{
$query = $this->select('ticket_master.*, tms.mail_subject as subject')
->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left')
- ->where('ticket_master.is_active', 1)
- ->where('tms.sender', "user")
- ->where('ticket_master.emp_id', $emp_id);
+ ->where('ticket_master.is_active', 1);
+
+ if($returnType == 'api'){
+ $query->whereIn('sender', ['staff', 'user']);
+ }else{
+ $query->where('tms.sender', "user");
+ }
+
+ $query->where('ticket_master.emp_id', $emp_id);
if (!empty($ticket_id)) {
$query->where('ticket_master.id', $ticket_id);
@@ -805,7 +814,8 @@ class TicketMasterModel extends Model
}
$data = $query->findAll();
- // dd($data, db_connect()->getLastQuery());
+ // dd($data, db_connect()->getLastQuery());
+ // print_r($this->db->getLastQuery());die;
return $data;
}
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
diff --git a/app/Views/insurer_branch.php b/app/Views/insurer_branch.php
index f2206cfa..da147629 100755
--- a/app/Views/insurer_branch.php
+++ b/app/Views/insurer_branch.php
@@ -14,17 +14,17 @@
+
+
| Name | : | {NAME} |
| Gender | : | {GENDER} |
| D.O.B | : | {DOB} |
| Relationship | : | {RELATION} |
| Policy No | : | {POLICY_NO} |
| TPA/UHID | : | {TPA_ID} |
| Policy Start | : | {POLICY_START_DATE} |
| Policy End | : | {POLICY_DATE} |
| Insurer | : | {INSURER_NAME} |
| TPA | : | {TPA_NAME} |