MERGE_CODE_MERGE : RV

This commit is contained in:
VENKATESHWARAN 2025-09-09 15:52:15 +05:30
commit e0651486ed
13 changed files with 2046 additions and 1487 deletions

View File

@ -87,6 +87,8 @@ class NotificationController extends AdminController
'client_hr_summary_mail_btn' 'client_hr_summary_mail_btn'
]; ];
$data = []; $data = [];
$emptyTemplate = [];
$updatedTemplate = [];
foreach ($checkboxNames as $checkboxName) foreach ($checkboxNames as $checkboxName)
{ {
@ -111,9 +113,31 @@ class NotificationController extends AdminController
$id = $find['id']; $id = $find['id'];
$changeData['enabled']= $value; $changeData['enabled']= $value;
$update = $notificationModel->update($id, $changeData); $update = $notificationModel->update($id, $changeData);
$updatedTemplate [] = $key;
}
if(!$find && $value == 1){
$emptyTemplate [] = $key;
} }
} }
return json_encode("true");
if(count($emptyTemplate) > 0){
return $this->response->setJSON([
'status' => false,
'code' => 400,
'message' => 'Notification settings updation Failed.',
'updated_templates' => $updatedTemplate,
'empty_templates' => $emptyTemplate
]);
}
return $this->response->setJSON([
'status' => true,
'code' => 200,
'message' => 'Notification settings updated successfully.',
'updated_templates' => $updatedTemplate,
'empty_templates' => $emptyTemplate
]);
} }
// This for Load the Template Data for in View Page // This for Load the Template Data for in View Page

View File

