diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 81ee4ce..5ad311c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -22,6 +22,8 @@ import { NgxChartsModule } from '@swimlane/ngx-charts'; import { BusStopComponent } from './data/bus-stop/bus-stop.component'; import { ServiceObjectComponent } from './data/service-object/service-object.component'; +import { RoadSurfaceComponent } from './data/road-surface/road-surface.component'; +import { RoadWidthComponent } from './data/road-width/road-width.component'; import { EditorComponent } from '../helpers/editor.component'; import { RendererComponent } from '../helpers/renderer.component'; @@ -30,9 +32,12 @@ import { BusStopCreateService } from '../services/bus-stop-create.service'; import { BusStopService } from '../services/bus-stop.service'; import { ServiceObjectCreateService } from '../services/service-object-create.service'; import { ServiceObjectService } from '../services/service-object.service'; +import { RoadSurfaceService } from '../services/road-surface.service'; +import { RoadSurfaceCreateService } from '../services/road-surface-create.service'; +import { RoadWidthService } from '../services/road-width.service'; +import { RoadWidthCreateService } from '../services/road-width-create.service'; import { BooleanSelectListService } from '../services/boolean-select-list.service'; - const httpInterceptorProviders: Type[] = [ RequestInterceptor, ]; @@ -47,8 +52,10 @@ const httpInterceptorProviders: Type[] = [ TemplatesComponent, BusStopComponent, ServiceObjectComponent, + RoadSurfaceComponent, EditorComponent, RendererComponent, + RoadWidthComponent, ], // directives, components, and pipes owned by this NgModule imports: [ BrowserModule, @@ -57,6 +64,8 @@ const httpInterceptorProviders: Type[] = [ ServiceObjectComponent, EditorComponent, RendererComponent, + RoadSurfaceComponent, + RoadWidthComponent, ]), CovalentCoreModule.forRoot(), CovalentChartsModule.forRoot(), @@ -79,7 +88,11 @@ const httpInterceptorProviders: Type[] = [ BusStopCreateService, BusStopService, ServiceObjectCreateService, - ServiceObjectService + ServiceObjectService, + RoadSurfaceCreateService, + RoadSurfaceService, + RoadWidthCreateService, + RoadWidthService, ], // additional providers needed for this module entryComponents: [ ], bootstrap: [ AppComponent ], diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 5bdaf94..47b248d 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -5,6 +5,8 @@ import { DataComponent } from './data/data.component'; import { LoginComponent } from './login/login.component'; import { TemplatesComponent } from './templates/templates.component'; import { BusStopComponent } from './data/bus-stop/bus-stop.component'; +import { RoadSurfaceComponent } from './data/road-surface/road-surface.component'; +import { RoadWidthComponent } from './data/road-width/road-width.component'; import { ServiceObjectComponent } from './data/service-object/service-object.component'; const routes: Routes = [ @@ -14,6 +16,8 @@ const routes: Routes = [ {path: 'data', component: DataComponent, children: [ {path: 'bus-stop', component: BusStopComponent}, {path: 'service-object', component: ServiceObjectComponent}, + {path: 'road-surface', component: RoadSurfaceComponent}, + {path: 'road-width', component: RoadWidthComponent}, ]}, ]}, ]; diff --git a/src/app/data/data.component.html b/src/app/data/data.component.html index 2714011..3cd9828 100644 --- a/src/app/data/data.component.html +++ b/src/app/data/data.component.html @@ -38,11 +38,11 @@ dashboard З'їзди - + dashboard Ширина проїзних частин - + dashboard Покриття доріг diff --git a/src/app/data/road-surface/road-surface.component.html b/src/app/data/road-surface/road-surface.component.html new file mode 100644 index 0000000..dad08a5 --- /dev/null +++ b/src/app/data/road-surface/road-surface.component.html @@ -0,0 +1,12 @@ +
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/src/app/data/road-surface/road-surface.component.ts b/src/app/data/road-surface/road-surface.component.ts new file mode 100644 index 0000000..b2bd67b --- /dev/null +++ b/src/app/data/road-surface/road-surface.component.ts @@ -0,0 +1,160 @@ +import {Component, ViewEncapsulation} from '@angular/core'; +import {GridOptions} from 'ag-grid/main'; +import { TdLoadingService } from '@covalent/core'; + +import { StatementBase } from '../../../models/statement.base'; + +import { RoadSurfaceService } from '../../../services/road-surface.service'; +import { RoadSurface } from '../../../models/road-surface'; +import { EditorComponent } from '../../../helpers/editor.component'; +import { RendererComponent } from '../../../helpers/renderer.component'; +import { RoadSurfaceCreateService } from '../../../services/road-surface-create.service'; +import { RegionSelectList } from '../../../models/region-select-list'; +import { RoadSelectList } from '../../../models/road-select-list'; +import { RoadDirectionSelectList } from '../../../models/road-direction-select-list'; +import { SurfaceTreatmentSelectList } from '../../../models/surface-treatment-select-list'; +import { StateCommonSelectList } from '../../../models/state-common-select-list'; +import { SurfaceTypeSelectList } from '../../../models/surface-type-select-list'; + +import { routerTransition } from '../../../animations/router.animation'; + +@Component({ + selector: 'road-surface', + templateUrl: 'road-surface.component.html', + styleUrls: ['road-surface.scss'], + encapsulation: ViewEncapsulation.None, +}) +export class RoadSurfaceComponent extends StatementBase { + + public regions: RegionSelectList[]; + public roadDirection: RoadDirectionSelectList[]; + public roads: RoadSelectList[]; + public surfaceTypes: SurfaceTypeSelectList[]; + public states: StateCommonSelectList[]; + public surfaceTreatment: SurfaceTreatmentSelectList[]; + + constructor( + protected service: RoadSurfaceService, + protected dataService: RoadSurfaceCreateService, + protected loadingService: TdLoadingService, + ) { + super(); + } + + protected createColumnDefs(): any[] { + return [ + { + headerName: '#', + width: 30, + checkboxSelection: true, + suppressSorting: true, + suppressMenu: true, + pinned: true, + }, + { + headerName: 'ID', + field: 'id', + }, + { + headerName: 'Назва дороги', + field: 'roadId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.roads, + valueCol: 'roadId', + labelCol: 'name', + }, + }, + { + headerName: 'Область', + field: 'regionId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.regions, + valueCol: 'regionId', + labelCol: 'name', + }, + }, + { + headerName: 'Напрямок смуги руху', + field: 'roadDirectionId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.roadDirection, + valueCol: 'roadDirectionId', + labelCol: 'name', + }, + }, + { + headerName: 'Місцезнаходження, км+ початок', + field: 'begin', + editable: true, + }, + { + headerName: 'Місцезнаходження, км+ кінець', + field: 'end', + editable: true, + }, + { + headerName: 'Тип покриття', + field: 'surfaceTypeId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.surfaceTypes, + valueCol: 'surfaceTypeId', + labelCol: 'name', + }, + }, + { + headerName: 'Тип поверхневої обробки', + field: 'surfaceTreatmentId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.surfaceTreatment, + valueCol: 'surfaceTreatmentId', + labelCol: 'name', + }, + }, + { + headerName: 'Стан покриття', + field: 'stateCommonId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.states, + valueCol: 'stateCommonId', + labelCol: 'value', + }, + }, + ]; + } + + protected initFunction(): void { + this.dataService.getModels().then((models: any) => { + this.regions = models.regionSelectListDsM as RegionSelectList[]; + this.roads = models.roadSelectListDsM as RoadSelectList[]; + this.roadDirection = models.roadDirectionSelectListDsM as RoadDirectionSelectList[]; + this.surfaceTypes = models.surfaceTypeSelectListDsM as SurfaceTypeSelectList[]; + this.states = models.stateCommonSelectListDsM as StateCommonSelectList[]; + this.surfaceTreatment = models.surfaceTreatmentSelectListDsM as SurfaceTreatmentSelectList[]; + }).then(() => { + this.bootstrapGrid(); + }); + } + + // tslint:disable-next-line:member-ordering + public CreateModel(): Object { + return new RoadSurface(); + } +} diff --git a/src/app/data/road-surface/road-surface.scss b/src/app/data/road-surface/road-surface.scss new file mode 100644 index 0000000..de4dc3d --- /dev/null +++ b/src/app/data/road-surface/road-surface.scss @@ -0,0 +1,4 @@ +.toolbar button { + margin: 2px; + padding: 0; +} \ No newline at end of file diff --git a/src/app/data/road-width/road-width.component.html b/src/app/data/road-width/road-width.component.html new file mode 100644 index 0000000..dad08a5 --- /dev/null +++ b/src/app/data/road-width/road-width.component.html @@ -0,0 +1,12 @@ +
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/src/app/data/road-width/road-width.component.ts b/src/app/data/road-width/road-width.component.ts new file mode 100644 index 0000000..3d0ab43 --- /dev/null +++ b/src/app/data/road-width/road-width.component.ts @@ -0,0 +1,140 @@ +import {Component, ViewEncapsulation} from '@angular/core'; +import {GridOptions} from 'ag-grid/main'; +import { TdLoadingService } from '@covalent/core'; + +import { StatementBase } from '../../../models/statement.base'; + + +import { RoadWidth } from '../../../models/road-width'; +import { EditorComponent } from '../../../helpers/editor.component'; +import { RendererComponent } from '../../../helpers/renderer.component'; +import { RoadWidthService } from '../../../services/road-width.service'; +import { RoadWidthCreateService } from '../../../services/road-width-create.service'; +import { RegionSelectList } from '../../../models/region-select-list'; +import { RoadSelectList } from '../../../models/road-select-list'; + + + + +import { routerTransition } from '../../../animations/router.animation'; + +@Component({ + selector: 'road-width', + templateUrl: 'road-width.component.html', + styleUrls: ['road-width.scss'], + encapsulation: ViewEncapsulation.None, +}) +export class RoadWidthComponent extends StatementBase { + + public regions: RegionSelectList[]; + + public roads: RoadSelectList[]; + + constructor( + protected service: RoadWidthService, + protected dataService: RoadWidthCreateService, + protected loadingService: TdLoadingService, + ) { + super(); + } + + protected createColumnDefs(): any[] { + return [ + { + headerName: '#', + width: 30, + checkboxSelection: true, + suppressSorting: true, + suppressMenu: true, + pinned: true, + }, + { + headerName: 'ID', + field: 'id', + }, + { + headerName: 'Назва дороги', + field: 'roadId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.roads, + valueCol: 'roadId', + labelCol: 'name', + }, + }, + { + headerName: 'Область', + field: 'regionId', + editable: true, + cellEditorFramework: EditorComponent, + cellRendererFramework: RendererComponent, + cellEditorParams: { + data: this.regions, + valueCol: 'regionId', + labelCol: 'name', + }, + }, + { + headerName: 'Місцезнаходження, км+ початок', + field: 'begin', + editable: true, + }, + { + headerName: 'Місцезнаходженя, км+ кінець', + field: 'end', + editable: true, + }, + { + headerName: 'Ширина, узбіччя зліва', + field: 'widthRoadsideLeft', + editable: true, + }, + { + headerName: 'Ширина, проїзна зворотнього напрямку', + field: 'widthReverseRoad', + editable: true, + }, + { + headerName: 'Ширина, розподільча смуга', + field: 'widthStrip', + editable: true, + }, + { + headerName: 'Ширина, проїзна прямого напрямку', + field: 'widthRoadwayForward', + editable: true, + }, + { + headerName: 'Ширина, узбіччя справа', + field: 'widthRoadsideRight', + editable: true, + }, + { + headerName: 'Кількість смуг руху зліва', + field: 'countLaneLeft', + editable: true, + }, + { + headerName: 'Кількість смуг руху справа', + field: 'countLaneRight', + editable: true, + }, + ]; + } + + protected initFunction(): void { + this.dataService.getModels().then((models: any) => { + this.regions = models.regionSelectListDsM as RegionSelectList[]; + this.roads = models.roadSelectListDsM as RoadSelectList[]; + }).then(() => { + this.bootstrapGrid(); + }); + } + + // tslint:disable-next-line:member-ordering + public CreateModel(): Object { + return new RoadWidth(); + } +} diff --git a/src/app/data/road-width/road-width.scss b/src/app/data/road-width/road-width.scss new file mode 100644 index 0000000..de4dc3d --- /dev/null +++ b/src/app/data/road-width/road-width.scss @@ -0,0 +1,4 @@ +.toolbar button { + margin: 2px; + padding: 0; +} \ No newline at end of file diff --git a/src/app/data/service-object/service-object.component.ts b/src/app/data/service-object/service-object.component.ts index 6621b09..d042dc5 100644 --- a/src/app/data/service-object/service-object.component.ts +++ b/src/app/data/service-object/service-object.component.ts @@ -1,5 +1,6 @@ import {Component, ViewEncapsulation} from '@angular/core'; import {GridOptions} from 'ag-grid/main'; +import { TdLoadingService } from '@covalent/core'; import { StatementBase } from '../../../models/statement.base'; @@ -37,6 +38,7 @@ export class ServiceObjectComponent extends StatementBase { protected service: ServiceObjectService, protected dataService: ServiceObjectCreateService, protected booleanService: BooleanSelectListService, + protected loadingService: TdLoadingService, ) { super(); } @@ -162,4 +164,9 @@ export class ServiceObjectComponent extends StatementBase { this.bootstrapGrid(); }); } + + // tslint:disable-next-line:member-ordering + public CreateModel(): Object { + return new ServiceObject(); + } } diff --git a/src/models/road-direction-select-list.ts b/src/models/road-direction-select-list.ts new file mode 100644 index 0000000..f12d6f4 --- /dev/null +++ b/src/models/road-direction-select-list.ts @@ -0,0 +1,4 @@ +export class RoadDirectionSelectList { + roadDirectionId: number; + name: string; +} diff --git a/src/models/road-surface.ts b/src/models/road-surface.ts new file mode 100644 index 0000000..f0c7a84 --- /dev/null +++ b/src/models/road-surface.ts @@ -0,0 +1,11 @@ +export class RoadSurface { + id: number; + roadId: number; + regionId: number; + roadDirectionId: number; + begin: number; + end: number; + surfaceTypeId: number; + surfaceTreatmentId: number; + stateCommonid: number; +} diff --git a/src/models/road-width.ts b/src/models/road-width.ts new file mode 100644 index 0000000..4f62b9a --- /dev/null +++ b/src/models/road-width.ts @@ -0,0 +1,14 @@ +export class RoadWidth { + id: number; + roadId: number; + regionId: number; + begin: number; + end: number; + withRoadsideLeft: number; + widthReverseRoad: number; + widthStrip: number; + widthRoadwayForward: number; + widthRoadsideRight: number; + countLaneLeft: number; + countLaneRight: number; +} diff --git a/src/models/surface-treatment-select-list.ts b/src/models/surface-treatment-select-list.ts new file mode 100644 index 0000000..35ba012 --- /dev/null +++ b/src/models/surface-treatment-select-list.ts @@ -0,0 +1,4 @@ +export class SurfaceTreatmentSelectList { + surfaceTreatmentId: number; + name: string; +} diff --git a/src/services/road-surface-create.service.ts b/src/services/road-surface-create.service.ts new file mode 100644 index 0000000..7df2d5d --- /dev/null +++ b/src/services/road-surface-create.service.ts @@ -0,0 +1,12 @@ +import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; + +import { CreateBaseService } from './create.base.service'; + +@Injectable() +export class RoadSurfaceCreateService extends CreateBaseService { + protected apiUrl: string = 'http://localhost:5000/roadsurface/directory'; + constructor(protected http: Http) { + super(http); + } +} diff --git a/src/services/road-surface.service.ts b/src/services/road-surface.service.ts new file mode 100644 index 0000000..c6ae977 --- /dev/null +++ b/src/services/road-surface.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; +import { Headers, Http } from '@angular/http'; + +import { StatementBaseService } from './statement.base.service'; + +import { RoadSurface } from '../models/road-surface'; + +@Injectable() +export class RoadSurfaceService extends StatementBaseService { + protected url: string = 'http://localhost:5000/roadsurface'; + constructor(protected http: Http) { + super(http); + } + public createModel(): Object { + return new RoadSurface(); + } + protected parseModels(json: any): any { + return json.roadSurfaceEditDsM as RoadSurface[]; + } + protected parseModel(json: any): any { + return json as RoadSurface; + } +} diff --git a/src/services/road-width-create.service.ts b/src/services/road-width-create.service.ts new file mode 100644 index 0000000..4800899 --- /dev/null +++ b/src/services/road-width-create.service.ts @@ -0,0 +1,12 @@ +import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; + +import { CreateBaseService } from './create.base.service'; + +@Injectable() +export class RoadWidthCreateService extends CreateBaseService { + protected apiUrl: string = 'http://localhost:5000/roadwidth/directory'; + constructor(protected http: Http) { + super(http); + } +} diff --git a/src/services/road-width.service.ts b/src/services/road-width.service.ts new file mode 100644 index 0000000..adc43c7 --- /dev/null +++ b/src/services/road-width.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; +import { Headers, Http } from '@angular/http'; + +import { StatementBaseService } from './statement.base.service'; + +import { RoadWidth } from '../models/road-width'; + +@Injectable() +export class RoadWidthService extends StatementBaseService { + protected url: string = 'http://localhost:5000/roadwidth'; + constructor(protected http: Http) { + super(http); + } + public createModel(): Object { + return new RoadWidth(); + } + protected parseModels(json: any): any { + return json.roadWidthEditDsM as RoadWidth[]; + } + protected parseModel(json: any): any { + return json as RoadWidth; + } +} -- libgit2 0.21.4