Skip to content

Commit e9fda96

Browse files
preview managers export
1 parent f800432 commit e9fda96

3 files changed

Lines changed: 36 additions & 13 deletions

File tree

ProcessMaker/Http/Controllers/Api/ProcessController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ public function store(Request $request)
429429

430430
//set manager id
431431
if ($request->has('manager_id')) {
432-
$process->manager_id = $request->input('manager_id', []);
432+
$process->manager_id = $request->input('manager_id');
433433
}
434434

435435
if (isset($data['bpmn'])) {

ProcessMaker/ImportExport/Exporters/ExporterBase.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ public function toArray()
308308
'dependents' => array_map(fn ($d) => $d->toArray(), $this->dependents),
309309
'name' => $this->getName($this->model),
310310
'description' => $this->getDescription(),
311-
'process_manager' => $this->getProcessManager()['managerName'],
312-
'process_manager_id' => $this->getProcessManager()['managerId'],
311+
'process_manager' => $this->getProcessManager(),
312+
'process_manager_id' => $this->getProcessManager(),
313313
'attributes' => $this->getExportAttributes(),
314314
'extraAttributes' => $this->getExtraAttributes($this->model),
315315
'references' => $this->references,
@@ -383,10 +383,22 @@ public function getExtraAttributes($model): array
383383

384384
public function getProcessManager(): array
385385
{
386-
return [
387-
'managerId' => $this->model->manager_id ? $this->model->manager_id : null,
388-
'managerName' => $this->model->manager?->fullname ? $this->model->manager->fullname : '',
389-
];
386+
// Check if the model has the getManagers method
387+
if (!method_exists($this->model, 'getManagers')) {
388+
return [];
389+
}
390+
391+
$managers = $this->model->getManagers() ?? [];
392+
393+
$informationManagers = [];
394+
foreach ($managers as $manager) {
395+
$informationManagers[] = [
396+
'managerId' => $manager->id,
397+
'managerName' => $manager->fullname,
398+
];
399+
}
400+
401+
return $informationManagers;
390402
}
391403

392404
public function getLastModifiedBy() : array

resources/js/processes/export/components/MainAssetView.vue

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
<li>{{ $t('Description') }}: <span class="fw-semibold">{{ processInfo.description }}</span></li>
1111
<li>{{ $t('Categories') }}: <span class="fw-semibold">{{ processInfo.categories }}</span></li>
1212
<li>{{ $t('Process Manager') }}:
13-
<span class="fw-semibold">
14-
<b-link v-if="processInfo.processManagerId"
15-
:href="`/profile/${processInfo.processManagerId}`"
16-
target="_blank">{{ processInfo.processManager }}</b-link>
17-
<span v-else>{{ processInfo.processManager }}</span>
18-
</span>
13+
<span v-if="!processInfo.processManager || processInfo.processManager.length === 0 || processInfo.processManager === 'N/A'" class="fw-semibold">N/A</span>
14+
<ul v-else class="process-manager-list">
15+
<li v-for="manager in processInfo.processManager" :key="manager.managerId" class="process-manager-item">
16+
<b-link :href="`/profile/${manager.managerId}`" target="_blank">{{ manager.managerName }}</b-link>
17+
</li>
18+
</ul>
1919
</li>
2020
<li>{{ $t('Created') }}: <span class="fw-semibold">{{ processInfo.created_at }}</span></li>
2121
<li>{{ $t('Last Modified') }}:
@@ -287,6 +287,17 @@ export default {
287287
list-style: none;
288288
}
289289
290+
.process-manager-list {
291+
padding-left: 20px;
292+
margin-top: 5px;
293+
margin-bottom: 0;
294+
list-style: disc;
295+
}
296+
297+
.process-manager-item {
298+
margin-bottom: 2px;
299+
}
300+
290301
.process-options-helper-text {
291302
margin-top: 0;
292303
margin-bottom: 2px;

0 commit comments

Comments
 (0)