@ -15,6 +15,7 @@ use App\Models\UserModel;
use App\Models\ClientPolicyModel; use App\Models\ClientPolicyModel;
use App\Models\ClientModel; use App\Models\ClientModel;
use App\Models\TicketMailTemplateModel; use App\Models\TicketMailTemplateModel;
use App\Models\ClientRMModel;
class ThzController extends BaseController class ThzController extends BaseController
@ -31,6 +32,8 @@ class ThzController extends BaseController
protected $clientModel; protected $clientModel;
protected $ticketMailTemplateModel; protected $ticketMailTemplateModel;
protected $cientRmModel;
protected $myLogger; protected $myLogger;
public function __construct() public function __construct()
@ -43,6 +46,7 @@ class ThzController extends BaseController
$this->userModel = new UserModel(); $this->userModel = new UserModel();
$this->clientPolicyModel = new ClientPolicyModel(); $this->clientPolicyModel = new ClientPolicyModel();
$this->clientModel = new ClientModel(); $this->clientModel = new ClientModel();
$this->cientRmModel = new ClientRMModel();
$this->ticketMailTemplateModel = new TicketMailTemplateModel(); $this->ticketMailTemplateModel = new TicketMailTemplateModel();
$this->myLogger = \Config\Services::mylogger(); $this->myLogger = \Config\Services::mylogger();
} }
@ -52,178 +56,181 @@ class ThzController extends BaseController
// //
} }
public function ticketSave(){ public function ticketSave()
try {
{ try {
$data = $this->request->getPost(); $data = $this->request->getPost();
$references = ""; $references = "";
if (!empty($data['thz_id'])) { if (!empty($data['thz_id'])) {
$text = "update"; $text = "update";
// here insert history Status. // here insert history Status.
$old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray(); $old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray();
$result = $this->updateTicket($data); $result = $this->updateTicket($data);
if ($old && isset($data['status'])) { if ($old && isset($data['status'])) {
if ($old['status'] != $data['status']) { if ($old['status'] != $data['status']) {
$history = [ $history = [
'thz_id' => $data['thz_id'], 'thz_id' => $data['thz_id'],
'field_name' => 'status', 'field_name' => 'status',
'display_name' => 'Status', 'display_name' => 'Status',
'old_value' => $old['status'], 'old_value' => $old['status'],
'new_value' => $data['status'], 'new_value' => $data['status'],
'is_active' => 1 'is_active' => 1
]; ];
if (!empty(get_session_userid())) { if (!empty(get_session_userid())) {
$history['created_by'] = get_session_userid(); $history['created_by'] = get_session_userid();
}
$hist_id = $this->thzHistoryModel->insert($history);
$references = $old['status'] . " - " . $data['status'] . " - " . $hist_id;
} else {
$references = $old['status'] . " - " . $data['status'];
} }
} else {
$hist_id = $this->thzHistoryModel->insert($history); $references = "No Details";
$references = $old['status']." - ".$data['status']." - ".$hist_id;
}else{
$references = $old['status']." - ".$data['status'];
} }
}else{
$references = "No Details"; $updateID = $data['thz_id'];
} else {
$text = "create";
$insertID = $this->insertTicket($data);
$result = true;
$references = "";
} }
$updateID = $data['thz_id']; $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID;
} else { $emailNotificationResult = $this->ticketSaveNotification($data, $insertOrUpdate = $text, $id);
$text = "create"; return $this->response->setJSON([
$insertID = $this->insertTicket($data);
$result = true;
$references = "";
}
$id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ;
$emailNotificationResult = $this->ticketSaveNotification($data , $insertOrUpdate = $text , $id);
return $this->response->setJSON([
'status' => $result ? 'success' : 'error', 'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again." , 'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again.",
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!', 'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!',
'ref' => $references 'ref' => $references
])->setStatusCode($result ? 200 : 400); ])->setStatusCode($result ? 200 : 400);
} catch (\Throwable $e) { } catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception || $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException; || $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), return $this->response->setJSON([
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() 'status' => 'error',
])->setStatusCode($code); 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
} }
public function ticketList() public function ticketList()
{ {
try{ try {
$returnType = strtolower($this->request->getGet('return_type') ?? 'api'); $returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$data = $this->request->getGet(); $data = $this->request->getGet();
if ($returnType === 'web' && in_array(get_role_id(), [2,3,4])) { if ($returnType === 'web' && in_array(get_role_id(), [2, 3, 4])) {
$data['assign_to'] = $data['assign_to'] ?? get_session_userid(); $data['assign_to'] = $data['assign_to'] ?? get_session_userid();
}
$tickets = $this->fetchTicketsBasedOnrole($data);
if ($returnType === 'api') {
if (empty($tickets)) {
// return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found'])->setStatusCode(404);
throw new \RuntimeException('No tickets found', 400);
} }
}else{
$data['page_name'] = "Tickets"; $tickets = $this->fetchTicketsBasedOnrole($data);
$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.
$data['client_list'] = $this->clientModel->getCreatedByUserName();
$data['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
return $this->loadLayout('thz_list', $data);
if ($returnType === 'api') {
if (empty($tickets)) {
// return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found'])->setStatusCode(404);
throw new \RuntimeException('No tickets found', 400);
}
} else {
$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.
$data['client_list'] = $this->clientModel->getCreatedByUserName();
$data['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
return $this->loadLayout('thz_list', $data);
}
return $this->response->setJSON([
'status' => 'success',
'data' => $tickets,
])->setStatusCode(200);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
return $this->response->setJSON([
'status' => 'success',
'data' => $tickets,
])->setStatusCode(200);
}
catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
} }
public function ticketConversationSave(){ public function ticketConversationSave()
{
try { try {
$data = $this->request->getPost(); $data = $this->request->getPost();
$data['notes_type'] = $data['notes_type'] ?? 'External' ; $data['notes_type'] = $data['notes_type'] ?? 'External';
$result = $this->thzMasterNotesModel->insert($data); $result = $this->thzMasterNotesModel->insert($data);
if(empty($result)){ if (empty($result)) {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); // return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
throw new \RuntimeException('No tickets found', 404); throw new \RuntimeException('No tickets found', 404);
} }
if($data['notes_type'] == "External"){ if ($data['notes_type'] == "External") {
$emailNotificationResult = $this->ticketConversationSaveNotification($data); $emailNotificationResult = $this->ticketConversationSaveNotification($data);
}else{ } else {
$emailNotificationResult = false ; $emailNotificationResult = false;
} }
return $this->response->setJSON([ return $this->response->setJSON([
'status' => $result ? 'success' : 'error', 'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again." , 'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again.",
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed Or No Need..!!' 'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed Or No Need..!!'
])->setStatusCode($result ? 200 : 400); ])->setStatusCode($result ? 200 : 400);
} } catch (\Throwable $e) {
catch (\Throwable $e) { $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception || $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException; || $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), return $this->response->setJSON([
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() 'status' => 'error',
])->setStatusCode($code); 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
} }
@ -254,112 +261,113 @@ class ThzController extends BaseController
} }
return $this->response->setJSON(['status' => 'success', 'data' => $result])->setStatusCode(200); return $this->response->setJSON(['status' => 'success', 'data' => $result])->setStatusCode(200);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
} $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
catch (\Throwable $e) { || $e instanceof \mysqli_sql_exception
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; || $e instanceof \PDOException;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); return $this->response->setJSON([
'status' => 'error',
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code); ])->setStatusCode($code);
} }
} }
public function ticketConversationList() public function ticketConversationList()
{ {
$data = $this->request->getGet(); $data = $this->request->getGet();
$returnType = strtolower($this->request->getGet('return_type') ?? 'api'); $returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$thz_id = $data['thz_id'] ?? null; $thz_id = $data['thz_id'] ?? null;
$ticketType = $data['notes_type'] ?? 'External' ; $ticketType = $data['notes_type'] ?? 'External';
if($thz_id){ if ($thz_id) {
$result['master'] = $this->thzMasterModel $result['master'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') ->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') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.thz_id', $thz_id) ->where('thz_master.thz_id', $thz_id)
->findAll(); ->findAll();
if(!empty($result['master'])){ if (!empty($result['master'])) {
$notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType ); $notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType);
$result['notes'] = !empty($notes) ? $notes : []; $result['notes'] = !empty($notes) ? $notes : [];
}else{ } else {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400); // return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400);
throw new \RuntimeException('No tickets found', 400); throw new \RuntimeException('No tickets found', 400);
}
}else{
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
throw new \RuntimeException('No tickets found', 404);
} }
} else {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
throw new \RuntimeException('No tickets found', 404);
}
if ($returnType === 'api') { if ($returnType === 'api') {
try { try {
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
} catch (\Throwable $e) { } catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception || $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException; || $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), return $this->response->setJSON([
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() 'status' => 'error',
])->setStatusCode($code); 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
} 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
}else{ ])->setStatusCode($code);
}
} else {
$assign_to = $result['master'][0]['assign_to']; $assign_to = $result['master'][0]['assign_to'];
$mobile = $result['master'][0]['mobile']; $mobile = $result['master'][0]['mobile'];
$toGetPolicyId = (!empty($result['master'][0]['policy_id']) && strtolower($result['master'][0]['policy_id']) !== 'null') $toGetPolicyId = (!empty($result['master'][0]['policy_id']) && strtolower($result['master'][0]['policy_id']) !== 'null')
? $result['master'][0]['policy_id'] ? $result['master'][0]['policy_id']
: ''; : '';
$result['related_tickets'] = $this->thzMasterModel $result['related_tickets'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') ->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') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to) ->where('thz_master.assign_to', $assign_to)
->where('thz_master.mobile',$mobile) ->where('thz_master.mobile', $mobile)
->where('thz_master.thz_id !=',$thz_id) ->where('thz_master.thz_id !=', $thz_id)
->where('thz_master.status !=','Closed') ->where('thz_master.status !=', 'Closed')
->where('thz_master.status !=','Resolved') ->where('thz_master.status !=', 'Resolved')
->findAll(); ->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 $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. // 2,3,4 remain person varannum.
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : ''; $result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
$result['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll(); $result['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
return $this->loadLayout('thz_notes', $result);
return $this->loadLayout('thz_notes', $result);
} }
} }
public function ticketType() public function ticketType()
{ {
$method = $this->request->getMethod(); // get, post $method = $this->request->getMethod(); // get, post
try{ try {
if ($method === 'get') { if ($method === 'get') {
$types = $this->thzTypeModel->select('id,name,is_active')->where('is_active', 1)->findAll(); $types = $this->thzTypeModel->select('id,name,is_active')->where('is_active', 1)->findAll();
if (empty($types)) { if (empty($types)) {
return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404); return $this->response->setJSON(['status' => 'error', 'message' => 'No ticket types found'])->setStatusCode(404);
} }
return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200); return $this->response->setJSON(['status' => 'success', 'data' => $types])->setStatusCode(200);
} }
if ($method === 'post') { if ($method === 'post') {
@ -383,37 +391,37 @@ class ThzController extends BaseController
'id' => $id 'id' => $id
])->setStatusCode($id ? 200 : 400); ])->setStatusCode($id ? 200 : 400);
} }
return $this->response->setJSON([ 'status' => 'error', 'message' => 'Invalid request method' ])->setStatusCode(405); return $this->response->setJSON(['status' => 'error', 'message' => 'Invalid request method'])->setStatusCode(405);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
} }
public function ticketHistoryList() public function ticketHistoryList()
{ {
try try {
{ $data = $this->request->getGet();
$data = $this->request->getGet(); $thz_id = $data['thz_id'];
$thz_id = $data['thz_id']; // $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray();
// $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray(); $details = $this->thzHistoryModel->select('thz_history.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as created_name')
$details = $this->thzHistoryModel->select('thz_history.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as created_name') ->join('user_profiles', 'user_profiles.id = thz_history.created_by', 'left')
->join('user_profiles', 'user_profiles.id = thz_history.created_by', 'left') ->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1)
->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1) ->orderBy('thz_history.created_at', 'desc')
->orderBy('thz_history.created_at', 'desc') ->get()->getResultArray();
->get()->getResultArray();
@ -423,21 +431,23 @@ class ThzController extends BaseController
} }
return $this->response->setJSON(['status' => 'success','data' => $details])->setStatusCode(200); return $this->response->setJSON(['status' => 'success', 'data' => $details])->setStatusCode(200);
} catch (\Throwable $e) { } catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception || $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException; || $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()]; $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), return $this->response->setJSON([
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() 'status' => 'error',
])->setStatusCode($code); 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
} }
@ -454,36 +464,37 @@ class ThzController extends BaseController
if (!empty($assign_to)) { if (!empty($assign_to)) {
// Tickets assigned to a staff // Tickets assigned to a staff
return $this->thzMasterModel return $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') ->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') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to) ->where('thz_master.assign_to', $assign_to)
->orderBy('thz_master.created_at','desc') ->orderBy('thz_master.created_at', 'desc')
->findAll(); ->findAll();
} }
// if (!empty($id) && !empty($mobile)) { // if (!empty($id) && !empty($mobile)) {
if (!empty($mobile)) { if (!empty($mobile)) {
// Specific ticket by ID and mobile // Specific ticket by ID and mobile
return $this->thzMasterModel return $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') ->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') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
// ->where('thz_id', $id) // ->where('thz_id', $id)
->where('thz_master.mobile', $mobile) ->where('thz_master.mobile', $mobile)
->orderBy('thz_master.created_at','desc') ->orderBy('thz_master.created_at', 'desc')
->findAll(); ->findAll();
} }
// All tickets (e.g., for managers) // All tickets (e.g., for managers)
return $this->thzMasterModel return $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') ->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') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->orderBy('thz_master.created_at','desc') ->orderBy('thz_master.created_at', 'desc')
->findAll(); ->findAll();
} }
private function ticketSaveNotification( $data , $insertOrUpdate , $id){ private function ticketSaveNotification($data, $insertOrUpdate, $id)
{
$user_email = $data['email'] ?? null; $user_email = $data['email'] ?? null;
@ -491,6 +502,8 @@ class ThzController extends BaseController
$assignee_email = $this->findAssigneeEmail($assignee_id); $assignee_email = $this->findAssigneeEmail($assignee_id);
$client_id = $data['client_id'] ?? null;
$emailToNotified = [ $emailToNotified = [
'user_email' => $user_email, 'user_email' => $user_email,
'assignee_email' => $assignee_email 'assignee_email' => $assignee_email
@ -498,26 +511,26 @@ class ThzController extends BaseController
$ticketId = $id; $ticketId = $id;
$result = $this->ticketSaveEmailNotificationBasedOnRole($emailToNotified , $insertOrUpdate , $ticketId , $data); $result = $this->ticketSaveEmailNotificationBasedOnRole($emailToNotified, $insertOrUpdate, $ticketId, $data, $client_id);
return $result;
return $result;
} }
private function ticketConversationSaveNotification($data){ private function ticketConversationSaveNotification($data)
{
$thz_id = $data['thz_id'] ; // thz is alias of ticket $thz_id = $data['thz_id']; // thz is alias of ticket
$data['subject'] = $this->findSubject($data['thz_id']); $data['subject'] = $this->findSubject($data['thz_id']);
$assignee_id = $this->findAssigneeId($data['thz_id']) ; $assignee_id = $this->findAssigneeId($data['thz_id']);
$user_email = $this->findUserEmail($data['thz_id']) ; $user_email = $this->findUserEmail($data['thz_id']);
$assignee_email = $this->findAssigneeEmail($assignee_id) ?? ''; $assignee_email = $this->findAssigneeEmail($assignee_id) ?? '';
$sender_mail = $data['notes_by'] == "User" ? $user_email : $assignee_email ; $sender_mail = $data['notes_by'] == "User" ? $user_email : $assignee_email;
$receiver_mail = $data['notes_by'] == "User" ? $assignee_email : $user_email ; $receiver_mail = $data['notes_by'] == "User" ? $assignee_email : $user_email;
$templateName = "ticket_conversation_save_notification"; $templateName = "ticket_conversation_save_notification";
@ -527,40 +540,43 @@ class ThzController extends BaseController
$message = $data['notes'] ?? ''; $message = $data['notes'] ?? '';
$this->sendEmail( $templateName, $data , $to_email , $ticketId , $message); $this->sendEmail($templateName, $data, $to_email, $ticketId, $message);
return true; return true;
} }
private function findAssigneeEmail($assignee_id){ private function findAssigneeEmail($assignee_id)
{
$row = $this->userModel->where('id', $assignee_id)->get()->getRow(); $row = $this->userModel->where('id', $assignee_id)->get()->getRow();
$assigneeEmail = $row ? $row->email : null; $assigneeEmail = $row ? $row->email : null;
return $assigneeEmail ? $assigneeEmail : ""; return $assigneeEmail ? $assigneeEmail : "";
} }
private function findAssigneeId($ticketId){ private function findAssigneeId($ticketId)
{
$row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow(); $row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow();
$assigneeId = $row ? $row->assign_to : null; $assigneeId = $row ? $row->assign_to : null;
return $assigneeId ? $assigneeId : 0 ; return $assigneeId ? $assigneeId : 0;
} }
private function findUserEmail($ticket_id){ private function findUserEmail($ticket_id)
{
$row = $this->thzMasterModel->where('thz_id', $ticket_id)->get()->getRow(); $row = $this->thzMasterModel->where('thz_id', $ticket_id)->get()->getRow();
$email = $row ? $row->email : null; $email = $row ? $row->email : null;
return $email ? $email : " " ; return $email ? $email : " ";
} }
private function findSubject($ticketId){ private function findSubject($ticketId)
{
$row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow(); $row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow();
$subject = $row ? $row->subject : null; $subject = $row ? $row->subject : null;
return $subject ? $subject : " " ; return $subject ? $subject : " ";
} }
private function ticketSaveEmailNotificationBasedOnRole($emailToNotified , $insertOrUpdate , $ticketId , $data){ private function ticketSaveEmailNotificationBasedOnRole($emailToNotified, $insertOrUpdate, $ticketId, $data, $client_id)
{
$user_email = $emailToNotified['user_email'] ?? null; $user_email = $emailToNotified['user_email'] ?? null;
$assignee_email = $emailToNotified['assignee_email'] ?? null; $assignee_email = $emailToNotified['assignee_email'] ?? null;
@ -572,13 +588,13 @@ class ThzController extends BaseController
case 'update': case 'update':
$this->sendEmail( 'ticket_save_update_assignee', $data ,$assignee_email , $ticketId ) ; $this->sendEmail('ticket_save_update_assignee', $data, $assignee_email, $ticketId);
break; break;
case 'create': case 'create':
$this->sendEmail( 'ticket_save_create_assignee', $data ,$assignee_email , $ticketId ) ; $this->sendEmail('ticket_save_create_assignee', $data, $assignee_email, $ticketId);
break; break;
@ -586,7 +602,6 @@ class ThzController extends BaseController
# code... # code...
break; break;
} }
} }
if (!empty($user_email)) { if (!empty($user_email)) {
@ -595,23 +610,34 @@ class ThzController extends BaseController
case 'update': case 'update':
if(empty($assignee_email)){ $data['assigneeAndStatus'] = empty($assignee_email)
$data['assigneeAndStatus'] = "Not Yet Assigned"; ? "Not Yet Assigned"
$this->sendEmail( 'ticket_save_update_user', $data ,$user_email , $ticketId ) ; : "Assigned With {$assignee_email}";
}else{
$data['assigneeAndStatus'] = "Assigned With {$assignee_email}";
$this->sendEmail( 'ticket_save_update_user', $data ,$user_email , $ticketId ) ;
}
break; $this->sendEmail('ticket_save_update_user', $data, $user_email, $ticketId);
break;
case 'create': case 'create':
if(empty($assignee_email)){ $account_manager_email = $this->cientRmModel->findAccountManagerEmail($client_id);
$this->sendEmail( 'ticket_save_create_user_unassigned', $data ,$user_email , $ticketId ) ;
}else{ $cc = getenv(' G_ticketing_system_cc');
$data['assignee_email'] = $assignee_email ;
$this->sendEmail( 'ticket_save_create_user_assigned', $data , $user_email , $ticketId ) ; $template = empty($assignee_email)
? 'ticket_save_create_user_unassigned'
: 'ticket_save_create_user_assigned';
if (!empty($assignee_email)) {
$data['assignee_email'] = $assignee_email;
}
$this->sendEmail($template, $data, $user_email, $ticketId);
// send to account manager and if it is more than one email also no problem we send to all account managers
if (!empty($account_manager_email)) {
$this->sendEmail($template, $data, $account_manager_email, $ticketId, $cc);
} }
break; break;
@ -620,22 +646,19 @@ class ThzController extends BaseController
# code... # code...
break; break;
} }
} }
return true; return true;
} }
private function updateTicket($data){ private function updateTicket($data)
{
$data['updated_by'] = get_session_userid(); $data['updated_by'] = get_session_userid();
$ticket_id = $data['thz_id']; $ticket_id = $data['thz_id'];
$result = $this->thzMasterModel->where('thz_id', $ticket_id)->set($data)->update(); $result = $this->thzMasterModel->where('thz_id', $ticket_id)->set($data)->update();
return $result; return $result;
} }
private function insertTicket($data) private function insertTicket($data)
@ -647,12 +670,13 @@ class ThzController extends BaseController
} }
private function sendEmail( $templateName, $data , $to_email , $ticketId , $message = ""){ private function sendEmail($templateName, $data, $to_email, $ticketId , $cc = "", $message = "", $bcc = "")
{
$mailTemplate = $this->ticketMailTemplateModel->where('template_name',$templateName )->findAll()[0] ?? []; $mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? [];
if(empty($mailTemplate)){ if (empty($mailTemplate)) {
return ; return;
} }
$mailTemplate['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['subject']); $mailTemplate['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['subject']);
@ -665,19 +689,18 @@ class ThzController extends BaseController
$mailTemplate['mail_content'] = str_replace('%assignee_email%', $data['assignee_email'] ?? '', $mailTemplate['mail_content']); $mailTemplate['mail_content'] = str_replace('%assignee_email%', $data['assignee_email'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%assigneeAndStatus%',$data['assigneeAndStatus'] ?? '' ,$mailTemplate['mail_content']); $mailTemplate['mail_content'] = str_replace('%assigneeAndStatus%', $data['assigneeAndStatus'] ?? '', $mailTemplate['mail_content']);
$from_mail = ""; $from_mail = "";
$to_mail = $to_email; $to_mail = $to_email;
$cc_string = ""; $cc_string = $cc;
$subject = $mailTemplate['subject'] ; $subject = $mailTemplate['subject'];
$message = $mailTemplate['mail_content'] ; $message = $mailTemplate['mail_content'];
$attachments = ""; $attachments = "";
$reply_to = ""; $reply_to = "";
$bcc_string = ""; $bcc_string = $bcc;
$res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail , 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
$res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail, 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
} }
@ -686,18 +709,15 @@ class ThzController extends BaseController
$policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $client_policy_id)->first(); $policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $client_policy_id)->first();
$policy_terms = []; $policy_terms = [];
if(isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])){ if (isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])) {
$raw_terms = json_decode($policy_data['policy_terms'] ?? [] , true) ?? []; $raw_terms = json_decode($policy_data['policy_terms'] ?? [], true) ?? [];
$ticketController = new TicketController(); $ticketController = new TicketController();
$policy_terms = $ticketController->convertTermsToDisplay($raw_terms); $policy_terms = $ticketController->convertTermsToDisplay($raw_terms);
} }
$data['policy_terms'] = $policy_terms; $data['policy_terms'] = $policy_terms;
return view('view_policy_terms', $data); return view('view_policy_terms', $data);
} }
} }

