Skip to content

Commit

Permalink
Generalized RelatedEntitiesWithSummary (from EducationalMaterialCompo…
Browse files Browse the repository at this point in the history
…nent) (#2029)

* feat(core): generalize related entities with summary component

to be usable with any entity type, not just EducationalMaterial

closes #2004
Co-authored-by: Simon <simon@aam-digital.com>
  • Loading branch information
sleidig authored Oct 16, 2023
1 parent bbf3749 commit 616fc9d
Show file tree
Hide file tree
Showing 10 changed files with 260 additions and 201 deletions.
6 changes: 3 additions & 3 deletions src/app/child-dev-project/children/children-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export const childrenComponents: ComponentTuple[] = [
).then((c) => c.ChildrenBmiDashboardComponent),
],
[
"EducationalMaterial",
"RelatedEntitiesWithSummary",
() =>
import(
"./educational-material/educational-material-component/educational-material.component"
).then((c) => c.EducationalMaterialComponent),
"../../core/entity-details/related-entities-with-summary/related-entities-with-summary.component"
).then((c) => c.RelatedEntitiesWithSummaryComponent),
],
[
"BmiBlock",
Expand Down

This file was deleted.

This file was deleted.

20 changes: 15 additions & 5 deletions src/app/core/config/config-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,14 +706,24 @@ export const defaultJsonConfig = {
"components": [
{
"title": "",
"component": "EducationalMaterial",
"component": "RelatedEntitiesWithSummary",
"config": {
"summaries": {
total: true,
average: true,
"entityType": EducationalMaterial.ENTITY_TYPE,
"property": "child",
"columns": [
{ "id": "date", "visibleFrom": "xs" },
{ "id": "materialType", "visibleFrom": "xs" },
{ "id": "materialAmount", "visibleFrom": "md" },
{ "id": "description", "visibleFrom": "md" },
],
"summaries": {
"countProperty": "materialAmount",
"groupBy": "materialType",
"total": true,
"average": false
}
}
}
}
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<app-entity-subrecord
[records]="data"
[filter]="filter"
[columns]="columns"
[newRecordFactory]="createNewRecordFactory()"
[isLoading]="isLoading"
></app-entity-subrecord>

<div class="margin-top-large">
<ng-container *ngIf="summarySum">
<strong i18n>Total:</strong> {{ summarySum }} <br />
</ng-container>
<ng-container *ngIf="summaryAvg">
<strong i18n>Average:</strong> {{ summaryAvg }} <br />
</ng-container>
</div>
Loading

0 comments on commit 616fc9d

Please sign in to comment.