From 2367026b8651d3e85b9320967cc69fa90f4b9442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Wed, 13 Sep 2023 17:26:51 -0300 Subject: [PATCH 01/27] Add required data for script and screens modal in modeler --- .../Controllers/Process/ModelerController.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ProcessMaker/Http/Controllers/Process/ModelerController.php b/ProcessMaker/Http/Controllers/Process/ModelerController.php index 5ebfb4f7cd..50743aeae1 100644 --- a/ProcessMaker/Http/Controllers/Process/ModelerController.php +++ b/ProcessMaker/Http/Controllers/Process/ModelerController.php @@ -10,6 +10,10 @@ use ProcessMaker\Managers\SignalManager; use ProcessMaker\Models\Process; use ProcessMaker\Models\ProcessRequest; +use ProcessMaker\Models\ScreenCategory; +use ProcessMaker\Models\ScreenType; +use ProcessMaker\Models\ScriptCategory; +use ProcessMaker\Models\ScriptExecutor; use ProcessMaker\PackageHelper; use ProcessMaker\Traits\HasControllerAddons; use ProcessMaker\Traits\ProcessMapTrait; @@ -31,6 +35,19 @@ public function show(ModelerManager $manager, Process $process, Request $request */ event(new ModelerStarting($manager)); + // For create screen modal in modeler + $screenTypes = []; + foreach (ScreenType::pluck('name')->toArray() as $type) { + $screenTypes[$type] = __(ucwords(strtolower($type))); + } + asort($screenTypes); + $countScreenCategories = ScreenCategory::where(['status' => 'ACTIVE', 'is_system' => false])->count(); + $isProjectsInstalled = PackageHelper::isPackageInstalled(PackageHelper::PM_PACKAGE_PROJECTS); + + // For create script modal in modeler + $scriptExecutors = ScriptExecutor::list(); + $countScriptCategories = ScriptCategory::where(['status' => 'ACTIVE', 'is_system' => false])->count(); + $draft = $process->versions()->draft()->first(); if ($draft) { $process->fill($draft->only(['svg', 'bpmn'])); @@ -43,6 +60,11 @@ public function show(ModelerManager $manager, Process $process, Request $request 'autoSaveDelay' => config('versions.delay.process', 5000), 'isVersionsInstalled' => PackageHelper::isPackageInstalled('ProcessMaker\Package\Versions\PluginServiceProvider'), 'isDraft' => $draft !== null, + 'screenTypes' => $screenTypes, + 'scriptExecutors' => $scriptExecutors, + 'countScreenCategories' => $countScreenCategories, + 'countScriptCategories' => $countScriptCategories, + 'isProjectsInstalled' => $isProjectsInstalled, ]); } From 3965cc5a4b82b0ff56a5fd4491e9b997cf83b818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Wed, 13 Sep 2023 17:27:11 -0300 Subject: [PATCH 02/27] Add process id to script controller --- ProcessMaker/Http/Controllers/Process/ScriptController.php | 3 ++- routes/web.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ProcessMaker/Http/Controllers/Process/ScriptController.php b/ProcessMaker/Http/Controllers/Process/ScriptController.php index 251a59e1cf..dfae843ce1 100644 --- a/ProcessMaker/Http/Controllers/Process/ScriptController.php +++ b/ProcessMaker/Http/Controllers/Process/ScriptController.php @@ -62,7 +62,7 @@ public function edit(Script $script, User $users) return view('processes.scripts.edit', compact('script', 'selectedUser', 'scriptExecutors', 'addons')); } - public function builder(ScriptBuilderManager $manager, Request $request, Script $script) + public function builder(ScriptBuilderManager $manager, Request $request, Script $script, $processId = null) { $processRequestAttributes = $this->getProcessRequestAttributes(); $processRequestAttributes['user_id'] = $request->user()->id; @@ -91,6 +91,7 @@ public function builder(ScriptBuilderManager $manager, Request $request, Script 'isVersionsInstalled' => PackageHelper::isPmPackageVersionsInstalled(), 'isDraft' => $draft !== null, 'user' => \Auth::user(), + 'processId' => $processId, ]); } diff --git a/routes/web.php b/routes/web.php index e2bbf9d316..6c82411f49 100644 --- a/routes/web.php +++ b/routes/web.php @@ -75,6 +75,7 @@ Route::get('scripts', [ScriptController::class, 'index'])->name('scripts.index')->middleware('can:view-scripts'); Route::get('scripts/{script}/edit', [ScriptController::class, 'edit'])->name('scripts.edit')->middleware('can:edit-scripts,script'); Route::get('scripts/{script}/builder', [ScriptController::class, 'builder'])->name('scripts.builder')->middleware('can:edit-scripts,script'); + Route::get('scripts/{script}/builder/{processId}', [ScriptController::class, 'builder'])->name('scripts.builder')->middleware('can:edit-scripts,script'); Route::get('signals', [SignalController::class, 'index'])->name('signals.index')->middleware('can:view-signals'); Route::get('signals/{signalId}/edit', [SignalController::class, 'edit'])->name('signals.edit')->middleware('can:edit-signals'); From 5ce4c1012e69cf1137d95c601a81b236813ffd17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Wed, 13 Sep 2023 17:27:31 -0300 Subject: [PATCH 03/27] Add show method in screen modal --- .../js/processes/screens/components/CreateScreenModal.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/js/processes/screens/components/CreateScreenModal.vue b/resources/js/processes/screens/components/CreateScreenModal.vue index 33d8320554..a1b58ab359 100644 --- a/resources/js/processes/screens/components/CreateScreenModal.vue +++ b/resources/js/processes/screens/components/CreateScreenModal.vue @@ -1,6 +1,7 @@