Skip to content

Commit

Permalink
Merge pull request #1406 from Aam-Digital/master
Browse files Browse the repository at this point in the history
Co-authored-by: Schottkyc137 <45085299+Schottkyc137@users.noreply.github.com>
Co-authored-by: MattKNichols <mattknichols@gmail.com>
Co-authored-by: Sebastian <sebastian.leidig@gmail.com>
  • Loading branch information
4 people authored Aug 26, 2022
2 parents 5ef5431 + c198d07 commit b2540df
Show file tree
Hide file tree
Showing 46 changed files with 1,539 additions and 9,627 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ module.exports = {
"core": {
"builder": "@storybook/builder-webpack5"
}
}
}
10,043 changes: 712 additions & 9,331 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 26 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^14.1.1",
"@angular/cdk": "^14.1.1",
"@angular/common": "^14.1.1",
"@angular/compiler": "^14.1.1",
"@angular/core": "^14.1.1",
"@angular/animations": "^14.1.2",
"@angular/cdk": "^14.1.2",
"@angular/common": "^14.1.2",
"@angular/compiler": "^14.1.2",
"@angular/core": "^14.1.2",
"@angular/flex-layout": "^14.0.0-beta.40",
"@angular/forms": "^14.1.1",
"@angular/localize": "^14.1.1",
"@angular/material": "^14.1.1",
"@angular/platform-browser": "^14.1.1",
"@angular/platform-browser-dynamic": "^14.1.1",
"@angular/router": "^14.1.1",
"@angular/service-worker": "^14.1.1",
"@angular/forms": "^14.1.2",
"@angular/localize": "^14.1.2",
"@angular/material": "^14.1.2",
"@angular/platform-browser": "^14.1.2",
"@angular/platform-browser-dynamic": "^14.1.2",
"@angular/router": "^14.1.2",
"@angular/service-worker": "^14.1.2",
"@casl/ability": "^6.0.0",
"@casl/angular": "^7.0.1",
"@faker-js/faker": "^7.3.0",
"@faker-js/faker": "^7.4.0",
"@fortawesome/angular-fontawesome": "^0.11.1",
"@fortawesome/fontawesome-svg-core": "^6.1.2",
"@fortawesome/free-regular-svg-icons": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.2",
"@ngneat/until-destroy": "^9.2.1",
"@sentry/browser": "^7.9.0",
"@sentry/browser": "^7.11.0",
"angulartics2": "^12.1.0",
"assert": "^2.0.0",
"crypto-es": "^1.2.7",
Expand All @@ -63,21 +63,22 @@
"tslib": "^2.4.0",
"util": "^0.12.4",
"uuid": "^8.3.2",
"zone.js": "~0.11.7"
"webpack": "5.74.0",
"zone.js": "~0.11.8"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.1.1",
"@angular-devkit/build-angular": "^14.1.3",
"@angular-eslint/builder": "14.0.2",
"@angular-eslint/eslint-plugin": "14.0.2",
"@angular-eslint/eslint-plugin-template": "14.0.2",
"@angular-eslint/schematics": "14.0.2",
"@angular-eslint/template-parser": "14.0.2",
"@angular/cli": "^14.1.1",
"@angular/compiler-cli": "^14.1.1",
"@angular/cli": "^14.1.3",
"@angular/compiler-cli": "^14.1.2",
"@babel/core": "^7.18.10",
"@compodoc/compodoc": "^1.1.19",
"@cypress/schematic": "~2.0.0",
"@schematics/angular": "^14.1.1",
"@cypress/schematic": "~2.0.2",
"@schematics/angular": "^14.1.3",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.10",
Expand All @@ -95,11 +96,11 @@
"@types/node": "^16.0.0",
"@types/pouchdb": "^6.4.0",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "5.32.0",
"@typescript-eslint/parser": "5.32.0",
"@typescript-eslint/eslint-plugin": "5.33.1",
"@typescript-eslint/parser": "5.33.1",
"babel-loader": "^8.2.5",
"cypress": "10.4.0",
"eslint": "^8.21.0",
"cypress": "10.6.0",
"eslint": "^8.22.0",
"husky": "^8.0.1",
"jasmine-core": "^4.3.0",
"jasmine-spec-reporter": "^7.0.0",
Expand All @@ -120,6 +121,7 @@
"xliff": "^6.1.0"
},
"overrides": {
"webpack": "5.74.0",
"@casl/angular": {
"@angular/core": "$@angular/core"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,23 @@
class="mat-elevation-z1 attendance-block w-{{
attendanceData.getWarningLevel(forChild)
}}"
(mouseenter)="showTooltip()"
(mouseleave)="hideTooltip()"
[appTemplateTooltip]="tooltip"
>
<span *ngIf="attendanceData.getAttendancePercentage(forChild)">
{{ attendanceData.getAttendancePercentage(forChild) | percent: "1.0-0" }}
</span>
<span *ngIf="!attendanceData.getAttendancePercentage(forChild)"> - </span>
</span>

