MERGE_TEST_TICKET&HR_FILE_UPLOAD_&UI&ISSUES

This commit is contained in:
Ubuntu 2025-08-26 18:55:54 +05:30
commit 38124040cc
54 changed files with 6005 additions and 1141 deletions

View File

@ -183,6 +183,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
});
$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
$routes->group("insurer", ["filter" => "authMVC"], function ($routes) {
@ -370,6 +372,9 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get('viewHrAccessData', 'ClientController::viewHrAccessData');
$routes->post('saveHrAccessData', 'ClientController::saveHrAccessData');
$routes->get('removeLevelContacts', 'ClientController::removeLevelContacts');
$routes->get('getClaimDumpFileErrorData', 'TicketController::getClaimDumpFileErrorData');
$routes->get("claim_dump_excel_error/(:any)", "TicketController::getClaimDumpExcelFileErrors/$1");
$routes->get("download_claim_dump_file/(:any)", "TicketController::downloadClaimDumpFile/$1");
});
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
@ -558,7 +563,15 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
$routes->get("hrFileList", "EmployeeRestController::hrFileList");
$routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters");
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
$routes->post("hrFileUpload", "EmployeeRestController::hrFileUpload");
$routes->post("updateHrFileUploadData", "EmployeeRestController::updateHrFileUploadData");
});
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
$routes->post("hrFileList", "EmployeeRestController::hrFileList");
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
$routes->post("sendEmail", "EmployeeRestController::send_email");
@ -646,4 +659,5 @@ $routes->post("ticketSave", "ThzController::ticketSave");
$routes->get("ticketList", "ThzController::ticketList");
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
$routes->get('ticketAssigning',"ThzController::ticketAssigning");
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
// $routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType');

View File

@ -143,7 +143,11 @@ class ClientController extends AdminController
// Perform the query
$builder = $db->table($table);
$isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0;
if(is_array($value)){
$isDuplicate = $builder->where($value)->where('is_active', 1)->countAllResults() > 0;
}else{
$isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0;
}
// Return the result
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
@ -4051,10 +4055,25 @@ class ClientController extends AdminController
{
// ---------for client-----------------------------------------------------------------------------
$role_id = get_role_id();
$user_id = get_session_userid();
if ($role_id == 2 || $role_id == 3) {
$clients = $this->clientModel
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
->where('is_active', 1)
->findAll();
->select("clients.*, DATE_FORMAT(clients.dob, '%d-%m-%Y') as dob")
->join('client_rm', 'client_rm.client_id = clients.id')
->where('client_rm.user_id', $user_id)
->where('clients.is_active', 1)
->findAll();
} else {
$clients = $this->clientModel
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
->where('is_active', 1)
->findAll();
}
$clientIds = array_column($clients, 'id');
@ -5037,7 +5056,16 @@ class ClientController extends AdminController
// $employeeController = new EmployeeController();
// $employeeController->truncateFileData('633');
// ---------- TICKET SERVICE CONTROLLER --------------------------------------------------------------------------------
$ticketServiceController = new TicketServiceController();
// $response = $ticketServiceController->claimDumpExcelFileFormatValidation(["file_id" => 3]);
// $response = $ticketServiceController->claimDumpExcelFileDataValidation(["file_id" => 3]);
// $response = $ticketServiceController->claimDumpOnBoardProcess(["file_id" => 3]);
// $response = $ticketServiceController->extractExcelData("claims_dump_form_client.xlsx");
// dd($response);
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
$empServiceController = new EmployeeServiceController();
@ -5051,21 +5079,25 @@ class ClientController extends AdminController
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']);
// dd( $res);
// $EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1056']);
// dd($res);
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
$policyTransactionController = new PolicyTransactionController();
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '17']);
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '57']);
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '22']);
// dd('-----', $res);
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
$batch_data = [
'client_id' => 20,
'client_branch_id' => 72,
'client_policy_id' => 127,
'client_id' => 51,
'client_branch_id' => 40,
'client_policy_id' => 63,
'insurer_or_tpa' => "insurer",
'event_type' => "deletion",
'event_type' => "correction",
'actions' => "export",
'file_name' => "deletion_enhancement_test_file.xlsx",
];
@ -5132,25 +5164,30 @@ class ClientController extends AdminController
// $EmpDataServiceController->cashDepositCalculationForDeletion($array);
// $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data);
// $result = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($batch_data);
// dd(db_connect()->getLastQuery());
// ------------- LEADS CONTROLLER ----------------------------------------------------------
$LeadsController = new LeadsController();
// $RFQModel = new RFQModel();
$RFQModel = new RFQModel();
// $data = $RFQModel->where('is_active', 1)->where('lead_id', 40)->first();
// // dd($data);
// $data = $RFQModel->where('is_active', 1)->where('lead_id', 323)->orderBy('id', 'desc')->first();
// $data = db_connect()->table('leads')->where('is_active', 1)->where('id', 326)->orderBy('id', 'desc')->get()->getResultArray();
// dd($data);
// $policy_type = 2;
// $proposel_name = "Proposal 2";
// $insurer_name = "ICICI-P-ICICI002-V1";
// $jsonArray = json_decode($data['json'], true);
// // dd($jsonArray);
// dd($jsonArray);
// $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
// dd($returndata);
// $LeadsController->handleMemberDataGPATotalSumInsurerFromExcel(['lead_id' => 169]);
// $res = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
// $res = $LeadsController->handleMemberDataGPATotalSumInsurerFromExcel(['lead_id' => 169]);
// $res = $LeadsController->reorderProposalsByInsurerTotal($jsonArray);
// $res = $LeadsController->calculateMembersDemography(['lead_id' => 326]);
// $res = $LeadsController->generateDemographyDataTable(['lead_id' => 326]);
// echo $res;
// dd($res);
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
@ -5163,6 +5200,7 @@ class ClientController extends AdminController
// $data['data'] = $BDSReportController->getBAPClientData();
// return $this->loadLayout('irda_bap_client_report_list', $data);
// $data['data'] = $BDSReportController->getClientData(1);
// return $this->loadLayout('irda_client_report_list', $data);

View File

@ -270,10 +270,11 @@ class EmployeeController extends AdminController
$client_id = $this->request->getPost('client_id');
$policy_id = $this->request->getPost('policy_id');
$branch_id = $this->request->getPost('branch_id');
$hr_file_id = $this->request->getPost('hr_file_id') ?? null;
$action = $this->request->getPost('upload-action-type');
$status = 'inprogress';
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1]); //here field policy_id have client_policy_id and not policy id from policy master
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1, 'hr_file_id' => $hr_file_id]); //here field policy_id have client_policy_id and not policy id from policy master
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
//start validation process

View File

