[65] #IMPLEMENT 'Export Functionality'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{- Export function added (.csv, .json).
- Minor fixes in layout and code. }
This commit is contained in:
@@ -83,57 +83,42 @@
|
||||
}
|
||||
</style>
|
||||
<div fxLayout="column" fxLayoutAlign="start stretch" fxFlexFill>
|
||||
<mat-toolbar style="margin-top:20px;background:transparent;">
|
||||
<mat-toolbar style="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>
|
||||
<div>
|
||||
<button mat-icon-button style="padding-right: 10px;" (click)="updateTimeSheetTable()">
|
||||
<mat-icon>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>
|
||||
|
||||
<mat-menu #exportMenu="matMenu" class="mat-elevation-z1">
|
||||
<ng-template matMenuContent>
|
||||
<button mat-menu-item
|
||||
(click)="exportTimeSheet('csv')"
|
||||
[disabled]="!timeSheetService.isTimeSheetReady">as CSV</button>
|
||||
<button mat-menu-item
|
||||
(click)="exportTimeSheet('json')"
|
||||
[disabled]="!timeSheetService.isTimeSheetReady">as JSON</button>
|
||||
<!-- <button mat-menu-item
|
||||
(click)="exportTimeSheet('xml')"
|
||||
[disabled]="!timeSheetService.isTimeSheetReady">as XML</button> -->
|
||||
</ng-template>
|
||||
</mat-menu>
|
||||
<button mat-icon-button style="margin-right: 10px;" [matMenuTriggerFor]="exportMenu">
|
||||
<mat-icon>import_export</mat-icon>
|
||||
</button>
|
||||
</ng-template>
|
||||
</div>
|
||||
</mat-toolbar-row>
|
||||
</mat-toolbar>
|
||||
|
||||
<!-- Page Content -->
|
||||
<mat-sidenav-container style="flex: 1;">
|
||||
<mat-sidenav-container style="flex: 1; overflow: hidden;">
|
||||
<mat-sidenav class="mat-elevation-z4" role="region" position="end" mode="side" disableClose
|
||||
[opened]="isSidenavOpened"
|
||||
style="border-radius: 10px;">
|
||||
@@ -143,12 +128,14 @@
|
||||
<h3 mat-subheader>{{ res.strings('time_sheet_config_label') }}</h3>
|
||||
</mat-list-item>
|
||||
<mat-list-item fxLayoutAlign="center">
|
||||
<mat-button-toggle-group
|
||||
<mat-button-toggle-group
|
||||
[(value)]="timeSheetService.grouped"
|
||||
name="groupingChoice" aria-label="Grouping Choice">
|
||||
<mat-button-toggle [value]="1">Normal</mat-button-toggle>
|
||||
<mat-button-toggle [value]="2">Nach Tagen</mat-button-toggle>
|
||||
<mat-button-toggle [value]="3">Akk.</mat-button-toggle>
|
||||
name="groupingChoice"
|
||||
aria-label="Grouping Choice">
|
||||
<mat-button-toggle [value]="1">{{ res.strings('time_sheet_toggle_default_label') }}</mat-button-toggle>
|
||||
<mat-button-toggle [value]="2">{{ res.strings('time_sheet_toggle_acc_label') }}</mat-button-toggle>
|
||||
<mat-button-toggle [value]="3">{{ res.strings('time_sheet_toggle_by_days_label') }}</mat-button-toggle>
|
||||
<mat-button-toggle [value]="4" hidden>{{ res.strings('time_sheet_toggle_raw_label') }}</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
@@ -171,11 +158,12 @@
|
||||
<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>
|
||||
[(value)]="timeSheetService.breakTime"
|
||||
[disabled]="timeSheetService.grouped > 1">
|
||||
<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>
|
||||
@@ -244,6 +232,15 @@
|
||||
<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]="1">{{ res.strings('time_sheet_toggle_default_label') }}</mat-button-toggle>
|
||||
<mat-button-toggle [value]="2">{{ res.strings('time_sheet_toggle_acc_label') }}</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
</mat-list-item>
|
||||
<mat-list-item fxLayoutAlign="center">
|
||||
<mat-form-field>
|
||||
<mat-label>{{ res.strings('time_sheet_select_device_label') }}</mat-label>
|
||||
@@ -262,11 +259,12 @@
|
||||
<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>
|
||||
[(value)]="timeSheetService.breakTime"
|
||||
[disabled]="timeSheetService.grouped > 1">
|
||||
<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>
|
||||
@@ -329,55 +327,52 @@
|
||||
</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 class="main-content mat-elevation-z4">
|
||||
<mat-card-content>
|
||||
<table mat-table #timeSheet [dataSource]="timeSheetDataSource">
|
||||
<table mat-table #timeSheet [dataSource]="timeSheetDataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="date">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_date') }}</th>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="date">{{ res.strings('time_sheet_table_date') }}</th>
|
||||
<td mat-cell *matCellDef="let data">{{ getDate(data) }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="from-time">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'von' }}</th>
|
||||
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_from') }}</th>
|
||||
<td mat-cell *matCellDef="let data">
|
||||
{{ data.beginDate | date:'H:mm' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="to-time">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'bis' }}</th>
|
||||
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_to') }}</th>
|
||||
<td mat-cell *matCellDef="let data">
|
||||
{{ data.endDate | date:'H:mm' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="time">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_working_time') }}</th>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 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>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ res.strings('time_sheet_table_place') }}</th>
|
||||
<td mat-cell *matCellDef="let data">{{ getWorkplaceString(data) }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="device">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ res.strings('time_sheet_table_device') }}</th>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ res.strings('time_sheet_table_device') }}</th>
|
||||
<td mat-cell *matCellDef="let data">{{ getDeviceNameString(data) }}</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<mat-paginator #paginator [pageSizeOptions]="[10, 20, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user