diff --git a/ProcessMaker/Traits/TaskControllerIndexMethods.php b/ProcessMaker/Traits/TaskControllerIndexMethods.php index 078843c950..b4209bede0 100644 --- a/ProcessMaker/Traits/TaskControllerIndexMethods.php +++ b/ProcessMaker/Traits/TaskControllerIndexMethods.php @@ -22,8 +22,21 @@ private function indexBaseQuery($request) $includes = $request->has('include') ? explode(',', $request->input('include')) : []; // Determine if the data should be included $includeData = in_array('data', $includes); + + $query = ProcessRequestToken::exclude(['data']); - $query = ProcessRequestToken::exclude(['data'])->with([ + // If all_inbox is true and user has process requests, filter to only show the latest process + if ($request->has('all_inbox') && $request->input('all_inbox') === 'false') { + $latestProcessRequest = ProcessRequestToken::where('user_id', auth()->id()) + ->orderBy('created_at', 'desc') + ->first(); + + if ($latestProcessRequest) { + $query->where('process_id', $latestProcessRequest->process_id); + } + } + + $query = $query->with([ 'processRequest' => function ($q) use ($includeData) { if (!$includeData) { return $q->exclude(['data']); diff --git a/resources/js/tasks/components/ListMixin.js b/resources/js/tasks/components/ListMixin.js index a0a2827bf9..9fc0a93ea0 100644 --- a/resources/js/tasks/components/ListMixin.js +++ b/resources/js/tasks/components/ListMixin.js @@ -94,6 +94,11 @@ const ListMixin = { if (this.additionalIncludes) { include.push(...this.additionalIncludes); } + + let getAllTasksInbox = "&all_inbox=false"; + if (this.$parent.allInbox) { + getAllTasksInbox = "&all_inbox=true"; + } // Load from our api client ProcessMaker.apiClient .get( @@ -108,6 +113,7 @@ const ListMixin = { }${this.getSortParam() }&non_system=true` + `&processesIManage=${(this.processesIManage ? 'true' : 'false')}` + + getAllTasksInbox + advancedFilter + this.columnsQuery, { diff --git a/resources/js/tasks/components/ParticipantHomeScreen.vue b/resources/js/tasks/components/ParticipantHomeScreen.vue index cc12f71978..4df71961f7 100644 --- a/resources/js/tasks/components/ParticipantHomeScreen.vue +++ b/resources/js/tasks/components/ParticipantHomeScreen.vue @@ -1,206 +1,207 @@ - - - - + + \ No newline at end of file