Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
1e5eb0ecf1
16
.env.sample
16
.env.sample
@ -33,11 +33,11 @@ database.default.DBDriver =
|
|||||||
|
|
||||||
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
|
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
|
||||||
# session.cookieName = 'ci_session'
|
# session.cookieName = 'ci_session'
|
||||||
#session.expiration = 28800
|
session.expiration =
|
||||||
# session.savePath = null
|
# session.savePath = null
|
||||||
# session.matchIP = false
|
# session.matchIP = false
|
||||||
# session.timeToUpdate = 300
|
session.timeToUpdate = 300
|
||||||
# session.regenerateDestroy = false
|
session.regenerateDestroy = false
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# LOGGER
|
# LOGGER
|
||||||
@ -81,16 +81,6 @@ cookie.secure = 'true';// if https set as true or if http set as false
|
|||||||
unlayer.projectID =
|
unlayer.projectID =
|
||||||
email.enquiryMail =
|
email.enquiryMail =
|
||||||
|
|
||||||
database.postDB.hostname =
|
|
||||||
database.postDB.database =
|
|
||||||
database.postDB.username =
|
|
||||||
database.postDB.password =
|
|
||||||
database.postDB.DBDriver =
|
|
||||||
database.postDB.DBPrefix =
|
|
||||||
database.postDB.port =
|
|
||||||
|
|
||||||
POST_ENROLLMENT_BASEURL =
|
|
||||||
|
|
||||||
#SMS
|
#SMS
|
||||||
SMS_API_KEY =
|
SMS_API_KEY =
|
||||||
SMS_SENDER_ID =
|
SMS_SENDER_ID =
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class Filters extends BaseConfig
|
|||||||
'before' => [
|
'before' => [
|
||||||
'HttpRequestLog' => ['except' => 'cli/*'],
|
'HttpRequestLog' => ['except' => 'cli/*'],
|
||||||
'Cors',
|
'Cors',
|
||||||
'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob']],
|
// 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']],
|
||||||
'SecurityInputFilter' => ['except' => ['notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ],
|
'SecurityInputFilter' => ['except' => ['notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ],
|
||||||
'GlobalPostFileUploadGuard'
|
'GlobalPostFileUploadGuard'
|
||||||
// 'csrf',
|
// 'csrf',
|
||||||
@ -95,5 +95,5 @@ class Filters extends BaseConfig
|
|||||||
* Example:
|
* Example:
|
||||||
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||||
*/
|
*/
|
||||||
public array $filters = [];
|
// public array $filters = [ 'Cors' => ['before' => ['employeeRest/*']]];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -770,12 +770,12 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
|||||||
|
|
||||||
|
|
||||||
//Third party - testing route
|
//Third party - testing route
|
||||||
|
$routes->get('FhplGetBenefDetails','FhplApiController::FhplGetBenefDetails');
|
||||||
$routes->get('EcardRequest','VidalApiController::EcardRequest');
|
$routes->get('EcardRequest','VidalApiController::EcardRequest');
|
||||||
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
||||||
$routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails');
|
$routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails');
|
||||||
$routes->get('ClaimDetail','VidalApiController::ClaimDetail');
|
$routes->get('ClaimDetail','FhplApiController::ClaimDetail');
|
||||||
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
|
$routes->get('SubmitClaim','FhplApiController::SubmitClaim');
|
||||||
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
||||||
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
||||||
$routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
$routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
||||||
|
|||||||
@ -59,8 +59,48 @@ class AppContentManagementController extends AdminController
|
|||||||
// add and edit
|
// add and edit
|
||||||
public function add_advertise_image() {
|
public function add_advertise_image() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||||
|
$id = (int) $sanitized_post_data['add_image_id'];
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'client_id' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Client is required',
|
||||||
|
'integer' => 'Invalid client selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$rules['advertise_image'] = [
|
||||||
|
'rules' => ($id === 0 ? 'uploaded[advertise_image]|' : '') // required only for ADD
|
||||||
|
. 'is_image[advertise_image]'
|
||||||
|
. '|mime_in[advertise_image,image/jpg,image/jpeg,image/png]'
|
||||||
|
. '|max_size[advertise_image,200]'
|
||||||
|
. '|min_dims[advertise_image,1640,664]'
|
||||||
|
. '|max_dims[advertise_image,1640,664]',
|
||||||
|
'errors' => [
|
||||||
|
'uploaded' => 'Image is required',
|
||||||
|
'is_image' => 'File must be an image',
|
||||||
|
'mime_in' => 'Only JPG, JPEG, PNG allowed',
|
||||||
|
'max_size' => 'Image size must not exceed 200 KB',
|
||||||
|
'min_dims' => 'Image dimensions must be exactly 1640x664 pixels',
|
||||||
|
'max_dims' => 'Image dimensions must be exactly 1640x664 pixels',
|
||||||
|
]
|
||||||
|
];
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$file = $this->request->getFile('advertise_image');
|
$file = $this->request->getFile('advertise_image');
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $sanitized_post_data['client_id'];
|
||||||
//1) original file name for vaildations
|
//1) original file name for vaildations
|
||||||
$fileName = $file->getClientName(); //original file name for vaildations
|
$fileName = $file->getClientName(); //original file name for vaildations
|
||||||
$existing = $this->addImgModel->where('name', $fileName)->where('client_id', $fileName)->where('is_active', 1)->first();
|
$existing = $this->addImgModel->where('name', $fileName)->where('client_id', $fileName)->where('is_active', 1)->first();
|
||||||
@ -80,13 +120,13 @@ class AppContentManagementController extends AdminController
|
|||||||
|
|
||||||
$file->move($uploadPath, $fileName);
|
$file->move($uploadPath, $fileName);
|
||||||
|
|
||||||
$id = $this->request->getPost('add_image_id');
|
$id = $sanitized_post_data['add_image_id'];
|
||||||
$data = ['name' => $fileName,'client_id'=>$client_id];
|
$details = ['name' => $fileName,'client_id'=>$client_id];
|
||||||
|
|
||||||
if ($id == 0) {
|
if ($id == 0) {
|
||||||
$this->addImgModel->insert($data);
|
$this->addImgModel->insert($details);
|
||||||
} else {
|
} else {
|
||||||
$this->addImgModel->update($id, $data);
|
$this->addImgModel->update($id, $details);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'message' => 'Image saved successfully.']);
|
return $this->respond(['status' => true, 'message' => 'Image saved successfully.']);
|
||||||
@ -143,8 +183,56 @@ class AppContentManagementController extends AdminController
|
|||||||
|
|
||||||
if ($this->request->getMethod() === 'post') {
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
$id = $this->request->getPost('fe_id');
|
$rules = [
|
||||||
$data = $this->request->getPost();
|
'type' => [
|
||||||
|
'rules' => 'required|max_length[255]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Type is required',
|
||||||
|
'max_length' => 'Type cannot exceed 255 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'content_section' => [
|
||||||
|
'rules' => 'required|max_length[255]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Content Section is required',
|
||||||
|
'max_length' => 'Content Section cannot exceed 255 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'heading' => [
|
||||||
|
'rules' => 'required|max_length[255]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Heading is required',
|
||||||
|
'max_length' => 'Heading cannot exceed 255 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'content' => [
|
||||||
|
'rules' => 'required|max_length[5000]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Content is required',
|
||||||
|
'max_length' => 'Content cannot exceed 5000 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'notes' => [
|
||||||
|
'rules' => 'required|max_length[1500]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Notes are required',
|
||||||
|
'max_length' => 'Notes cannot exceed 1500 characters'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$request_post_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($data);
|
||||||
|
$id = $data['fe_id'];
|
||||||
|
|
||||||
|
|
||||||
unset($data['fe_id']);
|
unset($data['fe_id']);
|
||||||
|
|
||||||
@ -231,8 +319,30 @@ class AppContentManagementController extends AdminController
|
|||||||
try {
|
try {
|
||||||
// --- 1. POST: CREATE OR UPDATE ---
|
// --- 1. POST: CREATE OR UPDATE ---
|
||||||
if ($method === 'post') {
|
if ($method === 'post') {
|
||||||
$id = $this->request->getPost('faq_id');
|
$rules = [
|
||||||
$data = array_filter($this->request->getPost(), fn($v) => $v !== '' && $v !== null);
|
'category' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Category is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'question' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Question is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'answer' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Answer is required'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$request_post_data = $this->request->getPost();
|
||||||
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
$data = array_filter($sanitized_post_data, fn($v) => $v !== '' && $v !== null);
|
||||||
|
$id = $data['faq_id'];
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
$status = $this->faqModel->insert($data);
|
$status = $this->faqModel->insert($data);
|
||||||
|
|||||||
@ -191,10 +191,13 @@ class BDSReportController extends AdminController
|
|||||||
return $this->loadLayout('irba_report', $data);
|
return $this->loadLayout('irba_report', $data);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$fromDate = $this->request->getPost('fromDate');
|
$request_post_data = $this->request->getPost();
|
||||||
$toDate = $this->request->getPost('toDate');
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
$category = $this->request->getPost('category');
|
|
||||||
$report_type = $this->request->getPost('report_type');
|
$fromDate = $sanitized_post_data['fromDate'];
|
||||||
|
$toDate = $sanitized_post_data['toDate'];
|
||||||
|
$category = $sanitized_post_data['category'];
|
||||||
|
$report_type = $sanitized_post_data['report_type'];
|
||||||
// log_message('error',json_encode($_POST));die();
|
// log_message('error',json_encode($_POST));die();
|
||||||
if ($report_type == 'insurer') {
|
if ($report_type == 'insurer') {
|
||||||
$life = $category == 'life' ? 1 : 0;
|
$life = $category == 'life' ? 1 : 0;
|
||||||
@ -937,11 +940,13 @@ class BDSReportController extends AdminController
|
|||||||
return $this->loadLayout('renewal_search', $data);
|
return $this->loadLayout('renewal_search', $data);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$fromDate = $this->request->getPost('fromDate');
|
$request_post_data = $this->request->getPost();
|
||||||
$toDate = $this->request->getPost('toDate');
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
$client_id = $this->request->getPost('client_id');
|
$fromDate = $sanitized_post_data['fromDate'];
|
||||||
$client_type = $this->request->getPost('client_type');
|
$toDate = $sanitized_post_data['toDate'];
|
||||||
$issuer_branch = $this->request->getPost('issuer_branch');
|
$client_id = $sanitized_post_data['client_id'];
|
||||||
|
$client_type = $sanitized_post_data['client_type'];
|
||||||
|
$issuer_branch = $sanitized_post_data['issuer_branch'];
|
||||||
|
|
||||||
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
||||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2676,12 +2676,73 @@ class EmployeeController extends AdminController
|
|||||||
//UPDATE EMPLOYEE
|
//UPDATE EMPLOYEE
|
||||||
public function update_emp_data()
|
public function update_emp_data()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
|
||||||
|
$rules = [
|
||||||
|
'emp_code' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Employee Code is missing'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'name' => [
|
||||||
|
'rules' => 'required|min_length[2]|max_length[100]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Employee name is required',
|
||||||
|
'min_length' => 'Name must be at least 2 characters',
|
||||||
|
'max_length' => 'Name cannot exceed 100 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'gender' => [
|
||||||
|
'rules' => 'permit_empty|in_list[M,F]',
|
||||||
|
'errors' => [
|
||||||
|
'in_list' => 'Invalid gender selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'email_corporate' => [
|
||||||
|
'rules' => 'required|valid_email',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Email is required',
|
||||||
|
'valid_email' => 'Enter a valid email address'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'mobile' => [
|
||||||
|
'rules' => 'required|numeric|exact_length[10]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'numeric' => 'Mobile number must contain digits only',
|
||||||
|
'exact_length' => 'Mobile number must be exactly 10 digits'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$request_post_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
if (isset($data['relationship'])) {
|
||||||
|
$rules['relationship'] = [
|
||||||
|
'rules' => 'required|in_list[Self,Spouse,Child,Father,Mother,Father-in-law,Mother-in-law]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Relationship is required',
|
||||||
|
'in_list' => 'The selected relationship is invalid.'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// print_rr($data);die();
|
// print_rr($data);die();
|
||||||
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
||||||
if(isset( $data['dob'])){
|
$data['dob'] = (!empty($data['dob'])) ? change_date_format($data['dob'], null, 'Y-m-d') : null;
|
||||||
$data['dob'] = change_date_format($data['dob'], null, 'Y-m-d');
|
|
||||||
}
|
|
||||||
// print_rr($data); die;
|
// print_rr($data); die;
|
||||||
|
|
||||||
// Fetch current employee data
|
// Fetch current employee data
|
||||||
@ -2971,12 +3032,15 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function mapEmployees(){
|
public function mapEmployees(){
|
||||||
$client_id = $this->request->getPost('client_id');
|
$request_post_data = $this->request->getPost();
|
||||||
$branch_id = $this->request->getPost('branch_id');
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
$policy_id = $this->request->getPost('client_policy_id');
|
|
||||||
$selected_employees = (array)$this->request->getPost('selected');
|
$client_id = $sanitized_post_data['client_id'];
|
||||||
$si_amt = $this->request->getPost('si_amt');
|
$branch_id = $sanitized_post_data['branch_id'];
|
||||||
$policy_start_date_unformatted = $this->request->getPost('policy_start_date');
|
$policy_id = $sanitized_post_data['client_policy_id'];
|
||||||
|
$selected_employees = (array)$sanitized_post_data['selected'];
|
||||||
|
$si_amt = $sanitized_post_data['si_amt'];
|
||||||
|
$policy_start_date_unformatted = $sanitized_post_data['policy_start_date'];
|
||||||
|
|
||||||
$policy_start_date = change_date_format($policy_start_date_unformatted, 'd/M/Y', 'Y-m-d');
|
$policy_start_date = change_date_format($policy_start_date_unformatted, 'd/M/Y', 'Y-m-d');
|
||||||
|
|
||||||
@ -3013,7 +3077,9 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function unmapEmployees($actionType){
|
public function unmapEmployees($actionType){
|
||||||
$selected_employees = (array)$this->request->getPost('selected');
|
$request_post_data = $this->request->getPost();
|
||||||
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
$selected_employees = (array)$sanitized_post_data['selected'];
|
||||||
if($actionType == 0){
|
if($actionType == 0){
|
||||||
for($i = 0;$i<count($selected_employees);$i++){log_message('error',$selected_employees[$i]);
|
for($i = 0;$i<count($selected_employees);$i++){log_message('error',$selected_employees[$i]);
|
||||||
$result1 = $this->employeeModel->set(['client_id' => null, 'client_branch_id' => null])->where('id',$selected_employees[$i])->update();log_message('error',$result1);
|
$result1 = $this->employeeModel->set(['client_id' => null, 'client_branch_id' => null])->where('id',$selected_employees[$i])->update();log_message('error',$result1);
|
||||||
@ -3273,7 +3339,31 @@ class EmployeeController extends AdminController
|
|||||||
public function retailendorsementsave()
|
public function retailendorsementsave()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = $this->request->getPost();
|
$rules = [
|
||||||
|
'endorsement_no' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Endorsement Number is missing'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Status is required',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$request_post_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
|
||||||
if (!empty($data['id'])) {
|
if (!empty($data['id'])) {
|
||||||
$text = "update";
|
$text = "update";
|
||||||
$updateID = $data['id'];
|
$updateID = $data['id'];
|
||||||
|
|||||||
@ -27,13 +27,13 @@ class FhplApiController extends BaseController
|
|||||||
|
|
||||||
public function generateAuthToken()
|
public function generateAuthToken()
|
||||||
{
|
{
|
||||||
$url = env('FHPL_TOKEN_URL'); // example: https://uat.fhpl.net/token
|
$url = env('FHPL_TOKEN_URL');
|
||||||
|
|
||||||
// x-www-form-urlencoded body
|
// x-www-form-urlencoded body
|
||||||
$postData = http_build_query([
|
$postData = http_build_query([
|
||||||
'UserName' => 'TestApi@fhpl',
|
'UserName' => env('FHPL_USER_NAME'),
|
||||||
'Password' => 'Fhpl@12345',
|
'Password' => env('FHPL_PASSWORD'),
|
||||||
'grant_type' => 'password',
|
'grant_type' => env('FHPL_GRANT_TYPE'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
@ -65,9 +65,447 @@ class FhplApiController extends BaseController
|
|||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => $httpCode === 200,
|
'status' => $httpCode === 200,
|
||||||
'http_code' => $httpCode,
|
'http_code' => $httpCode,
|
||||||
'response' => json_decode($response, true),
|
'data' => json_decode($response, true),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SubmitClaim($claimId = 515)
|
||||||
|
{
|
||||||
|
helper('api');
|
||||||
|
|
||||||
|
$data = $this->db->table('ticket_master tm')
|
||||||
|
->select('
|
||||||
|
tm.id,
|
||||||
|
tm.emp_mobile as mobileNo,
|
||||||
|
tm.emp_mail as emailId,
|
||||||
|
tm.doa as admissionDate,
|
||||||
|
tm.dod as dischargeDate,
|
||||||
|
tm.hospital_name as hospitalName,
|
||||||
|
tm.claim_amount as requestedAmount,
|
||||||
|
tm.tpa_no as dependentUniqueId,
|
||||||
|
cp.policy_no as policyNo,
|
||||||
|
e.emp_code as memberId,
|
||||||
|
tn.note as disease,
|
||||||
|
cf.url as filePath
|
||||||
|
')
|
||||||
|
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||||
|
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||||
|
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
|
||||||
|
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type='application/pdf'", 'left')
|
||||||
|
->where('tm.id', $claimId)
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
|
||||||
|
if (count($data) && $data['filePath'] == null) {
|
||||||
|
log_message('error', "TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' - Claim or File Missing");
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'Claim or File Missing', ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build absolute file path
|
||||||
|
$filename = basename($data['filePath']);
|
||||||
|
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
|
||||||
|
|
||||||
|
if (!file_exists($pdfPath)) {
|
||||||
|
log_message('error', "TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' - PDF not found on server");
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'PDF not found on server']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert PDF to Base64
|
||||||
|
$fileContent = base64_encode(file_get_contents($pdfPath));
|
||||||
|
|
||||||
|
// Generate FHPL Token
|
||||||
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
|
if (empty($tokenResponse['data']['access_token'])) {
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||||
|
}
|
||||||
|
$token = $tokenResponse['data']['access_token'];
|
||||||
|
|
||||||
|
// Build FHPL Request
|
||||||
|
$body = [
|
||||||
|
"IssueID" => $data['dependentUniqueId'], // this key added after seeing the error in responce have to click with fhpl team
|
||||||
|
"Userid" => getenv('FHPL_USER_NAME'),
|
||||||
|
"PolicyNo" => "111700-TATAMTORS", // $data['policyNo'],
|
||||||
|
"UhidNo" => "OIC40830846", //$data['dependentUniqueId'],
|
||||||
|
"ClaimID" => (string) $data['id'],
|
||||||
|
"DOA" => "2025-10-11",//date('Y-m-d', strtotime($data['admissionDate'])),
|
||||||
|
"DateofDischarge"=> $data['dischargeDate'] ? date('Y-m-d', strtotime($data['dischargeDate'])) : null,
|
||||||
|
"ClaimedAmount" => (float) $data['requestedAmount'],
|
||||||
|
"DocumentType" => 20, // Fresh Claim
|
||||||
|
"PayeeName" => $data['memberId'],
|
||||||
|
"HospitalName" => $data['hospitalName'],
|
||||||
|
"MobileNo" => $data['mobileNo'],
|
||||||
|
"Documents" => [
|
||||||
|
[
|
||||||
|
"documentName" => $filename,
|
||||||
|
"documentCategory" => "IRR",
|
||||||
|
"filecontent" => $fileContent
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$url = getenv('FHPL_BASE_URL') . "/api/ClaimSubmission";
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
"Authorization: Bearer " . $token,
|
||||||
|
"Content-Type: application/json"
|
||||||
|
];
|
||||||
|
|
||||||
|
log_message('error', 'TPA CLAIM PUSH FHPL | claimId: '.$claimId.' | payload: '.json_encode($body));
|
||||||
|
|
||||||
|
$response = call_third_party_api($url, 'POST', $headers, $body);
|
||||||
|
|
||||||
|
log_message('error', 'FHPL RESPONSE | ' . json_encode($response));
|
||||||
|
|
||||||
|
if($response['status'] != true){
|
||||||
|
log_message('error', 'TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' | response: '.json_encode($response));
|
||||||
|
$this->db->table('ticket_master')
|
||||||
|
->where('id',$claimId)
|
||||||
|
->update([ 'tpa_push_response' => json_encode($response) ]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($response['status'] === true && !empty($response['data'][0]['ClaimsInfo']))
|
||||||
|
{
|
||||||
|
$claimsInfo = json_decode($response['data'][0]['ClaimsInfo'], true);
|
||||||
|
|
||||||
|
if (!empty($claimsInfo[0]['ClaimID'])) {
|
||||||
|
|
||||||
|
$fhplClaimNo = $claimsInfo[0]['ClaimID'];
|
||||||
|
|
||||||
|
$this->db->table('ticket_master')
|
||||||
|
->where('id', $claimId)
|
||||||
|
->update([
|
||||||
|
'claim_number' => $fhplClaimNo,
|
||||||
|
'tpa_claim_id' => $fhplClaimNo,
|
||||||
|
'tpa_claim_push_reference_no' => $fhplClaimNo,
|
||||||
|
'updated_at' => date('Y-m-d H:i:s')
|
||||||
|
]);
|
||||||
|
|
||||||
|
log_message('error', 'TPA CLAIM PUSH SUCCESS FHPL | claimId: '.$claimId.' | claimNO: '.$fhplClaimNo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ClaimDetail($claimId = 515)
|
||||||
|
{
|
||||||
|
helper('api');
|
||||||
|
|
||||||
|
$ticket = $this->db->table('ticket_master tm')
|
||||||
|
->select("tm.id, tm.tpa_claim_id as claimNo, cp.policy_no , cp.policy_start_date , cp.policy_end_date")
|
||||||
|
->join('client_policy cp','tm.client_policy_id=cp.id')
|
||||||
|
->where('tm.id',$claimId)
|
||||||
|
->get()->getRowArray();
|
||||||
|
|
||||||
|
|
||||||
|
if(!$ticket) return $this->response->setJSON(['status'=>false,'message'=>'Invalid claim']);
|
||||||
|
|
||||||
|
// Generate FHPL Token
|
||||||
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
|
|
||||||
|
if (empty($tokenResponse['data']['access_token'])) {
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = $tokenResponse['data']['access_token'];
|
||||||
|
|
||||||
|
$url = getenv('FHPL_BASE_URL')."/api/GetTPA_ClaimsDetails";
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
"UserName" => getenv('FHPL_USER_NAME'),
|
||||||
|
"Password" => getenv('FHPL_PASSWORD'),
|
||||||
|
"PolicyNumber" => "GHI-81-25-00087313-000",//$ticket['policy_no'],
|
||||||
|
"Fromdate" => "2025-04-26",//$ticket['claimNo'],
|
||||||
|
"Todate" => "2025-04-27",//$ticket['claimNo'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = ["Authorization: Bearer ".$token,"Content-Type: application/json"];
|
||||||
|
|
||||||
|
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||||
|
|
||||||
|
// dd($response);
|
||||||
|
|
||||||
|
if (empty($response['data'][0])) {
|
||||||
|
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'API call failed.',
|
||||||
|
'data' => $response
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$status = null;
|
||||||
|
|
||||||
|
// find this claim
|
||||||
|
foreach($response['data'] as $row){
|
||||||
|
if($row['CLAIM_ID']==$ticket['claimNo']){
|
||||||
|
$status = $row['CLAIM_STATUS'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = [
|
||||||
|
"In-Progress" => 5,
|
||||||
|
"Under Process" => 5,
|
||||||
|
"Query" => 4,
|
||||||
|
"Paid" => 11,
|
||||||
|
"Rejected" => 8,
|
||||||
|
"Approved" => 8,
|
||||||
|
"Required Information" => 4,
|
||||||
|
];
|
||||||
|
|
||||||
|
if( $status != null && isset($map[$status]))
|
||||||
|
{
|
||||||
|
$this->db->table('ticket_master')->where('id',$claimId)->update(['claim_status_id'=>$map[$status],'tpa_claim_status'=>$status]);
|
||||||
|
// LOG UPDATE
|
||||||
|
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $status");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Claim status updated.',
|
||||||
|
'updated_status' => $status,
|
||||||
|
'api_response' => $response
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ClaimStatusUpdate()
|
||||||
|
{
|
||||||
|
helper('api');
|
||||||
|
|
||||||
|
$tickets = $this->db->table('ticket_master tm')
|
||||||
|
->select("tm.id,tm.tpa_claim_id,cp.policy_no")
|
||||||
|
->join('client_policy cp','tm.client_policy_id=cp.id')
|
||||||
|
->where('tm.tpa_claim_id IS NOT NULL')
|
||||||
|
->get()->getResultArray();
|
||||||
|
|
||||||
|
$count=0;
|
||||||
|
|
||||||
|
foreach($tickets as $t){
|
||||||
|
$this->ClaimDetail($t['id']);
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON(['status'=>true,'updated'=>$count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function EcardRequest($employeeId,$policyNo,$uhid)
|
||||||
|
{
|
||||||
|
helper('api');
|
||||||
|
|
||||||
|
// Generate FHPL Token
|
||||||
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
|
|
||||||
|
if (empty($tokenResponse['data']['access_token'])) {
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate FHPL Token
|
||||||
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
|
|
||||||
|
if (empty($tokenResponse['data']['access_token'])) {
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = $tokenResponse['data']['access_token'];
|
||||||
|
|
||||||
|
$url = getenv('FHPL_BASE_URL')."/api/GetEcard";
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
"UserName" => getenv('FHPL_USER_NAME'),
|
||||||
|
"Password" => getenv('FHPL_PASSWORD'),
|
||||||
|
"PolicyNumber" => $policyNo,
|
||||||
|
"EmployeeID" => $employeeId
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = ["Authorization: Bearer ".$token,"Content-Type: application/json"];
|
||||||
|
|
||||||
|
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||||
|
|
||||||
|
if(($response['data']['STATUS'] ?? '')=='SUCCESS'){
|
||||||
|
return $response['data']['E_Card'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function FhplGetBenefDetails($requestData = null)
|
||||||
|
{
|
||||||
|
helper('api');
|
||||||
|
|
||||||
|
$policyNo = $requestData['policy_no'] ?? "10/12/2025/16/17";
|
||||||
|
$client_policy_id = $requestData['client_policy_id'] ?? 0;
|
||||||
|
|
||||||
|
// Generate FHPL Token
|
||||||
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
|
if (empty($tokenResponse['data']['access_token'])) {
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||||
|
}
|
||||||
|
$token = $tokenResponse['data']['access_token'];
|
||||||
|
|
||||||
|
$url = getenv('FHPL_BASE_URL')."/api/GetEnrollmentDetailsPolicy";
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
"Authorization: Bearer ".$token,
|
||||||
|
"Content-Type: application/json"
|
||||||
|
];
|
||||||
|
|
||||||
|
$startIndex = 0;
|
||||||
|
$range = 100;
|
||||||
|
$allMembers = [];
|
||||||
|
|
||||||
|
do {
|
||||||
|
$body = [
|
||||||
|
"UserName" => getenv('FHPL_USER_NAME'),
|
||||||
|
"Password" => getenv('FHPL_PASSWORD'),
|
||||||
|
"PolicyNumber" => $policyNo,
|
||||||
|
"StartIndex" => $startIndex,
|
||||||
|
"Range" => $range
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||||
|
|
||||||
|
dd($response);
|
||||||
|
|
||||||
|
if(empty($response['data']['Members'])){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$allMembers = array_merge($allMembers,$response['data']['Members']);
|
||||||
|
|
||||||
|
$startIndex += $range;
|
||||||
|
|
||||||
|
} while($startIndex < ($response['data']['Total'] ?? 0));
|
||||||
|
|
||||||
|
|
||||||
|
dd($allMembers);
|
||||||
|
|
||||||
|
// Now same matching logic you already have
|
||||||
|
$employeePolicyModel = new EmployeePolicyModel();
|
||||||
|
|
||||||
|
$employeePolicyData = $employeePolicyModel
|
||||||
|
->join('employees','employees.id=employee_polices.employee_id')
|
||||||
|
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||||
|
->where('employee_polices.tpa_id IS NULL')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$updated = 0;
|
||||||
|
|
||||||
|
foreach($employeePolicyData as $policy){
|
||||||
|
foreach($allMembers as $m){
|
||||||
|
|
||||||
|
if(
|
||||||
|
strtolower(trim($policy['name']))==strtolower(trim($m['Name'])) &&
|
||||||
|
$policy['emp_code']==$m['MemberID'] &&
|
||||||
|
strtolower($policy['relationship'])==strtolower($m['Relation'])
|
||||||
|
){
|
||||||
|
$this->db->table('employee_polices')
|
||||||
|
->where('id',$policy['emp_policy_id'])
|
||||||
|
->update(['tpa_id'=>$m['UHID']]);
|
||||||
|
|
||||||
|
$updated++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status'=>true,
|
||||||
|
'total_fetched'=>count($allMembers),
|
||||||
|
'updated'=>$updated
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncFhplClaimsToNhance()
|
||||||
|
{
|
||||||
|
helper('api');
|
||||||
|
|
||||||
|
// Generate FHPL Token
|
||||||
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
|
|
||||||
|
if (empty($tokenResponse['data']['access_token'])) {
|
||||||
|
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = $tokenResponse['data']['access_token'];
|
||||||
|
|
||||||
|
$url = getenv('FHPL_BASE_URL')."/api/GetTPA_ClaimsDetails";
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
"Authorization: Bearer ".$token,
|
||||||
|
"Content-Type: application/json"
|
||||||
|
];
|
||||||
|
|
||||||
|
$policies = $this->db->table('client_policy')
|
||||||
|
->where('tpa_id',$this->fhplTpaId)
|
||||||
|
->get()->getResultArray();
|
||||||
|
|
||||||
|
$finalResult=[];
|
||||||
|
|
||||||
|
foreach($policies as $policy){
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
"UserName" => getenv('FHPL_USER_NAME'),
|
||||||
|
"Password" => getenv('FHPL_PASSWORD'),
|
||||||
|
"PolicyNumber" => $policy['policy_no'],
|
||||||
|
"Fromdate" => $policy['policy_start_date'],
|
||||||
|
"Todate" => $policy['policy_end_date']
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||||
|
|
||||||
|
if(!empty($response['data'])){
|
||||||
|
$finalResult = array_merge($finalResult,$response['data']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert / update ticket_master same way you already do for MediAssist
|
||||||
|
foreach($finalResult as $row){
|
||||||
|
|
||||||
|
$status = $row['CLAIM_STATUS'];
|
||||||
|
|
||||||
|
$map = [
|
||||||
|
"Under Process"=>5,
|
||||||
|
"Paid"=>11,
|
||||||
|
"Rejected"=>8,
|
||||||
|
"Approved"=>8
|
||||||
|
];
|
||||||
|
|
||||||
|
$claimStatus = $map[$status] ?? 1;
|
||||||
|
|
||||||
|
$this->db->table('ticket_master')->insert([
|
||||||
|
'policy_no'=>$row['POLICY_NO'],
|
||||||
|
'claim_number'=>$row['CLAIM_ID'],
|
||||||
|
'tpa_claim_id'=>$row['CLAIM_ID'],
|
||||||
|
'emp_code'=>$row['EMPLOYEE_NO'],
|
||||||
|
'insured_name'=>$row['PATIENT_NAME'],
|
||||||
|
'claim_amount'=>$row['CLAIM_AMOUNT'],
|
||||||
|
'hospital_name'=>$row['HOSPITAL_NAME'],
|
||||||
|
'doa'=>$row['DATE_OF_ADMISSION'],
|
||||||
|
'dod'=>$row['DATE_OF_DISCHARGE'],
|
||||||
|
'claim_status_id'=>$claimStatus,
|
||||||
|
'tpa_id'=>$this->fhplTpaId
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['status'=>true,'total'=>count($finalResult)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -378,7 +378,95 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
private function prepareLeadData()
|
private function prepareLeadData()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$rules = [
|
||||||
|
'lead_type' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Lead Type is required']
|
||||||
|
],
|
||||||
|
'issuer' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Issuer is required']
|
||||||
|
],
|
||||||
|
'entity_type_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Entity Type is required']
|
||||||
|
],
|
||||||
|
'client_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Client Name is required']
|
||||||
|
],
|
||||||
|
'client_short_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Client Short Name is required']
|
||||||
|
],
|
||||||
|
'gst' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'GST Number is required']
|
||||||
|
],
|
||||||
|
'branch_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Branch Name is required']
|
||||||
|
],
|
||||||
|
'branch_code' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Branch Code is required']
|
||||||
|
],
|
||||||
|
'contact_person_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Contact Person Name is required']
|
||||||
|
],
|
||||||
|
'contact_person_mobile' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Contact Person Mobile is required']
|
||||||
|
],
|
||||||
|
'contact_person_email' => [
|
||||||
|
'rules' => 'required|valid_email',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Contact Person Email is required',
|
||||||
|
'valid_email' => 'Please enter a valid email address'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'salse_person_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Sales Person is required']
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Status is required']
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
if($data['lead_form_type'] == 2){
|
||||||
|
$rules['client_type'] = [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Client Type is required']
|
||||||
|
];
|
||||||
|
$rules['policy_type_id'] = [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Policy Type is required']
|
||||||
|
];
|
||||||
|
$rules['policy_start_date'] = [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Date of Commencement is required']
|
||||||
|
];
|
||||||
|
$rules['policy_end_date'] = [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Date of Expiry is required']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$data['client_type'] = 1;
|
$data['client_type'] = 1;
|
||||||
$data['pan'] = "";
|
$data['pan'] = "";
|
||||||
|
|
||||||
@ -5739,7 +5827,7 @@ class LeadsController extends BaseController
|
|||||||
$first_file_name = $isFirstField ? 'Member List' : '';
|
$first_file_name = $isFirstField ? 'Member List' : '';
|
||||||
$member_data_link = $isFirstField ? $sample_dwn_link : '';
|
$member_data_link = $isFirstField ? $sample_dwn_link : '';
|
||||||
$read_only = $isFirstField ? 'readonly' : '';
|
$read_only = $isFirstField ? 'readonly' : '';
|
||||||
$accept = $isFirstField ? '.xls,.xlsx' : '';
|
$accept = $isFirstField ? '.xls,.xlsx' : '.xls,.xlsx,.pdf,.jpg,.jpeg,.png';
|
||||||
$displayIndex = $index + 1;
|
$displayIndex = $index + 1;
|
||||||
|
|
||||||
$html .= '
|
$html .= '
|
||||||
|
|||||||
@ -62,9 +62,7 @@ class LoginController extends BaseController
|
|||||||
set_session_data($session_data);
|
set_session_data($session_data);
|
||||||
|
|
||||||
// Bind session to device
|
// Bind session to device
|
||||||
set_session_data(['fingerprint' => hash('sha256',
|
set_session_data(['fingerprint' => generateFingerprint()]);
|
||||||
($this->request->getUserAgent()->getAgentString() . '|' . ($this->request->getIPAddress()
|
|
||||||
)))]);
|
|
||||||
|
|
||||||
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
||||||
log_message('error', 'User Login Sucessfully');
|
log_message('error', 'User Login Sucessfully');
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -281,13 +281,17 @@ class PayoutController extends BaseController
|
|||||||
//... Payout-invoice Mapping - Save/update/soft Delete/Hard Delete Data
|
//... Payout-invoice Mapping - Save/update/soft Delete/Hard Delete Data
|
||||||
public function saveInvoice()
|
public function saveInvoice()
|
||||||
{
|
{
|
||||||
$json = $this->request->getJSON(true);
|
$raw_json = $this->request->getJSON(true);
|
||||||
// print_rr($json);die();
|
|
||||||
|
|
||||||
if (!$json) {
|
// 1. Check if the JSON was actually valid/parsed before sanitizing
|
||||||
|
if (is_null($raw_json)) {
|
||||||
return $this->response->setJSON(['error' => 'Invalid JSON','message' => 'Invalid JSON received.'])->setStatusCode(400);
|
return $this->response->setJSON(['error' => 'Invalid JSON','message' => 'Invalid JSON received.'])->setStatusCode(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2. Sanitize the data
|
||||||
|
$json = sanitizeInputArrayAdvanced($raw_json);
|
||||||
|
|
||||||
|
// 3. Now you can safely use $json (even if it is an empty array)
|
||||||
$id = $json['invoice_id'] ?? null;
|
$id = $json['invoice_id'] ?? null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@ -917,12 +917,14 @@
|
|||||||
// policy Transaction Create function start
|
// policy Transaction Create function start
|
||||||
public function createInceptionPolicy()
|
public function createInceptionPolicy()
|
||||||
{
|
{
|
||||||
$post_data = $this->request->getPost() ?? [];
|
$post_data = $this->request->getPost();
|
||||||
|
$post_data = $post_data ? sanitizeInputArrayAdvanced($post_data) : [];
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Policy Trancaction form data : '. json_encode($post_data));
|
$this->myLogger->logme('error', 'Policy Trancaction form data : '. json_encode($post_data));
|
||||||
|
|
||||||
$id = $this->request->getPost('id');
|
$id = $post_data['id'] ?? null;
|
||||||
$data = $this->preparePolicyData();
|
$data = $this->preparePolicyData();
|
||||||
$data['cd_ac_pk'] = $this->request->getPost('cd_ac_no');
|
$data['cd_ac_pk'] = $post_data['cd_ac_no'];
|
||||||
$data['issuer'] = 2;
|
$data['issuer'] = 2;
|
||||||
$data['status'] = 'completed';
|
$data['status'] = 'completed';
|
||||||
$this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data));
|
$this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data));
|
||||||
@ -937,7 +939,8 @@
|
|||||||
|
|
||||||
private function preparePolicyData()
|
private function preparePolicyData()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$request_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
|
||||||
$file_data = $this->request->getFiles() ?? null;
|
$file_data = $this->request->getFiles() ?? null;
|
||||||
$data['file_data'] = $file_data ?? null;
|
$data['file_data'] = $file_data ?? null;
|
||||||
@ -2249,9 +2252,10 @@
|
|||||||
|
|
||||||
public function createEndorsementPolicy()
|
public function createEndorsementPolicy()
|
||||||
{
|
{
|
||||||
$id = $this->request->getPost('id');
|
// $id = $this->request->getPost('id');
|
||||||
$data = $this->preparePolicyTransactionData();
|
$data = $this->preparePolicyTransactionData();
|
||||||
$data['status'] = 'completed';
|
$data['status'] = 'completed';
|
||||||
|
$id = $data['id'] ?? null;
|
||||||
// print_r($data); die;
|
// print_r($data); die;
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
@ -2263,8 +2267,8 @@
|
|||||||
|
|
||||||
private function preparePolicyTransactionData()
|
private function preparePolicyTransactionData()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$request_post_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($data);
|
// print_r($data);
|
||||||
// die;
|
// die;
|
||||||
@ -3253,10 +3257,12 @@
|
|||||||
$client_policy_id = (!isset($client_policy_id) || $client_policy_id === '' || $client_policy_id === null) ? 0 : $client_policy_id;
|
$client_policy_id = (!isset($client_policy_id) || $client_policy_id === '' || $client_policy_id === null) ? 0 : $client_policy_id;
|
||||||
$user_id = (!isset($user_id) || $user_id === '' || $user_id === null) ? 0 : $user_id;
|
$user_id = (!isset($user_id) || $user_id === '' || $user_id === null) ? 0 : $user_id;
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
$isFromDashboard = $this->request->getPost("is_dashboard");
|
$request_post_data = $this->request->getPost();
|
||||||
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
$isFromDashboard = $sanitized_post_data["is_dashboard"];
|
||||||
|
|
||||||
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
||||||
$ids = $this->request->getPost('ids');
|
$ids = $sanitized_post_data['ids'];
|
||||||
|
|
||||||
$ids = array_filter(explode(',', $ids));
|
$ids = array_filter(explode(',', $ids));
|
||||||
|
|
||||||
@ -4224,10 +4230,12 @@
|
|||||||
// echo 'scbsc';die();
|
// echo 'scbsc';die();
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
// $jsonData = (array)$this->request->getJSON();
|
// $jsonData = (array)$this->request->getJSON();
|
||||||
$customer_id = $this->request->getPost('customer_id');
|
$request_data = $this->request->getPost();
|
||||||
$policy_id = $this->request->getPost('policy_id');
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
$cus_doc_name = $this->request->getPost('cus_doc_name');
|
$customer_id = $data['customer_id'];
|
||||||
$policy_doc_name = $this->request->getPost('policy_doc_name');
|
$policy_id = $data['policy_id'];
|
||||||
|
$cus_doc_name = $data['cus_doc_name'];
|
||||||
|
$policy_doc_name = $data['policy_doc_name'];
|
||||||
$pt_files = [];
|
$pt_files = [];
|
||||||
$kyc_files = [];
|
$kyc_files = [];
|
||||||
$batch_files = [];
|
$batch_files = [];
|
||||||
|
|||||||
@ -63,7 +63,98 @@ class ThzController extends BaseController
|
|||||||
public function ticketSave()
|
public function ticketSave()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = $this->request->getPost();
|
$rules = [
|
||||||
|
'client_id' => [
|
||||||
|
'rules' => 'permit_empty|integer',
|
||||||
|
'errors' => [
|
||||||
|
'integer' => 'Invalid client selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'mobile' => [
|
||||||
|
'rules' => 'required|regex_match[/^[0-9]{10}$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'regex_match' => 'Mobile number must be exactly 10 digits'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'name' => [
|
||||||
|
'rules' => 'required|min_length[3]|max_length[100]|alpha_space',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Name is required',
|
||||||
|
'min_length' => 'Name must be at least 3 characters',
|
||||||
|
'alpha_space'=> 'Name can contain only letters and spaces'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'email' => [
|
||||||
|
'rules' => 'required|valid_email|max_length[150]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Email is required',
|
||||||
|
'valid_email' => 'Please enter a valid email address'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'empcode' => [
|
||||||
|
'rules' => 'permit_empty|max_length[50]',
|
||||||
|
'errors' => [
|
||||||
|
'max_length' => 'Employee code is too long'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'ticket_type' => [
|
||||||
|
'rules' => 'required|in_list[Sales,Service]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Ticket Type is required',
|
||||||
|
'in_list' => 'Invalid Ticket Type selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'assign_to' => [
|
||||||
|
'rules' => 'permit_empty|integer',
|
||||||
|
'errors' => [
|
||||||
|
'integer' => 'Invalid assignee selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'subject' => [
|
||||||
|
'rules' => 'required|min_length[5]|max_length[150]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Subject is required',
|
||||||
|
'min_length' => 'Subject must be at least 5 characters',
|
||||||
|
'max_length' => 'Subject cannot exceed 150 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'message' => [
|
||||||
|
'rules' => 'required|min_length[10]|max_length[1500]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Message is required',
|
||||||
|
'min_length' => 'Message must be at least 10 characters',
|
||||||
|
'max_length' => 'Message cannot exceed 1500 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'rules' => 'permit_empty|in_list[Open,In Progress,Resolved,Closed]',
|
||||||
|
'errors' => [
|
||||||
|
'in_list' => 'Invalid ticket status'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_post_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
|
||||||
$references = "";
|
$references = "";
|
||||||
if (!empty($data['thz_id'])) {
|
if (!empty($data['thz_id'])) {
|
||||||
|
|
||||||
@ -157,7 +248,30 @@ class ThzController extends BaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$data = $this->request->getPost();
|
|
||||||
|
$rules = [
|
||||||
|
'notes' => [
|
||||||
|
'rules' => 'required|string|min_length[1]|max_length[1500]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Notes is required',
|
||||||
|
'string' => 'Notes must be valid text',
|
||||||
|
'min_length' => 'Notes cannot be empty',
|
||||||
|
'max_length' => 'Notes cannot exceed 1500 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_post_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
|
||||||
$data['notes_type'] = $data['notes_type'] ?? 'External';
|
$data['notes_type'] = $data['notes_type'] ?? 'External';
|
||||||
|
|
||||||
|
|||||||
@ -1122,8 +1122,130 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
public function createTicket()
|
public function createTicket()
|
||||||
{
|
{
|
||||||
$ticket_data = $this->request->getPost();
|
$rules = [
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
'emp_code' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Code is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'emp_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'insured_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Insured Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'relationship' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Relationship is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'emp_mobile' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Mobile is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'emp_mail' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Email is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'client_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Client Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'insurer_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Insurer is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'client_policy_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Policy is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'claim_status_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Claim Status is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'priority' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Priority is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'mode_of_intimation' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Mode of Intimation is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'claim_type' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Claim Type is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_address' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Address is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_city' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital City is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_state' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital State is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_pin_code' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Pincode is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_phone_no' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Phone Number is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'doa' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Date of Admission is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'dod' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Date of Discharge is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'claim_amount' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Claim Amount is required']
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$sanitized_data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
$ticket_data = $this->formatDateForClaim($sanitized_data);
|
||||||
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
||||||
// print_rr($ticket_data); die;
|
// print_rr($ticket_data); die;
|
||||||
|
|
||||||
@ -1183,9 +1305,132 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
public function updateTicket()
|
public function updateTicket()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'emp_code' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Code is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'emp_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'insured_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Insured Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'relationship' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Relationship is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'emp_mobile' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Mobile is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'emp_mail' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Email is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'client_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Client Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'insurer_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Insurer is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'client_policy_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Policy is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'claim_status_id' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Claim Status is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'priority' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Priority is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'mode_of_intimation' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Mode of Intimation is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'claim_type' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Claim Type is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Name is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_address' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Address is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_city' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital City is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_state' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital State is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_pin_code' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Pincode is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'hospital_phone_no' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Hospital Phone Number is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'doa' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Date of Admission is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'dod' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Date of Discharge is required']
|
||||||
|
],
|
||||||
|
|
||||||
|
'claim_amount' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Claim Amount is required']
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$sanitized_data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
$ticket_data = $this->formatDateForClaim($sanitized_data);
|
||||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||||
$ticket_data = $this->request->getPost();
|
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
|
||||||
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||||
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data, $old_ticket_data);
|
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data, $old_ticket_data);
|
||||||
// print_rr($ticket_data); die;
|
// print_rr($ticket_data); die;
|
||||||
@ -1250,7 +1495,49 @@ class TicketController extends BaseController
|
|||||||
{
|
{
|
||||||
//action 1 is create. action 2 is edit and action 3 is delete
|
//action 1 is create. action 2 is edit and action 3 is delete
|
||||||
if ($action == 1) {
|
if ($action == 1) {
|
||||||
$received_data = $this->request->getPost();
|
$rules = [
|
||||||
|
'template_name' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Template Name is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'ticket_type' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Policy Type is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'trigger_type' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Trigger Type is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'subject' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Subject is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'mail_content' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mail Content is required'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$received_data = sanitizeInputArrayAdvanced($data);
|
||||||
|
|
||||||
if (isset($received_data['id']) && $received_data['id'] != '') {
|
if (isset($received_data['id']) && $received_data['id'] != '') {
|
||||||
$status = $this->ticketMailTemplateModel->save($received_data);
|
$status = $this->ticketMailTemplateModel->save($received_data);
|
||||||
if ($status) {
|
if ($status) {
|
||||||
@ -3016,6 +3303,70 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
public function uploadClaimMisFile()
|
public function uploadClaimMisFile()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$filename = '';
|
||||||
|
$fileSize = '';
|
||||||
|
|
||||||
|
//validate uploaded file
|
||||||
|
$validated = $this->validate([
|
||||||
|
'file' => [
|
||||||
|
'uploaded[file]',
|
||||||
|
'mime_in[file,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet]',
|
||||||
|
'max_size[file,16384]',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validated)
|
||||||
|
{
|
||||||
|
|
||||||
|
$file = $this->request->getFile('file');
|
||||||
|
if (!$file) {
|
||||||
|
$this->myLogger->logme("error", 'File not found');
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'File not found'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_moved = $file->move(WRITEPATH . 'uploads/claims_mis/');
|
||||||
|
|
||||||
|
if ($is_moved) {
|
||||||
|
$filename = file_Upload_for_lead($file, $file_path);
|
||||||
|
$fileSize = $file->getSize(); // File size in bytes
|
||||||
|
$fileSize = $fileSize / (1024 * 1024); // Convert to MB
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", 'File move successful');
|
||||||
|
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
|
||||||
|
if(isset($data['from_date']) && !empty($data['from_date'])){
|
||||||
|
$data['from_date'] = change_date_format($data['from_date'], 'd/m/Y', 'Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($data['to_date']) && !empty($data['to_date'])){
|
||||||
|
$data['to_date'] = change_date_format($data['to_date'], 'd/m/Y', 'Y-m-d');
|
||||||
|
}
|
||||||
|
if(!empty($file_name)){
|
||||||
|
$data['file_name'] = $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->claimmisFileModel->insert($data);
|
||||||
|
|
||||||
|
if($response){
|
||||||
|
return $this->respond(['status'=>true, 'code'=>200, 'message'=>'MIS file uploaded successfully'], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status'=>true, 'code'=>500, 'message'=>'Failed to upload'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** OLD CODE KEEP it Safe
|
||||||
$file = $this->request->getFile('file');
|
$file = $this->request->getFile('file');
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
@ -3041,6 +3392,7 @@ class TicketController extends BaseController
|
|||||||
}else{
|
}else{
|
||||||
return $this->respond(['status'=>true, 'code'=>500, 'message'=>'Failed to upload'], 200);
|
return $this->respond(['status'=>true, 'code'=>500, 'message'=>'Failed to upload'], 200);
|
||||||
}
|
}
|
||||||
|
****/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadClaimMisFile()
|
public function downloadClaimMisFile()
|
||||||
|
|||||||
@ -83,7 +83,114 @@ class UserController extends AdminController
|
|||||||
return redirect()->to(base_url('/user/list'));
|
return redirect()->to(base_url('/user/list'));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$userData = $this->request->getPost();
|
// $userData = $this->request->getPost();
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$userData = sanitizeInputArrayAdvanced($data);
|
||||||
|
$rules = [
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Nhance Branch
|
||||||
|
// ======================
|
||||||
|
'nhance_branch_id' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Nhance Branch is required',
|
||||||
|
'integer' => 'Invalid Nhance Branch selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Reporting Manager
|
||||||
|
// ======================
|
||||||
|
'rm_id' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Reporting Manager is required',
|
||||||
|
'integer' => 'Invalid Reporting Manager selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Employee Code
|
||||||
|
// ======================
|
||||||
|
'emp_code' => [
|
||||||
|
'rules' => 'required|alpha_numeric|min_length[3]|max_length[20]|is_unique[user_profiles.emp_code,id,{PrimaryKey}]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Employee Code is required',
|
||||||
|
'alpha_numeric' => 'Employee Code must be alphanumeric',
|
||||||
|
'min_length' => 'Employee Code must be at least 3 characters',
|
||||||
|
'max_length' => 'Employee Code cannot exceed 20 characters',
|
||||||
|
'is_unique' => 'Employee Code already exists'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// First Name
|
||||||
|
// ======================
|
||||||
|
'first_name' => [
|
||||||
|
'rules' => 'required|alpha_space|min_length[2]|max_length[100]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Name is required',
|
||||||
|
'alpha_space' => 'Name can contain only letters and spaces',
|
||||||
|
'min_length' => 'Name must be at least 2 characters',
|
||||||
|
'max_length' => 'Name cannot exceed 100 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Email
|
||||||
|
// ======================
|
||||||
|
'email' => [
|
||||||
|
'rules' => 'required|valid_email|is_unique[user_profiles.email,id,{PrimaryKey}]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Email is required',
|
||||||
|
'valid_email' => 'Please enter a valid email address',
|
||||||
|
'is_unique' => 'Email already exists'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Mobile
|
||||||
|
// ======================
|
||||||
|
'mobile' => [
|
||||||
|
'rules' => 'required|regex_match[/^[6-9][0-9]{9}$/]|is_unique[user_profiles.mobile,id,{PrimaryKey}]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'regex_match' => 'Enter a valid 10-digit mobile number starting with 6, 7, 8, or 9',
|
||||||
|
'is_unique' => 'Mobile number already exists'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Role
|
||||||
|
// ======================
|
||||||
|
'role' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'User Role is required',
|
||||||
|
'integer' => 'Invalid User Role selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Team (Multiple select)
|
||||||
|
// ======================
|
||||||
|
'team' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'At least one User Team must be selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$userData['created_by'] = get_session_userid();
|
$userData['created_by'] = get_session_userid();
|
||||||
$temp_team = $userData['team'];
|
$temp_team = $userData['team'];
|
||||||
unset($userData['team']);
|
unset($userData['team']);
|
||||||
@ -167,9 +274,116 @@ class UserController extends AdminController
|
|||||||
return redirect()->to(base_url('/user/list'));
|
return redirect()->to(base_url('/user/list'));
|
||||||
} else {
|
} else {
|
||||||
// echo ":/ in 163";
|
// echo ":/ in 163";
|
||||||
$id = $this->request->getPost('PrimaryKey');
|
$rules = [
|
||||||
$teams = $this->request->getPost('team');
|
|
||||||
$userData = $this->request->getPost();
|
// ======================
|
||||||
|
// Nhance Branch
|
||||||
|
// ======================
|
||||||
|
'nhance_branch_id' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Nhance Branch is required',
|
||||||
|
'integer' => 'Invalid Nhance Branch selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Reporting Manager
|
||||||
|
// ======================
|
||||||
|
'rm_id' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Reporting Manager is required',
|
||||||
|
'integer' => 'Invalid Reporting Manager selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Employee Code
|
||||||
|
// ======================
|
||||||
|
'emp_code' => [
|
||||||
|
'rules' => 'required|alpha_numeric|min_length[3]|max_length[20]|is_unique[user_profiles.emp_code,id,{PrimaryKey}]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Employee Code is required',
|
||||||
|
'alpha_numeric' => 'Employee Code must be alphanumeric',
|
||||||
|
'min_length' => 'Employee Code must be at least 3 characters',
|
||||||
|
'max_length' => 'Employee Code cannot exceed 20 characters',
|
||||||
|
'is_unique' => 'Employee Code already exists'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// First Name
|
||||||
|
// ======================
|
||||||
|
'first_name' => [
|
||||||
|
'rules' => 'required|alpha_space|min_length[2]|max_length[100]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Name is required',
|
||||||
|
'alpha_space' => 'Name can contain only letters and spaces',
|
||||||
|
'min_length' => 'Name must be at least 2 characters',
|
||||||
|
'max_length' => 'Name cannot exceed 100 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Email
|
||||||
|
// ======================
|
||||||
|
'email' => [
|
||||||
|
'rules' => 'required|valid_email|is_unique[user_profiles.email,id,{PrimaryKey}]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Email is required',
|
||||||
|
'valid_email' => 'Please enter a valid email address',
|
||||||
|
'is_unique' => 'Email already exists'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Mobile
|
||||||
|
// ======================
|
||||||
|
'mobile' => [
|
||||||
|
'rules' => 'required|regex_match[/^[6-9][0-9]{9}$/]|is_unique[user_profiles.mobile,id,{PrimaryKey}]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'regex_match' => 'Enter a valid 10-digit mobile number starting with 6, 7, 8, or 9',
|
||||||
|
'is_unique' => 'Mobile number already exists'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Role
|
||||||
|
// ======================
|
||||||
|
'role' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'User Role is required',
|
||||||
|
'integer' => 'Invalid User Role selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Team (Multiple select)
|
||||||
|
// ======================
|
||||||
|
'team' => [
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'At least one User Team must be selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$userData = sanitizeInputArrayAdvanced($data);
|
||||||
|
$id = $userData['PrimaryKey'];
|
||||||
|
$teams = $userData['team'];
|
||||||
|
|
||||||
unset($userData['csrf_test_name']);
|
unset($userData['csrf_test_name']);
|
||||||
unset($userData['PrimaryKey']);
|
unset($userData['PrimaryKey']);
|
||||||
|
|
||||||
@ -594,29 +808,100 @@ class UserController extends AdminController
|
|||||||
|
|
||||||
// add/update
|
// add/update
|
||||||
if ($method === 'post') {
|
if ($method === 'post') {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
// ======================
|
||||||
|
// Partner Name
|
||||||
|
// ======================
|
||||||
|
'name' => [
|
||||||
|
'rules' => 'required|alpha_space|min_length[2]|max_length[100]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Partner name is required',
|
||||||
|
'alpha_space' => 'Partner name can contain only letters and spaces',
|
||||||
|
'min_length' => 'Partner name must be at least 2 characters',
|
||||||
|
'max_length' => 'Partner name cannot exceed 100 characters'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
// ======================
|
||||||
|
// Mobile Number
|
||||||
|
// ======================
|
||||||
|
'mobile' => [
|
||||||
|
'rules' => 'required|regex_match[/^[6-9][0-9]{9}$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'regex_match' => 'Enter a valid 10-digit mobile number starting with 6, 7, 8, or 9',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Email
|
||||||
|
// ======================
|
||||||
|
'email' => [
|
||||||
|
'rules' => 'required|valid_email',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Email is required',
|
||||||
|
'valid_email' => 'Please enter a valid email address',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
// ======================
|
||||||
|
// Retention Rate
|
||||||
|
// ======================
|
||||||
|
'retention_rate' => [
|
||||||
|
'rules' => [
|
||||||
|
'required',
|
||||||
|
'regex_match[/^(100(\.0{1,2})?|([0-9]{1,2})(\.[0-9]{1,2})?)$/]'
|
||||||
|
],
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Retention Rate is required',
|
||||||
|
'regex_match' => 'Retention Rate must be between 0 and 100 with up to 2 decimal places'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
// ======================
|
||||||
|
// Nhance Branch
|
||||||
|
// ======================
|
||||||
|
'nhance_branch_id' => [
|
||||||
|
'rules' => 'required|integer',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Nhance Branch is required',
|
||||||
|
'integer' => 'Invalid Nhance Branch selected'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
if (! $this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$id = !empty($data['PrimaryKey']) ? $data['PrimaryKey'] : null;
|
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||||
|
$id = !empty($sanitized_post_data['PrimaryKey']) ? $sanitized_post_data['PrimaryKey'] : null;
|
||||||
|
unset($sanitized_post_data['pk']);
|
||||||
|
|
||||||
// don't forgot same means just unset the key because partner_staff some UNIQUE KEY sets in table thats why
|
// don't forgot same means just unset the key because partner_staff some UNIQUE KEY sets in table thats why
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$existing = $this->partnerStaffModel->find((int)$id);
|
$existing = $this->partnerStaffModel->find((int)$id);
|
||||||
if ($existing) {
|
if ($existing) {
|
||||||
if ($data['email'] === $existing['email']) { unset($data['email']); }
|
if ($sanitized_post_data['email'] === $existing['email']) { unset($sanitized_post_data['email']); }
|
||||||
if ($data['mobile'] === $existing['mobile']) { unset($data['mobile']); }
|
if ($sanitized_post_data['mobile'] === $existing['mobile']) { unset($sanitized_post_data['mobile']); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$errors = [];
|
$errors = [];
|
||||||
|
|
||||||
// Check Email Duplicate (if it wasn't unset)
|
// Check Email Duplicate (if it wasn't unset)
|
||||||
if (isset($data['email'])) {
|
if (isset($sanitized_post_data['email'])) {
|
||||||
$count = $this->partnerStaffModel->where('email', $data['email'])->countAllResults();
|
$count = $this->partnerStaffModel->where('email', $sanitized_post_data['email'])->countAllResults();
|
||||||
if ($count > 0) $errors['email'] = "This email is already taken by another user.";
|
if ($count > 0) $errors['email'] = "This email is already taken by another user.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Mobile Duplicate (if it wasn't unset)
|
// Check Mobile Duplicate (if it wasn't unset)
|
||||||
if (isset($data['mobile'])) {
|
if (isset($sanitized_post_data['mobile'])) {
|
||||||
$count = $this->partnerStaffModel->where('mobile', $data['mobile'])->countAllResults();
|
$count = $this->partnerStaffModel->where('mobile', $sanitized_post_data['mobile'])->countAllResults();
|
||||||
if ($count > 0) $errors['mobile'] = "This mobile is already taken by another user.";
|
if ($count > 0) $errors['mobile'] = "This mobile is already taken by another user.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,14 +917,14 @@ class UserController extends AdminController
|
|||||||
// --- Save/Update ---
|
// --- Save/Update ---
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$text = "update";
|
$text = "update";
|
||||||
$data['updated_by'] = get_session_userid();
|
$sanitized_post_data['updated_by'] = get_session_userid();
|
||||||
|
|
||||||
$result = $this->partnerStaffModel->update($id, $data);
|
$result = $this->partnerStaffModel->update($id, $sanitized_post_data);
|
||||||
} else {
|
} else {
|
||||||
$text = "create";
|
$text = "create";
|
||||||
$data['role_id'] = 1;
|
$sanitized_post_data['role_id'] = 1;
|
||||||
$data['created_by'] = get_session_userid();
|
$sanitized_post_data['created_by'] = get_session_userid();
|
||||||
$id = $this->partnerStaffModel->insert($data);
|
$id = $this->partnerStaffModel->insert($sanitized_post_data);
|
||||||
if($id){
|
if($id){
|
||||||
$details['manager_id'] = $id;
|
$details['manager_id'] = $id;
|
||||||
$details['updated_by'] = get_session_userid();
|
$details['updated_by'] = get_session_userid();
|
||||||
|
|||||||
@ -112,7 +112,7 @@ class VidalApiController extends BaseController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SubmitClaim ($claimId = 515)
|
public function SubmitClaim ($claimId = null) //515
|
||||||
{
|
{
|
||||||
helper('api');
|
helper('api');
|
||||||
|
|
||||||
|
|||||||
@ -23,10 +23,8 @@ class AuthMVC implements FilterInterface
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Fingerprint validation
|
// Fingerprint validation
|
||||||
$fp = hash('sha256',
|
$fp = generateFingerprint()
|
||||||
$request->getUserAgent()->getAgentString() . '|' . $request->getIPAddress()
|
// log_message('error',$fp);
|
||||||
);
|
|
||||||
|
|
||||||
if (session()->get('fingerprint') !== $fp) {
|
if (session()->get('fingerprint') !== $fp) {
|
||||||
return AuthLogout::logout();
|
return AuthLogout::logout();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ class JWTToken
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
$models = new LevelContactModel();
|
$models = new LevelContactModel();
|
||||||
|
$id = $request_data['post_hr_id'];
|
||||||
$models->update($id, $data);
|
$models->update($id, $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1036,3 +1036,34 @@ if (!function_exists('checkDuplicateClaim')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getRealClientIP()
|
||||||
|
{
|
||||||
|
$request = service('request');
|
||||||
|
|
||||||
|
if (!empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
||||||
|
return $_SERVER['HTTP_CF_CONNECTING_IP'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||||
|
return explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $request->getIPAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateFingerprint()
|
||||||
|
{
|
||||||
|
$request = service('request');
|
||||||
|
|
||||||
|
$ua = $request->getUserAgent()->getAgentString();
|
||||||
|
$ip = getRealClientIP();
|
||||||
|
|
||||||
|
// Use only subnet (first 3 blocks) to tolerate IP change
|
||||||
|
$ipParts = explode('.', $ip);
|
||||||
|
$ipSubnet = $ipParts[0] . '.' . $ipParts[1] . '.' . $ipParts[2];
|
||||||
|
|
||||||
|
// $secret = env('app.sessionFingerprintSalt');
|
||||||
|
|
||||||
|
// return hash('sha256', $ua . '|' . $ipSubnet . '|' . $secret);
|
||||||
|
return hash('sha256', $ua . '|' . $ipSubnet );
|
||||||
|
}
|
||||||
|
|||||||
@ -684,7 +684,7 @@ table.dataTable tbody td {
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<label for="incentive_file_name">Upload File</label>
|
<label for="incentive_file_name">Upload File</label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="file" class="form-control" name="incentive_file_name" id="incentive_file_name" required>
|
<input type="file" class="form-control" name="incentive_file_name" id="incentive_file_name" required accept=".jpg,.jpeg,.png">
|
||||||
<i class="mdi mdi-upload additional-icon"></i>
|
<i class="mdi mdi-upload additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1134,6 +1134,16 @@ table.dataTable tbody td {
|
|||||||
console.error("Response Headers:", xhr.getAllResponseHeaders());
|
console.error("Response Headers:", xhr.getAllResponseHeaders());
|
||||||
console.error("Error Thrown:", error);
|
console.error("Error Thrown:", error);
|
||||||
console.error("Status:", status);
|
console.error("Status:", status);
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{toastr.error('Server error occurred.', 'Error');}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -1333,7 +1343,16 @@ table.dataTable tbody td {
|
|||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
console.log("Error: " + xhr.statusText);
|
console.log("Error: " + xhr.statusText);
|
||||||
toastr.error('Server error occurred.', 'Error');
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{toastr.error('Server error occurred.', 'Error');}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
@ -1395,6 +1414,16 @@ table.dataTable tbody td {
|
|||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
console.log("Error: " + xhr.statusText);
|
console.log("Error: " + xhr.statusText);
|
||||||
toastr.error('Server error occurred.', 'Error');
|
toastr.error('Server error occurred.', 'Error');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{toastr.error('Server error occurred.', 'Error');}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
|||||||
@ -126,7 +126,7 @@ table.dataTable thead th {
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="branchname">Upload Image</label>
|
<label for="branchname">Upload Image</label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="file" class="form-control" name="advertise_image" id="advertise_image" accept="image/*" onchange="PreviewImage();" required>
|
<input type="file" class="form-control" name="advertise_image" id="advertise_image" accept=".jpg,.jpeg,.png" onchange="PreviewImage();" required>
|
||||||
<i class="mdi mdi-upload additional-icon"></i>
|
<i class="mdi mdi-upload additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -227,7 +227,15 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
switch (xhr.status) {
|
switch (xhr.status) {
|
||||||
case 400:
|
case 400:
|
||||||
msg = xhr.responseJSON?.message || 'Bad Request — Invalid input.';
|
let response = xhr.responseJSON || JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
msg = response.message || 'Bad Request — Invalid input.';
|
||||||
break;
|
break;
|
||||||
case 401:
|
case 401:
|
||||||
msg = 'Unauthorized — Please log in again.';
|
msg = 'Unauthorized — Please log in again.';
|
||||||
|
|||||||
@ -197,6 +197,14 @@
|
|||||||
// Handle error response
|
// Handle error response
|
||||||
console.error('Upload failed:', error);
|
console.error('Upload failed:', error);
|
||||||
console.error('Upload failed:', error);
|
console.error('Upload failed:', error);
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
var response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
if (xhr.status === 500) {
|
||||||
|
var response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
// Reset button state
|
// Reset button state
|
||||||
|
|||||||
@ -204,6 +204,16 @@
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
toastr.error('An error occurred while adding the CD account number.', 'ERROR');
|
toastr.error('An error occurred while adding the CD account number.', 'ERROR');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -236,6 +236,14 @@
|
|||||||
// Handle error response
|
// Handle error response
|
||||||
console.error('Upload failed:', error);
|
console.error('Upload failed:', error);
|
||||||
console.error('Upload failed:', error);
|
console.error('Upload failed:', error);
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
var response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
if (xhr.status === 500) {
|
||||||
|
var response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
// Reset button state
|
// Reset button state
|
||||||
|
|||||||
@ -81,7 +81,7 @@ input:checked + .slider:before {
|
|||||||
style="border-radius:25px; border:1px solid #00999E;padding:10px;color:#00999E;"
|
style="border-radius:25px; border:1px solid #00999E;padding:10px;color:#00999E;"
|
||||||
alt="avatar"/>
|
alt="avatar"/>
|
||||||
<span style="margin-bottom:5px;">
|
<span style="margin-bottom:5px;">
|
||||||
<input type="file" name="client_logo" id="client_logo" accept="image/*" onchange="PreviewImage();"><br>
|
<input type="file" name="client_logo" id="client_logo" accept=".jpg,.jpeg,.png" onchange="PreviewImage();"><br>
|
||||||
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
|
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
@ -324,7 +324,7 @@ input:checked + .slider:before {
|
|||||||
$.each(res.data, function (index, item) {
|
$.each(res.data, function (index, item) {
|
||||||
var row = `<tr>
|
var row = `<tr>
|
||||||
<td> ${item.file_name}</td>
|
<td> ${item.file_name}</td>
|
||||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name" accept=".jpg,.jpeg,.png">
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||||
<input type="hidden" name="client_id" id="id_for_kyc_file" value="${client_id_for_file}"/>
|
<input type="hidden" name="client_id" id="id_for_kyc_file" value="${client_id_for_file}"/>
|
||||||
@ -349,7 +349,16 @@ input:checked + .slider:before {
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$submitButton.prop('disabled', false);
|
$submitButton.prop('disabled', false);
|
||||||
if (xhr.status === 404) {
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 404) {
|
||||||
toastr.warning('Resource not found', 'Warning');
|
toastr.warning('Resource not found', 'Warning');
|
||||||
} else if (xhr.status === 500) {
|
} else if (xhr.status === 500) {
|
||||||
toastr.warning('Internal server error', 'Warning');
|
toastr.warning('Internal server error', 'Warning');
|
||||||
|
|||||||
@ -304,7 +304,8 @@
|
|||||||
<td>${item.file_name}</td>
|
<td>${item.file_name}</td>
|
||||||
<td id="form_${item.id}">
|
<td id="form_${item.id}">
|
||||||
<form class="ajax">
|
<form class="ajax">
|
||||||
<input class="file-input__input" type="file" name="file_name">
|
<input class="file-input__input" type="file" name="file_name"
|
||||||
|
accept=".pdf,.jpg,.jpeg,.png">
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
||||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
|
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
|
||||||
<input type="hidden" name="client_id" value="${client_id}">
|
<input type="hidden" name="client_id" value="${client_id}">
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
<div class="form-group col-md-3 file-input-group">
|
<div class="form-group col-md-3 file-input-group">
|
||||||
<label for="file_input">Browser File<span class="text-danger">*</span></label>
|
<label for="file_input">Browser File<span class="text-danger">*</span></label>
|
||||||
<input type="file" class="form-control file-input" id="kyc_docs_file" name="file_name" required
|
<input type="file" class="form-control file-input" id="kyc_docs_file" name="file_name" required
|
||||||
|
accept=".pdf,.jpg,.jpeg,.png"
|
||||||
style="box-shadow: none !important; outline: none !important; border: none; height: unset !important;padding: 0px !important;background: transparent !important;">
|
style="box-shadow: none !important; outline: none !important; border: none; height: unset !important;padding: 0px !important;background: transparent !important;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<!-- <td><?= $index + 1; ?></td> -->
|
<!-- <td><?= $index + 1; ?></td> -->
|
||||||
<td><?= esc($item['file_name']); ?></td>
|
<td><?= esc($item['file_name']); ?></td>
|
||||||
<td><?= esc($item['other_docs_name']); ?></td>
|
<td><?= esc($item['other_docs_name']); ?></td>
|
||||||
<td><a id="download_<?= esc($item['id']); ?>" data-id="<?= esc($item['id']); ?>" class="mdi mdi-download" style="font-size:18px;" download></a></td>
|
<td><a id="download_<?= esc($item['id']); ?>" data-id="<?= esc($item['id']); ?>" class="mdi mdi-download" style="font-size:18px;" download title="Download file"></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<?php if(empty($item['upload_doc_name'])) { ?>
|
<?php if(empty($item['upload_doc_name'])) { ?>
|
||||||
<td id="form_<?= esc($item['id']); ?>">
|
<td id="form_<?= esc($item['id']); ?>">
|
||||||
<form class="ajax" enctype="multipart/form-data" method="post">
|
<form class="ajax" enctype="multipart/form-data" method="post">
|
||||||
<input class="file-input__input" type="file" name="file_name">
|
<input class="file-input__input" type="file" name="file_name" accept=".pdf,.jpg,.jpeg,.png">
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
||||||
<input type="hidden" class="form-control" value="<?= esc($item['id']); ?>" name="kyc_doc_type_id">
|
<input type="hidden" class="form-control" value="<?= esc($item['id']); ?>" name="kyc_doc_type_id">
|
||||||
<input type="hidden" name="client_id" value="<?= esc($client_id); ?>">
|
<input type="hidden" name="client_id" value="<?= esc($client_id); ?>">
|
||||||
|
|||||||
@ -48,6 +48,7 @@
|
|||||||
name="file_name"
|
name="file_name"
|
||||||
id="kyc_docs_file_<?= $value['id'] ?>"
|
id="kyc_docs_file_<?= $value['id'] ?>"
|
||||||
class="form-control edit-file-input"
|
class="form-control edit-file-input"
|
||||||
|
accept=".pdf,.jpg,.jpeg,.png"
|
||||||
style="box-shadow:none!important; outline:none!important; border:none; height:unset!important;padding: 0px !important;background: transparent !important;">
|
style="box-shadow:none!important; outline:none!important; border:none; height:unset!important;padding: 0px !important;background: transparent !important;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -832,7 +832,16 @@ input:checked + .slider_blue::before {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 404) {
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 404) {
|
||||||
//console.log('Resource not found', 'Warning');
|
//console.log('Resource not found', 'Warning');
|
||||||
} else if (xhr.status === 500) {
|
} else if (xhr.status === 500) {
|
||||||
//console.log('Internal server error', 'Warning');
|
//console.log('Internal server error', 'Warning');
|
||||||
|
|||||||
@ -548,8 +548,16 @@
|
|||||||
console.error('Response Text: ', xhr.responseText);
|
console.error('Response Text: ', xhr.responseText);
|
||||||
}
|
}
|
||||||
|
|
||||||
toastr.warning('Error uploading file', 'WARNING');
|
if (xhr.status === 400) {
|
||||||
console.error('Upload error:', error);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{ toastr.warning('Error uploading file', 'WARNING'); }
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
|
|||||||
@ -326,6 +326,18 @@
|
|||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
toastr.error("Something went wrong!", 'Error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -449,6 +449,17 @@
|
|||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
toastr.error("Something went wrong!", 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -254,6 +254,16 @@ input:checked + .slider:before {
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log('Something Wrong!', 'warning');
|
console.log('Something Wrong!', 'warning');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -323,14 +323,37 @@
|
|||||||
console.error('Response headers:', xhr.getAllResponseHeaders());
|
console.error('Response headers:', xhr.getAllResponseHeaders());
|
||||||
console.error('Response URL:', xhr.responseURL);
|
console.error('Response URL:', xhr.responseURL);
|
||||||
|
|
||||||
// Example of throwing a detailed error for further handling
|
// Handle validation errors (CI4)
|
||||||
throw new Error(`AJAX Request failed:
|
if (xhr.status === 400) {
|
||||||
Status: ${status},
|
|
||||||
Error: ${error},
|
let response = null;
|
||||||
Status Code: ${xhr.status},
|
|
||||||
Status Text: ${xhr.statusText},
|
try {
|
||||||
Response: ${xhr.responseText}
|
response = JSON.parse(xhr.responseText);
|
||||||
`);
|
} catch (e) {
|
||||||
|
toastr.error('Invalid server response', 'Error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle server errors
|
||||||
|
if (xhr.status >= 500) {
|
||||||
|
toastr.error('Server error. Please try again later.', 'Error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback
|
||||||
|
toastr.error('Unexpected error occurred.', 'Error');
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
|
|||||||
@ -254,6 +254,16 @@ $(document).ready(function () {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Something Wrong!', 'warning');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
@ -296,6 +306,16 @@ $(document).ready(function () {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Something Wrong!', 'warning');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1701,6 +1701,16 @@
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -553,7 +553,7 @@ if (isset($selected_lead_type)) {
|
|||||||
|
|
||||||
let isFirstField = container.childElementCount === 0; // Check if it's the first field
|
let isFirstField = container.childElementCount === 0; // Check if it's the first field
|
||||||
let placeholder = isFirstField ? 'First file must be Demography.' : '';
|
let placeholder = isFirstField ? 'First file must be Demography.' : '';
|
||||||
let accept = isFirstField ? '.xls,.xlsx' : '';
|
let accept = isFirstField ? '.xls,.xlsx' : '.xls,.xlsx,.pdf,.jpg,.jpeg,.png';
|
||||||
|
|
||||||
|
|
||||||
if(selected_lead_form_type != 1){
|
if(selected_lead_form_type != 1){
|
||||||
|
|||||||
@ -628,6 +628,16 @@
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -283,6 +283,16 @@
|
|||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1030,7 +1030,7 @@ function addHTMLInput(data = null, container_id = 'dynamic-form-container')
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<label for="file">Upload File<span class="text-danger">${required_star}</span></label>
|
<label for="file">Upload File<span class="text-danger">${required_star}</span></label>
|
||||||
<input type="file" class="form-control" id="file_name" name="file[]" ${required}>
|
<input type="file" class="form-control" id="file_name" name="file[]" ${required} accept=".pdf,.jpg,.jpeg,.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this, '${container_id}')">x</a>
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this, '${container_id}')">x</a>
|
||||||
@ -1216,7 +1216,7 @@ function addHTMLInputForVehicleFileUpload(data = null, container_id = 'dynamic-f
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<label for="file">Upload File<span class="text-danger">${required_star}</span></label>
|
<label for="file">Upload File<span class="text-danger">${required_star}</span></label>
|
||||||
<input type="file" class="form-control" id="file_name" name="file_name[]" ${required}>
|
<input type="file" class="form-control" id="file_name" name="file_name[]" ${required} accept=".pdf,.jpg,.jpeg,.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInputForVehicleFileUpload(this, '${container_id}')">x</a>
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInputForVehicleFileUpload(this, '${container_id}')">x</a>
|
||||||
|
|||||||
@ -1013,7 +1013,7 @@ function addHTMLInput(data = null)
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<label for="file">Upload File<span class="text-danger">*</span></label>
|
<label for="file">Upload File<span class="text-danger">*</span></label>
|
||||||
<input type="file" class="form-control" id="file_name" name="file[]" required>
|
<input type="file" class="form-control" id="file_name" name="file[]" accept=".pdf,.jpg,.jpeg,.png" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||||
@ -1192,7 +1192,7 @@ function addHTMLInputForVehicleFileUpload(data = null)
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<label for="file">Upload File<span class="text-danger">*</span></label>
|
<label for="file">Upload File<span class="text-danger">*</span></label>
|
||||||
<input type="file" class="form-control" id="file_name" name="file_name[]" required>
|
<input type="file" class="form-control" id="file_name" name="file_name[]" accept=".pdf,.jpg,.jpeg,.png" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInputForVehicleFileUpload(this)">x</a>
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInputForVehicleFileUpload(this)">x</a>
|
||||||
|
|||||||
@ -175,21 +175,21 @@
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="aadhar_file_name">Aadhar</label>
|
<label for="aadhar_file_name">Aadhar</label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="file" class="form-control" name="aadhar_file_name" id="aadhar_file_name" accept="image/*,application/pdf">
|
<input type="file" class="form-control" name="aadhar_file_name" id="aadhar_file_name" accept=".pdf,.jpg,.jpeg,.png">
|
||||||
<i class="mdi mdi-upload additional-icon"></i>
|
<i class="mdi mdi-upload additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="pan_file_name">PAN</label>
|
<label for="pan_file_name">PAN</label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="file" class="form-control" name="pan_file_name" id="pan_file_name" accept="image/*,application/pdf">
|
<input type="file" class="form-control" name="pan_file_name" id="pan_file_name" accept=".pdf,.jpg,.jpeg,.png">
|
||||||
<i class="mdi mdi-upload additional-icon"></i>
|
<i class="mdi mdi-upload additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="certificate_file_name">Certificate</label>
|
<label for="certificate_file_name">Certificate</label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="file" class="form-control" name="certificate_file_name" id="certificate_file_name" accept="image/*,application/pdf">
|
<input type="file" class="form-control" name="certificate_file_name" id="certificate_file_name" accept=".pdf,.jpg,.jpeg,.png">
|
||||||
<i class="mdi mdi-upload additional-icon"></i>
|
<i class="mdi mdi-upload additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -363,6 +363,16 @@
|
|||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -312,6 +312,16 @@
|
|||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error("Something went wrong!", 'Error');
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ $increment = 1;
|
|||||||
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
|
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
|
||||||
$isFirstField = ($index === 0);
|
$isFirstField = ($index === 0);
|
||||||
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
|
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
|
||||||
$accept = $isFirstField ? '.xls,.xlsx' : '';
|
$accept = $isFirstField ? '.xls,.xlsx' : '.xls,.xlsx,.pdf,.jpg,.jpeg,.png';
|
||||||
$displayIndex = $index + 1;
|
$displayIndex = $index + 1;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -243,6 +243,16 @@
|
|||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -715,8 +715,19 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
console.error('Response Text: ', xhr.responseText);
|
console.error('Response Text: ', xhr.responseText);
|
||||||
}
|
}
|
||||||
|
|
||||||
toastr.warning('Error uploading file', 'WARNING');
|
if (xhr.status === 400) {
|
||||||
console.error('Upload error:', error);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{ toastr.warning('Error uploading file', 'WARNING'); }
|
||||||
|
|
||||||
|
// toastr.warning('Error uploading file', 'WARNING');
|
||||||
|
// console.error('Upload error:', error);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
|
|||||||
@ -506,7 +506,17 @@ beccause = dataTables_length and dataTables_paginate need in same line thats why
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
toastr.error("Something went wrong!", 'Error');}
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
|
|||||||
@ -571,7 +571,16 @@ data-backdrop="static"
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{ toastr.error("Something went wrong!", 'Error'); }
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
@ -619,8 +628,19 @@ data-backdrop="static"
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error("Something went wrong!", 'Error');
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() { btn.disabled = false;}
|
complete: function() { btn.disabled = false;}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -434,7 +434,16 @@
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.error('Something Wrong!', 'warning');
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else{toastr.error('Something Wrong!', 'warning');}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -328,6 +328,17 @@
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log('Something Wrong!', 'warning');
|
console.log('Something Wrong!', 'warning');
|
||||||
|
// Handle validation errors (CI4)
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -478,6 +478,16 @@ $(document).ready(function () {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
toastr.warning('Something Wrong!', 'warning');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -222,7 +222,7 @@ $(document).ready(function() {
|
|||||||
$.each(res.data, function(index, item) {
|
$.each(res.data, function(index, item) {
|
||||||
var row = `<tr>
|
var row = `<tr>
|
||||||
<td> ${item.file_name}</td>
|
<td> ${item.file_name}</td>
|
||||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name" accept=".jpg,.jpeg,.png">
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||||
<input type="hidden" name="client_id" id="id_for_kyc_file" value="${client_id_for_file}"/>
|
<input type="hidden" name="client_id" id="id_for_kyc_file" value="${client_id_for_file}"/>
|
||||||
@ -247,7 +247,16 @@ $(document).ready(function() {
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$submitButton.prop('disabled', false);
|
$submitButton.prop('disabled', false);
|
||||||
if (xhr.status === 404) {
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 404) {
|
||||||
toastr.warning('Resource not found', 'Warning');
|
toastr.warning('Resource not found', 'Warning');
|
||||||
} else if (xhr.status === 500) {
|
} else if (xhr.status === 500) {
|
||||||
toastr.warning('Internal server error', 'Warning');
|
toastr.warning('Internal server error', 'Warning');
|
||||||
|
|||||||
@ -787,6 +787,16 @@ $("#vehicle_form").submit(function(event) {
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -581,7 +581,7 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<label for="incentive_file_name">Upload File</label>
|
<label for="incentive_file_name">Upload File</label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="file" class="form-control" name="incentive_file_name" id="incentive_file_name" required>
|
<input type="file" class="form-control" name="incentive_file_name" id="incentive_file_name" accept=".jpg,.jpeg,.png" required>
|
||||||
<i class="mdi mdi-upload additional-icon"></i>
|
<i class="mdi mdi-upload additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -222,6 +222,16 @@
|
|||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
toastr.warning(message, 'Validation Error');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7345,7 +7345,7 @@ function appendMultiFileData(data) {
|
|||||||
|
|
||||||
let isFirstField = container.childElementCount === 0; // Check if it's the first field
|
let isFirstField = container.childElementCount === 0; // Check if it's the first field
|
||||||
let placeholder = isFirstField ? 'First file must be Demography.' : '';
|
let placeholder = isFirstField ? 'First file must be Demography.' : '';
|
||||||
let accept = isFirstField ? '.xls,.xlsx' : '';
|
let accept = isFirstField ? '.xls,.xlsx' : '.xls,.xlsx,.pdf,.jpg,.jpeg,.png';
|
||||||
|
|
||||||
|
|
||||||
if(isFirstField == 1){
|
if(isFirstField == 1){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user