diff --git a/src/app/components/data-page/data-page.component.html b/src/app/components/data-page/data-page.component.html
index 00a4921..867f760 100644
--- a/src/app/components/data-page/data-page.component.html
+++ b/src/app/components/data-page/data-page.component.html
@@ -60,6 +60,7 @@
[editable]="data.isLockedByMe"
[tableDataGQLType]="object.tableDataGQLType"
(referenceIds)="addReferenceIdsToObject($event, object)"
+ [editableReferences]="object.editableReferences"
>
diff --git a/src/app/components/data-page/data-page.component.scss b/src/app/components/data-page/data-page.component.scss
index 6083b22..a4e4b8a 100644
--- a/src/app/components/data-page/data-page.component.scss
+++ b/src/app/components/data-page/data-page.component.scss
@@ -7,24 +7,25 @@
overflow: auto;
padding: 2em;
.inline-card {
- display: inline-table;
- min-width: 20em;
- margin: 1em;
+ display: inline-table;
+ min-width: 20em;
+ margin: 1em;
}
}
#floating-fab-button-box {
- position: absolute;
- bottom: 2em;
- right: 2em;
- display: flex;
- flex-direction: column;
- align-items: center;
- .floating-fab-button {
- margin-top: 0.5em;
- }
- }
- .floating-fab-button-top {
- position: absolute;
- top: 2em;
- right: 2em;
+ z-index: 999;
+ position: absolute;
+ bottom: 2em;
+ right: 2em;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ .floating-fab-button {
+ margin-top: 0.5em;
}
+}
+.floating-fab-button-top {
+ position: absolute;
+ top: 2em;
+ right: 2em;
+}
diff --git a/src/app/components/reference-table/reference-table.component.html b/src/app/components/reference-table/reference-table.component.html
index 41f774a..9ef7177 100644
--- a/src/app/components/reference-table/reference-table.component.html
+++ b/src/app/components/reference-table/reference-table.component.html
@@ -1,6 +1,6 @@
-
-
- Zeitraum auswählen
-
-
-
-
-
-
-
-
-
{
if (this.editable && this.required && this.inputType !== 'Boolean') {
diff --git a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.html b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.html
index a1b96fb..0e27bdc 100644
--- a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.html
+++ b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.html
@@ -1 +1,25 @@
-
date-range-cell works!
+
+ {{label}}
+
+
+
+
+
+
+
+
+ {{toLocaleDate(from)}} bis {{toLocaleDate(to)}}
+
diff --git a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.scss b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.scss
index e69de29..dbc6e25 100644
--- a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.scss
+++ b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.scss
@@ -0,0 +1,6 @@
+.date-range-input {
+ min-width: 11em;
+}
+.date-string {
+ min-width: 10em;
+}
\ No newline at end of file
diff --git a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts
index 82be446..90c46ba 100644
--- a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts
+++ b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts
@@ -1,4 +1,13 @@
-import { Component, OnInit } from '@angular/core';
+import { DatePipe } from '@angular/common';
+import {
+ Component,
+ Input,
+ Output,
+ EventEmitter,
+ ChangeDetectorRef,
+ OnInit,
+} from '@angular/core';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-date-range-cell',
@@ -6,10 +15,49 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./date-range-cell.component.scss']
})
export class DateRangeCellComponent implements OnInit {
+ @Input()
+ from: string;
- constructor() { }
+ @Input()
+ to: string;
- ngOnInit(): void {
+ @Output() fromChange = new EventEmitter
();
+ @Output() toChange = new EventEmitter();
+
+ @Input()
+ editable = false;
+
+ @Input()
+ required = false;
+ @Input()
+ label: string = null;
+ @Output() validityChange = new EventEmitter();
+ isValid = true;
+
+ constructor(private cdr: ChangeDetectorRef, public datepipe: DatePipe) {}
+
+ ngOnInit() {
+ }
+
+ startDateChange(event): void {
+ this.from = this.transformDate(event.value);
+ this.fromChange.emit(this.from);
+ }
+
+ endDateChange(event) {
+ this.to = this.transformDate(event.value);
+ this.toChange.emit(this.to);
+ }
+
+ transformDate(date) {
+ return this.datepipe.transform(date, 'yyyy-MM-dd');
+ }
+
+ toLocaleDate(date: string): string {
+ if (date == "") {
+ return "";
+ }
+ return new Date(date).toLocaleDateString();
}
}
diff --git a/src/app/pages/dataPages/bike/bike.component.ts b/src/app/pages/dataPages/bike/bike.component.ts
index 946f70b..4c64042 100644
--- a/src/app/pages/dataPages/bike/bike.component.ts
+++ b/src/app/pages/dataPages/bike/bike.component.ts
@@ -219,6 +219,21 @@ export class BikeComponent implements OnInit {
},
propertyNameOfUpdateInput: 'equipmentIds',
},
+ {
+ type: 'ReferenceTable',
+ title: 'Zeitscheiben',
+ dataPath: 'timeFrames',
+ dataService: null,
+ columnInfo: [
+ { dataPath: 'dateRange', translation: 'Zeitraum' },
+ { dataPath: 'lendingStation.name', translation: 'Standort' },
+ ],
+ editableReferences: false,
+ linkToTable: (element) => '/table/timeFrames',
+ linkToTableParams: (bike) => {
+ return { filter: bike.name };
+ },
+ },
];
headlineDataPath = 'name';
diff --git a/src/app/pages/tables/time-frames/time-frames.component.ts b/src/app/pages/tables/time-frames/time-frames.component.ts
index 0d305db..c870aab 100644
--- a/src/app/pages/tables/time-frames/time-frames.component.ts
+++ b/src/app/pages/tables/time-frames/time-frames.component.ts
@@ -9,7 +9,7 @@ export class TimeFramesComponent implements OnInit {
headline = 'Zeitscheiben';
columnInfo = [
- { dataPath: 'dataRange', translation: 'Zeitraum', type: 'DateRange', readonly: false },
+ { dataPath: 'dateRange', translation: 'Zeitraum', type: 'DateRange', readonly: false },
{
dataPath: 'cargoBike.name',
translation: 'Lastenrad',
@@ -19,7 +19,7 @@ export class TimeFramesComponent implements OnInit {
},
{
dataPath: 'lendingStation.name',
- translation: 'Ausleihstation',
+ translation: 'Standort',
link: (element) => {
return '/lendingStation/' + element['lendingStation.id'];
},