Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-04-05 10:09:08 +05:30
commit 69636e27af
19 changed files with 1324 additions and 31 deletions

View File

@ -52,6 +52,10 @@ $routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyS
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
$routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1');
$routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2");
$routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1");
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "UserController::create");
@ -534,6 +538,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
//New Tickets
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
$routes->get('feedback-list','TicketController::feedbackList');
$routes->get('new/(:any)','TicketController::ticket_form/$1');
$routes->post('create','TicketController::createTicket');
$routes->post('update','TicketController::updateTicket');

View File

@ -17,6 +17,8 @@ class EcardDownloadConversation extends Conversation
protected function showEcardMenu()
{
log_message('error', ('showEcardMenu function called'));
$chat_session_info = get_chatbot_session_info();
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
$buttons = [];

View File

@ -46,9 +46,14 @@ class MainMenuConversation extends Conversation
$this->bot->reply($message);
}
log_message('error', ('user_reponse before: ' . $user_reponse));
if (!$answer->isInteractiveMessageReply()) {
$user_reponse = null;
}
// Get just the existing path array
$path = $this->bot->userStorage()->get('path') ?? [];
@ -60,6 +65,9 @@ class MainMenuConversation extends Conversation
'path' => $path
]);
log_message('error', ('user_reponse : ' . $user_reponse));
switch ($user_reponse) {
case "ecard_download":

View File

@ -59,7 +59,10 @@ class NetworkHospitalConversation extends Conversation
$this->bot->userStorage()->save([
'path' => $path
]);
log_message('error', ('user_reponse : ' . $answer->getValue()));
switch ($answer->getValue()) {
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
$client_poilicy_id = explode('#',$answer->getValue())[1];

View File

@ -46,6 +46,9 @@ class policyConversation extends Conversation
if (!$answer->isInteractiveMessageReply()) {
$user_reponse = null;
}
log_message('error', ('user_reponse : ' . $answer->getValue()));
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()

View File

@ -89,7 +89,7 @@ class ChatbotControllerNew extends BaseController
$user = $this->botman->getUser();
$id = $user->getId();
// $this->myLogger->logme('error', ('TEST' . $id));
$this->myLogger->logme('error', ('TEST' . $id));
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
}
@ -128,14 +128,14 @@ class ChatbotControllerNew extends BaseController
$this->botman->listen();
}
private function registerHandlers()
{
// Handling Policy and Claims
$this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
$this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
// private function registerHandlers()
// {
// // Handling Policy and Claims
// $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
// $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
}
// }
public function chatbot()
{

View File

@ -3112,6 +3112,8 @@ class EmployeeRestController extends AdminController
}
// ---------------- TICKET API's ---------------------------------------------------------------------------------------------------
//Get Data from post for inserting ticket and message
public function initiateClaim()
{
@ -3171,22 +3173,27 @@ class EmployeeRestController extends AdminController
->first()['id'];
$fetchData['priority'] = 1;
$fetchData['mode_of_intimation'] = 1;
$fetchData['mode_of_intimation'] = 3;
$fetchData['claim_type'] = 1;
$fetchData = array_merge($fetchData, $received_data);
$fetchData['relationship'] = strtolower($fetchData['relationship']) ?? $fetchData['relationship'];
// print_r($fetchData); die;
$insert_status = $this->ticketMaster->insert($fetchData);
$ticket_id = $this->ticketMaster->insertID();
if ($insert_status && !empty($ticket_id)) {
//insert first history
$this->ticketController->putHistoryAfterInsert($fetchData, $ticket_id);
$messagesData = [
'ticket_id' => $ticket_id ?? null,
'sender' => 'user',
'claim_status' => $fetchData['claim_status_id'] ?? null,
'emp_mail' => $fetchData['emp_mail'] ?? null,
'mail_subject' => $fetchData['subject'] ?? null,
'mail_content' => $fetchData['message'] ?? null,
'mail_subject' => $fetchData['subject'] ?? "New Claim",
'mail_content' => $fetchData['message'] ?? "New Claim",
];
if (!empty($messagesData['ticket_id'])) {

View File

@ -1891,7 +1891,7 @@ class LeadsController extends BaseController
['file_path' => $temp_file_path, 'sheets' => []],
['file_path' => $lead_file_path, 'sheets' => []]
];
$outputPath = dirname($temp_file_path) . '/' . 'merged_' . $temp_file_name;
$outputPath = dirname($temp_file_path) . '/' . $temp_file_name;
$result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
// print_rr($result);
}

View File

@ -120,6 +120,8 @@ class TicketController extends BaseController
'((POLICY_TYPE))' => 'policy_type',
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
'((CLAIM_FORM_LINK))' => 'claim_form_link',
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
'((SETTLED_LETTER))' => 'settle_letter',
];
$this->extraFields = [
1 => ['non_id_reason'],
@ -232,7 +234,9 @@ class TicketController extends BaseController
'tcs.claim_status AS status',
'tm.claim_number AS claim_no',
'tm.tpa_id',
'tm.tpa_no',
'tm.emp_name',
'tm.emp_code',
'i.name AS insurer_name',
'c.client_name',
'tm.insured_name',
@ -272,7 +276,9 @@ class TicketController extends BaseController
'tm.claim_status_id',
'tm.is_head_approved',
'tm.tpa_id',
'tm.tpa_no',
'tm.emp_name',
'tm.emp_code',
'i.name AS insurer_name',
'c.client_name',
'tm.insured_name',
@ -456,7 +462,18 @@ class TicketController extends BaseController
$data['placeHolders'] = $this->placeHolders;
$data['message_data'] = $this->getTicketMessage($ticket_id);
$data['view_ticket_page'] = [];
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
if($ticket_data['ticket_type_id'] == 1){
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
}else{
$data['member_data'] = array_filter(
$this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']),
function ($member) {
return isset($member['emp_relationship']) && $member['emp_relationship'] == 'Self';
}
);
}
$data['ticket_history'] = $this->ticketHistory($ticket_id);
$data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray();
if (!empty($ticket_data['client_policy_id'])){
@ -578,7 +595,9 @@ class TicketController extends BaseController
$return_value = $this->ticketMasterModel->insert($ticket_data);
if ($return_value) {
//mail trigger part
$this->putHistoryAfterInsert($ticket_data, $return_value);
$mail_responce = $this->sendAutoMailTrigger($return_value);
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $return_value);
return $this->respond(['status' => true, 'ticket_id' => $return_value, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
@ -601,8 +620,12 @@ class TicketController extends BaseController
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
if ($return_value) {
//mail trigger part
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
$mail_responce = null;
if($old_ticket_data['claim_status_id'] != $ticket_data['claim_status_id']){
//mail trigger part
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $ticket_id);
}
//send mail to the head for rejected ticket approvel
if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){
@ -837,7 +860,7 @@ class TicketController extends BaseController
}
// Construct Mail Data
$mailData = [
$mailData[] = [
'mail' => $ticket_data['emp_mail'],
'subject' => $subject,
'message' => $message,
@ -845,6 +868,17 @@ class TicketController extends BaseController
'attachments' => []
];
// if the employee personal mail is not empty then send the mail to the employee personal mail
if(!empty($ticket_data['emp_personal_mail'])){
$mailData[] = [
'mail' => $ticket_data['emp_personal_mail'],
'subject' => $subject,
'message' => $message,
'cc' => $ticket_data['common_mails'] ?? '',
'attachments' => []
];
}
// print_r($mailData); die;
$this->myLogger->logme('error', "Final Email Data");
@ -869,6 +903,10 @@ class TicketController extends BaseController
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
} else if ($value == "claim_form_link"){
$replaceData = '<a href="' . base_url('claim-form-download/' . md5($ticket_data['insurer_id'])) . '" target="_blank">Click here to download Claim Form</a>';
} else if ($value == "claim_feedback_form" && $ticket_data['ticket_type_id'] == 1){
$replaceData = '<a href="' . base_url('claims-feedback-form/' . md5($ticket_data['id'])) . '" target="_blank">Click to open Claim Feedback Form</a>';
} else if ($value == "settle_letter"){
$replaceData = '<a href="' . $ticket_data['settle_letter'] . '" target="_blank"> View Settlement Letter </a>';
}else {
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
}
@ -927,6 +965,27 @@ class TicketController extends BaseController
$this->myLogger->logme('error', "Fetched ACM emails");
if(!empty($ticket_data['emp_personal_mail'])){
$this->myLogger->logme('error', "Send employee personal mail start");
$emailPersonalData = [
'mail' => $ticket_data['emp_personal_mail'],
'subject' => $mail_data['mail_subject'],
'message' => $mail_data['mail_content'],
'common' => [],
'cc' => $acm_mails['common_mails'],
'attachments' => []
];
$this->sendTrigger($emailPersonalData);
$this->myLogger->logme('error', "Send employee personal mail successfully");
}else{
$this->myLogger->logme('error', "Send employee personal mail is empty");
}
$emailData = [
'mail' => $mail_data['emp_mail'],
'subject' => $mail_data['mail_subject'],
@ -950,7 +1009,10 @@ class TicketController extends BaseController
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
$mail_content = $this->constructMailContent($ticket_id);
// print_r($mail_content); die;
$mail_responce = $this->sendTrigger($mail_content);
foreach ($mail_content as $key => $value) {
$mail_responce = $this->sendTrigger($value);
$this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
}
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
} else {
@ -1371,7 +1433,8 @@ class TicketController extends BaseController
}
}
public function getPoliciesbyEmpID() {
public function getPoliciesbyEmpID()
{
$received_data = $this->request->getPost();
$emp_id = $received_data['emp_id'];
@ -1443,5 +1506,121 @@ class TicketController extends BaseController
return $this->response->setStatusCode(500)->setBody('An error occurred while downloading the file.');
}
}
// -------------------------------------------------------------------------------------------------------------------------
public function autoMessageInsertBasedOnMailResponse($mail_sent_status, $ticket_id)
{
if (gettype($mail_sent_status) == 'array') {
$this->myLogger->logme('error', "auto Message Insert Based On Mail Response Failed because is array :$ticket_id ");
} else {
$mail_sent_status = json_decode($mail_sent_status);
$this->myLogger->logme('error', "mail_sent_status is object :$ticket_id ");
}
if (!empty($mail_sent_status) && isset($mail_sent_status->status) && $mail_sent_status->status == 'success') {
$sent_message_data['ticket_id'] = $ticket_id;
$sent_message_data['sender'] = 'staff';
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
$message_insert_status = $this->ticketMessageModel->insert($sent_message_data);
if ($message_insert_status) {
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, successfully store message:$ticket_id ");
} else {
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
}
return true;
} else {
$this->myLogger->logme('error', "Failed to send Mail :$ticket_id ");
return true;
}
}
public function putHistoryAfterInsert($ticket_data, $ticket_id)
{
$this->myLogger->logme('error', "Put History After Insert function called : $ticket_id");
if(!empty($ticket_data)){
$history_data = [
'ticket_id' => $ticket_id,
'field_name' => 'claim_status_id',
'display_name' => 'Ticket Created',
'old_value' => null,
'new_value' => $ticket_data['claim_status_id'],
'created_by' => get_session_userid(),
'is_active' => 1
];
$this->myLogger->logme('error', "Put History After Insert function called : " . json_encode($history_data));
$history_insert = $this->ticketHistoryModel->insert($history_data);
if($history_insert){
$this->myLogger->logme('error', "Put History After Insert Ticket Data Successfully");
}else{
$this->myLogger->logme('error', "Put History After Insert Ticket Data Failed");
}
}else{
$this->myLogger->logme('error', "Put History After Insert Ticket Data is empty");
}
return true;
}
public function viewClaimFeedbackForm($md5_ticket_id,$empView = null)
{
if ($this->request->is("get")){
$data['ticket_id'] = $md5_ticket_id;
$data['ticket_data'] = $this->ticketMasterModel->select('ticket_master.*,clients.client_name')->join('clients','clients.id = ticket_master.client_id')->where('MD5(ticket_master.id)',$md5_ticket_id)->where('ticket_master.is_active',1)->first();
$data['form_submitted'] = !empty($data['ticket_data']['feedback_json'])? 1 : 0;
$data['viewer'] = !empty($empView) ? $empView : 0;
// dd($data);
return view('ticket_feedback_form', $data);
}else{
$formDataJson = json_encode($this->request->getPost());
// log_message("error","Form data : ".$formDataJson);
$data_to_store = [
'feedback_json' => $formDataJson
];
if (!empty($formDataJson)){
// $this->ticketMasterModel->save($data_to_store);
$this->ticketMasterModel->where('MD5(id)', $md5_ticket_id)->set($data_to_store)->update();
return $this->respond(['status' => true,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200);
}else{
return $this->respond(['status' => false,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200);
}
}
}
public function feedbackList(){
$data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll();
// dd($data);
$this->loadLayout("ticket_feedback_list",$data);
}
}

View File

@ -17,10 +17,13 @@ class ExcelMergeHelper {
{
try {
log_message('debug', 'Attempting merge with original file order');
// echo "Attempting merge with original file order\n";
return self::processFiles($filePaths, $outputPath);
} catch (Exception $e) {
log_message('error', 'First attempt failed: ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
// echo "First attempt failed: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
log_message('debug', 'Retrying with reversed file order');
// echo "Retrying with reversed file order\n";
// Reverse the file order and try again
$reversedFiles = array_reverse($filePaths);
@ -29,6 +32,7 @@ class ExcelMergeHelper {
return self::processFiles($reversedFiles, $outputPath);
} catch (Exception $e2) {
log_message('error', 'Both attempts failed. Last error: ' . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine());
// echo "Both attempts failed. Last error: " . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine() . "\n";
return null;
}
}
@ -45,7 +49,9 @@ class ExcelMergeHelper {
private static function processFiles(array $filePaths, string $outputPath): string
{
log_message('debug', 'Starting Excel merge process');
// echo "Starting Excel merge process\n";
log_message('debug', 'Files to process: ' . json_encode($filePaths));
// echo "Files to process: " . json_encode($filePaths) . "\n";
if (empty($filePaths)) {
throw new Exception("No files provided to merge");
@ -66,6 +72,7 @@ class ExcelMergeHelper {
// Save the merged file
log_message('debug', "Saving merged file to: {$outputPath}");
// echo "Saving merged file to: {$outputPath}\n";
$writer = IOFactory::createWriter($mergedSpreadsheet, 'Xlsx');
$writer->setPreCalculateFormulas(false);
$writer->save($outputPath);
@ -76,6 +83,7 @@ class ExcelMergeHelper {
gc_collect_cycles();
log_message('debug', 'Excel merge process completed successfully');
// echo "Excel merge process completed successfully\n";
return $outputPath;
}
@ -87,15 +95,17 @@ class ExcelMergeHelper {
* @param int|null $index
* @throws Exception
*/
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, int $index = null)
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, ?int $index = null)
{
if (!isset($fileInfo['file_path']) || !file_exists($fileInfo['file_path'])) {
$path = $fileInfo['file_path'] ?? 'undefined';
log_message('error', "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}");
// echo "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}\n";
return;
}
log_message('debug', "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path']);
// echo "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path'] . "\n";
try {
// Load the source spreadsheet
@ -105,6 +115,7 @@ class ExcelMergeHelper {
$worksheets = $sourceSpreadsheet->getAllSheets();
$totalSheets = count($worksheets);
log_message('debug', "Total sheets in file: " . $totalSheets);
// echo "Total sheets in file: " . $totalSheets . "\n";
$sheetsToMerge = $fileInfo['sheets'] ?? [];
@ -114,26 +125,30 @@ class ExcelMergeHelper {
try {
$sheetName = $worksheet->getTitle();
log_message('debug', "Processing sheet: {$sheetName}");
// echo "Processing sheet: {$sheetName}\n";
// Generate unique sheet name before cloning
$newName = $sheetName;
$counter = 1;
while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
$newName = $sheetName . "_" . $counter++;
// $newName = $sheetName . "_" . $counter++;
log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
// echo "Sheet name already exists. Trying new name: {$newName}\n";
}
// Clone the worksheet and set the new name
$clonedSheet = clone $worksheet;
$clonedSheet->setTitle($newName);
// $clonedSheet = clone $worksheet;
// $clonedSheet->setTitle($newName);
// Add as external sheet
$mergedSpreadsheet->addExternalSheet($clonedSheet);
$mergedSpreadsheet->addExternalSheet($worksheet);
log_message('debug', "Successfully added sheet: {$newName}");
// echo "Successfully added sheet: {$newName}\n";
} catch (Exception $e) {
log_message('error', "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
// echo "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
}
}
}
@ -145,6 +160,7 @@ class ExcelMergeHelper {
} catch (Exception $e) {
log_message('error', "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
// echo "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
}
}
}

View File

@ -12,7 +12,7 @@ class TicketHistoryModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['id','field_name','display_name','old_value',
protected $allowedFields = ['id', "ticket_id", 'field_name','display_name','old_value',
'new_value','created_by','created_at','updated_by','updated_at','is_active'];
// Callbacks

View File

@ -15,6 +15,7 @@ class TicketMasterModel extends Model
protected $allowedFields = [
'id',
'ticket_type_id',
'feedback_json',
'claim_status_id',
'acm_id',
'insurer_id',

View File

@ -81,6 +81,13 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<!-- srinivas -->
<script src="https://editor.unlayer.com/embed.js"></script>
<!-- MD5 Hash Start -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
<!-- MD5 Hash End -->
<!-- <script src="<?= base_url('public/unlayer/js/embed.js') . '' ?>"></script> -->
<!-- srinivas -->
<style>
@ -668,6 +675,9 @@
<li>
<a href="<?= base_url('/ticket/ticket_reports') ?>">Claim Reports</a>
</li>
<li>
<a href="<?= base_url('/ticket/feedback-list') ?>">Claim Feedback List</a>
</li>
</ul>
</div>
</li>

View File

@ -1062,7 +1062,7 @@
console.log('incurredClaimDate', incurredClaimDate)
if (policyStartDate && incurredClaimDate) {
var timeDiff = incurredClaimDate - policyStartDate; // Time difference in milliseconds
var timeDiff = (policyStartDate - incurredClaimDate) + 1; // Time difference in milliseconds
console.log('timeDiff', timeDiff);
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); // Convert to days and add 1
console.log('daysDiff', daysDiff);
@ -1143,6 +1143,69 @@
$('#earned_premium_' + increment).val(earned_premium_roundoff);
}
$(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() {
calculateTotalLives(this);
});
function calculateTotalLives(input) {
var lead_type = $('#lead_type').val();
if (lead_type == 1) {
let formRow = input.closest('.form-row');
if (formRow) {
// Get the employee count and dependent count within the same row
let empCountInput = formRow.querySelector('[name="incept_emp_count[]"]');
let depCountInput = formRow.querySelector('[name="incept_dept_count[]"]');
let totalLivesInput = formRow.querySelector('[name="incept_no_of_lives[]"]');
// Parse the input values as integers, defaulting to 0 if empty
let empCount = empCountInput ? parseInt(empCountInput.value) || 0 : 0;
let depCount = depCountInput ? parseInt(depCountInput.value) || 0 : 0;
// Calculate total lives
let totalLives = empCount + depCount;
// Set the total lives input value
if (totalLivesInput) {
totalLivesInput.value = totalLives;
}
}
} else {
console.log("Function Called");
if (input.id === "incept_emp_count" || input.id === "incept_dept_count") {
var incept_emp_count = parseInt($("#incept_emp_count").val()) || 0;
var incept_dept_count = parseInt($("#incept_dept_count").val()) || 0;
var totalCount = incept_emp_count + incept_dept_count;
$("#incept_no_of_lives").val(totalCount);
} else if (input.id === "renewal_emp_count" || input.id === "renewal_dept_count") {
var renewal_emp_count = parseInt($("#renewal_emp_count").val()) || 0;
var renewal_dept_count = parseInt($("#renewal_dept_count").val()) || 0;
var totalCount = renewal_emp_count + renewal_dept_count;
$("#renewal_no_of_lives").val(totalCount);
} else {
var exp_emp_count = parseInt($("#exp_emp_count").val()) || 0;
var exp_dept_count = parseInt($("#exp_dept_count").val()) || 0;
var totalCount = exp_emp_count + exp_dept_count;
$("#exp_no_of_lives").val(totalCount);
}
}
}
//------------------------ FORM SUBMIT ---------------------------------------------------------------------------------
$("#leads_form_id").submit(function(event) {

View File

@ -116,14 +116,14 @@
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]"
placeholder="Enter Lives" required>
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
</div>
<div class="form-group col-md-3">
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_dept_count']) ? $lead_edit_data['incept_dept_count'] : '' ?>" type="text" class="form-control" id="incept_dept_count" name="incept_dept_count[]"
placeholder="Enter Lives" required>
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
</div>
<div class="form-group col-md-3">

View File

@ -0,0 +1,837 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg">
<title>Nhance Experience Form</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/parsleyjs@2.9.2/dist/parsley.min.js"></script>
<style>
.navbar-custom {
top: -10px !important;
height: 61px !important;
/* background-color: #02a8b5;
*/
background-color: #02a8b5;
}
.logo-box {
top: -10px !important;
height: 50px !important;
}
body {
background-color: #f0f0f0;
font-family: 'Roboto', sans-serif;
}
.nhance-form-card {
max-width: 740px;
margin: 32px auto;
background: #fff;
border-radius: 30px;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
padding: 32px 24px;
}
.nhance-form-card-details {
max-width: 740px;
margin: 20px auto;
/* Reduced vertical margin */
background: #fff;
border-radius: 20px;
/* Slightly smaller radius */
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
padding: 20px 16px;
/* Reduced padding */
}
/* Adjust form group spacing */
.nhance-form-card-details .form-group {
margin-bottom: 12px;
/* Reduced spacing between rows */
}
/* Compact label styling */
.nhance-form-card-details label {
font-size: 14px;
/* Smaller font size */
margin-bottom: 0;
}
/* Compact input styling */
.nhance-form-card-details .form-control-plaintext {
font-size: 14px;
/* Smaller font size */
padding-top: 4px !important;
padding-bottom: 4px !important;
}
/* Adjust grid columns spacing */
.nhance-form-card-details .col-md-4 {
padding-right: 8px;
}
.nhance-form-card-details .col-md-8 {
padding-left: 8px;
}
.nhance-form-header {
font-size: 32px;
font-weight: 400;
color: #202124;
margin-bottom: 8px;
}
.nhance-form-subtitle {
font-size: 14px;
color: #5f6368;
margin-bottom: 24px;
}
.divider {
border-top: 1px solid #dadce0;
margin: 24px 0;
}
.form-group {
margin-bottom: 24px;
}
label {
font-size: 16px;
font-weight: 400;
color: #202124;
display: block;
}
.form-control {
height: 48px;
border: 1px solid #dadce0;
border-radius: 4px;
padding: 12px 14px;
font-size: 14px;
color: #202124;
transition: border-color 0.2s;
}
.form-control:focus {
border-color: #1a73e8;
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
outline: none;
}
textarea.form-control {
height: auto;
min-height: 100px;
resize: vertical;
}
.required-asterisk {
color: #d93025;
margin-left: 4px;
}
.btn-nhance {
background-color: #1a73e8;
color: white;
border-radius: 4px;
padding: 12px 24px;
border: none;
font-size: 14px;
font-weight: 500;
letter-spacing: 0.25px;
text-transform: uppercase;
transition: background-color 0.2s, box-shadow 0.2s;
}
.btn-nhance:hover {
background-color: #1557b0;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.half-framed-textbox {
position: relative;
margin: 20px 0;
}
.border-animation {
position: absolute;
bottom: -2px;
/* Align with input bottom */
height: 2px;
background: #6200ea;
width: 0;
transition: width 0.3s ease;
}
.col-md-9 {
position: relative;
/* Contain the animation within the input column */
}
.half-framed-textbox input {
width: 100%;
padding: 8px;
font-size: 16px;
outline: none;
background: transparent;
position: relative;
text-align: left !important;
height: auto !important;
/* padding-left: 0 !important; */
/* padding-bottom: 0 !important; */
}
.half-framed-textbox .form-control {
border: none !important;
border-bottom: 2px solid #dadce0 !important;
box-shadow: none !important;
text-align: left !important;
height: auto !important;
height: auto !important;
padding-top: 18px !important;
padding-bottom: 0px !important;
line-height: 1.5 !important;
margin-bottom: 21px;
/* padding-left: 0 !important; */
/* padding-bottom: 0 !important; */
}
.form-control {
height: auto !important;
min-height: 48px;
}
.navbar-custom {
position: fixed;
top: 0;
width: 100%;
height: 61px;
background-color: #02a8b5;
display: flex;
align-items: center;
/* Center vertically */
justify-content: space-between;
/* Align logo and header properly */
padding: 0 20px;
/* Add some spacing */
z-index: 1000;
/* Ensure it stays above other content */
}
.logo-box img {
margin-top: auto;
height: 35px;
}
main {
flex: 1;
}
.feedback-header {
flex-grow: 1;
/* Allow it to take remaining space */
text-align: center;
font-size: 18px;
font-weight: bold;
color: white;
font-size: 32px;
font-weight: 400;
margin-top: auto;
font-family: 'sans-serif', serif;
}
</style>
<style>
.swal-modal {
background-color: white;
width: 80%;
max-width: 400px;
padding: 30px;
border-radius: 10px;
text-align: center;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}
.swal-title {
color: #595959;
font-size: 24px;
margin: 0 0 10px 0;
}
.swal-text {
color: #545454;
font-size: 16px;
margin: 15px 0;
}
.swal-icon {
width: 80px;
height: 80px;
border-radius: 50%;
margin: 0 auto 20px;
background-color: #a5dc86;
display: flex;
align-items: center;
justify-content: center;
animation: scaleIn 0.4s ease-out;
}
.swal-icon::after {
content: '';
display: block;
width: 30px;
height: 50px;
border: solid white;
border-width: 0 4px 4px 0;
transform: rotate(45deg);
margin-top: -8px;
}
@keyframes scaleIn {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
@media (max-width: 480px) {
.swal-modal {
width: 90%;
padding: 20px;
}
}
</style>
<!-- Style for Loader -->
<style>
.loader-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #00000069;
z-index: 99999;
}
.loader {
position: absolute;
left: 50%;
top: 50%;
width: 50px;
height: 50px;
font-size: 0;
color: #00c9d0;
display: inline-block;
margin: -25px 0 0 -25px;
text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
.loader div {
background-color: #6ad9cf;
display: inline-block;
float: none;
position: absolute;
top: 0;
left: 0;
width: 50px;
height: 50px;
opacity: .5;
border-radius: 50%;
-webkit-animation: ballPulseDouble 2s ease-in-out infinite;
animation: ballPulseDouble 2s ease-in-out infinite;
}
.loader div:last-child {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
</style>
<style>
.parsley-required{
color: red !important;
}
.swal-icon-error {
background-color: #f27474;
}
.swal-icon-error::before,
.swal-icon-error::after {
content: '';
position: absolute;
width: 40px;
height: 4px;
background-color: white;
}
.swal-icon-error::before {
transform: rotate(45deg);
}
.swal-icon-error::after {
transform: rotate(-45deg);
}
.swal-button-error {
background-color: #dc3545;
}
.swal-button-error:hover {
background-color: #bb2d3b;
}
</style>
</head>
<body>
<!-- Topbar Start -->
<div class="navbar-custom">
<div class="logo-box d-flex align-items-center">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="Logo">
</div>
<div class="feedback-header">
Nhance Experience Form
</div>
</div>
<!-- end Topbar -->
<input type="hidden" id="ticket_id" value="<?= $ticket_id ?>">
<input type="hidden" id="login_type" value="<?= $viewer ?>">
<input type="hidden" id="form_submission_state" value="<?= $form_submitted ?>">
<!-- <div class="nhance-form-card">
<div class="nhance-form-header">Nhance Experience Form</div>
<div class="nhance-form-subtitle">Fill in the details to enhance your experience</div>
</div> -->
<form id="feedbackForm" data-parsley-validate>
<div class="nhance-form-card-details" style="margin-top : 70px;">
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="email" class="mb-0 mr-2">Email &nbsp; </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : "" ?>" class="form-control-plaintext" id="email" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="name">Your name </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : "" ?>" class="form-control-plaintext" id="name" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="client_name">Your Employer </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : "" ?>" class="form-control-plaintext" id="client_name" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center ">
<div class="col-md-4">
<label for="emp_code">Your Employer ID </label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : "" ?>" class="form-control-plaintext" id="emp_code" readonly>
</div>
</div>
<div class="form-group d-flex align-items-center">
<div class="col-md-4">
<label for="claim_number">Your Claim ID</label>
</div>
<div class="col-md-8">
<input type="text" value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : "" ?>" class="form-control-plaintext" id="claim_number" readonly>
</div>
</div>
</div>
<div class="nhance-form-card">
<div class="form-group">
<label for="satisfaction_level">Your satisfaction level with Nhance in explanation of the claims settlement process<span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="highly_satisfied" required data-parsley-errors-container="#responsiveness-error">
<label class="form-check-label" for="highly_satisfied">
Highly satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="satisfied" required>
<label class="form-check-label" for="satisfied">
Satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="neutral" required>
<label class="form-check-label" for="neutral">
Neutral
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="dissatisfied" required>
<label class="form-check-label" for="dissatisfied">
Dissatisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="highly_dissatisfied" required>
<label class="form-check-label" for="highly_dissatisfied">
Highly dissatisfied
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">Your satisfaction level with Nhance responsiveness & professionalism throughout the process<span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error_1"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="highly_satisfied_1" required data-parsley-errors-container="#responsiveness-error_1">
<label class="form-check-label" for="highly_satisfied_1">
Highly satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="satisfied_1" required>
<label class="form-check-label" for="satisfied_1">
Satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="neutral_1" required>
<label class="form-check-label" for="neutral_1">
Neutral
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="dissatisfied_1" required>
<label class="form-check-label" for="dissatisfied_1">
Dissatisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="highly_dissatisfied_1" required>
<label class="form-check-label" for="highly_dissatisfied_1">
Highly dissatisfied
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">How satisfied were you with the time taken for Claim settlement? <span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error_2"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_were_you_with_the_time_taken_for_claim_settlement" id="claim_was_settled_on_time" required data-parsley-errors-container="#responsiveness-error_2">
<label class="form-check-label" for="claim_was_settled_on_time">
Claim was settled on time
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_were_you_with_the_time_taken_for_claim_settlement" id="claim_settlement_took_longer_than_expected">
<label class="form-check-label required" for="claim_settlement_took_longer_than_expected">
Claim settlement took longer than expected
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">How satisfied are you with the Policy's terms and coverage<span class="text-danger"> *</span></label>
<div class="error-container" id="responsiveness-error_3"></div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="highly_satisfied_2" required data-parsley-errors-container="#responsiveness-error_3">
<label class="form-check-label" for="highly_satisfied_2">
Highly satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="satisfied_2" required>
<label class="form-check-label" for="satisfied_2">
Satisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="neutral_2" required>
<label class="form-check-label" for="neutral_2">
Neutral
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="dissatisfied_2" required>
<label class="form-check-label" for="dissatisfied_2">
Dissatisfied
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="highly_dissatisfied_2" required>
<label class="form-check-label" for="highly_dissatisfied_2">
Highly dissatisfied
</label>
</div>
</div>
<div class="form-group">
<label for="claim_number">Would you recommend us? <span class="text-danger">*</span></label>
<div class="error-container" id="responsiveness-error_4"></div>
<div class="form-check">
<input class="form-check-input" type="radio" id="absolutely" name="would_you_recommend_us" required data-parsley-errors-container="#responsiveness-error_4">
<label class="form-check-label" for="absolutely">
Absolutely!
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="would_you_recommend_us" id="maybe_depends_on_improvements" required>
<label class="form-check-label" for="maybe_depends_on_improvements">
May be, depends on improvements.
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="would_you_recommend_us" id="no" required>
<label class="form-check-label" for="no">
No
</label>
</div>
</div>
<div class="form-group half-framed-textbox">
<label for="feedback"> Tell us how we can do better!</label>
<input type="text" class="form-control" id="feedback" name="feedback">
</div>
</div>
<div class="d-flex justify-content-center mt-3">
<button type="submit" id="feedbackFormSubmitButton" class="btn-nhance">Submit</button>
</div>
</form>
<div id="formSuccessPage">
</div>
<!-- Loader start -->
<div class="loader-mask">
<div class="loader">
<img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
</div>
</div>
<!-- Loader end -->
<footer class="text-center py-3 mt-auto" style="background-color: #f8f9fa; color: #5f6368;">
<p class="mb-0">© 2025 Nhance India Pvt Ltd. All Rights Reserved.</p>
</footer>
<script>
$(document).ready(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
var form_submitted_state = $("#form_submission_state").val();
var login_type = $("#login_type").val();
if (form_submitted_state == 1 && login_type != 1) {
$("#feedbackForm").hide();
const container = document.getElementById("formSuccessPage");
container.innerHTML = `
<div class = "nhance-form-card" style="margin-top : 70px;">
<div class="swal-icon"></div>
<h2 class="swal-title d-flex justify-content-center">Success!</h2>
<div class="swal-text d-flex justify-content-center">Your Feedback has been Received Successfully.</div>
</div>
`;
} else if (form_submitted_state == 1 && login_type == 1) {
$("#feedbackFormSubmitButton").hide();
var formData = <?= !empty($ticket_data['feedback_json']) ? $ticket_data['feedback_json'] : '{}' ?>;
console.log("Form data received : ", formData);
var feedbackText = formData.feedback;
$("#feedback").val(feedbackText).prop("readonly", true);
delete formData.feedback;
Object.values(formData).forEach((data, key) => {
console.log("key : ", data);
if (data.length > 1) {
$(`#${data}`).prop("checked", true);
}
})
} else if (form_submitted_state == 0 && login_type == 1) {
$("#feedbackForm").hide();
const container = document.getElementById("formSuccessPage");
container.innerHTML = `
<div class="nhance-form-card" style="margin-top: 70px;">
<div class="swal-icon swal-icon-error"></div>
<h2 class="swal-title d-flex justify-content-center">Error!</h2>
<div class="swal-text d-flex justify-content-center" id="errorMessage">User has not Submitted the Feedback Yet</div>
</div>
`;
}
})
$("#feedbackForm").submit(function(event) {
event.preventDefault();
if (!$(this).parsley().isValid()) {
return;
}
formData = $("#feedbackForm").serializeArray();
var would_you_recommend_us_id = $("[name='would_you_recommend_us']:checked").attr("id") || "";
var how_satisfied_are_you_with_the_policys_terms_and_coverage_id = $("[name='how_satisfied_are_you_with_the_policys_terms_and_coverage']:checked").attr("id") || "";
var how_satisfied_were_you_with_the_time_taken_for_claim_settlement_id = $("[name='how_satisfied_were_you_with_the_time_taken_for_claim_settlement']:checked").attr("id") || "";
var your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process_id = $("[name='your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process']:checked").attr("id") || "";
var your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process_id = $("[name='your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process']:checked").attr("id") || "";
formData.push({
name: "your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process",
value: your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process_id
});
formData.push({
name: "would_you_recommend_us",
value: would_you_recommend_us_id
});
formData.push({
name: "your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process",
value: your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process_id
});
formData.push({
name: "how_satisfied_were_you_with_the_time_taken_for_claim_settlement",
value: how_satisfied_were_you_with_the_time_taken_for_claim_settlement_id
});
formData.push({
name: "how_satisfied_are_you_with_the_policys_terms_and_coverage",
value: how_satisfied_are_you_with_the_policys_terms_and_coverage_id
});
var data = filterFormData(formData);
var ticket_id = $("#ticket_id").val();
console.log("Form Data : ", data);
console.log("Form Dataticket_id : ", ticket_id);
var url = "<?= base_url('claims-feedback-form') ?>" + `/${ticket_id}`;
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: url,
data: data,
type: 'POST',
success: function(response) {
if (response.status) {
console.log("Success:", response);
} else {
console.log("Failure");
}
location.reload(true);
},
error: function(xhr, status, error) {
console.error("AJAX Error:", error);
}
})
$("#feedbackForm")[0].reset();
});
function filterFormData(data) {
return data.filter(entry => entry.value !== "on");
}
</script>
</body>
</html>

View File

@ -0,0 +1,148 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
.addbtnStyle {
margin-left: 20px !important;
}
</style>
<style>
.table th:nth-child(1),
.table td:nth-child(1) {
max-width: 200px !important;
min-width: 100px !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
</style>
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Claim Feedback List </h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>Claim Number</th>
<th>Emp Code</th>
<th>Emp name</th>
<th>Corporate name</th>
</tr>
</thead>
<tbody>
<?php if (isset($feedback_data)) { ?>
<?php foreach($feedback_data as $data){ ?>
<tr onclick="viewFeedbackForm(<?php echo $data['id']; ?>)">
<td><?php echo $data['claim_number']; ?></td>
<td><?php echo $data['emp_code']; ?></td>
<td><?php echo $data['emp_name']; ?></td>
<td><?php echo $data['client_name']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<!-------------------------------------------------------------------------------------------------->
<script>
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Claim-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'claim-List',
exportOptions: {
orthogonal: 'sort'
},
},
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
});
} else {
console.error("Table atet found.");
}
});
function viewFeedbackForm(ticket_id){
console.log("Ticket ID : ",ticket_id);
var md5Hash_ticket_id = md5(ticket_id);
console.log("MD5 Ticket ID : ",md5Hash_ticket_id);
// alert(md5Hash);
feedbackPage = `<?= base_url("claims-feedback-form/") ?>${md5Hash_ticket_id}/1`
// window.location.href = feedbackPage;
window.open(feedbackPage, "_blank");
}
</script>

View File

@ -20,8 +20,9 @@
<td><?php echo $row['display_name']; ?></td>
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
<!-- <td><?php //echo $row['new_value']; ?></td> -->
<td><?php echo $row['modified_by']; ?></td>
<td><?php echo $row['created_at']; ?></td>
<td><?php echo $row['modified_by'] ?? "Created by employee"; ?></td>
<!-- <td><?php //echo $row['created_at']; ?></td> -->
<td><?php echo date("d-m-Y H:i:s a", strtotime($row['created_at'])) ?? " - "; ?></td>
</tr>
<?php } ?>
<?php } ?>

View File

@ -35,6 +35,10 @@ table.dataTable tbody td {
white-space: nowrap !important;
}
#scroll-horizontal-datatable tbody tr:hover {
background-color: #e0e0e0;
}
</style>
@ -57,6 +61,7 @@ table.dataTable tbody td {
<th>Policy Type</th>
<th>Claim number</th>
<th>TPA ID</th>
<th>Emp ID</th>
<th>Emp name</th>
<th>Insured Name</th>
<th>Corporate name</th>
@ -66,7 +71,7 @@ table.dataTable tbody td {
<tbody>
<?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?>
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
<tr onclick="viewTicket(<?php echo $row['id']; ?>)" style="cursor: pointer;">
<td data-toggle="tooltip" data-placement="top"
@ -109,7 +114,8 @@ table.dataTable tbody td {
<td><?php echo str_replace("Claim-", "", $ticket_type[$row['ticket_type_id']] ?? ""); ?></td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['tpa_no']; ?></td>
<td><?php echo $row['emp_code']; ?></td>
<td><?php echo $row['emp_name']; ?></td>
<td><?php echo $row['insured_name']; ?></td>
<td><?php echo $row['short_name']; ?></td>
@ -184,8 +190,12 @@ $(document).ready(function() {
function viewTicket(ticket_id){
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id
window.location.href = url
}
</script>