From 7117accf80baf48818c150d76635af71c2b48ac4 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 2 Feb 2017 12:38:45 +0200 Subject: [PATCH] add empty bus stop --- src/app/pages/statements/components/busStop2/busStop2.component.ts | 18 +++++++++++++----- src/app/pages/statements/components/busStop2/busStop2.html | 30 ++++++++---------------------- src/app/pages/statements/components/busStop2/busStop2.service.ts | 30 +++++++++++++++--------------- src/app/pages/statements/components/busStop2/busStop2.ts | 21 ++++++++++++++------- src/index.html | 56 +++++++++++++++++++++++++++++--------------------------- 5 files changed, 79 insertions(+), 76 deletions(-) diff --git a/src/app/pages/statements/components/busStop2/busStop2.component.ts b/src/app/pages/statements/components/busStop2/busStop2.component.ts index b8f02b2..677b079 100644 --- a/src/app/pages/statements/components/busStop2/busStop2.component.ts +++ b/src/app/pages/statements/components/busStop2/busStop2.component.ts @@ -1,18 +1,20 @@ import { Component, ViewEncapsulation } from '@angular/core'; import { BusStop2Service } from './busStop2.service'; - +import { busStop2 } from './busStop2'; import { LocalDataSource } from 'ng2-smart-table'; import { GridOptions } from 'ag-grid/main'; @Component({ selector: 'statement-table', encapsulation: ViewEncapsulation.None, - styleUrls: ['./busStop2.scss'], + styleUrls: ['./busStop2.scss', + '../../../../../../node_modules/ag-grid/dist/styles/ag-grid.css', + '../../../../../../node_modules/ag-grid/dist/styles/theme-dark.css'], templateUrl: './busStop2.html', }) export class BusStop2 { - source: LocalDataSource = new LocalDataSource(); + // source: LocalDataSource = new LocalDataSource(); public showGrid: boolean; public rowData: any[]; @@ -25,8 +27,14 @@ export class BusStop2 { this.gridOptions = {}; // this.gridOptions.rowModelType = 'virtual'; this.service.getData().then((data) => { - this.source.load(data); - this.rowData = data; + console.log(data); + if(data.length){ + // this.source.load(data); + this.rowData = data; + } else { + this.rowData = [new busStop2] + } + }); this.createColumnDefs(); this.showGrid = true; diff --git a/src/app/pages/statements/components/busStop2/busStop2.html b/src/app/pages/statements/components/busStop2/busStop2.html index 3f5614e..d658adf 100644 --- a/src/app/pages/statements/components/busStop2/busStop2.html +++ b/src/app/pages/statements/components/busStop2/busStop2.html @@ -1,25 +1,11 @@
-
- - + + + + +
- enableColResize - enableSorting - enableFilter - groupHeaders - suppressRowClickSelection - toolPanelSuppressGroups - toolPanelSuppressValues - debug - rowHeight="22" - rowSelection="multiple" - > - - -
- - + \ No newline at end of file diff --git a/src/app/pages/statements/components/busStop2/busStop2.service.ts b/src/app/pages/statements/components/busStop2/busStop2.service.ts index d793d48..9b1889d 100644 --- a/src/app/pages/statements/components/busStop2/busStop2.service.ts +++ b/src/app/pages/statements/components/busStop2/busStop2.service.ts @@ -3,27 +3,27 @@ import { Headers, Http } from '@angular/http'; import 'rxjs/add/operator/toPromise'; -import { BusStop2 } from './busStop2'; +import { busStop2 } from './busStop2'; @Injectable() export class BusStop2Service { private url = 'http://localhost:5000/busstop'; private headers = new Headers({'Content-Type': 'application/json'}); constructor(private http: Http) { } - getData(): Promise { - let busStops: BusStop2[] = [{ - id: 1, - road: 'Test', - region: 'Test', - locationLeft: '1', - locationRight: '1', - state: 'Test' - }]; - return Promise.resolve(busStops); - // return this.http.get(this.url) - // .toPromise() - // .then(response => response.json().busStopListDsM as BusStop2[]) - // .catch(this.handleError); + getData(): Promise { + // let busStops: BusStop2[] = [{ + // id: 1, + // road: 'Test', + // region: 'Test', + // locationLeft: '1', + // locationRight: '1', + // state: 'Test' + // }]; + // return Promise.resolve(busStops); + return this.http.get(this.url) + .toPromise() + .then(response => response.json().busStopEditDsM as busStop2[]) + .catch(this.handleError); } private handleError(error: any): Promise { console.error('An error occured', error); diff --git a/src/app/pages/statements/components/busStop2/busStop2.ts b/src/app/pages/statements/components/busStop2/busStop2.ts index 6c43143..9f40691 100644 --- a/src/app/pages/statements/components/busStop2/busStop2.ts +++ b/src/app/pages/statements/components/busStop2/busStop2.ts @@ -1,8 +1,15 @@ -export class BusStop2 { - id: number; - road: string; - region: string; - locationRight: string; - locationLeft: string; - state: string; +export class busStop2 { + RoadId: number; + RegionId: number; + SettlementId: number; + LocationLeft: string; + LocationRight: string; + SurfaceTypeId: string; + AreaStopAvailability: string; + AreaLandAvailability: string; + PocketAvailability: string; + ToiletAvailability: string; + YearBuild: string; + YearRepair: string; + StateCommonId: number; } diff --git a/src/index.html b/src/index.html index f8f60b3..6a3df39 100644 --- a/src/index.html +++ b/src/index.html @@ -1,41 +1,43 @@ - - - - - - <%= htmlWebpackPlugin.options.title %> + + + + + + + <%= htmlWebpackPlugin.options.title %> + + - <%= webpackConfig.htmlElements.headTags %> - <% } %> + --> + + <% if (webpackConfig.htmlElements.headTags) { %> + + <%= webpackConfig.htmlElements.headTags %> + <% } %> - - + + - - + + -
-
-
+
+
+
-<% if (htmlWebpackPlugin.options.metadata.isDevServer && htmlWebpackPlugin.options.metadata.HMR !== true) { %> - - -<% } %> + <% if (htmlWebpackPlugin.options.metadata.isDevServer && htmlWebpackPlugin.options.metadata.HMR !== true) { %> + + + <% } %> - + - + + \ No newline at end of file -- libgit2 0.21.4