diff --git a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.server.ts b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.server.ts index f49c2eb31..e753bdb16 100644 --- a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.server.ts +++ b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.server.ts @@ -236,11 +236,13 @@ export const actions: Actions = { const scenarioEndpoint = `${BASE_API_URL}/risk-scenarios/${event.params.id}/`; const scenario = await event.fetch(`${scenarioEndpoint}object`).then((res) => res.json()); - const measures = [...scenario.applied_controls, measure.id]; + const field: string = event.url.searchParams.get('field') || 'applied_controls'; + + const measures = [...scenario[field], measure.id]; const patchRequestInitOptions: RequestInit = { method: 'PATCH', - body: JSON.stringify({ applied_controls: measures }) + body: JSON.stringify({ [field]: measures }) }; const patchRes = await event.fetch(scenarioEndpoint, patchRequestInitOptions); diff --git a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte index 09fb5a926..c74bb6f4b 100644 --- a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte @@ -54,12 +54,12 @@ } } - function modalMeasureCreateForm(): void { + function modalMeasureCreateForm(field: string): void { const modalComponent: ModalComponent = { ref: CreateModal, props: { form: data.measureCreateForm, - formAction: '?/createAppliedControl', + formAction: '?/createAppliedControl&field=' + field, model: data.measureModel, debug: false } @@ -118,281 +118,284 @@ const impactColorMap = data.riskMatrix.impact.map((impact) => impact.hexcolor); -
{m.project()}
-{m.riskAssessment()}
-{m.project()}
+{m.riskAssessment()}
+