Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4ff4b35912
@ -22,6 +22,7 @@ class Acl
|
|||||||
'#^/util/log_list#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/util/log_list#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
'#^/util/view_log#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/util/view_log#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
'#^/util/download_log#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/util/download_log#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
|
'#^/metaDashboardDemo#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
|
|
||||||
// ===================== PUBLIC DOWNLOADS / FORMS =====================
|
// ===================== PUBLIC DOWNLOADS / FORMS =====================
|
||||||
'#^/download-#' => ['public' => true],
|
'#^/download-#' => ['public' => true],
|
||||||
|
|||||||
@ -774,8 +774,7 @@ $routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_cla
|
|||||||
|
|
||||||
|
|
||||||
//Third party ICICILombard Api Call
|
//Third party ICICILombard Api Call
|
||||||
|
$routes->get('generateAuthToken','ICICILombardController::generateAuthToken');
|
||||||
$routes->get('generateAuthToken','FhplApiController::generateAuthToken');
|
|
||||||
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
|
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
|
||||||
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
|
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
|
||||||
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
||||||
@ -793,6 +792,7 @@ $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');
|
||||||
$routes->get('syncTpaClaimToNhance','MediAssistApiController::syncTpaClaimToNhance');
|
$routes->get('syncTpaClaimToNhance','MediAssistApiController::syncTpaClaimToNhance');
|
||||||
|
$routes->get('HealthIndiaGetBenefDetails','HealthIndiaApiController::HealthIndiaGetBenefDetails');
|
||||||
|
|
||||||
|
|
||||||
// API service (Don't delete)
|
// API service (Don't delete)
|
||||||
|
|||||||
@ -3407,9 +3407,10 @@ class EmployeeController extends AdminController
|
|||||||
try {
|
try {
|
||||||
$rules = [
|
$rules = [
|
||||||
'endorsement_no' => [
|
'endorsement_no' => [
|
||||||
'rules' => 'required',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_\-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Endorsement Number is missing'
|
'required' => 'Endorsement Number is missing.',
|
||||||
|
'regex_match' => 'Endorsement Number can only contain letters, numbers, slashes (/), underscores (_), and hyphens (-).'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'status' => [
|
'status' => [
|
||||||
|
|||||||
@ -416,8 +416,10 @@ class HealthIndiaApiController extends BaseController
|
|||||||
try {
|
try {
|
||||||
helper('api');
|
helper('api');
|
||||||
|
|
||||||
$policyNo = $requestData['policy_no'] ?? null;
|
$policyNo = $requestData['policy_no'] ?? '141600_POLICY_AWAITED';
|
||||||
$client_policy_id = $requestData['client_policy_id'] ?? null;
|
$client_policy_id = $requestData['client_policy_id'] ?? 6473;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($policyNo)) {
|
if (empty($policyNo)) {
|
||||||
log_message('error', 'TPA ID PULL HEALTH_INDIA | policy_no missing in request');
|
log_message('error', 'TPA ID PULL HEALTH_INDIA | policy_no missing in request');
|
||||||
@ -440,22 +442,24 @@ class HealthIndiaApiController extends BaseController
|
|||||||
log_message('error', "TPA ID PULL HEALTH_INDIA | called for policy_no: {$policyNo}, client_policy_id: {$client_policy_id}");
|
log_message('error', "TPA ID PULL HEALTH_INDIA | called for policy_no: {$policyNo}, client_policy_id: {$client_policy_id}");
|
||||||
|
|
||||||
// Fetch file download dates
|
// Fetch file download dates
|
||||||
$batchFiles = $this->db->table('batch_files f')
|
// $batchFiles = $this->db->table('batch_files f')
|
||||||
->select("f.created_at")
|
// ->select("f.created_at")
|
||||||
->where('f.client_policy_id', $client_policy_id)
|
// ->where('f.client_policy_id', $client_policy_id)
|
||||||
->where('f.insurer_or_tpa', 'tpa')
|
// ->where('f.insurer_or_tpa', 'tpa')
|
||||||
->where('f.actions', 'export')
|
// ->where('f.actions', 'export')
|
||||||
->get()
|
// ->get()
|
||||||
->getResultArray();
|
// ->getResultArray();
|
||||||
|
|
||||||
if (empty($batchFiles)) {
|
|
||||||
log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request');
|
|
||||||
if ($function_calling_type == "job") {
|
// if (empty($batchFiles)) {
|
||||||
return ['status' => false, 'message' => 'batchFiles not found'];
|
// log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request');
|
||||||
} else {
|
// if ($function_calling_type == "job") {
|
||||||
return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
|
// return ['status' => false, 'message' => 'batchFiles not found'];
|
||||||
}
|
// } else {
|
||||||
}
|
// return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// Generate Health India Token
|
// Generate Health India Token
|
||||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||||
@ -485,6 +489,8 @@ class HealthIndiaApiController extends BaseController
|
|||||||
|
|
||||||
$response = call_third_party_api($url, 'POST', $headers, $body);
|
$response = call_third_party_api($url, 'POST', $headers, $body);
|
||||||
|
|
||||||
|
dd($response);
|
||||||
|
|
||||||
log_message('error', "TPA ID PULL HEALTH_INDIA | API Response: " . json_encode($response));
|
log_message('error', "TPA ID PULL HEALTH_INDIA | API Response: " . json_encode($response));
|
||||||
|
|
||||||
if (($response['status'] ?? false) !== true) {
|
if (($response['status'] ?? false) !== true) {
|
||||||
|
|||||||
@ -86,32 +86,64 @@ class ICICILombardController extends AdminController
|
|||||||
// dd($body);
|
// dd($body);
|
||||||
|
|
||||||
|
|
||||||
|
// $body = [
|
||||||
|
// "PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
||||||
|
// "CDBGAccountNumber" => "CD-MUM-0026",
|
||||||
|
// "CorrelationId" => "550e8400-e29b-41d4-a716-446655440016",
|
||||||
|
// "MemberDetails" => [
|
||||||
|
// [
|
||||||
|
// "MemberEmpId" => "EMPID3625562",
|
||||||
|
// "DOJ" => "21-MAR-2019",
|
||||||
|
// "InsuredName" => "Jeeva",
|
||||||
|
// "DOB" => "7-JUL-1993",
|
||||||
|
// "Relationship" => "SELF",
|
||||||
|
// "Gender" => "MALE",
|
||||||
|
// "DOC" => '28-Oct-2025',
|
||||||
|
// "SumInsured" => "500000",
|
||||||
|
// "EmailId" => "Jeeva@GMAIL.COM",
|
||||||
|
// "FlagStatus" => "A"
|
||||||
|
// ],
|
||||||
|
// [
|
||||||
|
// "MemberEmpId" => "EMPID3625562",
|
||||||
|
// "DOJ" => "21-MAR-2019",
|
||||||
|
// "InsuredName" => "Muthu",
|
||||||
|
// "DOB" => "8-AUG-1970",
|
||||||
|
// "Relationship" => "MOTHER",
|
||||||
|
// "Gender" => "FEMALE",
|
||||||
|
// "DOC" => '28-Oct-2025',
|
||||||
|
// "EmailId" => "Muthu@GMAIL.COM",
|
||||||
|
// "FlagStatus" => "A"
|
||||||
|
// ],
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
|
||||||
"CDBGAccountNumber" => "CD-MUM-0026",
|
"CDBGAccountNumber" => "CD-MUM-0026",
|
||||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440014",
|
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440018",
|
||||||
"MemberDetails" => [
|
"MemberDetails" => [
|
||||||
[
|
[
|
||||||
"MemberEmpId" => "EMPID3625560",
|
"MemberEmpId" => "EMPID3625562",
|
||||||
"DOJ" => "21-MAR-2019",
|
"DOJ" => "21-MAR-2019",
|
||||||
"InsuredName" => "Gowtham",
|
"InsuredName" => "Jeeva",
|
||||||
"DOB" => "7-JUL-1993",
|
"DOB" => "7-JUL-1993",
|
||||||
"Relationship" => "SELF",
|
"Relationship" => "SELF",
|
||||||
"Gender" => "MALE",
|
"Gender" => "MALE",
|
||||||
"DOC" => '2025-10-27',
|
"DOC" => '19-Nov-2025',
|
||||||
"SumInsured" => "500000",
|
"SumInsured" => "500000",
|
||||||
"EmailId" => "Gowtham@GMAIL.COM",
|
"EmailId" => "Jeeva@GMAIL.COM",
|
||||||
"FlagStatus" => "A"
|
"FlagStatus" => "A"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"MemberEmpId" => "EMPID3625560",
|
"MemberEmpId" => "EMPID3625562",
|
||||||
"DOJ" => "21-MAR-2019",
|
"DOJ" => "21-MAR-2019",
|
||||||
"InsuredName" => "Lavanya",
|
"InsuredName" => "Muthu",
|
||||||
"DOB" => "8-AUG-1970",
|
"DOB" => "8-AUG-1970",
|
||||||
"Relationship" => "MOTHER",
|
"Relationship" => "MOTHER",
|
||||||
"Gender" => "FEMALE",
|
"Gender" => "FEMALE",
|
||||||
"DOC" => '2025-10-27',
|
"DOC" => '19-Nov-2025',
|
||||||
"EmailId" => "Lavanya@GMAIL.COM",
|
"EmailId" => "Muthu@GMAIL.COM",
|
||||||
"FlagStatus" => "A"
|
"FlagStatus" => "A"
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
@ -147,9 +179,9 @@ class ICICILombardController extends AdminController
|
|||||||
// dd($headers);
|
// dd($headers);
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
|
||||||
"BatchId" => "3723144",
|
"BatchId" => "3725147",
|
||||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440014"
|
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440018"
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
||||||
@ -183,7 +215,7 @@ class ICICILombardController extends AdminController
|
|||||||
$body = [
|
$body = [
|
||||||
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
||||||
"IMID" => "201580517901",
|
"IMID" => "201580517901",
|
||||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440014"
|
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440018"
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
||||||
|
|||||||
@ -380,7 +380,7 @@ class LeadsController extends BaseController
|
|||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'lead_type' => [
|
'lead_type' => [
|
||||||
'rules' => 'required',
|
'rules' => 'integer',
|
||||||
'errors' => ['required' => 'Lead Type is required']
|
'errors' => ['required' => 'Lead Type is required']
|
||||||
],
|
],
|
||||||
'issuer' => [
|
'issuer' => [
|
||||||
@ -456,6 +456,38 @@ class LeadsController extends BaseController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1. MANUALLY VALIDATE FILES BEFORE PROCESSING
|
||||||
|
// $allFiles = $this->request->getFiles();
|
||||||
|
// foreach ($allFiles as $inputName => $files) {
|
||||||
|
// // If it's a single file, wrap it in an array to use the same logic
|
||||||
|
// $fileArray = is_array($files) ? $files : [$files];
|
||||||
|
|
||||||
|
// foreach ($fileArray as $index => $file) {
|
||||||
|
// if ($file->isValid() && !$file->hasMoved()) {
|
||||||
|
// $extension = strtolower($file->getExtension());
|
||||||
|
|
||||||
|
// // Logic: index 0 is Excel only, others are mixed
|
||||||
|
// if ($index === 0) {
|
||||||
|
// $allowed = ['xls', 'xlsx'];
|
||||||
|
// } else {
|
||||||
|
// $allowed = ['xls', 'xlsx', 'pdf', 'jpg', 'jpeg', 'png'];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!in_array($extension, $allowed)) {
|
||||||
|
// // Return 400 Error immediately
|
||||||
|
// return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
// 'status' => false,
|
||||||
|
// 'message' => 'Input validation failed',
|
||||||
|
// 'code' => 400,
|
||||||
|
// 'errors' => [
|
||||||
|
// $inputName => "File " . ($index + 1) . " has an invalid extension ($extension). Allowed: " . implode(',', $allowed)
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (!$this->validate($rules)) {
|
if (!$this->validate($rules)) {
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
|
|||||||
@ -918,6 +918,144 @@
|
|||||||
public function createInceptionPolicy()
|
public function createInceptionPolicy()
|
||||||
{
|
{
|
||||||
$post_data = $this->request->getPost();
|
$post_data = $this->request->getPost();
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
// ==========================================
|
||||||
|
// 1. CLIENT SECTION (5 Fields)
|
||||||
|
// ==========================================
|
||||||
|
'client_id' => ['label' => 'Client','rules' => 'required','errors' => ['required' => 'Please select a Client.']],
|
||||||
|
'client_type' => ['label' => 'Client Type','rules' => 'required','errors' => ['required' => 'Client Type must be selected.']],
|
||||||
|
'industry_type' => ['label' => 'Industry','rules' => 'permit_empty','errors' => []], // No errors needed for permit_empty unless adding other rules
|
||||||
|
'gst_no' => ['label' => 'GST Number','rules' => 'permit_empty|regex_match[/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/]','errors' => ['alpha_numeric' => 'GST Number should only contain letters and numbers.','regex_match' => 'Invalid GST format. (Example: 22AAAAA0000A1Z5)']],
|
||||||
|
'pan_no' => ['label' => 'PAN Number','rules' => 'permit_empty|regex_match[/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/]','errors' => ['alpha_numeric' => 'PAN Number should only contain letters and numbers.','regex_match' => 'Invalid PAN format. (Example: ABCDE1234F)']],
|
||||||
|
// ==========================================
|
||||||
|
// 2. PRE-SALES SECTION (3 Fields)
|
||||||
|
// ==========================================
|
||||||
|
'lead_source' => ['label' => 'Lead Source', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
'opportunity_id' => ['label' => 'Opportunity', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
'quotation_ref' => ['label' => 'Quotation Ref', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// 3. POLICY DOCUMENT (2 Fields)
|
||||||
|
// ==========================================
|
||||||
|
'policy_copy' => ['label' => 'Policy Copy', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
'proposal_form' => ['label' => 'Proposal Form', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// 4. VEHICLE DOCUMENT (2 Fields)
|
||||||
|
// ==========================================
|
||||||
|
'rc_copy' => ['label' => 'RC Copy', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
'inspection_report' => ['label' => 'Inspection Report', 'rules' => 'permit_empty', 'errors' => []],
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// 5. SALES SECTION (12 Fields)
|
||||||
|
// ==========================================
|
||||||
|
'base_policy' => ['label' => 'Base Policy', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'policy_no' => ['label' => 'Policy Number', 'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_-]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Policy Number is Must.',
|
||||||
|
'regex_match' => 'Policy Number can only contain letters, numbers, and symbols like / - or _'
|
||||||
|
]],
|
||||||
|
'policy_issue_date' => ['label' => 'Issue Date', 'rules' => 'required|valid_date[Y-m-d]|regex_match[/^\d{4}-\d{2}-\d{2}$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Policy Issue Date is required.',
|
||||||
|
'valid_date' => 'Please provide a valid Policy Issue Date.',
|
||||||
|
'regex_match' => 'The Policy Issue Date format is incorrect. '
|
||||||
|
]],
|
||||||
|
'month' => ['label' => 'Issue Month', 'rules' => 'required','errors' => [
|
||||||
|
'required' => 'Please select or enter the Policy Issue Month.'
|
||||||
|
]],
|
||||||
|
'policy_start_date' => ['label' => 'D.O.C',
|
||||||
|
'rules' => 'required|valid_date[Y-m-d]|regex_match[/^\d{4}-\d{2}-\d{2}$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'D.O.C (Start Date) is required.',
|
||||||
|
'valid_date' => 'Please provide a valid D.O.C date.',
|
||||||
|
'regex_match' => 'The D.O.C date format is incorrect. '
|
||||||
|
]],
|
||||||
|
'policy_end_date' => ['label' => 'D.O.E', 'rules' => 'required|valid_date[Y-m-d]|regex_match[/^\d{4}-\d{2}-\d{2}$/]','errors' => [
|
||||||
|
'required' => 'D.O.E (Expiry Date) is required.',
|
||||||
|
'valid_date' => 'Please provide a valid D.O.E date.',
|
||||||
|
'regex_match' => 'The D.O.E date format is incorrect. '
|
||||||
|
]],
|
||||||
|
'emp_count' => ['label' => 'No of Insured', 'rules' => 'permit_empty|numeric','errors' => [
|
||||||
|
'numeric' => 'No of Insured must contain only numbers.'
|
||||||
|
]],
|
||||||
|
'dependent_count' => ['label' => 'No of Dependents', 'rules' => 'permit_empty|numeric','errors' => [
|
||||||
|
'numeric' => 'No of Dependents must contain only numbers.'
|
||||||
|
]],
|
||||||
|
'installment' => ['label' => 'Installment', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'installment_data' => ['label' => 'Installment Data', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'co_share' => ['label' => 'CoP Yes', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'bro_payable_by' => ['label' => 'Remuneration Pay By', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'renewal_date' => ['label' => 'Renewal Date', 'rules' => 'required|valid_date[Y-m-d]|regex_match[/^\d{4}-\d{2}-\d{2}$/]','errors' => [
|
||||||
|
'required' => 'Renewal Date is required.',
|
||||||
|
'valid_date' => 'Please provide a valid Renewal Date.',
|
||||||
|
'regex_match' => 'The Renewal Date format is incorrect. '
|
||||||
|
]],
|
||||||
|
'sales_generated_by' => ['label' => 'Sales Generated By', 'rules' => 'permit_empty','errors' => [
|
||||||
|
// 'required' => 'Please select the person who generated this sale.'
|
||||||
|
]],
|
||||||
|
'serviced_by' => ['label' => 'Serviced By', 'rules' => 'permit_empty','errors' => [
|
||||||
|
// 'required' => 'Please select the service person for this policy.'
|
||||||
|
]],
|
||||||
|
'pos_id' => ['label' => 'POS', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// 6. PREMIUM DETAILS (Array Fields - 25 Fields)
|
||||||
|
// Use .* because these come from the dynamic table
|
||||||
|
// ==========================================
|
||||||
|
'follow_insurer_id.*' => ['label' => 'Insurer', 'rules' => 'required','errors' => ['required' => 'Please select an Insurer.']],
|
||||||
|
'co_share_type.*' => ['label' => 'Is Leader', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'cd_ac_no_for_child.*' => ['label' => 'CD Acc No', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'cd_current_balance.*' => ['label' => 'CD Amount', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'follower_policy_no.*' => ['label' => 'Follower Policy No', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'calc_policy_issue_date.*' => ['label' => 'Policy Issue Date', 'rules' => 'required','errors' => [ 'required' => 'Policy Issue Date is required' ]],
|
||||||
|
'co_share_per.*' => ['label' => 'Co-Share %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Co-Share % must be a valid decimal.']],
|
||||||
|
'non_comm_per_amt.*' => ['label' => 'Non-Comm Premium', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Amount must be numeric.']],
|
||||||
|
'base_premium.*' => ['label' => 'Base Premium', 'rules' => 'required|numeric|differs[0]','errors' => [
|
||||||
|
'required' => 'Base Premium is required.',
|
||||||
|
'numeric' => 'Base Premium must be a valid number.',
|
||||||
|
'differs' => 'Base Premium cannot be zero; please enter a positive or negative value.'
|
||||||
|
]],
|
||||||
|
'tp_premium.*' => ['label' => 'TP Premium', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'TP Premium must be numeric.']],
|
||||||
|
'ter_premium.*' => ['label' => 'TEP Premium', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'TEP Premium must be numeric.']],
|
||||||
|
'co_premium.*' => ['label' => 'Co-Premium', 'rules' => 'permit_empty|decimal','errors'=> ['decimal' => 'Co-Premium must be numeric.']],
|
||||||
|
'co_tp_premium.*' => ['label' => 'Co-TP Premium', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Co-TP Premium must be numeric.']],
|
||||||
|
'co_ter_premium.*' => ['label' => 'Co-TEP Premium', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Co-TEP Premium must be numeric.']],
|
||||||
|
'cgst.*' => ['label' => 'CGST', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'CGST must be numeric.']],
|
||||||
|
'sgst.*' => ['label' => 'SGST', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'SGST must be numeric.']],
|
||||||
|
'igst.*' => ['label' => 'IGST', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'IGST must be numeric.']],
|
||||||
|
'gst_amount.*' => ['label' => 'GST Amount', 'rules' => 'permit_empty|decimal|greater_than[0]','errors' => [
|
||||||
|
'decimal' => 'GST Amount must be a valid numeric value.',
|
||||||
|
'greater_than' => 'GST Amount cannot be zero; please enter a value greater than 0.'
|
||||||
|
]],
|
||||||
|
'stamp_duty.*' => ['label' => 'Stamp Duty', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Stamp Duty must be numeric.']],
|
||||||
|
'total.*' => ['label' => 'Total', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Total must be a numeric value.']],
|
||||||
|
'agreed_bp.*' => ['label' => 'Agreed BP %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Agreed BP % must be numeric.']],
|
||||||
|
'agreed_tp.*' => ['label' => 'Agreed TP %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Agreed TP % must be numeric.']],
|
||||||
|
'agreed_ter.*' => ['label' => 'Agreed TEP %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Agreed TEP % must be numeric.']],
|
||||||
|
'agreed_amount.*' => ['label' => 'Agreed Amount', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Agreed Amount must be numeric.']],
|
||||||
|
'actual_bp_amt.*' => ['label' => 'Actual BP Amount', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Actual BP Amount must be numeric.']],
|
||||||
|
'actual_tp_amt.*' => ['label' => 'Actual TP Amount', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Actual TP Amount must be numeric.']],
|
||||||
|
'actual_tep_amt.*' => ['label' => 'Actual TEP Amount', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Actual TEP Amount must be numeric.']],
|
||||||
|
'actual_bp_per.*' => ['label' => 'Actual BP %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Actual BP % must be numeric.']],
|
||||||
|
'actual_tp_per.*' => ['label' => 'Actual TP %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Actual TP % must be numeric.']],
|
||||||
|
'actual_tep_per.*' => ['label' => 'Actual TEP %', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'Actual TEP % must be numeric.']],
|
||||||
|
'actual_bp_brokerage_amt.*'=> ['label' => 'BP Remuneration', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'BP Remuneration must be numeric.']],
|
||||||
|
'actual_tp_brokerage_amt.*'=> ['label' => 'TP Remuneration', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'TP Remuneration must be numeric.']],
|
||||||
|
'actual_tep_brokerage_amt.*'=>['label' => 'TEP Remuneration', 'rules' => 'permit_empty|decimal','errors' => ['decimal' => 'TEP Remuneration must be numeric.']],
|
||||||
|
'exp_amt.*' => ['label' => 'Expected Amount', 'rules' => 'permit_empty|decimal','errors' => ['decimal'=> 'The Expected Amount field must contain a valid number.']]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$post_data = $post_data ? sanitizeInputArrayAdvanced($post_data) : [];
|
$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));
|
||||||
@ -2253,16 +2391,264 @@
|
|||||||
public function createEndorsementPolicy()
|
public function createEndorsementPolicy()
|
||||||
{
|
{
|
||||||
// $id = $this->request->getPost('id');
|
// $id = $this->request->getPost('id');
|
||||||
|
$rules = [
|
||||||
|
// ==========================================
|
||||||
|
// 1. CLIENT SECTION
|
||||||
|
// ==========================================
|
||||||
|
'client_id' => [
|
||||||
|
'label' => 'Client',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Client selection is mandatory.']
|
||||||
|
],
|
||||||
|
'client_policy_id' => [
|
||||||
|
'label' => 'Policy',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Please select the policy to endorse.']
|
||||||
|
],
|
||||||
|
'client_type' => ['rules' => 'permit_empty','errors' => []],
|
||||||
|
'client_branch_id' => ['rules' => 'permit_empty','errors' => []],
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// 2. ENDORSEMENT SECTION
|
||||||
|
// ==========================================
|
||||||
|
'action_type' => [
|
||||||
|
'label' => 'Endorsement Type',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Select an Endorsement Type.']
|
||||||
|
],
|
||||||
|
'endorsement_no' => ['label' => 'Endorsement No','rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9\/_-]+$/]',
|
||||||
|
'errors' => [ 'regex_match' => 'Endorsement No can only contain letters, numbers, and symbols like / - or _' ]],
|
||||||
|
'data_received_date' => [
|
||||||
|
'label' => 'Data Received Date',
|
||||||
|
'rules' => 'required|valid_date[d/m/Y]',
|
||||||
|
'errors' => ['required' => 'Data Received Date is required.', 'valid_date' => 'Please provide a valid Data Received Date.']
|
||||||
|
],
|
||||||
|
'policy_issue_date' => [
|
||||||
|
'label' => 'Endorsement Issue Date',
|
||||||
|
'rules' => 'required|valid_date[d/m/Y]',
|
||||||
|
'errors' => ['required' => 'Endorsement Issue Date is required.', 'valid_date' => 'Please provide a valid Endorsement Issue Date.']
|
||||||
|
],
|
||||||
|
// ==========================================
|
||||||
|
// ENDORSEMENT SECTION
|
||||||
|
// ==========================================
|
||||||
|
'month' => [
|
||||||
|
'label' => 'Endorsement Issue Month',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Endorsement Issue Month (MM/YYYY) is required.']
|
||||||
|
],
|
||||||
|
'endorse_eff_date' => [
|
||||||
|
'label' => 'Endorsement Effective Date',
|
||||||
|
'rules' => 'permit_empty|valid_date[d/m/Y]',
|
||||||
|
'errors' => ['valid_date' => 'Please provide a valid Endorsement Effective Date.']
|
||||||
|
],
|
||||||
|
'emp_count' => [
|
||||||
|
'label' => 'No of Insured',
|
||||||
|
'rules' => 'permit_empty|numeric',
|
||||||
|
'errors' => ['numeric' => 'No of Insured must be a number.']
|
||||||
|
],
|
||||||
|
'dependent_count' => [
|
||||||
|
'label' => 'No of Dependents',
|
||||||
|
'rules' => 'permit_empty|numeric',
|
||||||
|
'errors' => ['numeric' => 'No of Dependents must be a number.']
|
||||||
|
],
|
||||||
|
'last_action_date' => [
|
||||||
|
'label' => 'Latest Action Date',
|
||||||
|
'rules' => 'permit_empty|valid_date[d/m/Y]',
|
||||||
|
'errors' => ['valid_date' => 'Please provide a valid Latest Action Date.']
|
||||||
|
],
|
||||||
|
'install_due_date' => [
|
||||||
|
'label' => 'Installment Due Date',
|
||||||
|
'rules' => 'permit_empty|valid_date[d/m/Y]',
|
||||||
|
'errors' => ['valid_date' => 'Please provide a valid Installment Due Date.']
|
||||||
|
],
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// PREMIUM DETAILS (ARRAY FIELDS .*)
|
||||||
|
// ==========================================
|
||||||
|
'follow_insurer_id.*' => [
|
||||||
|
'label' => 'Insurer',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Please select an Insurer.']
|
||||||
|
],
|
||||||
|
'calc_policy_issue_date.*' => [
|
||||||
|
'label' => 'Premium Endorsement Issue Date',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Endorsement Issue Date is required.']
|
||||||
|
],
|
||||||
|
'co_share_per.*' => [
|
||||||
|
'label' => 'Co-Share %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Co-Share % must be a valid decimal.']
|
||||||
|
],
|
||||||
|
'base_premium.*' => [
|
||||||
|
'label' => 'Base Premium',
|
||||||
|
'rules' => 'required|numeric|differs[0]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Base Premium is required.',
|
||||||
|
'numeric' => 'Base Premium must be a valid number.',
|
||||||
|
'differs' => 'Base Premium cannot be zero; please enter a positive or negative value.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'total.*' => [
|
||||||
|
'label' => 'Total Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Total Premium must be a valid amount.'],
|
||||||
|
],
|
||||||
|
|
||||||
|
// Decimal validation with Labels
|
||||||
|
'non_comm_per_amt.*' => [
|
||||||
|
'label' => 'Non-Comm Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Non-Comm Premium must be numeric.']
|
||||||
|
],
|
||||||
|
'tp_premium.*' => [
|
||||||
|
'label' => 'TP Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'TP Premium must be numeric.']
|
||||||
|
],
|
||||||
|
'ter_premium.*' => [
|
||||||
|
'label' => 'TEP Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'TEP Premium must be numeric.']
|
||||||
|
],
|
||||||
|
'co_premium.*' => [
|
||||||
|
'label' => 'Co-Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Co-Premium must be numeric.']
|
||||||
|
],
|
||||||
|
'co_tp_premium.*' => [
|
||||||
|
'label' => 'Co-TP Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Co-TP Premium must be numeric.']
|
||||||
|
],
|
||||||
|
'co_ter_premium.*' => [
|
||||||
|
'label' => 'Co-TEP Premium',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Co-TEP Premium must be numeric.']
|
||||||
|
],
|
||||||
|
'cgst.*' => [
|
||||||
|
'label' => 'CGST',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'CGST must be numeric.']
|
||||||
|
],
|
||||||
|
'sgst.*' => [
|
||||||
|
'label' => 'SGST',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'SGST must be numeric.']
|
||||||
|
],
|
||||||
|
'igst.*' => [
|
||||||
|
'label' => 'IGST',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'IGST must be numeric.']
|
||||||
|
],
|
||||||
|
'gst_amount.*' => [
|
||||||
|
'label' => 'GST Amount',
|
||||||
|
'rules' => 'permit_empty|decimal|greater_than[0]',
|
||||||
|
'errors' => ['decimal' => 'GST Amount must be numeric.','greater_than' => 'GST Amount cannot be zero; please enter a value greater than 0.']
|
||||||
|
],
|
||||||
|
'stamp_duty.*' => [
|
||||||
|
'label' => 'Stamp Duty',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Stamp Duty must be numeric.']
|
||||||
|
],
|
||||||
|
'agreed_bp.*' => [
|
||||||
|
'label' => 'Agreed BP %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Agreed BP % must be numeric.']
|
||||||
|
],
|
||||||
|
'agreed_tp.*' => [
|
||||||
|
'label' => 'Agreed TP %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Agreed TP % must be numeric.']
|
||||||
|
],
|
||||||
|
'agreed_ter.*' => [
|
||||||
|
'label' => 'Agreed TEP %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Agreed TEP % must be numeric.']
|
||||||
|
],
|
||||||
|
'agreed_amount.*' => [
|
||||||
|
'label' => 'Agreed Amount',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Agreed Amount must be numeric.']
|
||||||
|
],
|
||||||
|
|
||||||
|
// Finance/Management Specific Labels
|
||||||
|
'actual_bp_amt.*' => [
|
||||||
|
'label' => 'Actual BP Amount',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Actual BP Amount must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_tp_amt.*' => [
|
||||||
|
'label' => 'Actual TP Amount',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Actual TP Amount must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_tep_amt.*' => [
|
||||||
|
'label' => 'Actual TEP Amount',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Actual TEP Amount must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_bp_per.*' => [
|
||||||
|
'label' => 'Actual BP %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Actual BP % must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_tp_per.*' => [
|
||||||
|
'label' => 'Actual TP %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Actual TP % must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_tep_per.*' => [
|
||||||
|
'label' => 'Actual TEP %',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Actual TEP % must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_bp_brokerage_amt.*' => [
|
||||||
|
'label' => 'BP Remuneration',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'BP Remuneration must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_tp_brokerage_amt.*' => [
|
||||||
|
'label' => 'TP Remuneration',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'TP Remuneration must be numeric.']
|
||||||
|
],
|
||||||
|
'actual_tep_brokerage_amt.*' => [
|
||||||
|
'label' => 'TEP Remuneration',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'TEP Remuneration must be numeric.']
|
||||||
|
],
|
||||||
|
'exp_amt.*' => [
|
||||||
|
'label' => 'Expected Amount',
|
||||||
|
'rules' => 'permit_empty|decimal',
|
||||||
|
'errors' => ['decimal' => 'Expected Amount must be numeric.']
|
||||||
|
],
|
||||||
|
'co_share_type.*' => ['label' => 'Is Leader', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'follower_policy_no.*' => ['label' => 'Follower Policy No', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
'co_share_id.*' => ['label' => 'Record ID', 'rules' => 'permit_empty','errors' => []],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$data = $this->preparePolicyTransactionData();
|
$data = $this->preparePolicyTransactionData();
|
||||||
|
|
||||||
|
$id = (isset($data['id']) && !empty($data['id'])) ? $data['id'] : null;
|
||||||
|
|
||||||
$data['status'] = 'completed';
|
$data['status'] = 'completed';
|
||||||
$id = $data['id'] ?? null;
|
|
||||||
// print_r($data); die;
|
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
return $this->insertEndorsementTransaction($data);
|
return $this->insertEndorsementTransaction($data);
|
||||||
} else {
|
} else {
|
||||||
return $this->updateEndorsementTransaction($id, $data);
|
return $this->updateEndorsementTransaction($id, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function preparePolicyTransactionData()
|
private function preparePolicyTransactionData()
|
||||||
|
|||||||
@ -114,7 +114,8 @@ class RestAuthenticationController extends AdminController
|
|||||||
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
||||||
$check = canSendOtp($employeeData);
|
$check = canSendOtp($employeeData);
|
||||||
if (!$check['allowed']) {
|
if (!$check['allowed']) {
|
||||||
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
|
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee verified with ID = " . $employeeData['employee_id']);
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee verified with ID = " . $employeeData['employee_id']);
|
||||||
@ -227,7 +228,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
||||||
$check = canSendOtp($employeeData);
|
$check = canSendOtp($employeeData);
|
||||||
if (!$check['allowed']) {
|
if (!$check['allowed']) {
|
||||||
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
|
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -535,7 +536,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
||||||
$check = canSendOtp($HrData);
|
$check = canSendOtp($HrData);
|
||||||
if (!$check['allowed']) {
|
if (!$check['allowed']) {
|
||||||
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
|
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE level_contacts SET otp = ? WHERE mobile = ? AND contact_type = 'client' AND is_active = 1";
|
$sql = "UPDATE level_contacts SET otp = ? WHERE mobile = ? AND contact_type = 'client' AND is_active = 1";
|
||||||
@ -591,7 +592,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
//check the resend otp (with in 60 seconds don't allow another otp to send)
|
||||||
$check = canSendOtp($HrData);
|
$check = canSendOtp($HrData);
|
||||||
if (!$check['allowed']) {
|
if (!$check['allowed']) {
|
||||||
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
|
return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
|||||||
@ -953,6 +953,13 @@ class TicketController extends BaseController
|
|||||||
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||||
|
|
||||||
|
|
||||||
|
// Security Check: Verify if record exists
|
||||||
|
if (empty($ticket_data)) {
|
||||||
|
// Redirect or show a 404 to prevent "Undefined array key" errors
|
||||||
|
return redirect()->to(base_url('ticket/list'))->with('error', 'Ticket not found');
|
||||||
|
}
|
||||||
|
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
|
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
|
||||||
|
|
||||||
if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) {
|
if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) {
|
||||||
@ -1120,117 +1127,197 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
public function createTicket()
|
public function createTicket()
|
||||||
{
|
{
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$selected_ticket_type = $this->request->getPost('ticket_type_id');
|
||||||
|
|
||||||
|
// 1. Initialize an empty rules array
|
||||||
|
$rules = [];
|
||||||
|
if ($selected_ticket_type == 1 || $selected_ticket_type == 72) {
|
||||||
$rules = [
|
$rules = [
|
||||||
'emp_code' => [
|
// --- EMPLOYEE DETAILS ---
|
||||||
'rules' => 'required',
|
'emp_code' => ['label' => 'Employee Code','rules' => 'required|alpha_numeric_space',
|
||||||
'errors' => ['required' => 'Employee Code is required']
|
'errors' => ['required' => 'Employee Code is required']
|
||||||
],
|
],
|
||||||
|
'emp_name' => ['label' => 'Employee Name','rules' => 'required|min_length[3]',
|
||||||
'emp_name' => [
|
'errors' => ['required' => 'Employee Name is required','min_length' => 'Employee Name must be at least 3 characters long']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Employee Name is required']
|
|
||||||
],
|
],
|
||||||
|
'insured_name' => ['label' => 'Insured Name','rules' => 'required',
|
||||||
'insured_name' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Insured Name is required']
|
'errors' => ['required' => 'Insured Name is required']
|
||||||
],
|
],
|
||||||
|
'relationship' => ['label' => 'Relationship','rules' => 'required',
|
||||||
'relationship' => [
|
'errors' => ['required' => 'Please select a Relationship']
|
||||||
'rules' => 'required',
|
],
|
||||||
'errors' => ['required' => 'Relationship is required']
|
'policy_no' => ['label' => 'Policy No','rules' => 'permit_empty','errors' => []],
|
||||||
|
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty','errors' => []],
|
||||||
|
'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'numeric' => 'Mobile must contain only numbers',
|
||||||
|
'exact_length' => 'Mobile must be exactly 10 digits'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'emp_mail' => ['label' => 'Employee Mail ID','rules' => 'required|valid_email',
|
||||||
|
'errors' => ['required' => 'Employee Email is required','valid_email' => 'Please provide a valid email address']
|
||||||
|
],
|
||||||
|
'emp_personal_mail' => ['label' => 'Personal Mail ID','rules' => 'permit_empty|valid_email',
|
||||||
|
'errors' => ['valid_email' => 'Personal email format is invalid']
|
||||||
|
],
|
||||||
|
'client_policy_id' => ['label' => 'Policy','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Please select a Policy']
|
||||||
|
],
|
||||||
|
'acm_id' => ['label' => 'Account Manager','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Select an Account Manager']
|
||||||
],
|
],
|
||||||
|
|
||||||
'emp_mobile' => [
|
// --- CLAIM DETAILS ---
|
||||||
'rules' => 'required',
|
'claim_status_id' => ['label' => 'Status','rules' => 'required',
|
||||||
'errors' => ['required' => 'Employee Mobile is required']
|
|
||||||
],
|
|
||||||
|
|
||||||
'emp_mail' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Employee Email is required']
|
|
||||||
],
|
|
||||||
|
|
||||||
'client_id' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Client ID 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']
|
'errors' => ['required' => 'Claim Status is required']
|
||||||
],
|
],
|
||||||
|
'priority' => ['label' => 'Priority','rules' => 'required',
|
||||||
'priority' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Priority is required']
|
'errors' => ['required' => 'Priority is required']
|
||||||
],
|
],
|
||||||
|
'mode_of_intimation' => ['label' => 'Mode of Submission','rules' => 'required',
|
||||||
'mode_of_intimation' => [
|
'errors' => ['required' => 'Mode of Submission is required']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Mode of Intimation is required']
|
|
||||||
],
|
],
|
||||||
|
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
||||||
'claim_type' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Claim Type is required']
|
'errors' => ['required' => 'Claim Type is required']
|
||||||
],
|
],
|
||||||
|
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
|
||||||
'hospital_name' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Name is required']
|
'errors' => ['required' => 'Hospital Name is required']
|
||||||
],
|
],
|
||||||
|
'hospital_address' => ['label' => 'Hospital Address','rules' => 'required',
|
||||||
'hospital_address' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Address is required']
|
'errors' => ['required' => 'Hospital Address is required']
|
||||||
],
|
],
|
||||||
|
'hospital_city' => ['label' => 'Hospital City','rules' => 'required',
|
||||||
'hospital_city' => [
|
'errors' => ['required' => 'City is required']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital City is required']
|
|
||||||
],
|
],
|
||||||
|
'hospital_state' => ['label' => 'Hospital State','rules' => 'required',
|
||||||
'hospital_state' => [
|
'errors' => ['required' => 'State is required']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital State is required']
|
|
||||||
],
|
],
|
||||||
|
'hospital_pin_code' => ['label' => 'Hospital Pincode','rules' => 'required|numeric|exact_length[6]',
|
||||||
'hospital_pin_code' => [
|
'errors' => ['exact_length' => 'Pincode must be 6 digits']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Pincode is required']
|
|
||||||
],
|
],
|
||||||
|
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
|
||||||
'hospital_phone_no' => [
|
'errors' => ['min_length' => 'Phone number too short']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Phone Number is required']
|
|
||||||
],
|
],
|
||||||
|
'doa' => ['label' => 'DOA', 'rules' => 'required',
|
||||||
'doa' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Date of Admission is required']
|
'errors' => ['required' => 'Date of Admission is required']
|
||||||
],
|
],
|
||||||
|
'dod' => [ 'label' => 'DOD', 'rules' => 'required',
|
||||||
'dod' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Date of Discharge is required']
|
'errors' => ['required' => 'Date of Discharge is required']
|
||||||
],
|
],
|
||||||
|
|
||||||
'claim_amount' => [
|
'claim_amount' => [
|
||||||
'rules' => 'required',
|
'label' => 'Claim Amount',
|
||||||
'errors' => ['required' => 'Claim Amount is required']
|
'rules' => 'permit_empty|numeric',
|
||||||
|
'errors' => ['numeric' => 'Claim Amount must contain only numbers.']
|
||||||
|
],
|
||||||
|
'pod_no' => ['label' => 'POD No','rules' => 'permit_empty','errors' => []],
|
||||||
|
|
||||||
|
// --- ADDITIONAL / CONDITIONAL FIELDS ---
|
||||||
|
'claim_number' => ['label' => 'Claim Number','rules' => 'permit_empty|alpha_numeric_punct','errors' => ['alpha_numeric_punct' => 'Invalid Claim Number.']],
|
||||||
|
'denial_date' => ['label' => 'Denial Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Denial Date must be dd/mm/yyyy.']],
|
||||||
|
'approved_amount' => ['label' => 'Approved Amount','rules' => 'permit_empty|numeric',
|
||||||
|
'errors' => ['numeric' => 'Approved amount must be numeric']
|
||||||
|
],
|
||||||
|
'approved_date' => ['label' => 'Approved Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Approved Date must be dd/mm/yyyy.']],
|
||||||
|
'approved_letter' => ['label' => 'Approved Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'approved_description' => ['label' => 'Approved Description','rules' => 'permit_empty','errors' => []],
|
||||||
|
'utr_details' => ['label' => 'UTR Details','rules' => 'permit_empty|alpha_numeric_punct','errors' => ['alpha_numeric_punct' => 'UTR Details contains invalid characters.']],
|
||||||
|
'settled_date' => ['label' => 'Settled Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Settled Date must be dd/mm/yyyy.']],
|
||||||
|
'settle_letter' => ['label' => 'Settle Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'pay_initiate_date' => ['label' => 'Payment Initiate Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Payment Initiate Date must be dd/mm/yyyy.']],
|
||||||
|
'cancel_remark' => ['label' => 'Cancel Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
'return_remark' => ['label' => 'Return Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
'awb_no_courier_name' => ['label' => 'AWB No','rules' => 'permit_empty','errors' => []],
|
||||||
|
'non_id_reason' => ['label' => 'Non ID Reason','rules' => 'permit_empty','errors' => []],
|
||||||
|
'client_id' => ['rules' => 'required','errors' => ['required' => 'Client ID is required']],
|
||||||
|
'insurer_id' => ['rules' => 'required','errors' => ['required' => 'Insurer is required'],
|
||||||
|
'si_amt' => [ 'label' => 'Sum Insured', 'rules' => 'permit_empty|numeric', 'errors' => ['numeric' => 'Sum Insured must be a valid number.']],
|
||||||
|
'registration_date' => ['label' => 'Registration Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Registration Date must be dd/mm/yyyy.']],
|
||||||
|
'denial_reason' => ['label' => 'Denial Reason', 'rules' => 'permit_empty|string','errors' => ['string' => 'Invalid characters in Denial Reason.']],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
} else if ($selected_ticket_type == 8) {
|
||||||
|
$rules = [
|
||||||
|
// --- GENERAL DETAILS ---
|
||||||
|
'client_name' => ['label' => 'Client Name','rules' => 'required|is_not_list[0]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Please select a Client Name.',
|
||||||
|
'is_not_list' => 'Please select a valid Client from the list.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'vehicle_id' => ['label' => 'Vehicle',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Vehicle selection is required.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'client_policy_id' => ['label' => 'Policy','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Please select a Policy.',]
|
||||||
|
],
|
||||||
|
'insurer_id' => ['label' => 'Insurer ID','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Insurer data is missing. Please re-select the policy.']
|
||||||
|
],
|
||||||
|
'emp_mobile' => ['label' => 'Mobile No','rules' => 'permit_empty|numeric|exact_length[10]',
|
||||||
|
'errors' => ['numeric' => 'Mobile number must contain only digits.',
|
||||||
|
'exact_length' => 'Mobile number must be exactly 10 digits.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'emp_mail' => ['label' => 'Mail ID','rules' => 'permit_empty|valid_email',
|
||||||
|
'errors' => ['valid_email' => 'Please provide a valid email address format.']
|
||||||
|
],
|
||||||
|
|
||||||
|
// --- CLAIM DETAILS ---
|
||||||
|
'ticket_type_id' => ['label' => 'Policy Type','rules' => 'required','errors' => ['required' => 'Policy Type is required.']],
|
||||||
|
'claim_status_id' => ['label' => 'Status','rules' => 'required','errors' => ['required' => 'Status is required.']],
|
||||||
|
|
||||||
|
// --- HIDDEN KEYS (Integrity Checks) ---
|
||||||
|
'ticket_master_id' => ['label' => 'Ticket Master ID','rules' => 'permit_empty','errors' => []],
|
||||||
|
'client_id' => ['label' => 'Client ID','rules' => 'required','errors' => ['required' => 'System error: Client ID is missing.']]
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$rules = [
|
||||||
|
// --- EMPLOYEE DETAILS ---
|
||||||
|
'emp_code' => ['label' => 'Employee ID', 'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Code is required']
|
||||||
|
],
|
||||||
|
'emp_name' => ['label' => 'Employee Name','rules' => 'required|min_length[3]',
|
||||||
|
'errors' => ['required' => 'Employee Name is required','min_length' => 'Employee Name must be at least 3 characters long']
|
||||||
|
],
|
||||||
|
'emp_mobile' => ['label' => 'Mobile No','rules' => 'required|numeric|exact_length[10]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'numeric' => 'Mobile must be digits only',
|
||||||
|
'exact_length' => 'Mobile must be exactly 10 digits'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'emp_mail' => ['label' => 'Mail ID','rules' => 'required|valid_email',
|
||||||
|
'errors' => ['required' => 'Official email is required','valid_email' => 'Please provide a valid official email']
|
||||||
|
],
|
||||||
|
'emp_personal_mail' => ['label' => 'Personal Mail','rules' => 'permit_empty|valid_email',
|
||||||
|
'errors' => ['valid_email' => 'Personal email format is invalid']
|
||||||
|
],
|
||||||
|
'client_policy_id' => ['label' => 'Policy','rules' => 'required','errors' => ['required' => 'Please select a Policy']],
|
||||||
|
'acm_id' => ['label' => 'Account Manager','rules' => 'required','errors' => ['required' => 'Account Manager must be selected']],
|
||||||
|
|
||||||
|
// --- CLAIM DETAILS ---
|
||||||
|
'claim_status_id' => ['label' => 'Status','rules' => 'required','errors' => ['required' => 'Claim status is required']],
|
||||||
|
'claim_type' => ['label' => 'Claim Type','rules' => 'required','errors' => ['required' => 'Claim type is required']],
|
||||||
|
'dob' => ['label' => 'Date of Birth','rules' => 'required','errors' => ['required' => 'Date of Birth is required']],
|
||||||
|
'date_of_intimat' => ['label' => 'Date of Intimation','rules' => 'required','errors' => ['required' => 'Intimation date is required']],
|
||||||
|
'si_amt' => ['label' => 'Sum Insured','rules' => 'required|numeric','errors' => ['numeric' => 'Sum insured must be a number']],
|
||||||
|
'approved_amount' => ['label' => 'Approved Amount','rules' => 'permit_empty|numeric','errors' => ['numeric' => 'Approved amount must be numeric']],
|
||||||
|
'approved_date' => ['label' => 'Approved Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Approved Date must be dd/mm/yyyy.']],
|
||||||
|
'approved_letter' => ['label' => 'Approved Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'approved_description' => ['label' => 'Approved Description','rules' => 'permit_empty','errors' => []],
|
||||||
|
'utr_details' => ['label' => 'UTR Details','rules' => 'permit_empty|alpha_numeric_punct','errors' => ['alpha_numeric_punct' => 'UTR Details contains invalid characters.']],
|
||||||
|
'settled_date' => ['label' => 'Settled Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Settled Date must be dd/mm/yyyy.']],
|
||||||
|
'settle_letter' => ['label' => 'Settle Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'pay_initiate_date' => ['label' => 'Payment Initiate Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Payment Initiate Date must be dd/mm/yyyy.']],
|
||||||
|
'cancel_remark' => ['label' => 'Cancel Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
'return_remark' => ['label' => 'Return Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->validate($rules)) {
|
if (!$this->validate($rules)) {
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
@ -1304,118 +1391,197 @@ class TicketController extends BaseController
|
|||||||
public function updateTicket()
|
public function updateTicket()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$selected_ticket_type = $this->request->getPost('ticket_type_id');
|
||||||
|
|
||||||
|
// 1. Initialize an empty rules array
|
||||||
|
$rules = [];
|
||||||
|
if ($selected_ticket_type == 1 || $selected_ticket_type == 72) {
|
||||||
$rules = [
|
$rules = [
|
||||||
'emp_code' => [
|
// --- EMPLOYEE DETAILS ---
|
||||||
'rules' => 'required',
|
'emp_code' => ['label' => 'Employee Code','rules' => 'required|alpha_numeric_space',
|
||||||
'errors' => ['required' => 'Employee Code is required']
|
'errors' => ['required' => 'Employee Code is required']
|
||||||
],
|
],
|
||||||
|
'emp_name' => ['label' => 'Employee Name','rules' => 'required|min_length[3]',
|
||||||
'emp_name' => [
|
'errors' => ['required' => 'Employee Name is required','min_length' => 'Employee Name must be at least 3 characters long']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Employee Name is required']
|
|
||||||
],
|
],
|
||||||
|
'insured_name' => ['label' => 'Insured Name','rules' => 'required',
|
||||||
'insured_name' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Insured Name is required']
|
'errors' => ['required' => 'Insured Name is required']
|
||||||
],
|
],
|
||||||
|
'relationship' => ['label' => 'Relationship','rules' => 'required',
|
||||||
'relationship' => [
|
'errors' => ['required' => 'Please select a Relationship']
|
||||||
'rules' => 'required',
|
],
|
||||||
'errors' => ['required' => 'Relationship is required']
|
'policy_no' => ['label' => 'Policy No','rules' => 'permit_empty','errors' => []],
|
||||||
|
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty','errors' => []],
|
||||||
|
'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'numeric' => 'Mobile must contain only numbers',
|
||||||
|
'exact_length' => 'Mobile must be exactly 10 digits'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'emp_mail' => ['label' => 'Employee Mail ID','rules' => 'required|valid_email',
|
||||||
|
'errors' => ['required' => 'Employee Email is required','valid_email' => 'Please provide a valid email address']
|
||||||
|
],
|
||||||
|
'emp_personal_mail' => ['label' => 'Personal Mail ID','rules' => 'permit_empty|valid_email',
|
||||||
|
'errors' => ['valid_email' => 'Personal email format is invalid']
|
||||||
|
],
|
||||||
|
'client_policy_id' => ['label' => 'Policy','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Please select a Policy']
|
||||||
|
],
|
||||||
|
'acm_id' => ['label' => 'Account Manager','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Select an Account Manager']
|
||||||
],
|
],
|
||||||
|
|
||||||
'emp_mobile' => [
|
// --- CLAIM DETAILS ---
|
||||||
'rules' => 'required',
|
'claim_status_id' => ['label' => 'Status','rules' => 'required',
|
||||||
'errors' => ['required' => 'Employee Mobile is required']
|
|
||||||
],
|
|
||||||
|
|
||||||
'emp_mail' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Employee Email is required']
|
|
||||||
],
|
|
||||||
|
|
||||||
'client_id' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Client ID 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']
|
'errors' => ['required' => 'Claim Status is required']
|
||||||
],
|
],
|
||||||
|
'priority' => ['label' => 'Priority','rules' => 'required',
|
||||||
'priority' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Priority is required']
|
'errors' => ['required' => 'Priority is required']
|
||||||
],
|
],
|
||||||
|
'mode_of_intimation' => ['label' => 'Mode of Submission','rules' => 'required',
|
||||||
'mode_of_intimation' => [
|
'errors' => ['required' => 'Mode of Submission is required']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Mode of Intimation is required']
|
|
||||||
],
|
],
|
||||||
|
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
||||||
'claim_type' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Claim Type is required']
|
'errors' => ['required' => 'Claim Type is required']
|
||||||
],
|
],
|
||||||
|
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
|
||||||
'hospital_name' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Name is required']
|
'errors' => ['required' => 'Hospital Name is required']
|
||||||
],
|
],
|
||||||
|
'hospital_address' => ['label' => 'Hospital Address','rules' => 'required',
|
||||||
'hospital_address' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Address is required']
|
'errors' => ['required' => 'Hospital Address is required']
|
||||||
],
|
],
|
||||||
|
'hospital_city' => ['label' => 'Hospital City','rules' => 'required',
|
||||||
'hospital_city' => [
|
'errors' => ['required' => 'City is required']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital City is required']
|
|
||||||
],
|
],
|
||||||
|
'hospital_state' => ['label' => 'Hospital State','rules' => 'required',
|
||||||
'hospital_state' => [
|
'errors' => ['required' => 'State is required']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital State is required']
|
|
||||||
],
|
],
|
||||||
|
'hospital_pin_code' => ['label' => 'Hospital Pincode','rules' => 'required|numeric|exact_length[6]',
|
||||||
'hospital_pin_code' => [
|
'errors' => ['exact_length' => 'Pincode must be 6 digits']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Pincode is required']
|
|
||||||
],
|
],
|
||||||
|
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
|
||||||
'hospital_phone_no' => [
|
'errors' => ['min_length' => 'Phone number too short']
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Hospital Phone Number is required']
|
|
||||||
],
|
],
|
||||||
|
'doa' => ['label' => 'DOA', 'rules' => 'required',
|
||||||
'doa' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Date of Admission is required']
|
'errors' => ['required' => 'Date of Admission is required']
|
||||||
],
|
],
|
||||||
|
'dod' => [ 'label' => 'DOD', 'rules' => 'required',
|
||||||
'dod' => [
|
|
||||||
'rules' => 'required',
|
|
||||||
'errors' => ['required' => 'Date of Discharge is required']
|
'errors' => ['required' => 'Date of Discharge is required']
|
||||||
],
|
],
|
||||||
|
|
||||||
'claim_amount' => [
|
'claim_amount' => [
|
||||||
'rules' => 'required',
|
'label' => 'Claim Amount',
|
||||||
'errors' => ['required' => 'Claim Amount is required']
|
'rules' => 'permit_empty|numeric',
|
||||||
|
'errors' => ['numeric' => 'Claim Amount must contain only numbers.']
|
||||||
|
],
|
||||||
|
'pod_no' => ['label' => 'POD No','rules' => 'permit_empty','errors' => []],
|
||||||
|
|
||||||
|
// --- ADDITIONAL / CONDITIONAL FIELDS ---
|
||||||
|
'claim_number' => ['label' => 'Claim Number','rules' => 'permit_empty|alpha_numeric_punct','errors' => ['alpha_numeric_punct' => 'Invalid Claim Number.']],
|
||||||
|
'denial_date' => ['label' => 'Denial Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Denial Date must be dd/mm/yyyy.']],
|
||||||
|
'approved_amount' => ['label' => 'Approved Amount','rules' => 'permit_empty|numeric',
|
||||||
|
'errors' => ['numeric' => 'Approved amount must be numeric']
|
||||||
|
],
|
||||||
|
'approved_date' => ['label' => 'Approved Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Approved Date must be dd/mm/yyyy.']],
|
||||||
|
'approved_letter' => ['label' => 'Approved Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'approved_description' => ['label' => 'Approved Description','rules' => 'permit_empty','errors' => []],
|
||||||
|
'utr_details' => ['label' => 'UTR Details','rules' => 'permit_empty|alpha_numeric_punct','errors' => ['alpha_numeric_punct' => 'UTR Details contains invalid characters.']],
|
||||||
|
'settled_date' => ['label' => 'Settled Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Settled Date must be dd/mm/yyyy.']],
|
||||||
|
'settle_letter' => ['label' => 'Settle Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'pay_initiate_date' => ['label' => 'Payment Initiate Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Payment Initiate Date must be dd/mm/yyyy.']],
|
||||||
|
'cancel_remark' => ['label' => 'Cancel Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
'return_remark' => ['label' => 'Return Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
'awb_no_courier_name' => ['label' => 'AWB No','rules' => 'permit_empty','errors' => []],
|
||||||
|
'non_id_reason' => ['label' => 'Non ID Reason','rules' => 'permit_empty','errors' => []],
|
||||||
|
'client_id' => ['rules' => 'required','errors' => ['required' => 'Client ID is required']],
|
||||||
|
'insurer_id' => ['rules' => 'required','errors' => ['required' => 'Insurer is required'],
|
||||||
|
'si_amt' => [ 'label' => 'Sum Insured', 'rules' => 'permit_empty|numeric', 'errors' => ['numeric' => 'Sum Insured must be a valid number.']],
|
||||||
|
'registration_date' => ['label' => 'Registration Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Registration Date must be dd/mm/yyyy.']],
|
||||||
|
'denial_reason' => ['label' => 'Denial Reason', 'rules' => 'permit_empty|string','errors' => ['string' => 'Invalid characters in Denial Reason.']],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
} else if ($selected_ticket_type == 8) {
|
||||||
|
$rules = [
|
||||||
|
// --- GENERAL DETAILS ---
|
||||||
|
'client_name' => ['label' => 'Client Name','rules' => 'required|is_not_list[0]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Please select a Client Name.',
|
||||||
|
'is_not_list' => 'Please select a valid Client from the list.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'vehicle_id' => ['label' => 'Vehicle',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Vehicle selection is required.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'client_policy_id' => ['label' => 'Policy','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Please select a Policy.',]
|
||||||
|
],
|
||||||
|
'insurer_id' => ['label' => 'Insurer ID','rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Insurer data is missing. Please re-select the policy.']
|
||||||
|
],
|
||||||
|
'emp_mobile' => ['label' => 'Mobile No','rules' => 'permit_empty|numeric|exact_length[10]',
|
||||||
|
'errors' => ['numeric' => 'Mobile number must contain only digits.',
|
||||||
|
'exact_length' => 'Mobile number must be exactly 10 digits.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'emp_mail' => ['label' => 'Mail ID','rules' => 'permit_empty|valid_email',
|
||||||
|
'errors' => ['valid_email' => 'Please provide a valid email address format.']
|
||||||
|
],
|
||||||
|
|
||||||
|
// --- CLAIM DETAILS ---
|
||||||
|
'ticket_type_id' => ['label' => 'Policy Type','rules' => 'required','errors' => ['required' => 'Policy Type is required.']],
|
||||||
|
'claim_status_id' => ['label' => 'Status','rules' => 'required','errors' => ['required' => 'Status is required.']],
|
||||||
|
|
||||||
|
// --- HIDDEN KEYS (Integrity Checks) ---
|
||||||
|
'ticket_master_id' => ['label' => 'Ticket Master ID','rules' => 'permit_empty','errors' => []],
|
||||||
|
'client_id' => ['label' => 'Client ID','rules' => 'required','errors' => ['required' => 'System error: Client ID is missing.']]
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$rules = [
|
||||||
|
// --- EMPLOYEE DETAILS ---
|
||||||
|
'emp_code' => ['label' => 'Employee ID', 'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'Employee Code is required']
|
||||||
|
],
|
||||||
|
'emp_name' => ['label' => 'Employee Name','rules' => 'required|min_length[3]',
|
||||||
|
'errors' => ['required' => 'Employee Name is required','min_length' => 'Employee Name must be at least 3 characters long']
|
||||||
|
],
|
||||||
|
'emp_mobile' => ['label' => 'Mobile No','rules' => 'required|numeric|exact_length[10]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Mobile number is required',
|
||||||
|
'numeric' => 'Mobile must be digits only',
|
||||||
|
'exact_length' => 'Mobile must be exactly 10 digits'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'emp_mail' => ['label' => 'Mail ID','rules' => 'required|valid_email',
|
||||||
|
'errors' => ['required' => 'Official email is required','valid_email' => 'Please provide a valid official email']
|
||||||
|
],
|
||||||
|
'emp_personal_mail' => ['label' => 'Personal Mail','rules' => 'permit_empty|valid_email',
|
||||||
|
'errors' => ['valid_email' => 'Personal email format is invalid']
|
||||||
|
],
|
||||||
|
'client_policy_id' => ['label' => 'Policy','rules' => 'required','errors' => ['required' => 'Please select a Policy']],
|
||||||
|
'acm_id' => ['label' => 'Account Manager','rules' => 'required','errors' => ['required' => 'Account Manager must be selected']],
|
||||||
|
|
||||||
|
// --- CLAIM DETAILS ---
|
||||||
|
'claim_status_id' => ['label' => 'Status','rules' => 'required','errors' => ['required' => 'Claim status is required']],
|
||||||
|
'claim_type' => ['label' => 'Claim Type','rules' => 'required','errors' => ['required' => 'Claim type is required']],
|
||||||
|
'dob' => ['label' => 'Date of Birth','rules' => 'required','errors' => ['required' => 'Date of Birth is required']],
|
||||||
|
'date_of_intimat' => ['label' => 'Date of Intimation','rules' => 'required','errors' => ['required' => 'Intimation date is required']],
|
||||||
|
'si_amt' => ['label' => 'Sum Insured','rules' => 'required|numeric','errors' => ['numeric' => 'Sum insured must be a number']],
|
||||||
|
'approved_amount' => ['label' => 'Approved Amount','rules' => 'permit_empty|numeric','errors' => ['numeric' => 'Approved amount must be numeric']],
|
||||||
|
'approved_date' => ['label' => 'Approved Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Approved Date must be dd/mm/yyyy.']],
|
||||||
|
'approved_letter' => ['label' => 'Approved Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'approved_description' => ['label' => 'Approved Description','rules' => 'permit_empty','errors' => []],
|
||||||
|
'utr_details' => ['label' => 'UTR Details','rules' => 'permit_empty|alpha_numeric_punct','errors' => ['alpha_numeric_punct' => 'UTR Details contains invalid characters.']],
|
||||||
|
'settled_date' => ['label' => 'Settled Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Settled Date must be dd/mm/yyyy.']],
|
||||||
|
'settle_letter' => ['label' => 'Settle Letter','rules' => 'permit_empty','errors' => []],
|
||||||
|
'pay_initiate_date' => ['label' => 'Payment Initiate Date','rules' => 'permit_empty|regex_match[/^\d{2}\/\d{2}\/\d{4}$/]','errors' => ['regex_match' => 'Payment Initiate Date must be dd/mm/yyyy.']],
|
||||||
|
'cancel_remark' => ['label' => 'Cancel Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
'return_remark' => ['label' => 'Return Remark','rules' => 'permit_empty','errors' => []],
|
||||||
|
];
|
||||||
|
}
|
||||||
if (!$this->validate($rules)) {
|
if (!$this->validate($rules)) {
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
@ -1425,7 +1591,6 @@ class TicketController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = $this->request->getPost();
|
|
||||||
$sanitized_data = sanitizeInputArrayAdvanced($request_data);
|
$sanitized_data = sanitizeInputArrayAdvanced($request_data);
|
||||||
$ticket_data = $this->formatDateForClaim($sanitized_data);
|
$ticket_data = $this->formatDateForClaim($sanitized_data);
|
||||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||||
@ -1604,12 +1769,34 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($action == 2) {
|
} elseif ($action == 2) {
|
||||||
$data = $this->request->getPost();
|
$request_data = $this->request->getPost();
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'note' => [
|
||||||
|
'label' => 'Add Notes',
|
||||||
|
'rules' => 'required|min_length[3]|max_length[1000]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'The note field cannot be empty.',
|
||||||
|
'min_length' => 'The note is too short (minimum 3 characters).',
|
||||||
|
'max_length' => 'The note cannot exceed 1000 characters.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
// if (isset($data['id']) && $data['id'] != ''){
|
// if (isset($data['id']) && $data['id'] != ''){
|
||||||
// print_rr($data);die();
|
// print_rr($data);die();
|
||||||
$status = $this->ticketNoteModel->save($data);
|
$status = $this->ticketNoteModel->save($data);
|
||||||
$id = isset($data['id']) ? $data['id'] : $this->ticketNoteModel->insertID();
|
$id = isset($data['id']) ? $data['id'] : $this->ticketNoteModel->insertID();
|
||||||
|
|
||||||
// }
|
// }
|
||||||
if ($status) {
|
if ($status) {
|
||||||
return $this->respond(['status' => true, 'id' => $id], 200);
|
return $this->respond(['status' => true, 'id' => $id], 200);
|
||||||
@ -1623,6 +1810,35 @@ class TicketController extends BaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$received_data = $this->request->getPost();
|
$received_data = $this->request->getPost();
|
||||||
|
$rules = [
|
||||||
|
'emp_mail' => [
|
||||||
|
'label' => 'To',
|
||||||
|
'rules' => 'required|valid_email',
|
||||||
|
'errors' => ['required' => 'Recipient email is missing.','valid_email' => 'Please provide a valid email address for the recipient.']
|
||||||
|
],
|
||||||
|
'mail_subject' => [
|
||||||
|
'label' => 'Subject',
|
||||||
|
'rules' => 'required|min_length[5]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Please enter a Subject for the mail.',
|
||||||
|
'min_length' => 'Subject should be at least 5 characters long.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'content' => [
|
||||||
|
'label' => 'Mail Content',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => ['required' => 'You cannot send an empty mail.']
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
// print_r($received_data); die;
|
// print_r($received_data); die;
|
||||||
$received_data['sender'] = 'staff';
|
$received_data['sender'] = 'staff';
|
||||||
$status = $this->ticketMessageModel->insert($received_data);
|
$status = $this->ticketMessageModel->insert($received_data);
|
||||||
@ -2773,7 +2989,45 @@ class TicketController extends BaseController
|
|||||||
public function upload_url()
|
public function upload_url()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
|
||||||
|
$request_data = $this->request->getPost();
|
||||||
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'ticket_id_url' => [
|
||||||
|
'label' => 'Ticket ID URL',
|
||||||
|
'rules' => 'required|numeric',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'System could not identify the Number.',
|
||||||
|
'numeric' => 'Invalid format.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'docs_name.*' => [
|
||||||
|
'label' => 'Required Documents',
|
||||||
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9_\- ]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Document Name is required',
|
||||||
|
'regex_match' => 'Document Name can only contain letters, numbers, hyphens, and underscores'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'url.*' => [
|
||||||
|
'label' => 'URL',
|
||||||
|
'rules' => 'required',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'URL is required',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$get_file_data = $this->request->getFiles('file_upload') ?? [];
|
$get_file_data = $this->request->getFiles('file_upload') ?? [];
|
||||||
$ticket_id = $data['ticket_id_url'];
|
$ticket_id = $data['ticket_id_url'];
|
||||||
|
|
||||||
@ -3254,12 +3508,40 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------- END CLAIM DUMP UPLOAD ----------------------------------------------------------------------------------------------
|
// -------- END CLAIM DUMP UPLOAD ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
public function saveIRDocsJson()
|
public function saveIRDocsJson()
|
||||||
{
|
{
|
||||||
$ticket_id = $this->request->getPost('ticket_id');
|
$request_data = $this->request->getPost();
|
||||||
$required_docs = $this->request->getPost('required_docs');
|
$data = sanitizeInputArrayAdvanced($request_data);
|
||||||
|
$ticket_id = $data['ticket_id'];
|
||||||
|
$required_docs = $data['required_docs'];
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'ticket_id' => [
|
||||||
|
'label' => 'Ticket ID',
|
||||||
|
'rules' => 'required|numeric',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'System could not identify the Number.',
|
||||||
|
'numeric' => 'Invalid format.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'required_docs' => [
|
||||||
|
'label' => 'Required Documents',
|
||||||
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9_\- ]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Document Name is required',
|
||||||
|
'regex_match' => 'Document Name can only contain letters, numbers, hyphens, and underscores'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if(empty($ticket_id)){
|
if(empty($ticket_id)){
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to save Docs'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to save Docs'], 200);
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class VidalApiController extends BaseController
|
|||||||
$apiUrl = getenv('VIDAL_API_BASE_URL').'/files/upload-url';
|
$apiUrl = getenv('VIDAL_API_BASE_URL').'/files/upload-url';
|
||||||
$subscriptionKey = getenv('VIDAL_API_SUBSCRIPTION_KEY');
|
$subscriptionKey = getenv('VIDAL_API_SUBSCRIPTION_KEY');
|
||||||
|
|
||||||
log_message('error', "Starting file upload process for filename: $filename | Path: $filePath");
|
log_message('error', "TPA CLAIM PUSH | Starting file upload process for filename: $filename | Path: $filePath");
|
||||||
|
|
||||||
// Step 1: Get signed URL from Vidal API
|
// Step 1: Get signed URL from Vidal API
|
||||||
// $filePath = '/opt/lampp/htdocs/nhance/writable/uploads/claim_files/1760013019_73d94af7b96ddc2e3d51.png';
|
// $filePath = '/opt/lampp/htdocs/nhance/writable/uploads/claim_files/1760013019_73d94af7b96ddc2e3d51.png';
|
||||||
@ -39,7 +39,7 @@ class VidalApiController extends BaseController
|
|||||||
"Ocp-Apim-Subscription-Key: $subscriptionKey"
|
"Ocp-Apim-Subscription-Key: $subscriptionKey"
|
||||||
];
|
];
|
||||||
|
|
||||||
log_message('error', "Requesting signed URL from Vidal API: $apiUrl | Payload: $payload");
|
log_message('error', "TPA CLAIM PUSH | Requesting signed URL from Vidal API: $apiUrl | Payload: $payload");
|
||||||
|
|
||||||
$ch = curl_init($apiUrl);
|
$ch = curl_init($apiUrl);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
@ -57,7 +57,7 @@ class VidalApiController extends BaseController
|
|||||||
$responseData = json_decode($response, true);
|
$responseData = json_decode($response, true);
|
||||||
|
|
||||||
if (!isset($responseData['data']['signedUrl']) || !isset($responseData['data']['fileId'])) {
|
if (!isset($responseData['data']['signedUrl']) || !isset($responseData['data']['fileId'])) {
|
||||||
log_message('error', "Invalid signed URL response received: " . json_encode($responseData));
|
log_message('error', "TPA CLAIM PUSH | Invalid signed URL response received: " . json_encode($responseData));
|
||||||
return ["status" => false, "message" => "Invalid signed URL response", "response" => $responseData];
|
return ["status" => false, "message" => "Invalid signed URL response", "response" => $responseData];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,12 +88,12 @@ class VidalApiController extends BaseController
|
|||||||
curl_close($ch2);
|
curl_close($ch2);
|
||||||
|
|
||||||
if ($curlErr) {
|
if ($curlErr) {
|
||||||
log_message('error', "Curl error during file upload: $curlErr");
|
log_message('error', "TPA CLAIM PUSH | Curl error during file upload: $curlErr");
|
||||||
return ["status" => false, "message" => "File upload failed", "data" => $curlErr];
|
return ["status" => false, "message" => "File upload failed", "data" => $curlErr];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($httpCode !== 200 && $httpCode !== 201) {
|
if ($httpCode !== 200 && $httpCode !== 201) {
|
||||||
log_message('error', "File upload failed with HTTP Code: $httpCode | Response: $uploadResponse");
|
log_message('error', "TPA CLAIM PUSH | File upload failed with HTTP Code: $httpCode | Response: $uploadResponse");
|
||||||
return [
|
return [
|
||||||
"status" => false,
|
"status" => false,
|
||||||
"message" => "File upload failed",
|
"message" => "File upload failed",
|
||||||
@ -153,7 +153,7 @@ class VidalApiController extends BaseController
|
|||||||
->getRowArray(); // single record
|
->getRowArray(); // single record
|
||||||
|
|
||||||
if (count($data) && $data['filePath'] == null) {
|
if (count($data) && $data['filePath'] == null) {
|
||||||
log_message('error', "Submit claim failed - Claim or File Missing");
|
log_message('error', "TPA CLAIM PUSH | Submit claim failed - Claim or File Missing");
|
||||||
return $this->response->setJSON(['status' => false,'message' => 'Claim or File Missing', ]);
|
return $this->response->setJSON(['status' => false,'message' => 'Claim or File Missing', ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ class VidalApiController extends BaseController
|
|||||||
|
|
||||||
$upload = $this->uploadFileToVidal($filePath,$filename);
|
$upload = $this->uploadFileToVidal($filePath,$filename);
|
||||||
if ($upload['status'] !== true) {
|
if ($upload['status'] !== true) {
|
||||||
log_message('error', "Submit claim failed - File upload failed");
|
log_message('error', "TPA CLAIM PUSH | Submit claim failed - File upload failed");
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
'message' => 'File upload failed',
|
'message' => 'File upload failed',
|
||||||
|
|||||||
@ -111,6 +111,7 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
|
|||||||
'diagnosis' => 'claim_description',
|
'diagnosis' => 'claim_description',
|
||||||
'healthcard_id' => 'tpa_no',
|
'healthcard_id' => 'tpa_no',
|
||||||
'claim_type' => 'tpa_claim_type',
|
'claim_type' => 'tpa_claim_type',
|
||||||
|
'diagnosis' => 'tpa_ailments',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -174,6 +174,8 @@ class FhplClaimImportService extends BaseTpaClaimImportService
|
|||||||
'cheque_no' => 'utr_details',
|
'cheque_no' => 'utr_details',
|
||||||
'uhid_no' => 'tpa_no',
|
'uhid_no' => 'tpa_no',
|
||||||
'claim_type' => 'tpa_claim_type',
|
'claim_type' => 'tpa_claim_type',
|
||||||
|
'diagnosis' => 'tpa_ailments',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $statusMapping = [
|
protected $statusMapping = [
|
||||||
|
|||||||
@ -101,6 +101,7 @@ class IciciClaimImportService extends BaseTpaClaimImportService
|
|||||||
'uhid' => 'tpa_no',
|
'uhid' => 'tpa_no',
|
||||||
'rejected_query_desc' => 'claim_description',
|
'rejected_query_desc' => 'claim_description',
|
||||||
'type_of_claim' => 'tpa_claim_type',
|
'type_of_claim' => 'tpa_claim_type',
|
||||||
|
'diagnosis' => 'tpa_ailments',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $statusMapping = [
|
protected $statusMapping = [
|
||||||
|
|||||||
@ -152,6 +152,7 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
|
|||||||
// Payment
|
// Payment
|
||||||
'utr_no' => 'utr_details',
|
'utr_no' => 'utr_details',
|
||||||
'claim_type' => 'tpa_claim_type',
|
'claim_type' => 'tpa_claim_type',
|
||||||
|
'primary_ailment_name' => 'tpa_ailments',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $statusMapping = [
|
protected $statusMapping = [
|
||||||
|
|||||||
@ -84,6 +84,8 @@ class RcareClaimImportService extends BaseTpaClaimImportService
|
|||||||
'hospital_district' => 'hospital_city',
|
'hospital_district' => 'hospital_city',
|
||||||
|
|
||||||
'diagnosis' => 'claim_description',
|
'diagnosis' => 'claim_description',
|
||||||
|
'diagnosis' => 'tpa_ailments',
|
||||||
|
|
||||||
|
|
||||||
// Payment
|
// Payment
|
||||||
'cheque_neft_number' => 'utr_details',
|
'cheque_neft_number' => 'utr_details',
|
||||||
|
|||||||
@ -344,6 +344,8 @@ class VidalClaimImportService extends BaseTpaClaimImportService
|
|||||||
// Meta
|
// Meta
|
||||||
'file_id' => 'file_id',
|
'file_id' => 'file_id',
|
||||||
'type_of_claim' => 'tpa_claim_type',
|
'type_of_claim' => 'tpa_claim_type',
|
||||||
|
'diagnosis' => 'tpa_ailments',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $statusMapping = [
|
protected $statusMapping = [
|
||||||
|
|||||||
@ -1149,14 +1149,27 @@ table.dataTable tbody td {
|
|||||||
console.error("Status:", status);
|
console.error("Status:", status);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
}else{toastr.error('Server error occurred.', 'Error');}
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -1358,14 +1371,30 @@ table.dataTable tbody td {
|
|||||||
console.log("Error: " + xhr.statusText);
|
console.log("Error: " + xhr.statusText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
}else{toastr.error('Server error occurred.', 'Error');}
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
|
console.error('Unexpected error:', xhr.responseText);
|
||||||
|
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
@ -1426,17 +1455,31 @@ 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');
|
console.error(xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
}else{toastr.error('Server error occurred.', 'Error');}
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
|||||||
@ -219,39 +219,42 @@ table.dataTable thead th {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
// Get the current domain
|
||||||
console.error('Status:', status);
|
const hostname = window.location.hostname;
|
||||||
console.error('Error:', error);
|
if (hostname === 'localhost' || hostname === '127.0.0.1') {
|
||||||
|
// DEVELOPER MODE: Show everything in a nice group
|
||||||
|
console.group("%c Debug: Server Error ", "background: #222; color: #bada55; padding: 2px;");
|
||||||
|
console.error("Status:", xhr.status);
|
||||||
|
console.error("Type:", error);
|
||||||
|
console.error("Full Response:", xhr.responseText);
|
||||||
|
console.groupEnd();
|
||||||
|
} else {
|
||||||
|
// LIVE MODE: Only log a simple, non-revealing error
|
||||||
|
console.error("Server Error: Action could not be completed. Reference Code: " + xhr.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
let msg = 'Something went wrong. Please try again later.';
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
switch (xhr.status) {
|
let errorMessages = "";
|
||||||
case 400:
|
let seenMessages = []; // Array to store unique messages
|
||||||
let response = xhr.responseJSON || JSON.parse(xhr.responseText);
|
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
msg = response.message || 'Bad Request — Invalid input.';
|
} else if (xhr.status === 403) {
|
||||||
break;
|
let response = JSON.parse(xhr.responseText);
|
||||||
case 401:
|
toastr.error(response.message, 'Security Policy');
|
||||||
msg = 'Unauthorized — Please log in again.';
|
} else if (xhr.status === 500) {
|
||||||
break;
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
case 403:
|
} else {
|
||||||
msg = 'Forbidden — You do not have permission.';
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
break;
|
|
||||||
case 404:
|
|
||||||
msg = 'Not Found — Requested URL or resource not found.';
|
|
||||||
break;
|
|
||||||
case 500:
|
|
||||||
console.log('Internal Server Error — Please contact support.');
|
|
||||||
msg = xhr.responseJSON?.message || xhr.responseText || msg;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
msg = xhr.responseJSON?.message || xhr.responseText || msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -196,14 +196,29 @@
|
|||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response
|
// Handle error response
|
||||||
console.error('Upload failed:', error);
|
console.error('Upload failed:', error);
|
||||||
console.error('Upload failed:', error);
|
console.error('Unexpected error:', xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
var response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
if (xhr.status === 500) {
|
} else if (xhr.status === 403) {
|
||||||
var response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
|
|||||||
@ -206,13 +206,26 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
toastr.error('An error occurred while adding the CD account number.', 'Error');
|
toastr.error('An error occurred while adding the CD account number.', 'Error');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -217,6 +217,29 @@
|
|||||||
console.log("error in submission of url data");
|
console.log("error in submission of url data");
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
complete : function(){
|
complete : function(){
|
||||||
@ -673,7 +696,30 @@
|
|||||||
}, function(xhr, status, error) {
|
}, function(xhr, status, error) {
|
||||||
console.error('Error fetching data:', error);
|
console.error('Error fetching data:', error);
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
toastr.error('An error occurred while saving docs.', 'Error');
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -235,14 +235,29 @@
|
|||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response
|
// Handle error response
|
||||||
console.error('Upload failed:', error);
|
console.error('Upload failed:', error);
|
||||||
console.error('Upload failed:', error);
|
console.error('Unexpected error:', xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
var response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
if (xhr.status === 500) {
|
} else if (xhr.status === 403) {
|
||||||
var response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
|
|||||||
@ -351,19 +351,28 @@ input:checked + .slider:before {
|
|||||||
$submitButton.prop('disabled', false);
|
$submitButton.prop('disabled', false);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
} else if (xhr.status === 404) {
|
} 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.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Unknown error occurred', 'Warning');
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -558,19 +558,7 @@ $("#branch_form").submit(function(event) {
|
|||||||
if(xhr.status === 409){
|
if(xhr.status === 409){
|
||||||
alert('The Current Branch is Already Existing..!!');
|
alert('The Current Branch is Already Existing..!!');
|
||||||
}
|
}
|
||||||
// if (xhr.status === 400) {
|
else if (xhr.status === 400) {
|
||||||
// let response = JSON.parse(xhr.responseText);
|
|
||||||
// if (response.errors) {
|
|
||||||
// let errorMessages = "";
|
|
||||||
// $.each(response.errors, function (field, message) {
|
|
||||||
// errorMessages += `• ${message}<br>`;
|
|
||||||
// });
|
|
||||||
// toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
|
||||||
// } else {
|
|
||||||
// toastr.warning(response.message || 'Validation failed', 'Warning');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (xhr.status === 400) {
|
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
let errorMessages = "";
|
let errorMessages = "";
|
||||||
let seenMessages = []; // Array to store unique messages
|
let seenMessages = []; // Array to store unique messages
|
||||||
@ -587,6 +575,13 @@ $("#branch_form").submit(function(event) {
|
|||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -378,28 +378,28 @@ $(document).ready(function()
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
$('#toggleButtons').on('change', function() {
|
$('#toggleButtons').on('change', function() {
|
||||||
let type = $(this).is(':checked') ? 1 : 2;
|
let type = $(this).is(':checked') ? 1 : 2;
|
||||||
// $('div.col-6 h4').text(
|
|
||||||
// $(this).is(':checked')
|
|
||||||
// ? "GC Client List"
|
|
||||||
// : "RC Client List"
|
|
||||||
// );
|
|
||||||
let url = '<?= base_url('client/typeList/') ?>' + type;
|
let url = '<?= base_url('client/typeList/') ?>' + type;
|
||||||
|
|
||||||
|
$('.loader').fadeIn(); // Show loader during AJAX
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.status === "success" && Array.isArray(response.data)) {
|
$('.loader').fadeOut();
|
||||||
console.error("#CL 1 : ", response.data);
|
// Pass response.data directly to the function
|
||||||
|
if (response.status === "success") {
|
||||||
renderRows(response.data);
|
renderRows(response.data);
|
||||||
} else {
|
} else {
|
||||||
console.error("#CL 2 : ", response.data);
|
// If the structure is slightly different, pass the whole object
|
||||||
renderRows([]);
|
renderRows(response);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
console.error("Error loading:", error);
|
console.error("Error loading:", error);
|
||||||
renderRows([]);
|
renderRows([]);
|
||||||
}
|
}
|
||||||
@ -408,25 +408,25 @@ $(document).ready(function()
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function renderRows(data) {
|
function renderRows(incomingData) {
|
||||||
|
|
||||||
|
let actualList = [];
|
||||||
|
if (incomingData && incomingData.clientList) {
|
||||||
|
actualList = incomingData.clientList;
|
||||||
|
} else if (Array.isArray(incomingData)) {
|
||||||
|
actualList = incomingData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
table.clear();
|
table.clear();
|
||||||
if (Array.isArray(data) && data.length) {
|
|
||||||
data.forEach((row, index) => {
|
if (actualList.length > 0) {
|
||||||
// let clientrm = json_encode($client_rm)
|
actualList.forEach((row, index) => {
|
||||||
// let account_managers = "";
|
|
||||||
//
|
|
||||||
// clientrm.forEach(client => {
|
|
||||||
// if (client.client_id == row.id) {
|
|
||||||
// account_managers += client.account_manager + ", ";
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// account_managers = account_managers.replace(/,\s*$/, "");
|
|
||||||
// if (account_managers === "") account_managers = "N/A";
|
|
||||||
|
|
||||||
let rowData = [
|
let rowData = [
|
||||||
index + 1,
|
index + 1,
|
||||||
`<span class="client_info" data-id="${row.id}">${row.client_name} (${row.short_name})</span>`,
|
`<span class="client_info" data-id="${row.id}">${row.client_name} (${row.short_name})</span>`,
|
||||||
row.account_managers,
|
row.account_managers || "N/A",
|
||||||
`<div class="btn-group dropdown">
|
`<div class="btn-group dropdown">
|
||||||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown">
|
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown">
|
||||||
<i class="mdi mdi-dots-horizontal"></i>
|
<i class="mdi mdi-dots-horizontal"></i>
|
||||||
|
|||||||
@ -841,20 +841,34 @@ input:checked + .slider_blue::before {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
} else if (xhr.status === 404) {
|
} else if (xhr.status === 403) {
|
||||||
//console.log('Resource not found', 'Warning');
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
} else if (xhr.status === 500) {
|
} else if (xhr.status === 500) {
|
||||||
//console.log('Internal server error', 'Warning');
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
//console.log('Unknown error occurred', 'Warning');
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
|
// else if (xhr.status === 404) {
|
||||||
|
// //console.log('Resource not found', 'Warning');
|
||||||
|
// } else if (xhr.status === 500) {
|
||||||
|
// //console.log('Internal server error', 'Warning');
|
||||||
|
// } else {
|
||||||
|
// //console.log('Unknown error occurred', 'Warning');
|
||||||
|
// }
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
complete :function(){
|
complete :function(){
|
||||||
|
|||||||
@ -550,14 +550,26 @@
|
|||||||
|
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
}else{ toastr.warning('Error uploading file', 'Warning'); }
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
}
|
||||||
|
else{ toastr.warning('Error uploading file', 'Warning'); }
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
|
|||||||
@ -603,13 +603,14 @@
|
|||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
||||||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||||
buttons: [{
|
buttons: [
|
||||||
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
// {
|
||||||
className: 'btn app-btn-primary mr-2',
|
// text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
||||||
action: function(e, dt, node, config) {
|
// className: 'btn app-btn-primary mr-2',
|
||||||
openTicket();
|
// action: function(e, dt, node, config) {
|
||||||
}
|
// openTicket();
|
||||||
},
|
// }
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
extend: 'collection',
|
extend: 'collection',
|
||||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||||
|
|||||||
@ -521,28 +521,28 @@
|
|||||||
extend: 'copy',
|
extend: 'copy',
|
||||||
text: '<i class="mdi mdi-content-copy"></i>',
|
text: '<i class="mdi mdi-content-copy"></i>',
|
||||||
titleAttr: 'Copy',
|
titleAttr: 'Copy',
|
||||||
filename: 'Enrolment List'
|
filename: 'Enrolment List',
|
||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: '<i class="mdi mdi-file-document"></i>',
|
text: '<i class="mdi mdi-file-document"></i>',
|
||||||
titleAttr: 'CSV',
|
titleAttr: 'CSV',
|
||||||
filename: 'Enrolment List'
|
filename: 'Enrolment List',
|
||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
extend: 'print',
|
extend: 'print',
|
||||||
text: '<i class="mdi mdi-printer"></i>',
|
text: '<i class="mdi mdi-printer"></i>',
|
||||||
titleAttr: 'Print',
|
titleAttr: 'Print',
|
||||||
filename: 'Enrolment List'
|
filename: 'Enrolment List',
|
||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
extend: 'pdf',
|
extend: 'pdf',
|
||||||
text: '<i class="mdi mdi-file-pdf"></i>',
|
text: '<i class="mdi mdi-file-pdf"></i>',
|
||||||
titleAttr: 'PDF',
|
titleAttr: 'PDF',
|
||||||
filename: 'Enrolment List'
|
filename: 'Enrolment List',
|
||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -328,15 +328,26 @@
|
|||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -136,9 +136,9 @@
|
|||||||
<div class="modal-body" id="emp_data_success">
|
<div class="modal-body" id="emp_data_success">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<!-- <div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary">Save changes</button>
|
<button type="button" class="btn btn-primary">Save changes</button>
|
||||||
</div>
|
</div> -->
|
||||||
</div><!-- /.modal-content -->
|
</div><!-- /.modal-content -->
|
||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|||||||
@ -451,16 +451,30 @@
|
|||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
}
|
||||||
|
else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -264,16 +264,29 @@ input:checked + .slider:before {
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log('Something Wrong!', 'warning');
|
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -323,33 +323,29 @@
|
|||||||
console.error('Response headers:', xhr.getAllResponseHeaders());
|
console.error('Response headers:', xhr.getAllResponseHeaders());
|
||||||
console.error('Response URL:', xhr.responseURL);
|
console.error('Response URL:', xhr.responseURL);
|
||||||
|
|
||||||
// Handle validation errors (CI4)
|
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
let response = null;
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
try {
|
|
||||||
response = JSON.parse(xhr.responseText);
|
|
||||||
} catch (e) {
|
|
||||||
toastr.error('Invalid server response', 'Error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
} else if (xhr.status === 403) {
|
||||||
}
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
// Handle server errors
|
} else if (xhr.status === 500) {
|
||||||
if (xhr.status >= 500) {
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
toastr.error('Server error. Please try again later.', 'Error');
|
} else {
|
||||||
return;
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
|
|||||||
@ -256,15 +256,26 @@ $(document).ready(function () {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
toastr.warning('Something Wrong!', 'Warning');
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -308,15 +319,26 @@ $(document).ready(function () {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1697,19 +1697,44 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
const hostname = window.location.hostname;
|
||||||
console.error(status, error);
|
if (hostname === 'localhost' || hostname === '127.0.0.1') {
|
||||||
|
// DEVELOPER MODE: Show everything in a nice group
|
||||||
|
console.group("%c Debug: Server Error ", "background: #222; color: #bada55; padding: 2px;");
|
||||||
|
console.error("Status:", xhr.status);
|
||||||
|
console.error("Type:", error);
|
||||||
|
console.error("Full Response:", xhr.responseText);
|
||||||
|
console.groupEnd();
|
||||||
|
} else {
|
||||||
|
// LIVE MODE: Only log a simple, non-revealing error
|
||||||
|
console.error("Server Error: Action could not be completed. Reference Code: " + xhr.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -634,17 +634,23 @@
|
|||||||
let seenMessages = []; // Array to store unique messages
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
// Only add the message if it hasn't been seen before
|
|
||||||
if (!seenMessages.includes(message)) {
|
if (!seenMessages.includes(message)) {
|
||||||
errorMessages += `• ${message}<br>`;
|
errorMessages += `• ${message}<br>`;
|
||||||
seenMessages.push(message); // Mark this message as "seen"
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -279,19 +279,44 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
}, function(xhr, status, error) {
|
}, function(xhr, status, error) {
|
||||||
console.error('Error fetching data:', error);
|
|
||||||
console.error(xhr.responseText);
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// Get the current domain
|
||||||
|
const hostname = window.location.hostname;
|
||||||
|
if (hostname === 'localhost' || hostname === '127.0.0.1') {
|
||||||
|
// DEVELOPER MODE: Show everything in a nice group
|
||||||
|
console.group("%c Debug: Server Error ", "background: #222; color: #bada55; padding: 2px;");
|
||||||
|
console.error("Status:", xhr.status);
|
||||||
|
console.error("Type:", error);
|
||||||
|
console.error("Full Response:", xhr.responseText);
|
||||||
|
console.groupEnd();
|
||||||
|
} else {
|
||||||
|
// LIVE MODE: Only log a simple, non-revealing error
|
||||||
|
console.error("Server Error: Action could not be completed. Reference Text: " + xhr.responseText);
|
||||||
|
}
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -913,6 +913,29 @@
|
|||||||
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);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4098,6 +4098,31 @@
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
setTimeout(function() {
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -361,18 +361,34 @@
|
|||||||
}
|
}
|
||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function (xhr) {
|
||||||
$('.loader, .loader-mask').fadeOut();
|
$('.loader, .loader-mask').fadeOut();
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
|
console.error('Unexpected error:', xhr.responseText);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -273,6 +273,15 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.emp_data_model', function() {
|
||||||
|
|
||||||
|
var id = $(this).attr('data-id');
|
||||||
|
var eno = $(this).attr('data-eno');
|
||||||
|
var status = $(this).attr('data-status');
|
||||||
|
|
||||||
|
fetchRetailEndorsementData(id, eno, status);
|
||||||
|
});
|
||||||
|
|
||||||
function submitRetailEndorsement(e) {
|
function submitRetailEndorsement(e) {
|
||||||
e.preventDefault(); // stop normal form submit
|
e.preventDefault(); // stop normal form submit
|
||||||
var form = document.getElementById("retailEndorsementForm");
|
var form = document.getElementById("retailEndorsementForm");
|
||||||
@ -310,17 +319,30 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
|
|||||||
@ -245,13 +245,27 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -718,10 +718,16 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -506,18 +506,31 @@ beccause = dataTables_length and dataTables_paginate need in same line thats why
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Something went wrong!", 'Error');}
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
console.error(xhr.responseText);
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
|||||||
@ -571,17 +571,31 @@ data-backdrop="static"
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
}else{ toastr.error("Something went wrong!", 'Error'); }
|
|
||||||
console.error(xhr.responseText);
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
@ -628,18 +642,30 @@ data-backdrop="static"
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
console.error(xhr.responseText);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function() { btn.disabled = false;}
|
complete: function() { btn.disabled = false;}
|
||||||
|
|||||||
@ -264,6 +264,30 @@
|
|||||||
// Hide loader
|
// Hide loader
|
||||||
$('.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);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -787,6 +787,31 @@
|
|||||||
// Hide loader
|
// Hide loader
|
||||||
$('.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);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -436,14 +436,29 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
} else{toastr.error('Something Wrong!', 'Warning');}
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -79,17 +79,63 @@ $(document).ready(function() {
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
let message = response.message;
|
let message = response.message;
|
||||||
toastr.error(message, 'Error');
|
if (xhr.status === 400) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, function(xhr, status, error) {
|
}, function(xhr, status, error) {
|
||||||
console.error('Error fetching data:', error);
|
console.error('Error fetching data:', error);
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
toastr.error('An error occurred while fetching the report page.', '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);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -195,7 +195,30 @@ $(document).ready(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);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
|
if (response.errors) {
|
||||||
|
$.each(response.errors, function (field, message) {
|
||||||
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -331,14 +331,29 @@
|
|||||||
// Handle validation errors (CI4)
|
// Handle validation errors (CI4)
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -480,15 +480,28 @@ $(document).ready(function () {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
toastr.warning('Something Wrong!', 'Warning');
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
|
|||||||
@ -249,20 +249,31 @@ $(document).ready(function() {
|
|||||||
$submitButton.prop('disabled', false);
|
$submitButton.prop('disabled', false);
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
} else if (xhr.status === 404) {
|
} 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.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
} else {
|
} else {
|
||||||
toastr.warning('Unknown error occurred', 'Warning');
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -789,13 +789,27 @@ $("#vehicle_form").submit(function(event) {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -224,13 +224,27 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if (xhr.status === 400) {
|
if (xhr.status === 400) {
|
||||||
let response = JSON.parse(xhr.responseText);
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
let errorMessages = "";
|
||||||
|
let seenMessages = []; // Array to store unique messages
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
$.each(response.errors, function (field, message) {
|
$.each(response.errors, function (field, message) {
|
||||||
toastr.warning(message, 'Validation Error');
|
if (!seenMessages.includes(message)) {
|
||||||
|
errorMessages += `• ${message}<br>`;
|
||||||
|
seenMessages.push(message); // Mark this message as "seen"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (xhr.status === 403) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
toastr.error(response.message, 'Security Policy');
|
||||||
|
} else if (xhr.status === 500) {
|
||||||
|
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||||
|
} else {
|
||||||
|
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user