diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b6233e82..bafc5373 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -638,4 +638,5 @@ $routes->post('enrollment','VidalApiController::enrollment'); $routes->post("ticketSave", "ThzController::ticketSave"); $routes->get("ticketList", "ThzController::ticketList"); $routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); -$routes->get("ticketConversationList", "ThzController::ticketConversationList"); \ No newline at end of file +$routes->get("ticketConversationList", "ThzController::ticketConversationList"); +$routes->get('ticketAssigning',"ThzController::ticketAssigning"); \ No newline at end of file diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index c5fd2d17..2b9dafcc 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -37,18 +37,18 @@ class ThzController extends BaseController $data = $this->request->getJSON(true); - if (!empty($data['thz_id'])) { - $text = "update"; - $result = $this->updateTicket($data); - } else { - $text = "create"; - $result = $this->insertTicket($data); - } + if (!empty($data['thz_id'])) { + $text = "update"; + $result = $this->updateTicket($data); + } else { + $text = "create"; + $result = $this->insertTicket($data); + } - return $this->response->setJSON([ - 'status' => $result ? 'success' : 'error', - 'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again." - ]); + return $this->response->setJSON([ + 'status' => $result ? 'success' : 'error', + 'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again." + ]); } public function ticketList() @@ -111,6 +111,46 @@ class ThzController extends BaseController return $this->response->setJSON((['status' => 'success', 'data' => $result])); + } + + public function ticketSaveNotification($data){ + + } + + public function ticketConversationSaveNotification($data){ + + } + + public function ticketAssigning(){ + + $returnType = strtolower($this->request->getGet('return_type') ?? 'api'); + + $data = $this->request->getVar(); + + $assignee_id = $data['assignee_id']; + + $thz_id = $data['thz_id']; + + $result = $this->thzMasterModel->set('assign_to',$assignee_id)->where('thz_id',$thz_id)->update(); + + if($returnType === 'api'){ + + if(empty($result)){ + return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); + } + + return $this->response->setJSON((['status' => 'success', 'data' => $result])); + + }else{ + + + + } + + + + + } @@ -142,6 +182,23 @@ class ThzController extends BaseController return $this->thzMasterModel->findAll(); } + private function notificationBasedOnRole($data){ + + $id = $data['thz_id'] ?? null; + $assign_to = $data['assign_to'] ?? null; + $mobile = $data['mobile'] ?? null; + + if (!empty($assign_to)) { + + } + + if (!empty($id) && !empty($mobile)) { + + } + + + } + private function updateTicket($data){ $data['updated_by'] = get_session_userid(); diff --git a/app/Views/bds_dash.php b/app/Views/bds_dash.php index 24a5effa..9f27e8a2 100644 --- a/app/Views/bds_dash.php +++ b/app/Views/bds_dash.php @@ -160,7 +160,7 @@