Skip to content

Commit 1588be9

Browse files
committed
adding only new files based on epic branch
1 parent 8c69baf commit 1588be9

4 files changed

Lines changed: 108 additions & 29 deletions

File tree

ProcessMaker/Http/Controllers/TaskController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ public function edit(ProcessRequestToken $task, string $preview = '')
191191
]);
192192
$userConfiguration = (new UserConfigurationController())->index();
193193

194+
// TODO: Remove this after testing and replace with the correct iframe source
195+
$is_hitl_task = true;
196+
$iframe_src = 'https://assets.processmaker.net/tces/edit.html?documentToken=6519c0f184aa123baaee296111e5247c&fileId=nOh7qKiHnLL3786w3N3QUu1u7RI3p_6b02cbd0-7551-446b-9b57-5cb931037845';
197+
194198
return view('tasks.edit', [
195199
'task' => $task,
196200
'dueLabels' => self::$dueLabels,
@@ -204,6 +208,8 @@ public function edit(ProcessRequestToken $task, string $preview = '')
204208
'screenFields' => $screenFields,
205209
'taskDraftsEnabled' => $taskDraftsEnabled,
206210
'userConfiguration' => $userConfiguration,
211+
'is_hitl_task' => $is_hitl_task,
212+
'iframe_src' => $iframe_src,
207213
]);
208214
}
209215
}