View File

@ -21,22 +21,38 @@ class ClientRMModel extends Model
public function checkExistenceOfClientRelation($id, $user_id, $level) public function checkExistenceOfClientRelation($id, $user_id, $level)
{ {
$query = $this->where('client_id', $id) $query = $this->where('client_id', $id)
->where('user_id', $user_id) ->where('user_id', $user_id)
->where('level', $level) ->where('level', $level)
->countAllResults(); ->countAllResults();
return ($query > 0) ? true : false; return ($query > 0) ? true : false;
} }
public function getAllClientRM(){ public function getAllClientRM()
{
return $this->db->table('client_rm') return $this->db->table('client_rm')
->select('client_rm.client_id, client_rm.level,') ->select('client_rm.client_id, client_rm.level,')
->select('user_profiles.first_name as account_manager') ->select('user_profiles.first_name as account_manager')
->join('user_profiles', 'user_profiles.id = client_rm.user_id') ->join('user_profiles', 'user_profiles.id = client_rm.user_id')
->where('level', 3) ->where('level', 3)
->get() ->get()
->getResult(); ->getResult();
} }
public function findAccountManagerEmail($client_id)
{
$builder = $this->db->table('client_rm');
$builder->select('user_profiles.email');
$builder->join('user_profiles', 'user_profiles.id = client_rm.user_id');
$builder->where('client_rm.client_id', $client_id);
$builder->where('client_rm.level', 3); // Assuming level 3 is for account managers
$result = $builder->get()->getResultArray();
if (count($result) > 0) {
// Extract just the email values into a simple string array
return array_column($result, 'email');
} else {
return null; // or []
}
}
} }

View File

