Author SHA1 Message Date
Adriano Markovic f5691ef3a3 [66] #REFACTOR 'layout: user'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
LocationBasedServices/maptology/master This commit looks good
{Added css flex classes.}
2020-03-18 13:04:09 +01:00
Adriano Markovic 8e3dc80fb8 [66] #REFACTOR 'layout: tables'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Revised layouts and solved linter issues with time-sheet.service.ts.}
2020-02-26 16:24:27 +01:00
Adriano Markovic 20108b282d [66] #REFACTOR 'layout: user'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Layout revised.}
2020-02-26 13:24:50 +01:00
Adriano Markovic aac6c5f5f3 [66] #REFACTOR 'layout: export'
{Revised the layout of the exort component.}
2020-02-26 12:05:52 +01:00
Adriano Markovic 3b644cece3 [66] #REFACTOR 'Layout: tables'
{Table view layout revised.}
2020-02-26 11:36:05 +01:00
Adriano Markovic 6b5f01a573 [66] #REFACTOR 'layout: privileges'
{Layout revised. Added content-layout.}
2020-02-26 11:13:07 +01:00
Adriano Markovic 98212476f4 Removed old templates. 2020-02-26 10:36:08 +01:00
Adriano Markovic eac84438f1 [66] #REFACTOR 'Component Renamed' 2020-02-26 10:34:01 +01:00
Adriano Markovic dfacfd4ff4 [66] #REFACTOR 'layout: notices'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Revised layout.}
2020-02-25 21:06:56 +01:00
Adriano Markovic 301578f241 [66] #REFACTOR 'layout: timesheet'
{Revised layout.}
2020-02-25 21:05:59 +01:00
Adriano Markovic 41dc0030c3 [misc] #REFACTOR 'layout: drawer'
{Moved the timesheet nav button up.}
2020-02-25 21:04:46 +01:00
Adriano Markovic 73ea8185a4 [66] #IMPLEMENT 'layout: header'
{Implemented the layout header layout and revised the basic layout.}
2020-02-25 21:03:52 +01:00
Adriano Markovic ff89c9a7cc [66] #REFACTOR 'component:time-sheet'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Layout revised.}
2020-02-19 22:08:28 +01:00
Adriano Markovic 7451e492c6 [66] #IMPLEMENT 'component:basic-layout'
{Basic layout component added and global stylesheet revised. }
2020-02-19 22:07:04 +01:00
23 changed files with 796 additions and 529 deletions
+8 -4
View File
@@ -29,9 +29,9 @@ import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip'; import { MatTooltipModule } from '@angular/material/tooltip';
import { MatButtonToggleModule } from "@angular/material/button-toggle"; import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { CdkTableModule } from "@angular/cdk/table"; import { CdkTableModule } from '@angular/cdk/table';
import { SatDatepickerModule, SatNativeDateModule } from 'saturn-datepicker' import { SatDatepickerModule, SatNativeDateModule } from 'saturn-datepicker';
import { LocationStrategy, PathLocationStrategy, registerLocaleData, DatePipe } from '@angular/common'; import { LocationStrategy, PathLocationStrategy, registerLocaleData, DatePipe } from '@angular/common';
import LocaleDE from '@angular/common/locales/de'; import LocaleDE from '@angular/common/locales/de';
@@ -44,6 +44,8 @@ import { AppComponent } from './app.component';
import { InsideComponent } from './layouts/inside.component'; import { InsideComponent } from './layouts/inside.component';
import { OutsideComponent } from './layouts/outside.component'; import { OutsideComponent } from './layouts/outside.component';
import { FooterComponent } from './layouts/footer.component'; import { FooterComponent } from './layouts/footer.component';
import { ContentLayoutComponent } from './layouts/content-layout.component';
import { ContentHeaderComponent } from './layouts/content-header.component';
import { ToolbarButtonComponent } from './widgets/toolbar-button.component'; import { ToolbarButtonComponent } from './widgets/toolbar-button.component';
import { LoginComponent } from './views/login.component'; import { LoginComponent } from './views/login.component';
@@ -108,7 +110,7 @@ import { DevicePositionService } from './services/device-position.service';
import { DevicePositionsComponent } from './views/device-positions.component'; import { DevicePositionsComponent } from './views/device-positions.component';
import { ChartComponent } from './widgets/chart.component'; import { ChartComponent } from './widgets/chart.component';
import { TimeSheetComponent } from './views/time-sheet.component'; import { TimeSheetComponent } from './views/time-sheet.component';
import { PlacesDialogComponent } from "./widgets/places-dialog.component"; import { PlacesDialogComponent } from './widgets/places-dialog.component';
/** /**
@@ -181,6 +183,8 @@ registerLocaleData(LocaleDE);
ChartComponent, ChartComponent,
TimeSheetComponent, TimeSheetComponent,
PlacesDialogComponent, PlacesDialogComponent,
ContentLayoutComponent,
ContentHeaderComponent,
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@@ -0,0 +1,4 @@
<mat-toolbar id="content-toolbar" [ngClass]="headerClass" [ngStyle]="headerStyle">
<ng-content select=".header-title"></ng-content>
<ng-content select=".header-actions"></ng-content>
</mat-toolbar>
@@ -0,0 +1,22 @@
import { Component, Input } from '@angular/core';
/**
* Simple content header component which is containing the name of the page on
* the left side and the action buttons on the right side.
*
* @author Adriano
*/
@Component({
selector: 'app-content-header',
templateUrl: './content-header.component.html'
})
export class ContentHeaderComponent {
/* Attributes which are forwarding the styles and classes
* to the mat-toolbar which where specified on the app-content-header.*/
@Input() headerStyle?: { [klass: string]: any; };
@Input() headerClass?: string | string[] | Set<string> | { [klass: string]: any; };
constructor() { }
}
@@ -0,0 +1,8 @@
<div class="outer-container" [ngClass]="layoutClass" [ngStyle]="layoutStyle">
<ng-content select="app-content-header"></ng-content>
<div #mainDiv class="inner-container">
<ng-content select="aside"></ng-content>
<ng-content select="main"></ng-content>
</div>
</div>
@@ -0,0 +1,32 @@
import { Component, AfterViewInit, ViewChild, ElementRef, Input } from '@angular/core';
/**
* Content layout component which displays an <app-header>
* on the top, a <main> on the left and an <aside> on the right side
* through angular projection.
* The <main> tag is mandatory and the other two can be omitted if necessary.
*
* @author Adriano
*/
@Component({
selector: 'app-content-layout',
templateUrl: './content-layout.component.html'
})
export class ContentLayoutComponent implements AfterViewInit {
/* Attributes which are forwarding the styles and classes
* to the div.outer-container which where specified on the app-content-layout.*/
@Input() layoutStyle?: { [klass: string]: any; };
@Input() layoutClass?: string | string[] | Set<string> | { [klass: string]: any; };
@ViewChild('mainDiv') mainDiv: ElementRef;
constructor() { }
ngAfterViewInit(): void {
const div: HTMLDivElement = this.mainDiv.nativeElement;
if (div.getElementsByTagName('main').length === 0) {
throw new Error('<main> tag not specified!');
}
}
}
@@ -8,6 +8,10 @@
<mat-icon class="icon-button">share</mat-icon> <mat-icon class="icon-button">share</mat-icon>
<span class="mat-button">{{ res.strings('privileges_title') }}</span> <span class="mat-button">{{ res.strings('privileges_title') }}</span>
</a> </a>
<a mat-list-item routerLink="/timesheet">
<mat-icon class="icon-button">access_time_icon</mat-icon>
<span class="mat-button">{{ res.strings('time_sheet_title') }}</span>
</a>
<a mat-list-item routerLink="/devices"> <a mat-list-item routerLink="/devices">
<mat-icon class="icon-button">devices</mat-icon> <mat-icon class="icon-button">devices</mat-icon>
<span class="mat-button">{{ res.strings('devices_title') }}</span> <span class="mat-button">{{ res.strings('devices_title') }}</span>
@@ -20,10 +24,6 @@
<mat-icon class="icon-button">cloud_download</mat-icon> <mat-icon class="icon-button">cloud_download</mat-icon>
<span class="mat-button">{{ res.strings('export_title') }}</span> <span class="mat-button">{{ res.strings('export_title') }}</span>
</a> </a>
<a mat-list-item routerLink="/timesheet">
<mat-icon class="icon-button">access_time_icon</mat-icon>
<span class="mat-button">{{ res.strings('time_sheet_title') }}</span>
</a>
<h3 mat-subheader>{{res.strings('drawer_settings')}}</h3> <h3 mat-subheader>{{res.strings('drawer_settings')}}</h3>
<a mat-list-item routerLink="/profile"> <a mat-list-item routerLink="/profile">
<mat-icon class="icon-button">perm_identity</mat-icon> <mat-icon class="icon-button">perm_identity</mat-icon>
@@ -39,7 +39,11 @@ export enum Grouping {
RAW = 4 /* Raw data which was extracted from the call to the '/users/current/visits' api */ RAW = 4 /* Raw data which was extracted from the call to the '/users/current/visits' api */
} }
type DateRange = { range?: SatDatepickerRangeValue<Date>, begin?: number, end?: number }; interface DateRange {
range?: SatDatepickerRangeValue<Date>;
begin?: number;
end?: number;
}
const COLUMN_SEPARATOR = ';'; const COLUMN_SEPARATOR = ';';
const LINE_SEPARATOR = '\r\n'; const LINE_SEPARATOR = '\r\n';
@@ -62,7 +66,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
fetching$ = new BehaviorSubject<boolean>(false); fetching$ = new BehaviorSubject<boolean>(false);
error$ = new BehaviorSubject<boolean>(false); error$ = new BehaviorSubject<boolean>(false);
private _visitsAvailable: boolean = false; private _visitsAvailable = false;
private visitsPage: VisitPage = TimeSheetService.emptyPage(); private visitsPage: VisitPage = TimeSheetService.emptyPage();
private request = 0; private request = 0;
@@ -114,8 +118,10 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
set grouped(grouped: Grouping) { set grouped(grouped: Grouping) {
if (grouped != null) { if (grouped != null) {
if (this._grouped !== grouped) { if (this._grouped !== grouped) {
if ((this._grouped === Grouping.DEFAULT || this.grouped === Grouping.BY_DAY_ACC) && this._breakTime) if ((this._grouped === Grouping.DEFAULT || this.grouped === Grouping.BY_DAY_ACC)
&& this._breakTime) {
this._breakTime = null; this._breakTime = null;
}
this._grouped = grouped; this._grouped = grouped;
this.updateTimeSheet(); this.updateTimeSheet();
} }
@@ -129,8 +135,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
set device(device: Device | null) { set device(device: Device | null) {
this._prevDevice = this._device; this._prevDevice = this._device;
this._device = device; this._device = device;
if (this._prevDevice === null && device === null) if (this._prevDevice === null && device === null) { return; }
return;
this.updateTimeSheet(); this.updateTimeSheet();
} }
@@ -141,8 +146,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
set breakTime(breakTime: number | null) { set breakTime(breakTime: number | null) {
this._prevBreakTime = this._breakTime; this._prevBreakTime = this._breakTime;
this._breakTime = breakTime; this._breakTime = breakTime;
if (this._prevBreakTime === null && breakTime === null) if (this._prevBreakTime === null && breakTime === null) { return; }
return;
this.updateTimeSheet(); this.updateTimeSheet();
} }
@@ -188,7 +192,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
} }
fetchData(): void { fetchData(): void {
if (this.fetching$.getValue()) return; if (this.fetching$.getValue()) { return; }
this.resetService(true); this.resetService(true);
this.fetchAllVisits(this.request); this.fetchAllVisits(this.request);
} }
@@ -263,8 +267,9 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
} }
}); });
/* Filter for specified device. */ /* Filter for specified device. */
if (this.device != null) if (this.device != null) {
filteredVisits = filteredVisits.filter(visit => visit.device === this.device.id); filteredVisits = filteredVisits.filter(visit => visit.device === this.device.id);
}
/* Map filtered visits to TimeSheetData */ /* Map filtered visits to TimeSheetData */
if (filteredVisits.length > 0) { if (filteredVisits.length > 0) {
@@ -274,10 +279,9 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
timeSheet = this.accumulateV2TsByDay(filteredVisits); timeSheet = this.accumulateV2TsByDay(filteredVisits);
break; break;
case Grouping.BY_DAY: case Grouping.BY_DAY:
let tsMap = this.mapV2TsByDay(filteredVisits); const tsMap = this.mapV2TsByDay(filteredVisits);
tsMap.forEach((ts: TimeSheetData[]) => { tsMap.forEach((ts: TimeSheetData[]) => {
if (ts.length > 0) if (ts.length > 0) { timeSheet.push(...ts); }
timeSheet.push(...ts);
}); });
break; break;
case Grouping.RAW: case Grouping.RAW:
@@ -327,29 +331,29 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
const timeSheetMap = new Map<number, TimeSheetData[]>(); const timeSheetMap = new Map<number, TimeSheetData[]>();
const rawTimeSheet: TimeSheetData[] = this.mapVisitsToTimeSheet(visits); const rawTimeSheet: TimeSheetData[] = this.mapVisitsToTimeSheet(visits);
const putInMap = (map: Map<number, TimeSheetData[]>, key: number, value: TimeSheetData) => { const putInMap = (map: Map<number, TimeSheetData[]>, key: number, value: TimeSheetData) => {
if (map.has(key)) if (map.has(key)) {
map.get(key).push(value); map.get(key).push(value);
else } else {
map.set(key, [value]); map.set(key, [value]);
}
}; };
if (rawTimeSheet.length > 0) { if (rawTimeSheet.length > 0) {
return rawTimeSheet return rawTimeSheet
.reduce((prevMap: Map<number, TimeSheetData[]>, currTS: TimeSheetData) => { .reduce((prevMap: Map<number, TimeSheetData[]>, currTS: TimeSheetData) => {
let beginMidnight = this.getMidnightDate(currTS.beginDate.getTime()).getTime(); const beginMidnight = this.getMidnightDate(currTS.beginDate.getTime()).getTime();
let endMidnight = this.getMidnightDate(currTS.endDate.getTime()).getTime(); const endMidnight = this.getMidnightDate(currTS.endDate.getTime()).getTime();
if (beginMidnight === endMidnight) { if (beginMidnight === endMidnight) {
putInMap(prevMap, beginMidnight, currTS); putInMap(prevMap, beginMidnight, currTS);
} } else {
else {
/* If beginDate & endDate are overlapping two or more days then split /* If beginDate & endDate are overlapping two or more days then split
* object into multiple TimeSheetData objects till endDate is reached. */ * object into multiple TimeSheetData objects till endDate is reached. */
const DAY = TimeSheetService.DAY_IN_MILLI; const DAY = TimeSheetService.DAY_IN_MILLI;
for (let j = beginMidnight + DAY; j <= endMidnight; j += DAY) { for (let j = beginMidnight + DAY; j <= endMidnight; j += DAY) {
const begin = (j == beginMidnight + DAY) ? currTS.beginDate.getTime() : j - DAY; const begin = (j === beginMidnight + DAY) ? currTS.beginDate.getTime() : j - DAY;
const end = j; const end = j;
const newTS = { const newTimeSheet = {
overlappingDays: false, overlappingDays: false,
beginDate: new Date(begin), beginDate: new Date(begin),
endDate: new Date(end), endDate: new Date(end),
@@ -357,7 +361,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
placeId: currTS.placeId, placeId: currTS.placeId,
deviceId: currTS.deviceId deviceId: currTS.deviceId
}; };
putInMap(prevMap, end - DAY, newTS); putInMap(prevMap, end - DAY, newTimeSheet);
} }
const newTS = { const newTS = {
@@ -400,8 +404,8 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
const places = new Set<number>(); const places = new Set<number>();
const devices = new Set<number>(); const devices = new Set<number>();
tsList.forEach((ts: TimeSheetData) => { tsList.forEach((ts: TimeSheetData) => {
if (ts.placeId) places.add(ts.placeId); if (ts.placeId) { places.add(ts.placeId); }
if (ts.deviceId) devices.add(ts.deviceId); if (ts.deviceId) { devices.add(ts.deviceId); }
}); });
const btThreshold = (this.breakTime) ? this.breakTime * 60_000 : 0; const btThreshold = (this.breakTime) ? this.breakTime * 60_000 : 0;
@@ -430,7 +434,6 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
{ sheet: null, acc: { hours: 0, minutes: 0 }, breakAcc: { hours: 0, minutes: 0} } { sheet: null, acc: { hours: 0, minutes: 0 }, breakAcc: { hours: 0, minutes: 0} }
); );
const accWorkingHours = this.processWorkingHours(timeAccumulation.acc, timeAccumulation.breakAcc); const accWorkingHours = this.processWorkingHours(timeAccumulation.acc, timeAccumulation.breakAcc);
timeSheet.push({ timeSheet.push({
overlappingDays: false, overlappingDays: false,
beginDate: new Date(erliestBegin), beginDate: new Date(erliestBegin),
@@ -459,10 +462,11 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
if (this.grouped === Grouping.DEFAULT) { if (this.grouped === Grouping.DEFAULT) {
let subtrahend = 0; let subtrahend = 0;
breaking = this.normalizeTime(breaking); breaking = this.normalizeTime(breaking);
if (working.hours >= 6 && breaking.hours === 0 && breaking.minutes < 30) if (working.hours >= 6 && breaking.hours === 0 && breaking.minutes < 30) {
subtrahend = 30 - breaking.minutes; subtrahend = 30 - breaking.minutes;
else if (working.hours >= 9 && breaking.hours === 0 && breaking.minutes < 45) } else if (working.hours >= 9 && breaking.hours === 0 && breaking.minutes < 45) {
subtrahend = 45 - breaking.minutes; subtrahend = 45 - breaking.minutes;
}
working.minutes -= subtrahend; working.minutes -= subtrahend;
if (working.minutes < 0) { if (working.minutes < 0) {
--working.hours; --working.hours;
@@ -470,14 +474,14 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
} }
/* Rounds up the minutes to a multiple of 15. */ /* Rounds up the minutes to a multiple of 15. */
if (working.minutes !== 0) if (working.minutes !== 0) {
working.minutes += Math.floor(15 - working.minutes % 15); working.minutes += Math.floor(15 - working.minutes % 15);
}
if (working.minutes === 60) { if (working.minutes === 60) {
++working.hours; ++working.hours;
working.minutes = 0; working.minutes = 0;
} }
if (working.hours >= 10) if (working.hours >= 10) { working = { hours: 10, minutes: 0 }; }
working = { hours: 10, minutes: 0 };
} }
return working; return working;
} }
@@ -489,10 +493,10 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
} }
private getMidnightDate(tstp: number): Date { private getMidnightDate(tstp: number): Date {
let midnight = new Date(tstp); const midnight = new Date(tstp);
midnight.setHours(0, 0, 0, 0); midnight.setHours(0, 0, 0, 0);
return midnight; return midnight;
}; }
private getWorkingTime(beginMillis: number, endMillis: number): Time { private getWorkingTime(beginMillis: number, endMillis: number): Time {
const beginMinutes = Math.floor(beginMillis / 1000 / 60); const beginMinutes = Math.floor(beginMillis / 1000 / 60);
@@ -517,12 +521,12 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
getWorkplaceString(data: TimeSheetData): string { getWorkplaceString(data: TimeSheetData): string {
let res = ''; let res = '';
if (data.placeId) { if (data.placeId) {
const place = this.workPlaces.find(place => place.id === data.placeId); const place = this.workPlaces.find(p => p.id === data.placeId);
res = this.getWorkplaceName(place); res = this.getWorkplaceName(place);
} else { } else {
data.placesSet.forEach(id => { data.placesSet.forEach(id => {
const place = this.workPlaces.find(place => place.id === id); const place = this.workPlaces.find(p => p.id === id);
res += this.getWorkplaceName(place) + ', ' res += this.getWorkplaceName(place) + ', ';
}); });
res = res.slice(0, res.length - 2); res = res.slice(0, res.length - 2);
} }
@@ -530,9 +534,9 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
} }
getDate(data: TimeSheetData): string { getDate(data: TimeSheetData): string {
if (this.grouped == Grouping.RAW) { if (this.grouped === Grouping.RAW) {
let prefix = ''; let prefix = '';
let date = formatDate(data.endDate, 'dd.LL.yyyy', 'de'); const date = formatDate(data.endDate, 'dd.LL.yyyy', 'de');
if (data.overlappingDays) { if (data.overlappingDays) {
prefix = formatDate(data.beginDate, 'dd', 'de') + ' - '; prefix = formatDate(data.beginDate, 'dd', 'de') + ' - ';
} }
@@ -552,13 +556,13 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
exportStr = this.createJSON(); exportStr = this.createJSON();
break; break;
} }
if (!exportStr) return false; if (!exportStr) { return false; }
/* '\ufeff' -> UTF-8 Header Byte prepended. */ /* '\ufeff' -> UTF-8 Header Byte prepended. */
const blob = new Blob(['\ufeff', exportStr], { type: `text/${type};` }); const blob = new Blob(['\ufeff', exportStr], { type: `text/${type};` });
const login = this.userService.getLogin(); const login = this.userService.getLogin();
let name = 'timesheet-export'; let name = 'timesheet-export';
if (login != null) name += '-' + login; if (login != null) { name += '-' + login; }
name += '-' + Date.now(); name += '-' + Date.now();
this.saveAs(`${name}.${type}`, blob); this.saveAs(`${name}.${type}`, blob);
return true; return true;
@@ -580,8 +584,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
} }
private createCSV(): string | null { private createCSV(): string | null {
if (this.data.length === 0) if (this.data.length === 0) { return null; }
return null;
let result = ''; let result = '';
result += 'DATE' + COLUMN_SEPARATOR; result += 'DATE' + COLUMN_SEPARATOR;
result += 'FROM' + COLUMN_SEPARATOR; result += 'FROM' + COLUMN_SEPARATOR;
@@ -609,7 +612,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
to: formatDate(td.endDate, 'H:mm', 'de'), to: formatDate(td.endDate, 'H:mm', 'de'),
workingTime: `${td.duration.hours} h ${td.duration.minutes} m`, workingTime: `${td.duration.hours} h ${td.duration.minutes} m`,
workplaces: this.getWorkplaceString(td) workplaces: this.getWorkplaceString(td)
} };
}) })
); );
} }
@@ -1,9 +1,12 @@
<div style="margin: 20px;"> <app-content-layout [layoutClass]="'table-page'">
<mat-toolbar> <app-content-header>
<div class="header-title">
<mat-icon>devices</mat-icon> <mat-icon>devices</mat-icon>
<span style="margin-left: 10px">{{ res.strings('devices_title') }}</span> <span>{{ res.strings('devices_title') }}</span>
</mat-toolbar> </div>
<div class="mat-elevation-z2"> </app-content-header>
<main class="mat-elevation-z2">
<ng-container *ngIf="loading.getValue()"> <ng-container *ngIf="loading.getValue()">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
@@ -65,6 +68,5 @@
<mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true"> <mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true">
</mat-paginator> </mat-paginator>
</div> </main>
</app-content-layout>
</div>
+18 -20
View File
@@ -1,17 +1,18 @@
<ng-container> <app-content-layout>
<div style="flex: 1 1 100%;"> <app-content-header [headerClass]="'header-transparent'">
<mat-toolbar style="margin-top:20px;background:transparent"> <div class="header-title">
<mat-icon style="margin-left:20px;">cloud_download</mat-icon> <mat-icon>cloud_download</mat-icon>
<span style="margin-left: 10px">{{ res.strings('export_title') }}</span> <span>{{ res.strings('export_title') }}</span>
</mat-toolbar> </div>
<mat-grid-list [cols]="columns" gutterSize="10" rowHeight="450" class="grid-layout"> </app-content-header>
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card"> <main class="flex-row-wrap justify-space-evenly">
<mat-card class="mat-typography user-card">
<mat-card-title-group> <mat-card-title-group>
<mat-card-title>{{ res.strings('export_explain_title') }}</mat-card-title> <mat-card-title>{{ res.strings('export_explain_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('export_explain_subtitle') }}</mat-card-subtitle> <mat-card-subtitle>{{ res.strings('export_explain_subtitle') }}</mat-card-subtitle>
</mat-card-title-group> </mat-card-title-group>
<mat-card-content style="min-height:130px"> <mat-card-content>
<p class="mat-body">{{ res.strings('export_explain_content') }}</p> <p class="mat-body">{{ res.strings('export_explain_content') }}</p>
<p class="mat-body">{{ res.strings('export_explain_process') }}</p> <p class="mat-body">{{ res.strings('export_explain_process') }}</p>
</mat-card-content> </mat-card-content>
@@ -30,9 +31,8 @@
</ng-template> </ng-template>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</mat-grid-tile>
<mat-grid-tile> <mat-card class="mat-typography user-card">
<mat-card class="mat-typography" class="user-card">
<mat-card-title-group> <mat-card-title-group>
<mat-card-title>{{ res.strings('export_download_title') }}</mat-card-title> <mat-card-title>{{ res.strings('export_download_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('export_download_subtitle') }}</mat-card-subtitle> <mat-card-subtitle>{{ res.strings('export_download_subtitle') }}</mat-card-subtitle>
@@ -41,23 +41,21 @@
<mat-list> <mat-list>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item> <mat-list-item>
<mat-label style="font-size:85%" matLine>{{ res.strings('export_devices') }}<div style="float: right;">{{ (exportService.devices | async)?.size }}</div></mat-label> <mat-label class="progress-label" matLine>{{ res.strings('export_devices') }}<div class="progress-float">{{ (exportService.devices | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.devices | async)" matLine></mat-progress-bar> <mat-progress-bar mode="determinate" [value]="progressValue(exportService.devices | async)" matLine></mat-progress-bar>
</mat-list-item> </mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item> <mat-list-item>
<mat-label style="font-size:85%" matLine>{{ res.strings('export_places') }}<div style="float: right;">{{ (exportService.places | async)?.size }}</div></mat-label> <mat-label class="progress-label" matLine>{{ res.strings('export_places') }}<div class="progress-float">{{ (exportService.places | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.places | async)" matLine></mat-progress-bar> <mat-progress-bar mode="determinate" [value]="progressValue(exportService.places | async)" matLine></mat-progress-bar>
</mat-list-item> </mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item> <mat-list-item>
<mat-label style="font-size:85%" matLine>{{ res.strings('export_visits') }}<div style="float: right;">{{ (exportService.visits | async)?.size }}</div></mat-label> <mat-label class="progress-label" matLine>{{ res.strings('export_visits') }}<div class="progress-float">{{ (exportService.visits | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.visits | async)" matLine></mat-progress-bar> <mat-progress-bar mode="determinate" [value]="progressValue(exportService.visits | async)" matLine></mat-progress-bar>
</mat-list-item> </mat-list-item>
</mat-list> </mat-list>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</mat-grid-tile> </main>
</mat-grid-list> </app-content-layout>
</div>
</ng-container>
@@ -12,7 +12,11 @@ import { Snackbars } from '../utils/snackbars';
@Component({ @Component({
selector: 'app-export', selector: 'app-export',
templateUrl: './export.component.html' templateUrl: './export.component.html',
styles: [
`.progress-label { font-size: 85% !important; }`,
`.progress-float { float: right; }`
]
}) })
export class ExportComponent implements OnInit, OnDestroy { export class ExportComponent implements OnInit, OnDestroy {
@@ -1,20 +1,32 @@
<mat-toolbar style="margin-top:20px;background:transparent"> <app-content-layout [layoutClass]="'table-page'">
<mat-icon style="margin-left:20px;">subject</mat-icon> <app-content-header>
<span style="margin-left: 10px">Logs</span> <div class="header-title">
<div flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px"> <mat-icon>subject</mat-icon>
<button mat-icon-button [matTooltip]="res.strings('manage_logs_connect_tooltip')" (click)="onConnect()" [disabled]="connected || (connecting | async)"> <span>Logs</span>
</div>
<div class="header-actions">
<button mat-icon-button
[matTooltip]="res.strings('manage_logs_connect_tooltip')"
(click)="onConnect()"
[disabled]="connected || (connecting | async)">
<mat-icon>play_circle_outline</mat-icon> <mat-icon>play_circle_outline</mat-icon>
</button> </button>
<button mat-icon-button [matTooltip]="res.strings('manage_logs_disconnect_tooltip')" (click)="onDisconnect()" [disabled]="!connected || (connecting | async)"> <button mat-icon-button
[matTooltip]="res.strings('manage_logs_disconnect_tooltip')"
(click)="onDisconnect()"
[disabled]="!connected || (connecting | async)">
<mat-icon>pause_circle_outline</mat-icon> <mat-icon>pause_circle_outline</mat-icon>
</button> </button>
<button mat-icon-button [matTooltip]="res.strings('manage_logs_clear_tooltip')" (click)="onClear()" [disabled]="(connecting | async)"> <button mat-icon-button
[matTooltip]="res.strings('manage_logs_clear_tooltip')"
(click)="onClear()"
[disabled]="(connecting | async)">
<mat-icon>not_interested</mat-icon> <mat-icon>not_interested</mat-icon>
</button> </button>
</div> </div>
</mat-toolbar> </app-content-header>
<div style="margin: 20px;">
<div class="mat-elevation-z2"> <main class="mat-elevation-z2">
<ng-container *ngIf="connecting | async"> <ng-container *ngIf="connecting | async">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
@@ -66,6 +78,5 @@
<mat-header-row *matHeaderRowDef="getColumns()"></mat-header-row> <mat-header-row *matHeaderRowDef="getColumns()"></mat-header-row>
<mat-row *matRowDef="let row; columns: getColumns();"></mat-row> <mat-row *matRowDef="let row; columns: getColumns();"></mat-row>
</mat-table> </mat-table>
</main>
</div> </app-content-layout>
</div>
@@ -1,15 +1,18 @@
<div style="margin: 20px;"> <app-content-layout [layoutClass]="'table-page'">
<mat-toolbar> <app-content-header>
<div class="header-title">
<mat-icon>forum</mat-icon> <mat-icon>forum</mat-icon>
<span style="margin-left: 10px">Hinweise</span> <span>{{ res.strings('manage_notices_title') }}</span>
<div flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px"> </div>
<app-language-select style="padding-top:5px;" [value]="language" (change)="language = $event"></app-language-select> <div class="header-actions flex-row-nowrap align-center">
<app-language-select [value]="language" (change)="language = $event"></app-language-select>
<button mat-icon-button matTooltip="Hinweis hinzufügen" routerLink="0" [disabled]="loading.getValue()"> <button mat-icon-button matTooltip="Hinweis hinzufügen" routerLink="0" [disabled]="loading.getValue()">
<mat-icon>add_circle_outline</mat-icon> <mat-icon>add_circle_outline</mat-icon>
</button> </button>
</div> </div>
</mat-toolbar> </app-content-header>
<div class="mat-elevation-z2">
<main class="mat-elevation-z2">
<ng-container *ngIf="loading.getValue()"> <ng-container *ngIf="loading.getValue()">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
@@ -90,6 +93,5 @@
<mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true"> <mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true">
</mat-paginator> </mat-paginator>
</div> </main>
</app-content-layout>
</div>
@@ -1,29 +1,40 @@
<div style="margin: 20px;"> <app-content-layout [layoutClass]="'table-page'">
<mat-toolbar> <app-content-header>
<div class="header-title">
<mat-icon>people</mat-icon> <mat-icon>people</mat-icon>
<span style="margin-left: 10px">{{ res.strings('manage_users_title') }}</span> <span>{{ res.strings('manage_users_title') }}</span>
<div flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px"> </div>
<div style="padding-top:15px;"> <div class="header-actions flex-row-nowrap">
<form #searchForm="ngForm" style="font-size: 12px"> <form #searchForm="ngForm" style="font-size: 12px">
<mat-form-field style="max-width:120px"> <mat-form-field style="max-width:120px">
<input matInput #termField="ngModel" maxlength="64" name="term" [placeholder]="res.strings('manage_users_term_placeholder')" [(ngModel)]="term" pattern="([A-Za-z]|[\u00C0-\u00FF]| ){0,64}" <input matInput #termField="ngModel"
maxlength="64" name="term"
[placeholder]="res.strings('manage_users_term_placeholder')"
[(ngModel)]="term"
pattern="([A-Za-z]|[\u00C0-\u00FF]| ){0,64}"
[disabled]="loading.getValue()" (keyup.enter)="onSearch()"> [disabled]="loading.getValue()" (keyup.enter)="onSearch()">
<mat-error *ngIf="termField.invalid"> <mat-error *ngIf="termField.invalid">
<ng-container [ngSwitch]="encode(termField.errors)"> <ng-container [ngSwitch]="encode(termField.errors)">
<ng-container *ngSwitchCase="FormErrorCode.REQUIRED">{{res.strings('manage_users_term_required')}}</ng-container> <ng-container *ngSwitchCase="FormErrorCode.REQUIRED">
<ng-container *ngSwitchCase="FormErrorCode.PATTERN">{{res.strings('manage_users_term_pattern')}}</ng-container> {{res.strings('manage_users_term_required')}}
</ng-container>
<ng-container *ngSwitchCase="FormErrorCode.PATTERN">
{{res.strings('manage_users_term_pattern')}}
</ng-container>
</ng-container> </ng-container>
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</form> </form>
</div> <button mat-icon-button
<button mat-icon-button [matTooltip]="res.strings('manage_users_search_tooltip')" (click)="onSearch()" [disabled]="loading.getValue()"> [matTooltip]="res.strings('manage_users_search_tooltip')"
(click)="onSearch()"
[disabled]="loading.getValue()">
<mat-icon>search</mat-icon> <mat-icon>search</mat-icon>
</button> </button>
</div> </div>
</app-content-header>
</mat-toolbar> <main class="mat-elevation-z2">
<div class="mat-elevation-z2">
<ng-container *ngIf="loading.getValue()"> <ng-container *ngIf="loading.getValue()">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
@@ -112,6 +123,5 @@
<mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true"> <mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true">
</mat-paginator> </mat-paginator>
</div> </main>
</app-content-layout>
</div>
@@ -4,21 +4,24 @@
</div> </div>
</ng-container> </ng-container>
<ng-template #content> <ng-template #content>
<div style="flex: 1 1 100%;"> <app-content-layout>
<mat-toolbar style="margin-top:20px;background:transparent"> <app-content-header [headerClass]="'header-transparent'">
<mat-icon style="margin-left:20px">message</mat-icon> <div class="header-title">
<span style="margin-left: 10px">{{ res.strings('notices_title') }}</span> <mat-icon>message</mat-icon>
</mat-toolbar> <span>{{ res.strings('notices_title') }}</span>
<div> </div>
<mat-grid-list [cols]="columns" gutterSize="10" rowHeight="480" class="grid-layout"> </app-content-header>
<main class="flex-row-wrap justify-space-evenly">
<ng-container *ngFor="let n of page.getValue().elements"> <ng-container *ngFor="let n of page.getValue().elements">
<ng-container *ngIf="canShow(n, getLanguage())"> <ng-container *ngIf="canShow(n, getLanguage())">
<mat-grid-tile colspan="1" rowspan="1"> <app-notice-card
<app-notice-card [language]="getLanguage()" [notice]="n" class="notice-card"></app-notice-card> [language]="getLanguage()"
</mat-grid-tile> [notice]="n"
class="flex-notice-card">
</app-notice-card>
</ng-container> </ng-container>
</ng-container> </ng-container>
</mat-grid-list> </main>
</div> </app-content-layout>
</div>
</ng-template> </ng-template>
+17 -12
View File
@@ -1,11 +1,16 @@
<div style="margin: 20px;"> <app-content-layout [layoutClass]="'table-page'">
<mat-toolbar> <app-content-header>
<div class="header-title">
<mat-icon>pie_chart_outlined</mat-icon> <mat-icon>pie_chart_outlined</mat-icon>
<span style="margin-left: 10px">{{ res.strings('places_title') }}</span> <span>{{ res.strings('places_title') }}</span>
<div style="padding-top:20px;" flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px"> </div>
<form style="font-size: 12px;" fxLayoutAlign="center center" flexLayout="row">
<mat-form-field fxFlex="1 1 180px"> <div class="header-actions">
<mat-select [placeholder]="res.strings('places_order_placeholder')" [value]="order.getValue()" (selectionChange)="order.next($event.source.value)"> <form style="font-size: 12px;">
<mat-form-field>
<mat-select [placeholder]="res.strings('places_order_placeholder')"
[value]="order.getValue()"
(selectionChange)="order.next($event.source.value)">
<mat-option *ngFor="let o of getOrders()" [value]="o"> <mat-option *ngFor="let o of getOrders()" [value]="o">
<span>{{ getOrderName(o) }}</span> <span>{{ getOrderName(o) }}</span>
</mat-option> </mat-option>
@@ -13,8 +18,9 @@
</mat-form-field> </mat-form-field>
</form> </form>
</div> </div>
</mat-toolbar> </app-content-header>
<div class="mat-elevation-z2">
<main class="mat-elevation-z2">
<ng-container *ngIf="loading.getValue() || deleting.getValue()"> <ng-container *ngIf="loading.getValue() || deleting.getValue()">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
@@ -72,6 +78,5 @@
<mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true"> <mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true">
</mat-paginator> </mat-paginator>
</div> </main>
</app-content-layout>
</div>
@@ -1,15 +1,20 @@
<div style="margin: 20px;"> <app-content-layout [layoutClass]="'table-page'">
<mat-toolbar> <app-content-header>
<div class="header-title">
<mat-icon>share</mat-icon> <mat-icon>share</mat-icon>
<span style="margin-left: 10px">{{ res.strings('privileges_title') }}</span> <span>{{ res.strings('privileges_title') }}</span>
<div flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px"> </div>
<button mat-icon-button [matTooltip]="res.strings('privileges_add_tooltip')" (click)="onAdd()" [disabled]="loading.getValue() || deleting.getValue()"> <div class="header-actions">
<button mat-icon-button
[matTooltip]="res.strings('privileges_add_tooltip')"
(click)="onAdd()"
[disabled]="loading.getValue() || deleting.getValue()">
<mat-icon>add_circle_outline</mat-icon> <mat-icon>add_circle_outline</mat-icon>
</button> </button>
</div> </div>
</app-content-header>
</mat-toolbar> <main class="mat-elevation-z2">
<div class="mat-elevation-z2">
<ng-container *ngIf="loading.getValue() || deleting.getValue()"> <ng-container *ngIf="loading.getValue() || deleting.getValue()">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
@@ -68,6 +73,5 @@
<mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true"> <mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true">
</mat-paginator> </mat-paginator>
</div> </main>
</app-content-layout>
</div>
@@ -1,15 +1,22 @@
<ng-container> <app-content-layout>
<mat-toolbar style="display: flex; background:transparent;"> <app-content-header [headerClass]="'header-transparent'">
<mat-icon style="margin-left: 5px;">access_time_icon</mat-icon> <div class="header-title">
<span style="margin-left: 10px">{{ res.strings('time_sheet_title') }}</span> <mat-icon>access_time_icon</mat-icon>
<span>{{ res.strings('time_sheet_title') }}</span>
</div>
<div flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px"> <div class="header-actions">
<button mat-icon-button <button mat-icon-button
[matTooltip]="res.strings('time_sheet_update_btn_tooltip')" [matTooltip]="res.strings('time_sheet_update_btn_tooltip')"
(click)="updateTimeSheetTable()"> (click)="updateTimeSheetTable()">
<mat-icon style="font-size: 18px;">update_icon</mat-icon> <mat-icon>update_icon</mat-icon>
</button> </button>
<button mat-icon-button
[matMenuTriggerFor]="exportMenu"
[matTooltip]="res.strings('time_sheet_export_btn_tooltip')">
<mat-icon>import_export</mat-icon>
</button>
<mat-menu #exportMenu="matMenu" class="mat-elevation-z1"> <mat-menu #exportMenu="matMenu" class="mat-elevation-z1">
<ng-template matMenuContent> <ng-template matMenuContent>
<button mat-menu-item <button mat-menu-item
@@ -24,20 +31,16 @@
</button> </button>
</ng-template> </ng-template>
</mat-menu> </mat-menu>
<button mat-icon-button
[matMenuTriggerFor]="exportMenu"
[matTooltip]="res.strings('time_sheet_export_btn_tooltip')">
<mat-icon >import_export</mat-icon>
</button>
</div> </div>
</mat-toolbar> </app-content-header>
<!-- Configuration Side Panel --> <!-- Configuration Side Panel -->
<div class="timesheet-container"> <aside>
<div class="timesheet-config"> <mat-list>
<mat-list class="config-col"> <mat-list-item class="flex-vrt-center">
<h3 mat-subheader class="flex-center">{{ res.strings('time_sheet_config_label') }}</h3> <h3 mat-subheader>{{ res.strings('time_sheet_config_label') }}</h3>
<mat-list-item class="flex-center toggle-btn"> </mat-list-item>
<mat-list-item class="flex-vrt-center">
<mat-button-toggle-group <mat-button-toggle-group
[(value)]="timeSheetService.grouped" [(value)]="timeSheetService.grouped"
name="groupingChoice" name="groupingChoice"
@@ -52,7 +55,8 @@
{{ res.strings('time_sheet_toggle_raw_label') }}</mat-button-toggle> {{ res.strings('time_sheet_toggle_raw_label') }}</mat-button-toggle>
</mat-button-toggle-group> </mat-button-toggle-group>
</mat-list-item> </mat-list-item>
<mat-form-field class="config-item" [matTooltip]="res.strings('time_sheet_select_device_tooltip')"> <mat-list-item class="vrt-margin">
<mat-form-field class="hrz-margin" [matTooltip]="res.strings('time_sheet_select_device_tooltip')">
<mat-label>{{ res.strings('time_sheet_select_device_label') }}</mat-label> <mat-label>{{ res.strings('time_sheet_select_device_label') }}</mat-label>
<mat-select <mat-select
[(value)]="timeSheetService.device"> [(value)]="timeSheetService.device">
@@ -64,7 +68,9 @@
</ng-container> </ng-container>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="config-item" [matTooltip]="res.strings('time_sheet_break_time_tooltip')"> </mat-list-item>
<mat-list-item class="vrt-margin">
<mat-form-field class="hrz-margin" [matTooltip]="res.strings('time_sheet_break_time_tooltip')">
<mat-label>{{ res.strings('time_sheet_break_time_label') }}</mat-label> <mat-label>{{ res.strings('time_sheet_break_time_label') }}</mat-label>
<mat-select <mat-select
[(value)]="timeSheetService.breakTime" [(value)]="timeSheetService.breakTime"
@@ -75,7 +81,9 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="config-item" [matTooltip]="res.strings('time_sheet_time_period_tooltip')"> </mat-list-item>
<mat-list-item class="vrt-margin">
<mat-form-field class="hrz-margin" [matTooltip]="res.strings('time_sheet_time_period_tooltip')">
<input matInput <input matInput
[placeholder]="res.strings('time_sheet_time_period_label')" [placeholder]="res.strings('time_sheet_time_period_label')"
[satDatepicker]="picker" [satDatepicker]="picker"
@@ -84,41 +92,43 @@
<sat-datepicker #picker [rangeMode]="true" orderPeriodLabel="month"></sat-datepicker> <sat-datepicker #picker [rangeMode]="true" orderPeriodLabel="month"></sat-datepicker>
<sat-datepicker-toggle matSuffix [for]="picker"></sat-datepicker-toggle> <sat-datepicker-toggle matSuffix [for]="picker"></sat-datepicker-toggle>
</mat-form-field> </mat-form-field>
</mat-list> </mat-list-item>
<mat-divider class="divider"></mat-divider> <mat-divider class="divider"></mat-divider>
<mat-list class="config-col"> <mat-list-item class="flex-vrt-center">
<button mat-subheader mat-button class="config-item" (click)="openWorkPlacesDialog()"> <button mat-subheader mat-button (click)="openWorkPlacesDialog()">
<mat-icon class="icon-button">list_icon</mat-icon> <mat-icon class="icon-button">list_icon</mat-icon>
<span>{{ res.strings('time_sheet_workplace_button') }}</span> <span>{{ res.strings('time_sheet_workplace_button') }}</span>
</button> </button>
</mat-list-item>
<ng-container *ngIf="workPlaces.length > 0"> <ng-container *ngIf="workPlaces.length > 0">
<mat-divider class="divider"></mat-divider> <mat-divider class="divider"></mat-divider>
<div class="config-item" *ngFor="let workPlace of workPlaces"> <mat-list-item class="hrz-margin" *ngFor="let workPlace of workPlaces">
<button mat-icon-button (click)="deleteWorkPlaceEntry(workPlace)"> <button mat-icon-button (click)="deleteWorkPlaceEntry(workPlace)">
<mat-icon class="icon-button">clear_icon</mat-icon> <mat-icon class="icon-button">clear_icon</mat-icon>
</button> </button>
<span fxLayoutAlign="center" fxFlex="1 1 auto">{{ getWorkplaceName(workPlace) }}</span> <span>{{ getWorkplaceName(workPlace) }}</span>
</div> </mat-list-item>
<mat-divider class="divider"></mat-divider> <mat-divider class="divider"></mat-divider>
<mat-list-item>
<button mat-button style="margin-bottom: 10px;" (click)="clearWorkPlaceList()" color="primary"> <button mat-button style="margin-bottom: 10px;" (click)="clearWorkPlaceList()" color="primary">
<mat-icon class="icon-button" style="margin-left: 12px">delete_icon</mat-icon> <mat-icon class="icon-button" style="margin-left: 12px">delete_icon</mat-icon>
<span>{{ res.strings('time_sheet_workplace_clear_list') }}</span> <span>{{ res.strings('time_sheet_workplace_clear_list') }}</span>
</button> </button>
</mat-list-item>
</ng-container> </ng-container>
</mat-list> </mat-list>
</div> </aside>
<!-- Table Content --> <!-- Table Content -->
<main class="mat-elevation-z2">
<ng-container *ngIf="false"> <ng-container *ngIf="false">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container> </ng-container>
<mat-card class="main-content mat-elevation-z2">
<mat-card-content>
<table mat-table #timeSheet class="main-table" [dataSource]="timeSheetDataSource"> <table mat-table #timeSheet class="main-table" [dataSource]="timeSheetDataSource">
<ng-container matColumnDef="date"> <ng-container matColumnDef="date">
@@ -159,7 +169,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="showTimeSheetRowInfo(row)"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="showTimeSheetRowInfo(row)"></tr>
</table> </table>
<mat-paginator #paginator [pageSizeOptions]="[10, 20, 50, 100]" showFirstLastButtons></mat-paginator> <mat-paginator #paginator [pageSizeOptions]="[10, 20, 50, 100]" showFirstLastButtons></mat-paginator>
</mat-card-content> </main>
</mat-card> </app-content-layout>
</div>
</ng-container>
@@ -1,15 +1,15 @@
import { Component, OnInit, HostListener, ViewChild, OnDestroy, AfterViewInit } from '@angular/core'; import { Component, OnInit, HostListener, ViewChild, OnDestroy, AfterViewInit } from '@angular/core';
import { Time, formatDate } from '@angular/common'; import { Time, formatDate } from '@angular/common';
import { MatPaginator } from "@angular/material/paginator"; import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from "@angular/material/table"; import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from "@angular/material/dialog"; import { MatDialog } from '@angular/material/dialog';
import { Subscription } from "rxjs"; import { Subscription } from 'rxjs';
import { ResourceService } from "../services/resource.service"; import { ResourceService } from '../services/resource.service';
import { DeviceService } from "../services/device.service"; import { DeviceService } from '../services/device.service';
import { TimeSheetService, TimeSheetData, Grouping } from '../services/time-sheet.service'; import { TimeSheetService, TimeSheetData, Grouping } from '../services/time-sheet.service';
import { PlacesDialogComponent } from "../widgets/places-dialog.component"; import { PlacesDialogComponent } from '../widgets/places-dialog.component';
import { Device, Place } from '../../api/models'; import { Device, Place } from '../../api/models';
import { MessageDialogComponent } from '../widgets/message-dialog.component'; import { MessageDialogComponent } from '../widgets/message-dialog.component';
@@ -23,42 +23,34 @@ import { MessageDialogComponent } from '../widgets/message-dialog.component';
* absence from a defined "working place" should be booked as a break. * absence from a defined "working place" should be booked as a break.
* 2. Summed -> Shows the time entries per day without any processing at all. * 2. Summed -> Shows the time entries per day without any processing at all.
* 3. By Day -> Shows every single time entry. Due to that a single day can occure frequently. * 3. By Day -> Shows every single time entry. Due to that a single day can occure frequently.
*
* @author Adriano
*/ */
@Component({ @Component({
selector: 'app-time-sheet', selector: 'app-time-sheet',
templateUrl: './time-sheet.component.html', templateUrl: './time-sheet.component.html',
styles: [ styles: [
`.flex-center { display: flex; flex: 1 1 auto; justify-content: center; }`, `mat-list .hrz-margin { width: 100%; margin-left: 32px; margin-right: 32px; }`,
`.divider { margin: 16px; }`, `mat-list .vrt-margin { margin-top: 20px; margin-bottom: 20px; }`,
`.timesheet-container { `mat-list .divider { margin: 16px; }`,
display: flex; `.main-table { width: 100%; }`,
flex-flow: row-reverse wrap; `.main-table .mat-column-date { width: 16% !important; }`,
justify-content: center; `.main-table .mat-column-to-time, .mat-column-from-time { width: 7% !important; }`,
align-items: flex-start; `.main-table .mat-column-time { width: 10% !important; }`,
}`, `.main-table .mat-column-device { width: 20% !important; }`,
`.timesheet-config { width: 350px; max-width: 350px; }`, `.main-table .mat-column-place { width: 40% !important; }`
`.config-col { display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; }`,
`.config-col .config-item { margin-left: 32px; margin-right: 32px; }`,
'.config-col .toggle-btn { font-size: 14px; margin: 20px 0px }',
`.main-content { flex: 1 1 auto; margin: 4px; padding: 8px 16px; }`,
`.main-content .main-table { width: 100%; }`,
`.main-content .mat-column-date { width: 16% !important; }`,
`.main-content .mat-column-to-time, .mat-column-from-time { width: 7% !important; }`,
`.main-content .mat-column-time { width: 10% !important; }`,
`.main-content .mat-column-device { width: 20% !important; }`,
`.main-content .mat-column-place { width: 40% !important; }`
], ],
}) })
export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit { export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit {
private static readonly LAYOUT_BREAKPOINT = 960; private static readonly LAYOUT_BREAKPOINT = 960;
readonly breakTimeOptions = [5, 10, 15, 20, 30, 45, 60, 90, 120, 150, 180];
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
compact = false;
static readonly normalDisplayCol = ['date', 'from-time', 'to-time', 'time', 'device', 'place']; static readonly normalDisplayCol = ['date', 'from-time', 'to-time', 'time', 'device', 'place'];
static readonly compactDisplayCol = ['date', 'time']; static readonly compactDisplayCol = ['date', 'time'];
readonly breakTimeOptions = [5, 10, 15, 20, 30, 45, 60, 90, 120, 150, 180];
@ViewChild(MatPaginator) paginator: MatPaginator;
compact = false;
displayedColumns = TimeSheetComponent.normalDisplayCol; displayedColumns = TimeSheetComponent.normalDisplayCol;
workPlaces: Place[]; workPlaces: Place[];
@@ -101,20 +93,22 @@ export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit {
} }
updateTimeSheetTable(): void { updateTimeSheetTable(): void {
if (!this.timeSheetService.fetching$.getValue()) if (!this.timeSheetService.fetching$.getValue()) {
this.timeSheetService.fetchData(); this.timeSheetService.fetchData();
} }
}
exportTimeSheet(type: string): void { exportTimeSheet(type: string): void {
if (!this.timeSheetService.exportTimeSheet(type)) if (!this.timeSheetService.exportTimeSheet(type)) {
this.openMessageDialog( this.openMessageDialog(
this.res.strings('time_sheet_export_error_msg_title'), this.res.strings('time_sheet_export_error_msg_title'),
this.res.strings('time_sheet_export_error_msg') this.res.strings('time_sheet_export_error_msg')
); );
} }
}
showTimeSheetRowInfo(data: TimeSheetData): void { showTimeSheetRowInfo(data: TimeSheetData): void {
if (!this.compact) return; if (!this.compact) { return; }
const res_values = [ const res_values = [
'time_sheet_table_date', 'time_sheet_table_from', 'time_sheet_table_to', 'time_sheet_table_date', 'time_sheet_table_from', 'time_sheet_table_to',
@@ -126,7 +120,7 @@ export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit {
`${this.getWorkplaceString(data)}`, `${this.getWorkplaceString(data)}` `${this.getWorkplaceString(data)}`, `${this.getWorkplaceString(data)}`
]; ];
let msg = ''; let msg = '';
res_values.forEach((val: string, idx: number, _) => msg += `${this.res.strings(val)}: ${data_values[idx]}; `) res_values.forEach((val: string, idx: number, _) => msg += `${this.res.strings(val)}: ${data_values[idx]}; `);
this.openMessageDialog(this.res.strings('time_sheet_table_row_dialog_title'), msg.slice(0, msg.length - 2)); this.openMessageDialog(this.res.strings('time_sheet_table_row_dialog_title'), msg.slice(0, msg.length - 2));
} }
@@ -150,12 +144,12 @@ export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit {
getDeviceNameString(data: TimeSheetData): string { getDeviceNameString(data: TimeSheetData): string {
let res = ''; let res = '';
if (data.deviceId) { if (data.deviceId) {
const device = this.devices.find(device => device.id === data.deviceId); const device = this.devices.find(d => d.id === data.deviceId);
res = device.model; res = device.model;
} else { } else {
data.devicesSet.forEach(id => { data.devicesSet.forEach(id => {
const device = this.devices.find(place => place.id === id); const device = this.devices.find(place => place.id === id);
res += device.model + '; ' res += device.model + '; ';
}); });
res = res.slice(0, res.length - 2); res = res.slice(0, res.length - 2);
} }
@@ -164,9 +158,9 @@ export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit {
getWorkingTime(time: Time): string { getWorkingTime(time: Time): string {
let res = ''; let res = '';
if (time.hours != 0) res += String(time.hours) + ' h '; if (time.hours !== 0) { res += String(time.hours) + ' h '; }
if (time.minutes != 0) res += String(time.minutes) + ' m'; if (time.minutes !== 0) { res += String(time.minutes) + ' m'; }
if (res === '') res = '-'; if (res === '') { res = '-'; }
return res; return res;
} }
+19 -24
View File
@@ -1,11 +1,12 @@
<ng-container *ngIf="idle | async;else progressBar"> <app-content-layout *ngIf="idle | async;else progressBar">
<div *ngIf="user | async as u;else progressBar" style="flex: 1 1 100%;"> <app-content-header [headerClass]="'header-transparent'">
<mat-toolbar style="margin-top:20px;background:transparent"> <div class="header-title">
<mat-icon style="margin-left:20px;">perm_identity</mat-icon> <mat-icon>perm_identity</mat-icon>
<span style="margin-left: 10px">{{ res.strings('user_title') }}</span> <span>{{ res.strings('user_title') }}</span>
</mat-toolbar> </div>
<mat-grid-list [cols]="columns" gutterSize="10" rowHeight="350" class="grid-layout"> </app-content-header>
<mat-grid-tile>
<main *ngIf="user | async as u;else progressBar" class="flex-row-wrap justify-space-evenly">
<mat-card class="mat-typography" class="user-card"> <mat-card class="mat-typography" class="user-card">
<mat-card-title-group> <mat-card-title-group>
<mat-card-title>{{ res.strings('user_change_title') }}</mat-card-title> <mat-card-title>{{ res.strings('user_change_title') }}</mat-card-title>
@@ -28,15 +29,14 @@
</mat-form-field> </mat-form-field>
</form> </form>
</mat-card-content> </mat-card-content>
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center"> <mat-card-actions class="flex-vrt-center">
<button #loginButton mat-raised-button color="primary" [disabled]="userForm.pristine || userForm.invalid" (click)="onChangeUser()"> <button #loginButton mat-raised-button color="primary" [disabled]="userForm.pristine || userForm.invalid" (click)="onChangeUser()">
<mat-icon class="icon-button">save</mat-icon> <mat-icon class="icon-button">save</mat-icon>
<span>{{ res.strings('button_save') }}</span> <span>{{ res.strings('button_save') }}</span>
</button> </button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</mat-grid-tile>
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card"> <mat-card class="mat-typography" class="user-card">
<mat-card-title>{{ res.strings('user_password_title') }}</mat-card-title> <mat-card-title>{{ res.strings('user_password_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('user_password_subtitle') }}</mat-card-subtitle> <mat-card-subtitle>{{ res.strings('user_password_subtitle') }}</mat-card-subtitle>
@@ -46,15 +46,14 @@
<app-password-field #newPassword name="newPassword" [label]="res.strings('user_password_new')" [hint]="res.strings('user_password_new_hint')" (keyup.enter)="passwordForm.valid && onChangePassword()"></app-password-field> <app-password-field #newPassword name="newPassword" [label]="res.strings('user_password_new')" [hint]="res.strings('user_password_new_hint')" (keyup.enter)="passwordForm.valid && onChangePassword()"></app-password-field>
</form> </form>
</mat-card-content> </mat-card-content>
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center"> <mat-card-actions class="flex-vrt-center">
<button mat-raised-button color="primary" (click)="onChangePassword()" [disabled]="passwordForm.pristine || passwordForm.invalid"> <button mat-raised-button color="primary" (click)="onChangePassword()" [disabled]="passwordForm.pristine || passwordForm.invalid">
<mat-icon class="icon-button">lock_outline</mat-icon> <mat-icon class="icon-button">lock_outline</mat-icon>
<span>{{ res.strings('button_change') }}</span> <span>{{ res.strings('button_change') }}</span>
</button> </button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</mat-grid-tile>
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card"> <mat-card class="mat-typography" class="user-card">
<mat-card-title>{{ res.strings('user_add_email_title') }}</mat-card-title> <mat-card-title>{{ res.strings('user_add_email_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('user_add_email_subtitle') }}</mat-card-subtitle> <mat-card-subtitle>{{ res.strings('user_add_email_subtitle') }}</mat-card-subtitle>
@@ -64,15 +63,14 @@
</form> </form>
<div style="height:70px"></div> <div style="height:70px"></div>
</mat-card-content> </mat-card-content>
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center"> <mat-card-actions class="flex-vrt-center">
<button mat-raised-button color="primary" (click)="onAddEmail()" [disabled]="emailForm.pristine || emailForm.invalid"> <button mat-raised-button color="primary" (click)="onAddEmail()" [disabled]="emailForm.pristine || emailForm.invalid">
<mat-icon class="icon-button">add</mat-icon> <mat-icon class="icon-button">add</mat-icon>
<span>{{ res.strings('button_add') }}</span> <span>{{ res.strings('button_add') }}</span>
</button> </button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</mat-grid-tile>
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card"> <mat-card class="mat-typography" class="user-card">
<mat-card-title>{{ res.strings('user_del_email_title') }}</mat-card-title> <mat-card-title>{{ res.strings('user_del_email_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('user_del_email_subtitle') }}</mat-card-subtitle> <mat-card-subtitle>{{ res.strings('user_del_email_subtitle') }}</mat-card-subtitle>
@@ -89,8 +87,7 @@
</mat-list> </mat-list>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</mat-grid-tile>
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card"> <mat-card class="mat-typography" class="user-card">
<mat-card-title>{{ res.strings('user_delete_title') }}</mat-card-title> <mat-card-title>{{ res.strings('user_delete_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('user_delete_subtitle') }}</mat-card-subtitle> <mat-card-subtitle>{{ res.strings('user_delete_subtitle') }}</mat-card-subtitle>
@@ -100,17 +97,15 @@
</form> </form>
<div style="height:70px"></div> <div style="height:70px"></div>
</mat-card-content> </mat-card-content>
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center"> <mat-card-actions class="flex-vrt-center">
<button mat-raised-button color="primary" (click)="onDeleteUser()" [disabled]="deleteForm.pristine || deleteForm.invalid"> <button mat-raised-button color="primary" (click)="onDeleteUser()" [disabled]="deleteForm.pristine || deleteForm.invalid">
<mat-icon class="icon-button">delete</mat-icon> <mat-icon class="icon-button">delete</mat-icon>
<span>{{ res.strings('button_delete') }}</span> <span>{{ res.strings('button_delete') }}</span>
</button> </button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</mat-grid-tile> </main>
</mat-grid-list> </app-content-layout>
</div>
</ng-container>
<ng-template #progressBar> <ng-template #progressBar>
<div fxFlexFill fxLayoutAlign="space-around center"> <div fxFlexFill fxLayoutAlign="space-around center">
<mat-spinner [diameter]="100"></mat-spinner> <mat-spinner [diameter]="100"></mat-spinner>
+122 -14
View File
@@ -147,8 +147,8 @@ mat-form-field {
.notice-card { .notice-card {
position: relative; position: relative;
padding: 10px; padding: 10px;
width: 100%; max-width: 100%;
height: 100%; max-height: 100%;
} }
.notice-card-element { .notice-card-element {
@@ -180,21 +180,12 @@ mat-form-field {
.user-card { .user-card {
flex: 1; flex: 1;
flex-basis: 400px;
max-width: 500px; max-width: 500px;
min-height: 280px; min-height: 280px;
margin: 10px; margin: 10px;
} }
// TODO: Check if needed
.time-sheet-card {
flex: 1;
// max-width:1280px;
// min-height:580px;
width: 80%;
height: 85%;
margin: 2px;
}
// fab position on marker map // fab position on marker map
.fab { .fab {
position:absolute; position:absolute;
@@ -215,6 +206,123 @@ mat-form-field {
white-space: normal; white-space: normal;
} }
.flex-spacer {
flex-grow: 1; // Basic layout styles
.table-page { margin: 10px; }
.header-transparent { background-color: transparent !important; }
.flex-spacer { flex-grow: 1; }
.flex {
display: flex !important;
&-row {
@extend .flex;
flex-direction: row !important;
&-wrap {
@extend .flex-row;
flex-wrap: wrap !important;
} }
&-nowrap {
@extend .flex-row;
flex-wrap: nowrap !important;
}
}
&-row-reverse {
@extend .flex;
flex-direction: row-reverse !important;
&-wrap {
@extend .flex-row-reverse;
flex-wrap: wrap !important;
}
&-nowrap {
@extend .flex-row;
flex-wrap: nowrap !important;
}
}
&-col {
@extend .flex;
flex-direction: column !important;
&-wrap {
@extend .flex-col;
flex-wrap: wrap !important;
}
&-nowrap {
@extend .flex-col;
flex-wrap: nowrap !important;
}
}
}
.justify-space-evenly { justify-content: space-evenly !important; }
.justify-space-between { justify-content: space-between !important; }
.align-center { align-items: center !important; }
.flex-vrt-center {
@extend .flex-col-nowrap;
@extend .align-center;
}
.flex-notice-card {
@extend .flex;
flex: 1 1 400px !important;
max-height: 30% !important;
padding: 8px !important;
}
$cont-padding: 8px;
app-content-layout {
div.outer-container {
@extend .flex;
@extend .flex-col-nowrap;
justify-content: flex-start;
overflow: hidden;
app-content-header {
padding-top: $cont-padding;
padding-right: $cont-padding;
padding-left: $cont-padding;
}
div.inner-container {
@extend .flex;
@extend .flex-row-reverse-wrap;
height: auto;
justify-content: space-evenly;
align-items: flex-start;
overflow: hidden;
padding-right: $cont-padding;
padding-bottom: $cont-padding;
padding-left: $cont-padding;
main {
flex: 1 1 600px;
}
aside {
flex: 0 1 350px;
}
}
}
}
app-content-header {
#content-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 20px;
padding-bottom: 10px;
.header-title {
display: flex;
align-items: center;
justify-content: space-around;
> * {
margin-right: 10px;
}
}
.header-actions > * {
margin-right: 8px;
}
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ContentHeaderComponent } from '../../app/layouts/content-header.component';
describe('HeaderComponent', () => {
let component: ContentHeaderComponent;
let fixture: ComponentFixture<ContentHeaderComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContentHeaderComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ContentHeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ContentLayoutComponent } from './../../app/layouts/content-layout.component';
describe('MainContentComponent', () => {
let component: ContentLayoutComponent;
let fixture: ComponentFixture<ContentLayoutComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContentLayoutComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ContentLayoutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});