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

This commit is contained in:
Gowtham M 2025-08-28 14:31:53 +05:30
commit 3006b172e5
24 changed files with 1362 additions and 588 deletions

View File

@ -659,4 +659,5 @@ $routes->post("ticketSave", "ThzController::ticketSave");
$routes->get("ticketList", "ThzController::ticketList");
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
// $routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType');

View File

@ -4055,10 +4055,25 @@ class ClientController extends AdminController
{
// ---------for client-----------------------------------------------------------------------------
$role_id = get_role_id();
$user_id = get_session_userid();
if ($role_id == 2 || $role_id == 3) {
$clients = $this->clientModel
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
->where('is_active', 1)
->findAll();
->select("clients.*, DATE_FORMAT(clients.dob, '%d-%m-%Y') as dob")
->join('client_rm', 'client_rm.client_id = clients.id')
->where('client_rm.user_id', $user_id)
->where('clients.is_active', 1)
->findAll();
} else {
$clients = $this->clientModel
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
->where('is_active', 1)
->findAll();
}
$clientIds = array_column($clients, 'id');
@ -5064,6 +5079,10 @@ class ClientController extends AdminController
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']);
// dd( $res);
// $EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1056']);
// dd($res);
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
$policyTransactionController = new PolicyTransactionController();
@ -5181,6 +5200,7 @@ class ClientController extends AdminController
// $data['data'] = $BDSReportController->getBAPClientData();
// return $this->loadLayout('irda_bap_client_report_list', $data);
// $data['data'] = $BDSReportController->getClientData(1);
// return $this->loadLayout('irda_client_report_list', $data);

View File

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

View File

@ -3902,7 +3902,9 @@ class EmployeeRestController extends AdminController
$filePath = $uploadPath . $record[0]['file_name'];
if (!file_exists($filePath)) {
return $this->failNotFound("File not found on server");
// return $this->failNotFound("File not found on server");
$data['message'] = 'The Physical File Not Found';
return view('errors/404', $data);
}
// Force file download
@ -3960,11 +3962,46 @@ class EmployeeRestController extends AdminController
$request = service('request');
// Start builder from model
// $builder = $this->hrFileUploadModel
// ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name')
// ->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
// ->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
// ->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left');
$builder = $this->hrFileUploadModel
->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name')
->select('
hr_file_upload.id,
hr_file_upload.client_id,
hr_file_upload.client_branch_id,
hr_file_upload.policy_id,
hr_file_upload.policy_no,
hr_file_upload.file_name,
hr_file_upload.file_action,
hr_file_upload.created_at,
hr_file_upload.created_by,
hr_file_upload.updated_at,
hr_file_upload.updated_by,
c.short_name,
cb.branch_name,
lc.name as first_name,
CASE
WHEN f.status IS NULL
THEN hr_file_upload.status
ELSE CONCAT(UCASE(LEFT(f.status, 1)), LCASE(SUBSTRING(f.status, 2)))
END AS status
', false)
->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left');
->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left')
->join(
'(SELECT f1.*
FROM files f1
WHERE f1.is_active = 1
ORDER BY f1.id DESC
LIMIT 1) f',
'f.hr_file_id = hr_file_upload.id',
'left'
);
// Allowed filter keys
$filters = [

View File

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

View File

@ -13,6 +13,7 @@ use App\Models\UserModel;
use App\Models\ClientPolicyModel;
use App\Models\ClientModel;
use App\Models\TicketMailTemplateModel;
// use App\Models\TicketTypesModel;
class ThzController extends BaseController
@ -28,6 +29,7 @@ class ThzController extends BaseController
protected $clientModel;
protected $ticketMailTemplateModel;
// protected $ticketTypesModel;
public function __construct()
{
@ -81,6 +83,9 @@ class ThzController extends BaseController
$data = $this->request->getGet();
if ($returnType === 'web' && in_array(get_role_id(), [2,3,4])) {
$data['assign_to'] = $data['assign_to'] ?? get_session_userid();
}
$tickets = $this->fetchTicketsBasedOnrole($data);
@ -91,7 +96,7 @@ class ThzController extends BaseController
}
}else{
$data['page_name'] = "Ticket List";
$data['page_name'] = "Tickets";
$data['ticket_data'] = $tickets;
$data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
@ -196,24 +201,70 @@ class ThzController extends BaseController
if ($returnType === 'api') {
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
}else{
$toGetCreatedBy = $result['master'][0]['created_by'];
$assign_to = $result['master'][0]['assign_to'];
$mobile = $result['master'][0]['mobile'];
$toGetPolicyId = (!empty($result['master'][0]['policy_id']) && strtolower($result['master'][0]['policy_id']) !== 'null')
? $result['master'][0]['policy_id']
: '';
$result['related_tickets'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.created_by', $toGetCreatedBy)
->findAll();
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to)
->where('thz_master.mobile',$mobile)
->where('thz_master.thz_id !=',$thz_id)
->where('thz_master.status !=','Closed')
->where('thz_master.status !=','Resolved')
->findAll();
$result['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
return $this->loadLayout('thz_notes', $result);
}
}
// public function ticketType()
// {
// $method = $this->request->getMethod(); // get, post
// if ($method === 'get') {
// $types = $this->ticketTypesModel->where('is_active', 1)->findAll();
// if (empty($types)) {
// return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404);
// }
// return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200);
// }
// if ($method === 'post') {
// $data = $this->request->getPost();
// if (!empty($data['id'])) {
// $text = "update";
// $result = $this->ticketTypesModel->update($data['id'], $data);
// $updateID = $data['id'];
// } else {
// $text = "create";
// $insertID = $this->ticketTypesModel->insert($data);
// $result = true;
// }
// $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ;
// return $this->response->setJSON([
// 'status' => $id ? 'success' : 'error',
// 'message' => $id ? "Ticket Type {$text}d successfully " : "Unable to {$text} ticket type. Please try again." ,
// 'id' => $id
// ])->setStatusCode($id ? 200 : 400);
// }
// return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404);
// }
/************************************************** PRIVATE FUNCTIONS ********************************************************/

View File

@ -2469,6 +2469,7 @@ class TicketController extends BaseController
')
->join('user_profiles as up', 'claim_dump_files.created_by = up.id', 'left')
->where('claim_dump_files.is_active', 1)
->orderBy('claim_dump_files.id', 'desc')
->findAll();
return $this->loadLayout('claim_dump_file_list', $data);

View File

@ -720,16 +720,16 @@ class TicketServiceController extends BaseController
'col_name' => 'Emp. Mobile',
'is_mandatory' => false,
'data_type' => 'string',
'format' => 'phone',
'format' => null,
'allowed_values' => null
],
"emp_email" => [
'col_idx' => 14,
'col_cell_name' => 'O',
'col_name' => 'Emp mail id',
'is_mandatory' => false,
'is_mandatory' => true,
'data_type' => 'string',
'format' => 'email',
'format' => null,
'allowed_values' => null
],
"claim_collection" => [
@ -774,7 +774,7 @@ class TicketServiceController extends BaseController
'col_name' => 'DOA',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"dod" => [
@ -783,7 +783,7 @@ class TicketServiceController extends BaseController
'col_name' => 'DOD',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"claim_amount" => [
@ -801,7 +801,7 @@ class TicketServiceController extends BaseController
'col_name' => 'Date of Claim Receipt',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"date_claim_registration" => [
@ -810,7 +810,7 @@ class TicketServiceController extends BaseController
'col_name' => 'Date of Claim Registration',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"date_latest_query_raise" => [
@ -819,7 +819,7 @@ class TicketServiceController extends BaseController
'col_name' => 'Date - Latest Query Raise',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"date_latest_query_resolution" => [
@ -828,7 +828,7 @@ class TicketServiceController extends BaseController
'col_name' => 'Date - Latest Query Resolution',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"approved_amt" => [
@ -846,7 +846,7 @@ class TicketServiceController extends BaseController
'col_name' => 'Date of Approval',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"utr_settlement" => [
@ -864,7 +864,7 @@ class TicketServiceController extends BaseController
'col_name' => 'Date of Settlement',
'is_mandatory' => false,
'data_type' => 'date',
'format' => 'm/d/Y',
'format' => 'd/m/Y',
'allowed_values' => null
],
"reason" => [
@ -976,11 +976,12 @@ class TicketServiceController extends BaseController
$columns_to_check = $excel_data_and_headers['claim_dump_excel_columns'];
// dd($columns_to_check);
$client_data = $this->clientModel->where('is_active', 1)->where('client_type', 1)->findAll();
$insurer_data = $this->insurerModel->where('is_active', 1)->findAll();
$tpa_data = $this->TPAModel->where('is_active', 1)->findAll();
$claim_status_data = $this->ticketClaimStatusModel->select('id, claim_status')->where('is_active', 1)->orderBy('id', 'asc')->groupBy('claim_status')->findAll();
//if upload the unwanted file upload handle
if(count($columns_to_check) == 0){
$message = "Wrong file was uploaded";
$this->claimDumpFileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
return array('error_summary' => [5], 'error_data' => $message);
}
//Store the error data by this structure
$result = ['error_type' => 1, 'error_summary' => [], 'error_data' => []];
@ -988,6 +989,7 @@ class TicketServiceController extends BaseController
//excel data is empty than through the error
if(count($excel_data ?? []) <= 1){
$message = "Uploaded file is empty";
$this->claimDumpFileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
return array('error_summary' => [5], 'error_data' => $message);
}
@ -1007,6 +1009,11 @@ class TicketServiceController extends BaseController
return array('error_summary' => [6], 'error_data' => $message);
}
$client_data = $this->clientModel->where('is_active', 1)->where('client_type', 1)->findAll();
$insurer_data = $this->insurerModel->where('is_active', 1)->findAll();
$tpa_data = $this->TPAModel->where('is_active', 1)->findAll();
$claim_status_data = $this->ticketClaimStatusModel->select('id, claim_status')->where('is_active', 1)->orderBy('id', 'asc')->groupBy('claim_status')->findAll();
//remove header
unset($excel_data[0]);
@ -1178,7 +1185,7 @@ class TicketServiceController extends BaseController
$columns_to_check = $excel_data_and_headers['claim_dump_excel_columns'];
// dd($columns_to_check);
$result = ['error_type' => 2, 'error_summary' => [], 'error_data' => []];
$result = ['error_type' => 1, 'error_summary' => [], 'error_data' => []];
//remove header
unset($excel_data[0]);
@ -1206,17 +1213,26 @@ class TicketServiceController extends BaseController
//excel file Account Manager Details like Name and Mobile Number
$excel_acm_data = $row[$acm_column_index] ?? null;
// var_dump($excel_acm_data); die;
$acm_name = null;
$acm_mobile = null;
//seperate the Account Manager Name and Mobile No
if (!empty($excel_acm_data)) {
$excel_acm_data = str_replace(['', '—'], '-', $excel_acm_data);
$parts = array_map('trim', explode('-', $excel_acm_data, 2));
$acm_name = $parts[0] ?? null;
$acm_mobile = $parts[1] ?? null;
// ensure mobile number is digits only
if ($acm_mobile !== null) {
$acm_mobile = preg_replace('/\D/', '', $acm_mobile);
}
}
// dd($acm_name, $acm_mobile);
$params = [
'client_name' => $row[$client_column_index] ?? null,
'policy_no' => $row[$policy_no_column_index] ?? null,
@ -1274,9 +1290,9 @@ class TicketServiceController extends BaseController
// dd($acm_data);
if (count($acm_data) == 0) {
array_push($result['error_summary'], 10);
$result['error_data'][$row_key][$emp_name_column_index]['col_name'] = $columns_to_check['employee_name']['col_name']; //push column name
$result['error_data'][$row_key][$emp_name_column_index]['col_idx'] = $emp_name_column_index; //push column index
$result['error_data'][$row_key][$emp_name_column_index]['error'][] = "This Acount Manager not exist in the system";
$result['error_data'][$row_key][$acm_column_index]['col_name'] = $columns_to_check['acm']['col_name']; //push column name
$result['error_data'][$row_key][$acm_column_index]['col_idx'] = $acm_column_index; //push column index
$result['error_data'][$row_key][$acm_column_index]['error'][] = "This Acount Manager not exist in the system";
}
}
@ -1455,7 +1471,8 @@ class TicketServiceController extends BaseController
$header_with_column_index = $this->getTheColumnIndex($excel_data[0], $this->actualHeaders, $returnType);
//Sanitize the excel data
// $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
$excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
// dd($excel_data);
$data = [
'claim_dump_excel_columns' => $header_with_column_index,
@ -1499,7 +1516,8 @@ class TicketServiceController extends BaseController
}
private function constructClaimData($excel_data, $db_data, $columns_to_check)
{
{
// dd($db_data);
$client_column_index = $columns_to_check['corporate']['col_idx'];
$policy_no_column_index = $columns_to_check['policy_no']['col_idx'];
$insurer_column_index = $columns_to_check['insurer']['col_idx'];
@ -1591,15 +1609,18 @@ class TicketServiceController extends BaseController
//get the acountmanager data
$acm_data = $ticketMasterModal->getAcmUserDetails($params) ?? [];
// dd($acm_data);
//get the claim status id from the database
$claim_status_data = $this->ticketClaimStatusModel
->select('id, claim_status')
->select('id, claim_status, ticket_type')
->where('is_active', 1)
->where('ticket_type', $db_data['ticket_type_id'])
->where('LOWER(claim_status)', strtolower($excel_status_data))
->first();
// dd($claim_status_data);
$claim_status_id = $claim_status_data['id'] ?? null;
//initialize Ticket controller for the other data
@ -1618,9 +1639,10 @@ class TicketServiceController extends BaseController
}
}
$db_data['insured_name'] = $db_data['insured_emp_id'] ?? null;
$db_data['insured_name'] = $excel_data[$insured_name_column_index] ?? null;
//get Insured emp name and Insured emp id
$insured_data = $ticketMasterModal->getInsuredDetails($db_data);
// dd($insured_data);
//handle remarks based on the status
$return_remarks = null;
@ -1639,15 +1661,15 @@ class TicketServiceController extends BaseController
'claim_status_id' => $claim_status_id ?? null,
'acm_id' => $acm_data['id'] ?? null,
'insurer_id' => $db_data['insurer_id'] ?? null,
'tpa_id' => $excel_tpa_id_data ?? $db_data['tpa_id'] ?? null,
'tpa_id' => $db_data['tpa_id'] ?? null,
'client_id' => $db_data['client_id'] ?? null,
'emp_id' => $db_data['emp_id'] ?? null,
'client_policy_id' => $db_data['client_policy_id'] ?? null,
'policy_no' => $db_data['policy_no'] ?? null,
'emp_code' => $db_data['emp_code'] ?? null,
'tpa_no' => $db_data['tpa_no'] ?? null,
'tpa_no' => $excel_tpa_id_data ?? $db_data['tpa_no'] ?? null,
'emp_name' => $db_data['emp_name'] ?? null,
'relationship' => $excel_relationship_data ?? null,
'relationship' => strtolower($excel_relationship_data) ?? null,
'emp_mobile' => $excel_emp_mobile_data ?? $db_data['emp_mobile'] ?? null,
'emp_mail' => $excel_emp_email_data ?? $db_data['emp_mail'] ?? null,
@ -1655,7 +1677,7 @@ class TicketServiceController extends BaseController
'claim_type' => $cliam_type_id ?? null,
'insured_emp_id' => $insured_data['emp_id'] ?? null,
'insured_name' => $insured_data['name'] ?? $db_data['insured_emp_id'] ?? null,
'insured_name' => $insured_data['name'] ?? $excel_data[$insured_name_column_index] ?? null,
'hospital_name' => $excel_hospital_data ?? null,
'claim_amount' => $excel_claim_amount_data ?? null,
@ -1693,6 +1715,7 @@ class TicketServiceController extends BaseController
'approved_description' => null
];
// dd($ticketMaster);
return $ticketMaster;
}

View File

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

View File

@ -43,7 +43,7 @@ class ThzMasterModel extends Model
public function ticketAutoFetchDetails($client_id ,$mobile){
$result = $this->db->table('employees e')
->select('e.id, e.email_personal, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
->select('e.id, e.email_personal,e.email_corporate, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.is_active = 1', 'left')
->whereIn('e.emp_status', ['active', 'draft', 'enrolled'])
->where('e.is_active', 1)

View File

@ -1059,10 +1059,10 @@ class TicketMasterModel extends Model
$relationship = $params['relationship'] ?? null;
$insured_name = $params['insured_name'] ?? null;
$client_name = "6-Eleven";
$emp_code = "EMP0020K12";
$emp_name = "Lokesh";
$policy_no = "GMC-1999/2000/2021/2022";
// $client_name = "6-Eleven";
// $emp_code = "EMP0020K12";
// $emp_name = "Lokesh";
// $policy_no = "GMC-1999/2000/2021/2022";
$builder = $this->db->table('employees e');
@ -1106,7 +1106,7 @@ class TicketMasterModel extends Model
$builder->where('LOWER(e.relationship)', strtolower('self'));
$query = $builder->get();
$result = $query->getResultArray();
$result = $query->getRowArray();
return $result;
}
@ -1123,7 +1123,7 @@ class TicketMasterModel extends Model
$builder->where('user_profiles.is_active', 1);
$builder->where('user_profiles.mobile', trim($acm_mobile));
$query = $builder->get();
$result = $query->getResultArray();
$result = $query->getRowArray();
return $result;
}
@ -1161,8 +1161,8 @@ class TicketMasterModel extends Model
$builder->where('ep.client_policy_id', trim($policy_id));
$query = $builder->get();
$result = $query->getResultArray();
$result = $query->getRowArray();
// dd($this->db->getLastQuery());
return $result;
}

View File

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

View File

@ -1,10 +1,29 @@
<style>
.reload:hover {
cursor: pointer;
}
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.addbtnStyle{
margin-left: 20px !important;
}
.dataTables_filter {
position: absolute;
}
</style>
<div class="row">
<!-- <div class="row">
<div class="col-xl-12" style="margin-left: 14px;max-width: 98%;">
<div id="accordion1" class="mb-3">
<div class="card mb-1">
@ -21,7 +40,6 @@
<div class="form-row" id="file_upload">
<div class="form-group col-md-4">
<label>Upload file</label>
<!-- &nbsp;[ <a href="#" id="excel_download" data-toggle="tooltip" data-placement="top" title="Download Sample Excel">Sample Excel</a> ] -->
<input type="file" name="claim_dump_list" id="claim_dump_list" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
</div>
<div class="d-flex align-items-center justify-content-start">
@ -39,7 +57,7 @@
</div>
</div>
</div>
</div>
</div> -->
<div class="col-12">
<div class="card">
@ -121,6 +139,34 @@
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Center modal content for upload file-->
<div class="modal fade" id="claim-file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">Claim Dump Upload</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="claim-upload-form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="file_upload">
<div class="form-group col-md-9">
<label>Upload file</label>
<!-- &nbsp;[ <a href="#" id="excel_download" data-toggle="tooltip" data-placement="top" title="Download Sample Excel">Sample Excel</a> ] -->
<input type="file" name="claim_dump_list" id="claim_dump_list" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
</div>
<div class="form-group col-md-3" style="margin-top: 18px;">
<button id="claim_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function() {
@ -176,6 +222,7 @@
// Reset form
$('#claim-upload-form')[0].reset();
$('.close').click();
window.location.reload();
},
@ -225,6 +272,38 @@
});
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#tickets-table');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
text: 'Add',
className: 'buttons-html5 addbtnStyle',
action: function (e, dt, node, config) {
openDumpUploadModal();
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 15, // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
function fetchFileError(file_id) {
var url = '<?php echo base_url('util/getClaimDumpFileErrorData/'); ?>';
@ -326,5 +405,11 @@
let html = `<div class="spinner-border text-primary" role="status" style="position: relative; left: 200px;"></div>`
$('#modal_body').append(html);
});
function openDumpUploadModal() {
var myModal = new bootstrap.Modal(document.getElementById('claim-file-upload-modal'));
myModal.show();
}
</script>

View File

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

View File

@ -55,7 +55,9 @@
<?php
if (isset($events) && count($events)) {
foreach ($events as $key => $action) {
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
if($key != "inception"){
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
}
}
}
?>
@ -143,19 +145,35 @@
<!-- end row -->
</div>
<!-- Center modal content for reupload file-->
<div class="modal fade" id="hr-file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">Endorsement Upload</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="hrUploadForm" enctype="multipart/form-data">
<input type="hidden" id="hr_file_client_id" name="client_id">
<input type="hidden" id="hr_file_policy_id" name="policy_id">
<input type="hidden" id="hr_file_branch_id" name="branch_id">
<input type="hidden" id="hr_file_hr_file_id" name="hr_file_id">
<input type="hidden" id="hr_file_upload_actions" name="upload-action-type">
<input type="file" id="fileInput" name="emplist" required
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
var branch_policy = '';
$(document).ready(function(){
//initialize the get client, branch, and policy
getClientAndBranchAndPolicy();
//client change to get the Client Branch
$('#client2').change(function(){
let client_id = $(this).val();
@ -217,18 +235,18 @@
<td>${file.short_name ?? ""}</td>
<td>${file.branch_name ?? ""}</td>
<td>${file.policy_no ?? ""}</td>
<td>${file.file_action ?? ""}</td>
<td>${formatTextToCamelCase(file.file_action) ?? ""}</td>
<td>${file.created_at} by <strong>${file.first_name ?? ""}</strong></td>
<td>${file.status}</td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="${baseurl}/hrFileDownload?id=${file.id}" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<a href="${baseurl}/hrFileDownload?id=${file.id}" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<a class="dropdown-item" onclick="uploadEndorsementFile(${file.client_id}, ${file.client_branch_id}, ${file.policy_id}, ${file.id}, '${file.file_action}')" style="color: #000;" aria-hidden="true"><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Initiate Endorsement</a>
</div>
</div>
@ -252,36 +270,6 @@
});
});
//featch client and branch and policy
function getClientAndBranchAndPolicy()
{
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if(res.status == true){
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
vehicle_list = res.vehicle_data;
unit_list = res.unit_data;
appendClients3(res.client_data);
}else{
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
// ------------ Append Functions are Below ----------------------------------------------------------------------------------
function appendClients3(data)
@ -332,10 +320,7 @@
}
function appendPolicy3(data)
{
console.log('policy2', data);
console.log('policy2', $('#policy2'));
{
$('#policy2').empty();
$('#policy2').append($('<option>', {
value: '',
@ -344,7 +329,7 @@
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.policy_id,
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#policy2').append(option);
@ -353,7 +338,7 @@
// ----------------------------------------------------------------------------------------------
// for datatable
$(document).ready(function() {
$('#hr_tickets_table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
@ -382,4 +367,85 @@
});
});
//for initialize the file upload for the files table
function uploadEndorsementFile(client_id, branch_id, policy_id, file_id, event){
console.log(client_id, branch_id, policy_id, file_id, event);
$('#hr_file_client_id').val(client_id);
$('#hr_file_branch_id').val(branch_id);
$('#hr_file_policy_id').val(policy_id);
$('#hr_file_upload_actions').val(event);
$('#hr_file_hr_file_id').val(file_id);
var myModal = new bootstrap.Modal(document.getElementById('hr-file-upload-modal'));
myModal.show();
}
//hr file upload reupload to the files table
$('#hrUploadForm').submit(function(e) {
e.preventDefault();
var isValid = $('#hrUploadForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return;
}
// Create FormData object
var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]);
}
// return false;
$.ajax({
url: `<?= base_url('employee/upload') ?>`,
type: "POST",
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Let jQuery handle the content type
headers: {
// "Content-Type":"multipart/form-data",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
$('#hrUploadForm')[0].reset();
if (response.code === 200 && response.dataStatus === true && response
.data !== "") {
toastr.success(
'File upload successs, Data validation is in-progress',
'success');
$('.close').click()
window.location.reload(true);
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
// alert(response.message);
toastr.error(response.message, 'Failed');
window.location.reload(true);
} else {
console.error('Something went wrong!');
// alert('Something went wrong! Try later');
toastr.error('Something went wrong! Try later', 'Error');
window.location.reload(true);
}
$('.close').click();
},
error: function(xhr, status, error) {
// Request failed, handle error
console.error("Request failed:", status, error);
toastr.error('Something went wrong! Try later', 'Error');
$('#hrUploadForm')[0].reset();
$('.close').click();
window.location.reload(true);
}
});
})
</script>

View File

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

View File

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

View File

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

View File

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

View File

@ -652,9 +652,9 @@ $(document).ready(function(){
if(res.status == true){
if(res.data.length > 0){
$('#ct_type').val(2)
$('#cd_ac_pk').val(res.is_copay_yes.cd_ac_pk);
$('#cd_ac_no').val(res.cd_master_data.cd_ac_no ?? "");
$('#ct_type').val(2);
$('#cd_ac_pk').val(res?.is_copay_yes?.cd_ac_pk || "");
$('#cd_ac_no').val(res?.cd_master_data?.cd_ac_no || "");
$('#bro_payable_by').val(res.data[0].bro_payable_by);
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){

View File

@ -3975,14 +3975,6 @@ $('#policy_no').change(function(){
toastr.warning(res.message,'WARNING');
$('#policy_no').val("");
return;
}
if(res.status == true){
$('#ct_type').val(1);
$('#client_policy_id').val(res.data.id);
$('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date);
$('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
}else{
$('#ct_type').val(2);
$('#client_policy_id').val('');
@ -3991,6 +3983,14 @@ $('#policy_no').change(function(){
$('#tpa').val('').select2();
console.log(res.message, 'warning');
}
// if(res.status == true){
// $('#ct_type').val(1);
// $('#client_policy_id').val(res.data.id);
// $('#policy_start_date').val(res.data.policy_start_date);
// $('#policy_end_date').val(res.data.policy_end_date);
// $('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
// }
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
@ -3999,12 +3999,12 @@ $('#policy_no').change(function(){
});
}else{
$('#ct_type').val(2)
$('#ct_type').val(2);
$('#client_policy_id').val();
$('#policy_start_date').val();
$('#policy_end_date').val();
$('#tpa').val('').select2();
console.log("Could not get policy data")
console.log("This is new policy Could not get policy data")
}
});

View File

@ -73,8 +73,8 @@ tbody tr td:last-child {
/* Optional: control first column width */
.table th:nth-child(1),
.table td:nth-child(1) {
max-width: 200px !important;
min-width: 100px !important;
max-width: 50px !important;
min-width: 50px !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
@ -104,6 +104,14 @@ tbody tr td:last-child {
text-align: right;
}
.text-custom {
font-weight: 400;
font-style: normal;
font-size: 11px;
line-height: 1.44;
letter-spacing: -0.02em;
}
</style>
<style>
/* .table th:nth-child(1),
@ -116,10 +124,119 @@ tbody tr td:last-child {
} */
td .text-muted {
font-size: 0.85em; /* smaller than default */
color: #6c757d !important; /* Bootstrap muted grey */
.text-custom-black{
color: #000000 !important;
}
.text-custom-grey{
font-size: 0.85em;
color: #6c757d !important;
}
table.dataTable td.wrap {
white-space: normal !important;
word-break: break-word;
}
table thead th {
text-align: center;
vertical-align: middle;
}
.btn-custom {
font-weight: 500;
font-style: normal;
font-size: 12px;
line-height: 1;
letter-spacing: 0;
text-align: center;
}
.table-custom th {
font-family: 'Poppins', sans-serif !important;
font-weight: 700;
font-style: normal;
font-size: 13px;
line-height: 1.44;
letter-spacing: -0.02em;
text-align: center;
color: #000;
padding: 10px 12px;
}
/* Remove borders from all pagination buttons */
/* Pagination (p) */
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .paginate_button:active,
.dataTables_wrapper .dataTables_paginate .paginate_button:focus,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
padding: 2px 6px !important;
font-size: 12px !important;
background: transparent !important;
border-radius: 13px !important;
border: none !important;
}
.dataTables_wrapper .dataTables_paginate .page-item.previous .page-link,
.dataTables_wrapper .dataTables_paginate .page-item.next .page-link {
/* box-shadow: 0 0 0 0.15rem rgba(0,153,158,0.5) !important;
background: rgba(0,153,158,0.8) !important;*/
border-radius: 13px !important;
background-color: #F5FFFF;
border: none !important;
box-shadow: 0 0 0 0.15rem #F5FFFF;
}
/* Active page number */
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
color: #fff !important;
border-radius: 13px !important;
}
/* Inactive (not active) page numbers */
.dataTables_wrapper .dataTables_paginate .page-item:not(.active) .page-link {
border: 1px solid #fff !important;
border-radius: 13px !important;
}
/* Info text (i) */
.dataTables_info {
font-size: 12px;
}
.form-control {
background-color: #ECECEC !important;
border: 1px solid #ccc; /* optional */
color: #000; /* keep text readable */
}
.form-control:focus {
background-color: #ECECEC !important; /* keep same color on focus */
box-shadow: none; /* remove blue glow */
}
/* Select2 box */
.select2-container .select2-selection--single {
background-color: #ECECEC !important;
border: 1px solid #ccc !important;
height: 38px !important;
}
/* Text inside */
.select2-container .select2-selection__rendered {
color: #000 !important;
line-height: 36px !important;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
background-color: #ECECEC !important;
}
</style>
@ -128,23 +245,22 @@ td .text-muted {
<div class="col-12">
<div class="card">
<div class="card-body maincard">
<div class="row" style="padding-bottom: 10px;" >
<div class="row">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Ticket List </h4>
<p class="title-text app-font-family" style="position: relative;">Tickets </p>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<div>
<table id="scroll-horizontal-datatable" class="table w-100 nowrap text-custom-black text-custom app-font-family">
<thead>
<tr>
<th>Ticket No</th>
<th>Name</th>
<th>Ticket ID</th>
<th class="app-text-left">Name</th>
<th>Policy Number</th>
<th>Ticket Type</th>
<th>Subject</th>
<th>Status</th>
<th>Assign To</th>
<th class="app-text-left">Assign To</th>
<th>Created At</th>
<th>Updated At</th>
</tr>
@ -154,31 +270,38 @@ td .text-muted {
<?php foreach($ticket_data as $index => $row){ ?>
<tr data-id="<?= $row['thz_id']; ?>" style="cursor: pointer;">
<td><?php echo $row['thz_id']; ?></td>
<td>
<td class="app-text-right"><?php echo $row['thz_id']; ?></td>
<td class="app-text-left">
<?php echo $row['name']; ?>
<span class="text-muted"><?php if (!empty($row['empcode'])): echo '('.$row['empcode'].')'; endif; ?></span><br>
<span class="text-muted"><?php if (!empty($row['mobile'])): echo $row['mobile']; endif; ?></span>
<span class="text-custom-grey"><?php if (!empty($row['empcode'])): echo '('.$row['empcode'].')'; endif; ?></span><br>
<span class="text-custom-grey"><?php if (!empty($row['mobile'])): echo $row['mobile']; endif; ?></span>
</td>
<td><?php echo (!empty($row['policy_no']) && strtolower($row['policy_no']) !== 'null')
<td class="app-text-center"><?php echo (!empty($row['policy_no']) && strtolower($row['policy_no']) !== 'null')
? $row['policy_no']
: 'N/A'; ?>
</td>
<td><?php echo $row['ticket_type']; ?></td>
<td><?php echo $row['subject']; ?></td>
<td><?php echo $row['status']; ?></td>
<td><?php echo $row['assignee_name']; ?></td>
<td>
<td class="app-text-center"><?php echo $row['ticket_type'] ? $row['ticket_type'] : '-'; ?></td>
<td class="app-text-center wrap" title="<?php echo htmlspecialchars($row['subject']); ?>">
<?php
$subject = $row['subject'] ? $row['subject'] : 'N/A';
echo (strlen($subject) > 50)
? htmlspecialchars(substr($subject, 0, 50)) . "..."
: htmlspecialchars($subject);
?>
</td>
<td class="app-text-center"><?php echo $row['status'] ? $row['status'] : '-' ; ?></td>
<td class="app-text-left"><?php echo $row['assignee_name'] ? $row['assignee_name'] : '-'; ?></td>
<td class="app-text-left">
<?php if (!empty($row['created_at'])):
$cdt = new DateTime($row['created_at']);
echo $cdt->format('d/m/Y') . "<br><span class='time'>" . $cdt->format('h:i a') . "</span>";
echo $cdt->format('d/m/Y') . "<br><span class='time'> " . $cdt->format('h:i a') . "</span>";
endif;
?>
</td>
<td>
<td class="app-text-left">
<?php if (!empty($row['updated_at'])):
$udt = new DateTime($row['updated_at']);
echo $udt->format('d/m/Y') . "<br><span class='time'>" . $udt->format('h:i a') . "</span>";
echo $udt->format('d/m/Y') . "<br><span class='time'> " . $udt->format('h:i a') . "</span>";
endif;
?>
</td>
@ -195,7 +318,7 @@ td .text-muted {
</div>
</div>
<div class="modal fade" id="ticketModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade app-font-family" id="ticketModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" style="margin:5px auto!important;">
<div class="modal-content">
<form id="ticketForm">
@ -207,15 +330,15 @@ td .text-muted {
<!-- first row -->
<div class="d-flex w-100 justify-content-between align-items-center">
<h4 class="modal-title mb-0" id="modalLabel">New Ticket</h4>
<h4 class="modal-title app-font-family mb-0" id="modalLabel" style="font-size:27px !important">New Ticket</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<!-- second row -->
<div class="form-row mt-3 w-100">
<div class="form-group col-md-6">
<div class="form-group col-md-6 app-font-family">
<label for="client_id">Client</label>
<select class="form-control" id="client_id" name="client_id">
<select class="form-control app-field-grey" id="client_id" name="client_id">
<option value="">Select Client</option>
<?php if(isset($client_list)) { ?>
<?php foreach ($client_list as $c) { ?>
@ -225,22 +348,21 @@ td .text-muted {
</select>
</div>
<div class="form-group col-md-5">
<div class="form-group col-md-5 app-font-family">
<label for="mobile">Mobile<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile"
name="mobile" placeholder="Enter Mobile"
pattern="^[0-9]{10}$" required
<input type="text" class="form-control app-field-grey" id="mobile" placeholder="Enter Mobile Number"
name="mobile"
pattern="^[0-9]{10}$" required maxlength="10"
title="Please enter a valid 10-digit mobile number">
</div>
<div class="form-group col-md-1" style="padding:27.5px 0 0 0;">
<button type="button" class="btn btn-primary" style="padding: 0 10px !important; border-radius:13px;" onclick="getAutoFetchDetails()"><i class="mdi mdi-cached" style="font-size:24px; color:#fff !important;"></i></button>
<div class="form-group col-md-1" style="padding:32.5px 0 0 18px;">
<button type="button" class="btn-custom app-btn-primary app-font-family" style="padding: 0 10px !important; border-radius:13px;" onclick="getAutoFetchDetails()"><i class="mdi mdi-cached app-text-white" style="font-size:24px;"></i></button>
</div>
</div>
</div>
<div class="modal-body" style="padding-top: 15px !important;
padding-bottom: 10px !important;">
<div class="modal-body" style="padding: 12px 15px 0px 15px !important;">
<div class="form-row">
<input type="hidden" id="thz_id" name="thz_id">
<input type="hidden" id="return_type" name="return_type">
@ -248,12 +370,12 @@ td .text-muted {
<input type="hidden" id="policy_id" name="policy_id">
<input type="hidden" id="created_by" name="created_by" value="<?= get_session_userid(); ?>">
<div class="form-group col-md-4">
<div class="form-group col-md-4 app-font-family">
<label for="name">Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" name="name" placeholder="Enter Name" required>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-4 app-font-family">
<label for="email">Email Id<span class="text-danger">*</span></label>
<input type="email" class="form-control" id="email"
name="email" placeholder="Enter Email"
@ -262,22 +384,23 @@ td .text-muted {
title="Please enter a valid email address">
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-4 app-font-family">
<label for="empcode">Employee code</label>
<input type="text" class="form-control" id="empcode" name="empcode" placeholder="Enter Employee code">
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-4 app-font-family">
<label for="ticket_type">Ticket Type<span class="text-danger">*</span></label>
<select class="form-control" id="ticket_type" name="ticket_type" required onchange="hideandshowpolicy()">
<option value="">Select Ticket Type</option>
<option value="Sales" selected >Sales</option>
<option value="Service">Service</option>
<!-- <option value="0">+ Add New</option> -->
</select>
</div>
<div class="form-group col-md-4" id="policy_container">
<div class="form-group col-md-4 app-font-family" id="policy_container">
<label for="policy_no">Policy Number</label>
<select class="form-control" id="policy_no" name="policy_no" onchange="changevalue()">
<option value="" selected data-id="">Select Policy</option>
@ -298,36 +421,50 @@ td .text-muted {
<!-- // enga 5-"head" and 1-"admin" assign pannvaga dropdown-data la varakudhathu. but dropdown display aganum
// 2,3,4 dropdown data'va varannum but dropdown hide pannanum -->
<?php if(in_array(get_role_id(), [1,5]) ) { ?>
<?php if (in_array(get_role_id(), [1,5])): ?>
<div class="form-group col-md-4">
<label for="assign_to">Assign To</label>
<select class="form-control" id="assign_to" name="assign_to">
<option value="">Select Assign To</option>
<?php if(isset($assignee)) { ?>
<?php foreach ($assignee as $a) { ?>
<option value="<?= $a['id']?>"><?= $a['emp_code'] ?> - <?= $a['first_name'] ?> <?= $a['last_name'] ?></option>
<?php } ?>
<?php } ?>
<?php if (!empty($assignee)): ?>
<?php foreach ($assignee as $a): ?>
<option value="<?= esc($a['id']) ?>">
<?= esc($a['emp_code']) ?> - <?= esc($a['first_name']) ?> <?= esc($a['last_name']) ?>
</option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
<?php } ?>
<?php else: ?>
<input type="hidden" id="hide_assign_to" name="assign_to" value="<?= esc(get_session_userid()); ?>">
<?php endif; ?>
<div class="form-group col-md-12">
<!-- <div class="form-group col-md-12 app-font-family">
<label for="subject">Subject<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="subject" name="subject" placeholder="Enter Subject" required>
<small id="subjectCounter" class="form-text text-muted app-text-right">0/150</small>
</div> -->
<div class="form-group col-md-12 app-font-family">
<div class="d-flex justify-content-between">
<label for="subject" class="mb-1">Subject <span class="text-danger">*</span></label>
<small id="subjectCounter" class="form-text text-muted">0/150</small>
</div>
<input type="text" class="form-control" id="subject" name="subject" placeholder="Enter Subject" required maxlength="150">
</div>
<div class="form-group col-md-12">
<label for="message">Message<span class="text-danger">*</span></label>
<div class="form-group col-md-12 app-font-family">
<div class="d-flex justify-content-between">
<label for="message">Message<span class="text-danger">*</span></label>
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
</div>
<!-- <input type="text" class="form-control" id="message" name="message" placeholder="Enter Message"> -->
<textarea class="form-control" id="message" name="message" placeholder="Enter Message" rows="4" required></textarea>
<textarea class="form-control" id="message" name="message" placeholder="Enter Message" rows="3" required maxlength="1500"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-border-radius mr-2 text-white" onclick="resetTicket()">Reset</button>
<button type="button" class="btn btn-ternary btn-border-radius" onclick="submitTicket()">Save</button>
<button type="button" class="btn app-btn-primary app-btn-border-radius mr-2 app-text-white" onclick="resetTicket()">Reset</button>
<button type="button" class="btn app-btn-secondary app-btn-border-radius" onclick="submitTicket()">Save</button>
</div>
</form>
</div>
@ -335,7 +472,7 @@ td .text-muted {
</div>
<div class="modal fade" id="AssignModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade app-font-family" id="AssignModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
@ -359,7 +496,7 @@ td .text-muted {
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-ternary btn-border-radius" onclick="updateAssignTo()">Save</button>
<button type="button" class="btn-custom app-btn-secondary app-btn-border-radius app-font-family" onclick="updateAssignTo()">Save</button>
</div>
</div>
</div>
@ -371,6 +508,8 @@ td .text-muted {
function openTicket(){
var form = document.getElementById('ticketForm');
form.reset();
$("#client_id").select2();
$("#ticket_type").select2();
document.getElementById('thz_id').value = '';
document.getElementById('modalLabel').innerText = "New Ticket";
document.getElementById('return_type').innerText = "Web";
@ -381,6 +520,8 @@ td .text-muted {
function resetTicket(){
var form = document.getElementById('ticketForm');
form.reset();
$("#client_id").select2();
$("#ticket_type").select2();
}
function submitTicket() {
@ -392,25 +533,39 @@ td .text-muted {
var name = document.getElementById('name').value.trim();
var mobile = document.getElementById('mobile').value.trim();
var email = document.getElementById('email').value.trim();
var message = document.getElementById('message').value.trim();
var subject = document.getElementById('subject').value.trim();
var ticketType = document.getElementById('ticket_type').value.trim();
// Validation checks
if (name === "" || mobile === "" || email === "" || ticketType === "") {
toastr.warning('Please fill all required fields.', 'warning');
toastr.warning('Please fill all required fields.', 'Warning');
form.classList.add('was-validated');
return;
}
if (message.length > 1500) {
toastr.error('Message cannot exceed 1500 characters', 'Warning');
form.classList.add('was-validated');
return;
}
if (subject.length > 150) {
toastr.error('Subject cannot exceed 150 characters', 'Warning');
form.classList.add('was-validated');
return;
}
var mobilePattern = /^[0-9]{10}$/;
if (!mobilePattern.test(mobile)) {
toastr.warning('Please enter a valid 10-digit mobile number.', 'warning');
toastr.warning('Please enter a valid 10-digit mobile number.', 'Warning');
document.getElementById('mobile').focus();
return;
}
var emailPattern = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
if (!emailPattern.test(email)) {
toastr.warning('Please enter a valid email address.', 'warning');
toastr.warning('Please enter a valid email address.', 'Warning');
document.getElementById('email').focus();
return;
}
@ -427,16 +582,16 @@ td .text-muted {
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'success');
toastr.success(response.message, 'Success');
$('#ticketModal').modal('hide');
form.reset();
window.location.href = "<?= base_url('ticketList?return_type=web') ?>";
} else {
toastr.error(response.message, 'error');
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'error');
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});
@ -462,18 +617,18 @@ td .text-muted {
policySelect.innerHTML = '<option value="" data-id="">Select Policy</option>';
if (client_id === "") {
toastr.warning('Please Select Client.', 'warning');
toastr.warning('Please Select Client.', 'Warning');
return;
}
if (mobile === "") {
toastr.warning('Please Enter a mobile number.', 'warning');
toastr.warning('Please Enter a mobile number.', 'Warning');
return;
}
var mobilePattern = /^[0-9]{10}$/;
if (!mobilePattern.test(mobile)) {
toastr.warning('Please enter a valid 10-digit mobile number.', 'warning');
toastr.warning('Please enter a valid 10-digit mobile number.', 'Warning');
document.getElementById('mobile').focus();
return;
}
@ -489,7 +644,7 @@ td .text-muted {
let policies = response.data.policy_details;
document.getElementById('name').value = client.name || "";
document.getElementById('email').value = client.email_personal || "";
document.getElementById('email').value = client.email_corporate || "";
document.getElementById('empcode').value = client.emp_code || "";
document.getElementById('branch_id').value = client.branch_id || "";
@ -508,11 +663,11 @@ td .text-muted {
document.getElementById('policy_id').value = policies[0].id;
}
} else {
toastr.warning(response.message || "No details found.", 'warning');
toastr.warning(response.message || "No details found.", 'Warning');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'error');
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});
@ -540,6 +695,50 @@ td .text-muted {
document.getElementById('policy_id').value = "";
}
}
// function hideandshowpolicy() {
// var select = document.getElementById('ticket_type');
// var value = select.value;
// var policyContainer = document.getElementById('policy_container');
// if (value === "0") {
// let newType = prompt("Enter new ticket type:");
// if (newType && newType.trim() !== "") {
// $.ajax({
// url: "<?= base_url('ticketType') ?>",
// type: "POST",
// data: { name: newType },
// dataType: 'json',
// success: function(response) {
// if (response.status === "success") {
// let option = new Option(newType, newType);
// let addNewOption = select.querySelector('option[value="0"]');
// select.insertBefore(option, addNewOption);
// select.value = newType;
// value = newType;
// console.log(response.message);
// } else { console.log(response.message); value = ""; }
// },
// error: function(xhr) { console.log("Error: " + xhr.statusText); value = ""; }
// });
// } else {
// select.value = "";
// value = "";
// }
// }
// if (value === 'Service') {
// policyContainer.style.display = "block";
// } else {
// policyContainer.style.display = "none";
// document.getElementById('policy_no').value = "";
// document.getElementById('policy_id').value = "";
// }
// }
</script>
<script>
@ -578,37 +777,42 @@ $(document).ready(function() {
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [
{
text: '<i class="mdi mdi-plus"></i> Create New Ticket',
className: 'btn btn-primary btn-border-radius text-white mr-2',
attr: { style: "color:#fff !important;" },
text: '<i class="mdi mdi-plus app-text-white" ></i><span class="app-text-white app-font-family btn-custom"> Create New Ticket </span>',
className: 'btn app-btn-primary app-btn-border-radius app-text-white mr-2',
action: function(e, dt, node, config) {
openTicket();
}
},
{
extend: 'collection',
text: ' Export <i class="mdi mdi-menu-down"></i>',
className: 'btn btn-ternary btn-border-radius text-white',
text: '<span class="app-text-white app-font-family btn-custom"> Export </span><i class="mdi mdi-menu-down app-text-white"></i>',
className: 'btn app-btn-secondary app-btn-border-radius app-text-white',
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'ticket-List'
},
{
extend: 'excel',
text: ' Excel',
title: 'ticket-List',
exportOptions: {
orthogonal: 'sort'
}
}
{
extend: 'csv',
text: '<i class="mdi mdi-file-delimited app-text-white" ></i><span class="app-text-white app-font-family btn-custom"> CSV </span>',
title: 'Tickets',
className: 'app-btn-primary app-text-white',
},
{
extend: 'excel',
text: '<i class="mdi mdi-file-excel app-text-white" ></i><span class="app-text-white app-font-family btn-custom"> EXCEL </span>',
title: 'Tickets',
exportOptions: {
orthogonal: 'sort'
},
className: 'app-btn-primary app-text-white',
}
]
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
search: "_INPUT_",
searchPlaceholder: "Search...",
paginate: {
previous: "",
next: ""
}
},
paging: true,
pageLength: 25,
@ -618,6 +822,39 @@ $(document).ready(function() {
} else {
console.error("Table Not found.");
}
const subjectInput = document.getElementById("subject");
const subjectCounter = document.getElementById("subjectCounter");
subjectInput.addEventListener("input", function () {
const subjectLength = subjectInput.value.length;
subjectCounter.textContent = `${subjectLength}/150`;
if (subjectLength > 150) {
toastr.error('Subject cannot exceed 150 characters', 'Warning');
subjectInput.classList.add('is-invalid');
} else {
subjectInput.classList.remove('is-invalid');
}
});
const messageInput = document.getElementById("message");
const messageCounter = document.getElementById("messageCounter");
messageInput.addEventListener("input", function () {
const messageLength = messageInput.value.length;
messageCounter.textContent = `${messageLength}/1500`;
if (messageLength > 1500) {
toastr.error('Message cannot exceed 1500 characters', 'Warning');
messageInput.classList.add('is-invalid');
} else {
messageInput.classList.remove('is-invalid');
}
});
});
function viewTicket(ticket_id){
@ -644,10 +881,10 @@ function removeticket(input, ticket_id) {
console.log('Data fetched successfully:', response);
if (response.status === true) {
toastr.success(response.message, 'SUCCESS');
toastr.success(response.message, 'Success');
window.location.reload();
} else {
toastr.warning(response.message, 'WARNING');
toastr.warning(response.message, 'Warning');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);

View File

@ -47,11 +47,26 @@
.card-scroll{
overflow-y:auto;
height:440px;
min-height:380px;
max-height:380px;
}
.recard-scroll{
overflow-y:auto;
height:295px;
min-height:295px;
max-height:295px;
}
.edit-icon {
font-size: 17px; /* keep fixed size */
color: #555 !important;
cursor: pointer;
transition: transform 0.2s, color 0.2s; /* smooth hover effect */
display: inline-block; /* important for transform */
}
.edit-icon:hover {
color: #00999E !important;
transform: scale(1.5);
}
.maincard{
@ -62,6 +77,7 @@
.conversation-card,
.conversation-card .card-header,
.conversation-card .card-body {
background: #F5FFFF !important;
}
@ -78,6 +94,44 @@
overflow-y:auto;
box-shadow: 0 2px 4px 0 #00000040;
}
hr{
margin-top: 5px;
margin-bottom: 5px;
}
.related-ticket-card {
margin-bottom: 6px;
}
.related-ticket-card .card-body {
border-radius: 15px;
padding: 6px 15px !important;
}
.related-ticket-card h5,
.related-ticket-card p,
.related-ticket-card small {
margin: 0 !important;
}
</style>
<style>
/* Select2 box */
.select2-container .select2-selection--single {
background-color: #ECECEC !important;
border: 1px solid #ccc !important;
height: 38px !important;
}
/* Text inside */
.select2-container .select2-selection__rendered {
color: #000 !important;
line-height: 36px !important;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
background-color: #ECECEC !important;
}
</style>
@ -95,7 +149,7 @@
<span onclick="history.back()" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</span>
Ticket ID-<?= $master[0]['thz_id']; ?>
<span class="title-text app-font-family">Ticket ID-<?= $master[0]['thz_id']; ?></span>
</h4>
</div>
@ -103,42 +157,45 @@
<div class="row" id="notes-body">
<!-- Left Details -->
<div class="col-4" id="notes-body-left">
<div class="col-5" id="notes-body-left">
<div class="card master-card" style="background:#F5FFFF;">
<div class="card-header d-flex justify-content-between align-items-center" style="background:none; border:none;">
<h5 class="mb-0">Details</h5>
<a href="javascript:void(0);"
onclick="openEditTicket()">
<i class="mdi mdi-pencil"
title="Edit"
style="font-size:15px; color:#555; cursor:pointer; transition:0.2s;"
onmouseover="this.style.color='#02a8b5'; this.style.fontSize='17px';"
onmouseout="this.style.color='#555'; this.style.fontSize='15px';">
</i>
<p class="sub-title-text app-font-family mb-0">Details</p>
<?php if($master[0]['status'] !== "Closed") : ?>
<a href="javascript:void(0);" onclick="openEditTicket()">
<i class="mdi mdi-pencil edit-icon" title="Edit"></i>
<!-- <i class="mdi mdi-pencil"
title="Edit"
style="font-size:15px; color:#555; cursor:pointer; transition:0.2s;"
onmouseover="this.style.color='#02a8b5'; this.style.fontSize='17px';"
onmouseout="this.style.color='#555'; this.style.fontSize='15px';">
</i> -->
</a>
<?php endif; ?>
</div>
<div class="card-body card-scroll" style="padding-left: 27px !important; background:#F5FFFF;">
<div class="card-body card-scroll sub-title-text app-font-family" style="padding:0 27px !important; background:#F5FFFF;">
<div class="row mb-2 ml-o">
<div class="col-5">Ticket ID</div>
<div class="col-7 text-end"><?= $master[0]['thz_id'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Ticket ID</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['thz_id'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Name</div>
<div class="col-7 text-end"><?= $master[0]['name'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Name</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['name'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Mobile</div>
<div class="col-7 text-end"><?= $master[0]['mobile'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Mobile</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['mobile'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Policy Number</div>
<div class="col-7 text-end">
<div class="col-4 app-subtitle app-text-grey app-font-family">Policy Number</div>
<div class="col-8 app-text text-end app-font-family" style="font-weight: 500 !important;">
<?= (!empty($master[0]['policy_no']) && strtolower($master[0]['policy_no']) !== 'null')
? '<u class="text-warning">
? '<u class="app-text-black">
<a href="javascript:void(0);"
class="text-warning"
class="app-text-black"
data-toggle="modal"
data-target="#PolicyModal"
title="Click to view Policy Terms"
data-id="'.$master[0]['policy_id'].'">'
.$master[0]['policy_no'].'
</a>
@ -147,33 +204,34 @@
</div>
</div>
<div class="row mb-2">
<div class="col-5">Assigned To</div>
<div class="col-7 text-end"><?= $master[0]['assignee_name'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Assigned To</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['assignee_name'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Status</div>
<div class="col-7 text-end"><?= $master[0]['status'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Status</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['status'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Ticket Type</div>
<div class="col-7 text-end"><?= $master[0]['ticket_type'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Ticket Type</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important;"><?= $master[0]['ticket_type'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Subject</div>
<div class="col-7 text-end"><?= $master[0]['subject'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Subject</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important; text-align: justify;"><?= $master[0]['subject'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Message</div>
<div class="col-7 text-end"><?= $master[0]['message'];?></div>
<div class="col-4 app-subtitle app-text-grey app-font-family">Message</div>
<div class="col-8 app-text app-text-black text-end app-font-family" style="font-weight: 500 !important; text-align: justify;"><?= $master[0]['message'];?></div>
</div>
<div class="row mb-2">
<div class="col-5">Related Tickets</div>
<div class="col-7 text-end">
<div class="col-4 app-subtitle app-text-grey app-font-family">Related Tickets</div>
<div class="col-8 app-text text-end app-font-family" style="font-weight: 500 !important;">
<u class="text-warning">
<a href="javascript:void(0);"
class="text-warning"
data-toggle="modal"
data-target="#relatedTicketModal"
title="<?= empty($master[0]['created_by']) ? 'No related tickets' : 'Click to view related tickets'; ?>"
data-id="<?= $master[0]['created_by']; ?>">
View
</a>
@ -188,42 +246,44 @@
<!-- Right Conversation -->
<div class="col-8">
<div class="col-7">
<!-- Conversation Card -->
<div class="card mb-3 conversation-card">
<div class="card-header border-0">
<h5 class="mb-0" style="font-size:15px;">Conversation</h5>
<hr/>
<div class="card-header d-flex justify-content-between align-items-center" style="background:none; border:none; padding-bottom: 0px;">
<p class="sub-title-text app-font-family" >Conversation</p>
</div>
<div class="card-body pt-0 recard-scroll">
<div class="card-body recard-scroll" style="padding:0 27px !important; margin:0 !important; background:#F5FFFF;">
<?php if(!empty($notes)): ?>
<?php foreach($notes as $i => $conv): ?>
<!-- Top Row: Message + Badge -->
<div class="d-flex justify-content-between align-items-start">
<p class="mb-1 mr-4"><?= $conv['notes'] ?></p>
<!-- <?php if(!empty($conv['notes_by'])): ?>
<span class="badge bg-warning text-dark"><?= $conv['notes_by'] ?></span>
<?php endif; ?> -->
<?php if (!empty($conv['notes_type']) && $conv['notes_type'] === "Internal"): ?>
<span class="badge bg-warning text-dark"><?= $conv['notes_type'] ?></span>
<?php endif; ?>
</div>
<!-- Bottom Row: Name + Date -->
<div class="d-flex justify-content-between small text-muted">
<span><i class="mdi mdi-account"></i> <?= $conv['name'] ?></span>
<span><?= date("j F Y h:i a", strtotime($conv['created_at'])) ?></span>
</div>
<div style="border:none; padding: 0px; margin: 0px;">
<hr/>
<!-- Top Row: Message + Badge -->
<div class="d-flex justify-content-between align-items-start app-text app-text-black app-font-family">
<p class="mb-1 ml-0 mr-0 app-font-family" style="font-weight: 400 !important;"><?= $conv['notes'] ?></p>
<!-- <?php if(!empty($conv['notes_by'])): ?>
<span class="badge bg-warning text-dark"><?= $conv['notes_by'] ?></span>
<?php endif; ?> -->
<?php if (!empty($conv['notes_type']) && $conv['notes_type'] === "Internal"): ?>
<span class="badge app-badge-secondary app-text-white app-font-family" style="font-size:10px;"><?= $conv['notes_type'] ?></span>
<?php endif; ?>
</div>
<!-- Bottom Row: Name + Date -->
<div class="d-flex justify-content-between small text-muted" style="padding-top: 5px;">
<span class="app-font-family" style="font-weight: 400 !important;"><i class="mdi mdi-account"></i> <?= $conv['name'] ?></span>
<span style="font-size:9px; font-weight: 400 !important;" class="app-font-family"><?= date("j F Y h:i a", strtotime($conv['created_at'])) ?></span>
</div>
<?php echo $i < count($notes)-1 ? '<hr/>' : ''; ?>
<!-- <?php echo $i < count($notes)-1 ? '<hr/>' : ''; ?> -->
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
<p class="text-center"><i>No Data Found</i></p>
<div class="d-flex justify-content-center align-items-center app-font-family"
style="height: 45vh; width:100%;">
<p class="text-center app-font-family"><i>No Data Found</i></p>
</div>
<?php endif; ?>
</div>
@ -237,7 +297,7 @@
<input type="hidden" id="notes_by" name="notes_by" value="Staff">
<input type="hidden" id="created_by" name="created_by" value="<?= get_session_userid(); ?>">
<div class="notes-box">
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..."></textarea>
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..." required maxlength="1500"></textarea>
<div class="icon-buttons">
<!-- save btn means local - internal -->
<button type="button" class="btn-icon" onclick="submitConverstionTicket('Internal')"><i class="mdi mdi-content-save"></i></button>
@ -245,6 +305,7 @@
<button type="button" class="btn-icon" onclick="submitConverstionTicket('External')"><i class="mdi mdi-email"></i></button>
</div>
</div>
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
</form>
</div>
@ -255,12 +316,12 @@
</div>
</div>
<div class="modal fade" id="EditModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade app-text-black app-font-family" id="EditModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<form id="ticketForm">
<div class="modal-header">
<h4 class="modal-title" id="EditModalLabel">Update</h4>
<h4 class="modal-title title-text" id="EditModalLabel" style="font-size:27px !important">Update</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
@ -270,7 +331,7 @@
<input type="hidden" id="updated_by" name="updated_by" value="<?= get_session_userid(); ?>">
<div class="form-group col-md-12">
<label for="ticket_type">Ticket Type<span class="text-danger">*</span></label>
<label for="ticket_type" class="sub-title-text app-font-family">Ticket Type<span class="text-danger">*</span></label>
<select class="form-control" id="ticket_type" name="ticket_type" required>
<option value="">Select Ticket Type</option>
<option value="Sales">Sales</option>
@ -280,7 +341,7 @@
<div class="form-group col-md-12">
<label for="status">Status</label>
<label for="status" class="sub-title-text app-font-family">Status</label>
<select class="form-control" id="status" name="status">
<option value="">Select Status</option>
<option value="Open">Open</option>
@ -294,7 +355,7 @@
// 2,3,4 dropdown data'va varannum but dropdown hide pannanum -->
<?php if(in_array(get_role_id(), [1,5]) ) { ?>
<div class="form-group col-md-12">
<label for="assign_to">Assign To</label>
<label for="assign_to" class="sub-title-text app-font-family">Assign To</label>
<select class="form-control" id="assign_to" name="assign_to">
<option value="">Select Assign To</option>
<?php if(isset($assignee)) { ?>
@ -310,53 +371,64 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-ternary btn-border-radius" onclick="submitTicket()">Save</button>
<button type="button" class="btn app-btn-secondary app-btn-border-radius" onclick="submitTicket()">Save</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="relatedTicketModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade app-font-family" id="relatedTicketModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content" style="border-radius:15px;">
<div class="modal-header" style="border-bottom-width:0;">
<h4 class="modal-title">Related Tickets</h4>
<h4 class="modal-title title-text app-font-family" style="font-size:27px !important">Related Tickets</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body card-scroll" style="padding-top:5px!important;">
<?php foreach($related_tickets as $j => $rt): ?>
<div class="card related-ticket-card mb-3">
<div class="card-body" style="border-radius: 20px; padding:27px !important;">
<div class="d-flex justify-content-between align-items-start">
<h5 class="mb-1"><?php echo '# '.$rt['thz_id']." / ".$rt['ticket_type']; ?></h5>
<small>
<?php if (!empty($rt['created_at'])):
<?php if(!empty($related_tickets)): foreach($related_tickets as $j => $rt): ?>
<div class="card related-ticket-card app-font-family app-text"
style="cursor: pointer;"
onclick="window.location='<?= base_url().'/ticketConversationList?return_type=web&thz_id='.$rt['thz_id']; ?>'">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center" style="margin-bottom: 10px !important;">
<h5 class="app-font-family app-text"><?php echo '# '.$rt['thz_id']." / ".$rt['ticket_type']; ?></h5>
<small classs="app-font-family" style="font-size:7px;">
<?php if (!empty($rt['created_at'])):
$cdt = new DateTime($rt['created_at']);
echo $cdt->format('d/m/Y') . "<span class='time'> " . $cdt->format('h:i a') . "</span>";
endif;
?></small>
endif; ?>
</small>
</div>
<p class="mb-2"><?php echo $rt['subject']; ?></p>
<small><span style="color: green !important;">Status: </span><?php echo $rt['status']; ?></small>
<p class="mt-1 app-font-family"
style="font-size:9px; font-weight:400; margin:4px;">
<?= $rt['subject'] ? $rt['subject'] : "&nbsp;"; ?>
</p>
<small class="app-font-family" style="font-size:7px;"><span style="color: green !important; font-weight: 500;">Status: </span><?php echo $rt['status']; ?></small>
</div>
</div>
<?php endforeach; ?>
<?php endforeach;
else: ?>
<div class="d-flex justify-content-center align-items-center"
style="height: 50vh; width:100%;">
<p class="text-center"><i>No Data Found</i></p>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="modal fade" id="PolicyModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade app-font-family" id="PolicyModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content" style="border-radius:15px;">
<div class="modal-header" style="border-bottom-width:0;">
<h4 class="modal-title">Policy Terms</h4>
<h4 class="modal-title title-text app-font-family">Policy Terms</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
@ -364,8 +436,9 @@
<?php if(!empty($policy_terms)):
echo $policy_terms;
else: ?>
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
<p class="text-center"><i>No Data Found</i></p>
<div class="d-flex justify-content-center align-items-center"
style="height: 50vh; width:100%;">
<p class="text-center"><i>No Data Found</i></p>
</div>
<?php endif; ?>
</div>
@ -383,6 +456,20 @@
$("#ticket_type").select2();
$("#status").select2();
$("#assign_to").select2();
const messageInput = document.getElementById("notes");
const messageCounter = document.getElementById("messageCounter");
messageInput.addEventListener("input", function () {
const messageLength = messageInput.value.length;
messageCounter.textContent = `${messageLength}/1500`;
if (messageLength > 1500) {
toastr.error('Message cannot exceed 1500 characters', 'Warning');
messageInput.classList.add('is-invalid');
} else {
messageInput.classList.remove('is-invalid');
}
});
});
@ -422,16 +509,16 @@
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'success');
toastr.success(response.message, 'Success');
$('#ticketModal').modal('hide');
form.reset();
window.location.href = "<?= base_url('ticketConversationList?return_type=web&thz_id=') ?>" + id;
} else {
toastr.error(response.message, 'error');
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'error');
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});
@ -444,6 +531,17 @@
document.getElementById("thz_id").value = urlParams.get('thz_id');
var id = urlParams.get('thz_id');
var form = document.getElementById("conversationForm");
// reset any old error styles
form.classList.remove('was-validated');
var notes = document.getElementById('notes').value.trim();
if (notes === "") {
toastr.warning('Please enter notes', 'Warning');
form.classList.add('was-validated');
return;
}
var formData = new FormData(form);
$.ajax({
@ -455,15 +553,15 @@
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'success');
toastr.success(response.message, 'Success');
form.reset();
window.location.href = "<?= base_url('ticketConversationList?return_type=web&thz_id=') ?>" + id;
} else {
toastr.error(response.message, 'error');
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'error');
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB