Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/FOUR-20300: Inbox in Home Page - Implement General Inbox features-part 1 #7835

Open
wants to merge 5 commits into
base: epic/FOUR-20297
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ProcessMaker/Traits/TaskControllerIndexMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
6 changes: 6 additions & 0 deletions resources/js/tasks/components/ListMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -108,6 +113,7 @@ const ListMixin = {
}${this.getSortParam()
}&non_system=true` +
`&processesIManage=${(this.processesIManage ? 'true' : 'false')}` +
getAllTasksInbox +
advancedFilter +
this.columnsQuery,
{
Expand Down
Loading