LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Adde a single and grouped mapping functionality to the time sheet table. }
341 lines
19 KiB
HTML
341 lines
19 KiB
HTML
<ng-container>
|
|
<style>
|
|
/* Styles for the work place table */
|
|
.workplaces{
|
|
margin-left: 16px;
|
|
margin-right: 16px;
|
|
}
|
|
.cdk-column-address {
|
|
width: 90%;
|
|
text-align: start;
|
|
}
|
|
.cdk-column-delete {
|
|
width: 10%;
|
|
text-align: right;
|
|
margin-right: 32px;
|
|
}
|
|
|
|
/* Styles for the main time sheet table */
|
|
.mat-column-date, .mat-column-time {
|
|
word-wrap: break-word !important;
|
|
white-space: unset !important;
|
|
flex: 0 0 20% !important;
|
|
width: 20% !important;
|
|
overflow-wrap: break-word;
|
|
word-wrap: break-word;
|
|
word-break: break-word;
|
|
-ms-hyphens: auto;
|
|
-moz-hyphens: auto;
|
|
-webkit-hyphens: auto;
|
|
hyphens: auto;
|
|
}
|
|
.mat-column-place {
|
|
word-wrap: break-word !important;
|
|
white-space: unset !important;
|
|
flex: 0 0 30% !important;
|
|
width: 40% !important;
|
|
overflow-wrap: break-word;
|
|
word-wrap: break-word;
|
|
word-break: break-word;
|
|
-ms-hyphens: auto;
|
|
-moz-hyphens: auto;
|
|
-webkit-hyphens: auto;
|
|
hyphens: auto;
|
|
}
|
|
</style>
|
|
<div fxLayout="column" fxLayoutAlign="start stretch" fxFlexFill>
|
|
<mat-toolbar style="margin-top:20px;background:transparent;">
|
|
<mat-toolbar-row style="flex: 1 1 auto;">
|
|
<div>
|
|
<mat-icon style="margin-left: 5px;">access_time_icon</mat-icon>
|
|
<span style="margin-left: 10px">{{ res.strings('time_sheet_title') }}</span>
|
|
<!-- <p style="margin-left: 5px;font-size: small;">{{ res.strings('time_sheet_subtitle') }}</p> -->
|
|
</div>
|
|
|
|
<div class="flex-spacer"></div>
|
|
|
|
<button mat-raised-button class="mat-elevation-z2"
|
|
*ngIf="isSidenavOpened; else iconUpdateButton"
|
|
color="primary" style="margin-right: 10px;"
|
|
(click)="updateTimeSheetTable()">
|
|
<mat-icon class="icon-button">update_icon</mat-icon>
|
|
<span>{{ res.strings('button_update') }}</span>
|
|
</button>
|
|
<ng-template #iconUpdateButton>
|
|
<button mat-mini-fab class="mat-elevation-z2"
|
|
color="primary" style="margin-right: 10px;"
|
|
(click)="updateTimeSheetTable()">
|
|
<mat-icon class="icon-button">update_icon</mat-icon>
|
|
</button>
|
|
</ng-template>
|
|
|
|
<mat-menu #exportMenu="matMenu" class="mat-elevation-z2">
|
|
<ng-template matMenuContent>
|
|
<button mat-menu-item (click)="exportTimeSheet('.csv')" disabled>as CSV</button>
|
|
<button mat-menu-item (click)="exportTimeSheet('.json')" disabled>as JSON</button>
|
|
<button mat-menu-item (click)="exportTimeSheet('.xml')" disabled>as XML</button>
|
|
</ng-template>
|
|
</mat-menu>
|
|
<button mat-raised-button class="mat-elevation-z2"
|
|
*ngIf="isSidenavOpened; else iconExportButton"
|
|
[matMenuTriggerFor]="exportMenu"
|
|
color="primary">
|
|
<mat-icon class="icon-button">import_export</mat-icon>
|
|
<span>{{ res.strings('button_export') }}</span>
|
|
</button>
|
|
<ng-template #iconExportButton>
|
|
<button mat-mini-fab class="mat-elevation-z2"
|
|
[matMenuTriggerFor]="exportMenu"
|
|
color="primary">
|
|
<mat-icon class="icon-button">import_export</mat-icon>
|
|
</button>
|
|
</ng-template>
|
|
</mat-toolbar-row>
|
|
</mat-toolbar>
|
|
|
|
<!-- Page Content -->
|
|
<mat-sidenav-container style="flex: 1;">
|
|
<mat-sidenav class="mat-elevation-z4" role="region" position="end" mode="side" disableClose
|
|
[opened]="isSidenavOpened"
|
|
style="border-radius: 10px;">
|
|
<mat-list fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px"
|
|
style="margin-bottom: 20px;">
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<h3 mat-subheader>{{ res.strings('time_sheet_config_label') }}</h3>
|
|
</mat-list-item>
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-button-toggle-group
|
|
[(value)]="timeSheetService.grouped"
|
|
name="groupingChoice" aria-label="Grouping Choice">
|
|
<mat-button-toggle [value]="false">Normal</mat-button-toggle>
|
|
<mat-button-toggle [value]="true">Gruppiert</mat-button-toggle>
|
|
</mat-button-toggle-group>
|
|
</mat-list-item>
|
|
</mat-list>
|
|
<mat-list fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-form-field>
|
|
<mat-label>{{ res.strings('time_sheet_select_device_label') }}</mat-label>
|
|
<mat-select
|
|
[(value)]="timeSheetService.device">
|
|
<mat-option [value]="null">{{ res.strings('time_sheet_no_device_selected') }}</mat-option>
|
|
<ng-container *ngIf="devices">
|
|
<mat-option *ngFor="let device of devices" [value]="device">
|
|
{{ device.model }}
|
|
</mat-option>
|
|
</ng-container>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</mat-list-item>
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-form-field>
|
|
<mat-label>{{ res.strings('time_sheet_break_time_label') }}</mat-label>
|
|
<mat-select
|
|
[(value)]="timeSheetService.breakTime">
|
|
<mat-option [value]="null">{{ res.strings('time_sheet_no_break_time_selected') }}</mat-option>
|
|
<mat-option *ngFor="let opt of breakTimeOptions" [value]="opt">
|
|
{{ opt }}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</mat-list-item>
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-form-field>
|
|
<input matInput
|
|
[placeholder]="res.strings('time_sheet_time_period_label')"
|
|
[satDatepicker]="picker"
|
|
[value]="timeSheetService.dateRange"
|
|
(dateChange)="timeSheetService.dateRange = $event.target.value">
|
|
<sat-datepicker #picker [rangeMode]="true" orderPeriodLabel="month"></sat-datepicker>
|
|
<sat-datepicker-toggle matSuffix [for]="picker"></sat-datepicker-toggle>
|
|
</mat-form-field>
|
|
</mat-list-item>
|
|
</mat-list>
|
|
<mat-divider role="seperator" style="margin: 16px;"></mat-divider>
|
|
<mat-list fxLayout="column" fxLayoutAlign="center">
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<button mat-subheader mat-button (click)="openWorkPlacesDialog()">
|
|
<mat-icon class="icon-button">list_icon</mat-icon>
|
|
<span>{{ res.strings('time_sheet_workplace_button') }}</span>
|
|
</button>
|
|
</mat-list-item>
|
|
<ng-container *ngIf="workPlaces.length > 0">
|
|
<mat-divider role="seperator" style="margin: 16px;"></mat-divider>
|
|
|
|
<table #workPlacesTable cdk-table class="workplaces" [dataSource]="workPlaces">
|
|
|
|
<ng-container matColumnDef="address">
|
|
<th cdk-header-cell *cdkHeaderCellDef>Address</th>
|
|
<td cdk-cell *cdkCellDef="let workPlace">
|
|
{{ getWorkplaceName(workPlace) }}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="delete">
|
|
<th cdk-header-cell *cdkHeaderCellDef>Delete</th>
|
|
<td cdk-cell *cdkCellDef="let workPlace"
|
|
(click)="deleteWorkPlaceEntry(workPlace)">
|
|
<mat-icon class="icon-button">delete_icon</mat-icon>
|
|
</td>
|
|
</ng-container>
|
|
|
|
<tr cdk-row
|
|
*cdkRowDef="let workplaceRow; columns: ['address', 'delete']"
|
|
fxLayout="row"
|
|
fxLayoutAlign="center center"></tr>
|
|
</table>
|
|
|
|
<mat-divider role="seperator" style="margin: 16px;"></mat-divider>
|
|
|
|
<button mat-button (click)="clearWorkPlaceList()" color="primary">
|
|
<mat-icon class="icon-button" style="margin-left: 12px">delete_icon</mat-icon>
|
|
<span>{{ res.strings('time_sheet_workplace_clear_list') }}</span>
|
|
</button>
|
|
</ng-container>
|
|
</mat-list>
|
|
</mat-sidenav>
|
|
|
|
<mat-sidenav-content>
|
|
<!-- Responsive Sidenav for mobile devices. -->
|
|
<ng-container *ngIf="!isSidenavOpened">
|
|
<mat-card class="mat-elevation-z4" style="margin: 4px;">
|
|
<mat-card-content>
|
|
<mat-list fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<h3 mat-subheader>{{ res.strings('time_sheet_config_label') }}</h3>
|
|
</mat-list-item>
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-form-field>
|
|
<mat-label>{{ res.strings('time_sheet_select_device_label') }}</mat-label>
|
|
<mat-select
|
|
[(value)]="timeSheetService.device">
|
|
<mat-option [value]="null">{{ res.strings('time_sheet_no_device_selected') }}</mat-option>
|
|
<ng-container *ngIf="devices">
|
|
<mat-option *ngFor="let device of devices" [value]="device">
|
|
{{ device.model }}
|
|
</mat-option>
|
|
</ng-container>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</mat-list-item>
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-form-field>
|
|
<mat-label>{{ res.strings('time_sheet_break_time_label') }}</mat-label>
|
|
<mat-select
|
|
[(value)]="timeSheetService.breakTime">
|
|
<mat-option [value]="null">{{ res.strings('time_sheet_no_break_time_selected') }}</mat-option>
|
|
<mat-option *ngFor="let opt of breakTimeOptions" [value]="opt">
|
|
{{ opt }}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</mat-list-item>
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<mat-form-field>
|
|
<input matInput
|
|
[placeholder]="res.strings('time_sheet_time_period_label')"
|
|
[satDatepicker]="picker"
|
|
[value]="timeSheetService.dateRange"
|
|
(dateChange)="timeSheetService.dateRange = $event.target.value">
|
|
<sat-datepicker #picker [rangeMode]="true" orderPeriodLabel="month"></sat-datepicker>
|
|
<sat-datepicker-toggle matSuffix [for]="picker"></sat-datepicker-toggle>
|
|
</mat-form-field>
|
|
</mat-list-item>
|
|
</mat-list>
|
|
</mat-card-content>
|
|
</mat-card>
|
|
<mat-card class="mat-elevation-z4" style="margin: 4px;">
|
|
<mat-card-content>
|
|
<mat-list fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<button mat-subheader mat-button (click)="openWorkPlacesDialog()">
|
|
<mat-icon class="icon-button" style="margin-left: 4px">list_icon</mat-icon>
|
|
<span>{{ res.strings('time_sheet_workplace_button') }}</span>
|
|
</button>
|
|
</mat-list-item>
|
|
</mat-list>
|
|
<ng-container *ngIf="workPlaces.length > 0">
|
|
<table #workPlacesTable cdk-table class="workplaces" [dataSource]="workPlaces">
|
|
|
|
<ng-container matColumnDef="address">
|
|
<td cdk-cell *cdkCellDef="let workPlace">
|
|
{{ getWorkplaceName(workPlace) }}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="delete">
|
|
<td cdk-cell *cdkCellDef="let workPlace"
|
|
(click)="deleteWorkPlaceEntry(workPlace)">
|
|
<mat-icon class="icon-button">delete_icon</mat-icon>
|
|
</td>
|
|
</ng-container>
|
|
|
|
<tr cdk-row
|
|
*cdkRowDef="let workplaceRow; columns: ['address', 'delete']"
|
|
fxLayout="row"
|
|
fxLayoutAlign="center center"></tr>
|
|
</table>
|
|
<mat-list fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
|
|
<mat-list-item fxLayoutAlign="center">
|
|
<button mat-button color="primary" (click)="clearWorkPlaceList()">
|
|
<mat-icon class="icon-button" style="margin-left: 4px">delete_icon</mat-icon>
|
|
<span>{{ res.strings('time_sheet_workplace_clear_list') }}</span>
|
|
</button>
|
|
</mat-list-item>
|
|
</mat-list>
|
|
</ng-container>
|
|
</mat-card-content>
|
|
</mat-card>
|
|
</ng-container>
|
|
|
|
<!-- Table Content -->
|
|
<!-- <ng-container *ngIf="loading.getValue() || deleting.getValue()"> -->
|
|
<ng-container *ngIf="false">
|
|
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
|
|
</ng-container>
|
|
<mat-card class="mat-elevation-z4" style="margin: 4px;">
|
|
<mat-card-content>
|
|
<table mat-table #timeSheet [dataSource]="timeSheetDataSource">
|
|
|
|
<ng-container matColumnDef="date">
|
|
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_date') }}</th>
|
|
<td mat-cell *matCellDef="let data">{{ data.begin | date:'dd.LL.yyyy' }}</td>
|
|
<!-- <td mat-cell *matCellDef="let data">{{ data.begin | date:'short' }}</td> -->
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="from">
|
|
<th mat-header-cell *matHeaderCellDef>{{ 'von' }}</th>
|
|
<td mat-cell *matCellDef="let data">
|
|
{{ data.begin | date:'H:mm' }}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="to">
|
|
<th mat-header-cell *matHeaderCellDef>{{ 'bis' }}</th>
|
|
<td mat-cell *matCellDef="let data">
|
|
{{ data.end | date:'H:mm' }}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="time">
|
|
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_working_time') }}</th>
|
|
<td mat-cell *matCellDef="let data">{{ getWorkingTime(data.workingTime) }}</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="place">
|
|
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_place') }}</th>
|
|
<td mat-cell *matCellDef="let data">{{ data.place }}</td>
|
|
</ng-container>
|
|
|
|
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
</table>
|
|
</mat-card-content>
|
|
<mat-card-footer>
|
|
<mat-paginator #paginator [pageSizeOptions]="[10, 20, 50, 100]" [showFirstLastButtons]="true"></mat-paginator>
|
|
</mat-card-footer>
|
|
</mat-card>
|
|
</mat-sidenav-content>
|
|
</mat-sidenav-container>
|
|
</div>
|
|
</ng-container> |