Add lendingStation to timeFrame table

pull/6/head
Max Ehrlicher-Schmidt 4 years ago
parent 7c156010a8
commit 28fb8ff8e3

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { BikesService } from 'src/app/services/bikes.service'; import { BikesService } from 'src/app/services/bikes.service';
import { LendingStationsService } from 'src/app/services/lending-stations.service';
import { TimeFrameService } from 'src/app/services/timeFrame.service'; import { TimeFrameService } from 'src/app/services/timeFrame.service';
@Component({ @Component({
selector: 'app-time-frames', selector: 'app-time-frames',
@ -22,10 +23,7 @@ export class TimeFramesComponent implements OnInit {
link: (element) => { link: (element) => {
return '/bike/' + element['cargoBike.id']; return '/bike/' + element['cargoBike.id'];
}, },
possibleObjects: [ possibleObjects: [],
{ id: 1, name: 'test' },
{ id: 2, name: 'bike2' },
],
nameToShowInSelection: (bike) => bike.name, nameToShowInSelection: (bike) => bike.name,
valueToOverwriteDataPath: (bike) => bike.name, valueToOverwriteDataPath: (bike) => bike.name,
currentlySelectedObjectId: (timeFrame) => { currentlySelectedObjectId: (timeFrame) => {
@ -39,6 +37,13 @@ export class TimeFramesComponent implements OnInit {
link: (element) => { link: (element) => {
return '/lendingStation/' + element['lendingStation.id']; return '/lendingStation/' + element['lendingStation.id'];
}, },
possibleObjects: [],
nameToShowInSelection: (station) => station.name,
valueToOverwriteDataPath: (station) => station.name,
currentlySelectedObjectId: (timeFrame) => {
return timeFrame['lendingStation.id'];
},
propertyNameOfReferenceId: 'lendingStationId'
}, },
]; ];
@ -51,7 +56,8 @@ export class TimeFramesComponent implements OnInit {
loadingRowIds: string[] = []; loadingRowIds: string[] = [];
constructor( constructor(
private service: TimeFrameService, private service: TimeFrameService,
private bikesService: BikesService private bikesService: BikesService,
private lendingStationsService: LendingStationsService
) { ) {
this.bikesService.loadTableData(); this.bikesService.loadTableData();
this.bikesService.tableData.subscribe((data) => { this.bikesService.tableData.subscribe((data) => {
@ -59,7 +65,13 @@ export class TimeFramesComponent implements OnInit {
(column) => column.dataPath === 'cargoBike.name' (column) => column.dataPath === 'cargoBike.name'
).possibleObjects = data; ).possibleObjects = data;
}); });
// TODO: add LendingStationService
this.lendingStationsService.loadTableData();
this.lendingStationsService.tableData.subscribe((data) => {
this.columnInfo.find(
(column) => column.dataPath === 'lendingStation.name'
).possibleObjects = data;
});
} }
ngOnInit() { ngOnInit() {

Loading…
Cancel
Save