@ -64,33 +64,30 @@ input:checked + .slider:before {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card-body"> <div class="card-body">
<div class="form-row">
<div class="form-group">
<label for="">Upload Your Logo</label> <br>
<img
src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : base_url()."public/assets/images/avatar_2x.png" ?>"
width="75" height="75"
id="uploadPreview"
class="avatar img-circle img-thumbnail"
style="border-radius:25px; border:1px solid #00999E;padding:10px;color:#00999E;"
alt="avatar"/>
<span style="margin-bottom:5px;">
<input type="file" name="client_logo" id="client_logo" accept="image/*" onchange="PreviewImage();"><br>
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
</span>
<br>
</div>
</div>
<form role="form" class="parsley-examples" method="post" id="general_form" enctype="multipart/form-data"> <form role="form" class="parsley-examples" method="post" id="general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="general_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/> <input type="hidden" name="PrimaryKey" id="general_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="client_id" id="client_id" /> <input type="hidden" name="client_id" id="client_id" />
<div class="form-group"> <div class="form-group">
<div class="form-row">
<div class="form-group">
<label for="">Upload Your Logo</label> <br>
<img
src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : base_url()."public/assets/images/avatar_2x.png" ?>"
width="75" height="75"
id="uploadPreview"
class="avatar img-circle img-thumbnail"
style="border-radius:25px; border:1px solid #00999E;padding:10px;color:#00999E;"
alt="avatar"/>
<span style="margin-bottom:5px;">
<input type="file" name="client_logo" id="client_logo" accept="image/*" onchange="PreviewImage();"><br>
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
</span>
<br>
</div>
</div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="entity_type_id">Entity Type <span <label for="entity_type_id">Entity Type <span
@ -381,7 +378,7 @@ input:checked + .slider:before {
// Check if the file extension is allowed // Check if the file extension is allowed
if (!allowedExtensions.includes(fileExtension)) { if (!allowedExtensions.includes(fileExtension)) {
toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.'); toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); $("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
input.value = ""; input.value = "";
} }
@ -390,7 +387,7 @@ input:checked + .slider:before {
const fileSize = file.size / 1024; // in KB const fileSize = file.size / 1024; // in KB
if (fileSize > 200) { if (fileSize > 200) {
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.'); toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); $("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
input.value = ""; input.value = "";
} }
@ -399,7 +396,7 @@ input:checked + .slider:before {
img.onload = function() { img.onload = function() {
if (this.width !== 100 || this.height !== 100) { if (this.width !== 100 || this.height !== 100) {
toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.'); toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.');
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); $("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
} }
// If both size and dimensions are valid, you can proceed with your logic here // If both size and dimensions are valid, you can proceed with your logic here
// For example, you can display the image // For example, you can display the image

View File

@ -466,7 +466,12 @@ $("#branch_form").submit(function(event) {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
console.log('Something Wrong!', 'warning'); console.log('Something Wrong!', 'warning');
}, 300); }, 300);
},
complete: function() {
console.log('Ajax request completed');
window.scrollTo({ top: 0, behavior: 'smooth' });
} }
}); });
} }
contactCount = 1 contactCount = 1
@ -511,7 +516,7 @@ $('body').on('click', '.btnBranchEdit', function() {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 500); }, 500);
// console.log('branch contact : ',res.contact)
$('#add_branch').show(); $('#add_branch').show();
$('#branch_table').hide(); $('#branch_table').hide();

View File

@ -342,7 +342,7 @@
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"> <input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id"> <input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
<input type="hidden" name="client_id" value="${client_id}"> <input type="hidden" name="client_id" value="${client_id}">
<button class="btn btn-sm btn-primary submit" style="position: relative; right: 80px;">Submit</button> <button class="btn btn-sm btn-primary submit" style="position: relative; right:0px;">Submit</button>
</form> </form>
</td> </td>
<td id="name_${item.id}" style="display:none;"></td> <td id="name_${item.id}" style="display:none;"></td>

View File

