From 2d869b07c78993c0b614da5004003540d74ec07e Mon Sep 17 00:00:00 2001 From: nsemets Date: Wed, 22 Oct 2025 18:03:39 +0300 Subject: [PATCH] fix(schemas): fixed display of multiple same blocks --- .../custom-step/custom-step.component.html | 271 +++++++++--------- .../justification-review.component.html | 88 +++--- .../components/review/review.component.html | 20 +- .../registry-overview.component.html | 26 +- .../registration-blocks-data.component.html | 6 +- .../registration/page-schema.mapper.ts | 12 +- 6 files changed, 216 insertions(+), 207 deletions(-) diff --git a/src/app/features/registries/components/custom-step/custom-step.component.html b/src/app/features/registries/components/custom-step/custom-step.component.html index a8cdbc290..872da1b1d 100644 --- a/src/app/features/registries/components/custom-step/custom-step.component.html +++ b/src/app/features/registries/components/custom-step/custom-step.component.html @@ -30,7 +30,7 @@

{{ section.title }}

@if (section.description) { -

{{ section.description }}

+

{{ section.description }}

} @@ -40,151 +40,150 @@

{{ section.title }}

@for (q of questions; track q.id) {
- - - @if (q.exampleText) { - - - {{ 'common.links.showExample' | translate }} - - - - {{ 'common.links.hideExample' | translate }} - -

{{ q.exampleText }}

-
-
+ - @switch (q.fieldType) { - @case (FieldType.TextArea) { - - @if ( - stepForm.controls[q.responseKey!].errors?.['required'] && - (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) - ) { - - {{ INPUT_VALIDATION_MESSAGES.required | translate }} - - } - } - @case (FieldType.Radio) { -
- @for (option of q.options; track option) { -
- - - - @if (option.helpText) { - - } -
- } -
- @if ( - stepForm.controls[q.responseKey!].errors?.['required'] && - (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) - ) { - - {{ INPUT_VALIDATION_MESSAGES.required | translate }} - - } + @if (q.exampleText) { + + + {{ 'common.links.showExample' | translate }} + + + + {{ 'common.links.hideExample' | translate }} + +

{{ q.exampleText }}

+
+
+ } + + @switch (q.fieldType) { + @case (FieldType.TextArea) { + + @if ( + stepForm.controls[q.responseKey!].errors?.['required'] && + (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) + ) { + + {{ INPUT_VALIDATION_MESSAGES.required | translate }} + } - @case (FieldType.Checkbox) { -
- @for (option of q.options; track option) { -
- - - - @if (option.helpText) { - - } -
- } -
- @if ( - stepForm.controls[q.responseKey!].errors?.['required'] && - (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) - ) { - - {{ INPUT_VALIDATION_MESSAGES.required | translate }} - + } + @case (FieldType.Radio) { +
+ @for (option of q.options; track option) { +
+ + + + @if (option.helpText) { + + } +
} +
+ @if ( + stepForm.controls[q.responseKey!].errors?.['required'] && + (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) + ) { + + {{ INPUT_VALIDATION_MESSAGES.required | translate }} + } + } + @case (FieldType.Checkbox) { +
+ @for (option of q.options; track option) { +
+ - @case (FieldType.Text) { - - @if ( - stepForm.controls[q.responseKey!].errors?.['required'] && - (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) - ) { - - {{ INPUT_VALIDATION_MESSAGES.required | translate }} - + + @if (option.helpText) { + + } +
} +
+ @if ( + stepForm.controls[q.responseKey!].errors?.['required'] && + (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) + ) { + + {{ INPUT_VALIDATION_MESSAGES.required | translate }} + } - @case (FieldType.File) { -

{{ 'files.actions.uploadFile' | translate }}

-

- {{ 'shared.files.limitText' | translate }} -

-

- {{ 'shared.files.description' | translate }} -

-
- @for (file of attachedFiles[q.responseKey!] || []; track file) { - - } -
-
- -
+ } + + @case (FieldType.Text) { + + @if ( + stepForm.controls[q.responseKey!].errors?.['required'] && + (stepForm.controls[q.responseKey!].touched || stepForm.controls[q.responseKey!].dirty) + ) { + + {{ INPUT_VALIDATION_MESSAGES.required | translate }} + } } -
+ @case (FieldType.File) { +

{{ 'files.actions.uploadFile' | translate }}

+

+ {{ 'shared.files.limitText' | translate }} +

+

+ {{ 'shared.files.description' | translate }} +

+
+ @for (file of attachedFiles[q.responseKey!] || []; track file) { + + } +
+
+ +
+ } + }
}
diff --git a/src/app/features/registries/components/justification-review/justification-review.component.html b/src/app/features/registries/components/justification-review/justification-review.component.html index 5f8c45cda..480466477 100644 --- a/src/app/features/registries/components/justification-review/justification-review.component.html +++ b/src/app/features/registries/components/justification-review/justification-review.component.html @@ -1,7 +1,8 @@ -
+

{{ 'registries.justification.step' | translate }}

{{ 'registries.justification.title' | translate }}

+ @if (schemaResponse()?.revisionJustification) {

{{ schemaResponse()?.revisionJustification }}

} @else { @@ -12,7 +13,9 @@

{{ 'registries.justification.title' | translate }}

} +

{{ 'registries.justification.updatedList' | translate }}

+ @if (changes().length) { @for (item of changes(); track item) {

{{ item }}

@@ -21,6 +24,7 @@

{{ 'registries.justification.updatedList' | translate }}

{{ 'registries.justification.noUpdates' | translate }}

}
+ @for (page of pages(); track page.id) {

{{ page.title }}

@@ -28,6 +32,14 @@

{{ page.title }}

@if (page.description) {

{{ page.description }}

} + + @if (page.questions?.length) { + + } + @if (page.sections?.length) { @for (section of page.sections; track section.id) {
@@ -43,51 +55,39 @@

{{ section.title }}

}
} - } @else { - @if (page.questions?.length) { - - } }
} -
-
- @if (inProgress) { - - - - - } @else if (isUnapproved) { - - - } -
+ +
+ @if (inProgress) { + + + + + + + } @else if (isUnapproved) { + + + + }
diff --git a/src/app/features/registries/components/review/review.component.html b/src/app/features/registries/components/review/review.component.html index 691afff6c..5f7c247bf 100644 --- a/src/app/features/registries/components/review/review.component.html +++ b/src/app/features/registries/components/review/review.component.html @@ -13,6 +13,7 @@

{{ 'common.labels.title' | translate }}

} +

{{ 'common.labels.description' | translate }}

{{ draftRegistration()?.description }}

@@ -50,6 +51,7 @@

{{ 'shared.license.title' | translate }}

}
+

{{ 'shared.subjects.title' | translate }}

@@ -57,6 +59,7 @@

{{ 'shared.subjects.title' | translate }}

}
+ @if (!subjects().length) {

{{ 'common.labels.noData' | translate }}

@@ -77,6 +80,7 @@

{{ 'shared.tags.title' | translate }}

}
+ @for (page of pages(); track page.id) {

{{ page.title }}

@@ -85,6 +89,14 @@

{{ page.title }}

{{ page.description }}

} + @if (page.questions?.length) { + + } + @if (page.sections?.length) { @for (section of page.sections; track section.id) {
@@ -101,14 +113,6 @@

{{ section.title }}

}
} - } @else { - @if (page.questions?.length) { - - } }
} diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.html b/src/app/features/registry/pages/registry-overview/registry-overview.component.html index 387f1f2a6..55714a2c2 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.html +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.html @@ -93,7 +93,18 @@

{{ page.title }}

@if (page.description) { -

{{ page.description }}

+

{{ page.description }}

+ } + + @if (page.questions?.length) { + } @if (page.sections?.length) { @@ -101,7 +112,7 @@

{{ page.title }}

{{ section.title }}

@if (section.description) { -

{{ section.description }}

+

{{ section.description }}

} @if (section.questions?.length) { {{ section.title }} }
} - } @else { - @if (page.questions?.length) { - - } } } diff --git a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html index f6c8241ba..ec75249f2 100644 --- a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html +++ b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html @@ -1,6 +1,6 @@ @for (question of questions(); track question.id) {
-

+

{{ question.displayText }} @if (!isOriginalRevision() && updatedKeysMap()[question.responseKey!]) { @@ -15,7 +15,7 @@

} @case (FieldType.Checkbox) { @for (option of reviewData()[question.responseKey!]; track option) { -

{{ option }}

+

{{ option }}

} } @case (FieldType.File) { @@ -43,7 +43,7 @@

@if (question.fieldType === FieldType.File) {

{{ 'common.labels.noFiles' | translate }}

} @else if (question.fieldType === FieldType.Paragraph) { -

{{ question.paragraphText! | translate }}

+

{{ question.paragraphText! | translate }}

} @else {

{{ 'common.labels.noData' | translate }}

} diff --git a/src/app/shared/mappers/registration/page-schema.mapper.ts b/src/app/shared/mappers/registration/page-schema.mapper.ts index 01fc419f3..e5207c49a 100644 --- a/src/app/shared/mappers/registration/page-schema.mapper.ts +++ b/src/app/shared/mappers/registration/page-schema.mapper.ts @@ -41,12 +41,18 @@ export class PageSchemaMapper { case BlockType.Paragraph: if (currentQuestion) { - currentQuestion.paragraphText = item.attributes.display_text; + currentQuestion.paragraphText = currentQuestion.paragraphText + ? currentQuestion.paragraphText + '\n \n' + item.attributes.display_text + : item.attributes.display_text; currentQuestion.fieldType = FieldType.Paragraph; } else if (currentSection) { - currentSection.description = item.attributes.display_text; + currentSection.description = currentSection.description + ? currentSection.description + '\n \n' + item.attributes.display_text + : item.attributes.display_text; } else { - currentPage.description = item.attributes.display_text; + currentPage.description = currentPage.description + ? currentPage.description + '\n \n' + item.attributes.display_text + : item.attributes.display_text; } break;