From 05249beb5424519bbc9d4ef1c2cb2cd54db5a123 Mon Sep 17 00:00:00 2001 From: muhtasimhafiz Date: Wed, 22 Jan 2025 18:16:45 +0600 Subject: [PATCH] fix tickets search --- .../Projects/Controllers/NewProject.php | 11 +++---- app/Domain/Tickets/Controllers/ShowKanban.php | 2 -- .../Tickets/Hxcontrollers/TicketColumn.php | 10 +++++- .../components/ticket-column.blade.php | 33 ++++++------------- .../Tickets/Templates/showKanban.blade.php | 18 +++++++--- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/app/Domain/Projects/Controllers/NewProject.php b/app/Domain/Projects/Controllers/NewProject.php index efc5bb72f..ce44ff0c4 100644 --- a/app/Domain/Projects/Controllers/NewProject.php +++ b/app/Domain/Projects/Controllers/NewProject.php @@ -56,7 +56,7 @@ public function run() Auth::authOrRedirect([Roles::$owner, Roles::$admin, Roles::$manager], true); if (! session()->exists('lastPage')) { - session(['lastPage' => BASE_URL.'/projects/showAll']); + session(['lastPage' => BASE_URL . '/projects/showAll']); } $msgKey = ''; @@ -122,7 +122,7 @@ public function run() $mailer->setContext('project_created'); $mailer->setSubject($this->language->__('email_notifications.project_created_subject')); - $actual_link = BASE_URL.'/projects/showProject/'.$id.''; + $actual_link = BASE_URL . '/projects/showProject/' . $id . ''; $message = sprintf($this->language->__('email_notifications.project_created_message'), $actual_link, $id, $projectName, session('userdata.name')); $mailer->setHtml($message); @@ -139,12 +139,12 @@ public function run() $this->queueRepo->queueMessageToUsers($to, $message, $this->language->__('email_notifications.project_created_subject'), $id); //Take the old value to avoid nl character - $values['details'] = $_POST['details']; + $values['details'] = $_POST['details'] ?? $_POST; $this->tpl->sendConfetti(); - $this->tpl->setNotification(sprintf($this->language->__('notifications.project_created_successfully'), BASE_URL.'/leancanvas/simpleCanvas/'), 'success', 'project_created'); + $this->tpl->setNotification(sprintf($this->language->__('notifications.project_created_successfully'), BASE_URL . '/leancanvas/simpleCanvas/'), 'success', 'project_created'); - return Frontcontroller::redirect(BASE_URL.'/projects/showProject/'.$id); + return Frontcontroller::redirect(BASE_URL . '/projects/showProject/' . $id); } $this->tpl->assign('project', $values); @@ -161,5 +161,4 @@ public function run() return $this->tpl->display('projects.newProject'); } } - } diff --git a/app/Domain/Tickets/Controllers/ShowKanban.php b/app/Domain/Tickets/Controllers/ShowKanban.php index 983135402..bc8cc79e2 100644 --- a/app/Domain/Tickets/Controllers/ShowKanban.php +++ b/app/Domain/Tickets/Controllers/ShowKanban.php @@ -34,7 +34,6 @@ public function get(array $params): Response { $template_assignments = $this->ticketService->getTicketTemplateAssignments($params); array_map([$this->tpl, 'assign'], array_keys($template_assignments), array_values($template_assignments)); - $this->tpl->assign('allKanbanColumns', $this->ticketService->getKanbanColumns()); return $this->tpl->display('tickets.showKanban'); @@ -57,5 +56,4 @@ public function post(array $params): Response return Frontcontroller::redirect(CURRENT_URL); } } - } diff --git a/app/Domain/Tickets/Hxcontrollers/TicketColumn.php b/app/Domain/Tickets/Hxcontrollers/TicketColumn.php index fda6cebde..07bc7eb99 100644 --- a/app/Domain/Tickets/Hxcontrollers/TicketColumn.php +++ b/app/Domain/Tickets/Hxcontrollers/TicketColumn.php @@ -31,7 +31,16 @@ public function get($params): void { // $ticketId = (int) ($params['id']); $statusKey = (int) ($params['status']); + // dd($params); $allTickets = $this->ticketService->getAll($params); + + + // $searchCriteria = $this->ticketService->prepareTicketSearchArray($params); + // $searchCriteria['orderBy'] = 'kanbansort'; + + // $allTickets = $this->ticketService->getAllGrouped($searchCriteria); + // dd($params); + $ticketTypeIcons = $this->ticketService->getTypeIcons(); $priorities = $this->ticketService->getPriorityLabels(); $efforts = $this->ticketService->getEffortLabels(); @@ -47,6 +56,5 @@ public function get($params): void $this->tpl->assign("ticketTypeIcons", $ticketTypeIcons); $this->tpl->assign("priorities", $priorities); $this->tpl->assign("statusKey", $statusKey); - } } diff --git a/app/Domain/Tickets/Templates/components/ticket-column.blade.php b/app/Domain/Tickets/Templates/components/ticket-column.blade.php index 7bf09d3cc..9861f02cc 100644 --- a/app/Domain/Tickets/Templates/components/ticket-column.blade.php +++ b/app/Domain/Tickets/Templates/components/ticket-column.blade.php @@ -8,24 +8,20 @@ 'milestones' => [], 'users' => [], 'onTheClock' => false, - 'searchcriteria' => [] + 'searchCriteria' => [], ]) -@php - $searchcriteria['status'] = $status; -@endphp - -@if (!empty($searchcriteria)) +@if (!empty($searchCriteria)) @php - $queryString = http_build_query($searchcriteria); + $searchCriteria['status'] = $status; + $queryString = http_build_query($searchCriteria); $url = rtrim('/hx/tickets/ticketColumn/get', '?') . '?' . $queryString; @endphp @endif @if (!empty($status)) -
@@ -33,20 +29,11 @@
@foreach ($allTickets as $ticket) - @if ($ticket['status'] == $statusKey) -
- -
- @endif +
+ +
@endforeach
diff --git a/app/Domain/Tickets/Templates/showKanban.blade.php b/app/Domain/Tickets/Templates/showKanban.blade.php index b2618cfd3..1e40b76e8 100644 --- a/app/Domain/Tickets/Templates/showKanban.blade.php +++ b/app/Domain/Tickets/Templates/showKanban.blade.php @@ -2,11 +2,11 @@ @section('content') get('ticketTypeIcons'); - + $allTicketGroups = $allTickets; - + ?> @include('tickets::includes.ticketHeader') @@ -59,7 +59,8 @@ "> @foreach ($allKanbanColumns as $key => $statusRow)
-

+

0 {{ $tpl->e($statusRow['name']) }} @@ -136,6 +137,12 @@ class="mb-2 quickadd-ticket" data-key="{{ $key }}"> @endphp @if ($group['label'] != 'all') + @php + if (!empty($searchCriteria['groupBy']) && !empty($group['id'])) { + $groupBy = $searchCriteria['groupBy']; + $searchCriteria[$groupBy] = rtrim($group['id']); + } + @endphp