<div style="position: absolute" *ngIf="tooltip">
<div
class="mat-elevation-z3 attendance-tooltip"
(mouseenter)="showTooltip()"
(mouseleave)="hideTooltip()"
>
<div class="attendance-tooltip-header">
<ng-template #tooltip>
<div class="attendance-tooltip-container">
<strong>
{{ attendanceData.periodFrom | date: "shortDate" }} -
{{ attendanceData.periodTo | date: "shortDate" }}
{{ attendanceData.activity.title }}
</div>
</strong>

<div
class="attendance-tooltip-content"
i18n="
Attended Tooltip|How many attendees were present / how many attendees
were absent
Expand All @@ -33,20 +27,17 @@
attended {{ attendanceDescription }} events
</div>

<div
class="attendance-tooltip-content"
<em
*ngIf="logicalCount[LStatus.IGNORE] > 0"
i18n="Attended Tooltip|How many events were excluded"
>
(excluding {{ logicalCount[LStatus.IGNORE] }} events excused or unknown)
</div>
<div>
<app-attendance-calendar
[records]="attendanceData.events"
[highlightForChild]="forChild"
[activity]="attendanceData.activity"
>
</app-attendance-calendar>
</div>
</em>
<app-attendance-calendar
[records]="attendanceData.events"
[highlightForChild]="forChild"
[activity]="attendanceData.activity"
>
</app-attendance-calendar>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@
padding-bottom: 5px;
}