resources/js/tasks/edit.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const main = new Vue({
6363
userConfiguration,
6464
urlConfiguration: "users/configuration",
6565
showTabs: true,
66+
isNavbarExpanded: false,
6667
},
6768
computed: {
6869
taskDefinitionConfig() {
@@ -493,5 +494,49 @@ const main = new Vue({
493494

494495
return response;
495496
},
497+
toggleNavbar() {
498+
this.isNavbarExpanded = !this.isNavbarExpanded;
499+
},
496500
},
497501
});
502+
503+
// Make toggleNavbar available globally for the navbar component
504+
window.toggleNavbar = function() {
505+
if (window.ProcessMaker.navbar && window.ProcessMaker.navbar.toggleNavbar) {
506+
window.ProcessMaker.navbar.toggleNavbar();
507+
} else if (main && main.toggleNavbar) {
508+
main.toggleNavbar();
509+
}
510+
};
511+
512+
window.addEventListener('message', function(event) {
513+
// Get reference to the iframe
514+
var iframe = document.querySelector('iframe');
515+
516+
// Only process messages from the iframe
517+
if (event.source === iframe.contentWindow) {
518+
var messageData = event.data;
519+
520+
// Only show alert and console.log when status is "MarkedAsCorrect"
521+
if (messageData && messageData.status === 'MarkedAsCorrect') {
522+
// Log all messages for debugging
523+
console.log('Received message from iframe Edit.js:', event);
524+
525+
// Show alert with the message data (remove later)
526+
var alertMessage = 'Message received from iframe Edit.js:\n';
527+
528+
if (typeof messageData === 'object') {
529+
alertMessage += JSON.stringify(messageData, null, 2);
530+
} else {
531+
alertMessage += messageData;
532+
}
533+
534+
alert(alertMessage);
535+
536+
// Also log to console (remove later)
537+
console.log('Message data:', messageData);
538+
console.log('Message origin:', event.origin);
539+
console.log('Message source:', event.source);
540+
}
541+
}
542+
});

resources/views/layouts/layoutnext.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class="main flex-grow-1 h-100
133133
@endif
134134

135135
@yield('js')
136+
@stack('scripts')
136137

137138
@isset($addons)
138139
@foreach ($addons as $addon)

resources/views/tasks/edit.blade.php

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,52 @@ class="nav-link">
8686
@endcan
8787
<div id="tabContent" class="tab-content tw-flex tw-flex-col tw-grow tw-overflow-y-scroll">
8888
<div id="tab-form" role="tabpanel" aria-labelledby="tab-form" class="tab-pane active show">
89-
@can('update', $task)
90-
<task
91-
ref="task"
92-
class="card border-0"
93-
v-model="formData"
94-
:initial-task-id="{{ $task->id }}"
95-
:initial-request-id="{{ $task->process_request_id }}"
96-
:screen-version="{{ $task->screen['id'] ?? null }}"
97-
:user-id="{{ Auth::user()->id }}"
98-
csrf-token="{{ csrf_token() }}"
99-
initial-loop-context="{{ $task->getLoopContext() }}"
100-
:wait-loading-listeners="true"
101-
@task-updated="taskUpdated"
102-
@updated-page-core="updatePage"
103-
@submit="submit"
104-
@completed="completed"
105-
@@error="error"
106-
@closed="closed"
107-
@redirect="redirectToTask"
108-
@form-data-changed="handleFormDataChange" />
109-
@endcan
110-
<div v-if="taskHasComments">
111-
<timeline :commentable_id="task.id"
112-
commentable_type="ProcessMaker\Models\ProcessRequestToken"
113-
:adding="false"
114-
:readonly="task.status === 'CLOSED'"
115-
:timeline="false" />
116-
</div>
89+
@if(isset($is_hitl_task) && $is_hitl_task === true)
90+
<!-- Smart Extract Manual Edit content when $hitl is true -->
91+
@if(isset($iframe_src))
92+
<div id="manual-edit-iframe-container" style="position: relative; width: 100%; height: calc(100vh - 200px); border: none; margin: 0; padding: 0;">
93+
<x-package-smart-extract::iframe-loader
94+
:src="$iframe_src"
95+
:title="__('Smart Extract')"
96+
loading-message="{{ __('Loading dashboard') }}"
97+
/>
98+
</div>
99+
@else
100+
<div class="alert alert-warning">
101+
{{__('No iframe source provided for Manual Edit.')}}
102+
</div>
103+
@endif
104+
@else
105+
<!-- Original Form content when $hitl is false or not set -->
106+
@can('update', $task)
107+
<task
108+
ref="task"
109+
class="card border-0"
110+
v-model="formData"
111+
:initial-task-id="{{ $task->id }}"
112+
:initial-request-id="{{ $task->process_request_id }}"
113+
:screen-version="{{ $task->screen['id'] ?? null }}"
114+
:user-id="{{ Auth::user()->id }}"
115+
csrf-token="{{ csrf_token() }}"
116+
initial-loop-context="{{ $task->getLoopContext() }}"
117+
:wait-loading-listeners="true"
118+
@task-updated="taskUpdated"
119+
@updated-page-core="updatePage"
120+
@submit="submit"
121+
@completed="completed"
122+
@@error="error"
123+
@closed="closed"
124+
@redirect="redirectToTask"
125+
@form-data-changed="handleFormDataChange" />
126+
@endcan
127+
<div v-if="taskHasComments">
128+
<timeline :commentable_id="task.id"
129+
commentable_type="ProcessMaker\Models\ProcessRequestToken"
130+
:adding="false"
131+
:readonly="task.status === 'CLOSED'"
132+
:timeline="false" />
133+
</div>
134+
@endif
117135
</div>
118136
@can('editData', $task->processRequest)
119137
<div v-if="task.process_request.status === 'ACTIVE'" id="tab-data" role="tabpanel" aria-labelledby="tab-data" class="card card-body border-top-0 tab-pane p-3">
@@ -433,7 +451,7 @@ class="mr-2 custom-badges pl-2 pr-2 rounded-lg">
433451
let draftTask = task.draft;
434452
const userHasAccessToTask = {{ Auth::user()->can('update', $task) ? "true": "false" }};
435453
const userIsAdmin = {{ Auth::user()->is_administrator ? "true": "false" }};
436-
const userIsProcessManager = {{ Auth::user()->id === $task->process?->manager_id ? "true": "false" }};
454+
const userIsProcessManager = {{ in_array(Auth::user()->id, $task->process?->manager_id ?? []) ? "true": "false" }};
437455
const userConfiguration = @json($userConfiguration);
438456
let screenFields = @json($screenFields);
439457
window.Processmaker.user = @json($currentUser);
@@ -445,6 +463,15 @@ class="mr-2 custom-badges pl-2 pr-2 rounded-lg">
445463
@endforeach
446464

447465
<script src="{{mix('js/tasks/edit.js')}}"></script>
466+
<script>
467+
// Simple iframe setup for Manual Edit
468+
document.addEventListener('DOMContentLoaded', function() {
469+
const iframe = document.getElementById('manual-edit-iframe');
470+
if (iframe) {
471+
console.log('Manual Edit iframe loaded and ready');
472+
}
473+
});
474+
</script>
448475
@endsection
449476

450477
@section('css')

0 commit comments

Comments
 (0)