@ -1,12 +1,76 @@
<style>
<?php foreach ($hr_access_data as $key => $value) {
$key = $key + 1;
?>
#user<?php echo "$key"; ?>-active {
margin: 0;
}
#user<?= $key ?>-active .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-active label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-pre {
margin: 0;
}
#user<?= $key ?>-pre .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-pre label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-gmc2 {
margin: 0;
}
#user<?= $key ?>-gmc2 .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-gmc2 label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-cd {
margin: 0;
}
#user<?= $key ?>-cd .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-cd label {
font-size: 11px !important;
height: auto !important;
}
<?php } ?>
</style>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<?php if(isset($hr_access_data) && !empty($hr_access_data)) { ?> <?php if (isset($hr_access_data) && !empty($hr_access_data)) { ?>
<form id="insuranceForm" onsubmit="submitForm(event)"> <form id="insuranceForm" onsubmit="submitForm(event)">
<?php foreach ($hr_access_data as $key => $value) { <?php foreach ($hr_access_data as $key => $value) {
$key = $key + 1 ?> $key = $key + 1;
?>
<!-- User 1 Card --> <!-- User 1 Card -->
<div class="user-card" data-user-id="<?= 'user' . $key ?>"> <div class="user-card" data-user-id="<?= 'user' . $key ?>">
@ -68,7 +132,9 @@
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>" <input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>"
<?= in_array($policies['client_policy_id'], $value['allowed_pre_policies']) ? 'checked' : '' ?>> <?= in_array($policies['client_policy_id'], $value['allowed_pre_policies']) ? 'checked' : '' ?>>
<label style="<?php if($policies['policy_status'] == 0){echo 'color:#ff5757';} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label> <label style="<?php if ($policies['policy_status'] == 0) {
echo 'color:#ff5757';
} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
@ -86,7 +152,11 @@
} ?>> } ?>>
<i class="mdi mdi-check-circle mr-2"></i>Active policies <i class="mdi mdi-check-circle mr-2"></i>Active policies
</div> </div>
<div class="<?php if (in_array(2, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-active"> <div class="<?php if (in_array(2, $value['allowed_post_modules'])) {
echo 'checkbox-group';
} else {
echo 'checkbox-group hidden';
} ?>" id="<?= 'user' . $key ?>-active">
<!-- Select All --> <!-- Select All -->
@ -113,8 +183,14 @@
?> ?>
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post" <input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post"
value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {echo 'checked';} ?>> value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if($policies['policy_status'] == 0){echo 'color:#ff5757';} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label> echo 'checked';
} ?>>
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if ($policies['policy_status'] == 0) {
echo 'color:#ff5757';
} ?>">
<?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?>
</label>
</div> </div>
<?php } ?> <?php } ?>
@ -127,11 +203,17 @@
<div class="section"> <div class="section">
<div class="section-title"> <div class="section-title">
<input type="checkbox" class="main-checkbox" <input type="checkbox" class="main-checkbox"
onchange="toggleSection(this, '<?= 'user' . $key ?>-cd')" name="<?= 'user' . $key ?>_modules" value="3" <?php if (in_array(3, $value['allowed_post_modules'])) { echo 'checked';} ?>> onchange="toggleSection(this, '<?= 'user' . $key ?>-cd')" name="<?= 'user' . $key ?>_modules" value="3" <?php if (in_array(3, $value['allowed_post_modules'])) {
echo 'checked';
} ?>>
<i class="mdi mdi-file mr-2"></i>CD statement <i class="mdi mdi-file mr-2"></i>CD statement
</div> </div>
<div class="<?php if (in_array(3, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-cd"> <div class="<?php if (in_array(3, $value['allowed_post_modules'])) {
echo 'checkbox-group';
} else {
echo 'checkbox-group hidden';
} ?>" id="<?= 'user' . $key ?>-cd">
<!-- Select All --> <!-- Select All -->
<div class="checkbox-item"> <div class="checkbox-item">
@ -141,7 +223,9 @@
<?php foreach ($post_cd_data as $key3 => $cd) { ?> <?php foreach ($post_cd_data as $key3 => $cd) { ?>
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="policy-checkbox" data-user="<?= $key ?>" data-group="cd" id="<?= 'user' . $key ?>-icici1" name="<?= 'user' . $key ?>_cd" value="<?= $cd['cd_master_pk'] ?>" <?php if (in_array($cd['cd_master_pk'], $value['allowed_cd'])) { echo 'checked';} ?>> <input type="checkbox" class="policy-checkbox" data-user="<?= $key ?>" data-group="cd" id="<?= 'user' . $key ?>-icici1" name="<?= 'user' . $key ?>_cd" value="<?= $cd['cd_master_pk'] ?>" <?php if (in_array($cd['cd_master_pk'], $value['allowed_cd'])) {
echo 'checked';
} ?>>
<label for="<?= 'user' . $key ?>-icici1"><?= $cd['insurer_short_name'] ?> - <span class="policy-number"><?= $cd['cd_account_no'] ?></span></label> <label for="<?= 'user' . $key ?>-icici1"><?= $cd['insurer_short_name'] ?> - <span class="policy-number"><?= $cd['cd_account_no'] ?></span></label>
</div> </div>
<?php } ?> <?php } ?>
@ -152,7 +236,9 @@
<div class="col-md-6 col-lg-3"> <div class="col-md-6 col-lg-3">
<div class="section"> <div class="section">
<div class="section-title"> <div class="section-title">
<input type="checkbox" class="main-checkbox" name="<?= 'user' . $key ?>_modules" value="4" <?php if (in_array(4, $value['allowed_post_modules'])) {echo 'checked';} ?>> <input type="checkbox" class="main-checkbox" name="<?= 'user' . $key ?>_modules" value="4" <?php if (in_array(4, $value['allowed_post_modules'])) {
echo 'checked';
} ?>>
<i class="mdi mdi-clipboard-text mr-2"></i>Claims <i class="mdi mdi-clipboard-text mr-2"></i>Claims
</div> </div>
</div> </div>
@ -173,7 +259,9 @@
</form> </form>
<?php } else { ?> <?php } else { ?>
<div class="submit-container"> <p align="center"> <b>There is no HR data</b></p> </div> <div class="submit-container">
<p align="center"> <b>There is no HR data</b></p>
</div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>

View File

@ -23,7 +23,30 @@ table.dataTable tbody td {
} */ } */
</style> </style>
<div class="row" style="position: relative;left: 250px;top: 55px;"> <style>
/* Put this in your CSS */
#scroll-horizontal-datatable_wrapper .btn-secondary {
cursor: pointer;
width: auto;
display: inline-flex;
align-items: center;
border: 1px solid #F5FFFF;
background-color: #F5FFFF !important;
}
#scroll-horizontal-datatable_wrapper #submitBtn{
background-color: #E26728 !important;
color: white !important;
border: 1px solid #E26728;
padding: 5px 10px !important;
border-radius: 10px !important;
cursor: pointer !important;
box-shadow: 0px 2px 4px 0px #00000024 !important;
}
</style>
<!-- <div class="row" style="position: relative;left: 250px;top: 55px;">
<div class="form-group col-md-3" id="date_div"> <div class="form-group col-md-3" id="date_div">
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%"> <div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="mdi mdi-calendar-blank"></i>&nbsp; <i class="mdi mdi-calendar-blank"></i>&nbsp;
@ -35,9 +58,9 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<button type="button" class="btn btn-primary" onclick="appendHrActivityHistoryHtml(this, true)"> submit </button> <button type="button" class="btn btn-primary" onclick="appendHrActivityHistoryHtml(this, true)"> submit </button>
</div> </div>
</div> </div> -->
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap flex-grow">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S. No</th> <th>S. No</th>
@ -68,9 +91,9 @@ $(document).ready(function () {
var ticketsTable = $('#scroll-horizontal-datatable'); var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) { if (ticketsTable.length) {
ticketsTable.DataTable({ var table = ticketsTable.DataTable({
scrollX: true, scrollX: true,
dom: "<'row'<'col-sm-2'f><'col-sm-2'>>" + // Filter left, buttons right dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // search left, buttons right
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-3'i><'col-sm-2'l><'col-sm-7'p>>", "<'row'<'col-sm-3'i><'col-sm-2'l><'col-sm-7'p>>",
language: { language: {
@ -79,40 +102,62 @@ $(document).ready(function () {
}, },
paging: true, paging: true,
pageLength: 25, pageLength: 25,
ordering: false ordering: false,
buttons: [
{
text: '<div id="reportrange" class="form-control d-inline-block mr-2 custom-daterange" style="background:white; cursor: pointer; width: auto; display:inline-flex; align-items:center;">' +
'<i class="mdi mdi-calendar-blank"></i>&nbsp;<span></span> <i class="mdi mdi-menu-down"></i>' +
'</div>' +
'<input type="hidden" id="startDate">' +
'<input type="hidden" id="endDate">' +
'<button type="button" id="submitBtn" class="btn btn-primary ml-2">Submit</button>',
className: 'btn-group d-inline-block btn-secondary',
style : 'background: white; border: 1px solid #ced4da; padding: 5px 10px; border-radius: 5px;',
action: function () {
appendHrActivityHistoryHtml(this, true);
}
}
]
});
// Attach submit handler separately so it works
$(document).on("click", "#submitBtn", function () {
appendHrActivityHistoryHtml(this, true);
});
// Daterangepicker setup
const params = new URLSearchParams(window.location.search);
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
const start = moment(startDateParam, 'DD-MM-YYYY');
const end = moment(endDateParam, 'DD-MM-YYYY');
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$(document).ready(function () {
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");
} }
// Daterangepicker setup
const params = new URLSearchParams(window.location.search);
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
const start = moment(startDateParam, 'DD-MM-YYYY');
const end = moment(endDateParam, 'DD-MM-YYYY');
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
}); });

View File

@ -1004,6 +1004,22 @@ $(document).ready(function(){
}); });
}); });
function openModal(modalId) {
var modalEl = document.getElementById(modalId);
if (typeof bootstrap !== "undefined" && bootstrap.Modal) {
// Bootstrap 5
var modal = bootstrap.Modal.getOrCreateInstance(modalEl);
modal.show();
} else if (typeof $ !== "undefined" && typeof $.fn.modal === "function") {
// Bootstrap 4
$('#' + modalId).modal('show');
} else {
console.error("No compatible Bootstrap modal found.");
}
}
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +1,115 @@
<style> <style>
#notification_table{ #notification_table {
overflow-x : unset; overflow-x: unset;
} }
.preview_button{
display:none; .preview_button {
display: none;
} }
.scrollb { .scrollb {
overflow-y: auto !important; overflow-y: auto !important;
} }
#editor-container { #editor-container {
width: 100%; width: 100%;
min-height: 600px; min-height: 600px;
} }
.modal-dialog { .modal-dialog {
max-width: 90% !important; max-width: 90% !important;
width: 90% !important; width: 90% !important;
} }
/* Also ensure the modal body has proper height */ /* Also ensure the modal body has proper height */
.modal-body { .modal-body {
min-height: 600px; min-height: 600px;
padding: 20px; padding: 20px;
} }
/* If you're using Bootstrap's modal, you might also want to ensure proper positioning */ /* If you're using Bootstrap's modal, you might also want to ensure proper positioning */
.modal-dialog { .modal-dialog {
margin: 1.75rem auto; margin: 1.75rem auto;
} }
.mail-section{ .mail-section {
border: 1px solid #00999E; border: 1px solid #00999E;
border-radius:10px; border-radius: 10px;
padding:5px !important; padding: 5px !important;
} }
</style>
<style>
/* Custom switch (responsive, no inline styles) */
#notification-tab .switch {
position: relative;
display: inline-block;
width: 2.5rem;
height: 1.2rem;
}
#notification-tab .switch input {
opacity: 0;
width: 0;
height: 0;
}
#notification-tab .slider {
position: absolute;
cursor: pointer;
inset: 0;
background-color: #ccc;
transition: 0.3s;
border-radius: 34px;
}
#notification-tab .slider:before {
position: absolute;
content: "";
height: 1rem;
width: 1rem;
left: 0.2rem;
bottom: 0.1rem;
background-color: #fff;
transition: 0.3s;
border-radius: 50%;
}
#notification-tab input:checked+.slider {
background-color: #2196F3;
}
#notification-tab input:checked+.slider:before {
transform: translateX(1.2rem);
}
/* Reusable row styling */
#notification-tab .mail-row {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: .5rem;
padding-right: .5rem;
}
#notification-tab .mail-row .mail-section {
display: flex;
width: 100%;
align-items: center;
}
#notification-tab .mail-row .mail-section .left {
display: flex;
align-items: center;
margin-top: .3rem;
flex: 0 0 70%;
}
#notification-tab .mail-row .mail-section .right {
flex: 0 0 30%;
text-align: right;
}
</style> </style>
<div class="tab-pane fade" id="notification-tab"> <div class="tab-pane fade" id="notification-tab">
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>" /> <input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>" />
@ -114,66 +186,119 @@
<!-- mail section --> <!-- mail section -->
<!-- Member welcome mail row-->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6 mail-section">
<label for="branch_name">Member welcome mail</label> <!-- Example: Member welcome mail -->
<label class="switch"> <div class="form-group col-md-6 mail-row">
<input id="member_welcome_mail_btn" type="checkbox" name="member_welcome_mail_btn" <?= ($member_welcome_mail == 1) ? 'checked' : '' ?>> <div class="mail-section">
<span class="slider round" style="height: 27px;"></span> <div class="left">
</label> <label class="switch">
&nbsp; &nbsp; <input id="member_welcome_mail_btn" type="checkbox" name="member_welcome_mail_btn" <?= ($member_welcome_mail == 1) ? 'checked' : '' ?>>
<a href="" data-toggle="modal" id="member_welcome_mail" onclick="getMailTemplateData(this)" data-target="#member_welcome_mail_modal">Edit</a> <span class="slider"></span>
</label>
<span class="ml-2">Member welcome mail</span>
</div>
<div class="right">
<a href="#" id="member_welcome_mail" onclick="getMailTemplateData(this)" data-toggle="modal" data-target="#member_welcome_mail_modal">
<i class="mdi mdi-pencil"></i>
</a>
</div>
</div>
</div> </div>
<div class="form-group col-md-6 mail-section">
<label for="branch_name">Member reminder mail</label> <!-- Example: Member reminder mail -->
<label class="switch"> <div class="form-group col-md-6 mail-row">
<input id="member_reminder_mail_btn" type="checkbox" name="member_reminder_mail_btn" <?= $member_reminder_mail == 1 ? 'checked' : '' ?>> <div class="mail-section">
<span class="slider round" style="height: 27px;"></span> <div class="left">
</label> <label class="switch">
&nbsp; &nbsp; <input id="member_reminder_mail_btn" type="checkbox" name="member_reminder_mail_btn" <?= ($member_reminder_mail == 1) ? 'checked' : '' ?>>
<a href="" data-toggle="modal" id="member_reminder_mail" onclick="getMailTemplateData(this)" data-target="#member_reminder_mail_modal">Edit</a> <span class="slider"></span>
</label>
<span class="ml-2">Member reminder mail</span>
</div>
<div class="right">
<a href="#" id="member_reminder_mail" onclick="getMailTemplateData(this)" data-toggle="modal" data-target="#member_reminder_mail_modal">
<i class="mdi mdi-pencil"></i>
</a>
</div>
</div>
</div>
</div>
<!-- Member Ecard mail row-->
<div class="form-row">
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
<input id="member_ecard_mail_btn" type="checkbox" name="member_ecard_mail_btn" <?= $member_ecard_mail == 1 ? 'checked' : '' ?>>
<span class="slider round"></span>
</label>
<span class="ml-2"> Member ECard mail</span>
</div>
<div class="right">
<a href="" data-toggle="modal" id="member_ecard_mail" onclick="getMailTemplateData(this)" data-target="#member_ecard_mail_modal">
<i class="mdi mdi-pencil"></i>
</a>
</div>
</div>
</div>
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
<input id="member_review_and_summary_mail_btn" type="checkbox" name="member_review_and_summary_mail_btn" <?= $member_review_and_summary_mail == 1 ? 'checked' : '' ?>>
<span class="slider round"></span>
</label>
<span class="ml-2"> Member Review And Summary Mail</span>
</div>
<div class="right">
<a href="" data-toggle="modal" id="member_review_and_summary_mail" onclick="getMailTemplateData(this)" data-target="#member_review_and_summary_mail_modal">
<i class="mdi mdi-pencil"></i>
</a>
</div>
</div>
</div> </div>
</div> </div>
<!-- Account Manager Summary Mail row-->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6 mail-section"> <div class="form-group col-md-6 mail-row">
<label for="branch_name">Member ECard mail</label> <div class="mail-section">
<label class="switch"> <div class="left">
<input id="member_ecard_mail_btn" type="checkbox" name="member_ecard_mail_btn" <?= $member_ecard_mail == 1 ? 'checked' : '' ?>> <label class="switch">
<span class="slider round" style="height: 27px;"></span> <input id="account_maneger_summary_mail_btn" type="checkbox" name="account_maneger_summary_mail_btn" <?= $account_maneger_summary_mail ? 'checked' : '' ?>>
</label> <span class="slider round"></span>
&nbsp; &nbsp; </label>
<a href="" data-toggle="modal" id="member_ecard_mail" onclick="getMailTemplateData(this)" data-target="#member_ecard_mail_modal">Edit</a> <span class="ml-2"> Account Manager summary mail</span>
</div>
<div class="right">
<a href="" data-toggle="modal" id="account_maneger_summary_mail" onclick="getMailTemplateData(this)" data-target="#account_maneger_summary_mail_modal">
<i class="mdi mdi-pencil"></i>
</a>
</div>
</div>
</div> </div>
<div class="form-group col-md-6 mail-section"> <div class="form-group col-md-6 mail-row">
<label for="branch_name">Member Review and summary mail</label> <div class="mail-section">
<label class="switch"> <div class="left">
<input id="member_review_and_summary_mail_btn" type="checkbox" name="member_review_and_summary_mail_btn" <?= $member_review_and_summary_mail == 1 ? 'checked' : '' ?>> <label class="switch">
<span class="slider round" style="height: 27px;"></span> <input id="client_hr_summary_mail_btn" type="checkbox" name="client_hr_summary_mail_btn" <?= $client_hr_summary_mail == 1 ? 'checked' : '' ?>>
</label> <span class="slider round"></span>
&nbsp; &nbsp; </label>
<a href="" data-toggle="modal" id="member_review_and_summary_mail" onclick="getMailTemplateData(this)" data-target="#member_review_and_summary_mail_modal">Edit</a> <span class="ml-2">Client HR summary mail</span>
</div> </div>
</div> <div class="right">
<a href="" data-toggle="modal" id="client_hr_summary_mail" onclick="getMailTemplateData(this)" data-target="#client_hr_summary_mail_modal">
<div class="form-row"> <i class="mdi mdi-pencil"></i>
<div class="form-group col-md-6 mail-section"> </a>
<label for="branch_name">Account Manager summary mail</label> </div>
<label class="switch"> </div>
<input id="account_maneger_summary_mail_btn" type="checkbox" name="account_maneger_summary_mail_btn" <?= $account_maneger_summary_mail ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="account_maneger_summary_mail" onclick="getMailTemplateData(this)" data-target="#account_maneger_summary_mail_modal">Edit</a>
</div>
<div class="form-group col-md-6 mail-section">
<label for="branch_name">Client HR summary mail</label>
<label class="switch">
<input id="client_hr_summary_mail_btn" type="checkbox" name="client_hr_summary_mail_btn" <?= $client_hr_summary_mail == 1 ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="client_hr_summary_mail" onclick="getMailTemplateData(this)" data-target="#client_hr_summary_mail_modal">Edit</a>
</div> </div>
</div> </div>
@ -184,6 +309,8 @@
<a style="float:right;" id="notification_enable_form_submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</a> <a style="float:right;" id="notification_enable_form_submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</a>
</div> </div>
</div> </div>
</div> </div>
<!-- </form> --> <!-- </form> -->
@ -595,9 +722,9 @@
<hr> <hr>
<!-- Unlayer editor --> <!-- Unlayer editor -->
<!-- <div class="form-row" id="rac_rate_dropdown"> --> <!-- <div class="form-row" id="rac_rate_dropdown"> -->
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="account_maneger_summary_mail_editor_container" style="height: 600px"></div> <div id="account_maneger_summary_mail_editor_container" style="height: 600px"></div>
</div> </div>
<!-- </div> --> <!-- </div> -->
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1 preview_button" <button class="btn btn-primary waves-effect waves-light mr-1 preview_button"
@ -663,48 +790,48 @@
</select> </select>
</div> </div>
</div> --> </div> -->
</div> --> </div> -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<select id="client_hr_summary_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)"> <select id="client_hr_summary_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
<option value="">PlaceHolders</option> <option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?> <?php foreach ($placeHolders as $value): ?>
<?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?> <?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?>
<?php $valueChange = str_replace('_', ' ', $value); <?php $valueChange = str_replace('_', ' ', $value);
$valueChange = ucwords($valueChange); ?> $valueChange = ucwords($valueChange); ?>
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option> <option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
<?php } ?> <?php } ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<span id="copy-feedback" style="display: none; position: absolute; top: 50px; right: 10px; color: green; font-size: 12px;">Copied to clipboard!</span> <span id="copy-feedback" style="display: none; position: absolute; top: 50px; right: 10px; color: green; font-size: 12px;">Copied to clipboard!</span>
</div>
</div> </div>
<hr> </div>
<!-- Unlayer editor --> <hr>
<div class="form-row" id="rac_rate_dropdown"> <!-- Unlayer editor -->
<div class="form-group col-md-12"> <div class="form-row" id="rac_rate_dropdown">
<div id="client_hr_summary_mail_editor_container" style="height: 600px"></div> <div class="form-group col-md-12">
</div> <div id="client_hr_summary_mail_editor_container" style="height: 600px"></div>
</div> </div>
<div id="editor"></div>
<input type="file" id="Question_title_fileInput" style="display: none;">
</div> </div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1 preview_button" <div id="editor"></div>
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button> <input type="file" id="Question_title_fileInput" style="display: none;">
</div>
</form>
</div> </div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> <div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1 preview_button"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<!-- /.modal --> <!-- /.modal -->
@ -1376,7 +1503,7 @@
console.log("Creating new editor instance..."); console.log("Creating new editor instance...");
editor = unlayer.createEditor({ editor = unlayer.createEditor({
id: `${template_name}_editor_container`, id: `${template_name}_editor_container`,
projectId: <?=getenv('unlayer.projectID') ?>, projectId: <?= getenv('unlayer.projectID') ?>,
displayMode: "email", displayMode: "email",
features: { features: {
textEditor: { textEditor: {
@ -1386,7 +1513,9 @@
enabled: true, enabled: true,
deviceOptions: ['desktop', 'mobile'] deviceOptions: ['desktop', 'mobile']
}, },
preview: { enabled: true }, preview: {
enabled: true
},
imageEditor: { imageEditor: {
enabled: true enabled: true
}, },
@ -1434,7 +1563,7 @@
function getMailTemplateData(element) { function getMailTemplateData(element) {
template_name = element.id; template_name = element.id;
const validTemplates = [ const validTemplates = [
"account_maneger_summary_mail", "member_reminder_mail", "member_ecard_mail", "member_welcome_mail","member_review_and_summary_mail","client_hr_summary_mail" "account_maneger_summary_mail", "member_reminder_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail"
]; ];
if (!validTemplates.includes(template_name)) { if (!validTemplates.includes(template_name)) {
@ -1953,52 +2082,85 @@
}); });
} }
} }
$(document).on('click', '#notification_enable_form_submit', function() { $(document).on('click', '#notification_enable_form_submit', function() {
var formData = []; var formData = [];
console.log($('#hr_mail_id').val()); console.log($('#hr_mail_id').val());
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()}) formData.push({
formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() }); name: 'client_id',
formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() }); value: $('#general_PrimaryKey').val()
formData.push({ name: 'mail_domain', value: $('#mail_domain').val() }); })
formData.push({ name: 'reply_to', value: $('#reply_to').val() }); formData.push({
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') }); name: 'nhance_team_mail_ids',
formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') }); value: $('#nhance_team_mail_ids').val()
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') }); });
formData.push({ name: 'member_review_and_summary_mail_btn', value: $('#member_review_and_summary_mail_btn').prop('checked') }); formData.push({
formData.push({ name: 'account_maneger_summary_mail_btn', value: $('#account_maneger_summary_mail_btn').prop('checked') }); name: 'hr_mail_id',
formData.push({ name: 'client_hr_summary_mail_btn', value: $('#client_hr_summary_mail_btn').prop('checked') }); value: $('#hr_mail_id').val()
});
formData.push({
name: 'mail_domain',
value: $('#mail_domain').val()
});
formData.push({
name: 'reply_to',
value: $('#reply_to').val()
});
formData.push({
name: 'member_welcome_mail_btn',
value: $('#member_welcome_mail_btn').prop('checked')
});
formData.push({
name: 'member_reminder_mail_btn',
value: $('#member_reminder_mail_btn').prop('checked')
});
formData.push({
name: 'member_ecard_mail_btn',
value: $('#member_ecard_mail_btn').prop('checked')
});
formData.push({
name: 'member_review_and_summary_mail_btn',
value: $('#member_review_and_summary_mail_btn').prop('checked')
});
formData.push({
name: 'account_maneger_summary_mail_btn',
value: $('#account_maneger_summary_mail_btn').prop('checked')
});
formData.push({
name: 'client_hr_summary_mail_btn',
value: $('#client_hr_summary_mail_btn').prop('checked')
});
var form_action = '<?= base_url("client/notification/update_enable") ?>'; var form_action = '<?= base_url("client/notification/update_enable") ?>';
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$.ajax({ $.ajax({
url: form_action, url: form_action,
type: "POST", type: "POST",
data: formData, data: formData,
dataType: 'json', dataType: 'json',
success: function(res) success: function(res) {
{ if (res.status == true) {
console.log(res); toastr.success('Update Successfully');
if (res) }
{
toastr.success('Update Successfully'); if (res.status == false) {
} let empty_templates = res.empty_templates.join(", ");
toastr.warning(`Updation Failed. The following templates were empty: ${empty_templates}`);
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, toastr.warning('Something Wrong!', 'warning');
error: function (xhr, status, error) }, 1000);
{ }
console.error(xhr.responseText); });
console.error(status, error); })
setTimeout(function()
{
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
})
</script> </script>

View File

@ -95,6 +95,21 @@
/* margin-left: 141px; */ /* margin-left: 141px; */
width: 576px; width: 576px;
} }
#policyGMCTerms input ,
#policyGMCTerms select,
#policyGMCTerms .select2-container .select2-selection--single ,
#policyGMCTerms .select2-container .select2-selection--multiple {
background-color: #ECECEC !important;
border:1px solid #ECECEC !important;
box-shadow: none !important;
}
.policy-base-info{
margin-top:10px;
}
</style> </style>
<div id="policyGMCTerms" style="display:none"> <div id="policyGMCTerms" style="display:none">
@ -112,196 +127,173 @@
<div class="form-group"> <div class="form-group">
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col-md-4">
<label for="sumInsured">Sum Insured</label> <div class="col">
</div> <div class="d-flex align-items-center gap-2">
<div class="col-md-4"> <label for="sumInsured" class="form-label" >Sum Insured</label>
<input style="width: 128%;" type="text" name="sum_insured" id="sum_insured" class="form-control" <input class="form-control mr-2" type="text" name="sum_insured" id="sum_insured" style="max-width:200px;"
onkeypress="return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)"> onkeypress="return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)">
</div> <button type="button" class="btn btn-primary si-add-more mr-2" onclick="appendGMCSIAddMore()"
<div class="col-md-2" style="position: relative;left: 88px;"> style="background-color: #e26728; border:1px solid #e26728;"
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button> >
</div> <i class="mdi mdi-plus"></i>
<div class="col-md-4"> </button>
</div> <div id='numberToWordGMC' class="text-danger-2 mr-2"></div>
<div class="col-md-4"> </div>
<div id='numberToWordGMC' class="text-danger-2"></div>
</div> </div>
</div> </div>
<div id="gmc_si_add_more"></div> <div id="gmc_si_add_more"></div>
<div class="row" style="margin-bottom:10px;">
<div class="col">
<label for="totalSumInsured" class="form-label me-3">Family Floater</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="familyFloaterYes" name="family_floater" value="1">
<label class="form-check-label" for="familyFloaterYes">Yes</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="familyFloaterNo" name="family_floater" value="0">
<label class="form-check-label" for="familyFloaterNo">No</label>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col"
style="background-color: #F5FFFF;border-radius:10px;box-shadow: 0px 2px 2px 0px #00000040;
padding:20px;">
<div class="col-md-4"> <div class="d-flex align-items-center policy-base-info">
<label for="totalSumInsured">Family Floater</label> <input type="checkbox" style="margin-right: 10px;color:black;"
</div> name="family_floaters[]" value="self" id="self" checked>
<div class="col-md-6"> <span style="margin-right:150px;color:black;">Self:</span>
&nbsp;&nbsp; <input type="radio" id="familyFloaterYes" name="family_floater" class="family_floater" value="1"> <div class="self-age">
<label for="familyFloaterYes">Yes</label> <span style="margin-right:10px;color:black;;">Min Age:</span>
<input
<br>
<input type="radio" id="familyFloaterNo" name="family_floater" class="family_floater" value="0" style="margin-left:10px">
<label for="familyFloaterNo">No</label>
</div>
<div class="col-md-4">
</div>
<div class="col-md-8" style="margin-bottom:10px">
<table data-custom-table-css="table">
<tbody>
<tr>
<td style="width: 11%;"><span style="margin-right:20px;color:black;">Self:</span></td>
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;color:black;"
name="family_floaters[]" value="self" id="self" checked> </td>
<td style="width: 28%;">
<div class="self-age"><span style="margin-right:20px;color:black;;">Min Age:</span><input
class="underline-input min_age" class="underline-input min_age"
value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>"
style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age"
onchange="lowerIsEighteen(this)"> onchange="lowerIsEighteen(this)">
</div> </div>
</td>
<td style="width: 28%;"> <div class="self-age">
<div class="self-age"><span style="margin-right:20px;color:black;">Max Age:</span><input <span style="margin-right:10px;color:black;">Max Age:</span>
<input
class="underline-input max_age" class="underline-input max_age"
value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>"
style="width: 35%;;" type="number" name="self_max_age" id="self_max_age" style="width: 35%;;" type="number" name="self_max_age" id="self_max_age"
onchange="lowerIsEighteen(this)"></div> onchange="lowerIsEighteen(this)">
</td> </div>
<!-- <td style="width: 11%;"><span class="self-age" </div>
style="margin-right:20px;color:black;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="self-age" type="checkbox" <div class="d-flex align-items-center policy-base-info">
style="margin-right: 70px;" name="is_payable_employee_for_self" <input type="checkbox" style="margin-right:10px;"
id="is_payable_employee_for_self"> </td> --> name="family_floaters[]" value="spouse" id="spouse">
</tr>
<tr> <span style="margin-right:125px;color:black;">
<td style="width: 11%;"><span style="margin-right:20px;color:black;">Spouse:</span></td> Spouse:</span>
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"
name="family_floaters[]" value="spouse" id="spouse"></td> <div class="spouse-age"><span style="margin-right:10px;color:black;">Min Age:</span>
<td style="width: 28%;"> <input
<div class="spouse-age"><span style="margin-right:20px;color:black;">Min Age:</span><input
class="underline-input min_age" class="underline-input min_age"
value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>"
style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age"
onchange="lowerIsEighteen(this)"></div> onchange="lowerIsEighteen(this)">
</td> </div>
<td style="width: 28%;">
<div class="spouse-age"><span style="margin-right:20px;color:black;">Max Age:</span><input <div class="spouse-age"><span style="margin-right:10px;color:black;">Max Age:</span>
<input
class="underline-input max_age" class="underline-input max_age"
value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>"
style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age"
onchange="lowerIsEighteen(this)"></div> onchange="lowerIsEighteen(this)">
</td> </div>
<!-- <td style="width: 11%;"><span class="spouse-age" </div>
style="margin-right:20px;color:black;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="spouse-age" type="checkbox" <div class="d-flex align-items-center policy-base-info">
style="margin-right: 70px;" name="is_payable_employee_for_spouse" <span for="children" style="color:black;" class="mr-2">Children:</span>
id="is_payable_employee_for_spouse"> </td> -->
</tr> <select name="family_floaters[]" id="children" style="margin-right:60px;" class="px-1" >
<tr>
<td style="width: 11%;"><span for="children" style="color:black;">Children:</span></td>
<td style="width: 11%;"><select name="family_floaters[]" id="children">
<option value="0">None</option> <option value="0">None</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="3">3</option> <option value="3">3</option>
<option value="4">4</option> <option value="4">4</option>
</select> </select>
</td>
<td style="width: 28%;"> <div class="child-age"><span style="margin-right:10px;color:black;">Min Age:</span>
<div class="child-age"><span style="margin-right:20px;color:black;">Min Age:</span><input <input
class="underline-input min_age" class="underline-input min_age"
value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>"
style="width: 35%;;" type="number" name="child_min_age" id="child_min_age" style="width: 35%;;" type="number" name="child_min_age" id="child_min_age"
oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div> oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div>
</td>
<td style="width: 28%;"> <div class="child-age"><span style="margin-right:10px;color:black;">Max Age:</span>
<div class="child-age"><span style="margin-right:20px;color:black;">Max Age:</span><input <input
class="underline-input max_age" class="underline-input max_age"
value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>"
style="width: 35%;;" type="number" name="child_max_age" id="child_max_age" style="width: 35%;;" type="number" name="child_max_age" id="child_max_age"
oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div> oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
</td> </div>
<!-- <td style="width: 11%;"><span class="child-age" </div>
style="margin-right:20px;color:black;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="child-age" type="checkbox"
style="margin-right: 70px;" name="is_payable_employee_for_child"
id="is_payable_employee_for_child"> </td> -->
</tr>
</tbody> <div class="d-flex align-items-center policy-base-info flex-nowrap">
</table>
<div style="margin-top:10px"></div> <!-- Select Other Members -->
<div style="margin-top:10px"></div> <div class="d-flex align-items-center">
<span class="me-2 fw-bold text-dark mr-3">
<b>Select Other Members:</b>
</span>
<select name="family_floaters[]" id="family_floaters" class="form-select mr-3 px-1">
<option value="0">None</option>
<option value="1P">Only one parent (Either Father / Mother)</option>
<option value="2P">Only two parents (Father+Mother)</option>
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIL, FIL)</option>
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
</select>
</div>
<div style="margin-top:10px"> <!-- Elders Count -->
<span for="family_floaters" style="color:black;"><b>Select Other Members:</b></span> <div class="d-flex align-items-center">
<select name="family_floaters[]" id="family_floaters" style="margin-left: 10px;"> <span class="me-2 text-dark" style="margin-right:10px;color:black;">Elders Count:</span>
<option value="0">None</option> <input class="underline-input" type="number" style="width: 35%;"
<option value="1P">Only one parent (Either Father / Mother)</option> name="elder_member_count" id="member_count" readonly>
<option value="2P">Only two parents (Father+Mother)</option> </div>
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIl, FIL)</option>
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
</select>
</div>
<div style="margin-top:10px"> <!-- Min Age -->
<table data-custom-table-css="table"> <div class="d-flex align-items-center">
<tbody> <span class="me-2 text-dark" style="margin-right:10px;color:black;">Min Age:</span>
<tr> <input class="underline-input" type="number"
<td style="width: 22%;"> name="other_member_min_age" id="other_member_min_age" style="width: 35%;"
<div class="other-member-age"><span style="margin-right:20px;color:black;">Elders value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>"
Count:</span><input class="underline-input" id="member_count" onchange="lowerIsEighteen(this)">
style="width: 30%; width: 30%;" type="number" </div>
name="elder_member_count" id="member_count" readonly></div>
</td> <!-- Max Age -->
<td style="width: 28%;"> <div class="d-flex align-items-center">
<div class="other-member-age" style="margin-left: 32px;"><span <span class="me-2 text-dark" style="margin-right:10px;color:black;">Max Age:</span>
style="margin-right:20px;color:black;">Min Age:</span><input <input class="underline-input" type="number"
class="underline-input min_age" name="other_member_max_age" id="other_member_max_age" style="width: 35%;"
value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>"
style="width: 35%;;" type="number" class="underline-input min_age" onchange="lowerIsEighteen(this)">
name="other_member_min_age" id="other_member_min_age" </div>
onchange="lowerIsEighteen(this)"></div>
</td> </div>
<td style="width: 28%;">
<div class="other-member-age" style="margin-left: 17px;"><span
style="margin-right:20px;color:black;">Max Age:</span><input
class="underline-input max_age"
value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>"
style="width: 35%;;" type="number" class="underline-input max_age"
name="other_member_max_age" id="other_member_max_age"
onchange="lowerIsEighteen(this)"></div>
</td>
<!-- <td style="width: 11%;"><span class="other-member-age"
style="margin-right:20px;color:black;font-size: 12px;">Is Payable by employee:</span>
</td>
<td style="width: 11%;"><input class="other-member-age" type="checkbox"
style="margin-right: 70px;" name="is_payable_employee_for_elders"
id="is_payable_employee_for_elders"> </td> -->
</tr>
</tbody>
</table>
</div>
</div> </div>
</div> </div>
<hr>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col-md-1"> <div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="waiverofpreexistingdiseases_display" id="waiverofpreexistingdiseases_display" class="unchecked" checked> <input type="checkbox" style="margin-top: 12px" name="waiverofpreexistingdiseases_display" id="waiverofpreexistingdiseases_display" class="unchecked" checked>
@ -1762,22 +1754,28 @@
var html = ` var html = `
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col-md-4"> <div class="col">
<label for="sumInsured">Additional Sum Insured</label> <div class="d-flex align-items-center gap-2">
</div> <label for="sumInsured" class="form-label" >Additional Sum Insured</label>
<div class="col-md-4"> <input class="form-control mr-2" style="max-width:200px;"
<input style="width: 128%;" value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)"> value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]"
</div> class="form-control multiple_sum_insured mr-2" onkeypress="return onlyNumbers(event)"
<div class="col-md-2" style="position: relative;left: 88px;"> onkeyup="formatNumber(this); numtowordinkeyup(this)">
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button> <button type="button" class="btn btn-danger si-remove-multi mr-2" onclick="removeGMCAdditionalSI(this)"
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button> style="background-color: #BD0707;border:1px solid #BD0707">
</div> <i class="mdi mdi-delete"></i>
<div class="col-md-4"> </button>
</div> <button type="button" class="btn btn-primary si-add-more mr-2" onclick="appendGMCSIAddMore()"
<div class="col-md-4"> style="background-color: #e26728; border:1px solid #e26728;"
<div class="text-danger-2 numberToWordSumInsured"></div> >
</div> <i class="mdi mdi-plus"></i>
</div>`; </button>
<div id='numberToWordSumInsured' class="text-danger-2 mr-2"></div>
</div>
</div>
</div>
`;
$('#gmc_si_add_more').append(html); $('#gmc_si_add_more').append(html);
} }

