diff --git a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html index 089bb78334..098480b5b9 100644 --- a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html +++ b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html @@ -6,16 +6,12 @@
- - - - Total: {{ summary }}
-
+ + + Total: {{ totalSummary }}
- - - Average: {{ avgSummary }} - + + Average: {{ avgSummary }}
diff --git a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts index 08f9dc519b..668efa2d8a 100644 --- a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts +++ b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts @@ -11,7 +11,6 @@ import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy"; import { EntitySubrecordComponent } from "../../../../core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component"; import { EntityListConfig } from "app/core/entity-list/EntityListConfig"; import { ActivatedRoute } from "@angular/router"; -import { RouteData } from "app/core/config/dynamic-routing/view-config.interface"; /** * Displays educational materials of a child, such as a pencil, rulers, e.t.c @@ -30,11 +29,11 @@ import { RouteData } from "app/core/config/dynamic-routing/view-config.interface standalone: true, }) export class EducationalMaterialComponent implements OnInit { + @Input() summary: any[]; @Input() entity: Child; records: EducationalMaterial[] = []; - summary = ""; + totalSummary = ""; avgSummary = ""; - summaryTitle: { [key: string]: string }[] listConfig: EntityListConfig; @Input() config: { columns: FormFieldConfig[] } = { @@ -116,17 +115,7 @@ export class EducationalMaterialComponent implements OnInit { return `${label}: ${avg}`; }); - this.summary = summaryArray.join(", "); + this.totalSummary = summaryArray.join(", "); this.avgSummary = avgSummaryArray.join(", "); - this.getSummaryList(); - } - - getSummaryList() { - this.route.data.subscribe((data: RouteData) => { - this.listConfig = data.config; - - this.summaryTitle = this.listConfig['panels'] - .find((panel: { title: string })=> panel.title === "Educational Materials").summary; - }); } } diff --git a/src/app/core/config/config-fix.ts b/src/app/core/config/config-fix.ts index 0e03c98188..3c9d8b4df8 100644 --- a/src/app/core/config/config-fix.ts +++ b/src/app/core/config/config-fix.ts @@ -712,17 +712,16 @@ export const defaultJsonConfig = { "components": [ { "title": "", - "component": "EducationalMaterial" - } - ], - "summary": [ - { - "Total": $localize `:Total item Count:Total` - }, - - { - "Average": $localize `:Average Per Item:Average` - } + "component": "EducationalMaterial", + "config": { + "summary": [ + { + "type": "boolean", + total: true, average: true + } + ] + } + }, ] }, {