Skip to content

Commit

Permalink
fix: save form flow on close task modal (#1295)
Browse files Browse the repository at this point in the history
* fixed last saved by bug

* save form flow on close modal
  • Loading branch information
mbritense authored Nov 29, 2024
1 parent 7a8fd41 commit 39581a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export class TaskDetailContentComponent implements OnInit, OnDestroy {

this.loadTaskDetails(value.task as any, value.processLinkActivityResult);
}
@Input() public set modalClosed(_: boolean) {
// save form flow data on modal closed
if (this.formFlow) this.formFlow.saveData();
}
@Output() public readonly closeModalEvent = new EventEmitter();
@Output() public readonly formSubmit = new EventEmitter();
@Output() public readonly activeChange = new EventEmitter<boolean>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
@if (processLinkPreloaded$ | async) {
<valtimo-task-detail-content
[taskAndProcessLink]="taskAndProcessLink$ | async"
[modalClosed]="modalCloseEvent$ | async"
(formSubmit)="onFormSubmit()"
(closeModalEvent)="closeModal()"
></valtimo-task-detail-content>
} @else {
<valtimo-task-detail-content
[task]="task$ | async"
[modalClosed]="modalCloseEvent$ | async"
(formSubmit)="onFormSubmit()"
(closeModalEvent)="closeModal()"
></valtimo-task-detail-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export class TaskDetailModalComponent implements OnInit {

public readonly canAssignUserToTask$ = new BehaviorSubject<boolean>(false);

public readonly modalCloseEvent$ = new BehaviorSubject<boolean>(false);

private readonly _subscriptions = new Subscription();

constructor(
Expand Down Expand Up @@ -118,7 +120,7 @@ export class TaskDetailModalComponent implements OnInit {
public openTaskAndProcessLinkDetails(taskWithProcessLink: TaskWithProcessLink | null): void {
this.processLinkPreloaded$.next(true);
this.taskAndProcessLink$.next(taskWithProcessLink);
this.task$.next(taskWithProcessLink.task as any);
this.task$.next({...(taskWithProcessLink.task as any)});
this.page$.next({
title: taskWithProcessLink.task?.name,
subtitle: `${this.translateService.instant('taskDetail.taskCreated')} ${taskWithProcessLink.task?.created}`,
Expand Down Expand Up @@ -147,6 +149,7 @@ export class TaskDetailModalComponent implements OnInit {
public closeModal(): void {
this._modal.open = false;
this.taskIntermediateSaveService.setSubmission({});
this.modalCloseEvent$.next(!this.modalCloseEvent$.getValue());
}

private openModal(): void {
Expand Down

0 comments on commit 39581a1

Please sign in to comment.