Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add configurable subtitle and explanation inputs #2656

Merged
merged 19 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
45b26ad
feat: add configurable subtitle and explanation inputs
sadaf895 Nov 12, 2024
a203d14
Update src/app/features/dashboard-widgets/entity-count-dashboard-widg…
sadaf895 Nov 12, 2024
59e720b
added 'subtitle' and 'explanation' inputs for other dashboard widgets.
sadaf895 Nov 12, 2024
5401135
Merge branch 'master' into Overwriting_label/title
sleidig Nov 13, 2024
c98d903
Update src/app/child-dev-project/notes/dashboard-widgets/important-no…
sadaf895 Nov 13, 2024
477441b
Update src/app/features/dashboard-widgets/entity-count-dashboard-widg…
sadaf895 Nov 13, 2024
7c82a57
Update src/app/features/dashboard-widgets/progress-dashboard-widget/p…
sadaf895 Nov 13, 2024
58abc07
Updated the logic for subtitle and explanation inputs
sadaf895 Nov 13, 2024
860925d
reset config before merging (and to test the default subtitles)
sleidig Nov 13, 2024
ffa2edb
Update src/app/child-dev-project/notes/dashboard-widgets/important-no…
sadaf895 Nov 13, 2024
de22ee0
Update src/app/features/dashboard-widgets/shortcut-dashboard-widget/s…
sadaf895 Nov 13, 2024
26eab00
Update src/app/features/dashboard-widgets/shortcut-dashboard-widget/s…
sadaf895 Nov 13, 2024
a31fbba
Update src/app/features/dashboard-widgets/entity-count-dashboard-widg…
sadaf895 Nov 13, 2024
ea9fe03
Update src/app/features/dashboard-widgets/entity-count-dashboard-widg…
sadaf895 Nov 13, 2024
4b8762b
Update src/app/features/dashboard-widgets/birthday-dashboard-widget/b…
sadaf895 Nov 13, 2024
d682093
Update src/app/child-dev-project/notes/dashboard-widgets/important-no…
sadaf895 Nov 13, 2024
d76ccb7
remove translation from html file
sadaf895 Nov 13, 2024
a7a7841
Update src/app/features/todos/todos-dashboard/todos-dashboard.compone…
sleidig Nov 13, 2024
802fa70
lint errors fix
sadaf895 Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<app-dashboard-list-widget
icon="exclamation-triangle"
subtitle="Notes needing follow-up"
i18n-subtitle="subtitle|dashboard showing notes that require action"
[subtitle]="subtitle"
[explanation]="explanation"
i18n-explanation
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved
theme="note"
entityType="Note"
[dataMapper]="dataMapper"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class ImportantNotesDashboardComponent extends DashboardWidget {
super();
}

@Input() subtitle: string =
$localize`:dashboard widget subtitle:Notes needing follow-up`;
@Input() explanation: string =
$localize`:dashboard widget explanation:'Notes require immediate attention or follow-up actions'`;
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved

private noteIsRelevant(note: Note): boolean {
return this.warningLevels.includes(note.warningLevel.id);
}
Expand Down
22 changes: 21 additions & 1 deletion src/app/core/config/config-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,34 @@ export const defaultJsonConfig = {
link: "/public-form/test",
},
],
subtitle: $localize`:Shortcut dashboard subtitle:Quick Actions`,
explanation: $localize`:Shortcut dashboard explanation:Shortcuts to quickly navigate to common actions.`
},
},
{
component: "EntityCountDashboard",
config:{
subtitle: $localize`:Subtitle: Entity Group Counts`,
explanation: $localize`:Explanation: Displays counts of entities grouped by center and gender`,

entityType: "Child", // Entity type to group by (e.g., "Child", "Teacher")
groupBy: ["center", "gender"], // Fields to group by
}
},
{
component: "ImportantNotesDashboard",
config: {
warningLevels: ["WARNING", "URGENT"],
subtitle: $localize`:Subtitle:Notes Needing Follow-Up`,
explanation: $localize`:Explanation:These notes require immediate attention or follow-up actions.`,
},
},
{
component: "TodosDashboard",
config: {},
config: {
subtitle: $localize`:Subtitle:Tasks Due`,
explanation: $localize`:Explanation:Tasks that are due and require completion soon.`,
},
},
{
component: "NotesDashboard",
Expand Down Expand Up @@ -155,10 +169,16 @@ export const defaultJsonConfig = {
component: "ProgressDashboard",
config: {
dashboardConfigId: "1",
subtitle: $localize`:Subtitle:Progress Overview`,
explanation: $localize`:Explanation:Shows the progress of different parts of project tasks. You can use this to track any kind of targets.`,
},
},
{
component: "BirthdayDashboard",
config:{
subtitle: $localize`:Subtitle:Upcoming Birthdays`,
explanation: $localize`:Explanation:Shows upcoming birthdays`,
}
},
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<app-dashboard-list-widget
icon="birthday-cake"
theme="child"
subtitle="Upcoming Birthdays"
[subtitle]="subtitle"
i18n-subtitle="Subtitle of the birthday widget"
[explanation]="explanation"
i8n-explanation
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved
[entries]="entries"
>
<div class="table-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export class BirthdayDashboardComponent

entries: EntityWithBirthday[];

@Input() subtitle: string =
$localize`:dashboard widget subtitle:Upcoming Birthdays`;
@Input() explanation: string;

constructor(private entityMapper: EntityMapperService) {
super();
this.today = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
[icon]="entityIcon"
theme="child"
[title]="totalEntities"
[subtitle]="label"
[subtitle]="subtitle ?? label"
[explanation]="explanation"
i18n-explanation
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved
[entries]="entityGroupCounts[groupBy[currentGroupIndex]]"
[paginationPageSize]="4"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ export class EntityCountDashboardComponent
label: string;
entityIcon: IconName;

@Input() subtitle: string;
@Input() explanation: string =
$localize`dashboard widget explanation : 'Counting all "active" records. If configured, you can view different disaggregations by using the arrows below.'
"`;
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved

constructor(
private entityMapper: EntityMapperService,
private router: Router,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<app-dashboard-list-widget
icon="list"
theme="child"
[subtitle]="data?.title"
[subtitle]="subtitle ?? data.title"
[explanation]="explanation"
i8n-explanation
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved
[entries]="data?.parts"
>
<div class="table-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export class ProgressDashboardComponent
@Input() dashboardConfigId = "";
data: ProgressDashboardConfig;

@Input() subtitle: string =
$localize`:dashboard widget subtitle: Progress Overview`;
@Input() explanation: string =
$localize`:dashboard widget explanation: Shows the progress of different parts of project tasks. You can use this to track any kind of targets.`;

constructor(
private entityMapper: EntityMapperService,
private dialog: MatDialog,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<app-dashboard-list-widget
icon="external-link-alt"
theme="general"
subtitle="Quick actions"
[subtitle]="subtitle"
i18n-subtitle="
Title of dashboard widget that shows a list of certain actions a user can
click on
"
[explanation]="explanation"
i18n-explanation
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved
[entries]="_shortcuts"
>
<div class="table-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export class ShortcutDashboardComponent {
}
_shortcuts: MenuItem[] = [];

@Input() subtitle: string =
$localize`dashboard widget subtitle:Quick Actions`;
@Input() explanation: string =
$localize`dashboard widget explanation:Shortcuts to quickly navigate to common actions`;
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved

constructor(
private routePermissionsService: RoutePermissionsService,
private locationStrategy: LocationStrategy,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<app-dashboard-list-widget
icon="tasks"
subtitle="Tasks due"
[subtitle]="subtitle ?? 'Tasks due'"
sadaf895 marked this conversation as resolved.
Show resolved Hide resolved
i18n-subtitle="subtitle|dashboard showing open todos"
[explanation]="explanation ?? 'Tasks that are due'"
theme="note"
entityType="Todo"
[dataMapper]="dataMapper"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from "@angular/core";
import { Component, Input } from "@angular/core";
import { DynamicComponent } from "../../../core/config/dynamic-components/dynamic-component.decorator";
import { Todo } from "../model/todo";
import { FormDialogService } from "../../../core/form-dialog/form-dialog.service";
Expand Down Expand Up @@ -35,6 +35,9 @@ export class TodosDashboardComponent extends DashboardWidget {

startDateLabel: string = Todo.schema.get("startDate").label;

@Input() subtitle: string;
@Input() explanation: string;

constructor(
private formDialog: FormDialogService,
private currentUser: CurrentUserSubject,
Expand Down
Loading