Skip to content

Commit

Permalink
story/add-documentId-to-start-form add optional documentId to start f…
Browse files Browse the repository at this point in the history
…orm if starting supporting process
  • Loading branch information
floris-thijssen-ritense committed Jan 17, 2025
1 parent dd27b1a commit 78a63ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export class FormViewModelComponent implements OnInit, OnDestroy {
this.processDefinitionKey$,
this.documentDefinitionName$,
this.isStartForm$,
this.documentId$,
])
.pipe(
take(1),
Expand All @@ -224,12 +225,14 @@ export class FormViewModelComponent implements OnInit, OnDestroy {
processDefinitionKey,
documentDefinitionName,
isStartForm,
documentId,
]) =>
isStartForm
? this.viewModelService
.submitViewModelForStartForm(
formName,
processDefinitionKey,
documentId,
documentDefinitionName,
submission.data
)
Expand Down Expand Up @@ -415,13 +418,14 @@ export class FormViewModelComponent implements OnInit, OnDestroy {
switchMap(updating => {
if (!updating) {
this.loading$.next(true);
return combineLatest([this.formName$, this.processDefinitionKey$, this.change$]).pipe(
return combineLatest([this.formName$, this.processDefinitionKey$, this.change$, this.documentId$]).pipe(
take(1),
switchMap(([formName, processDefinitionKey, change]) =>
switchMap(([formName, processDefinitionKey, change, documentId]) =>
this.viewModelService
.updateViewModelForStartForm(
formName,
processDefinitionKey,
documentId,
change.data,
this.formio.formio.page,
this._isWizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ export class ViewModelService extends BaseApiService {
public updateViewModelForStartForm(
formName: string,
processDefinitionKey: string,
documentId: string,
viewModel: object,
page: number,
isWizard: boolean
): Observable<object> {
const params = {
formName,
processDefinitionKey,
documentId,
isWizard,
...(!isNaN(page) && {page}),
};
Expand All @@ -109,6 +111,7 @@ export class ViewModelService extends BaseApiService {
public submitViewModelForStartForm(
formName: string,
processDefinitionKey: string,
documentId: string,
documentDefinitionName: string,
viewModel: object
): Observable<object> {
Expand All @@ -119,6 +122,7 @@ export class ViewModelService extends BaseApiService {
params: {
formName,
processDefinitionKey,
documentId,
documentDefinitionName,
},
headers: new HttpHeaders().set(InterceptorSkip, '400'),
Expand Down

0 comments on commit 78a63ab

Please sign in to comment.