From 7faf391ad16ef792a490bc6a4531f46b9f084305 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 8 Aug 2025 15:46:00 +0530 Subject: [PATCH 1/5] FIX_THE LIVE_ISSUE : RV --- app/Controllers/LeadsController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 178b5599..775b6f91 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -121,6 +121,7 @@ class LeadsController extends BaseController ]; $this->claim_type_for_gpa = [ + 'nil' => 'Nil', 'accident_death' => 'Accident Death', 'permanent_total_disablement' => 'Permanent Total Disablement', 'permanent_partial_disablement' => 'Permanent Partial Disablement', From 2fde346d366d70727616047b3f20b8a056b50a18 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 8 Aug 2025 17:26:48 +0530 Subject: [PATCH 2/5] CHANGE_GPA_CLAIM_HISTORY_IN_EXCEL : RV --- app/Controllers/LeadsController.php | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 775b6f91..b1db3311 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -1824,6 +1824,72 @@ class LeadsController extends BaseController $filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '_' . '.xlsx'; } + //claim history new sheet; + if (!empty($rfq_data['fin_years_claims'])) { + + $claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? []; + + if (!empty($claim_details['finyear'])) { + + // Get headers dynamically + $headers = array_map(function ($key) { + return ucwords(str_replace('_', ' ', $key)); + }, array_keys($claim_details['finyear'][0])); + + $newSheet = new Worksheet($spreadsheet, 'Claims Experience'); + $spreadsheet->addSheet($newSheet); + $spreadsheet->setActiveSheetIndexByName('Claims Experience'); + $sheet = $spreadsheet->getActiveSheet(); + + // Set headers + $sheet->fromArray($headers, NULL, 'A1'); + + // Apply background color and bold style to headers + $headerCellRange = 'A1:' . chr(64 + count($headers)) . '1'; // e.g., A1:G1 + + $sheet->getStyle($headerCellRange)->getFont()->setBold(true); + $sheet->getStyle($headerCellRange)->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('ADD8E6'); + + // Add border to header + $sheet->getStyle($headerCellRange)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN); + + // Fill data and apply borders + $row = 2; + foreach ($claim_details['finyear'] as $record) { + $col = 'A'; + foreach ($record as $value) { + $label = ucwords(str_replace('_', ' ', ($value ?? ""))); + $sheet->setCellValue($col . $row, $label); + $col++; + } + + // Apply border to each data row + $sheet->getStyle('A' . $row . ':' . chr(64 + count($headers)) . $row) + ->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN); + + $row++; + } + // Auto-size all columns based on header count + for ($i = 0; $i < count($headers); $i++) { + $colLetter = chr(65 + $i); // 'A', 'B', etc. + $sheet->getColumnDimension($colLetter)->setAutoSize(true); + } + + // Enable wrap text for all cells + $maxColLetter = chr(64 + count($headers)); // Last column letter + $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true); + + // Optional: center vertically for neatness + $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER); + + // Optional: Make row height auto (helps when wrap text is on) + for ($i = 2; $i < $row; $i++) { + $sheet->getRowDimension($i)->setRowHeight(-1); + } + + } + } + // Save to temporary location $uploadFilePath = WRITEPATH . 'tmp/' . $filename; $writer = new Xlsx($spreadsheet); From 3a1e3752b13eeea0fa3d2ccdce771a8734e6f561 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 8 Aug 2025 18:05:39 +0530 Subject: [PATCH 3/5] FEAT_INTRO_CHAT&GEMINI --- app/Config/Routes.php | 1 + app/Controllers/Home.php | 28 +++++++++++++ app/Controllers/ICICILombardController.php | 22 +++++++---- app/Libraries/Gemini.php | 46 ++++++++++++++++++++++ app/Views/chatbot.php | 44 +++++++++++++++++---- 5 files changed, 125 insertions(+), 16 deletions(-) create mode 100644 app/Libraries/Gemini.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index d35f2951..ac723e59 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -46,6 +46,7 @@ $routes->get("frontend_content", "AppContentManagementController::frontend_conte // $routes->get('/', 'LoginController::index'); $routes->get('/test', 'Home::index'); +$routes->get('/check_gemini', 'Home::check_Gemini'); $routes->get('/login', 'LoginController::index'); ///auth/google $routes->get('/loginPos', 'LoginController::loginPos'); //login POS team $routes->post('/getVerifyPosMobileNo', 'LoginController::getVerifyPosMobileNo'); //Verify POS team mobile no diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 9f76bf77..09d3dc19 100755 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -2,6 +2,12 @@ namespace App\Controllers; + +use GeminiAPI\Client; +use GeminiAPI\Resources\ModelName; +use GeminiAPI\Resources\Parts\TextPart; + + class Home extends PublicController { public function index(): string @@ -28,4 +34,26 @@ class Home extends PublicController return $payload['a'] + $payload['b']; } + public function check_Gemini() + { + try { + $apiKey = 'AIzaSyBbx-uotRBqkYhqLpmD60420E_a0G0duP8'; + // Initialize the Gemini client + $client = new Client($apiKey); + + // Send a prompt to the Gemini Pro model + $response = $client->generativeModel(ModelName::GEMINI_PRO)->generateContent( + new TextPart('Write a short, creative story about a knight and a dragon.') + ); + + // Display the generated text + $data['gemini_response'] = $response->text(); + } catch (\Exception $e) { + // Handle any errors that occur during the API call + $data['gemini_response'] = 'An error occurred: ' . $e->getMessage(); + } + + print_rr($data); + } + } diff --git a/app/Controllers/ICICILombardController.php b/app/Controllers/ICICILombardController.php index e1c09e30..9433f7f1 100644 --- a/app/Controllers/ICICILombardController.php +++ b/app/Controllers/ICICILombardController.php @@ -62,9 +62,15 @@ class ICICILombardController extends AdminController //'Scope: esbgpabatchcreation' ]; + #old policy info start + #"PolicyNumber" => "4016/A/51974976/00/000", + # "CDBGAccountNumber" => "CD-MUM-3344", + #"CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f", + #old policy inf end + $body = [ - "PolicyNumber" => "4016/A/51974976/00/000", - "CDBGAccountNumber" => "CD-MUM-3344", + "PolicyNumber" => "4016/A/O/53077718/00/000", + "CDBGAccountNumber" => "CD-MUM-0026", "CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f", "MemberDetails" => [ [ @@ -74,8 +80,8 @@ class ICICILombardController extends AdminController "DOB" => "7-JUL-1983", "Relationship" => "SELF", "Gender" => "MALE", - "DOC" => "20-JAN-2020", - "SumInsured" => "600000", + "DOC" => "08-JUL-2025", + "SumInsured" => "400000", "EmailId" => "ABC@GMAIL.COM", "FlagStatus" => "A" ], @@ -86,8 +92,8 @@ class ICICILombardController extends AdminController "DOB" => "8-AUG-1970", "Relationship" => "MOTHER", "Gender" => "FEMALE", - "DOC" => "20-JAN-2020", - "SumInsured" => "600000", + "DOC" => "08-JUL-2025", + "SumInsured" => "400000", "EmailId" => "ABC@GMAIL.COM", "FlagStatus" => "A" ], @@ -97,13 +103,13 @@ class ICICILombardController extends AdminController "InsuredName" => "ABC28142", "DOB" => "8-SEP-1970", "Gender" => "MALE", - "SumInsured" => "600000", + "SumInsured" => "400000", "EmailId" => "ABC@GMAIL.COM", "FlagStatus" => "M" ], [ "UHID" => "IL00688842552", - "DOL" => "20-JAN-2020", + "DOL" => "08-JUL-2025", "FlagStatus" => "D" ] ] diff --git a/app/Libraries/Gemini.php b/app/Libraries/Gemini.php new file mode 100644 index 00000000..da610e96 --- /dev/null +++ b/app/Libraries/Gemini.php @@ -0,0 +1,46 @@ +myLogger = \Config\Services::mylogger(); + // $this->client = new Google_Client(); + // $this->client->setAuthConfig(ROOTPATH . 'nhance-app-google-drive.json'); // App credentials + // // putenv('GOOGLE_APPLICATION_CREDENTIALS=' . ROOTPATH . 'nhance-app-google-drive.json'); + // $this->client->useApplicationDefaultCredentials(); + + // $this->client->addScope(Google_Service_Drive::DRIVE); // Full access to Google Drive + } + + public function check() + { + try { + // Initialize the Gemini client + $client = new Client($apiKey); + + // Send a prompt to the Gemini Pro model + $response = $client->generativeModel(ModelName::GEMINI_PRO)->generateContent( + new TextPart('Write a short, creative story about a knight and a dragon.') + ); + + // Display the generated text + $data['gemini_response'] = $response->text(); + } catch (\Exception $e) { + // Handle any errors that occur during the API call + $data['gemini_response'] = 'An error occurred: ' . $e->getMessage(); + } + } + +} diff --git a/app/Views/chatbot.php b/app/Views/chatbot.php index 5fd18fae..b6e09688 100644 --- a/app/Views/chatbot.php +++ b/app/Views/chatbot.php @@ -6,12 +6,40 @@ Insurance ChatBot + + -

Loading...Please wait

+

Loading...

- + + +
+
+ + Loading... + +
+
+ + + + + + \ No newline at end of file