diff --git a/ProcessMaker/Http/Controllers/TaskController.php b/ProcessMaker/Http/Controllers/TaskController.php index 213d9374ab..afdd6d3441 100755 --- a/ProcessMaker/Http/Controllers/TaskController.php +++ b/ProcessMaker/Http/Controllers/TaskController.php @@ -108,13 +108,16 @@ public function edit(ProcessRequestToken $task, string $preview = '') { $task = $task->loadTokenInstance(); $dataManager = new DataManager(); - $userHasComments = Comment::where('commentable_type', ProcessRequestToken::class) - ->where('commentable_id', $task->id) - ->where('body', 'like', '%{{' . \Auth::user()->id . '}}%') - ->count() > 0; - if (!\Auth::user()->can('update', $task) && !$userHasComments) { - $this->authorize('update', $task); + if (!\Auth::user()->can('update', $task)) { + $userHasComments = Comment::where('commentable_type', ProcessRequestToken::class) + ->where('commentable_id', $task->id) + ->where('body', 'like', '%{{' . \Auth::user()->id . '}}%') + ->count() > 0; + + if (!$userHasComments) { + $this->authorize('update', $task); + } } //Mark notification as read @@ -178,7 +181,9 @@ public function edit(ProcessRequestToken $task, string $preview = '') ]); } - UserResourceView::setViewed(Auth::user(), $task); + dispatch(function () use ($task) { + UserResourceView::setViewed(Auth::user(), $task); + })->afterResponse(); $currentUser = Auth::user()->only([ 'id', 'username', @@ -189,7 +194,8 @@ public function edit(ProcessRequestToken $task, string $preview = '') 'timezone', 'datetime_format', ]); - $userConfiguration = (new UserConfigurationController())->index(); + //$userConfiguration = (new UserConfigurationController())->index(); + $userConfiguration = app(UserConfigurationController::class)->index(); $hitlEnabled = config('smart-extract.hitl_enabled', false) && $isSmartExtractTask; // Build the iframe source @@ -209,9 +215,11 @@ public function edit(ProcessRequestToken $task, string $preview = '') $iframeSrc = $dashboardUrl . '?' . $queryParams; } } + $canUpdateTask = Auth::user()->can('update', $task); return view('tasks.edit', [ 'task' => $task, + 'canUpdateTask' => $canUpdateTask, 'dueLabels' => self::$dueLabels, 'manager' => $manager, 'submitUrl' => $submitUrl, diff --git a/resources/js/tasks/edit.js b/resources/js/tasks/edit.js index d58fa5281b..9a4f6cc2ad 100644 --- a/resources/js/tasks/edit.js +++ b/resources/js/tasks/edit.js @@ -64,6 +64,10 @@ const main = new Vue({ userConfiguration, urlConfiguration: "users/configuration", showTabs: true, + loadedTabs: { + form: true, + data: false, + }, }, computed: { taskDefinitionConfig() { @@ -172,6 +176,14 @@ const main = new Vue({ this.setAllowReassignment(); }, methods: { + openDataTab() { + if (!this.loadedTabs.data) { + this.loadedTabs.data = true; + } + this.$nextTick(() => { + this.resizeMonaco(); + }); + }, defineUserConfiguration() { this.userConfiguration = JSON.parse(this.userConfiguration.ui_configuration); this.showMenu = this.userConfiguration.tasks.isMenuCollapse; @@ -288,8 +300,13 @@ const main = new Vue({ }, resizeMonaco() { this.showTree = false; - const editor = this.$refs.monaco.getMonaco(); - editor.layout({ height: window.innerHeight * 0.65 }); + const editor = this.$refs.monaco?.getMonaco?.(); + if (!editor) { + return; + } + editor.layout({ + height: window.innerHeight * 0.65, + }); }, prepareData() { this.updateRequestData = debounce(this.updateRequestData, 1000); diff --git a/resources/views/layouts/layoutnext.blade.php b/resources/views/layouts/layoutnext.blade.php index 0524f2abf8..420b8cc024 100644 --- a/resources/views/layouts/layoutnext.blade.php +++ b/resources/views/layouts/layoutnext.blade.php @@ -95,6 +95,7 @@ {!! config('global_header') !!} @endif + @stack('preload') @{{ __('Skip to Content') }} diff --git a/resources/views/tasks/edit.blade.php b/resources/views/tasks/edit.blade.php index 8bd7af00fd..061402a1cf 100644 --- a/resources/views/tasks/edit.blade.php +++ b/resources/views/tasks/edit.blade.php @@ -27,6 +27,14 @@ function() use ($task) { ], 'attributes' => 'v-cloak']) @endsection @section('content') +@push('preload') + + + + + + +@endpush