From 44c3506704187b9224b3965b49ec0d76025b347b Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 28 Jan 2025 15:26:49 +0530 Subject: [PATCH] FEAT_CLAIM_MAIL_EDITOR_SRI --- app/Config/Routes.php | 4 +- app/Controllers/TicketController.php | 76 ++++- app/Models/TicketMailTemplateModel.php | 2 +- app/Models/TicketNoteModel.php | 2 +- app/Views/ticket_mail_template.php | 425 +++++++++++++++++++++++-- app/Views/ticket_note.php | 2 +- 6 files changed, 481 insertions(+), 30 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index eb828452..bf6d4c6f 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -499,6 +499,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->post('create','TicketController::createTicket'); $routes->get('update','TicketController::updateTicket'); $routes->get('view/(:any)','TicketController::view_ticket/$1'); - $routes->get('mail_template','TicketController::createMailTemplate'); + $routes->get('mail_template','TicketController::mailTemplate'); + $routes->post('crud_mail_template/(:any)','TicketController::crudTemplate/$1'); + $routes->post('note','TicketController::crudNote'); }); diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index c489e247..392f1fd0 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -27,6 +27,7 @@ class TicketController extends BaseController protected $modeOFIntimate; protected $claimType; protected $claimStatus; + protected $placeHolders; protected $clientModel; protected $ticketMasterModel; @@ -34,6 +35,7 @@ class TicketController extends BaseController protected $ticketMailTemplateModel; protected $ticketMesageModel; protected $ticketNoteModel; + protected $triggerType; public function __construct() { @@ -80,10 +82,25 @@ class TicketController extends BaseController 4 => "Death", ] ]; + $this->triggerType = [ + 1 => "Trigger 1", + 2 => "Trigger 2", + 3 => "Trigger 3", + 4 => "Trigger 4", + 5 => "Trigger 5", + 6 => "Trigger 6", + 7 => "Trigger 7" + ]; + + $this->placeHolders = ['member_name', 'nhance_logo', 'tpa_id', 'ecard_download_link', + 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', + 'client_name']; + $this->ticketMasterModel = new TicketMasterModel(); $this->claimStatus = new TicketClaimStatusModel(); $this->clientModel = new ClientModel(); $this->ticketHistoryModel = new TicketHistoryModel(); + $this->ticketMailTemplateModel = new TicketMailTemplateModel(); } @@ -177,6 +194,7 @@ class TicketController extends BaseController public function view_ticket($ticket_id) { $data = []; + $data['ticket_note'] = $this->ticketNoteModel->where('is_active', 1)->findAll(); return $this->loadLayout('ticket_edit_onbording', $data); } @@ -215,11 +233,63 @@ class TicketController extends BaseController { } - public function createMailTemplate() + public function mailTemplate() { - $data = []; - return $this->loadLayout('ticket_mail_template', $data); + $data = []; + $data['trigger_type'] = $this->triggerType; + $data['policy_type'] = $this->ticketType; + $data['placeHolders'] = $this->placeHolders; + $data['ticket_data'] = $this->ticketMailTemplateModel->where('is_active',1)->findAll(); + $data['ticket_type'] = $this->ticketType; + $data['trigger_type'] = $this->triggerType; + return $this->loadLayout('ticket_mail_template', $data); } + public function crudTemplate($action){ + //action 1 is create. action 2 is edit and action 3 is delete + if ($action == 1){ + $received_data = $this->request->getPost(); + if (isset($received_data['id']) && $received_data['id'] != '' ){ + $status = $this->ticketMailTemplateModel->save($received_data); + if ($status){ + return $this->respond(['status'=> true],200); + }else{ + return $this->respond(['status' => false],200); + } + }else{ + $status = $this->ticketMailTemplateModel->save($received_data); + if ($status){ + return $this->respond(['status'=> true],200); + }else{ + return $this->respond(['status' => false],200); + } + } + + } + elseif ($action == 2){ + $table_id = (int)$this->request->getPost('id'); + $data = $this->ticketMailTemplateModel->where('id',$table_id)->where('is_active',1)->first(); + if ($data){ + return $this->respond(['status' => true,'data'=> $data],200); + }else{ + return $this->respond(['status' => false],404); + } + } + elseif ($action == 3){ + $table_id = (int)$this->request->getPost('id'); + + $sql = "update ticket_mail_template set is_active = 0 where id = $table_id "; + $status = $this->ticketMailTemplateModel->query($sql); + if($status){ + return $this->respond(['status'=> true],200); + }else{ + return $this->respond(['status' => false],404); + } + } + } + + public function crudNote(){ + + } } \ No newline at end of file diff --git a/app/Models/TicketMailTemplateModel.php b/app/Models/TicketMailTemplateModel.php index 609338bb..e1059e8b 100644 --- a/app/Models/TicketMailTemplateModel.php +++ b/app/Models/TicketMailTemplateModel.php @@ -12,7 +12,7 @@ class TicketMailTemplateModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = []; + protected $allowedFields = ['id','template_name','subject','ticket_type','is_auto_mail','trigger_type','mail_content']; // Callbacks protected $allowCallbacks = true; diff --git a/app/Models/TicketNoteModel.php b/app/Models/TicketNoteModel.php index c9c10746..7efe2281 100644 --- a/app/Models/TicketNoteModel.php +++ b/app/Models/TicketNoteModel.php @@ -12,7 +12,7 @@ class TicketNoteModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = ['id,created_by','updated_by','is_active']; + protected $allowedFields = ['id','ticket_id','note','created_by','updated_by','is_active']; // Callbacks protected $allowCallbacks = true; diff --git a/app/Views/ticket_mail_template.php b/app/Views/ticket_mail_template.php index f48b20d2..dec3c5cb 100644 --- a/app/Views/ticket_mail_template.php +++ b/app/Views/ticket_mail_template.php @@ -24,6 +24,33 @@ table.dataTable tbody td { .addbtnStyle { margin-left: 20px !important; } + +.custom-dropdown-menu { + display: none; + position: absolute; + background-color: #ffffff !important; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0.25rem; + padding: 0.5rem 0; + min-width: 10rem; + z-index: 9999; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +.custom-dropdown-menu .dropdown-item { + display: block !important; + width: 100% !important; + padding: 0.5rem 1rem !important; + color: #212529 !important; + text-decoration: none !important; + background-color: transparent !important; +} + +.custom-dropdown-menu .dropdown-item:hover { + background-color: #f8f9fa !important; + color: #16181b !important; + cursor: pointer !important; +}
@@ -40,17 +67,29 @@ table.dataTable tbody td { Template Name - Status Policy Type + Trigger Type + Mail Send Type + Actions $row){ ?> - - - + + + + + + + @@ -74,52 +113,84 @@ table.dataTable tbody td {