diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 91202a2..23f3654 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -24,6 +24,7 @@ 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 { RoadToCategoryComponent } from './data/road-to-category/road-to-category.component'; import { CrossSectionComponent } from './data/cross-section/cross-section.component'; import { EditorComponent } from '../helpers/editor.component'; import { RendererComponent } from '../helpers/renderer.component'; @@ -41,6 +42,8 @@ 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 { RoadToCategoryService } from '../services/road-to-category.service'; +import { RoadToCategoryCreateService } from '../services/road-to-category-create.service'; import { CrossSectionService } from '../services/cross-section.service'; import { CrossSectionCreateService } from '../services/cross-section-create.service'; import { BooleanSelectListService } from '../services/boolean-select-list.service'; @@ -71,6 +74,7 @@ const httpInterceptorProviders: Type[] = [ EditorComponent, RendererComponent, RoadWidthComponent, + RoadToCategoryComponent, FlowIntensityComponent, RoadComponent, CrossSectionComponent, @@ -86,6 +90,7 @@ const httpInterceptorProviders: Type[] = [ RendererComponent, RoadSurfaceComponent, RoadWidthComponent, + RoadToCategoryComponent, FlowIntensityComponent, RoadComponent, CrossSectionComponent, @@ -118,6 +123,8 @@ const httpInterceptorProviders: Type[] = [ RoadSurfaceService, RoadWidthCreateService, RoadWidthService, + RoadToCategoryCreateService, + RoadToCategoryService, FlowIntensityCreateService, FlowIntensityService, RoadCreateService, diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index ae94404..9bb52c2 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -7,6 +7,7 @@ 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 { RoadToCategoryComponent } from './data/road-to-category/road-to-category.component'; import { CrossSectionComponent } from './data/cross-section/cross-section.component'; import { ServiceObjectComponent } from './data/service-object/service-object.component'; import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; @@ -27,6 +28,7 @@ const routes: Routes = [ {path: 'cross-section', component: CrossSectionComponent}, {path: 'road', component: RoadComponent}, {path: 'road-service', component: RoadServiceComponent}, + {path: 'road-to-category', component: RoadToCategoryComponent}, {path: 'settlement-address-link', component: SettlementAddressLinkComponent}, ]}, ]}, diff --git a/src/app/data/data.component.html b/src/app/data/data.component.html index cf364c0..ca125e6 100644 --- a/src/app/data/data.component.html +++ b/src/app/data/data.component.html @@ -30,7 +30,7 @@ dashboard Інтенсивності - + dashboard Категорія доріг diff --git a/src/app/data/road-to-category/road-to-category.component.html b/src/app/data/road-to-category/road-to-category.component.html new file mode 100644 index 0000000..7db449a --- /dev/null +++ b/src/app/data/road-to-category/road-to-category.component.html @@ -0,0 +1,12 @@ +
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/src/app/data/road-to-category/road-to-category.component.ts b/src/app/data/road-to-category/road-to-category.component.ts new file mode 100644 index 0000000..afa9026 --- /dev/null +++ b/src/app/data/road-to-category/road-to-category.component.ts @@ -0,0 +1,98 @@ +import {Component, ViewEncapsulation} from '@angular/core'; +import {GridOptions} from 'ag-grid/main'; +import { TdLoadingService } from '@covalent/core'; + +import { StatementBase } from '../../../models/statement.base'; + + +import { RoadToCategory } from '../../../models/road-to-category'; +import { EditorComponent } from '../../../helpers/editor.component'; +import { RendererComponent } from '../../../helpers/renderer.component'; +import { RoadToCategoryService } from '../../../services/road-to-category.service'; +import { RoadToCategoryCreateService } from '../../../services/road-to-category-create.service'; +import { RegionSelectList } from '../../../models/region-select-list'; +import { RoadSelectList } from '../../../models/road-select-list'; +import { RoadCategorySelectList } from '../../../models/road-category-select-list'; + + + +import { routerTransition } from '../../../animations/router.animation'; + +@Component({ + selector: 'road-to-category', + templateUrl: 'road-to-category.component.html', + styleUrls: ['road-to-category.scss'], + encapsulation: ViewEncapsulation.None, +}) +export class RoadToCategoryComponent extends StatementBase { + + public regions: RegionSelectList[]; + + public roads: RoadSelectList[]; + + public roadCategory: RoadCategorySelectList[]; + + constructor( + protected service: RoadToCategoryService, + protected dataService: RoadToCategoryCreateService, + 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', + }, + }, + ]; + } + + protected initFunction(): void { + this.dataService.getModels().then((models: any) => { + this.regions = models.regionSelectListDsM as RegionSelectList[]; + this.roads = models.roadSelectListDsM as RoadSelectList[]; + this.roadCategory = models.roadCategorySelectListDsM as RoadCategorySelectList[]; + }).then(() => { + this.bootstrapGrid(); + }); + } + + // tslint:disable-next-line:member-ordering + public CreateModel(): Object { + return new RoadToCategory(); + } +} diff --git a/src/app/data/road-to-category/road-to-category.scss b/src/app/data/road-to-category/road-to-category.scss new file mode 100644 index 0000000..de4dc3d --- /dev/null +++ b/src/app/data/road-to-category/road-to-category.scss @@ -0,0 +1,4 @@ +.toolbar button { + margin: 2px; + padding: 0; +} \ No newline at end of file diff --git a/src/models/road-category-select-list.ts b/src/models/road-category-select-list.ts new file mode 100644 index 0000000..cd9859a --- /dev/null +++ b/src/models/road-category-select-list.ts @@ -0,0 +1,4 @@ +export class RoadCategorySelectList { + roadCategoryId: number; + value: string; + } diff --git a/src/models/road-to-category.ts b/src/models/road-to-category.ts new file mode 100644 index 0000000..ea16d52 --- /dev/null +++ b/src/models/road-to-category.ts @@ -0,0 +1,9 @@ +export class RoadToCategory { + id: number; + roadId: number; + regionId: number; + begin: number; + end: number; + distance: number; + roadCategoryId: number; +} diff --git a/src/models/service-object-type-select-list.ts b/src/models/service-object-type-select-list.ts index 1519622..67e055f 100644 --- a/src/models/service-object-type-select-list.ts +++ b/src/models/service-object-type-select-list.ts @@ -1,4 +1,4 @@ export class ServiceObjectTypeSelectList { - stateCommonId: number; + serviceObjectTypeId: number; value: string; } diff --git a/src/services/road-to-category-create.service.ts b/src/services/road-to-category-create.service.ts new file mode 100644 index 0000000..aecbc60 --- /dev/null +++ b/src/services/road-to-category-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 RoadToCategoryCreateService extends CreateBaseService { + protected apiUrl: string = 'http://localhost:5000/roadtocategory/directory'; + constructor(protected http: Http) { + super(http); + } +} diff --git a/src/services/road-to-category.service.ts b/src/services/road-to-category.service.ts new file mode 100644 index 0000000..5cd5d54 --- /dev/null +++ b/src/services/road-to-category.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; +import { Headers, Http } from '@angular/http'; + +import { StatementBaseService } from './statement.base.service'; + +import { RoadToCategory } from '../models/road-to-category'; + +@Injectable() +export class RoadToCategoryService extends StatementBaseService { + protected url: string = 'http://localhost:5000/roadtocategory'; + constructor(protected http: Http) { + super(http); + } + public createModel(): Object { + return new RoadToCategory(); + } + protected parseModels(json: any): any { + return json.roadToCategoryEditDsM as RoadToCategory[]; + } + protected parseModel(json: any): any { + return json as RoadToCategory; + } +} -- libgit2 0.21.4