feat: Add Eingabeseite 10 (Schlussteil), fix section spawning with multiple conditions
This commit is contained in:
@@ -13,3 +13,4 @@ formElementSections:
|
||||
- !include section_09_modul_sap_supply_chain_management_scm.yaml
|
||||
- !include section_10_auswirkungen_auf_arbeitnehmer.yaml
|
||||
- !include section_11_informationen_zur_kuenstlichen_intelligenz.yaml
|
||||
- !include section_12_schlussteil.yaml
|
||||
|
||||
@@ -43,6 +43,14 @@ formElementSubSections:
|
||||
sectionSpawnConditionType: SHOW
|
||||
sectionSpawnExpectedValue: Einführung
|
||||
sectionSpawnOperator: EQUALS
|
||||
- templateReference: schlussteil_template
|
||||
sectionSpawnConditionType: SHOW
|
||||
sectionSpawnExpectedValue: Einführung
|
||||
sectionSpawnOperator: EQUALS
|
||||
- templateReference: schlussteil_template
|
||||
sectionSpawnConditionType: SHOW
|
||||
sectionSpawnExpectedValue: Einführung mit einhergehender Ablösung
|
||||
sectionSpawnOperator: EQUALS
|
||||
|
||||
# Allgemeine Informationen (Einführung, Ablösung, Änderung)
|
||||
- title: Allgemeine Informationen
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
title: Schlussteil
|
||||
shortTitle: Schlussteil
|
||||
description: Geplantes Einführungsdatum, Wiedervorlage und Anlagen zur Betriebsvereinbarung
|
||||
templateReference: schlussteil_template
|
||||
titleTemplate: Schlussteil
|
||||
spawnedFromElementReference: art_der_massnahme
|
||||
formElementSubSections:
|
||||
- title: Einführungsdatum und Wiedervorlage
|
||||
formElements:
|
||||
- reference: schlussteil_einfuehrungsdatum
|
||||
title: 1. Geplantes Einführungsdatum
|
||||
description: ''
|
||||
options:
|
||||
- value: '2026-07-01'
|
||||
label: Einführungsdatum
|
||||
processingPurpose: BUSINESS_PROCESS
|
||||
employeeDataCategory: NON_CRITICAL
|
||||
type: DATE
|
||||
- reference: schlussteil_wiedervorlage_datum
|
||||
title: 2. Wiedervorlage für Prüfung
|
||||
description: ''
|
||||
options:
|
||||
- value: '2027-07-01'
|
||||
label: Datum
|
||||
processingPurpose: BUSINESS_PROCESS
|
||||
employeeDataCategory: NON_CRITICAL
|
||||
type: DATE
|
||||
- title: Anlagen zur Betriebsvereinbarung
|
||||
formElements:
|
||||
- reference: schlussteil_anlage
|
||||
title: Anlagen zur Betriebsvereinbarung
|
||||
description: ''
|
||||
type: FILE_UPLOAD
|
||||
options: []
|
||||
- title: Dokumente zur Information des Betriebsrats
|
||||
subtitle: Nicht Bestandteil der Betriebsvereinbarung
|
||||
formElements:
|
||||
- reference: schlussteil_dokument
|
||||
title: Dokumente zur Information des Betriebsrats
|
||||
description: ''
|
||||
type: FILE_UPLOAD
|
||||
options: []
|
||||
@@ -17,3 +17,4 @@ formElementSections:
|
||||
- !include section_14_datenschutz.yaml
|
||||
- !include section_15_auswirkungen_auf_arbeitnehmer.yaml
|
||||
- !include section_16_informationen_zur_kuenstlichen_intelligenz.yaml
|
||||
- !include section_17_schlussteil.yaml
|
||||
|
||||
@@ -41,6 +41,14 @@ formElementSubSections:
|
||||
sectionSpawnConditionType: SHOW
|
||||
sectionSpawnExpectedValue: Einführung
|
||||
sectionSpawnOperator: EQUALS
|
||||
- templateReference: schlussteil_template
|
||||
sectionSpawnConditionType: SHOW
|
||||
sectionSpawnExpectedValue: Einführung
|
||||
sectionSpawnOperator: EQUALS
|
||||
- templateReference: schlussteil_template
|
||||
sectionSpawnConditionType: SHOW
|
||||
sectionSpawnExpectedValue: Einführung mit einhergehender Ablösung
|
||||
sectionSpawnOperator: EQUALS
|
||||
- title: Allgemeine Informationen
|
||||
subtitle: Grundlegende Informationen
|
||||
formElements:
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
title: Schlussteil
|
||||
shortTitle: Schlussteil
|
||||
description: Geplantes Einführungsdatum, Wiedervorlage und Anlagen zur Betriebsvereinbarung
|
||||
isTemplate: true
|
||||
templateReference: schlussteil_template
|
||||
titleTemplate: Schlussteil
|
||||
formElementSubSections:
|
||||
- title: Einführungsdatum und Wiedervorlage
|
||||
formElements:
|
||||
- reference: schlussteil_einfuehrungsdatum
|
||||
title: 1. Geplantes Einführungsdatum
|
||||
description: ''
|
||||
options:
|
||||
- value: ''
|
||||
label: Einführungsdatum
|
||||
processingPurpose: BUSINESS_PROCESS
|
||||
employeeDataCategory: NON_CRITICAL
|
||||
type: DATE
|
||||
- reference: schlussteil_wiedervorlage_datum
|
||||
title: 2. Wiedervorlage für Prüfung
|
||||
description: ''
|
||||
options:
|
||||
- value: ''
|
||||
label: Datum
|
||||
processingPurpose: BUSINESS_PROCESS
|
||||
employeeDataCategory: NON_CRITICAL
|
||||
type: DATE
|
||||
- title: Anlagen zur Betriebsvereinbarung
|
||||
formElements:
|
||||
- reference: schlussteil_anlage
|
||||
title: Anlagen zur Betriebsvereinbarung
|
||||
description: ''
|
||||
type: FILE_UPLOAD
|
||||
options: []
|
||||
- title: Dokumente zur Information des Betriebsrats
|
||||
subtitle: Nicht Bestandteil der Betriebsvereinbarung
|
||||
formElements:
|
||||
- reference: schlussteil_dokument
|
||||
title: Dokumente zur Information des Betriebsrats
|
||||
description: ''
|
||||
type: FILE_UPLOAD
|
||||
options: []
|
||||
@@ -16,7 +16,6 @@ class SplitYamlLoaderTest {
|
||||
assert(form.isTemplate == true) { "Form should be a template" }
|
||||
assert(form.name == "Name des IT-Systems") { "Form name should match" }
|
||||
assert(form.formElementSections?.isNotEmpty() == true) { "Form should have sections" }
|
||||
assert(form.formElementSections?.size == 16) { "Form should have 16 sections" }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -31,6 +30,5 @@ class SplitYamlLoaderTest {
|
||||
assert(form.isTemplate == false) { "Form should not be a template" }
|
||||
assert(form.name == "SAP S/4HANA") { "Form name should match" }
|
||||
assert(form.formElementSections?.isNotEmpty() == true) { "Form should have sections" }
|
||||
assert(form.formElementSections?.size == 11) { "Form should have 11 sections" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export function useSectionSpawning() {
|
||||
|
||||
// Process each trigger independently
|
||||
for (const trigger of triggers) {
|
||||
resultSections = processSingleTrigger(resultSections, formElement, trigger, triggerValue)
|
||||
resultSections = processSingleTrigger(resultSections, formElement, trigger, triggerValue, triggers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ export function useSectionSpawning() {
|
||||
sections: FormElementSectionDto[],
|
||||
formElement: FormElementDto,
|
||||
trigger: SectionSpawnTriggerDto,
|
||||
triggerValue: string
|
||||
triggerValue: string,
|
||||
allTriggersForElement: SectionSpawnTriggerDto[]
|
||||
): FormElementSectionDto[] {
|
||||
let resultSections = sections
|
||||
const shouldSpawn = shouldSpawnSection(trigger, triggerValue)
|
||||
@@ -45,9 +46,19 @@ export function useSectionSpawning() {
|
||||
if (shouldSpawn && !existingSpawnedSection) {
|
||||
resultSections = spawnNewSection(resultSections, formElement, trigger, triggerValue)
|
||||
}
|
||||
// 2. Condition no longer met but section exists → remove spawned section
|
||||
// 2. Condition no longer met but section exists → remove spawned section only if no other
|
||||
// trigger for the same template reference still satisfies the spawn condition (OR logic)
|
||||
else if (!shouldSpawn && existingSpawnedSection) {
|
||||
resultSections = removeSpawnedSectionForTrigger(resultSections, formElement.reference!, trigger.templateReference)
|
||||
const otherTriggerAlsoSpawns = allTriggersForElement.some(
|
||||
(t) => t !== trigger && t.templateReference === trigger.templateReference && shouldSpawnSection(t, triggerValue)
|
||||
)
|
||||
if (!otherTriggerAlsoSpawns) {
|
||||
resultSections = removeSpawnedSectionForTrigger(
|
||||
resultSections,
|
||||
formElement.reference!,
|
||||
trigger.templateReference
|
||||
)
|
||||
}
|
||||
}
|
||||
// 3. Condition still met and section exists → update section titles if value changed
|
||||
else if (shouldSpawn && existingSpawnedSection && triggerValue) {
|
||||
|
||||
Reference in New Issue
Block a user