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

Bug/120 open absence payload without class teacher role #129

Merged
merged 17 commits into from
Sep 25, 2019
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@
border-bottom: 1px solid $border-color;
}

.filters {
display: block;
flex-direction: row;
align-items: flex-end;
}

.form-group {
flex: 1;
margin-right: $spacer;
margin-bottom: 0;
margin-bottom: 0.5rem;
float: left;
}

.buttons {
flex: none;
margin-right: 0;
}

.filters {
display: flex;
flex-direction: row;
align-items: flex-end;
padding-top: 31px;
float: left;
margin-bottom: 1rem;
}

.extended-filters-header {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<i class="material-icons">edit</i>
</a>
</div>
<table class="table">
<table class="table table-striped">
<thead>
<tr>
<th>
Expand Down Expand Up @@ -74,7 +74,10 @@
</thead>
<tbody>
<tr *ngFor="let entry of data.entries">
<td (click)="onCheckboxCellClick($event, checkbox)">
<td
class="edit-absences-checkbox"
(click)="onCheckboxCellClick($event, checkbox)"
>
<input
#checkbox
type="checkbox"
Expand All @@ -84,38 +87,40 @@
(change)="selectionService.toggle(entry.lessonPresence)"
/>
</td>
<td class="presence-category">
<td data-label="PRÄSENZ" class="presence-category">
<span [className]="entry.presenceCategory">
<i class="material-icons">{{ entry.presenceCategoryIcon }}</i>
</span>
</td>
<td>
<td data-label="NAME, FACH, KLASSE">
{{ entry.lessonPresence.StudentFullName }}
<br />
{{ entry.lessonPresence.EventDesignation }},
{{ entry.lessonPresence.StudyClassNumber }}
</td>
<td>
<td data-label="ZEIT">
{{
entry.lessonPresence.LessonDateTimeFrom | date: 'shortTime'
}}–{{
entry.lessonPresence.LessonDateTimeTo | date: 'shortTime'
}}
</td>
<td>{{ entry.confirmationState?.Value }}</td>
<td class="designation-comment">
<td data-label="STATUS">{{ entry.confirmationState?.Value }}</td>
<td data-label="GRUND, KOMMENTAR" class="designation-comment">
<ng-container *ngIf="!entry.canChangePresenceType">{{
entry.presenceType?.Designation
}}</ng-container
><br />
<span class="comment">{{ entry.lessonPresence.Comment }}</span>
</td>
<td>
<td data-label="DATUM">
{{
entry.lessonPresence.LessonDateTimeFrom | date: 'mediumDate'
}}
</td>
<td>{{ entry.lessonPresence.TeacherInformation }}</td>
<td data-label="LEHRKRAFT">
{{ entry.lessonPresence.TeacherInformation }}
</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

:host {
display: block;
min-width: $erz-edit-absences-min-width;
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
<div class="form-group">
<label>{{ 'evaluate-absences.header.student' | translate }}</label>
<erz-typeahead
[typeaheadService]="studentsService"
[(value)]="filter.student"
></erz-typeahead>
</div>
<div class="filters mb-2">
<div class="form-group">
<label>{{ 'evaluate-absences.header.student' | translate }}</label>
<erz-typeahead
[typeaheadService]="studentsService"
[(value)]="filter.student"
></erz-typeahead>
</div>

<div class="form-group">
<label>{{ 'evaluate-absences.header.module-instance' | translate }}</label>
<erz-typeahead
[typeaheadService]="moduleInstancesService"
[(value)]="filter.moduleInstance"
></erz-typeahead>
</div>
<div class="form-group">
<label>{{ 'evaluate-absences.header.module-instance' | translate }}</label>
<erz-typeahead
[typeaheadService]="moduleInstancesService"
[(value)]="filter.moduleInstance"
></erz-typeahead>
</div>

<div class="form-group">
<label>{{ 'evaluate-absences.header.study-class' | translate }}</label>
<erz-typeahead
[typeaheadService]="studyClassesService"
[(value)]="filter.studyClass"
></erz-typeahead>
</div>
<div class="form-group">
<label>{{ 'evaluate-absences.header.study-class' | translate }}</label>
<erz-typeahead
[typeaheadService]="studyClassesService"
[(value)]="filter.studyClass"
></erz-typeahead>
</div>

<div class="buttons">
<button type="button" class="btn btn-primary" (click)="show()">
{{ 'evaluate-absences.header.show' | translate }}
</button>
<div class="buttons">
<button type="button" class="btn btn-primary" (click)="show()">
{{ 'evaluate-absences.header.show' | translate }}
</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@
border-bottom: 1px solid $border-color;
}

.filters {
display: block;
flex-direction: row;
align-items: flex-end;
}

.form-group {
flex: 1;
margin-right: $spacer;
margin-bottom: 0;
margin-bottom: 0.5rem;
float: left;
}

.buttons {
flex: none;
margin-right: 0;
padding-top: 31px;
float: left;
margin-bottom: 1rem;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<div class="p-3" *erzLet="state.entries$ | async as entries">
<ng-container *ngIf="!(state.loading$ | async); else loading">
<ng-container *ngIf="entries && entries.length > 0; else noEntries">
<table class="table">
<table
class="table table-striped"
matSort
(matSortChange)="sortData($event)"
>
<thead>
<tr>
<th scope="col">
Expand All @@ -23,15 +27,17 @@
</thead>
<tbody>
<tr *ngFor="let entry of entries">
<td>{{ entry.StudentFullName }}</td>
<td>{{ entry.TotalAbsences }}</td>
<td>
<td data-label="NAME">{{ entry.StudentFullName }}</td>
<td data-label="TOTAL">{{ entry.TotalAbsences }}</td>
<td data-label="ENTSCHULDIGT">
{{ entry.TotalAbsencesValidExcuse }}
</td>
<td>{{ entry.TotalAbsencesWithoutExcuse }}</td>
<td>{{ entry.TotalAbsencesUnconfirmed }}</td>
<td>{{ entry.TotalIncidents }}</td>
<td>{{ entry.TotalHalfDays }}</td>
<td data-label="UNENTSCHULDIGT">
{{ entry.TotalAbsencesWithoutExcuse }}
</td>
<td data-label="OFFEN">{{ entry.TotalAbsencesUnconfirmed }}</td>
<td data-label="VERSPÄTUNG">{{ entry.TotalIncidents }}</td>
<td data-label="HALBTAGE">{{ entry.TotalHalfDays }}</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

:host {
display: block;
min-width: $erz-evaluate-absences-min-width;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.erz-container > form > div > button .spinner-border {
margin-top: 0 !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ import { OpenAbsencesService } from '../../services/open-absences.service';
describe('OpenAbsencesEditComponent', () => {
let component: OpenAbsencesEditComponent;
let fixture: ComponentFixture<OpenAbsencesEditComponent>;
let storeMock: any;

beforeEach(async(() => {
storeMock = {};
spyOn(localStorage, 'getItem').and.callFake(
(key: string) => storeMock[key] || null
);
spyOn(localStorage, 'setItem').and.callFake(
(key: string) => storeMock[key] || null
);

storeMock['CLX.LoginToken'] =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvYXV0aCIsImF1ZCI6Imh0dHBzOi8vZGV2NDIwMC8iLCJuYmYiOjE1NjkzOTM5NDMsImV4cCI6MTU2OTQwODM0MywidG9rZW5fcHVycG9zZSI6IlVzZXIiLCJzY29wZSI6IlR1dG9yaW5nIiwiY29uc3VtZXJfaWQiOiJkZXY0MjAwIiwidXNlcm5hbWUiOiJMMjQzMSIsImluc3RhbmNlX2lkIjoiR1ltVEVTVCIsImN1bHR1cmVfaW5mbyI6ImRlLUNIIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDo0MjAwIiwiaWRfbWFuZGFudCI6IjIxMCIsImlkX3BlcnNvbiI6IjI0MzEiLCJmdWxsbmFtZSI6IlRlc3QgUnVkeSIsInJvbGVzIjoiTGVzc29uVGVhY2hlclJvbGU7Q2xhc3NUZWFjaGVyUm9sZSIsInRva2VuX2lkIjoiMzc0OSJ9.9lDju5CIIUaISRSz0x8k-kcF7Q6IhN_6HEMOlnsiDRA';

TestBed.configureTestingModule(
buildTestModuleMetadata({
declarations: [OpenAbsencesEditComponent],
Expand All @@ -31,6 +43,8 @@ describe('OpenAbsencesEditComponent', () => {
});

it('should create', () => {
storeMock['CLX.LoginToken'] =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvYXV0aCIsImF1ZCI6Imh0dHBzOi8vZGV2NDIwMC8iLCJuYmYiOjE1NjkzOTM5NDMsImV4cCI6MTU2OTQwODM0MywidG9rZW5fcHVycG9zZSI6IlVzZXIiLCJzY29wZSI6IlR1dG9yaW5nIiwiY29uc3VtZXJfaWQiOiJkZXY0MjAwIiwidXNlcm5hbWUiOiJMMjQzMSIsImluc3RhbmNlX2lkIjoiR1ltVEVTVCIsImN1bHR1cmVfaW5mbyI6ImRlLUNIIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDo0MjAwIiwiaWRfbWFuZGFudCI6IjIxMCIsImlkX3BlcnNvbiI6IjI0MzEiLCJmdWxsbmFtZSI6IlRlc3QgUnVkeSIsInJvbGVzIjoiTGVzc29uVGVhY2hlclJvbGU7Q2xhc3NUZWFjaGVyUm9sZSIsInRva2VuX2lkIjoiMzc0OSJ9.9lDju5CIIUaISRSz0x8k-kcF7Q6IhN_6HEMOlnsiDRA';
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('OpenAbsencesListComponent', () => {
let openAbsencesService: OpenAbsencesService;
let entryA: OpenAbsencesEntry;
let entryB: OpenAbsencesEntry;
let storeMock: any;

beforeEach(async(() => {
entryA = new OpenAbsencesEntry([
Expand All @@ -27,6 +28,17 @@ describe('OpenAbsencesListComponent', () => {
buildLessonPresenceWithIds(12, 22)
]);

storeMock = {};
spyOn(localStorage, 'getItem').and.callFake(
(key: string) => storeMock[key] || null
);
spyOn(localStorage, 'setItem').and.callFake(
(key: string) => storeMock[key] || null
);

storeMock['CLX.LoginToken'] =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvYXV0aCIsImF1ZCI6Imh0dHBzOi8vZGV2NDIwMC8iLCJuYmYiOjE1NjkzOTM5NDMsImV4cCI6MTU2OTQwODM0MywidG9rZW5fcHVycG9zZSI6IlVzZXIiLCJzY29wZSI6IlR1dG9yaW5nIiwiY29uc3VtZXJfaWQiOiJkZXY0MjAwIiwidXNlcm5hbWUiOiJMMjQzMSIsImluc3RhbmNlX2lkIjoiR1ltVEVTVCIsImN1bHR1cmVfaW5mbyI6ImRlLUNIIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDo0MjAwIiwiaWRfbWFuZGFudCI6IjIxMCIsImlkX3BlcnNvbiI6IjI0MzEiLCJmdWxsbmFtZSI6IlRlc3QgUnVkeSIsInJvbGVzIjoiTGVzc29uVGVhY2hlclJvbGU7Q2xhc3NUZWFjaGVyUm9sZSIsInRva2VuX2lkIjoiMzc0OSJ9.9lDju5CIIUaISRSz0x8k-kcF7Q6IhN_6HEMOlnsiDRA';

TestBed.configureTestingModule(
buildTestModuleMetadata({
declarations: [OpenAbsencesListComponent],
Expand Down
19 changes: 16 additions & 3 deletions src/app/open-absences/services/open-absences.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ import { buildTestModuleMetadata } from 'src/spec-helpers';
import { OpenAbsencesService } from './open-absences.service';

describe('OpenAbsencesService', () => {
beforeEach(() =>
let storeMock: any;
beforeEach(() => {
storeMock = {};
spyOn(localStorage, 'getItem').and.callFake(
(key: string) => storeMock[key] || null
);
spyOn(localStorage, 'setItem').and.callFake(
(key: string) => storeMock[key] || null
);
storeMock['CLX.LoginToken'] =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvYXV0aCIsImF1ZCI6Imh0dHBzOi8vZGV2NDIwMC8iLCJuYmYiOjE1NjkzOTM5NDMsImV4cCI6MTU2OTQwODM0MywidG9rZW5fcHVycG9zZSI6IlVzZXIiLCJzY29wZSI6IlR1dG9yaW5nIiwiY29uc3VtZXJfaWQiOiJkZXY0MjAwIiwidXNlcm5hbWUiOiJMMjQzMSIsImluc3RhbmNlX2lkIjoiR1ltVEVTVCIsImN1bHR1cmVfaW5mbyI6ImRlLUNIIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDo0MjAwIiwiaWRfbWFuZGFudCI6IjIxMCIsImlkX3BlcnNvbiI6IjI0MzEiLCJmdWxsbmFtZSI6IlRlc3QgUnVkeSIsInJvbGVzIjoiTGVzc29uVGVhY2hlclJvbGU7Q2xhc3NUZWFjaGVyUm9sZSIsInRva2VuX2lkIjoiMzc0OSJ9.9lDju5CIIUaISRSz0x8k-kcF7Q6IhN_6HEMOlnsiDRA';

TestBed.configureTestingModule(
buildTestModuleMetadata({ providers: [OpenAbsencesService] })
)
);
);
});

it('should be created', () => {
storeMock['CLX.LoginToken'] =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvYXV0aCIsImF1ZCI6Imh0dHBzOi8vZGV2NDIwMC8iLCJuYmYiOjE1NjkzOTM5NDMsImV4cCI6MTU2OTQwODM0MywidG9rZW5fcHVycG9zZSI6IlVzZXIiLCJzY29wZSI6IlR1dG9yaW5nIiwiY29uc3VtZXJfaWQiOiJkZXY0MjAwIiwidXNlcm5hbWUiOiJMMjQzMSIsImluc3RhbmNlX2lkIjoiR1ltVEVTVCIsImN1bHR1cmVfaW5mbyI6ImRlLUNIIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDo0MjAwIiwiaWRfbWFuZGFudCI6IjIxMCIsImlkX3BlcnNvbiI6IjI0MzEiLCJmdWxsbmFtZSI6IlRlc3QgUnVkeSIsInJvbGVzIjoiTGVzc29uVGVhY2hlclJvbGU7Q2xhc3NUZWFjaGVyUm9sZSIsInRva2VuX2lkIjoiMzc0OSJ9.9lDju5CIIUaISRSz0x8k-kcF7Q6IhN_6HEMOlnsiDRA';
const service: OpenAbsencesService = TestBed.get(OpenAbsencesService);
expect(service).toBeTruthy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
display: flex;
flex-direction: column;
padding: 0.75 * $spacer $spacer;
background-color: $gray-100;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/components/spinner/spinner.component.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.spinner-container {
margin-top: 20vh;
text-align: center;
top: -131px;
min-height: 200px;
}

.spinner-border {
width: 3rem;
height: 3rem;
margin-top: 100px;
}
11 changes: 11 additions & 0 deletions src/app/shared/models/token-payload.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as t from 'io-ts';

const TokenPayload = t.type({
culture_info: t.string,
fullname: t.string,
id_person: t.number,
instance_id: t.string,
roles: t.string
});
type TokenPayload = t.TypeOf<typeof TokenPayload>;
export { TokenPayload };
12 changes: 11 additions & 1 deletion src/app/shared/services/lesson-presences-rest.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ import { EditAbsencesFilter } from 'src/app/edit-absences/services/edit-absences
describe('LessonPresencesRestService', () => {
let service: LessonPresencesRestService;
let httpTestingController: HttpTestingController;

let storeMock: any;
beforeEach(() => {
TestBed.configureTestingModule(buildTestModuleMetadata({}));
service = TestBed.get(LessonPresencesRestService);
httpTestingController = TestBed.get(HttpTestingController);

storeMock = {};
spyOn(localStorage, 'getItem').and.callFake(
(key: string) => storeMock[key] || null
);
spyOn(localStorage, 'setItem').and.callFake(
(key: string) => storeMock[key] || null
);
});

describe('.get', () => {
Expand Down Expand Up @@ -107,6 +115,8 @@ describe('LessonPresencesRestService', () => {

describe('.getListOfUnconfirmedClassTeacher', () => {
it('fetches list for class teacher filtered by unconfirmed state from settings', () => {
storeMock['CLX.LoginToken'] =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvYXV0aCIsImF1ZCI6Imh0dHBzOi8vZGV2NDIwMC8iLCJuYmYiOjE1NjkzOTM5NDMsImV4cCI6MTU2OTQwODM0MywidG9rZW5fcHVycG9zZSI6IlVzZXIiLCJzY29wZSI6IlR1dG9yaW5nIiwiY29uc3VtZXJfaWQiOiJkZXY0MjAwIiwidXNlcm5hbWUiOiJMMjQzMSIsImluc3RhbmNlX2lkIjoiR1ltVEVTVCIsImN1bHR1cmVfaW5mbyI6ImRlLUNIIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDo0MjAwIiwiaWRfbWFuZGFudCI6IjIxMCIsImlkX3BlcnNvbiI6IjI0MzEiLCJmdWxsbmFtZSI6IlRlc3QgUnVkeSIsInJvbGVzIjoiTGVzc29uVGVhY2hlclJvbGU7Q2xhc3NUZWFjaGVyUm9sZSIsInRva2VuX2lkIjoiMzc0OSJ9.9lDju5CIIUaISRSz0x8k-kcF7Q6IhN_6HEMOlnsiDRA';
const data: any[] = [];
service
.getListOfUnconfirmedClassTeacher()
Expand Down
Loading