.attendance-tooltip {
position: relative;
top: -5px;
left: 5px;

padding: 8px;
background-color: white;
}
.attendance-tooltip-header {
text-align: center;
font-weight: bold;
}
.attendance-tooltip-content {
text-align: left;
font-size: 0.95em;
.attendance-tooltip-container {
padding: 0.5em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { AttendanceLogicalStatus } from "../model/attendance-status";
export class AttendanceBlockComponent implements OnChanges {
@Input() attendanceData: ActivityAttendance;
@Input() forChild: string;
tooltip = false;
tooltipTimeout;
LStatus = AttendanceLogicalStatus;
logicalCount: { [key in AttendanceLogicalStatus]?: number };

Expand All @@ -24,18 +22,6 @@ export class AttendanceBlockComponent implements OnChanges {
{};
}

showTooltip() {
if (this.tooltipTimeout) {
clearTimeout(this.tooltipTimeout);
}
this.tooltipTimeout = setTimeout(() => (this.tooltip = true), 1000);
}
hideTooltip() {
if (this.tooltipTimeout) {
clearTimeout(this.tooltipTimeout);
}
this.tooltipTimeout = setTimeout(() => (this.tooltip = false), 150);
}
get attendanceDescription(): string {
return `${this.logicalCount[this.LStatus.PRESENT]} / ${
(this.logicalCount[this.LStatus.PRESENT] || 0) +
Expand Down
2 changes: 2 additions & 0 deletions src/app/child-dev-project/attendance/attendance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import {
import { ConfigurableEnumModule } from "../../core/configurable-enum/configurable-enum.module";
import * as Hammer from "hammerjs";
import { TabStateModule } from "../../utils/tab-state/tab-state.module";
import { CommonComponentsModule } from "../../core/common-components/common-components.module";

@Injectable()
// Only allow horizontal swiping
Expand Down Expand Up @@ -132,6 +133,7 @@ export class HorizontalHammerConfig extends HammerGestureConfig {
ConfigurableEnumModule,
HammerModule,
TabStateModule,
CommonComponentsModule,
],
exports: [
ActivityCardComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Injectable } from "@angular/core";
import { Child } from "../model/child";
import { faker } from "../../../core/demo-data/faker";
import { Aser } from "./model/aser";
import { ConfigurableEnumValue } from "../../../core/configurable-enum/configurable-enum.interface";
import { mathLevels, readingLevels } from "./model/skill-levels";
import { WarningLevel } from "../../../core/entity/model/warning-level";

Expand Down Expand Up @@ -78,10 +77,7 @@ export class DemoAserGeneratorService extends DemoDataGenerator<Aser> {
* @param skillRange The array of skill levels for the desired subject (mathLevels or readingLevels)
* @param previousSkillLevel The string indicating the level from the previous test for this subject
*/
private selectNextSkillLevel(
skillRange: ConfigurableEnumValue[],
previousSkillLevel: ConfigurableEnumValue
): ConfigurableEnumValue {
private selectNextSkillLevel<T>(skillRange: T[], previousSkillLevel: T): T {
const previousSkillLevelIndex = skillRange.indexOf(previousSkillLevel);

let nextSkillLevelIndex;
Expand Down
102 changes: 52 additions & 50 deletions src/app/child-dev-project/children/aser/model/skill-levels.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
import {
ConfigurableEnumConfig,
ConfigurableEnumValue,
EMPTY,
} from "../../../../core/configurable-enum/configurable-enum.interface";
import { Ordering } from "../../../../core/configurable-enum/configurable-enum-ordering";

export type SkillLevel = ConfigurableEnumValue & { passed?: boolean };
export type SkillLevel = Ordering.EnumValue & { passed?: boolean };

export const readingLevels: ConfigurableEnumConfig<SkillLevel> = [
EMPTY,
{
id: "Nothing",
label: $localize`:Label reading level:Nothing`,
},
{
id: "Read Letters",
label: $localize`:Label reading level:Read Letters`,
},
{
id: "Read Words",
label: $localize`:Label reading level:Read Words`,
},
{
id: "Read Sentence",
label: $localize`:Label reading level:Read Sentence`,
},
{
id: "Read Paragraph",
label: $localize`:Label reading level:Read Paragraph`,
passed: true,
},
];
export const readingLevels: ConfigurableEnumConfig<SkillLevel> =
Ordering.imposeTotalOrdering([
EMPTY,
{
id: "Nothing",
label: $localize`:Label reading level:Nothing`,
},
{
id: "Read Letters",
label: $localize`:Label reading level:Read Letters`,
},
{
id: "Read Words",
label: $localize`:Label reading level:Read Words`,
},
{
id: "Read Sentence",
label: $localize`:Label reading level:Read Sentence`,
},
{
id: "Read Paragraph",
label: $localize`:Label reading level:Read Paragraph`,
passed: true,
},
]);

export const mathLevels: ConfigurableEnumConfig<SkillLevel> = [
EMPTY,
{
id: "Nothing",
label: $localize`:Label math level:Nothing`,
},
{
id: "Numbers 1-9",
label: $localize`:Label math level:Numbers 1-9`,
},
{
id: "Numbers 10-99",
label: $localize`:Label math level:Numbers 10-99`,
},
{
id: "Subtraction",
label: $localize`:Label math level:Subtraction`,
},
{
id: "Division",
label: $localize`:Label math level:Division`,
passed: true,
},
];
export const mathLevels: ConfigurableEnumConfig<SkillLevel> =
Ordering.imposeTotalOrdering([
EMPTY,
{
id: "Nothing",
label: $localize`:Label math level:Nothing`,
},
{
id: "Numbers 1-9",
label: $localize`:Label math level:Numbers 1-9`,
},
{
id: "Numbers 10-99",
label: $localize`:Label math level:Numbers 10-99`,
},
{
id: "Subtraction",
label: $localize`:Label math level:Subtraction`,
},
{
id: "Division",
label: $localize`:Label math level:Division`,
passed: true,
},
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<img [src]="entity?.photo?.photo?.value" class="child-pic" alt=""/>
<div>
<!-- Font-weight is applied as style to override the default -->
<h3 style="font-weight: bold">{{ entity?.name }}</h3>
<a><fa-icon icon="phone"></fa-icon> {{ entity?.phone }}</a>
<p *ngIf="entity?.schoolId || entity?.schoolClass">
<app-school-block
[entityId]="entity?.schoolId"
[linkDisabled]="true"
></app-school-block
>,
<ng-container i18n="The class a child is attending|e.g. 'class 8'" *ngIf="entity.schoolClass">
class {{ entity?.schoolClass }}
</ng-container>
</p>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@use "@angular/material" as mat;

.child-pic {
width: 80px;
height: 80px;
border-radius: 100vmax;
object-fit: cover;
border: 3px solid mat.get-color-from-palette(mat.$grey-palette, 500);
@include mat.elevation(2);
}

:host {
padding: 0.5em;
display: flex;
flex-direction: row;
gap: 2em;
align-items: center;
}
Loading

0 comments on commit b2540df

Please sign in to comment.