View File

@ -74,6 +74,16 @@
width: 689px; width: 689px;
} }
#policyGPATermsForm input ,
#policyGPATermsForm select,
#policyGPATermsForm .select2-container .select2-selection--single ,
#policyGPATermsForm .select2-container .select2-selection--multiple {
background-color: #ECECEC !important;
border:1px solid #ECECEC !important;
box-shadow: none !important;
}
</style> </style>
<div id="policyGPATermsForm" style="display:none"> <div id="policyGPATermsForm" style="display:none">
@ -101,7 +111,11 @@
<label for="sumInsured" class="form-label" >Sum Insured</label> <label for="sumInsured" class="form-label" >Sum Insured</label>
<input class="form-control mr-2" type="text" name="sumInsured2" id="sumInsured2" style="max-width:200px;" <input class="form-control mr-2" type="text" name="sumInsured2" id="sumInsured2" style="max-width:200px;"
onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)"> onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
<button type="button" class="btn btn-primary si-add-more mr-2" onclick="appendGPASIAddMore()">+</button> <button type="button" class="btn btn-primary si-add-more mr-2" onclick="appendGPASIAddMore()"
style="background-color: #e26728; border:1px solid #e26728;"
>
<i class="mdi mdi-plus"></i>
</button>
<div id='numberToWordSumInsured' class="text-danger-2 mr-2"></div> <div id='numberToWordSumInsured' class="text-danger-2 mr-2"></div>
</div> </div>
@ -123,43 +137,33 @@
</div> </div>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col"> <div class="col d-flex align-items-center"
<table data-custom-table-css="table"> style="background-color: #F5FFFF;border-radius:10px;box-shadow: 0px 2px 2px 0px #00000040;
<tbody> padding:20px;">
<tr>
<td>
<input disabled type="checkbox" style="color:black;" name="family_floaters[]"
value="self" id="self" checked>
</td>
<td >
<span style="margin-right: 20px;color:black;">Self</span>
</td>
<td >
<div class="self-age">
<span style="margin-right: 20px;color:black;">Min Age:</span>
<input class="underline-input min_age"
style="background-color: white !important;"
value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>"
type="number" name="self_min_age" id="self_min_age_gpa"
onchange="lowerIsEighteen(this)">
</div>
</td>
<td >
<div class="self-age">
<span style="margin-right: 20px;color:black;">Max Age:</span>
<input class="underline-input max_age"
style="background-color:white !important"
value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>"
type="number" name="self_max_age" id="self_max_age_gpa"
onchange="lowerIsEighteen(this)">
</div>
</td>
</tr>
</tbody> <input disabled type="checkbox" style="color:black;" name="family_floaters[]"
</table> value="self" id="self" checked>
<span style="margin-right: 40px;color:black;">Self</span>
<div class="self-age" style="margin-right: 20px;">
<span style="margin-right: 20px;color:black;">Min Age:</span>
<input class="underline-input min_age"
style="background-color: white !important;"
value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>"
type="number" name="self_min_age" id="self_min_age_gpa"
onchange="lowerIsEighteen(this)">
</div>
<div class="self-age" style="margin-right: 20px;">
<span style="margin-right: 20px;color:black;">Max Age:</span>
<input class="underline-input max_age"
style="background-color:white !important"
value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>"
type="number" name="self_max_age" id="self_max_age_gpa"
onchange="lowerIsEighteen(this)">
</div>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
@ -403,15 +407,13 @@
</div> </div>
<hr>
<div class="gpa_special_condition"> <div class="gpa_special_condition">
</div> </div>
<br> <br>
<div class="form-group text-right m-b-0" style="margin-top: -49px;"> <div class="form-group text-right m-b-0" style="margin-top: -49px;">
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special Condition</a> <a href="#" class="btn button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special Condition</a>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
</div> </div>
</form> </form>
@ -925,8 +927,14 @@
style="max-width:200px;" style="max-width:200px;"
value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]"
class="form-control multiple_sum_insured mr-2" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)"> class="form-control multiple_sum_insured mr-2" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
<button type="button" class="btn btn-danger si-remove-multi mr-2" onclick="removeGMCAdditionalSI(this)">x</button> <button type="button" class="btn btn-danger si-remove-multi mr-2" onclick="removeGMCAdditionalSI(this)"
<button type="button" class="btn btn-primary si-add-more mr-2" onclick="appendGPASIAddMore()">+</button> style="background-color: #BD0707;border:1px solid #BD0707">
<i class="mdi mdi-delete"></i>
</button>
<button type="button" class="btn btn-primary si-add-more mr-2" onclick="appendGPASIAddMore()"
style="background-color: #e26728; border:1px solid #e26728;" >
<i class="mdi mdi-plus"></i>
</button>
<div id='numberToWordSumInsured' class="text-danger-2 "></div> <div id='numberToWordSumInsured' class="text-danger-2 "></div>
</div> </div>
</div> </div>