diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index e2ca1a06..90e039f6 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -93,7 +93,8 @@ class ThzController extends BaseController $data['page_name'] = "Ticket List"; $data['ticket_data'] = $tickets; - $data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['1', '5'])->findAll(); // enga 5-"head" and 1-"admin" role person thaan assignee.. + $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(); return $this->loadLayout('thz_list', $data); } @@ -160,6 +161,8 @@ class ThzController extends BaseController public function ticketConversationList(){ $data = $this->request->getGet(); + $data = $this->request->getGet(); + $returnType = strtolower($this->request->getGet('return_type') ?? 'api'); $thz_id = $data['thz_id'] ?? null; @@ -182,7 +185,20 @@ class ThzController extends BaseController return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); } - return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); + + if ($returnType === 'api') { + return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); + }else{ + $toGetRelated = $result['master'][0]['created_by']; + $result['related_tickets'] = $this->thzMasterModel + ->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') + ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left') + ->where('thz_master.created_by', $toGetRelated) + ->findAll(); + $result['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu + // 2,3,4 remain person varannum. + return $this->loadLayout('thz_notes', $result); + } } diff --git a/app/Models/ThzMasterNotesModel.php b/app/Models/ThzMasterNotesModel.php index 73e355bd..8654a936 100644 --- a/app/Models/ThzMasterNotesModel.php +++ b/app/Models/ThzMasterNotesModel.php @@ -12,7 +12,7 @@ class ThzMasterNotesModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = ['thz_id','notes','notes_by','notes_type','created_by','created_at']; + protected $allowedFields = ['thz_id','notes','notes_by','created_by','created_at','notes_type']; protected bool $allowEmptyInserts = false; diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index 1565e6fa..eb16be9b 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -1,54 +1,84 @@ @@ -103,18 +138,13 @@ thead tr th:last-child { Ticket Number Name - Mobile Number - Email - Emp Code Policy Number Ticket Type Subject - Message Status - Assignee - - ACTION - + Assign To + Created At + Updated At @@ -123,42 +153,30 @@ thead tr th:last-child { - - - - + + +
+ + - - - + - - + format('d/m/Y') . "
" . $cdt->format('h:i a') . ""; + endif; + ?> + + + format('d/m/Y') . "
" . $udt->format('h:i a') . ""; + endif; + ?> - @@ -222,6 +240,7 @@ thead tr th:last-child { +
@@ -270,17 +289,21 @@ thead tr th:last-child {
--> -
- - + + + + + - - -
+ + +
@@ -408,25 +431,6 @@ thead tr th:last-child { - - \ No newline at end of file