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

Note Details redesign #1752

Merged
merged 49 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
035207c
dynamic component directive uses @Input bindings
TheSlimvReal Mar 21, 2023
04f9030
using @Input in dynamic dashboard components
TheSlimvReal Mar 21, 2023
afc2330
using @Input in all other dynamic components
TheSlimvReal Mar 21, 2023
4745e50
fixing tests
TheSlimvReal Mar 21, 2023
2c947e1
fixed remaining tests
TheSlimvReal Mar 22, 2023
cb85add
code cleanups
TheSlimvReal Mar 22, 2023
67199cd
fixed test
TheSlimvReal Mar 22, 2023
56b099d
removed unused import
TheSlimvReal Mar 22, 2023
ce1c1ca
fixed lodash imports
TheSlimvReal Mar 22, 2023
0823719
using locale date format on default
TheSlimvReal Mar 22, 2023
116b0f3
improved form configuration to already hold additional schema config
TheSlimvReal Mar 23, 2023
0ce612a
making note-details use forms
TheSlimvReal Feb 23, 2023
3205eee
note details component uses forms in UI
TheSlimvReal Feb 23, 2023
71dc580
note details is opened as form component
TheSlimvReal Feb 23, 2023
868af62
working on note deep copy
TheSlimvReal Feb 28, 2023
58d54e7
added todo for making attendance select a form
TheSlimvReal Mar 1, 2023
a8c97f8
removed unneeded openForm function
TheSlimvReal Mar 1, 2023
8740f43
added comment
TheSlimvReal Mar 1, 2023
fb8b9b7
added component for editing children with attendance
TheSlimvReal Mar 20, 2023
25a5a82
edit attendance component allows to select attendance
TheSlimvReal Mar 22, 2023
b202a9b
fixed tests
TheSlimvReal Mar 22, 2023
ced4f25
removed log
TheSlimvReal Mar 22, 2023
4671fb6
made note details forms configurable
TheSlimvReal Mar 23, 2023
edc16e3
added delete button
TheSlimvReal Mar 23, 2023
ac7d95b
not using deep clone anymore to keep enum equality
TheSlimvReal Mar 23, 2023
da0d4ac
fixed rebase
TheSlimvReal Mar 27, 2023
4adb2fb
making note-details use forms
TheSlimvReal Feb 23, 2023
51f0563
note details component uses forms in UI
TheSlimvReal Feb 23, 2023
aa3af29
note details is opened as form component
TheSlimvReal Feb 23, 2023
38b05d0
working on note deep copy
TheSlimvReal Feb 28, 2023
d890549
added todo for making attendance select a form
TheSlimvReal Mar 1, 2023
20d9b2e
edit attendance component allows to select attendance
TheSlimvReal Mar 22, 2023
cfc83e7
added delete button
TheSlimvReal Mar 23, 2023
75caf67
fix: using some buttons in all popups
TheSlimvReal Mar 23, 2023
d897f8b
fixed tests
TheSlimvReal Mar 23, 2023
776fc3f
removed log
TheSlimvReal Mar 27, 2023
fbd7916
Merge pull request #1794 from Aam-Digital/common_popup_buttons
TheSlimvReal Apr 3, 2023
a0edcff
cleaned up form dialog service
TheSlimvReal Apr 3, 2023
1776138
added configurable attachment to note
TheSlimvReal Apr 3, 2023
a999595
added missing @Input
TheSlimvReal Apr 3, 2023
739fa7e
fixed test
TheSlimvReal Apr 3, 2023
40219f8
added test for attendance selection
TheSlimvReal Apr 3, 2023
93ec815
Merge remote-tracking branch 'origin/master' into note_redesign
TheSlimvReal Apr 3, 2023
e1f4d0c
added further tests
TheSlimvReal Apr 4, 2023
b4bcec2
make corner close buttons look square
sleidig Apr 4, 2023
7973c0f
some layout and margin improvements
sleidig Apr 4, 2023
4c055b6
tweak styling of attendee list
sleidig Apr 4, 2023
2b6bfb3
fix displaying attendees on mobile
sleidig Apr 4, 2023
991f56e
add comment
TheSlimvReal Apr 4, 2023
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
Expand Up @@ -6,7 +6,6 @@ import { formatPercent, NgIf } from "@angular/common";
import { ActivityAttendance } from "../model/activity-attendance";
import moment from "moment";
import { FormFieldConfig } from "../../../core/entity-components/entity-form/entity-form/FormConfig";
import { FormDialogService } from "../../../core/form-dialog/form-dialog.service";
import { DynamicComponent } from "../../../core/view/dynamic-components/dynamic-component.decorator";
import { MatProgressBarModule } from "@angular/material/progress-bar";
import { MatSlideToggleModule } from "@angular/material/slide-toggle";
Expand All @@ -15,6 +14,7 @@ import { MatButtonModule } from "@angular/material/button";
import { EntitySubrecordComponent } from "../../../core/entity-components/entity-subrecord/entity-subrecord/entity-subrecord.component";
import { AttendanceCalendarComponent } from "../attendance-calendar/attendance-calendar.component";
import { AttendanceSummaryComponent } from "../attendance-summary/attendance-summary.component";
import { MatDialog } from "@angular/material/dialog";