@ -34,6 +34,7 @@ use App\Models\TicketMasterModel;
use App\Models\TicketMessageModel;
use App\Models\HRAccessControlModel;
use App\Models\InsurerModel;
use App\Models\HrFileUploadModel;
@ -87,6 +88,7 @@ class EmployeeRestController extends AdminController
protected $ticketController;
protected $hrAccessControlModel;
protected $insurerModel;
protected $hrFileUploadModel;
public function __construct()
@ -118,6 +120,7 @@ class EmployeeRestController extends AdminController
$this->ticketController = new TicketController();
$this->hrAccessControlModel = new HRAccessControlModel();
$this->insurerModel = new InsurerModel();
$this->hrFileUploadModel = new HrFileUploadModel();
}
@ -3781,4 +3784,272 @@ class EmployeeRestController extends AdminController
return $response->getBody();
}
//--------------------------------------------------------------------------------------------
public function hrFileUpload()
{
try {
// Check file
$file = $this->request->getFile('file_name');
if (!$file) {
return $this->response->setJSON([
'status' => false,
'message' => "Invalid file or file not uploaded.",
'data' => "No Data"
]);
}
// Upload folder path
$uploadPath = WRITEPATH . 'uploads/hr_files/';
// If directory not exists, create it
if (!is_dir($uploadPath)) {
mkdir($uploadPath, 0777, true);
}
// New file name with timestamp
$newFileName = time() . '_' . $file->getRandomName();
// Move file
$file->move($uploadPath, $newFileName);
// Prepare data
$data = [
'client_id' => $this->request->getPost('client_id'),
'client_branch_id' => $this->request->getPost('client_branch_id'),
'policy_id' => $this->request->getPost('policy_id'),
'policy_no' => $this->request->getPost('policy_no'),
'file_name' => $newFileName,
'file_action' => $this->request->getPost('file_action'),
'status' => 'Yet to start',
'created_by' => $this->request->getPost('created_by'),
'updated_by' => $this->request->getPost('created_by'),
];
// Save into DB
$this->hrFileUploadModel->insert($data);
return $this->respondCreated([
'status' => true,
'message' => 'File uploaded successfully',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function updateHrFileUploadData()
{
try {
$id = $this->request->getPost('id');
if (!$id) {
return $this->failValidationErrors('ID is required for update.');
}
// Prepare data
$data = [
'client_id' => $this->request->getPost('client_id'),
'client_branch_id' => $this->request->getPost('client_branch_id'),
'policy_id' => $this->request->getPost('policy_id'),
'policy_no' => $this->request->getPost('policy_no'),
'file_action' => $this->request->getPost('file_action'),
'status' => $this->request->getPost('status'),
'updated_by' => $this->request->getPost('updated_by'),
];
// Check if record exists
$record = $this->hrFileUploadModel->find($id);
if (!$record) {
return $this->failNotFound("Record with ID {$id} not found.");
}
// Update record
$this->hrFileUploadModel->update($id, $data);
return $this->respond([
'status' => true,
'message' => 'File record updated successfully',
'data' => $data
], 200);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function hrFileDownload($id = null)
{
try {
$file_id = $this->request->getGet('id') ?? $id;
// Find record
$record = $this->hrFileUploadModel->where('id',$file_id)->find();
// print_rr( $record);die;
if (!$record) {
return $this->failNotFound("File record not found");
}
$uploadPath = WRITEPATH . 'uploads/hr_files/';
$filePath = $uploadPath . $record[0]['file_name'];
if (!file_exists($filePath)) {
// return $this->failNotFound("File not found on server");
$data['message'] = 'The Physical File Not Found';
return view('errors/404', $data);
}
// Force file download
return $this->response->download($filePath, null)
->setFileName($record[0]['file_name']);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
// public function hrFileList()
// {
// try {
// $request = service('request');
// $builder = $this->hrFileUploadModel
// ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name ');
// // Allowed filter keys
// $filters = [
// 'client_id',
// 'client_branch_id',
// 'policy_no',
// 'file_action',
// 'status',
// 'created_by'
// ];
// // Apply filters dynamically
// foreach ($filters as $key) {
// $value = $request->getGetPost($key); // supports both GET and POST
// if (!empty($value)) {
// $builder->where($key, $value);
// }
// }
// // Fetch results
// $builder->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left');
// $builder->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left');
// $builder->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left');
// $data = $builder->findAll();
// return $this->respond([
// 'status' => true,
// 'message' => 'File list fetched successfully',
// 'data' => $data
// ]);
// } catch (\Exception $e) {
// return $this->failServerError($e->getMessage());
// }
// }
public function hrFileList()
{
try {
$request = service('request');
// Start builder from model
// $builder = $this->hrFileUploadModel
// ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name')
// ->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
// ->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
// ->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left');
$builder = $this->hrFileUploadModel
->select('
hr_file_upload.id,
hr_file_upload.client_id,
hr_file_upload.client_branch_id,
hr_file_upload.policy_id,
hr_file_upload.policy_no,
hr_file_upload.file_name,
hr_file_upload.file_action,
hr_file_upload.created_at,
hr_file_upload.created_by,
hr_file_upload.updated_at,
hr_file_upload.updated_by,
c.short_name,
cb.branch_name,
lc.name as first_name,
CASE
WHEN f.status IS NULL
THEN hr_file_upload.status
ELSE CONCAT(UCASE(LEFT(f.status, 1)), LCASE(SUBSTRING(f.status, 2)))
END AS status
', false)
->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left')
->join(
'(SELECT f1.*
FROM files f1
WHERE f1.is_active = 1
ORDER BY f1.id DESC
LIMIT 1) f',
'f.hr_file_id = hr_file_upload.id',
'left'
);
// Allowed filter keys
$filters = [
'client_id',
'client_branch_id',
'policy_id',
'policy_no',
'file_action',
'status',
'created_by'
];
// Apply filters dynamically
foreach ($filters as $key) {
$value = $request->getGetPost($key); // supports both GET and POST
if (!empty($value)) {
$builder->where("hr_file_upload.$key", $value);
}
}
// Execute query
$data = $builder->get()->getResultArray();
return $this->respond([
'status' => "success",
'message' => 'File list fetched successfully',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function hrFileUploadMasters()
{
try {
//for inception upload
$data['actions'] = ['addition' => 'Addition (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
return $this->respond([
'status' => true,
'message' => 'File inception upload masters',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
}

View File

@ -143,6 +143,18 @@ class JobWorker extends AdminController
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\ClientController',
],
'claimDumpExcelFileFormatValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
'claimDumpExcelFileDataValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
'claimDumpOnBoardProcess' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
];

View File

@ -248,12 +248,14 @@ class PolicyTransactionController extends BaseController
// policy Transaction Create function start
public function createInceptionPolicy()
{
// print_r($this->request->getPost()); die;
{
$post_data = $this->request->getPost() ?? [];
$this->myLogger->logme('error', 'Policy Trancaction form data : '. json_encode($post_data));
$id = $this->request->getPost('id');
$data = $this->preparePolicyData();
$data['cd_ac_pk'] = $this->request->getPost('cd_ac_no');
// print_r($this->request->getPost()); die;
$this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data));
if (!$id) {
@ -995,8 +997,16 @@ class PolicyTransactionController extends BaseController
if ($id) {
$data['is_active'] = 0;
$this->policyTransactionModel->where('id', $id)->set($data)->update();
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update();
$policy_transaction_data = $this->policyTransactionModel->where('id', $id)->first();
if($policy_transaction_data['policy_type_id'] > 7){
$this->policyTransactionModel->where('id', $id)->set($data)->update();
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update();
$this->clientPolicyModel->where('id', $policy_transaction_data['client_policy_id'])->set($data)->update();
$this->policyTransactionModel->where('client_policy_id', $policy_transaction_data['client_policy_id'])->set($data)->update();
}else{
$this->policyTransactionModel->where('id', $id)->set($data)->update();
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update();
}
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Transaction removed successfully'], 200);
} else {

View File

@ -3,12 +3,18 @@
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Helpers\MailHelper;
use CodeIgniter\HTTP\ResponseInterface;
use App\Models\ThzMasterModel;
use App\Models\ThzMasterNotesModel;
use App\ControllerCleaners\ThzControllerCleaner;
use App\Models\UserModel;
use App\Models\ClientPolicyModel;
use App\Models\ClientModel;
use App\Models\TicketMailTemplateModel;
// use App\Models\TicketTypesModel;
class ThzController extends BaseController
{
@ -19,13 +25,21 @@ class ThzController extends BaseController
protected $thzControllerCleaner;
protected $userModel;
protected $clientPolicyModel;
protected $clientModel;
protected $ticketMailTemplateModel;
// protected $ticketTypesModel;
public function __construct()
{
$this->thzMasterModel = new ThzMasterModel();
$this->thzMasterNotesModel = new ThzMasterNotesModel();
$this->thzControllerCleaner = new ThzControllerCleaner();
$this->userModel = new UserModel();
$this->thzMasterModel = new ThzMasterModel();
$this->thzMasterNotesModel = new ThzMasterNotesModel();
$this->thzControllerCleaner = new ThzControllerCleaner();
$this->userModel = new UserModel();
$this->clientPolicyModel = new ClientPolicyModel();
$this->clientModel = new ClientModel();
$this->ticketMailTemplateModel = new TicketMailTemplateModel();
}
public function index()
@ -36,19 +50,29 @@ class ThzController extends BaseController
public function ticketSave(){
$data = $this->request->getPost();
// $data = $this->request->getJSON(true);
// $return_type = isset($data['return_type']) ? $data['return_type'] : 'api';
if (!empty($data['thz_id'])) {
$text = "update";
$text = "update";
$result = $this->updateTicket($data);
$updateID = $data['thz_id'];
} else {
$text = "create";
$result = $this->insertTicket($data);
$text = "create";
$insertID = $this->insertTicket($data);
$result = true;
}
$id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ;
$emailNotificationResult = $this->ticketSaveNotification($data , $insertOrUpdate = $text , $id);
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again."
'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again." ,
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!'
])->setStatusCode($result ? 200 : 400);
}
@ -57,9 +81,14 @@ class ThzController extends BaseController
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$data = $this->request->getGet();
if ($returnType === 'web' && in_array(get_role_id(), [2,3,4])) {
$data['assign_to'] = $data['assign_to'] ?? get_session_userid();
}
$tickets = $this->fetchTicketsBasedOnrole($data);
if ($returnType === 'api') {
if (empty($tickets)) {
@ -67,9 +96,12 @@ class ThzController extends BaseController
}
}else{
$data['page_name'] = "Ticket List";
$data['page_name'] = "Tickets";
$data['ticket_data'] = $tickets;
$data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['1', '5'])->findAll(); // enga 5-"head" and 1-"admin" role person thaan assignee..
$data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
$data['client_list'] = $this->clientModel->getCreatedByUserName();
return $this->loadLayout('thz_list', $data);
}
@ -81,7 +113,9 @@ class ThzController extends BaseController
public function ticketConversationSave(){
$data = $this->request->getJSON(true);
$data = $this->request->getPost();
$data['notes_type'] = $data['notes_type'] ?? 'External' ;
$result = $this->thzMasterNotesModel->insert($data);
@ -89,78 +123,149 @@ class ThzController extends BaseController
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
}
if($data['notes_type'] == "External"){
$emailNotificationResult = $this->ticketConversationSaveNotification($data);
}else{
$emailNotificationResult = false ;
}
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again."
'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again." ,
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed Or No Need..!!'
])->setStatusCode($result ? 200 : 400);
}
public function ticketConversationList(){
public function ticketAutoFetchDetails(){
$data = $this->request->getPost();
$data = $this->request->getGet();
$client_id = $data['client_id'];
$mobile = $data['mobile'];
$thz_id = $data['thz_id'] ?? null;
if($client_id && $mobile){
$details = $this->thzMasterModel->ticketAutoFetchDetails($client_id ,$mobile);
if(empty($details)){
return $this->response->setJSON((['status' => 'error', 'message' => 'No Data found']))->setStatusCode(400);
}else{
$policyIds = array_column($details, 'policy_id');
$policyIds = array_filter($policyIds);
$clientPolicy = $this->clientPolicyModel->whereIn('id', $policyIds)->where('is_active', 1)->get()->getResultArray();
$result['client_details'] = $details;
$result['policy_details'] = empty($clientPolicy) ? [] : $clientPolicy ;
}
}else{
return $this->response->setJSON((['status' => 'error', 'message' => 'Client and Mobile Not found']))->setStatusCode(400);
}
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
}
public function ticketConversationList(){
$data = $this->request->getGet();
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$thz_id = $data['thz_id'] ?? null;
$ticketType = $data['notes_type'] ?? 'External' ;
if($thz_id){
$result['master'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.thz_id', $thz_id)
->where('thz_master.thz_id', $thz_id)
->findAll();
$notes = $this->thzMasterNotesModel->ticketConversationList($thz_id);
$result['notes'] = !empty($notes) ? $notes : [];
if(!empty($result['master'])){
$notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType );
$result['notes'] = !empty($notes) ? $notes : [];
}else{
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400);
}
}else{
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
}
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(400);
}
public function ticketSaveNotification($data){
}
public function ticketConversationSaveNotification($data){
}
public function ticketAssigning(){
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$data = $this->request->getVar();
$assignee_id = $data['assignee_id'];
$thz_id = $data['thz_id'];
$result = $this->thzMasterModel->set('assign_to',$assignee_id)->where('thz_id',$thz_id)->update();
if($returnType === 'api'){
if(empty($result)){
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
}
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
}else{
if ($returnType === 'api') {
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
}else{
}
$assign_to = $result['master'][0]['assign_to'];
$mobile = $result['master'][0]['mobile'];
$toGetPolicyId = (!empty($result['master'][0]['policy_id']) && strtolower($result['master'][0]['policy_id']) !== 'null')
? $result['master'][0]['policy_id']
: '';
$result['related_tickets'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to)
->where('thz_master.mobile',$mobile)
->where('thz_master.thz_id !=',$thz_id)
->where('thz_master.status !=','Closed')
->where('thz_master.status !=','Resolved')
->findAll();
$result['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
return $this->loadLayout('thz_notes', $result);
}
}
// public function ticketType()
// {
// $method = $this->request->getMethod(); // get, post
// if ($method === 'get') {
// $types = $this->ticketTypesModel->where('is_active', 1)->findAll();
// if (empty($types)) {
// return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404);
// }
// return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200);
// }
// if ($method === 'post') {
// $data = $this->request->getPost();
// if (!empty($data['id'])) {
// $text = "update";
// $result = $this->ticketTypesModel->update($data['id'], $data);
// $updateID = $data['id'];
// } else {
// $text = "create";
// $insertID = $this->ticketTypesModel->insert($data);
// $result = true;
// }
// $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ;
// return $this->response->setJSON([
// 'status' => $id ? 'success' : 'error',
// 'message' => $id ? "Ticket Type {$text}d successfully " : "Unable to {$text} ticket type. Please try again." ,
// 'id' => $id
// ])->setStatusCode($id ? 200 : 400);
// }
// return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404);
// }
/************************************************** PRIVATE FUNCTIONS ********************************************************/
@ -177,6 +282,7 @@ class ThzController extends BaseController
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to)
->orderBy('thz_master.created_at','desc')
->findAll();
}
@ -188,6 +294,7 @@ class ThzController extends BaseController
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
// ->where('thz_id', $id)
->where('thz_master.mobile', $mobile)
->orderBy('thz_master.created_at','desc')
->findAll();
}
@ -195,23 +302,154 @@ class ThzController extends BaseController
return $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->orderBy('thz_master.created_at','desc')
->findAll();
}
private function notificationBasedOnRole($data){
$id = $data['thz_id'] ?? null;
$assign_to = $data['assign_to'] ?? null;
$mobile = $data['mobile'] ?? null;
if (!empty($assign_to)) {
private function ticketSaveNotification( $data , $insertOrUpdate , $id){
$user_email = $data['email'] ?? null;
$assignee_id = $data['assign_to'] ?? null;
$assignee_email = $this->findAssigneeEmail($assignee_id);
$emailToNotified = [
'user_email' => $user_email,
'assignee_email' => $assignee_email
];
$ticketId = $id;
$result = $this->ticketSaveEmailNotificationBasedOnRole($emailToNotified , $insertOrUpdate , $ticketId , $data);
return $result;
}
private function ticketConversationSaveNotification($data){
$thz_id = $data['thz_id'] ; // thz is alias of ticket
$data['subject'] = $this->findSubject($data['thz_id']);
$assignee_id = $this->findAssigneeId($data['thz_id']) ;
$user_email = $this->findUserEmail($data['thz_id']) ;
$assignee_email = $this->findAssigneeEmail($assignee_id) ?? '';
$sender_mail = $data['notes_by'] == "User" ? $user_email : $assignee_email ;
$receiver_mail = $data['notes_by'] == "User" ? $assignee_email : $user_email ;
$templateName = "ticket_conversation_save_notification";
$to_email = $receiver_mail;
$ticketId = $thz_id;
$message = $data['notes'] ?? '';
$this->sendEmail( $templateName, $data , $to_email , $ticketId , $message);
return true;
}
private function findAssigneeEmail($assignee_id){
$row = $this->userModel->where('id', $assignee_id)->get()->getRow();
$assigneeEmail = $row ? $row->email : null;
return $assigneeEmail ? $assigneeEmail : "";
}
private function findAssigneeId($ticketId){
$row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow();
$assigneeId = $row ? $row->assign_to : null;
return $assigneeId ? $assigneeId : 0 ;
}
private function findUserEmail($ticket_id){
$row = $this->thzMasterModel->where('thz_id', $ticket_id)->get()->getRow();
$email = $row ? $row->email : null;
return $email ? $email : " " ;
}
private function findSubject($ticketId){
$row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow();
$subject = $row ? $row->subject : null;
return $subject ? $subject : " " ;
}
private function ticketSaveEmailNotificationBasedOnRole($emailToNotified , $insertOrUpdate , $ticketId , $data){
$user_email = $emailToNotified['user_email'] ?? null;
$assignee_email = $emailToNotified['assignee_email'] ?? null;
if (!empty($assignee_email)) {
switch ($insertOrUpdate) {
case 'update':
$this->sendEmail( 'ticket_save_update_assignee', $data ,$assignee_email , $ticketId ) ;
break;
case 'create':
$this->sendEmail( 'ticket_save_create_assignee', $data ,$assignee_email , $ticketId ) ;
break;
default:
# code...
break;
}
}
if (!empty($id) && !empty($mobile)) {
if (!empty($user_email)) {
switch ($insertOrUpdate) {
case 'update':
if(empty($assignee_email)){
$data['assigneeAndStatus'] = "Not Yet Assigned";
$this->sendEmail( 'ticket_save_update_user', $data ,$user_email , $ticketId ) ;
}else{
$data['assigneeAndStatus'] = "Assigned With {$assignee_email}";
$this->sendEmail( 'ticket_save_update_user', $data ,$user_email , $ticketId ) ;
}
break;
case 'create':
if(empty($assignee_email)){
$this->sendEmail( 'ticket_save_create_user_unassigned', $data ,$user_email , $ticketId ) ;
}else{
$data['assignee_email'] = $assignee_email ;
$this->sendEmail( 'ticket_save_create_user_assigned', $data , $user_email , $ticketId ) ;
}
break;
default:
# code...
break;
}
}
return true;
}
@ -225,16 +463,66 @@ class ThzController extends BaseController
}
private function insertTicket($data){
private function insertTicket($data)
{
$data['created_by'] = get_session_userid();
$result = $this->thzMasterModel->insert($data);
$this->thzMasterModel->insert($data);
return $result;
return $this->thzMasterModel->insertID(); // returns the inserted row's ID
}
private function sendEmail( $templateName, $data , $to_email , $ticketId , $message = ""){
$mailTemplate = $this->ticketMailTemplateModel->where('template_name',$templateName )->findAll()[0] ?? [];
if(empty($mailTemplate)){
return ;
}
$mailTemplate['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['subject']);
$mailTemplate['mail_content'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%ticketId%', $ticketId ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%message%', $message ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%assignee_email%', $data['assignee_email'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%assigneeAndStatus%',$data['assigneeAndStatus'] ?? '' ,$mailTemplate['mail_content']);
$from_mail = "";
$to_mail = $to_email;
$cc_string = "";
$subject = $mailTemplate['subject'] ;
$message = $mailTemplate['mail_content'] ;
$attachments = "";
$reply_to = "";
$bcc_string = "";
$res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail , 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
}
public function getPolicyTerms($client_policy_id)
{
$policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $client_policy_id)->first();
$policy_terms = [];
if(isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])){
$raw_terms = json_decode($policy_data['policy_terms'] ?? [] , true) ?? [];
$ticketController = new TicketController();
$policy_terms = $ticketController->convertTermsToDisplay($raw_terms);
}
$data['policy_terms'] = $policy_terms;
return view('view_policy_terms', $data);
}
}

View File

@ -21,6 +21,7 @@ use App\Models\InsurerModel;
use App\Models\EmployeeModel;
use App\Models\TPAModel;
use App\Models\ClaimFilesModel;
use App\Models\ClaimDumpFileModel;
use DOMDocument;
use Psr\Log\LoggerInterface;
@ -60,6 +61,7 @@ class TicketController extends BaseController
protected $insurerModel;
protected $TPAModel;
protected $claimFilesModel;
protected $claimDumpFileModel;
public function __construct()
{
@ -345,6 +347,7 @@ class TicketController extends BaseController
$this->insurerModel = new InsurerModel();
$this->TPAModel = new TPAModel();
$this->claimFilesModel = new ClaimFilesModel();
$this->claimDumpFileModel = new ClaimDumpFileModel();
}
public function ticketList()
@ -2383,17 +2386,20 @@ class TicketController extends BaseController
}
// 5. Merge the Sum Insured value if the multiple sum insured exists
if(isset($data['multiple_sum_insured'])){
if(isset($data['sumInsured2'])){
$data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']);
}else{
$data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']);
if (isset($data['multiple_sum_insured'])) {
$multipleSumInsured = is_array($data['multiple_sum_insured']) ? $data['multiple_sum_insured'] : [$data['multiple_sum_insured']]; // force into array if string
if (isset($data['sumInsured2'])) {
$data['sumInsured2'] .= ", " . implode(", ", $multipleSumInsured);
} else {
$data['sum_insured'] .= ", " . implode(", ", $multipleSumInsured);
}
unset($data['multiple_sum_insured']);
}
// 6. Add the special condition to key value pair
if(!empty($data['special_condition_label'])){
foreach ($data['special_condition_label'] as $key => $value) {
if($value != "" && $value != null) {
@ -2445,6 +2451,155 @@ class TicketController extends BaseController
}
// -------- CLAIM DUMP UPLOAD ----------------------------------------------------------------------------------------------
public function claimDumpUpload()
{
$data['page_name'] = "Claim Dupm Upload";
if($this->request->is('get')){
$data['claim_dump_file_data'] = $this->claimDumpFileModel
->select('
claim_dump_files.id as file_id,
claim_dump_files.file_name,
claim_dump_files.status,
claim_dump_files.created_at,
up.first_name as user_name
')
->join('user_profiles as up', 'claim_dump_files.created_by = up.id', 'left')
->where('claim_dump_files.is_active', 1)
->orderBy('claim_dump_files.id', 'desc')
->findAll();
return $this->loadLayout('claim_dump_file_list', $data);
}else{
// print_r($this->request->getFile('claim_dump_list')); die;
$filename = '';
$fileSize = '';
//validate uploaded file
$validated = $this->validate([
'claim_dump_list' => [
'uploaded[claim_dump_list]',
'mime_in[claim_dump_list,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet]',
'max_size[claim_dump_list,16384]',
],
]);
if ($validated)
{
$avatar = $this->request->getFile('claim_dump_list');
if (!$avatar) {
$this->myLogger->logme("error", 'File not found');
return $this->respond(['status' => false, 'code' => 400, 'message' => 'File not found'], 400);
}
$is_moved = $avatar->move(WRITEPATH . 'uploads/claim_dump_excel/');
if ($is_moved) {
$filename = $avatar->getName();
$fileSize = $avatar->getSize(); // File size in bytes
$fileSize = $fileSize / (1024 * 1024); // Convert to MB
$this->myLogger->logme("error", 'File move successful');
} else {
$this->myLogger->logme("error", 'File move failed');
return $this->respond(['status' => false, 'code' => 500, 'message' => 'File move failed'], 500);
}
} else {
$this->myLogger->logme("error", 'Upload failed Invalid file');
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Invalid file'], 404);
}
$status = 'inprogress';
$insert_data = [
'file_name' => $filename,
'status' => $status
];
$file_id = $this->claimDumpFileModel->insert($insert_data);
$this->myLogger->logme("error", 'claim_dumb_file_id : {file_id}, uploaded success', ['file_id' => $file_id]);
//after file upload success than call the file formate validation in service controller
$ticketServiceController = new TicketServiceController();
// $response = $ticketServiceController->claimDumpExcelFileFormatValidation(["file_id" => $file_id]);
$r = Jobs::addJob(['job_name' => 'claimDumpExcelFileFormatValidation', 'payload' => ['file_id' => $file_id]]);
return $this->respond(['status' => true, 'code' => 200, 'message' => 'File uploaded successfully. File being validated'], 200);
}
}
public function getClaimDumpFileErrorData()
{
$file_id = $this->request->getGet('file_id');
$file = $this->claimDumpFileModel->where('id', $file_id)->first();
if (!isset($file)) {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found'], 200);
} else {
return $this->respond(['status' => true, 'code' => 200, 'data' => $file['reason']], 200);
}
}
public function getClaimDumpExcelFileErrors($file_id)
{
// $file_id = $this->request->getGet('file_id');
$ticketServiceController = new TicketServiceController();
// Render views and capture output
$result = $ticketServiceController->getClaimExcelErrorData($file_id) ?? [];
// dd($result);
if ($result != 0) {
$result['file_id'] = $file_id;
echo view('excel_errors', $result);
} else if ($result == 0) {
$data['message'] = 'File Not Found Physically';
return view('errors/404', $data);
} else {
echo view('errors/html/production');
}
}
public function downloadClaimDumpFile($file_id)
{
// $actionType = $this->request->getGet();
$file_data = $this->claimDumpFileModel->where('id', $file_id)->first();
$fileName = $file_data['file_name'];
$filePath = WRITEPATH . '/uploads/claim_dump_excel/' . $fileName;
try {
// Check if the file exists
if (file_exists($filePath)) {
// Set the appropriate MIME type
$mimeType = mime_content_type($filePath);
// Send the file to the client for download
return $this->response->download($filePath, null, $mimeType);
} else {
$data['message'] = 'The Physical File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
$errorMessage = $e->getMessage();
$this->myLogger->logme('error', $errorMessage);
// You can return an error response here
echo $errorMessage;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,179 @@
<?php
use App\Models\EmployeeModel;
use App\Models\InsurerModel;
use App\Models\TPAModel;
use Kint\Kint;
if (!function_exists('check_client')) {
function check_client($params)
{
$client_data = $params['client_data'] ?? [];
$client_name = $params['client_name'] ?? "";
// Kint::dump($client_name);
if (!empty($client_data)) {
foreach ($client_data as $key => $value) {
// Kint::dump($value['client_name'], $client_name);
if(trim($value['client_name']) === trim($client_name)){
return array('status' => true, 'client_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => 'This Client Name does not exist in the system');
}
}
if (!function_exists('check_insurer')) {
function check_insurer($params)
{
$insurer_data = $params['insurer_data'] ?? [];
$insurer_name = $params['insurer_name'] ?? "";
if (!empty($insurer_data)) {
foreach ($insurer_data as $key => $value) {
if(trim($value['short_name']) === trim($insurer_name)){
return array('status' => true, 'insuer_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => 'This Insurer does not exist in the system');
}
}
if (!function_exists('check_tpa')) {
function check_tpa($params)
{
$tpa_data = $params['tpa_data'] ?? [];
$tpa_name = $params['tpa_name'] ?? "";
if (!empty($tpa_data)) {
foreach ($tpa_data as $key => $value) {
if(trim($value['short_name']) === trim($tpa_name)){
return array('status' => true, 'tpa_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => 'This TPA does not exist in the system');
}
}
if (!function_exists('check_status')) {
function check_status($params)
{
$data = $params['data'] ?? [];
$check_value = $params['value'] ?? "";
if (!empty($data)) {
foreach ($data as $key => $value) {
// Kint::dump(strtolower(trim($value['claim_status'])), strtolower(trim($check_value)));
if(strtolower(trim($value['claim_status'])) === strtolower(trim($check_value))){
return array('status' => true, 'status_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => "This Status ('{$check_value}') does not exist in the system");
}
}
if (!function_exists('check_policy')) {
function check_policy($params)
{
$data = $params['data'] ?? [];
$client_id = $params['client_id'] ?? "";
$check_value = $params['value'] ?? "";
if (!empty($data)) {
foreach ($data as $key => $value) {
if($value['client_id'] === $client_id && trim($value['policy_no']) === trim($check_value)){
return array('status' => true, 'status_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => "This Policy Number does not exist in the Client");
}
}
if (!function_exists('check_emp_and_insured')) {
function check_emp_and_insured($params)
{
$employee_modal = new EmployeeModel();
$tpa_data = $employee_modal
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->where('employees.client', $params['client_id'])
->where('employees.name', $params['emp_name'])
->where('employees.emp_code', $params['emp_code'])
->where('employees.is_active', 1)
->where('employees.emp_status !=', "truncated")
->where('employee_polices.is_active', 1)
->where('employees.status !=', "truncated")
->first();
if (empty($tpa_data)) {
return false;
}
return $tpa_data['id'];
}
}
if (!function_exists('dynamic_check_excel_date_format')) {
function dynamic_check_excel_date_format($dateString, $format = 'd/m/Y')
{
if ($dateString == "") {
return array('status' => true);
}
$date = DateTime::createFromFormat($format, $dateString);
if ($date && $date->format($format) == $dateString) {
return array('status' => true);
} else {
$res = validate_date_flexible($dateString, $format);
if (!$res) {
return array('status' => false, 'error' => "wrong date format: Expected {$format}({$res}) and received $dateString");
} else {
return array('status' => true);
}
}
}
}
if (!function_exists('validate_date_flexible')) {
function validate_date_flexible($date, $format = 'm/d/Y')
{
// Create a DateTime from the given format
$d = DateTime::createFromFormat($format, $date);
if (!$d) return false;
// Compare normalized values (remove leading zeros)
$original = preg_replace('/\b0+/', '', $date);
$normalized = preg_replace('/\b0+/', '', $d->format($format));
return $original === $normalized;
}
}
if (!function_exists('normalizeDate')) {
function normalizeDate($dateString, $formats = ['d-m-Y', 'd/m/Y', 'm-d-Y', 'm/d/Y', 'Y-m-d'])
{
if (empty($dateString)) {
return null; // keep null if no value
}
foreach ($formats as $format) {
$dt = DateTime::createFromFormat($format, trim($dateString));
if ($dt && $dt->format($format) === trim($dateString)) {
return $dt->format('Y-m-d'); // ✅ return in DB format
}
}
return null; // if no valid format found
}
}
?>

View File

@ -267,7 +267,6 @@
.right-bar {
width: 300px;
/* Adjust as needed */
overflow: hidden;
}
@ -616,7 +615,7 @@
</li>
<li>
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<i class="mdi mdi-information-outline" aria-hidden="true"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> App Content Management </span>
</a>

View File

@ -0,0 +1,56 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class ClaimDumpFileModel extends Model
{
protected $table = 'claim_dump_files';
protected $primaryKey = 'id';
protected $allowedFields = [
"id",
"file_name",
"status",
"reason",
"created_by",
"created_at",
"updated_by",
"updated_at",
"is_active",
];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
}

View File

@ -20,7 +20,8 @@ class FileModel extends Model
"policy_id",
"client_branch_id",
"uploaded_by",
"updated_by"
"updated_by",
"hr_file_id",
];

View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class HrFileUploadModel extends Model
{
protected $table = 'hr_file_upload';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
// Allowed fields
protected $allowedFields = [
'client_id',
'client_branch_id',
'policy_id',
'policy_no',
'file_name',
'file_action',
'status',
'created_by',
'created_at',
'updated_by',
'updated_at'
];
// Automatically set timestamps
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
// Return type
protected $returnType = 'array';
}

View File

@ -39,4 +39,22 @@ class ThzMasterModel extends Model
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function ticketAutoFetchDetails($client_id ,$mobile){
$result = $this->db->table('employees e')
->select('e.id, e.email_personal,e.email_corporate, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.is_active = 1', 'left')
->whereIn('e.emp_status', ['active', 'draft', 'enrolled'])
->where('e.is_active', 1)
->where('e.mobile', $mobile)
->where('e.client_id', $client_id)
->groupBy('e.client_id')
->get()
->getResultArray();
return $result;
}
}

View File

@ -12,7 +12,7 @@ class ThzMasterNotesModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['thz_id','notes','notes_by','created_by','created_at'];
protected $allowedFields = ['thz_id','notes','notes_by','created_by','created_at','notes_type'];
protected bool $allowEmptyInserts = false;
@ -76,9 +76,17 @@ class ThzMasterNotesModel extends Model
}
public function ticketConversationList($thz_id)
public function ticketConversationList($thz_id , $returnType)
{
$ticketTypeFilter = "";
if ($returnType == 'api') {
//user only see his message
$ticketTypeFilter = "AND thz_master_notes.notes_type = 'External' ";
}
$integer_ticket_id = (int)$thz_id;
$notes_sql = "SELECT
thz_master_notes.*,
CASE
@ -95,8 +103,9 @@ class ThzMasterNotesModel extends Model
LEFT JOIN thz_master
ON thz_master.thz_id = thz_master_notes.thz_id
AND LOWER(thz_master_notes.notes_by) = 'user'
WHERE thz_master_notes.thz_id = " . (int)$thz_id . "
ORDER BY thz_master_notes.created_at ASC";
WHERE thz_master_notes.thz_id = ". $integer_ticket_id ."
$ticketTypeFilter
ORDER BY thz_master_notes.created_at DESC";
$result = $this->db->query($notes_sql)->getResultArray();

View File

@ -76,7 +76,9 @@ class TicketMasterModel extends Model
'emp_personal_mail',
'client_policy_id',
'approved_description'
'approved_description',
'file_id',
'denial_letter',
];
@ -883,8 +885,6 @@ class TicketMasterModel extends Model
return $finalResults;
}
public function getNotSettledbutApprovedCount($ticket_type)
{
// Fetch the approved and settled claim_status IDs
@ -975,7 +975,198 @@ class TicketMasterModel extends Model
return json_encode(['policy_terms' => null]);
}
// ---------- CLAIM DUMP UPLOAD-------------------------------------------------------------------------------------------
public function getPolicyData($params)
{
$client_name = $params['client_name'] ?? null;
$insurer_short_name = $params['insurer_short_name'] ?? null;
$tpa_short_name = $params['tpa_short_name'] ?? null;
$policy_no = $params['policy_no'] ?? null;
$builder = $this->db->table('client_policy');
$builder->select('client_policy.*');
$builder->join('clients c', 'client_policy.client_id = c.id');
$builder->join('insurers i', 'client_policy.insurer_id = i.id');
$builder->join('tpa', 'client_policy.tpa_id = tpa.id and tpa.is_active = 1', 'left');
$builder->where('c.is_active', 1);
$builder->where('client_policy.is_active', 1);
$builder->where('i.is_active', 1);
$builder->where('c.client_name', trim($client_name));
$builder->where('i.short_name', trim($insurer_short_name));
if(!empty($tpa_short_name)){
$builder->where('tpa.short_name', trim($tpa_short_name));
}
$builder->where('client_policy.policy_no', trim($policy_no));
$query = $builder->get();
$result = $query->getResultArray();
// dd($this->db->getLastQuery());
return $result;
}
public function getTheClaimDetails($params)
{
$client_name = $params['client_name'] ?? null;
$policy_no = $params['policy_no'] ?? null;
$insurer_short_name = $params['insurer_short_name'] ?? null;
$tpa_short_name = $params['tpa_short_name'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$emp_name = $params['emp_name'] ?? null;
$insured_name = $params['insured_name'] ?? null;
$claim_no = $params['claim_no'] ?? null;
$tpa_no = $params['tpa_no'] ?? null;
$relationship = $params['relationship'] ?? null;
$builder = $this->table('ticket_master');
$builder->select('ticket_master.*');
$builder->join('clients c', 'ticket_master.client_id = c.id');
$builder->join('insurers i', 'ticket_master.insurer_id = i.id');
$builder->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left');
$builder->where('c.is_active', 1);
$builder->where('i.is_active', 1);
$builder->where('tpa.is_active', 1);
$builder->where('ticket_master.is_active', 1);
$builder->where('c.client_name', trim($client_name));
$builder->where('i.short_name', trim($insurer_short_name));
$builder->where('ticket_master.policy_no', trim($policy_no));
$builder->where('ticket_master.emp_code', trim($emp_code));
$builder->where('ticket_master.emp_name', trim($emp_name));
$builder->where('ticket_master.insured_name', trim($insured_name));
$builder->where('ticket_master.tpa_no', trim($tpa_no));
$builder->where('ticket_master.claim_number', trim($claim_no));
$builder->where('ticket_master.relationship', trim($relationship));
if(!empty($tpa_short_name)){
$builder->where('tpa.short_name', trim($tpa_short_name));
}
$query = $builder->get();
$result = $query->getResultArray();
return $result;
}
public function getEmployeeAndEmployeePolicyDetails($params)
{
$client_name = $params['client_name'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$emp_name = $params['emp_name'] ?? null;
$policy_no = $params['policy_no'] ?? null;
$relationship = $params['relationship'] ?? null;
$insured_name = $params['insured_name'] ?? null;
// $client_name = "6-Eleven";
// $emp_code = "EMP0020K12";
// $emp_name = "Lokesh";
// $policy_no = "GMC-1999/2000/2021/2022";
$builder = $this->db->table('employees e');
$builder->select("
e.id as emp_id,
e.client_id,
e.client_branch_id,
e.emp_code,
e.name as emp_name,
e.mobile as emp_mobile,
e.email_corporate as emp_mail,
e.email_personal as emp_mail_personal,
ep.id as emp_policy_id,
ep.tpa_id as tpa_no,
cp.id as client_policy_id,
cp.insurer_id,
cp.tpa_id,
cp.policy_no,
CASE
WHEN cp.policy_type_id = 2 THEN 1
WHEN cp.policy_type_id = 1 THEN 2
WHEN cp.policy_type_id = 6 THEN 3
WHEN cp.policy_type_id = 7 THEN 4
ELSE NULL
END AS ticket_type_id
", false);
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
$builder->join('clients c', 'e.client_id = c.id');
$builder->join('client_policy cp', 'ep.client_policy_id = cp.id');
$builder->where('e.is_active', 1);
$builder->where('ep.is_active', 1);
$builder->where('c.is_active', 1);
$builder->where('cp.is_active', 1);
$builder->where('e.emp_code', trim($emp_code));
$builder->where('e.name', trim($emp_name));
$builder->where('c.client_name', trim($client_name));
$builder->where('cp.policy_no', trim($policy_no));
$builder->where('LOWER(e.relationship)', strtolower('self'));
$query = $builder->get();
$result = $query->getRowArray();
return $result;
}
public function getAcmUserDetails($params)
{
$acm_name = $params['acm_name'] ?? null;
$acm_mobile = $params['acm_mobile'] ?? null;
if ($acm_mobile != null) {
$builder = $this->db->table('user_profiles');
$builder->select("user_profiles.*");
$builder->where('user_profiles.is_active', 1);
$builder->where('user_profiles.mobile', trim($acm_mobile));
$query = $builder->get();
$result = $query->getRowArray();
return $result;
}
return [];
}
public function getInsuredDetails($params)
{
$client_id = $params['client_id'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$policy_id = $params['client_policy_id'] ?? null;
$insured_name = $params['insured_name'] ?? null;
$builder = $this->db->table('employees e');
$builder->select("
e.id as emp_id,
e.client_id,
e.client_branch_id,
e.emp_code,
e.name as emp_name,
e.mobile as emp_mobile,
e.email_corporate as emp_mail,
e.email_personal as emp_mail_personal,
ep.id as emp_policy_id,
ep.tpa_id as tpa_no,
");
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
$builder->where('e.is_active', 1);
$builder->where('ep.is_active', 1);
$builder->where('e.emp_code', trim($emp_code));
$builder->where('e.name', trim($insured_name));
$builder->where('e.client_id', trim($client_id));
$builder->where('ep.client_policy_id', trim($policy_id));
$query = $builder->get();
$result = $query->getRowArray();
// dd($this->db->getLastQuery());
return $result;
}
// -----------------------------------------------------------------------------------------------------
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TicketTypesModel extends Model
{
protected $table = 'ticket_types';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['name','created_at','updated_at','created_by','updated_by' ,'is_active'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -381,15 +381,14 @@ $(document).ready(function(){
<script>
// $(document).on('click', '.dash-anchor', function () {
// console.log("clicked dynamic", this);
$(document).on('click', '.dash-anchor', function () {
// remove active class from all tabs
$('.dash-tab').removeClass('active');
// // remove active class from all tabs
// $('.dash-tab').removeClass('active');
// // add active only to the clicked one's child span
// $(this).find('.dash-tab').addClass('active');
// });
// add active only to the clicked one's child span
$(this).find('.dash-tab').addClass('active');
});

View File

@ -344,7 +344,7 @@ table.dataTable tbody td {
<div class="form-row">
<div class="form-group col-md-12">
<label for="emp_code">User Role<span class="text-danger">*</span>
<span class="tooltip-trigger fa fa-info-circle" id="roleAccessMatrixTrigger"></span>
<span class="tooltip-trigger mdi mdi-information-outline" id="roleAccessMatrixTrigger"></span>
</label>
<select class="form-control" id="role" name="role" required>
<option value="">Select Role</option>
@ -357,7 +357,7 @@ table.dataTable tbody td {
<div class="form-row">
<div class="form-group col-md-12">
<label for="profile">User Team<span class="text-danger">*</span>
<span class="tooltip-trigger fa fa-info-circle" id="accessMatrixTrigger"></span>
<span class="tooltip-trigger mdi mdi-information-outline" id="accessMatrixTrigger"></span>
</label>
<select hidden class="form-control" id="team" name="team[]" multiple required>
<?php foreach($teamData as $value) { ?>

View File

@ -132,7 +132,7 @@
border-radius: 15px !important;
border:2px solid #09B9BF;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
min-width: 250px;
min-width: 300px;
}
#bds-dash-tab{
@ -182,7 +182,7 @@
<h2>
<span class="mb-3 span-color"><?= $businessTeamCount ?>
</h2>
<h6 >&nbsp;<span class="text-danger"> Team Action</span></h6>
<h6 >&nbsp;<span class="text-danger"> Team Action </span></h6>
</div>
</div>
</div>

View File

@ -0,0 +1,415 @@
<style>
.reload:hover {
cursor: pointer;
}
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.addbtnStyle{
margin-left: 20px !important;
}
.dataTables_filter {
position: absolute;
}
</style>
<!-- <div class="row">
<div class="col-xl-12" style="margin-left: 14px;max-width: 98%;">
<div id="accordion1" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
aria-expanded="true">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body">
<form class="parsley-examples" id="claim-upload-form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="file_upload">
<div class="form-group col-md-4">
<label>Upload file</label>
<input type="file" name="claim_dump_list" id="claim_dump_list" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
</div>
<div class="d-flex align-items-center justify-content-start">
<div class="form-group col-md-11">
<div class="col-md-3">
<button id="claim_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div> -->
<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;">Files</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">File name</th>
<th class="font-weight-medium">User/Time</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($claim_dump_file_data)) {
foreach ($claim_dump_file_data as $key => $file) {
?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name'] ?>
</td>
<td><?php echo change_date_format($file['created_at'], 'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['user_name'] . '</strong>' ?> </td>
<td>
<?php if ($file['status'] == "failed") { ?>
<?= $file['status'] ?> <span class='col-xl-3 col-lg-4 col-sm-6'>
<!-- <a href="<?= base_url('util/claim_dump_excel_error/') . $file['file_id'] ?>" target="_blank" class='fe-alert-circle' data-err="<?= $file['file_id'] ?>"></a> -->
<a href="#" class='fe-alert-circle' onclick="fetchFileError(<?= $file['file_id'] ?>)"></a>
</span>
<?php } else if ($file['status'] == "inprogress") { ?>
<a data-id="<?= $file['status'] ?>" class="reload" href="#"><?= $file['status'] ?></a>
<?php } else { ?>
<?= $file['status'] ?>
<?php } ?>
</td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
data-toggle="dropdown" aria-expanded="false"><i
class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a target="_blank" class="dropdown-item" href="<?= base_url("util/download_claim_dump_file/") . $file['file_id']; ?>"><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<!-- <a data-id="<?php echo $file['file_id'] ?>" data-toggle="modal" data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list" href="#"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a> -->
</div>
</div>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
<!-- Center modal content -->
<div class="modal fade" id="cliam-dump-file-err-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id="modal_body" class="modal-body">
<div class="spinner-border text-primary" role="status" style="position: relative; left: 200px;"></div>
</div>
</div>
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Center modal content for upload file-->
<div class="modal fade" id="claim-file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">Claim Dump Upload</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="claim-upload-form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="file_upload">
<div class="form-group col-md-9">
<label>Upload file</label>
<!-- &nbsp;[ <a href="#" id="excel_download" data-toggle="tooltip" data-placement="top" title="Download Sample Excel">Sample Excel</a> ] -->
<input type="file" name="claim_dump_list" id="claim_dump_list" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
</div>
<div class="form-group col-md-3" style="margin-top: 18px;">
<button id="claim_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function() {
// AJAX Form Submit Function
$('#claim-upload-form').on('submit', function(e) {
e.preventDefault(); // Prevent default form submission
// Get form data
var formData = new FormData(this);
var fileInput = $('#claim_dump_list')[0];
// Validate file type
var allowedTypes = [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel',
'application/vnd.oasis.opendocument.spreadsheet'
];
var selectedFile = fileInput.files[0];
if (!allowedTypes.includes(selectedFile.type)) {
alert('Please upload a valid Excel file (.xlsx, .xls, .ods)');
return false;
}
//form submit url;
let url = `<?php echo base_url('ticket/claim-upload'); ?>`;
// Show loading state
var submitButton = $('#claim_form_submit_button');
var originalText = submitButton.text();
submitButton.prop('disabled', true).text('Uploading...');
// AJAX request
$.ajax({
url: url, // Your route URL
type: 'POST',
data: formData,
processData: false, // CRITICAL: Don't process the data
contentType: false, // CRITICAL: Don't set content-type header
cache: false,
success: function(response) {
// Handle successful response
console.log('Upload successful:', response);
if (response.status == true) {
toastr.success(response.message, "SUCCESS");
} else {
toastr.error(response.message, "ERROR");
}
// Reset form
$('#claim-upload-form')[0].reset();
$('.close').click();
window.location.reload();
},
error: function(xhr, status, error) {
// Handle error response
console.error('Upload failed:', error);
console.error('Upload failed:', error);
},
complete: function() {
// Reset button state
submitButton.prop('disabled', false).text(originalText);
}
});
});
// File input change event for additional validation
$('#claim_dump_list').on('change', function() {
var fileInput = this;
var file = fileInput.files[0];
if (file) {
// Check file size (optional - set max size as needed, e.g., 10MB)
var maxSize = 10 * 1024 * 1024; // 10MB in bytes
if (file.size > maxSize) {
toastr.warning('File size should not exceed 10MB');
$(this).val(''); // Clear the input
return false;
}
// Display selected file name
var fileName = file.name;
if ($('#selected-file').length === 0) {
$('<div id="selected-file" class="mt-2 text-muted"><small>Selected file: <span id="file-name"></span></small></div>')
.insertAfter('#claim_dump_list');
}
$('#file-name').text(fileName);
}
});
$('body').on('click', '.reload', function() {
status = this.getAttribute('data-id')
console.log(status);
if (status == 'inprogress') {
window.location.reload(true);
}
})
});
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#tickets-table');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-7'f><'col-sm-5 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: [
{
text: 'Add',
className: 'buttons-html5 addbtnStyle',
action: function (e, dt, node, config) {
openDumpUploadModal();
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 15, // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
function fetchFileError(file_id) {
var url = '<?php echo base_url('util/getClaimDumpFileErrorData/'); ?>';
let requestData = { file_id: file_id };
var myModal = new bootstrap.Modal(document.getElementById('cliam-dump-file-err-modal'));
myModal.show();
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
$('#modal_body').empty();
if (response.status === true) {
var file_error_data = (JSON.parse(response.data));
var file_error_html = "";
for (var key in file_error_data['error_summary']) {
var err_id = parseInt(key);
var err_count = file_error_data['error_summary'][key];
switch (err_id) {
case 0:
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
break;
case 1:
file_error_html += "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 2:
file_error_html += "<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 3:
file_error_html += "<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 4:
file_error_html += "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 5:
file_error_html += "<strong>" + (file_error_data['error_data'] || 'Error data not available') + "</strong>";
break;
case 6:
file_error_html += "<strong>" + (file_error_data['error_data'] || 'Error data not available') + "</strong>";
break;
case 7:
file_error_html += "<strong>Claim already exist</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 8:
file_error_html += "<strong>Policy not found</strong> <span class='badge badge-warning float-right'>" +
err_count + "</span><br>";
break;
case 9:
file_error_html += "<strong>Employee not found</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 10:
file_error_html += "<strong>ACM not found</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
default:
file_error_html += "<strong>Unknown error type</strong> <span class='badge badge-secondary float-right'>" +
err_count + "</span><br>";
break;
}
}
if (err_id != 5 && err_id != 6 && err_id != 0) {
file_error_html += (file_error_html != "" ?
"<a href ='<?php echo base_url('util/claim_dump_excel_error/') ?>" + file_id +
"' target=_blank>click here to more details...</a>" : "");
}
// console.log(file_error_html);
$('#modal_body').append(file_error_html);
} else {
console.log('Response status was false');
$('#modal_body').append('<div class="alert alert-warning">No error data available.</div>');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error('Status:', status);
console.error('Response:', xhr.responseText);
// Show error message to user
$('#modal_body').empty().append(
'<div class="alert alert-danger">Failed to fetch error data. Please try again.</div>'
);
});
}
$('.close').click(function(){
$('#modal_body').empty()
let html = `<div class="spinner-border text-primary" role="status" style="position: relative; left: 200px;"></div>`
$('#modal_body').append(html);
});
function openDumpUploadModal() {
var myModal = new bootstrap.Modal(document.getElementById('claim-file-upload-modal'));
myModal.show();
}
</script>

View File

@ -138,8 +138,8 @@
border-radius:25px;
border:2px solid #09B9BF;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
min-width: 250px;
max-width: 250px;
min-width: 300px;
max-width: 300px;
}
#claims-dash-tab{
@ -161,7 +161,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,1)">
<div class="card-block">
<h4 class="mb-3">GMC</h4>
<h2 class="span-color"><span><?= isset($claim_data[1]['total']) ? $claim_data[1]['total'] : '0' ?></span></h2>
<h2 ><span class="span-color"><?= isset($claim_data[1]['total']) ? $claim_data[1]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GMC Records</span></h6>
</div>
</div>
@ -171,7 +171,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,2)">
<div class="card-block">
<h4 class="mb-3">GPA</h4>
<h2 class="span-color"><span><?= isset($claim_data[2]['total']) ? $claim_data[2]['total'] : '0' ?></span></h2>
<h2 ><span class="span-color"><?= isset($claim_data[2]['total']) ? $claim_data[2]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GPA Records</span></h6>
</div>
</div>
@ -180,7 +180,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,3)">
<div class="card-block">
<h4 class="mb-3">EDLI</h4>
<h2 class="span-color"><span><?= isset($claim_data[3]['total']) ? $claim_data[3]['total'] : '0' ?></span></h2>
<h2 ><span class="span-color"><?= isset($claim_data[3]['total']) ? $claim_data[3]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All EDLI Records</span></h6>
</div>
</div>
@ -189,7 +189,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,4)">
<div class="card-block">
<h4 class="mb-3">GTLI</h4>
<h2 class="span-color"><span><?= isset($claim_data[4]['total']) ? $claim_data[4]['total'] : '0' ?></span></h2>
<h2 ><span class="span-color"><?= isset($claim_data[4]['total']) ? $claim_data[4]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GTLI Records</span></h6>
</div>
</div>

View File

@ -49,7 +49,7 @@
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
</div>
<div class="table-responsive" id="branch_table">
@ -72,7 +72,7 @@
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack"
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list"
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted"
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>

View File

@ -570,20 +570,17 @@ body {
if (otherCard !== card) {
const otherContent = otherCard.querySelector('.card-content');
const otherIcon = otherCard.querySelector('.accordion-icon i');
otherContent.classList.remove('active');
otherIcon.classList.remove('mdi mdi-chevron-up');
otherIcon.classList.add('mdi mdi-chevron-down');
otherIcon.setAttribute('class', 'mdi mdi-chevron-down');
}
});
// Toggle current accordion
content.classList.toggle('active');
if (content.classList.contains('active')) {
icon.classList.remove('mdi mdi-chevron-down');
icon.classList.add('mdi mdi-chevron-up');
icon.classList.setAttribute('class', 'mdi mdi-chevron-up');
} else {
icon.classList.remove('mdi mdi-chevron-up');
icon.classList.add('mdi mdi-chevron-down');
icon.classList.setAttribute('class', 'mdi mdi-chevron-down');
}
}

View File

@ -51,7 +51,7 @@
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>

View File

@ -180,7 +180,7 @@ $(document).ready(function(){
}).prop('disabled', false);
$('#client_rm_btnSubmit').show();
$(this).html('<span id="rm_icons" class="fa fa-times-circle"></span> Close Edit ');
$(this).html('<span id="rm_icons" class="mdi mdi-close-circle-outline"></span> Close Edit ');
} else {
$('#account_manager').select2({
placeholder: "Select Account Manager"

View File

@ -287,12 +287,12 @@
<div class="form-group col-md-12">
<label for="email">Email<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" onchange="validateInput(this, 'employees', 'email_corporate')" required>
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'employees', 'email_corporate')" required>
</div>
<div class="form-group col-md-12">
<label for="mobile">Mobile Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" onchange="validateInput(this, 'employees', 'mobile')" required>
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" onkeyup="validateInput(this, 'employees', 'mobile')" required>
</div>
</div>
@ -570,21 +570,53 @@
});
}
function validateInput(input, table, field){
// function validateInput(input, table, field){
// let value = $(input).val();
// let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
// let message = "Value is duplicate!";
// if(label){
// message = label + " already exists!";
// }
// checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
// if (isDuplicate) {
// toastr.warning(message, 'WARNING');
// $(input).val('')
// }
// });
// }
function validateInput(input, table, field) {
let emp_code = $('#emp_code_for_edit').val();
let client_id = $('#clients').val();
console.log("emp_code", emp_code);
console.log("client_id", client_id);
let value = $(input).val();
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
let message = "Value is duplicate!";
if(label){
if (label) {
message = label + " already exists!";
}
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
let data = {};
data["emp_code !="] = emp_code;
data[field] = value;
console.log(data);
checkDuplicateTableFieldValue(table, field, data, function(isDuplicate) {
if (isDuplicate) {
toastr.warning(message, 'WARNING');
$(input).val('')
}
$("#btnSubmit").prop('disabled', true);
}else{
$("#btnSubmit").prop('disabled', false);
}
});
}
@ -597,108 +629,106 @@
}
var modalInstance; // Store the modal instance globally
function showModal() {
var myModalEl = document.getElementById('emp_history_modal');
modalInstance = new bootstrap.Modal(myModalEl, {
backdrop: true, // Ensures the backdrop is shown
keyboard: true // Allows closing with the Escape key
});
modalInstance.show();
}
function closeModal() {
if (modalInstance) {
modalInstance.hide(); // Hide the modal and its backdrop
// Manually remove backdrop if it's still visible
setTimeout(function () {
document.querySelector('.modal-backdrop').classList.remove('show');
}, 150); // Wait for animation to finish
function showModal() {
var myModalEl = document.getElementById('emp_history_modal');
modalInstance = new bootstrap.Modal(myModalEl, {
backdrop: true, // Ensures the backdrop is shown
keyboard: true // Allows closing with the Escape key
});
modalInstance.show();
}
}
function closeModal() {
if (modalInstance) {
modalInstance.hide(); // Hide the modal and its backdrop
// Manually remove backdrop if it's still visible
setTimeout(function () {
document.querySelector('.modal-backdrop').classList.remove('show');
}, 150); // Wait for animation to finish
}
}
function get_emp_history(input, emp_id) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
let url = '<?= base_url("employee/get_emp_history")?>';
let requestData = { emp_id: emp_id };
let url = '<?= base_url("employee/get_emp_history")?>';
let requestData = { emp_id: emp_id };
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (response.status === true) {
console.log('response data length', response.data.emp_history.length);
if (response.status === true) {
console.log('response data length', response.data.emp_history.length);
// **Clear old data**
$('#emp_history_content').html('');
// **Clear old data**
$('#emp_history_content').html('');
// **Check if data exists**
if (response.data.emp_history.length > 0) {
let historyTable = `
<div class="card-body">
<div class="table-responsive">
<table class="table w-100">
<thead class="bg-light">
<tr>
<th>Field</th>
<th>Change</th>
<th>User</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
`;
// **Loop through the data dynamically**
response.data.emp_history.forEach(row => {
historyTable += `
<tr>
<td>${row.field_name}</td>
<td>${row.old_value} => ${row.new_value}</td>
<td>${row.created_by}</td>
<td>${row.created_at}</td>
</tr>
// **Check if data exists**
if (response.data.emp_history.length > 0) {
let historyTable = `
<div class="card-body">
<div class="table-responsive">
<table class="table w-100">
<thead class="bg-light">
<tr>
<th>Field</th>
<th>Change</th>
<th>User</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
`;
});
historyTable += `
</tbody>
</table>
// **Loop through the data dynamically**
response.data.emp_history.forEach(row => {
historyTable += `
<tr>
<td>${row.field_name}</td>
<td>${row.old_value} => ${row.new_value}</td>
<td>${row.created_by}</td>
<td>${row.created_at}</td>
</tr>
`;
});
historyTable += `
</tbody>
</table>
</div>
</div>
</div>
`;
`;
// **Append to modal**
$('#emp_history_content').append(historyTable);
// **Append to modal**
$('#emp_history_content').append(historyTable);
} else {
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>');
}
// **Show the modal**
showModal();
} else {
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
// **Show the modal**
showModal();
} else {
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
// function closeModal(){
// var myModalEl = document.getElementById('emp_history_modal');
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
// if (modalInstance) {
// modalInstance.hide();
// }
// }
// function closeModal(){
// var myModalEl = document.getElementById('emp_history_modal');
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
// if (modalInstance) {
// modalInstance.hide();
// }
// }
</script>

View File

@ -129,7 +129,6 @@ option:disabled {
</div>
<div id="full-width-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-full-width">
@ -148,8 +147,6 @@ option:disabled {
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Center modal content -->
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
@ -167,6 +164,11 @@ option:disabled {
<script>
var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0;
$('#file_upload').hide();
$(document).ready(function() {
@ -181,15 +183,6 @@ $(document).ready(function() {
});
// Declare a global variable to store API response data
var clientPolicies = [];
var clientPoliciesWithBranch = {
policies: []
};
var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0;
$(document).ready(function() {
// console.log("document loaded");
@ -330,8 +323,6 @@ $(document).ready(function() {
$(window).on("load", function() {
console.log("window loaded");
fetchClientPolicies();
// Get the current page URL
const url = window.location.href;
@ -368,87 +359,88 @@ $(window).on("load", function() {
});
function fetchClientPolicies() {
$('#loader').show();
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
// console.log('fetchClientPolicies');
// console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
// function fetchClientPolicies() {
console.log(response);
// console.log(response.dataStatus);
// console.log(response.data);
// $('#loader').show();
// var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
// // console.log('fetchClientPolicies');
// // console.log(apiURL);
// $.ajax({
// url: apiURL,
// method: 'GET',
// headers: {
// "Content-Type": "application/json",
// "X-Requested-With": "XMLHttpRequest"
// },
// success: function(response) {
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
clientPolicies = (response.data)
// console.log(clientPolicies);
// console.log(response);
// // console.log(response.dataStatus);
// // console.log(response.data);
response.data.forEach(policy => {
// console.log('policies', policy.policies);
policy.policies.forEach(p => {
clientPoliciesWithBranch.policies.push(p);
});
});
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
// try {
// clientPolicies = (response.data)
// // console.log(clientPolicies);
// console.log(clientPoliciesWithBranch);
// response.data.forEach(policy => {
// // console.log('policies', policy.policies);
// policy.policies.forEach(p => {
// clientPoliciesWithBranch.policies.push(p);
// });
// });
appendClients(clientPolicies);
// // console.log(clientPoliciesWithBranch);
// appendClients(clientPolicies);
setTimeout(function() {
if (client_id_param != null ) {
var foundPolicies = clientPolicies.find(function(item) {
// console.log(typeof item.id)
return item.id == client_id_param;
});
appendBranch(foundPolicies.branchs);
}
}, 500);
// setTimeout(function() {
// if (client_id_param != null ) {
// var foundPolicies = clientPolicies.find(function(item) {
// // console.log(typeof item.id)
// return item.id == client_id_param;
// });
// appendBranch(foundPolicies.branchs);
// }
// }, 500);
setTimeout(function() {
if (client_branch_id_param != null ) {
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
// console.log('item', item);
return item.branch_id === client_branch_id_param;
});
// setTimeout(function() {
// if (client_branch_id_param != null ) {
// var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
// // console.log('item', item);
// return item.branch_id === client_branch_id_param;
// });
if (foundPolicies) {
// console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} else {
console.log('No policies found for the selected client');
}
}
}, 500);
// if (foundPolicies) {
// // console.log('foundPolicies', foundPolicies);
// appendPolicies(foundPolicies);
// } else {
// console.log('No policies found for the selected client');
// }
// }
// }, 500);
} catch (error) {
console.error('Error parsing API response data:', error);
}
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
console.error(xhr.responseText);
}
});
// } catch (error) {
// console.error('Error parsing API response data:', error);
// }
// } else if (response.code === 404 && response.dataStatus === false) {
// console.error('no data found', response);
// } else {
// console.error('Something went wrong!');
// }
// },
// error: function(xhr, status, error) {
// console.error('Error fetching data from API:', error);
// console.error(xhr.responseText);
// }
// });
$('#loader').hide();
}
// $('#loader').hide();
// }
function fetchFileError(file_id) {
@ -593,7 +585,6 @@ function fetchFileError(file_id) {
$('#loader').hide();
}
function appendClients(data) {
// console.log('client_id_param', client_id_param)
@ -610,7 +601,6 @@ function appendClients(data) {
});
}
function appendBranch(data) {
$('#branch_id').empty();
@ -630,7 +620,6 @@ function appendBranch(data) {
});
}
function appendPolicies(data) {
// console.log(data)
@ -645,14 +634,11 @@ function appendPolicies(data) {
$.each(data, function(index, item) {
// console.log(item)
var option = $('<option>', {
value: item.client_policy_id,
// text:`${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
value: item.id,
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
});
if (client_policy_param == item.client_policy_id) {
if (client_policy_param == item.id) {
option.attr('selected', true);
}
$('#policy_id').append(option);
@ -664,51 +650,25 @@ $(document).ready(function() {
$('#client_id').on('change', function() {
$('#policy_id').empty();
let client_id = $(this).val();
console.log('client_id', client_id);
$('#policy_id').append($('<option>', {
value: '',
text: 'Select'
}));
var selectedClient = $(this).val();
// console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
console.log('foundPolicies.branchs', foundPolicies.branchs);
appendBranch(foundPolicies.branchs);
if(branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch(data);
}
});
});
$(document).ready(function() {
$('#branch_id').on('change', function() {
var selectedClient = $(this).val();
// console.log('selectedBranch', selectedClient);
// console.log('clientPolicies', clientPoliciesWithBranch);
let branch_id = $(this).val();
console.log("branch_id", branch_id);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
// console.log('item', item);
return item.branch_id === selectedClient;
});
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else {
// console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
if(policy_list != '' && branch_id != '') {
let data = policy_list[branch_id];
appendPolicies(data);
}
});

View File

@ -166,6 +166,10 @@
color:#09B9BF;
}
.diff-span-color{
color: #0EB96E !important;
}
.endorsement-div{
margin-left:20px;
}
@ -215,7 +219,7 @@
<span class="span-color"><?= $pendingActionsData['uhid'] ?></span>
</h2>
<h6 class="text-right">
<span class="span-color f-left">Exported : <?= $pendingActionsData['uhid_export_count'] ?></span>
<span class="diff-span-color f-left">Exported : <?= $pendingActionsData['uhid_export_count'] ?></span>
<span class="text-danger">Not Exported : <?= $pendingActionsData['uhid_not_export_count'] ?></span>
</h6>
@ -232,7 +236,7 @@
<span class="span-color"><?= $pendingActionsData['tpa'] ?></span>
</h2>
<h6 class="text-right">
<span class="span-color f-left">Exported : <?= $pendingActionsData['tpa_export_count'] ?></span>
<span class="diff-span-color f-left">Exported : <?= $pendingActionsData['tpa_export_count'] ?></span>
<span class="text-danger">Not Exported : <?= $pendingActionsData['tpa_not_export_count'] ?></span>
</h6>
@ -249,8 +253,8 @@
<span class="span-color"><?= $pendingActionsData['correction'] ?></span>
</h2>
<h6 class="tex-right">
<span class="span-color">Exported : <?= $pendingActionsData['correction_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <span ><?= $pendingActionsData['correction_not_export_count'] ?></span></span>
<span class="diff-span-color">Exported : <?= $pendingActionsData['correction_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <?= $pendingActionsData['correction_not_export_count'] ?></span>
</h6>
</div>
@ -266,8 +270,8 @@
<span class="span-color"><?= $pendingActionsData['deletion'] ?></span>
</h2>
<h6>
<span class="span-color">Exported : <?= $pendingActionsData['deletion_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <span ><?= $pendingActionsData['deletion_not_export_count'] ?></span></span>
<span class="diff-span-color">Exported : <?= $pendingActionsData['deletion_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <?= $pendingActionsData['deletion_not_export_count'] ?></span>
</h6>
</div>
@ -283,8 +287,8 @@
<span class="span-color"><?= $pendingActionsData['si_enhancement'] ?></span>
</h2>
<h6>
<span class="span-color">Exported : <?= $pendingActionsData['si_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <span ><?= $pendingActionsData['si_not_export_count'] ?></span></span>
<span class="diff-span-color">Exported : <?= $pendingActionsData['si_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <?= $pendingActionsData['si_not_export_count'] ?></span>
</h6>
</div>

View File

@ -138,7 +138,7 @@
}
?>
</td>
<td class="text-center"><a href="#" data-id="<?php echo $employee['id'] ?>" class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal" data-target="#centermodal"></a>
<td class="text-center"><a href="#" data-id="<?php echo $employee['id'] ?>" class="mdi mdi-eye emp_data_model" aria-hidden="true" data-toggle="modal" data-target="#centermodal"></a>
</td>
</tr>
<?php }

View File

@ -19,7 +19,7 @@
<div class="card-header" onclick="toggleAccordion(this)">
<div class="user-info">
<h5 class="mb-0"><?= $value['hr_name'] ?>
<!-- <i class="fa fa-info-circle" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> -->
<!-- <i class="mdi mdi-information-outline" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> -->
</h5>
<p class="user-email"><?= $value['hr_mail'] ?></p>
</div>
@ -38,7 +38,7 @@
value="1" <?php if (in_array(1, $value['allowed_pre_modules'] ?? [])) {
echo 'checked';
} ?>>
<i class="fas fa-user-plus mr-2"></i>Pre enrollment
<i class="mdi mdi-account-plus mr-2"></i>Pre enrollment
</div>
<div class="<?= in_array(1, $value['allowed_pre_modules']) ? 'checkbox-group' : 'checkbox-group hidden' ?>" id="<?= 'user' . $key ?>-pre">
@ -84,7 +84,7 @@
value="2" <?php if (in_array(2, $value['allowed_post_modules'])) {
echo 'checked';
} ?>>
<i class="fas fa-check-circle mr-2"></i>Active policies
<i class="mdi mdi-check-circle mr-2"></i>Active policies
</div>
<div class="<?php if (in_array(2, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-active">
@ -128,7 +128,7 @@
<div class="section-title">
<input type="checkbox" class="main-checkbox"
onchange="toggleSection(this, '<?= 'user' . $key ?>-cd')" name="<?= 'user' . $key ?>_modules" value="3" <?php if (in_array(3, $value['allowed_post_modules'])) { echo 'checked';} ?>>
<i class="fas fa-file-alt mr-2"></i>CD statement
<i class="mdi mdi-file mr-2"></i>CD statement
</div>
<div class="<?php if (in_array(3, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-cd">
@ -153,7 +153,7 @@
<div class="section">
<div class="section-title">
<input type="checkbox" class="main-checkbox" name="<?= 'user' . $key ?>_modules" value="4" <?php if (in_array(4, $value['allowed_post_modules'])) {echo 'checked';} ?>>
<i class="fas fa-clipboard-list mr-2"></i>Claims
<i class="mdi mdi-clipboard-text mr-2"></i>Claims
</div>
</div>
</div>
@ -173,7 +173,7 @@
</form>
<?php } else { ?>
<div class="submit-container"><b>There is no HR data</b></div>
<div class="submit-container"> <p align="center"> <b>There is no HR data</b></p> </div>
<?php } ?>
</div>
</div>

View File

@ -0,0 +1,451 @@
<style>
.select2-container .select2-selection--multiple .select2-selection__choice {
padding: 5px 7px 5px 0 !important;
color: #000000;
}
</style>
<div class="tab-pane fade" id="HR-DOC-tab">
<div class="row">
<div class="col-xl-12">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<!-- <div class="text-center"> -->
<form class="parsley-examples" id="hr_file_upload_search" >
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label>Client</label> <br />
<select name="client_id" class="form-control" id="client2" >
<option value="">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Branch</label> <br />
<select name="client_branch_id" class="form-control" id="client_branch_id2" >
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Policy</label> <br />
<select name="policy_id" class="form-control" id="policy2" >
<option value="">Select</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label>Event<span class="text-danger">*</span></label> <br />
<select name="file_action" class="form-control" id="event_type" required>
<option value="">Select</option>
<?php
if (isset($events) && count($events)) {
foreach ($events as $key => $action) {
if($key != "inception"){
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="form-row" id="">
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
<div class="form-group col-md-3">
<button type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Search</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row" id="hr_file_list">
<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;">Files</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
id="hr_tickets_table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">File name</th>
<th class="font-weight-medium">Client</th>
<th class="font-weight-medium">Client Branch</th>
<th class="font-weight-medium">Policy</th>
<th class="font-weight-medium">Event</th>
<th class="font-weight-medium">User/Time</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($HRfileList)) { foreach ($fileList as $key => $file) { ?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name']?>
</td>
<td><?php echo $file['short_name'] ?></td>
<td><?php echo $file['branch_name'] ?></td>
<td><?php echo $file['policy_no'] ?></td>
<td><?php echo $file['file_action'] ?></td>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?></td>
<td><?php echo $file['status']; ?> </td>
<td> </td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<!-- end row -->
</div>
<!-- Center modal content for reupload file-->
<div class="modal fade" id="hr-file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">Endorsement Upload</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="hrUploadForm" enctype="multipart/form-data">
<input type="hidden" id="hr_file_client_id" name="client_id">
<input type="hidden" id="hr_file_policy_id" name="policy_id">
<input type="hidden" id="hr_file_branch_id" name="branch_id">
<input type="hidden" id="hr_file_hr_file_id" name="hr_file_id">
<input type="hidden" id="hr_file_upload_actions" name="upload-action-type">
<input type="file" id="fileInput" name="emplist" required
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function(){
//client change to get the Client Branch
$('#client2').change(function(){
let client_id = $(this).val();
console.log('client_id', client_id);
if(branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch3(data);
}
})
//change the client branch than change the client policy
$('#client_branch_id2').change(function(){
let branch_id = $(this).val();
console.log("branch_id", branch_id);
if(policy_list != '' && branch_id != '') {
let data = policy_list[branch_id];
appendPolicy3(data);
}
});
})
$(document).ready(function() {
// Initialize select2
$("#client2").select2();
$("#policy2").select2();
$("#client_branch_id2").select2();
// Form submit event
$("#hr_file_upload_search").on("submit", function (e) {
e.preventDefault(); // stop normal form submit
let formData = $(this).serialize(); // serialize form with csrf
var baseurl = `<?= base_url() ?>`;
$.ajax({
url: "<?= base_url('hrFileList') ?>",
type: "POST",
data: formData,
dataType: "json",
beforeSend: function () {
// optional loader
$("#hr_tickets_table tbody").html(
"<tr><td colspan='9' class='text-center'>Loading...</td></tr>"
);
},
success: function (res) {
let tbody = "";
if (res.status === "success" && res.data.length > 0) {
$.each(res.data, function (index, file) {
tbody += `
<tr>
<td><b>${index + 1}</b></td>
<td id="${file.id}" class="reload truncate" title="${file.file_name}">${file.file_name}</td>
<td>${file.short_name ?? ""}</td>
<td>${file.branch_name ?? ""}</td>
<td>${file.policy_no ?? ""}</td>
<td>${formatTextToCamelCase(file.file_action) ?? ""}</td>
<td>${file.created_at} by <strong>${file.first_name ?? ""}</strong></td>
<td>${file.status}</td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="${baseurl}/hrFileDownload?id=${file.id}" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<a class="dropdown-item" onclick="uploadEndorsementFile(${file.client_id}, ${file.client_branch_id}, ${file.policy_id}, ${file.id}, '${file.file_action}')" style="color: #000;" aria-hidden="true"><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Initiate Endorsement</a>
</div>
</div>
</td>
</tr>
`;
});
} else {
tbody = `<tr><td colspan="9" class="text-center">No records found</td></tr>`;
}
$("#hr_tickets_table tbody").html(tbody);
},
error: function (xhr, status, error) {
console.error("Error:", error);
$("#hr_tickets_table tbody").html(
`<tr><td colspan="9" class="text-center text-danger">Something went wrong</td></tr>`
);
},
});
});
});
// ------------ Append Functions are Below ----------------------------------------------------------------------------------
function appendClients3(data)
{
$('#client2').empty();
$('#client2').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + (item.dob ? ('- (' + item.dob + ' )' ) : '') + (item.pan ? ('- ' + item.pan ) : '');
// console.log(client_show_name);
}
var option = $('<option>', {
value: item.id,
text: client_show_name,
'data-cn': item.client_name,
'data-ct': item.client_type,
});
$('#client2').append(option);
});
}
function appendBranch3(data)
{
$('#client_branch_id2').empty();
$('#client_branch_id2').append($('<option>', {
value: '',
text: 'Select Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch_id2').append(option);
});
}
function appendPolicy3(data)
{
$('#policy2').empty();
$('#policy2').append($('<option>', {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#policy2').append(option);
});
}
// ----------------------------------------------------------------------------------------------
// for datatable
$(document).ready(function() {
$('#hr_tickets_table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{
"extend": 'csv',
"text": 'CSV',
"title": 'Employee-Upload-List',
"className": 'my_class',
"exportOptions": {
"columns": ':not(:last-child)'
},
}],
"initComplete": function(settings, json) {
$('.my_class').css({
"position": "relative",
"left": "79px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true,
});
});
//for initialize the file upload for the files table
function uploadEndorsementFile(client_id, branch_id, policy_id, file_id, event){
console.log(client_id, branch_id, policy_id, file_id, event);
$('#hr_file_client_id').val(client_id);
$('#hr_file_branch_id').val(branch_id);
$('#hr_file_policy_id').val(policy_id);
$('#hr_file_upload_actions').val(event);
$('#hr_file_hr_file_id').val(file_id);
var myModal = new bootstrap.Modal(document.getElementById('hr-file-upload-modal'));
myModal.show();
}
//hr file upload reupload to the files table
$('#hrUploadForm').submit(function(e) {
e.preventDefault();
var isValid = $('#hrUploadForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return;
}
// Create FormData object
var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]);
}
// return false;
$.ajax({
url: `<?= base_url('employee/upload') ?>`,
type: "POST",
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Let jQuery handle the content type
headers: {
// "Content-Type":"multipart/form-data",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
$('#hrUploadForm')[0].reset();
if (response.code === 200 && response.dataStatus === true && response
.data !== "") {
toastr.success(
'File upload successs, Data validation is in-progress',
'success');
$('.close').click()
window.location.reload(true);
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
// alert(response.message);
toastr.error(response.message, 'Failed');
window.location.reload(true);
} else {
console.error('Something went wrong!');
// alert('Something went wrong! Try later');
toastr.error('Something went wrong! Try later', 'Error');
window.location.reload(true);
}
$('.close').click();
},
error: function(xhr, status, error) {
// Request failed, handle error
console.error("Request failed:", status, error);
toastr.error('Something went wrong! Try later', 'Error');
$('#hrUploadForm')[0].reset();
$('.close').click();
window.location.reload(true);
}
});
})
</script>

View File

@ -9,6 +9,51 @@
}
</style>
<script>
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
var branch_policy = '';
$(document).ready(function(){
getClientAndBranchAndPolicy();
})
//featch client and branch and policy
function getClientAndBranchAndPolicy()
{
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if(res.status == true){
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
appendClients(res.client_data);
appendClients2(res.client_data);
appendClients3(res.client_data);
}else{
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
</script>
<div class="row" id="client_add" style="position: relative; bottom: 25px;">
<div class="col-12">
<div class="card-body">
@ -25,18 +70,22 @@
<span class="d-none d-sm-inline-block">Insurer or TPA Data</span>
</a>
</li>
<li class="nav-item">
<a href="#HR-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="hr_tab">
<span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">HR Uploaded Files</span>
</a>
</li>
</ul>
<div class="tab-content">
<?php include('employee_upload.php'); ?>
<?php include('insurer_or_tpa_data.php'); ?>
<?php include('hr_file_upload.php'); ?>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
@ -45,8 +94,17 @@
$('#kyc_tab').click();
}
if (window.location.hash === '#HR-DOC-tab') {
console.log('url hash :', window.location.hash)
$('#hr_tab').click();
}
})
function formatTextToCamelCase(str) {
return str
.replace(/_/g, ' ') // replace underscores with spaces
.toLowerCase() // convert everything to lowercase
.replace(/\b\w/g, char => char.toUpperCase()); // capitalize each word
}
</script>

View File

@ -1,7 +1,7 @@
<div class="tab-pane fade" id="branch-tab">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
</div>
<div class="table-responsive" id="branch_table" >
@ -23,7 +23,7 @@
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>

View File

@ -131,6 +131,11 @@
<script>
var client_id_param2 = 0;
var client_branch_id_param2 = 0;
var client_policy_param2 = 0;
$(document).ready(function() {
// Initialize select2
$("#client").select2();
@ -139,16 +144,6 @@
});
// Declare a global variable to store API response data
var clientPolicies = [];
var clientPoliciesWithBranch2 = {
policies: []
};
var client_id_param2 = 0;
var client_branch_id_param2 = 0;
var client_policy_param2 = 0;
$(document).ready(function() {
<?php if (session()->has('error')) : ?>
@ -231,9 +226,7 @@
});
$(window).on("load", function() {
fetchClientPolicies2();
// Get the current page URL
const url = window.location.href;
@ -284,82 +277,82 @@
});
function fetchClientPolicies2() {
// function fetchClientPolicies2() {
$('#loader').show();
// $('#loader').show();
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
// console.log(response.code);
// console.log(response.dataStatus);
// console.log(response.data);
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
clientPolicies = (response.data);
// console.log(clientPolicies);
// var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
// $.ajax({
// url: apiURL,
// method: 'GET',
// headers: {
// "Content-Type": "application/json",
// "X-Requested-With": "XMLHttpRequest"
// },
// success: function(response) {
// // console.log(response.code);
// // console.log(response.dataStatus);
// // console.log(response.data);
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
// try {
// clientPolicies = (response.data);
// // console.log(clientPolicies);
response.data.forEach(policy => {
// console.log('policies', policy.policies);
policy.policies.forEach(p => {
clientPoliciesWithBranch2.policies.push(p);
});
});
// response.data.forEach(policy => {
// // console.log('policies', policy.policies);
// policy.policies.forEach(p => {
// clientPoliciesWithBranch2.policies.push(p);
// });
// });
appendClients2(clientPolicies);
// appendClients2(clientPolicies);
setTimeout(function() {
if (client_branch_id_param2 != null) {
var foundPolicies = clientPolicies.find(function(item) {
// console.log(typeof item.id)
return item.id == client_id_param2;
});
appendBranch2(foundPolicies.branchs);
}
}, 500);
// setTimeout(function() {
// if (client_branch_id_param2 != null) {
// var foundPolicies = clientPolicies.find(function(item) {
// // console.log(typeof item.id)
// return item.id == client_id_param2;
// });
// appendBranch2(foundPolicies.branchs);
// }
// }, 500);
setTimeout(function() {
if (client_id_param2 != null) {
// setTimeout(function() {
// if (client_id_param2 != null) {
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
// console.log('item', item);
return item.branch_id === client_branch_id_param2;
});
// var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
// // console.log('item', item);
// return item.branch_id === client_branch_id_param2;
// });
if (foundPolicies) {
// console.log('foundPolicies', foundPolicies);
appendPolicies2(foundPolicies);
} else {
console.log('No policies found for the selected client');
}
}
}, 500);
// if (foundPolicies) {
// // console.log('foundPolicies', foundPolicies);
// appendPolicies2(foundPolicies);
// } else {
// console.log('No policies found for the selected client');
// }
// }
// }, 500);
} catch (error) {
console.error('Error parsing API response data:', error);
}
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
// console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
}
});
// } catch (error) {
// console.error('Error parsing API response data:', error);
// }
// } else if (response.code === 404 && response.dataStatus === false) {
// console.error('no data found', response);
// } else {
// // console.error('Something went wrong!');
// }
// },
// error: function(xhr, status, error) {
// console.error('Error fetching data from API:', error);
// }
// });
$('#loader').hide();
}
// $('#loader').hide();
// }
function appendClients2(data) {
@ -408,11 +401,10 @@
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.client_policy_id,
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
value: item.id,
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
});
if (client_policy_param2 == item.client_policy_id) {
if (client_policy_param2 == item.id) {
option.attr('selected', true);
}
$('#policy').append(option);
@ -423,50 +415,25 @@
$('#client').on('change', function() {
$('#policy').empty();
$('#policy').append($('<option>', {
value: '0',
text: 'Select'
}));
let client_id = $(this).val();
console.log('client_id', client_id);
var selectedClient = $(this).val();
// console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
// console.log(foundPolicies.branchs);
appendBranch2(foundPolicies.branchs);
if(branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch2(data);
}
});
});
$(document).ready(function() {
$('#client_branch_id').on('change', function() {
var selectedClient = $(this).val();
let branch_id = $(this).val();
console.log("branch_id", branch_id);
// console.log('selectedBranch', selectedClient);
// console.log('clientPolicies', clientPoliciesWithBranch2);
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
return item.branch_id === selectedClient;
});
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
appendPolicies2(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else {
// console.log('foundPolicies', foundPolicies);
appendPolicies2(foundPolicies);
if(policy_list != '' && branch_id != '') {
let data = policy_list[branch_id];
appendPolicies2(data);
}
});

View File

@ -1,7 +1,7 @@
<div class="tab-pane fade" id="branch-tab">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add KYC Docs</button>
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add KYC Docs</button>
</div>
<div class="table-responsive" id="branch_table" >
@ -22,7 +22,7 @@
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>

View File

@ -791,7 +791,7 @@
});
}
fetchPendingAction()
// fetchPendingAction()
$('#messages-list-2').on('click', 'li', function(event) {

View File

@ -249,7 +249,7 @@
/* Force all text across the entire app to black */
html, body, * {
color: #000 !important;
color: #000 !important;
}
@ -429,6 +429,7 @@
.search-bar input {
width: 100%;
padding-right: 40px; /* make space for the button */
border-radius: 10px !important;
background-color: #F4F4F4;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
@ -510,6 +511,162 @@
font-weight: 600!important;
}
/*
#E26728 (base)
#B8521F (darker 1)
#9C461B (darker 2)
#803A16 (darker 3)
rgba(226, 103, 40, 0.5) (transparent)
#00999E (base)
#007A7E (darker 1)
#006C70 (darker 2)
#005D61 (darker 3)
rgba(0, 153, 158, 0.5) (transparent)
*/
.app-field-grey {
background-color: #ECECEC !important;
}
.app-font-family,
.app-font-family *:not(.mdi):not(.fa):not(.material-icons) {
font-family: 'Poppins' !important;
}
.app-title { font-size: 18px; }
.app-heading { font-size: 16px; }
.app-subtitle { font-size: 14px; }
.app-text { font-size: 12px; }
.title-text {
font-weight: 500;
font-style: normal;
font-size: 30px;
line-height: 1;
letter-spacing: 0;
}
.sub-title-text {
font-weight: 500;
font-style: normal;
font-size: 18px;
line-height: 1;
letter-spacing: 0;
}
.app-text-left {
text-align: left !important; }
.app-text-right {
text-align: right !important; }
.app-text-center {
text-align: center !important; }
.app-text-white {
color: #ffffff !important; }
.app-text-black {
color: #000000 !important; }
.app-text-grey {
color: #5D5D5D !important; }
.app-text-primary {
color: #00999E !important; }
.app-text-secondary {
color: #E26728 !important; }
.app-text-success {
color: #1abc9c !important; }
a.app-text-primary:hover, a.app-text-primary:focus {
color: rgba(0, 153, 158, 0.5); !important; }
a.app-text-secondary:hover, a.app-text-secondary:focus {
color: rgba(226, 103, 40, 0.5) !important; }
a.app-text-success:hover, a.app-text-success:focus {
color: #117964 !important; }
.app-btn-primary {
color: #fff !important;
background-color: #00999E;
border-color: #00999E; }
.app-btn-primary:hover {
color: #fff !important;
background-color: #007A7E;
border-color: #006C70; }
.app-btn-primary:focus, .app-btn-primary.focus {
color: #fff !important;
background-color: #007A7E;
border-color: #006C70;
box-shadow: 0 0 0 0.15rem rgba(0, 153, 158, 0.5); }
.app-btn-primary.disabled, .app-btn-primary:disabled {
color: #fff !important;
background-color: #00999E;
border-color: #00999E; }
.app-btn-primary:not(:disabled):not(.disabled):active, .app-btn-primary:not(:disabled):not(.disabled).active,
.show > .app-btn-primary.dropdown-toggle {
color: #fff !important;
background-color: #006C70;
border-color: #005D61; }
.app-btn-primary:not(:disabled):not(.disabled):active:focus, .app-btn-primary:not(:disabled):not(.disabled).active:focus,
.show > .app-btn-primary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.15rem rgba(0, 153, 158, 0.5); }
.app-btn-secondary {
color: #fff !important;
background-color: #E26728;
border-color: #E26728; }
.app-btn-secondary:hover {
color: #fff !important;
background-color: #B8521F;
border-color: #9C461B; }
.app-btn-secondary:focus, .app-btn-secondary.focus {
color: #fff !important;
background-color: #E26728;
border-color: #9C461B;
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
.app-btn-secondary.disabled, .app-btn-secondary:disabled {
color: #fff !important;
background-color: #E26728;
border-color: #E26728; }
.app-btn-secondary:not(:disabled):not(.disabled):active, .app-btn-secondary:not(:disabled):not(.disabled).active,
.show > .app-btn-secondary.dropdown-toggle {
color: #fff !important;
background-color: #9C461B;
border-color: #803A16; }
.app-btn-secondary:not(:disabled):not(.disabled):active:focus, .app-btn-secondary:not(:disabled):not(.disabled).active:focus,
.show > .app-btn-secondary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
.app-btn-border-radius{ border-radius: 10px !important; }
.app-badge-primary {
color: #ffffff;
background-color: #00999E; }
a.app-badge-primary:hover, a.app-badge-primary:focus {
color: #ffffff;
background-color: #007A7E; }
a.app-badge-primary:focus, a.app-badge-primary.focus {
outline: 0;
box-shadow: 0 0 0 0.15rem rgba(0, 153, 158, 0.5); }
.app-badge-secondary {
color: #ffffff;
background-color: #E26728; }
a.app-badge-secondary:hover, a.app-badge-secondary:focus {
color: #ffffff;
background-color: #B8521F; }
a.app-badge-secondary:focus, a.app-badge-secondary.focus {
outline: 0;
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
</style>
@ -677,8 +834,11 @@
<a href="<?= base_url('/ticket/feedback-list') ?>">Claim Feedback List</a>
</li>
<li>
<a href="<?= base_url('/ticketList?return_type=web') ?>">Ticket List</a>
<a href="<?= base_url('/ticket/claim-upload') ?>">Claim Dump Upload</a>
</li>
<!-- <li>
<a href="<?= base_url('/ticketList?return_type=web') ?>">Ticket List</a>
</li> -->
</ul>
</div>
</li>
@ -694,7 +854,15 @@
</a>
</li>
<?php } ?>
<!-- Tickets -->
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
<li>
<a id="tickets" href="<?= base_url('/ticketList?return_type=web') ?>" class="waves-effect img-inactive-not-working">
<img src="<?= base_url() . "public"; ?>/assets/images/ticket.png" alt="Logo" height="20">
<span>Tickets</span>
</a>
</li>
<?php } ?>
<!-- BDS -->
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<li>

View File

@ -875,7 +875,7 @@
<?php } ?>
<li>
<a id="user_manual" href="<?= base_url("autobookstackLogin") ?>" class="waves-effect" target="_blank" rel="noopener noreferrer">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<i class="mdi mdi-information-outline" aria-hidden="true"></i>
<span>User Manual</span>
</a>
</li>

View File

@ -136,7 +136,7 @@
border-radius:25px;
border:2px solid #09B9BF;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
min-width: 250px;
min-width: 300px;
}
#leads-dash-tab{
@ -166,7 +166,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_
<div class="card dash-card" onclick="hide_and_show_tile(1,1)">
<div class="card-block">
<h4 class="mb-3">Leads</h4>
<h2 class="span-color"><span><?= isset($lead_data) ? $lead_data['total'] : 0 ?></span>
<h2 ><span class="span-color"><?= isset($lead_data) ? $lead_data['total'] : 0 ?></span>
</h2>
<h6><span class="text-danger">Lead Tracker</span></h6>
</div>
@ -176,8 +176,8 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_
<div class="card dash-card" onclick="hide_and_show_tile(1,2)">
<div class="card-block">
<h4 class="mb-3">BDS Renewals</h4>
<h2 class="span-color">
<span><?= isset($bds_renewal) ? $bds_renewal['total'] : 0 ?></span>
<h2 >
<span class="span-color"><?= isset($bds_renewal) ? $bds_renewal['total'] : 0 ?></span>
</h2>
<h6><span class="text-danger">Renewal Tracker</span></h6>
</div>

View File

@ -1,7 +1,7 @@
<div class="tab-pane fade" id="branch-tab">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policies</button>
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policies</button>
</div>
<div class="table-responsive" id="branch_table" >
@ -23,7 +23,7 @@
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>

View File

@ -317,7 +317,7 @@
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD &nbsp;&nbsp; <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD &nbsp;&nbsp; <i class="mdi mdi-information-outline" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
</div>
</div>
@ -652,9 +652,9 @@ $(document).ready(function(){
if(res.status == true){
if(res.data.length > 0){
$('#ct_type').val(2)
$('#cd_ac_pk').val(res.is_copay_yes.cd_ac_pk);
$('#cd_ac_no').val(res.cd_master_data.cd_ac_no ?? "");
$('#ct_type').val(2);
$('#cd_ac_pk').val(res?.is_copay_yes?.cd_ac_pk || "");
$('#cd_ac_no').val(res?.cd_master_data?.cd_ac_no || "");
$('#bro_payable_by').val(res.data[0].bro_payable_by);
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){

View File

@ -446,7 +446,7 @@
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD &nbsp;&nbsp; <i class="fa fa-info-circle info-icon" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD &nbsp;&nbsp; <i class="mdi mdi-information-outline info-icon" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
</label>
</div>
@ -532,7 +532,7 @@
</div>
<div class="form-group col-md-3">
<label for="installment">Installment &nbsp; <i id="infoIcon" class="fas fa-info-circle info-icon" data-toggle="tooltip" title="Click for Installment details" style="margin-left: 5px;"></i></label>
<label for="installment">Installment &nbsp; <i id="infoIcon" class="mdi mdi-information-outline info-icon" data-toggle="tooltip" title="Click for Installment details" style="margin-left: 5px;"></i></label>
<input id="installment" value="" type="text" class="form-control" name="installment">
</div>
@ -3975,14 +3975,6 @@ $('#policy_no').change(function(){
toastr.warning(res.message,'WARNING');
$('#policy_no').val("");
return;
}
if(res.status == true){
$('#ct_type').val(1);
$('#client_policy_id').val(res.data.id);
$('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date);
$('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
}else{
$('#ct_type').val(2);
$('#client_policy_id').val('');
@ -3991,6 +3983,14 @@ $('#policy_no').change(function(){
$('#tpa').val('').select2();
console.log(res.message, 'warning');
}
// if(res.status == true){
// $('#ct_type').val(1);
// $('#client_policy_id').val(res.data.id);
// $('#policy_start_date').val(res.data.policy_start_date);
// $('#policy_end_date').val(res.data.policy_end_date);
// $('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
// }
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
@ -3999,12 +3999,12 @@ $('#policy_no').change(function(){
});
}else{
$('#ct_type').val(2)
$('#ct_type').val(2);
$('#client_policy_id').val();
$('#policy_start_date').val();
$('#policy_end_date').val();
$('#tpa').val('').select2();
console.log("Could not get policy data")
console.log("This is new policy Could not get policy data")
}
});

View File

@ -321,7 +321,7 @@ table.dataTable tbody td {
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
</a>
</div>
@ -1668,9 +1668,14 @@ function hideDateField(input = null)
}
}
function removePolicyTransaction(input, pt_id) {
function removePolicyTransaction(input, pt_id, policy_type_id) {
confirmActionSweertAlert("Do you want to delete this transaction?", "Yes, Proceed!", "No, Cancel").then((confirmed) => {
let string = "Do you want to delete this transaction?";
if(policy_type_id > 7){
string = "Do you want to delete this transaction? Deleting this will also remove the linked CRM policy entry.";
}
confirmActionSweertAlert(string, "Yes, Proceed!", "No, Cancel").then((confirmed) => {
if (confirmed) {
let url = '<?= base_url('policy_tranction/inception/removePolicyTransaction/') ?>' + pt_id;
@ -1694,6 +1699,4 @@ function removePolicyTransaction(input, pt_id) {
});
}
</script>

View File

@ -75,7 +75,7 @@
<div class="form-group col-md-3 renewalFields" style="display: none;">
<span class="info-icon-wrapper">
<i class="fa fa-info-circle text-primary"></i>
<i class="mdi mdi-information-outline text-primary"></i>
<div class="info-tooltip">
<strong>Formulas:</strong><br>
1. Incurred Claims = Paid Claims + Outstanding Claims<br>

File diff suppressed because it is too large Load Diff

View File

@ -1,436 +1,569 @@
<style>
.bg-staff {
background-color: #FFF5E5;
.notes-box {
display: flex;
align-items: center;
border: 1px solid #00aaff;
border-radius: 6px;
padding: 5px;
}
.notes-box textarea {
flex: 1;
border: none;
outline: none;
resize: none;
padding: 8px;
font-size: 14px;
}
.icon-buttons {
display: flex;
gap: 6px;
margin-left: 5px;
}
.btn-icon {
background: #008b8b;
border: none;
border-radius: 50%;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.btn-icon i {
color: #ffffff !important;
font-size: 18px;
}
.conversation-card{
border-radius: 15px !important;
box-shadow: 0 2px 4px 0 #00000040;
}
.card-scroll{
overflow-y:auto;
min-height:380px;
max-height:380px;
}
.recard-scroll{
overflow-y:auto;
min-height:295px;
max-height:295px;
}
.edit-icon {
font-size: 17px; /* keep fixed size */
color: #555 !important;
cursor: pointer;
transition: transform 0.2s, color 0.2s; /* smooth hover effect */
display: inline-block; /* important for transform */
}
.edit-icon:hover {
color: #00999E !important;
transform: scale(1.5);
}
.maincard{
margin-top:0 !important;
padding-top: 0 !important;
}
.conversation-card,
.conversation-card .card-header,
.conversation-card .card-body {
background: #F5FFFF !important;
}
.master-card{
border-radius: 15px !important;
box-shadow: 0 2px 4px 0 #00000040;
}
</style>
<div class="row">
<div class="col-12">
<div class="card" style="margin-right: 23px;">
<div class="card-body">
<!-- Header Section -->
<div class="row mb-3">
<div class="col-6 d-flex align-items-center">
<h4 class="mb-0">Ticket</h4>
</div>
<div class="col-6 text-right">
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
</a>
</div>
</div>
<style>
.related-ticket-card
.related-ticket-card .card-header,
.related-ticket-card .card-body {
background: #F5FFFF !important;
overflow-y:auto;
box-shadow: 0 2px 4px 0 #00000040;
}
<!-- Navigation Tabs -->
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab"
aria-expanded="true">
<i class="mdi mdi-ticket-account"></i>
<span class="d-none d-sm-inline-block">General</span>
</a>
</li>
<li class="nav-item">
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab"
aria-expanded="false">
<i class="mdi mdi-note-text"></i>
<span class="d-none d-sm-inline-block">Notes</span>
</a>
</li>
</ul>
hr{
margin-top: 5px;
margin-bottom: 5px;
}
<!-- Tab Content -->
<div class="tab-content">
<div class="tab-pane fade show active" id="general-tab">
<div class="row">
<div class="col-12">
<div class="card-body">
<form role="form" class="parsley-examples" method="post" id="thz_form_data" onsubmit="submitTicket(event, this)" enctype="multipart/form-data">
<div class="form-group">
<h5>Ticket Master Details</h5>
<hr>
.related-ticket-card {
margin-bottom: 6px;
}
.related-ticket-card .card-body {
border-radius: 15px;
padding: 6px 15px !important;
}
.related-ticket-card h5,
.related-ticket-card p,
.related-ticket-card small {
margin: 0 !important;
}
<div class="form-row">
</style>
<style>
/* Select2 box */
.select2-container .select2-selection--single {
background-color: #ECECEC !important;
border: 1px solid #ccc !important;
height: 38px !important;
}
<div class="form-group col-md-3">
<label for="name">Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" placeholder="Enter Name" name="name" required>
</div>
/* Text inside */
.select2-container .select2-selection__rendered {
color: #000 !important;
line-height: 36px !important;
}
<div class="form-group col-md-3">
<label for="mobile">Mobile<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile" name="mobile" required>
</div>
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
background-color: #ECECEC !important;
}
</style>
<div class="form-group col-md-3">
<label for="email">Email Id<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="email" placeholder="Enter Email" name="Email" required>
</div>
<div class="form-group col-md-3">
<label for="empcode">Employee code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="empcode" placeholder="Enter Employee code" name="empcode" required>
</div>
<div class="form-group col-md-3">
<label for="policy_no">Policy Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="policy_no" placeholder="Enter Policy Number" name="policy_no" required>
</div>
<div class="form-group col-md-3">
<label for="ticket_type">Ticket Type<span class="text-danger">*</span></label>
<select class="form-control" id="ticket_type" name="ticket_type" required>
<option value="">Select Ticket Type</option>
<option value="Sales">Sales</option>
<option value="Service">Service</option>
</select>
</div>
<div class="col-12">
<div class="card ">
<div class="card-body maincard">
<!-- Title -->
<div class="row" id="notes-title" style="padding-bottom: 10px;">
<!-- <div class="col-6" style="align-self: center;">
<h4 style="position: relative;"><span onclick="history.back()"><i class="mdi mdi-chevron-left" style="font-size: 24px;"></i></span> Ticket ID-<?php echo $master[0]['thz_id']; ?></h4>
</div> -->
<h4 class="d-flex align-items-center" style="gap: 8px;">
<span onclick="history.back()" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</span>
<span class="title-text app-font-family">Ticket ID-<?= $master[0]['thz_id']; ?></span>
</h4>
</div>
<div class="form-group col-md-3">
<label for="modal_vehicle_no">Subject<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="subject" placeholder="Enter Subject" name="subject" required>
</div>
<!-- Body -->
<div class="row" id="notes-body">
<div class="form-group col-md-3">
<label for="message">Message<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="message" placeholder="Enter Message" name="message" required>
</div>
<div class="form-group col-md-3">
<label for="status">Status<span class="text-danger">*</span></label>
<select class="form-control" id="status" name="status" required>
<option value="">Select Status</option>
<option value="Open">Open</option>
<option value="In Progress">In Progress</option>
<option value="Resolved">Resolved</option>
<option value="Closed">Closed</option>
</select>
</div>
<div class="form-group col-md-6">
<label for="assign_to">Assign To<span class="text-danger">*</span></label>
<select class="form-control" id="Assign_to" name="assign_to" required>
<option value="">Select Assignee</option>
<?php if(isset($assignee)) { ?>
<?php foreach ($assignee as $value) { ?>
<option value="<?= $a['id']?>"><?= $a['emp_code'] ?> - <?= $a['first_name'] ?> <?= $a['last_name'] ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<input type="hidden" id="thz_id" name="thz_id">
</div>
<br><br>
</div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
</div>
</form>
<!-- Left Details -->
<div class="col-5" id="notes-body-left">
<div class="card master-card" style="background:#F5FFFF;">
<div class="card-header d-flex justify-content-between align-items-center" style="background:none; border:none;">
<p class="sub-title-text app-font-family mb-0">Details</p>
<?php if($master[0]['status'] !== "Closed") : ?>
<a href="javascript:void(0);" onclick="openEditTicket()">
<i class="mdi mdi-pencil edit-icon" title="Edit"></i>
<!-- <i class="mdi mdi-pencil"
title="Edit"
style="font-size:15px; color:#555; cursor:pointer; transition:0.2s;"
onmouseover="this.style.color='#02a8b5'; this.style.fontSize='17px';"
onmouseout="this.style.color='#555'; this.style.fontSize='15px';">
</i> -->
</a>
<?php endif; ?>
</div>
<div class="card-body card-scroll sub-title-text app-font-family" style="padding:0 27px !important; background:#F5FFFF;">
<div class="row mb-2 ml-o">
<div class="col-4 app-subtitle app-text-grey app-font-family">Ticket ID</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['thz_id'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Name</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['name'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Mobile</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['mobile'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Policy Number</div>
<div class="col-8 app-text text-end app-font-family" style="font-weight: 500 !important;">
<?= (!empty($master[0]['policy_no']) && strtolower($master[0]['policy_no']) !== 'null')
? '<u class="app-text-black">
<a href="javascript:void(0);"
class="app-text-black"
data-toggle="modal"
data-target="#PolicyModal"
title="Click to view Policy Terms"
data-id="'.$master[0]['policy_id'].'">'
.$master[0]['policy_no'].'
</a>
</u>'
: 'N/A'; ?>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="note-tab">
<div class="row">
<div class="col-12">
<div class="card-body">
<form role="form" class="parsley-examples" method="post" id="thz_note_form"
enctype="multipart/form-data">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-12">
<label for="ticket_note">Add Notes</label>
<textarea class="form-control" id="thz_notes" name="notes" rows="3"
placeholder="Enter Text"><?= isset($thz_note['notes']) ? $thz_note['notes'] : '' ?></textarea>
</div>
</div>
</div><input type="hidden" id="thz_notes_id">
<input type="hidden" id="thz_master_id">
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary" id="thz_note_submit">Submit</button>
</div>
</form>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Assigned To</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['assignee_name'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Status</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['status'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Ticket Type</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['ticket_type'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Subject</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important; text-align: justify;"><?= $master[0]['subject'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Message</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important; text-align: justify;"><?= $master[0]['message'];?></div>
</div>
<div class="row mb-2">
<div class="col-4 app-subtitle app-text-grey app-font-family">Related Tickets</div>
<div class="col-8 app-text text-end app-font-family" style="font-weight: 500 !important;">
<u class="text-warning">
<a href="javascript:void(0);"
class="text-warning"
data-toggle="modal"
data-target="#relatedTicketModal"
title="<?= empty($master[0]['created_by']) ? 'No related tickets' : 'Click to view related tickets'; ?>"
data-id="<?= $master[0]['created_by']; ?>">
View
</a>
</u>
</div>
</div> <!-- end col-->
</div>
<!-- add more fields -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="modal fade" id="member_data_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col-md-12">
<label for="acm_id">Insured Member<span class="text-danger"></span></label>
<select class="form-control" onchange="setMemberData(this)">
<option value="0">Select Insured Member</option>
<?php if (!empty($member_data)) : ?>
<?php foreach ($member_data as $value) : ?>
<option value="<?= isset($value['emp_code']) ? $value['emp_code'] : '' ?>"
data-empID="<?= isset($value['emp_id']) ? $value['emp_id'] : '' ?>"
data-empName="<?= isset($value['emp_name']) ? htmlspecialchars($value['emp_name'], ENT_QUOTES, 'UTF-8') : '' ?>"
data-policyNo="<?= isset($value['policy_no']) ? $value['policy_no'] : '' ?>"
data-tpaNo="<?= isset($value['tpa_no']) ? $value['tpa_no'] : '' ?>"
data-relationship="<?= isset($value['emp_relationship']) ? htmlspecialchars($value['emp_relationship'], ENT_QUOTES, 'UTF-8') : '' ?>">
<?= isset($value['emp_name']) && isset($value['emp_relationship'])
? htmlspecialchars($value['emp_name'] . ' - ' . $value['emp_relationship'], ENT_QUOTES, 'UTF-8')
: 'Unknown Member' ?>
</option>
<!-- Right Conversation -->
<div class="col-7">
<!-- Conversation Card -->
<div class="card mb-3 conversation-card">
<div class="card-header d-flex justify-content-between align-items-center" style="background:none; border:none; padding-bottom: 0px;">
<p class="sub-title-text app-font-family" >Conversation</p>
</div>
<div class="card-body recard-scroll" style="padding:0 27px !important; margin:0 !important; background:#F5FFFF;">
<?php if(!empty($notes)): ?>
<?php foreach($notes as $i => $conv): ?>
<div style="border:none; padding: 0px; margin: 0px;">
<hr/>
<!-- Top Row: Message + Badge -->
<div class="d-flex justify-content-between align-items-start app-text app-text-black app-font-family">
<p class="mb-1 ml-0 mr-0 app-font-family" style="font-weight: 400 !important;"><?= $conv['notes'] ?></p>
<!-- <?php if(!empty($conv['notes_by'])): ?>
<span class="badge bg-warning text-dark"><?= $conv['notes_by'] ?></span>
<?php endif; ?> -->
<?php if (!empty($conv['notes_type']) && $conv['notes_type'] === "Internal"): ?>
<span class="badge app-badge-secondary app-text-white app-font-family" style="font-size:10px;"><?= $conv['notes_type'] ?></span>
<?php endif; ?>
</div>
<!-- Bottom Row: Name + Date -->
<div class="d-flex justify-content-between small text-muted" style="padding-top: 5px;">
<span class="app-font-family" style="font-weight: 400 !important;"><i class="mdi mdi-account"></i> <?= $conv['name'] ?></span>
<span style="font-size:9px; font-weight: 400 !important;" class="app-font-family"><?= date("j F Y h:i a", strtotime($conv['created_at'])) ?></span>
</div>
<!-- <?php echo $i < count($notes)-1 ? '<hr/>' : ''; ?> -->
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="d-flex justify-content-center align-items-center app-font-family"
style="height: 45vh; width:100%;">
<p class="text-center app-font-family"><i>No Data Found</i></p>
</div>
<?php endif; ?>
</select>
</div>
</div>
<!-- Input Card -->
<div class="card">
<form id="conversationForm">
<input type="hidden" id="notes_type" name="notes_type">
<input type="hidden" id="thz_id" name="thz_id">
<input type="hidden" id="notes_by" name="notes_by" value="Staff">
<input type="hidden" id="created_by" name="created_by" value="<?= get_session_userid(); ?>">
<div class="notes-box">
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..." required maxlength="1500"></textarea>
<div class="icon-buttons">
<!-- save btn means local - internal -->
<button type="button" class="btn-icon" onclick="submitConverstionTicket('Internal')"><i class="mdi mdi-content-save"></i></button>
<!-- mail btn means notify - external -->
<button type="button" class="btn-icon" onclick="submitConverstionTicket('External')"><i class="mdi mdi-email"></i></button>
</div>
</div>
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary close" data-dismiss="modal" aria-label="Close">Submit</a>
</div>
</div> <!-- /notes-body -->
</div>
</div>
</div> -->
<div id="ticket_conversation_div">
<?php include("ticket_conversation.php") ?>
</div>
<?php //include("ticket_form_handler.php") ?>
<div class="modal fade app-text-black app-font-family" id="EditModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<form id="ticketForm">
<div class="modal-header">
<h4 class="modal-title title-text" id="EditModalLabel" style="font-size:27px !important">Update</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<input type="hidden" id="edit_thz_id" name="thz_id">
<input type="hidden" id="updated_by" name="updated_by" value="<?= get_session_userid(); ?>">
<div class="form-group col-md-12">
<label for="ticket_type" class="sub-title-text app-font-family">Ticket Type<span class="text-danger">*</span></label>
<select class="form-control" id="ticket_type" name="ticket_type" required>
<option value="">Select Ticket Type</option>
<option value="Sales">Sales</option>
<option value="Service">Service</option>
</select>
</div>
<div class="form-group col-md-12">
<label for="status" class="sub-title-text app-font-family">Status</label>
<select class="form-control" id="status" name="status">
<option value="">Select Status</option>
<option value="Open">Open</option>
<option value="In Progress">In Progress</option>
<option value="Resolved">Resolved</option>
<option value="Closed">Closed</option>
</select>
</div>
<!-- // enga 5-"head" and 1-"admin" assign pannvaga dropdown-data la varakudhathu. but dropdown display aganum
// 2,3,4 dropdown data'va varannum but dropdown hide pannanum -->
<?php if(in_array(get_role_id(), [1,5]) ) { ?>
<div class="form-group col-md-12">
<label for="assign_to" class="sub-title-text app-font-family">Assign To</label>
<select class="form-control" id="assign_to" name="assign_to">
<option value="">Select Assign To</option>
<?php if(isset($assignee)) { ?>
<?php foreach ($assignee as $a) { ?>
<option value="<?= $a['id']?>"><?= $a['emp_code'] ?> - <?= $a['first_name'] ?> <?= $a['last_name'] ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<?php } ?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn app-btn-secondary app-btn-border-radius" onclick="submitTicket()">Save</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade app-font-family" id="relatedTicketModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content" style="border-radius:15px;">
<div class="modal-header" style="border-bottom-width:0;">
<h4 class="modal-title title-text app-font-family" style="font-size:27px !important">Related Tickets</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body card-scroll" style="padding-top:5px!important;">
<?php if(!empty($related_tickets)): foreach($related_tickets as $j => $rt): ?>
<div class="card related-ticket-card app-font-family app-text"
style="cursor: pointer;"
onclick="window.location='<?= base_url().'/ticketConversationList?return_type=web&thz_id='.$rt['thz_id']; ?>'">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center" style="margin-bottom: 10px !important;">
<h5 class="app-font-family app-text"><?php echo '# '.$rt['thz_id']." / ".$rt['ticket_type']; ?></h5>
<small classs="app-font-family" style="font-size:7px;">
<?php if (!empty($rt['created_at'])):
$cdt = new DateTime($rt['created_at']);
echo $cdt->format('d/m/Y') . "<span class='time'> " . $cdt->format('h:i a') . "</span>";
endif; ?>
</small>
</div>
<p class="mt-1 app-font-family"
style="font-size:9px; font-weight:400; margin:4px;">
<?= $rt['subject'] ? $rt['subject'] : "&nbsp;"; ?>
</p>
<small class="app-font-family" style="font-size:7px;"><span style="color: green !important; font-weight: 500;">Status: </span><?php echo $rt['status']; ?></small>
</div>
</div>
<?php endforeach;
else: ?>
<div class="d-flex justify-content-center align-items-center"
style="height: 50vh; width:100%;">
<p class="text-center"><i>No Data Found</i></p>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="modal fade app-font-family" id="PolicyModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content" style="border-radius:15px;">
<div class="modal-header" style="border-bottom-width:0;">
<h4 class="modal-title title-text app-font-family">Policy Terms</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body card-scroll" style="padding-top:5px!important;">
<?php if(!empty($policy_terms)):
echo $policy_terms;
else: ?>
<div class="d-flex justify-content-center align-items-center"
style="height: 50vh; width:100%;">
<p class="text-center"><i>No Data Found</i></p>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script>
function submitClaimForm(event, form) {
event.preventDefault();
$(document).ready(function() {
// Initialize select2
$("#ticket_type").select2();
$("#status").select2();
$("#assign_to").select2();
const messageInput = document.getElementById("notes");
const messageCounter = document.getElementById("messageCounter");
var isValid = $('#ticket_form_data').parsley().validate();
messageInput.addEventListener("input", function () {
const messageLength = messageInput.value.length;
messageCounter.textContent = `${messageLength}/1500`;
if (!isValid) {
toastr.warning('Form validation failed. Please check the required fields.', 'WARNING');
return false;
if (messageLength > 1500) {
toastr.error('Message cannot exceed 1500 characters', 'Warning');
messageInput.classList.add('is-invalid');
} else {
messageInput.classList.remove('is-invalid');
}
});
});
function openEditTicket() {
var form = document.getElementById('ticketForm');
form.reset();
var masterData = <?= json_encode($master[0]); ?>;
console.log(masterData);
$("#edit_thz_id").val(masterData.thz_id);
$("#ticket_type").val(masterData.ticket_type).trigger("change");
$("#status").val(masterData.status).trigger("change");
$("#assign_to").val(masterData.assign_to).trigger("change");
$("#EditModalLabel").text("Update #" + masterData.thz_id);
var myModal = new bootstrap.Modal(document.getElementById('EditModal'));
myModal.show();
}
const formAction = '<?= base_url("ticket/update"); ?>';
// Show loader
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// Collect IDs and form data
const formData = new FormData(form);
// AJAX request
$.ajax({
data: formData,
url: formAction,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(response) {
// Hide loader
console.log('Form submitted response:', response);
if (response.status === true) {
location.reload();
toastr.success(response.message, 'SUCCESS');
} else {
toastr.error(response.message, 'ERROR');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
// Hide loader
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
}
function openFetchEmpDataodal() {
var myModal = new bootstrap.Modal(document.getElementById('member_data_modal'));
myModal.show();
}
function setMemberData(input) {is_head_approved
var selectedOption = $(input).find(':selected');
// Retrieve the data-* attributes
var empId = selectedOption.data('empid');
var empName = selectedOption.data('empname');
var policyNo = selectedOption.data('policyno');
var tpaNo = selectedOption.data('tpano');
var relationship = selectedOption.data('relationship');
$('#tpa_no').val(tpaNo);
$('#insured_emp_id').val(empId);
$('#insured_name').val(empName);
$('#policy_no').val(policyNo);
$('#relationship option').each(function() {
if ($(this).text() === relationship) {
$(this).prop('selected', true);
}
});
}
function showConfirmationModal(event) {
Swal.fire({
title: "Approve Claim Rejection",
// text: "Do you want to save this?",
icon: "warning",
showCancelButton: true,
showDenyButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#6c757d",
denyButtonColor: "#d33",
confirmButtonText: "Approve",
denyButtonText: "Reject",
cancelButtonText: "Cancel"
}).then((result) => {
if (result.isConfirmed) {
$('#is_head_approved').val(1);
console.log($('#ticket_form_data')[0])
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
} else if (result.isDenied) {
// Show second Swal for rejection reason
Swal.fire({
title: "Rejection Reason",
text: "Please provide a reason for rejection",
input: "textarea",
inputPlaceholder: "Enter your reason here...",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#6c757d",
confirmButtonText: "Submit",
cancelButtonText: "Back"
}).then((reasonResult) => {
if (reasonResult.isConfirmed) {
// Check if reason is not empty
if (reasonResult.value && reasonResult.value.trim() !== "") {
$('#is_head_approved').val(2);
$('#rejection_reason').val(reasonResult.value.trim());
console.log($('#ticket_form_data')[0]);
$('#head_rejection_reason').val(reasonResult.value.trim());
submitClaimForm(event, $('#ticket_form_data')[0]);
} else {
// Alert if reason is empty
Swal.fire({
title: "Error",
text: "Rejection reason cannot be empty",
icon: "error",
confirmButtonColor: "#3085d6"
}).then(() => {
// Go back to the rejection reason dialog
showConfirmationModal(event);
});
}
} else {
// If canceled, go back to first Swal
showConfirmationModal(event);
}
});
} else {
$('#is_head_approved').val(0);
return false;
}
});
}
</script>
<script>
$(document).ready(function() {
// Initialize select2
$("#ticket_type").select2();
$("#status").select2();
$("#assign_to").select2();
function submitTicket() {
var form = document.getElementById("ticketForm");
var id = form.querySelector("[name='thz_id']").value;
var formData = new FormData(form);
url = '<?= base_url('ThzControllernote/1'); ?>';
data = { id : $('#thz_master_id').val(), is_auto_query : 0};
$.ajax({
url:url,
data:data,
type:'POST',
success: function(res) {
if (res.status == true){
$('#thz_master_id').val(res.data.thz_id);
$('#thz_notes').val(res.data.notes);
$('#thz_notes_id').val(res.data.id);
$('#thz_notes_by').val('Staff');
$.ajax({
url: "<?= base_url('ticketSave') ?>",
type: "POST",
data: formData,
processData: false,
contentType: false,
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'Success');
$('#ticketModal').modal('hide');
form.reset();
window.location.href = "<?= base_url('ticketConversationList?return_type=web&thz_id=') ?>" + id;
} else {
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Went Wrong!', 'warning');
}, 1000);
}
})
$("#ticket_note_form").submit(function(event) {
event.preventDefault();
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var url = '<?= base_url("/ThzControllernote/2"); ?>';
var formData = $(this).serializeArray();
var ticket_id = $('#thz_master_id').val();
if (ticket_id != null && ticket_id != ''){
formData.push({ name: 'thz_id', value: ticket_id});
}
var primary_key = $('#thz_note_id').val();
if (primary_key != null && primary_key != ''){
formData.push({ name: 'id', value: primary_key});
}
console.log(formData);
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
if (response.status == true) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.success('Note Added Successfully','Success');
// console.log("Respone id is ")
// console.log(response.id);
$('#note_id').val(response.id);
// console.log($('#'))
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
});
}
});
function submitConverstionTicket(notetype) {
document.getElementById("notes_type").value = notetype;
const urlParams = new URLSearchParams(window.location.search);
document.getElementById("thz_id").value = urlParams.get('thz_id');
var id = urlParams.get('thz_id');
var form = document.getElementById("conversationForm");
// reset any old error styles
form.classList.remove('was-validated');
var notes = document.getElementById('notes').value.trim();
if (notes === "") {
toastr.warning('Please enter notes', 'Warning');
form.classList.add('was-validated');
return;
}
var formData = new FormData(form);
$.ajax({
url: "<?= base_url('ticketConversationSave') ?>",
type: "POST",
data: formData,
processData: false,
contentType: false,
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'Success');
form.reset();
window.location.href = "<?= base_url('ticketConversationList?return_type=web&thz_id=') ?>" + id;
} else {
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});
}
</script>

View File

@ -184,7 +184,7 @@
<div style="display: flex; align-items: center; gap: 10px;">
<h5 style="margin: 0;">
Claim Details
<i id="infoIcon" class="fas fa-info-circle info-icon" title="Click for more details" style="margin-left: 5px;"></i>
<i id="infoIcon" class="mdi mdi-information-outline info-icon" title="Click for more details" style="margin-left: 5px;"></i>
<?= isset($ticket_data['claim_number']) && !empty($ticket_data['claim_number']) ? '( Claim No : ' . $ticket_data['claim_number'] . ' )' : '' ?>
</h5>
</div>

View File

@ -142,7 +142,7 @@
<!-- end first_data_points -->
<br><br>
<h5>Claim Details <span><i id="infoIcon" class="fas fa-info-circle info-icon" title="Click for more details"></i></span></h5>
<h5>Claim Details <span><i id="infoIcon" class="mdi mdi-information-outline info-icon" title="Click for more details"></i></span></h5>
<hr>
<!-- second_data_points -->

View File

@ -148,9 +148,9 @@ table.dataTable tbody td {
if ($row['is_head_approved'] == 0) {
echo $row['status'] . '&nbsp;<i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 1) {
echo $row['status'] . '&nbsp;<i class="fa fa-check-circle" style="color:green;" aria-hidden="true"></i>';
echo $row['status'] . '&nbsp;<i class="mdi mdi-check-circle" style="color:green;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 2) {
echo $row['status'] . '&nbsp;<i class="fa fa-times-circle" style="color:red;" aria-hidden="true"></i>';
echo $row['status'] . '&nbsp;<i class="mdi mdi-close-circle-outline" style="color:red;" aria-hidden="true"></i>';
} else {
echo $row['status'];
}

View File

@ -1,7 +1,7 @@
<div class="tab-pane fade" id="branch-tab">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
</div>
<div class="table-responsive" id="branch_table" >
@ -23,7 +23,7 @@
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

100
test.http Normal file
View File

@ -0,0 +1,100 @@
POST https://testtips.vidalhealthtpa.com:7443/mobilerest/vidalbrokerservices/submitClaim
Authorization: Basic dmlkYWxicm9rZXJsb2dpbjp2aWRhbHN0YWdlQDEyMw==
Cookie: JSESSIONID=678ofNbsfB8svK1lyV6rON3w.worker1
Content-Type: multipart/form-data; boundary=WebApiBoundary
--WebApiBoundary
Content-Disposition: form-data; name="username"
Web_api
--WebApiBoundary
Content-Disposition: form-data; name="password"
Web@api
--WebApiBoundary
Content-Disposition: form-data; name="policyNo"
CI/TEST/POLICY/123456
--WebApiBoundary
Content-Disposition: form-data; name="enrollmentId"
BLR-RG-H0351-043-0000002-A
--WebApiBoundary
Content-Disposition: form-data; name="typeOfClaim"
Main hospitalization claim
--WebApiBoundary
Content-Disposition: form-data; name="claimSubType"
Hospitalization
--WebApiBoundary
Content-Disposition: form-data; name="requestedAmount"
4500
--WebApiBoundary
Content-Disposition: form-data; name="ailmentType"
Non covid
--WebApiBoundary
Content-Disposition: form-data; name="admissionDate"
20-03-2025
--WebApiBoundary
Content-Disposition: form-data; name="dischargeDate"
23-03-2025
--WebApiBoundary
Content-Disposition: form-data; name="hospitalName"
A G HOSPITAL NEW
--WebApiBoundary
Content-Disposition: form-data; name="empanelmentNo"
HOS-PON-010427
--WebApiBoundary
Content-Disposition: form-data; name="documentType"
Claim
--WebApiBoundary
Content-Disposition: form-data; name="ailmentName"
Cold
--WebApiBoundary
Content-Disposition: form-data; name="hospitalAddress"
abc
--WebApiBoundary
Content-Disposition: form-data; name="hospitalState"
karnataka
--WebApiBoundary
Content-Disposition: form-data; name="hospitalCity"
bangalore
--WebApiBoundary
Content-Disposition: form-data; name="hospitalPinCode"
560036
--WebApiBoundary
Content-Disposition: form-data; name="hospitalPhoneNo"
7656879899
--WebApiBoundary
Content-Disposition: form-data; name="File"; filename="tracker.pdf"
Content-Type: application/pdf
< ./C:\Users\jvadi\Downloads\Tickets - Business Show_ Chennai (India) (06_11_2025 14_00_00) - vadivel.pdf
--WebApiBoundary--
// claim