MERGE_UAT_CLAIMS_LIVE_ISSSUE
This commit is contained in:
commit
755cd30809
@ -817,6 +817,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post('saveIRDocsJson',"TicketController::saveIRDocsJson");
|
||||
$routes->get('getTpaClaimStatus',"ApiServiceController::getClaimStatus");
|
||||
$routes->post('manualTpaClaimPush',"ApiServiceController::manualTpaClaimPush");
|
||||
$routes->match(['get', 'post'], 'getClaimTemplateData', 'TicketController::getClaimTemplateData');
|
||||
$routes->post('uploadApprovedLetterFromReply', 'TicketController::uploadApprovedLetterFromReply');
|
||||
});
|
||||
|
||||
// Non-EB Claims
|
||||
|
||||
@ -277,61 +277,61 @@ class MasterController extends AdminController
|
||||
echo view('insurer_onboarding', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function createInsurerGeneralInfo()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Insurer general info function called');
|
||||
$this->myLogger->logme('error', 'Insurer general info function called');
|
||||
$rules = [
|
||||
'name' => [
|
||||
'label' => 'Insurer Name',
|
||||
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\s\-_]+$/]'],
|
||||
'errors' => [
|
||||
'required' => 'Insurer Name is required.',
|
||||
'regex_match' => 'Insurer Name can only contain letters, numbers, spaces, hyphens, and underscores.',
|
||||
]
|
||||
],
|
||||
'short_name' => [
|
||||
'label' => 'Insurer Short Name',
|
||||
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\-_]+$/]'],
|
||||
'errors' => [
|
||||
'required' => 'Short Name is required.',
|
||||
'regex_match' => 'Short Name can only contain letters, numbers, hyphens, and underscores.',
|
||||
]
|
||||
],
|
||||
'type' => [
|
||||
'label' => 'Insurer Type',
|
||||
'rules' => 'permit_empty|in_list[pvt,psu]',
|
||||
'errors' => [
|
||||
'in_list' => 'Please select a valid Insurer Type (PVT or PSU).'
|
||||
]
|
||||
],
|
||||
'category' => [
|
||||
'label' => 'Insurer Category',
|
||||
'rules' => 'permit_empty|in_list[life,general]',
|
||||
'errors' => [
|
||||
'in_list' => 'Please select a valid Category (Life or General).'
|
||||
]
|
||||
],
|
||||
'addition_add_day' => [
|
||||
'rules' => 'permit_empty' // Checkboxes return null if unchecked
|
||||
],
|
||||
'deletion_add_day' => [
|
||||
'rules' => 'permit_empty'
|
||||
],
|
||||
'is_multi_event' => [
|
||||
'rules' => 'permit_empty'
|
||||
],
|
||||
'insurer_logo' => [
|
||||
'name' => [
|
||||
'label' => 'Insurer Name',
|
||||
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\s\-_]+$/]'],
|
||||
'errors' => [
|
||||
'required' => 'Insurer Name is required.',
|
||||
'regex_match' => 'Insurer Name can only contain letters, numbers, spaces, hyphens, and underscores.',
|
||||
]
|
||||
],
|
||||
'short_name' => [
|
||||
'label' => 'Insurer Short Name',
|
||||
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\-_]+$/]'],
|
||||
'errors' => [
|
||||
'required' => 'Short Name is required.',
|
||||
'regex_match' => 'Short Name can only contain letters, numbers, hyphens, and underscores.',
|
||||
]
|
||||
],
|
||||
'type' => [
|
||||
'label' => 'Insurer Type',
|
||||
'rules' => 'permit_empty|in_list[pvt,psu]',
|
||||
'errors' => [
|
||||
'in_list' => 'Please select a valid Insurer Type (PVT or PSU).'
|
||||
]
|
||||
],
|
||||
'category' => [
|
||||
'label' => 'Insurer Category',
|
||||
'rules' => 'permit_empty|in_list[life,general]',
|
||||
'errors' => [
|
||||
'in_list' => 'Please select a valid Category (Life or General).'
|
||||
]
|
||||
],
|
||||
'addition_add_day' => [
|
||||
'rules' => 'permit_empty' // Checkboxes return null if unchecked
|
||||
],
|
||||
'deletion_add_day' => [
|
||||
'rules' => 'permit_empty'
|
||||
],
|
||||
'is_multi_event' => [
|
||||
'rules' => 'permit_empty'
|
||||
],
|
||||
'insurer_logo' => [
|
||||
'rules' => 'if_exist|is_image[insurer_logo]|max_size[insurer_logo,200]|ext_in[insurer_logo,jpg,jpeg,png]',
|
||||
'errors' => [
|
||||
'is_image' => 'The uploaded file must be an image',
|
||||
'max_size' => 'File size should not exceed 200 KB',
|
||||
'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||
]
|
||||
],
|
||||
];
|
||||
],
|
||||
];
|
||||
// $rules = [
|
||||
// 'name' => [
|
||||
// 'rules' => 'required',
|
||||
@ -3538,8 +3538,9 @@ class MasterController extends AdminController
|
||||
{
|
||||
$posModel = new PartnerPosModel();
|
||||
$method = $this->request->getMethod();
|
||||
|
||||
|
||||
if ($this->request->getMethod() === 'post') {
|
||||
try {
|
||||
|
||||
$rules = [
|
||||
'manager_id' => [
|
||||
@ -3555,7 +3556,7 @@ class MasterController extends AdminController
|
||||
'required' => 'Name is required',
|
||||
'min_length' => 'Name must be at least 3 characters',
|
||||
'max_length' => 'Name cannot exceed 100 characters',
|
||||
'alpha_space'=> 'Name can contain only letters and spaces'
|
||||
'alpha_space' => 'Name can contain only letters and spaces'
|
||||
]
|
||||
],
|
||||
'pos_code' => [
|
||||
@ -3589,27 +3590,27 @@ class MasterController extends AdminController
|
||||
]
|
||||
],
|
||||
'state' => [
|
||||
'label' => 'State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'State is required.',
|
||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'city' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
'errors' => [
|
||||
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'pincode' => [
|
||||
'rules' => 'required|numeric|exact_length[6]',
|
||||
'errors' => [
|
||||
'required' => 'Pincode is required.',
|
||||
'numeric' => 'Pincode must be digits only.',
|
||||
'exact_length' => 'Pincode must be exactly 6 digits.'
|
||||
]
|
||||
],
|
||||
'label' => 'State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'State is required.',
|
||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'city' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
'errors' => [
|
||||
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'pincode' => [
|
||||
'rules' => 'required|numeric|exact_length[6]',
|
||||
'errors' => [
|
||||
'required' => 'Pincode is required.',
|
||||
'numeric' => 'Pincode must be digits only.',
|
||||
'exact_length' => 'Pincode must be exactly 6 digits.'
|
||||
]
|
||||
],
|
||||
'aadhar' => [
|
||||
'rules' => 'required|numeric|exact_length[12]',
|
||||
'errors' => [
|
||||
@ -3632,25 +3633,22 @@ class MasterController extends AdminController
|
||||
]
|
||||
],
|
||||
'aadhar_file_name' => [
|
||||
'rules' => 'permit_empty|uploaded[aadhar_file_name]|max_size[aadhar_file_name,5120]|ext_in[aadhar_file_name,pdf,jpg,jpeg,png]',
|
||||
'rules' => 'if_exist|max_size[aadhar_file_name,5120]|ext_in[aadhar_file_name,pdf,jpg,jpeg,png]',
|
||||
'errors' => [
|
||||
'uploaded' => 'Invalid Aadhaar file',
|
||||
'max_size' => 'Aadhaar file size should not exceed 5MB',
|
||||
'ext_in' => 'Aadhaar must be PDF or image (jpg, jpeg, png)'
|
||||
]
|
||||
],
|
||||
'pan_file_name' => [
|
||||
'rules' => 'permit_empty|uploaded[pan_file_name]|max_size[pan_file_name,5120]|ext_in[pan_file_name,pdf,jpg,jpeg,png]',
|
||||
'rules' => 'if_exist|max_size[pan_file_name,5120]|ext_in[pan_file_name,pdf,jpg,jpeg,png]',
|
||||
'errors' => [
|
||||
'uploaded' => 'Invalid PAN file',
|
||||
'max_size' => 'PAN file size should not exceed 5MB',
|
||||
'ext_in' => 'PAN must be PDF or image (jpg, jpeg, png)'
|
||||
]
|
||||
],
|
||||
'certificate_file_name' => [
|
||||
'rules' => 'permit_empty|uploaded[certificate_file_name]|max_size[certificate_file_name,5120]|ext_in[certificate_file_name,pdf,jpg,jpeg,png]',
|
||||
'rules' => 'if_exist|max_size[certificate_file_name,5120]|ext_in[certificate_file_name,pdf,jpg,jpeg,png]',
|
||||
'errors' => [
|
||||
'uploaded' => 'Invalid Certificate file',
|
||||
'max_size' => 'Certificate file size should not exceed 5MB',
|
||||
'ext_in' => 'Certificate must be PDF or image (jpg, jpeg, png)'
|
||||
]
|
||||
@ -3669,138 +3667,217 @@ class MasterController extends AdminController
|
||||
$data = $this->request->getPost();
|
||||
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||
$id = $sanitized_post_data['pk'] ?? null;
|
||||
unset($sanitized_post_data['pk']);
|
||||
unset($sanitized_post_data['pk']);
|
||||
|
||||
try {
|
||||
// Certificate
|
||||
$certificate = $this->uploadPOSFile('certificate_file_name', 'pos_certificate_files');
|
||||
if ($certificate !== null) { $sanitized_post_data['certificate_file_name'] = $certificate; } else { unset($sanitized_post_data['certificate_file_name']); }
|
||||
if ($certificate !== null) {
|
||||
$sanitized_post_data['certificate_file_name'] = $certificate;
|
||||
} else {
|
||||
unset($sanitized_post_data['certificate_file_name']);
|
||||
}
|
||||
|
||||
// PAN file
|
||||
$panFile = $this->uploadPOSFile('pan_file_name', 'pos_certificate_files');
|
||||
if ($panFile !== null) { $sanitized_post_data['pan_file_name'] = $panFile; } else { unset($sanitized_post_data['pan_file_name']);}
|
||||
if ($panFile !== null) {
|
||||
$sanitized_post_data['pan_file_name'] = $panFile;
|
||||
} else {
|
||||
unset($sanitized_post_data['pan_file_name']);
|
||||
}
|
||||
|
||||
// Aadhaar file
|
||||
$aadharFile = $this->uploadPOSFile('aadhar_file_name', 'pos_certificate_files');
|
||||
if ($aadharFile !== null) { $sanitized_post_data['aadhar_file_name'] = $aadharFile; } else { unset($sanitized_post_data['aadhar_file_name']);}
|
||||
|
||||
} catch (\RuntimeException $e) {
|
||||
return $this->respond([ 'status' => false, 'code' => 400, 'message' => $e->getMessage(), 'data' => $sanitized_post_data ], 400);
|
||||
if ($aadharFile !== null) {
|
||||
$sanitized_post_data['aadhar_file_name'] = $aadharFile;
|
||||
} else {
|
||||
unset($sanitized_post_data['aadhar_file_name']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', 'File upload error: ' . $e->getMessage() . ' | POST data: ' . json_encode($sanitized_post_data) . $e->getTraceAsString());
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $e->getMessage(), 'data' => $sanitized_post_data], 400);
|
||||
}
|
||||
|
||||
foreach ($sanitized_post_data as $k => $v) {
|
||||
if ($v === '' || $v === null) {
|
||||
unset($sanitized_post_data[$k]);
|
||||
}
|
||||
foreach ($sanitized_post_data as $k => $v) {
|
||||
if ($v === '' || $v === null) {
|
||||
unset($sanitized_post_data[$k]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// INSERT / UPDATE
|
||||
if (empty($id)) {
|
||||
$status = $posModel->insert($sanitized_post_data);
|
||||
} else {
|
||||
$status = $posModel->update($id, $sanitized_post_data);
|
||||
}
|
||||
try {
|
||||
if (empty($id)) {
|
||||
$status = $posModel->insert($sanitized_post_data);
|
||||
} else {
|
||||
$status = $posModel->update($id, $sanitized_post_data);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
return $this->respond([ 'status' => true, 'code' => 200, 'message' => 'POS updated successfully', 'data' => $sanitized_post_data ], 200);
|
||||
}
|
||||
if ($status) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'POS updated successfully', 'data' => $sanitized_post_data], 200);
|
||||
}
|
||||
|
||||
return $this->respond([ 'status' => false, 'code' => 400, 'message' => 'Failed to update', 'data' => $sanitized_post_data ], 400);
|
||||
}
|
||||
elseif ($method === 'get') {
|
||||
$modelErrors = method_exists($posModel, 'errors') ? $posModel->errors() : [];
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to update',
|
||||
'errors' => $modelErrors,
|
||||
'data' => $sanitized_post_data
|
||||
], 400);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'partnerPOS DB error: ' . $e->getMessage() . ' | payload: ' . json_encode($sanitized_post_data) . ' | trace: ' . $e->getTraceAsString());
|
||||
|
||||
$id = $this->request->getGet('pk') ?? null;
|
||||
$message = 'Something went wrong while saving POS details.';
|
||||
$statusCode = 500;
|
||||
|
||||
$db = db_connect();
|
||||
|
||||
$builder = $db->table('partner_staff');
|
||||
|
||||
$data['manager_list'] = $builder->select('partner_staff.id, partner_staff.name')
|
||||
->where('partner_staff.is_active', 1)
|
||||
->where('partner_staff.role_id', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
if (!empty($id)) {
|
||||
|
||||
$data['pos_list'] = $posModel
|
||||
->select('partner_pos.*, partner_staff.name AS manager_name')
|
||||
->join('partner_staff', 'partner_staff.id = partner_pos.manager_id', 'left')
|
||||
->where('partner_pos.id', $id)
|
||||
->orderBy('partner_pos.id', 'DESC')
|
||||
->findAll();
|
||||
|
||||
if (!empty($data)) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
$data['pos_list'] = $posModel
|
||||
->select('partner_pos.*, ps.name AS manager_name')
|
||||
->join('partner_staff ps', 'ps.id = partner_pos.manager_id', 'left')
|
||||
->orderBy('partner_pos.id', 'DESC')
|
||||
->findAll();
|
||||
|
||||
|
||||
return $this->loadLayout('pos_list', ['data' => $data,'tab_name' => 'POS details','page_name' => 'POS details']);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
// $input = $this->request->getRawInput();
|
||||
$id = $this->request->getGet('pk'); // ✅ THIS
|
||||
$id = $id ?? null;
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No ID provided for deletion'
|
||||
], 200);
|
||||
}
|
||||
|
||||
$update_status = $posModel->where('id', $id)->set(['is_active' => 0])->update();
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data removed successfully',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to remove data',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
}
|
||||
if (stripos($e->getMessage(), 'Duplicate entry') !== false) {
|
||||
$statusCode = 400;
|
||||
if (stripos($e->getMessage(), 'email') !== false) {
|
||||
$message = 'Email already exists.';
|
||||
} elseif (stripos($e->getMessage(), 'mobile') !== false) {
|
||||
$message = 'Mobile number already exists.';
|
||||
} else {
|
||||
$message = 'Duplicate data found. Please check email/mobile.';
|
||||
}
|
||||
}
|
||||
|
||||
private function uploadPOSFile(string $fieldName, string $uploadDir)
|
||||
{
|
||||
$file = $this->request->getFile($fieldName);
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => $statusCode,
|
||||
'message' => $message
|
||||
], $statusCode);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
log_message(
|
||||
'error',
|
||||
'partnerPOS fatal error: ' . $e->getMessage() .
|
||||
' | file: ' . $e->getFile() .
|
||||
' | line: ' . $e->getLine() .
|
||||
' | trace: ' . $e->getTraceAsString()
|
||||
);
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 500,
|
||||
'message' => 'Internal server error while processing POS request.'
|
||||
], 500);
|
||||
}
|
||||
} elseif ($method === 'get') {
|
||||
|
||||
if (!$file || !$file->isValid()) { return null; }
|
||||
$id = $this->request->getGet('pk') ?? null;
|
||||
|
||||
$allowedMime = [ 'image/jpg', 'image/jpeg', 'image/png', 'image/webp', 'application/pdf'];
|
||||
$db = db_connect();
|
||||
|
||||
if (!in_array($file->getMimeType(), $allowedMime)) { throw new \RuntimeException('Invalid file format'); }
|
||||
$builder = $db->table('partner_staff');
|
||||
|
||||
$path = ROOTPATH . 'public/uploads/' . $uploadDir . '/';
|
||||
$data['manager_list'] = $builder->select('partner_staff.id, partner_staff.name')
|
||||
->where('partner_staff.is_active', 1)
|
||||
->where('partner_staff.role_id', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (!is_dir($path)) { mkdir($path, 0755, true); }
|
||||
|
||||
$newName = $file->getRandomName();
|
||||
$file->move($path, $newName);
|
||||
if (!empty($id)) {
|
||||
|
||||
return $newName;
|
||||
$data['pos_list'] = $posModel
|
||||
->select('partner_pos.*, partner_staff.name AS manager_name')
|
||||
->join('partner_staff', 'partner_staff.id = partner_pos.manager_id', 'left')
|
||||
->where('partner_pos.id', $id)
|
||||
->orderBy('partner_pos.id', 'DESC')
|
||||
->findAll();
|
||||
|
||||
if (!empty($data)) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
$data['pos_list'] = $posModel
|
||||
->select('partner_pos.*, ps.name AS manager_name')
|
||||
->join('partner_staff ps', 'ps.id = partner_pos.manager_id', 'left')
|
||||
->orderBy('partner_pos.id', 'DESC')
|
||||
->findAll();
|
||||
|
||||
|
||||
}
|
||||
return $this->loadLayout('pos_list', ['data' => $data, 'tab_name' => 'POS details', 'page_name' => 'POS details']);
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
// $input = $this->request->getRawInput();
|
||||
$id = $this->request->getGet('pk'); // ✅ THIS
|
||||
$id = $id ?? null;
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No ID provided for deletion'
|
||||
], 200);
|
||||
}
|
||||
|
||||
$update_status = $posModel->where('id', $id)->set(['is_active' => 0])->update();
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data removed successfully',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to remove data',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function uploadPOSFile(string $fieldName, string $uploadDir)
|
||||
{
|
||||
$file = $this->request->getFile($fieldName);
|
||||
|
||||
if (!$file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// No file selected for this optional input.
|
||||
if ($file->getError() === UPLOAD_ERR_NO_FILE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$file->isValid()) {
|
||||
throw new \RuntimeException('File upload failed for ' . $fieldName);
|
||||
}
|
||||
|
||||
$allowedMime = [
|
||||
'image/jpg',
|
||||
'image/jpeg',
|
||||
'image/pjpeg',
|
||||
'image/png',
|
||||
'image/x-png',
|
||||
'image/webp',
|
||||
'application/pdf'
|
||||
];
|
||||
|
||||
$mimeType = (string) $file->getMimeType();
|
||||
if (!in_array($mimeType, $allowedMime, true)) {
|
||||
throw new \RuntimeException('Invalid file format for ' . $fieldName);
|
||||
}
|
||||
|
||||
$path = ROOTPATH . 'public/uploads/' . $uploadDir . '/';
|
||||
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
|
||||
$newName = $file->getRandomName();
|
||||
$file->move($path, $newName);
|
||||
|
||||
return $newName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -2438,7 +2438,7 @@ class TicketController extends BaseController
|
||||
|
||||
//---- Email Trigger Part----------------------------------------------------------------------------------------------
|
||||
|
||||
public function constructMailContent($ticket_id)
|
||||
public function constructMailContent($ticket_id, $status_id = null)
|
||||
{
|
||||
$this->myLogger->logme('error', "Constructing mail content for Ticket ID: $ticket_id");
|
||||
|
||||
@ -2454,9 +2454,14 @@ class TicketController extends BaseController
|
||||
|
||||
$this->myLogger->logme('error', "Fetched ticket data: " . json_encode($ticket_data));
|
||||
|
||||
if (!empty($status_id)) {
|
||||
$ticket_data['claim_status_id'] = (int) $status_id;
|
||||
}
|
||||
|
||||
// Fetch Email Template Data
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
// print_r($template_data); die;
|
||||
$template_data = !empty($status_id)
|
||||
? ($this->ticketMasterModel->getTemplateDataByStatusID((int) $status_id, (int) ($ticket_data['ticket_type_id'] ?? 0))[0] ?? null)
|
||||
: $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
|
||||
if (!$template_data) {
|
||||
$this->myLogger->logme('error', "No email template found for Claim Status ID: " . $ticket_data['claim_status_id']);
|
||||
@ -2628,7 +2633,7 @@ class TicketController extends BaseController
|
||||
'mail' => [$mail_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||
'subject' => $mail_data['mail_subject'],
|
||||
'message' => $mail_data['mail_content'],
|
||||
'common' => [],
|
||||
'common' => ['module' => "claim", 'pk' => $mail_data['ticket_id']],
|
||||
'cc' => $acm_mails['common_mails'],
|
||||
'attachments' => []
|
||||
];
|
||||
@ -2826,7 +2831,7 @@ class TicketController extends BaseController
|
||||
'mail' => $template_data['emp_mail'],
|
||||
'subject' => $template_data['subject'],
|
||||
'message' => $template_data['mail_content'],
|
||||
'common' => [],
|
||||
'common' => ['module' => "claim", 'pk' => $ticket_id],
|
||||
'cc' => $acm_mails['common_mails'],
|
||||
'attachments' => []
|
||||
];
|
||||
@ -2987,7 +2992,7 @@ class TicketController extends BaseController
|
||||
'mail' => $head_mail['email'],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'common' => [],
|
||||
'common' => ['module' => "claim", 'pk' => $ticket_data['id']],
|
||||
];
|
||||
|
||||
$this->sendTrigger($emailData);
|
||||
@ -3722,7 +3727,7 @@ class TicketController extends BaseController
|
||||
return $input;
|
||||
}
|
||||
|
||||
function convertTermsToDisplay(array $data)
|
||||
public function convertTermsToDisplay(array $data)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
@ -3902,6 +3907,106 @@ class TicketController extends BaseController
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getClaimTemplateData()
|
||||
{
|
||||
try {
|
||||
$ticket_id = $this->request->getPost('ticket_id') ?? $this->request->getGet('ticket_id');
|
||||
$status_id = $this->request->getPost('status_id') ?? $this->request->getGet('status_id');
|
||||
|
||||
if (empty($ticket_id) || empty($status_id)) {
|
||||
return $this->respond(['status' => false, 'message' => 'Ticket ID and Status ID are required'], 400);
|
||||
}
|
||||
|
||||
$mail_content = $this->constructMailContent($ticket_id, $status_id);
|
||||
if ($mail_content) {
|
||||
return $this->respond(['status' => true, 'data' => $mail_content], 200);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to construct mail content'], 200);
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme('error', 'Error in getClaimTemplateData: ' . $e->getMessage() . ' in file ' . $e->getFile() . ' on line ' . $e->getLine() . $e->getTraceAsString());
|
||||
return $this->respond(['status' => false, 'message' => 'An error occurred while fetching template data'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadApprovedLetterFromReply()
|
||||
{
|
||||
try {
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
$status_id = $this->request->getPost('status_id');
|
||||
$approvedLetterUrl = trim((string) $this->request->getPost('approved_letter'));
|
||||
$approvedLetterFile = $this->request->getFile('approved_letter_file');
|
||||
|
||||
if (empty($ticket_id) || empty($status_id)) {
|
||||
return $this->respond(['status' => false, 'message' => 'Ticket ID and Status ID are required'], 400);
|
||||
}
|
||||
|
||||
if ((int) $status_id !== 9) {
|
||||
return $this->respond(['status' => false, 'message' => 'Approved letter upload is allowed only for APPROVED status'], 400);
|
||||
}
|
||||
|
||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||
if (empty($ticket_data)) {
|
||||
return $this->respond(['status' => false, 'message' => 'Ticket not found'], 404);
|
||||
}
|
||||
|
||||
if (!empty($ticket_data['approved_letter'])) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'message' => 'Approved letter already available',
|
||||
'data' => ['approved_letter' => $ticket_data['approved_letter']],
|
||||
], 200);
|
||||
}
|
||||
|
||||
$hasApprovedLetterFile = $approvedLetterFile !== null
|
||||
&& $approvedLetterFile->isValid()
|
||||
&& $approvedLetterFile->getError() !== UPLOAD_ERR_NO_FILE;
|
||||
|
||||
if ($approvedLetterUrl !== '' && $hasApprovedLetterFile) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'message' => 'Provide either Approved Letter URL or Approved Letter PDF file, not both.',
|
||||
], 400);
|
||||
}
|
||||
|
||||
if ($approvedLetterUrl !== '' && !$this->isClaimUploadUrl($approvedLetterUrl)) {
|
||||
return $this->respond(['status' => false, 'message' => 'Approved Letter URL format is invalid.'], 400);
|
||||
}
|
||||
|
||||
if ($approvedLetterUrl === '' && !$hasApprovedLetterFile) {
|
||||
return $this->respond(['status' => false, 'message' => 'Provide Approved Letter URL or Approved Letter PDF file.'], 400);
|
||||
}
|
||||
|
||||
$approvedLetterValue = $approvedLetterUrl;
|
||||
if ($hasApprovedLetterFile) {
|
||||
$uploadResult = $this->uploadApprovedLetterPdf($approvedLetterFile, 'Approved Letter');
|
||||
if (!($uploadResult['status'] ?? false)) {
|
||||
return $this->respond(['status' => false, 'message' => $uploadResult['message'] ?? 'Invalid Approved Letter file.'], 400);
|
||||
}
|
||||
|
||||
$approvedLetterValue = $this->createApprovedLetterFileUrl(
|
||||
(int) $ticket_id,
|
||||
(int) ($ticket_data['ticket_type_id'] ?? 1),
|
||||
$uploadResult['data'],
|
||||
'APPROVED_LETTER_PDF'
|
||||
);
|
||||
}
|
||||
|
||||
$this->ticketMasterModel
|
||||
->where('id', (int) $ticket_id)
|
||||
->set(['approved_letter' => $approvedLetterValue])
|
||||
->update();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'Approved letter uploaded successfully',
|
||||
'data' => ['approved_letter' => $approvedLetterValue],
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme('error', 'Error in uploadApprovedLetterFromReply: ' . $e->getMessage() . ' in file ' . $e->getFile() . ' on line ' . $e->getLine() . $e->getTraceAsString());
|
||||
return $this->respond(['status' => false, 'message' => 'An error occurred while uploading approved letter'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// -------- CLAIM DUMP UPLOAD ----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -133,17 +133,20 @@ class TicketMasterModel extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getTemplateDataByStatusID($claim_status_id)
|
||||
public function getTemplateDataByStatusID($claim_status_id, $ticket_type_id = null)
|
||||
{
|
||||
|
||||
$template_data = $this->table('ticket_claim_status')
|
||||
$builder = $this->db->table('ticket_claim_status tcs')
|
||||
->select('ticket_mail_template.*')
|
||||
->join('ticket_mail_template', 'ticket_mail_template.trigger_type = ticket_claim_status.trigger_type')
|
||||
->join('ticket_mail_template', 'ticket_mail_template.trigger_type = tcs.trigger_type')
|
||||
->where('ticket_mail_template.is_active', 1)
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->where('ticket_claim_status.id', $claim_status_id)
|
||||
->get()
|
||||
->getResultArray();
|
||||
->where('tcs.id', $claim_status_id)
|
||||
->where('tcs.is_active', 1);
|
||||
|
||||
if ($ticket_type_id !== null && $ticket_type_id !== '') {
|
||||
$builder->where('ticket_mail_template.ticket_type', $ticket_type_id);
|
||||
}
|
||||
|
||||
$template_data = $builder->get()->getResultArray();
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
helper('datatable_view');
|
||||
$batch_header_labels = [
|
||||
'S.No', 'Batch Code', 'File Name', 'Client', 'Client Branch', 'Client Policy',
|
||||
'Event Type', 'Insurer/ TPA', 'Action', 'Count', '(₹)Amount', 'User/Time', 'Status', 'Action',
|
||||
|
||||
@ -242,6 +242,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
@ -329,6 +330,7 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -10,11 +10,20 @@
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
var pageHideMainNavTitle = true;
|
||||
var pageTitle = 'Client Details - <?= $client['client_name'] ?> ( <?= $client['short_name'] ?> ) ';
|
||||
var pageBackButton = '<a href="<?= base_url("client/list"); ?>" class="topbar-icon-btn" data-toggle="tooltip" data-placement="top" title="Back to Client List" aria-label="Back to Client List"><i class="ri-arrow-left-s-line"></i></a>';
|
||||
if (typeof window.applyTopNavbarTitle === 'function') {
|
||||
window.applyTopNavbarTitle();
|
||||
}
|
||||
</script>
|
||||
<div class="row" id="client_info">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div id="client_info">
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-12">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card">
|
||||
@ -23,14 +32,19 @@
|
||||
<div class="col-6">
|
||||
|
||||
<h4 style="position: relative; left: 18px; top: 2px;">
|
||||
<!--
|
||||
<span class="client_info_close fs-6" id="close_btn">
|
||||
<i class="mdi mdi-chevron-left" style="font-size: 28px;cursor:pointer;"></i>
|
||||
</span>
|
||||
</span>
|
||||
-->
|
||||
<span>
|
||||
<!--
|
||||
Client Basic Info -
|
||||
<strong> <?= $client['client_name'] ?> ( <?= $client['short_name'] ?> ) </strong>
|
||||
-->
|
||||
Client Basic Information
|
||||
</span>
|
||||
|
||||
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
@ -228,8 +242,9 @@
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -205,6 +205,10 @@ table.dataTable thead th {
|
||||
<?php if(in_array(get_role_id(), [1, 5])) { ?>
|
||||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="openClientDetailsPage(<?= $row->id ?>)">
|
||||
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>Open Client Details
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -257,6 +261,7 @@ table.dataTable thead th {
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
/**
|
||||
const table = document.getElementById("client-list-table");
|
||||
|
||||
// Create custom dropdown
|
||||
@ -344,9 +349,9 @@ table.dataTable thead th {
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
// Open client details page
|
||||
function openClientDetailsPage(clientId) {
|
||||
window.openClientDetailsPage = function(clientId) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
@ -369,7 +374,7 @@ table.dataTable thead th {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -91,9 +91,9 @@ if ($emp_show_branch) {
|
||||
$emp_header_labels[] = 'Branch';
|
||||
}
|
||||
$emp_header_labels = array_merge($emp_header_labels, [
|
||||
'Name', 'EMP Code', 'Relationship', 'Gender', 'Email', 'Mobile', 'Date of Birth',
|
||||
'Policy name', 'Insurer name', 'TPA ID', 'Risk ID', 'Policy status',
|
||||
'(₹)Sum Insured', '(₹)Premium', '(₹)Pro Rata Premium', '(₹)GST', 'Action',
|
||||
'Name ', 'EMP Code ', 'Relationship ', 'Gender ', 'Email', 'Mobile', 'Date of Birth',
|
||||
'Policy name ', 'Insurer name ', 'TPA ID ', 'Risk ID ', 'Policy status ',
|
||||
'(₹)Sum Insured ', '(₹)Premium ', '(₹)Pro Rata Premium ', '(₹)GST ', 'Action ',
|
||||
]);
|
||||
$emp_col_count = count($emp_header_labels);
|
||||
$emp_col_max_len = array_fill(0, $emp_col_count, 0);
|
||||
@ -157,8 +157,20 @@ if (isset($employees)) {
|
||||
$emp_col_max_len[$emp_col_count - 6] = max($emp_col_max_len[$emp_col_count - 6], mb_strlen('Total'));
|
||||
$emp_col_min_px = array_fill(0, $emp_col_count, 80);
|
||||
$emp_col_max_px = array_fill(0, $emp_col_count, 360);
|
||||
$emp_col_min_px[0] = 48;
|
||||
$emp_col_max_px[0] = 72;
|
||||
$emp_col_min_px[0] = 64;
|
||||
$emp_col_max_px[0] = 88;
|
||||
|
||||
$emp_dynamic_idx = 1;
|
||||
if ($emp_show_client_branch || $emp_show_branch) {
|
||||
$emp_col_min_px[$emp_dynamic_idx] = max($emp_col_min_px[$emp_dynamic_idx], 120);
|
||||
$emp_col_max_px[$emp_dynamic_idx] = max($emp_col_max_px[$emp_dynamic_idx], 190);
|
||||
$emp_dynamic_idx++;
|
||||
}
|
||||
$emp_col_min_px[$emp_dynamic_idx] = max($emp_col_min_px[$emp_dynamic_idx], 110); // Name
|
||||
$emp_dynamic_idx++;
|
||||
$emp_col_min_px[$emp_dynamic_idx] = max($emp_col_min_px[$emp_dynamic_idx], 100); // EMP Code
|
||||
$emp_col_max_px[$emp_dynamic_idx] = max($emp_col_max_px[$emp_dynamic_idx], 140);
|
||||
|
||||
$emp_col_min_px[$emp_col_count - 1] = 72;
|
||||
$emp_col_max_px[$emp_col_count - 1] = 96;
|
||||
$emp_col_width_px = nhance_dt_column_widths_px($emp_header_labels, $emp_col_max_len, $emp_col_min_px, $emp_col_max_px);
|
||||
@ -183,6 +195,11 @@ $gst_total = 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
<?php endfor; ?>
|
||||
#employee-data-list-table,
|
||||
#employee-data-list-table_wrapper .dataTables_scrollHead table,
|
||||
#employee-data-list-table_wrapper .dataTables_scrollBody table {
|
||||
table-layout: fixed !important;
|
||||
}
|
||||
#employee-data-list-table tbody td:not(:last-child) {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@ -201,6 +218,15 @@ $gst_total = 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
#employee-data-list-table_wrapper table.dataTable thead .sorting:before,
|
||||
#employee-data-list-table_wrapper table.dataTable thead .sorting:after,
|
||||
#employee-data-list-table_wrapper table.dataTable thead .sorting_asc:before,
|
||||
#employee-data-list-table_wrapper table.dataTable thead .sorting_asc:after,
|
||||
#employee-data-list-table_wrapper table.dataTable thead .sorting_desc:before,
|
||||
#employee-data-list-table_wrapper table.dataTable thead .sorting_desc:after {
|
||||
right: 0.55rem !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
@ -213,7 +239,7 @@ $gst_total = 0;
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" class="table table-hover m-0 table-centered nowrap w-100 dt-responsive" cellspacing="0" id="employee-data-list-table">
|
||||
<table data-custom-table-css="table" class="table table-hover m-0 table-centered nowrap w-100" cellspacing="0" id="employee-data-list-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">S.No </th>
|
||||
@ -240,7 +266,7 @@ $gst_total = 0;
|
||||
<th class="font-weight-medium">Policy status </th>
|
||||
<th class="font-weight-medium">(₹)Sum Insured </th>
|
||||
<th class="font-weight-medium">(₹)Premium </th>
|
||||
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">(₹)Pro Rata <br> Premium </th>
|
||||
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">(₹)Pro Rata Premium </th>
|
||||
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST </th>
|
||||
<th class="font-weight-medium" > Action </th>
|
||||
</tr>
|
||||
@ -344,29 +370,17 @@ $gst_total = 0;
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<?php if (isset($getData)) {
|
||||
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||
<th></th>
|
||||
<?php }
|
||||
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||
<th></th>
|
||||
<?php } } ?>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th><?php echo format_indian_number($pro_rata_total); ?></th>
|
||||
<th><?php echo format_indian_number($gst_total); ?></th>
|
||||
<th></th>
|
||||
<?php for ($i = 0; $i < $emp_col_count; $i++) : ?>
|
||||
<?php if ($i === ($emp_col_count - 4)) : ?>
|
||||
<th>Total</th>
|
||||
<?php elseif ($i === ($emp_col_count - 3)) : ?>
|
||||
<th><?php echo format_indian_number($pro_rata_total); ?></th>
|
||||
<?php elseif ($i === ($emp_col_count - 2)) : ?>
|
||||
<th><?php echo format_indian_number($gst_total); ?></th>
|
||||
<?php else : ?>
|
||||
<th></th>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
@ -239,6 +239,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
@ -328,6 +329,7 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@ -338,11 +340,7 @@ $(document).ready(function () {
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
// dom:
|
||||
// "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
// "<'row'<'col-sm-12'tr>>" +
|
||||
// "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
||||
"<'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>>",
|
||||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||
@ -409,110 +407,23 @@ $(document).ready(function () {
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
getURLParams();
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams() {
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
console.log('startDate', startDate)
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
|
||||
// Log the values or use them as needed
|
||||
console.log('Start Date:', startDate);
|
||||
console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD-MM-YYYY');
|
||||
var end = moment(endDateParam, 'DD-MM-YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
function cb(startDate, endDate) {
|
||||
$('#reportrange').html(startDate.format('D-MM-YYYY') + ' - ' + endDate.format('D-MM-YYYY'));
|
||||
$('#startDate').val(startDate.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(endDate.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
@ -525,18 +436,24 @@ $(function() {
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
]
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
});
|
||||
}, cb);
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
$('#date_div').hide();
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(moment().subtract(29, 'days'), moment());
|
||||
});
|
||||
});
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
@ -568,7 +485,9 @@ $(function() {
|
||||
}
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
return Object.keys(obj).map(function(key) {
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]);
|
||||
}).join('&');
|
||||
}
|
||||
|
||||
function getURLParams() {
|
||||
@ -599,78 +518,17 @@ $(function() {
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
}, 1000)
|
||||
|
||||
$('#startDate').val(startDate);
|
||||
$('#endDate').val(endDate);
|
||||
$('#client_id').val(client_id).change();
|
||||
$('#insurer_id').val(insurer_id).change();
|
||||
$('#policy_type_id').val(policy_type_id).change();
|
||||
$('#date_type').val(date_type);
|
||||
$('#issuer').val(issuer);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD-MM-YYYY');
|
||||
var end = moment(endDateParam, 'DD-MM-YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
locale: {
|
||||
format: 'DD-MM-YYYY'
|
||||
},
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null) {
|
||||
let val = $('#date_type').val();
|
||||
|
||||
|
||||
@ -614,6 +614,7 @@ $isl_col_width_px = nhance_dt_column_widths_px($isl_header_labels, $isl_col_max_
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
/**
|
||||
const table = document.getElementById("insurer-statement-list-table");
|
||||
|
||||
// Create custom dropdown
|
||||
@ -690,6 +691,7 @@ $isl_col_width_px = nhance_dt_column_widths_px($isl_header_labels, $isl_col_max_
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -138,7 +138,9 @@ $kyc_col_width_px = nhance_dt_column_widths_px($kyc_header_labels, $kyc_col_max_
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("kyc-list-table");
|
||||
|
||||
@ -226,6 +228,7 @@ $kyc_col_width_px = nhance_dt_column_widths_px($kyc_header_labels, $kyc_col_max_
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
<script>
|
||||
|
||||
|
||||
@ -1453,35 +1453,6 @@ $(function(){
|
||||
});
|
||||
}
|
||||
|
||||
function nhApplyMenuScrollLimit($menu, usableSpace) {
|
||||
if (!$menu || !$menu.length) {
|
||||
return;
|
||||
}
|
||||
var $items = $menu.children('.dropdown-item:visible, a:visible, button:visible');
|
||||
var visibleItems = 3;
|
||||
var fixedMenuMax = 0;
|
||||
if ($items.length) {
|
||||
$items.slice(0, visibleItems).each(function () {
|
||||
fixedMenuMax += $(this).outerHeight(true) || 0;
|
||||
});
|
||||
}
|
||||
if (!fixedMenuMax) {
|
||||
fixedMenuMax = 132; // safe default for 3 items
|
||||
}
|
||||
fixedMenuMax += 14; // include menu paddings/borders
|
||||
var viewportMax = Math.max(140, usableSpace - 12);
|
||||
var finalMax = Math.max(132, Math.min(fixedMenuMax, viewportMax));
|
||||
|
||||
$menu.css({
|
||||
maxHeight: finalMax + 'px',
|
||||
overflowY: 'auto',
|
||||
overflowX: 'hidden',
|
||||
scrollBehavior: 'smooth',
|
||||
overscrollBehavior: 'contain',
|
||||
zIndex: '20050'
|
||||
});
|
||||
}
|
||||
|
||||
function nhNormalizeActionCells(tableApi) {
|
||||
if (!tableApi) {
|
||||
return;
|
||||
@ -1584,12 +1555,16 @@ $(function(){
|
||||
$dd.data('nh-auto-dropup', 1);
|
||||
}
|
||||
|
||||
// Keep height capped to ~3 items and allow vertical scroll for extra actions.
|
||||
// Keep action menu fully expanded (no inner scroll).
|
||||
if ($menu.length && menuHeight > 0) {
|
||||
var usableSpace = openUp ? above : below;
|
||||
nhApplyMenuScrollLimit($menu, usableSpace);
|
||||
$menu.addClass('nh-action-menu-elevated');
|
||||
$menu.scrollTop(0);
|
||||
$menu.css({
|
||||
maxHeight: '',
|
||||
overflowY: '',
|
||||
overflowX: '',
|
||||
scrollBehavior: '',
|
||||
overscrollBehavior: '',
|
||||
zIndex: '20050'
|
||||
}).addClass('nh-action-menu-elevated');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -196,14 +196,15 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="issuer">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="">Select Issuer</option>
|
||||
<?php
|
||||
<option value='2' selected>Nhance</option>;
|
||||
|
||||
<!-- <?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
?> -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -229,14 +230,14 @@
|
||||
<hr>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloverhide" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloverhide" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
@ -343,7 +344,7 @@
|
||||
placeholder="Enter Branch Code" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields">
|
||||
<div class="form-group col-md-4 renewalFields rolloverhide">
|
||||
<label for="contact_person_summary">Contact Person<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="contact_person_summary" id="contact_person_summary">
|
||||
<option value="">Select a Contact</option>
|
||||
@ -541,8 +542,8 @@
|
||||
|
||||
var lead_type = $(this).val();
|
||||
var increment = 1; // Example increment value (modify as needed)
|
||||
var start_date_id = (lead_type == "1" || lead_type == "3") ? `policy_start_date_${increment}` : "policy_start_date";
|
||||
var end_date_id = (lead_type == "1" || lead_type == "3") ? `policy_end_date_${increment}` : "policy_end_date";
|
||||
var start_date_id = (lead_type == "1") ? `policy_start_date_${increment}` : "policy_start_date";
|
||||
var end_date_id = (lead_type == "1") ? `policy_end_date_${increment}` : "policy_end_date";
|
||||
|
||||
$(".policy_start_date").attr("id", start_date_id);
|
||||
// $("label[for]").attr("for", start_date_id);
|
||||
@ -553,7 +554,7 @@
|
||||
// $('#leads_form_id')[0].reset();
|
||||
|
||||
// console.log("Updated ID:", newId);
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
if (lead_type == 1) {
|
||||
|
||||
var policy_start_datePicker = flatpickr("#policy_start_date_" + increment, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -561,8 +562,7 @@
|
||||
onChange: function(selectedDates) {
|
||||
var policy_end_date = new Date(selectedDates[0]);
|
||||
policy_end_date.setFullYear(policy_end_date.getFullYear() + 1);
|
||||
policy_end_date.setDate(policy_end_date.getDate() -
|
||||
1); // Set end date to last day of selected year
|
||||
policy_end_date.setDate(policy_end_date.getDate() - 1); // Set end date to last day of selected year
|
||||
policy_end_datePicker.setDate(policy_end_date);
|
||||
|
||||
// console.log('this object', this);
|
||||
@ -585,7 +585,7 @@
|
||||
// }
|
||||
}
|
||||
});
|
||||
} else if (lead_type != 1 && lead_type != 3) {
|
||||
} else if (lead_type == 2) {
|
||||
$("#source_policy_id").prop("required", true);
|
||||
$("#source_policy_start_date").prop("required", true);
|
||||
$("#source_policy_end_date").prop("required", true);
|
||||
@ -624,7 +624,7 @@
|
||||
|
||||
}
|
||||
|
||||
if (lead_type != 1 && lead_type != 3) {
|
||||
if (lead_type != 1) {
|
||||
dataIncrement = 1;
|
||||
// updateRenewalFields(dataIncrement);
|
||||
|
||||
@ -744,12 +744,9 @@
|
||||
leadTypeBsedHideAndShow(lead_type)
|
||||
|
||||
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
|
||||
if (lead_type == 1) {
|
||||
$('.claim-row').hide();
|
||||
|
||||
} else {
|
||||
|
||||
$('.claim-row').show();
|
||||
if (policy_type_id == 1) {
|
||||
$('.gpaClaimFileds').show();
|
||||
@ -757,50 +754,50 @@
|
||||
} else if (policy_type_id == 6 || policy_type_id == 7) {
|
||||
$('.gpaClaimFileds').hide();
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
|
||||
// updateRenewalFields(dataIncrement);
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
console.log('Flatpickr instance:', this);
|
||||
console.log('ID of this element:', this.input.id);
|
||||
|
||||
// Extract the increment value from the element's ID
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
let lead_type = $('#lead_type').val();
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
if (lead_type == 3) {
|
||||
policyStartDate = $("#policy_start_date");
|
||||
}
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
|
||||
// Recalculate policy_run_days if policy start date is already selected
|
||||
// if (policyStartDate.val()) {
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (lead_type != 1 && policy_type_id != 1 && policy_type_id != 6 && policy_type_id != 7) {
|
||||
// updateRenewalFields(dataIncrement);
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
console.log('Flatpickr instance:', this);
|
||||
console.log('ID of this element:', this.input.id);
|
||||
|
||||
// Extract the increment value from the element's ID
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
let lead_type = $('#lead_type').val();
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
if (lead_type == 3) {
|
||||
policyStartDate = $("#policy_start_date");
|
||||
}
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
|
||||
// Recalculate policy_run_days if policy start date is already selected
|
||||
// if (policyStartDate.val()) {
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
}
|
||||
|
||||
hide_list_show_add();
|
||||
|
||||
pageTitle = 'Edit Opportunities - (EB)';
|
||||
@ -1131,12 +1128,9 @@
|
||||
leadTypeBsedHideAndShow(lead_type)
|
||||
|
||||
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
|
||||
if (lead_type == 1) {
|
||||
$('.claim-row').hide();
|
||||
|
||||
} else {
|
||||
|
||||
$('.claim-row').show();
|
||||
|
||||
if (policy_type_id == 1) {
|
||||
@ -1145,47 +1139,47 @@
|
||||
} else if (policy_type_id == 6 || policy_type_id == 7) {
|
||||
$('.gpaClaimFileds').hide();
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
updateRenewalFields(dataIncrement);
|
||||
}
|
||||
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
console.log('Flatpickr instance:', this);
|
||||
console.log('ID of this element:', this.input.id);
|
||||
|
||||
// Extract the increment value from the element's ID
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
if (lead_type == 3) {
|
||||
policyStartDate = $("#policy_start_date");
|
||||
}
|
||||
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
|
||||
// Recalculate policy_run_days if policy start date is already selected
|
||||
// if (policyStartDate.val()) {
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (lead_type != 1 && policy_type_id != 1 && policy_type_id != 6 && policy_type_id != 7) {
|
||||
if (lead_type == 1) {
|
||||
updateRenewalFields(dataIncrement);
|
||||
}
|
||||
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
console.log('Flatpickr instance:', this);
|
||||
console.log('ID of this element:', this.input.id);
|
||||
|
||||
// Extract the increment value from the element's ID
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
if (lead_type == 3) {
|
||||
policyStartDate = $("#policy_start_date");
|
||||
}
|
||||
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
|
||||
// Recalculate policy_run_days if policy start date is already selected
|
||||
// if (policyStartDate.val()) {
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log(response.message, 'WARNING');
|
||||
}
|
||||
@ -1287,7 +1281,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_start_date">Date of Commencement <span class="text-danger">*</span></label>
|
||||
<div class="input-icon">
|
||||
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" onchange="calculatePolicyMetrics(this)">
|
||||
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" onchange="calculatePolicyMetrics(this)" autocomplete="off" >
|
||||
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
||||
</div>
|
||||
|
||||
@ -1296,7 +1290,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_end_date">Date of Expiry <span class="text-danger">*</span></label>
|
||||
<div class="input-icon">
|
||||
<input type="text" class="form-control policy_end_date" id="policy_end_date_${increment}" name="policy_end_date[]" placeholder="Enter DOE">
|
||||
<input type="text" class="form-control policy_end_date" id="policy_end_date_${increment}" name="policy_end_date[]" placeholder="Enter DOE" autocomplete="off">
|
||||
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
@ -1351,7 +1345,7 @@
|
||||
// $(".policy_end_date").attr("id", end_date_id);
|
||||
|
||||
// Initialize date pickers
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
if (lead_type == 1) {
|
||||
|
||||
var policy_start_datePicker = flatpickr("#policy_start_date_" + increment, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -1565,7 +1559,7 @@
|
||||
console.log('Lead Type:', lead_type);
|
||||
|
||||
let increment = input.id.split('_').pop(); // Extract increment
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
if (lead_type == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1683,7 +1677,7 @@
|
||||
|
||||
var lead_type = $('#lead_type').val();
|
||||
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
if (lead_type == 1) {
|
||||
|
||||
let formRow = input.closest('.form-row');
|
||||
|
||||
@ -1924,6 +1918,7 @@
|
||||
onChange: function(selectedDates) {
|
||||
try {
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Incurred claim date changed:', selectedDates);
|
||||
let policyStartDate = $("#source_policy_start_date");
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
@ -2301,7 +2296,7 @@
|
||||
|
||||
function leadTypeBsedHideAndShow(value, resetValues = false) {
|
||||
|
||||
if (value == 1 || value == 3) {
|
||||
if (value == 1) {
|
||||
$('.btnDiv').show();
|
||||
$('.claim-row').hide();
|
||||
|
||||
@ -2317,6 +2312,56 @@
|
||||
|
||||
// $('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
|
||||
if (resetValues) {
|
||||
|
||||
$('#gst').val('');
|
||||
$('#pan').val('');
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#contact_person_name').val('');
|
||||
$('#contact_person_mobile').val('');
|
||||
$('#contact_person_email').val('');
|
||||
|
||||
$('#client_type').val('');
|
||||
$('#client_name').val('');
|
||||
$('#client_short_name').val('');
|
||||
$('#entity_type_id').val('');
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').removeAttr('required');
|
||||
|
||||
} else if (value == 3) {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
$('.claim-row').show();
|
||||
|
||||
$('.emp_title_text').text('No of Employees at Inception')
|
||||
$('.depnd_title_text').text(' No of Dependents at Inception')
|
||||
$('.total_title_text').text('Total Lives at Inception')
|
||||
|
||||
$('.freshFields').find('select, input').attr('required', 'required');
|
||||
$('.freshFields').show();
|
||||
|
||||
$('.rolloOverFields').find('select, input').attr('required', 'required');
|
||||
$('.renewalFields').show();
|
||||
|
||||
$('#source_policy_id').hide();
|
||||
$('#source_policy_start_date').hide();
|
||||
$('#source_policy_end_date').hide();
|
||||
|
||||
$('#source_policy_id').closest('.form-group').hide();
|
||||
$('#source_policy_start_date').closest('.form-group').hide();
|
||||
$('#source_policy_end_date').closest('.form-group').hide();
|
||||
|
||||
$('.source_policy_id').find('select, input').attr('required', 'required');
|
||||
$('.source_policy_start_date').find('select, input').attr('required', 'required');
|
||||
$('.source_policy_end_date').find('select, input').attr('required', 'required');
|
||||
|
||||
|
||||
$('.rolloverhide').hide();
|
||||
|
||||
|
||||
if (resetValues) {
|
||||
|
||||
$('#gst').val('');
|
||||
|
||||
@ -935,6 +935,30 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
}
|
||||
|
||||
if(lead_type == 3){
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
|
||||
if ($('#' + incurred_claim_date_id).length) {
|
||||
flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function (selectedDates) {
|
||||
try {
|
||||
let increment = this.input.id.split('_').pop();
|
||||
let policyStartDate = $("#source_policy_start_date");
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error in incurred_claim_datepicker:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.warn(`Incurred claim date field #${incurred_claim_date_id} not found.`);
|
||||
}
|
||||
}
|
||||
|
||||
// if (lead_type == 3) {
|
||||
|
||||
// $('#client_id').prepend($('<option>', {
|
||||
|
||||
@ -367,6 +367,7 @@ table.dataTable thead th {
|
||||
|
||||
<?php include('policy_transaction_endorsement_form_2.php'); ?>
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
@ -446,6 +447,7 @@ table.dataTable thead th {
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
<script>
|
||||
var client_list = '';
|
||||
|
||||
@ -426,7 +426,7 @@ table.dataTable tbody td {
|
||||
function closeFilterNav() {
|
||||
document.getElementById("filter-sidebar").style.width = "0";
|
||||
}
|
||||
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
@ -518,6 +518,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
@ -195,6 +195,7 @@ $pt_col_width_px = nhance_dt_column_widths_px($pt_header_labels, $pt_col_max_len
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("policy-type-list-table");
|
||||
|
||||
@ -276,6 +277,7 @@ $pt_col_width_px = nhance_dt_column_widths_px($pt_header_labels, $pt_col_max_len
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -233,6 +233,7 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
<input type="file" class="form-control" name="aadhar_file_name" id="aadhar_file_name" accept=".pdf,.jpg,.jpeg,.png" data-parsley-file-validation>
|
||||
<i class="mdi mdi-upload additional-icon"></i>
|
||||
</div>
|
||||
<small id="aadhar_file_name_display" class="text-muted d-block" style="display:none !important;"></small>
|
||||
<small class="text-muted d-block">Allowed: PDF, PNG, JPG, JPEG.</small>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -241,6 +242,7 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
<input type="file" class="form-control" name="pan_file_name" id="pan_file_name" accept=".pdf,.jpg,.jpeg,.png" data-parsley-file-validation>
|
||||
<i class="mdi mdi-upload additional-icon"></i>
|
||||
</div>
|
||||
<small id="pan_file_name_display" class="text-muted d-block" style="display:none !important;"></small>
|
||||
<small class="text-muted d-block">Allowed: PDF, PNG, JPG, JPEG.</small>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -249,6 +251,7 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
<input type="file" class="form-control" name="certificate_file_name" id="certificate_file_name" accept=".pdf,.jpg,.jpeg,.png" data-parsley-file-validation>
|
||||
<i class="mdi mdi-upload additional-icon"></i>
|
||||
</div>
|
||||
<small id="certificate_file_name_display" class="text-muted d-block" style="display:none !important;"></small>
|
||||
<small class="text-muted d-block">Allowed: PDF, PNG, JPG, JPEG.</small>
|
||||
</div>
|
||||
</div>
|
||||
@ -433,11 +436,17 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('.loader, .loader-mask').fadeOut();
|
||||
let response = null;
|
||||
try {
|
||||
response = xhr.responseText ? JSON.parse(xhr.responseText) : null;
|
||||
} catch (e) {
|
||||
response = null;
|
||||
}
|
||||
|
||||
if (xhr.status === 400) {
|
||||
let response = JSON.parse(xhr.responseText);
|
||||
let errorMessages = "";
|
||||
let seenMessages = []; // Array to store unique messages
|
||||
if (response.errors) {
|
||||
if (response && response.errors) {
|
||||
$.each(response.errors, function (field, message) {
|
||||
if (!seenMessages.includes(message)) {
|
||||
errorMessages += `• ${message}<br>`;
|
||||
@ -446,16 +455,15 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
});
|
||||
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
|
||||
} else {
|
||||
toastr.warning(response.message || 'Validation failed', 'Warning');
|
||||
toastr.warning((response && response.message) ? response.message : 'Validation failed', 'Warning');
|
||||
}
|
||||
|
||||
} else if (xhr.status === 403) {
|
||||
let response = JSON.parse(xhr.responseText);
|
||||
toastr.error(response.message, 'Security Policy');
|
||||
toastr.error((response && response.message) ? response.message : 'Security policy error', 'Security Policy');
|
||||
} else if (xhr.status === 500) {
|
||||
toastr.error('Something went wrong . Please try again later.', 'Server Error');
|
||||
toastr.error((response && response.message) ? response.message : 'Something went wrong . Please try again later.', 'Server Error');
|
||||
} else {
|
||||
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
|
||||
toastr.error((response && response.message) ? response.message : 'An unexpected error occurred. Please try again later.', 'Error');
|
||||
}
|
||||
console.error('Unexpected error:', xhr.responseText);
|
||||
|
||||
@ -470,9 +478,32 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
$('#partnerPOSForm').parsley().reset();
|
||||
}
|
||||
$('#manager_id').val(null).trigger('change');
|
||||
updateFileNameDisplay('#aadhar_file_name', '#aadhar_file_name_display', '');
|
||||
updateFileNameDisplay('#pan_file_name', '#pan_file_name_display', '');
|
||||
updateFileNameDisplay('#certificate_file_name', '#certificate_file_name_display', '');
|
||||
|
||||
}
|
||||
|
||||
function updateFileNameDisplay(inputSelector, displaySelector, existingName = '') {
|
||||
const $display = $(displaySelector);
|
||||
let fileName = '';
|
||||
|
||||
if (existingName && String(existingName).trim() !== '') {
|
||||
fileName = String(existingName).trim();
|
||||
} else {
|
||||
const inputEl = $(inputSelector)[0];
|
||||
if (inputEl && inputEl.files && inputEl.files.length > 0) {
|
||||
fileName = inputEl.files[0].name || '';
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName) {
|
||||
$display.text('Uploaded: ' + fileName).show();
|
||||
} else {
|
||||
$display.text('').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appendEditData(data){
|
||||
$('#pos_id').val(data.id);
|
||||
@ -481,14 +512,12 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
$('#mobile').val(data.mobile);
|
||||
$('#pos_code').val(data.pos_code);
|
||||
|
||||
// Instead of setting the file input
|
||||
$('#current_file_name').text(data['certificate_file_name'] || 'No file uploaded');
|
||||
|
||||
$('#aadhar').val(data.aadhar);
|
||||
$('#aadhar_file_name').text(data['aadhar_file_name'] || 'No file uploaded');
|
||||
updateFileNameDisplay('#aadhar_file_name', '#aadhar_file_name_display', data['aadhar_file_name'] || '');
|
||||
|
||||
$('#pan').val(data.pan);
|
||||
$('#pan_file_name').text(data['pan_file_name'] || 'No file uploaded');
|
||||
updateFileNameDisplay('#pan_file_name', '#pan_file_name_display', data['pan_file_name'] || '');
|
||||
updateFileNameDisplay('#certificate_file_name', '#certificate_file_name_display', data['certificate_file_name'] || '');
|
||||
|
||||
$('#bank_name').val(data.bank_name);
|
||||
$('#account_holder_name').val(data.account_holder_name);
|
||||
@ -508,6 +537,18 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
});
|
||||
}
|
||||
|
||||
$('#aadhar_file_name').on('change', function () {
|
||||
updateFileNameDisplay('#aadhar_file_name', '#aadhar_file_name_display');
|
||||
});
|
||||
|
||||
$('#pan_file_name').on('change', function () {
|
||||
updateFileNameDisplay('#pan_file_name', '#pan_file_name_display');
|
||||
});
|
||||
|
||||
$('#certificate_file_name').on('change', function () {
|
||||
updateFileNameDisplay('#certificate_file_name', '#certificate_file_name_display');
|
||||
});
|
||||
|
||||
|
||||
$('#aadhar').on('input', function () {
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
@ -598,6 +639,7 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
|
||||
</script>
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("pos-list-table");
|
||||
|
||||
@ -685,4 +727,5 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
@ -5,75 +5,75 @@
|
||||
|
||||
<div class="form-row renewalCalculation">
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_date']) ? $lead_edit_data['incurred_claims_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date<?= $increment ?>"
|
||||
name="incurred_claim_date[]" placeholder="Enter DOE" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="paid_claims">Paid Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims<?= $increment ?>" name="paid_claims[]"
|
||||
placeholder="Enter Paid Claims" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="outstanding_claims">Outstanding Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims<?= $increment ?>" name="outstanding_claims[]"
|
||||
placeholder="Enter Outstanding Claims" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="incurred_claims">Incurred Claim<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims<?= $increment ?>" name="incurred_claims[]"
|
||||
placeholder="Enter Incurred Claim" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" name="policy_run_days[]"
|
||||
placeholder="Enter Policy Run Days" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="premium_at_inception">Premium Paid at Inception<span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception<?= $increment ?>" name="premium_at_inception[]"
|
||||
placeholder="Enter Premium Paid" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="premium_date">Premium as on Date<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date<?= $increment ?>" name="premium_date[]"
|
||||
placeholder="Enter Premium Date" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="earned_premium">Earned Premium<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium<?= $increment ?>" name="earned_premium[]"
|
||||
placeholder="Enter Earned Premium" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" name="annualised_claims[]"
|
||||
placeholder="Enter Annualised Claims" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="incurred_claims_ratio">Incurred Claims Ratio(%) <span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio<?= $increment ?>"
|
||||
name="incurred_claims_ratio[]" placeholder="Enter Incurred Claims Ratio" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="earned_claims_ratio">Earned Claims Ratio(%) <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio<?= $increment ?>" name="earned_claims_ratio[]"
|
||||
placeholder="Enter Earned Claims Ratio" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<span class="info-icon-wrapper">
|
||||
<i class="mdi mdi-information-outline text-primary"></i>
|
||||
<div class="info-tooltip">
|
||||
@ -89,7 +89,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<!-- <div class="form-group col-md-3 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="location">Location <span class="text-danger">*</span></label>
|
||||
<input value="<?php //echo isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
|
||||
</div> -->
|
||||
@ -161,20 +161,20 @@
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="exp_emp_count"> No of Employees at Expiry <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_emp_count']) ? $lead_edit_data['exp_emp_count'] : '' ?>" type="text" class="form-control" id="exp_emp_count" name="exp_emp_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="exp_dept_count"> No of Dependents at Expiry <span
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_dept_count']) ? $lead_edit_data['exp_dept_count'] : '' ?>" type="text" class="form-control" id="exp_dept_count" name="exp_dept_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="exp_no_of_lives"> Total Lives at Expiry <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_no_of_lives']) ? $lead_edit_data['exp_no_of_lives'] : '' ?>" type="text" class="form-control" id="exp_no_of_lives" name="exp_no_of_lives[]"
|
||||
placeholder="Enter Lives">
|
||||
@ -184,21 +184,21 @@
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="renewal_emp_count"> No of Employees at Renewal <span
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_emp_count']) ? $lead_edit_data['renewal_emp_count'] : '' ?>" type="text" class="form-control" id="renewal_emp_count" name="renewal_emp_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="renewal_dept_count"> No of Dependents at Renewal <span
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_dept_count']) ? $lead_edit_data['renewal_dept_count'] : '' ?>" type="text" class="form-control" id="renewal_dept_count" name="renewal_dept_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields" style="display: none;">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields" style="display: none;">
|
||||
<label for="renewal_no_of_lives"> Total Lives at Renewal <span
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_no_of_lives']) ? $lead_edit_data['renewal_no_of_lives'] : '' ?>" type="text" class="form-control" id="renewal_no_of_lives" name="renewal_no_of_lives[]"
|
||||
|
||||
@ -13,25 +13,25 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="total_lives_at_incept" class="total_title">
|
||||
<span class="total_title_text"> Total Lives at Inception </span> <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['total_lives_at_incept']) ? $lead_edit_data['total_lives_at_incept'] : '' ?>" type="text" class="form-control" id="total_lives_at_incept" name="total_lives_at_incept[]" placeholder="Enter Lives" disabled>
|
||||
<input value="<?= isset($lead_edit_data['total_lives_at_incept']) ? $lead_edit_data['total_lives_at_incept'] : '' ?>" type="text" class="form-control" id="total_lives_at_incept" name="total_lives_at_incept[]" placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
||||
<label for="total_si_at_incept"> Total Sum Insured at Inception <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['total_si_at_incept']) ? $lead_edit_data['total_si_at_incept'] : '' ?>" type="text" class="form-control" id="total_si_at_incept" name="total_si_at_incept[]" placeholder="Enter Sum Insured" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
||||
<label for="premium_at_incept"> Premium at inception <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_at_incept']) ? $lead_edit_data['premium_at_incept'] : '' ?>" type="text" class="form-control" id="premium_at_incept" name="premium_at_incept[]" placeholder="Enter Premium" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
||||
<label for="renewal_emp_count"> No of Employees at Renewal <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_emp_count']) ? $lead_edit_data['renewal_emp_count'] : '' ?>" type="text" class="form-control" id="renewal_emp_count" name="renewal_emp_count[]" placeholder="Enter Lives" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 renewalFields">
|
||||
<div class="form-group col-md-4 renewalFields rolloOverFields">
|
||||
<label for="total_si_at_renewal"> Total Sum Insured at Renewal <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['total_si_at_renewal']) ? $lead_edit_data['total_si_at_renewal'] : '' ?>" type="text" class="form-control" id="total_si_at_renewal" name="total_si_at_renewal[]" placeholder="Enter Sum Insured" >
|
||||
</div>
|
||||
|
||||
@ -590,6 +590,7 @@
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
@ -676,4 +677,5 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
@ -4,6 +4,27 @@
|
||||
<form role="form" class="parsley-examples" style="color:black;" method="post" id="ticket_reply_form" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
$showApprovedStatusDropdown =
|
||||
isset($ticket_data['claim_status_id'], $ticket_data['ticket_type_id']) && (int) $ticket_data['claim_status_id'] === 10 && (int) $ticket_data['ticket_type_id'] === 1 &&
|
||||
(
|
||||
(isset($ticket_data['claim_created_by']) && $ticket_data['claim_created_by'] == 'TPA') ||
|
||||
(array_key_exists('tpa_claim_push_reference_no', $ticket_data) && $ticket_data['tpa_claim_push_reference_no'] !== null)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($showApprovedStatusDropdown): ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="status_back_option">Status</label>
|
||||
<select class="form-control" id="status_back_option">
|
||||
<option value="">Select</option>
|
||||
<option value="9">APPROVED</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Email To Field -->
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_mail_for_to">To</label>
|
||||
@ -46,10 +67,140 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.approved-letter-mode-option {
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.approved-letter-mode-option.selected {
|
||||
border-color: #0a8794;
|
||||
background-color: #f2fbfc;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="modal fade" id="approvedLetterUploadModal" tabindex="-1" role="dialog" aria-labelledby="approvedLetterUploadModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="approvedLetterUploadModalLabel">Upload Approved Letter</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="approved-letter-mode-option selected" onclick="selectApprovedLetterOption(this, 'approved_letter_mode_url')">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="approved_letter_mode" id="approved_letter_mode_url" value="url" checked>
|
||||
<label class="form-check-label" for="approved_letter_mode_url">Approved Letter URL</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="approved-letter-mode-option" onclick="selectApprovedLetterOption(this, 'approved_letter_mode_pdf')">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="approved_letter_mode" id="approved_letter_mode_pdf" value="pdf">
|
||||
<label class="form-check-label" for="approved_letter_mode_pdf">Approved Letter PDF</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="approved_letter_url_block">
|
||||
<label for="approved_letter_reply_url">Approved Letter URL</label>
|
||||
<input type="text" class="form-control" id="approved_letter_reply_url" placeholder="Enter Approved Letter URL">
|
||||
<small class="text-danger d-none" id="approved_letter_reply_url_error"></small>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0" id="approved_letter_pdf_block" style="display:none;">
|
||||
<label for="approved_letter_reply_file">Approved Letter PDF</label>
|
||||
<input type="file" class="form-control" id="approved_letter_reply_file" accept=".pdf,application/pdf">
|
||||
<small class="text-muted">Only PDF is allowed for file upload.</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="uploadApprovedLetterBtn">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
|
||||
function selectApprovedLetterOption(element, inputId) {
|
||||
$('.approved-letter-mode-option').removeClass('selected');
|
||||
$(element).addClass('selected');
|
||||
$('#' + inputId).prop('checked', true).trigger('change');
|
||||
}
|
||||
|
||||
function validateApprovedLetterPdf(fileInput) {
|
||||
const file = fileInput.files && fileInput.files[0] ? fileInput.files[0] : null;
|
||||
if (!file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const fileName = (file.name || '').toLowerCase();
|
||||
const isPdfByName = fileName.endsWith('.pdf');
|
||||
const mimeType = (file.type || '').toLowerCase();
|
||||
const isPdfByType = mimeType === '' || mimeType === 'application/pdf' || mimeType === 'application/x-pdf';
|
||||
|
||||
if (!isPdfByName || !isPdfByType) {
|
||||
fileInput.value = '';
|
||||
toastr.warning('Only PDF files are allowed for Approved Letter.', 'Warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isValidApprovedLetterUrl(urlValue) {
|
||||
const url = (urlValue || '').trim();
|
||||
if (!url) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const normalizedUrl = /^https?:\/\//i.test(url) ? url : `https://${url}`;
|
||||
const parsed = new URL(normalizedUrl);
|
||||
if (!['http:', 'https:'].includes(parsed.protocol)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const host = (parsed.hostname || '').toLowerCase();
|
||||
if (!host) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (host === 'localhost') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (/^\d{1,3}(\.\d{1,3}){3}$/.test(host)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return host.includes('.');
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function setApprovedLetterUrlError(message) {
|
||||
const $urlInput = $('#approved_letter_reply_url');
|
||||
const $errorEl = $('#approved_letter_reply_url_error');
|
||||
|
||||
if (message) {
|
||||
$urlInput.addClass('is-invalid');
|
||||
$errorEl.text(message).removeClass('d-none');
|
||||
} else {
|
||||
$urlInput.removeClass('is-invalid');
|
||||
$errorEl.text('').addClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
@ -71,6 +222,13 @@ const editorConfig = {
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
const replyTicketId = `<?= isset($ticket_data['id']) ? (int) $ticket_data['id'] : 0 ?>`;
|
||||
let replyApprovedLetter = <?= json_encode($ticket_data['approved_letter'] ?? null) ?>;
|
||||
console.log('Approved Letter from server:', replyApprovedLetter);
|
||||
|
||||
function hasApprovedLetterValue(value) {
|
||||
return value !== null && value !== undefined && String(value).trim() !== '';
|
||||
}
|
||||
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
|
||||
@ -134,6 +292,216 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
async function loadClaimTemplateForStatus(ticketId, statusId) {
|
||||
if (!ticketId || !statusId) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('/ticket/getClaimTemplateData') ?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
ticket_id: ticketId,
|
||||
status_id: statusId
|
||||
},
|
||||
success: function(res) {
|
||||
if (res && res.status && res.data) {
|
||||
if (typeof res.data.subject !== 'undefined') {
|
||||
$('#mail_subject').val(res.data.subject || '');
|
||||
}
|
||||
if (typeof res.data.message !== 'undefined') {
|
||||
editor.value = res.data.message || '';
|
||||
}
|
||||
} else {
|
||||
toastr.warning(res.message || 'Failed to load mail template', 'Warning');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('Unable to fetch mail template.', 'Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openApprovedLetterUploadModalAndHandle(ticketId, statusId) {
|
||||
const dfd = $.Deferred();
|
||||
const $modal = $('#approvedLetterUploadModal');
|
||||
const $modeUrl = $('#approved_letter_mode_url');
|
||||
const $modePdf = $('#approved_letter_mode_pdf');
|
||||
const $urlBlock = $('#approved_letter_url_block');
|
||||
const $pdfBlock = $('#approved_letter_pdf_block');
|
||||
const $urlInput = $('#approved_letter_reply_url');
|
||||
const $fileInput = $('#approved_letter_reply_file');
|
||||
const $uploadBtn = $('#uploadApprovedLetterBtn');
|
||||
const approvedLetterModalEl = document.getElementById('approvedLetterUploadModal');
|
||||
const approvedLetterModalInstance = new bootstrap.Modal(approvedLetterModalEl, {
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
});
|
||||
|
||||
$urlInput.val('');
|
||||
$fileInput.val('');
|
||||
$modeUrl.prop('checked', true).trigger('change');
|
||||
$('.approved-letter-mode-option').removeClass('selected');
|
||||
$('.approved-letter-mode-option').first().addClass('selected');
|
||||
$uploadBtn.prop('disabled', false);
|
||||
approvedLetterModalInstance.show();
|
||||
|
||||
function cleanup() {
|
||||
$uploadBtn.off('click.approvedUpload');
|
||||
$modal.off('hidden.bs.modal.approvedUpload');
|
||||
$modeUrl.off('change.approvedUpload');
|
||||
$modePdf.off('change.approvedUpload');
|
||||
}
|
||||
|
||||
$modal.on('hidden.bs.modal.approvedUpload', function() {
|
||||
cleanup();
|
||||
if (dfd.state() === 'pending') {
|
||||
dfd.reject('Upload cancelled');
|
||||
}
|
||||
});
|
||||
|
||||
$modeUrl.on('change.approvedUpload', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$urlBlock.show();
|
||||
$pdfBlock.hide();
|
||||
$fileInput.val('');
|
||||
}
|
||||
});
|
||||
|
||||
$modePdf.on('change.approvedUpload', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$pdfBlock.show();
|
||||
$urlBlock.hide();
|
||||
$urlInput.val('');
|
||||
}
|
||||
});
|
||||
|
||||
$urlInput.on('input.approvedUpload', function() {
|
||||
const currentValue = $.trim($(this).val());
|
||||
if (currentValue === '') {
|
||||
setApprovedLetterUrlError('');
|
||||
return;
|
||||
}
|
||||
if (!isValidApprovedLetterUrl(currentValue)) {
|
||||
setApprovedLetterUrlError('Approved Letter URL format is invalid.');
|
||||
} else {
|
||||
setApprovedLetterUrlError('');
|
||||
}
|
||||
});
|
||||
|
||||
$urlInput.on('blur.approvedUpload', function() {
|
||||
const currentValue = $.trim($(this).val());
|
||||
if (currentValue === '') {
|
||||
setApprovedLetterUrlError('');
|
||||
return;
|
||||
}
|
||||
if (!isValidApprovedLetterUrl(currentValue)) {
|
||||
setApprovedLetterUrlError('Approved Letter URL format is invalid.');
|
||||
} else {
|
||||
setApprovedLetterUrlError('');
|
||||
}
|
||||
});
|
||||
|
||||
$fileInput.on('change.approvedUpload', function() {
|
||||
validateApprovedLetterPdf(this);
|
||||
});
|
||||
|
||||
$uploadBtn.on('click.approvedUpload', function() {
|
||||
const selectedMode = $('input[name="approved_letter_mode"]:checked').val();
|
||||
const urlValue = $.trim($urlInput.val());
|
||||
const file = $fileInput[0].files && $fileInput[0].files[0] ? $fileInput[0].files[0] : null;
|
||||
|
||||
if (selectedMode === 'url' && !urlValue) {
|
||||
setApprovedLetterUrlError('Please enter Approved Letter URL.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedMode === 'url' && !isValidApprovedLetterUrl(urlValue)) {
|
||||
setApprovedLetterUrlError('Approved Letter URL format is invalid.');
|
||||
return;
|
||||
}
|
||||
setApprovedLetterUrlError('');
|
||||
|
||||
if (selectedMode === 'pdf' && !file) {
|
||||
toastr.warning('Please select Approved Letter PDF.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedMode === 'pdf' && file) {
|
||||
if (!validateApprovedLetterPdf($fileInput[0])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('ticket_id', ticketId);
|
||||
formData.append('status_id', statusId);
|
||||
formData.append('approved_letter', selectedMode === 'url' ? urlValue : '');
|
||||
if (selectedMode === 'pdf' && file) {
|
||||
formData.append('approved_letter_file', file);
|
||||
}
|
||||
|
||||
$uploadBtn.prop('disabled', true);
|
||||
$.ajax({
|
||||
url: '<?= base_url('/ticket/uploadApprovedLetterFromReply') ?>',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res && res.status) {
|
||||
replyApprovedLetter = (res.data && res.data.approved_letter) ? res.data.approved_letter : replyApprovedLetter;
|
||||
toastr.success(res.message || 'Approved letter uploaded successfully', 'Success');
|
||||
cleanup();
|
||||
approvedLetterModalInstance.hide();
|
||||
dfd.resolve();
|
||||
} else {
|
||||
$uploadBtn.prop('disabled', false);
|
||||
toastr.error((res && res.message) ? res.message : 'Approved letter upload failed', 'Error');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
$uploadBtn.prop('disabled', false);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('Unable to upload approved letter.', 'Error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return dfd.promise();
|
||||
}
|
||||
|
||||
function handleStatusTemplateFlow() {
|
||||
const selectedStatusId = $('#status_back_option').val();
|
||||
if (!selectedStatusId || !replyTicketId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (String(selectedStatusId) === '9' && !hasApprovedLetterValue(replyApprovedLetter)) {
|
||||
openApprovedLetterUploadModalAndHandle(replyTicketId, selectedStatusId)
|
||||
.done(function() {
|
||||
loadClaimTemplateForStatus(replyTicketId, selectedStatusId);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
loadClaimTemplateForStatus(replyTicketId, selectedStatusId);
|
||||
}
|
||||
|
||||
$('#status_back_option').on('change', function() {
|
||||
handleStatusTemplateFlow();
|
||||
});
|
||||
|
||||
if ($('#status_back_option').length && hasApprovedLetterValue(replyApprovedLetter)) {
|
||||
const selectedStatusId = $('#status_back_option').val();
|
||||
if (selectedStatusId) {
|
||||
loadClaimTemplateForStatus(replyTicketId, selectedStatusId);
|
||||
}
|
||||
}
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
|
||||
@ -144,6 +144,7 @@ $tpa_col_width_px = nhance_dt_column_widths_px($tpa_header_labels, $tpa_col_max_
|
||||
|
||||
<!-- end row -->
|
||||
<script>
|
||||
/**
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("tpa-list-table");
|
||||
if (!table) {
|
||||
@ -234,6 +235,7 @@ $tpa_col_width_px = nhance_dt_column_widths_px($tpa_header_labels, $tpa_col_max_
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
@ -757,6 +757,9 @@ div.dataTables_wrapper table.dataTable tbody td.table-action-cell .dropdown-menu
|
||||
border: 1px solid rgba(0, 0, 0, 0.12) !important;
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12) !important;
|
||||
z-index: 1080 !important;
|
||||
max-height: none !important;
|
||||
overflow-y: visible !important;
|
||||
overflow-x: visible !important;
|
||||
}
|
||||
|
||||
div.dataTables_wrapper table.dataTable tbody td.table-action-cell .dropdown-menu .dropdown-item {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user