@DynamicComponent("ActivityAttendanceSection")
@Component({
Expand Down Expand Up @@ -81,7 +81,7 @@ export class ActivityAttendanceSectionComponent implements OnInit {
constructor(
private attendanceService: AttendanceService,
@Inject(LOCALE_ID) private locale: string,
private formDialog: FormDialogService
private dialog: MatDialog
) {}

ngOnInit() {
Expand Down Expand Up @@ -149,8 +149,11 @@ export class ActivityAttendanceSectionComponent implements OnInit {
}

showDetails(activity: ActivityAttendance) {
this.formDialog.openDialog(AttendanceDetailsComponent, activity, {
forChild: this.forChild,
this.dialog.open(AttendanceDetailsComponent, {
sleidig marked this conversation as resolved.
Show resolved Hide resolved
data: {
forChild: this.forChild,
attendance: activity,
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class RollCallSetupComponent implements OnInit {
newNote.authors = [this.sessionService.getCurrentUser().name];

this.formDialog
.openDialog(NoteDetailsComponent, newNote)
.openFormPopup(newNote, [], NoteDetailsComponent)
.afterClosed()
.subscribe((createdNote: Note) => {
if (createdNote) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,6 @@ export class RollCallComponent implements OnChanges {
}

showDetails() {
this.formDialog.openDialog(NoteDetailsComponent, this.eventEntity);
this.formDialog.openFormPopup(this.eventEntity, [], NoteDetailsComponent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ export class AttendanceCalendarComponent implements OnChanges {
}

showEventDetails(selectedEvent: Note) {
this.formDialog.openDialog(NoteDetailsComponent, selectedEvent);
this.formDialog.openFormPopup(selectedEvent, [], NoteDetailsComponent);
}
}
7 changes: 7 additions & 0 deletions src/app/child-dev-project/attendance/attendance-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ export const attendanceComponents: ComponentTuple[] = [
"./dashboard-widgets/attendance-week-dashboard/attendance-week-dashboard.component"
).then((c) => c.AttendanceWeekDashboardComponent),
],
[
"EditAttendance",
() =>
import("./edit-attendance/edit-attendance.component").then(
(c) => c.EditAttendanceComponent
),
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -15,113 +15,110 @@
~ along with ndb-core. If not, see <http://www.gnu.org/licenses/>.
-->

<app-form-dialog-wrapper #dialogForm [entity]="entity" [readonly]="true">
<h1 mat-dialog-title>
<app-dialog-close mat-dialog-close></app-dialog-close>
{{ entity?.activity?.title }}: {{ entity.periodFrom | date: "shortDate" }} -
{{ entity.periodTo | date: "shortDate" }}
</h1>

<form #entityForm="ngForm">
<div
class="summary w-{{ entity.getWarningLevel() }}"
i18n="
<h1 mat-dialog-title>
<app-dialog-close mat-dialog-close></app-dialog-close>
{{ entity?.activity?.title }}: {{ entity.periodFrom | date: "shortDate" }} -
{{ entity.periodTo | date: "shortDate" }}
</h1>
<div mat-dialog-content>
<div
class="summary w-{{ entity.getWarningLevel() }}"
i18n="
Attendance|Attendance of a child (in percent) or the average of the
event (in percent)
"
>
Attendance:
{{
(forChild
? entity?.getAttendancePercentage(forChild)
: entity?.getAttendancePercentageAverage()
) | percent: "1.0-0"
}}
</div>
>
Attendance:
{{
(forChild
? entity?.getAttendancePercentage(forChild)
: entity?.getAttendancePercentageAverage()
) | percent: "1.0-0"
}}
</div>

<div class="flex-row flex-wrap gap-regular" *ngIf="forChild">
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="days present|How many days a child was present"
placeholder="days present"
[value]="entity.countEventsPresent(forChild)"
readonly
/>
</mat-form-field>
<div class="flex-row flex-wrap gap-regular" *ngIf="forChild">
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="days present|How many days a child was present"
placeholder="days present"
[value]="entity.countEventsPresent(forChild)"
readonly
/>
</mat-form-field>

<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="days absent|How many days a child was absent"
placeholder="days absent"
[value]="entity.countEventsAbsent(forChild)"
readonly
/>
</mat-form-field>
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="days absent|How many days a child was absent"
placeholder="days absent"
[value]="entity.countEventsAbsent(forChild)"
readonly
/>
</mat-form-field>

<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="days absent|How many days the presence or absence of a child is unknown"
placeholder="unknown status"
[value]="entity.countEventsWithUnknownStatus(forChild)"
readonly
/>
</mat-form-field>
</div>
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="days absent|How many days the presence or absence of a child is unknown"
placeholder="unknown status"
[value]="entity.countEventsWithUnknownStatus(forChild)"
readonly
/>
</mat-form-field>
</div>

<div class="flex-row flex-wrap gap-regular" *ngIf="!forChild">
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="Total present|How many children were present"
placeholder="Total present"
[value]="entity.countTotalPresent()"
readonly
/>
</mat-form-field>
<div class="flex-row flex-wrap gap-regular" *ngIf="!forChild">
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="Total present|How many children were present"
placeholder="Total present"
[value]="entity.countTotalPresent()"
readonly
/>
</mat-form-field>

<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="Total absent|How many children were absent"
placeholder="Total absent"
[value]="entity.countTotalAbsent()"
readonly
/>
</mat-form-field>
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="Total absent|How many children were absent"
placeholder="Total absent"
[value]="entity.countTotalAbsent()"
readonly
/>
</mat-form-field>

<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="Total unknown|How many children have an unknown presence or absence status"
placeholder="Total unknown"
[value]="entity.countEventsWithUnknownStatus()"
readonly
/>
</mat-form-field>
</div>
<mat-form-field>
<input
matInput
type="number"
i18n-placeholder="Total unknown|How many children have an unknown presence or absence status"
placeholder="Total unknown"
[value]="entity.countEventsWithUnknownStatus()"
readonly
/>
</mat-form-field>
</div>

<app-entity-subrecord
[records]="entity.events"
[columns]="eventsColumns"
clickMode="none"
(rowClick)="showEventDetails($event)"
[editable]="false"
>
</app-entity-subrecord>
<app-entity-subrecord
[records]="entity.events"
[columns]="eventsColumns"
clickMode="none"
(rowClick)="showEventDetails($event)"
[editable]="false"
>
</app-entity-subrecord>

<app-attendance-calendar
[records]="entity.events"
[highlightForChild]="forChild"
[activity]="entity.activity"
></app-attendance-calendar>
</form>
</app-form-dialog-wrapper>
<app-attendance-calendar
[records]="entity.events"
[highlightForChild]="forChild"
[activity]="entity.activity"
></app-attendance-calendar>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "../model/activity-attendance";
import { AttendanceLogicalStatus } from "../model/attendance-status";
import { RecurringActivity } from "../model/recurring-activity";
import { MatDialogRef } from "@angular/material/dialog";
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
import { EventNote } from "../model/event-note";
import { AttendanceService } from "../attendance.service";
import { MockedTestingModule } from "../../../utils/mocked-testing.module";
Expand All @@ -16,43 +16,43 @@ describe("AttendanceDetailsComponent", () => {
let component: AttendanceDetailsComponent;
let fixture: ComponentFixture<AttendanceDetailsComponent>;

beforeEach(
waitForAsync(() => {
const mockAttendanceService = jasmine.createSpyObj([
"createEventForActivity",
]);
mockAttendanceService.createEventForActivity.and.resolveTo(
new EventNote()
);
beforeEach(waitForAsync(() => {
const mockAttendanceService = jasmine.createSpyObj([
"createEventForActivity",
]);
mockAttendanceService.createEventForActivity.and.resolveTo(new EventNote());

const entity = ActivityAttendance.create(new Date(), [
generateEventWithAttendance(
[
["1", AttendanceLogicalStatus.PRESENT],
["2", AttendanceLogicalStatus.PRESENT],
["3", AttendanceLogicalStatus.ABSENT],
],
new Date("2020-01-01")
),
generateEventWithAttendance(
[
["1", AttendanceLogicalStatus.PRESENT],
["2", AttendanceLogicalStatus.ABSENT],
],
new Date("2020-01-02")
),
]);
entity.activity = RecurringActivity.create("Test Activity");

TestBed.configureTestingModule({
imports: [AttendanceDetailsComponent, MockedTestingModule.withState()],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: AttendanceService, useValue: mockAttendanceService },
const entity = ActivityAttendance.create(new Date(), [
generateEventWithAttendance(
[
["1", AttendanceLogicalStatus.PRESENT],
["2", AttendanceLogicalStatus.PRESENT],
["3", AttendanceLogicalStatus.ABSENT],
],
new Date("2020-01-01")
),
generateEventWithAttendance(
[
["1", AttendanceLogicalStatus.PRESENT],
["2", AttendanceLogicalStatus.ABSENT],
],
}).compileComponents();
})
);
new Date("2020-01-02")
),
]);
entity.activity = RecurringActivity.create("Test Activity");

TestBed.configureTestingModule({
imports: [AttendanceDetailsComponent, MockedTestingModule.withState()],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: AttendanceService, useValue: mockAttendanceService },
{
provide: MAT_DIALOG_DATA,
useValue: { attendance: new ActivityAttendance() },
},
],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(AttendanceDetailsComponent);
Expand Down
Loading