Commit 4cfbf7ca7300aa3eb731773a2ef22cd4325d4da1

Authored by Administrator
1 parent 43da7a40

add road-to-category

src/app/app.module.ts
... ... @@ -24,6 +24,7 @@ import { BusStopComponent } from './data/bus-stop/bus-stop.component';
24 24 import { ServiceObjectComponent } from './data/service-object/service-object.component';
25 25 import { RoadSurfaceComponent } from './data/road-surface/road-surface.component';
26 26 import { RoadWidthComponent } from './data/road-width/road-width.component';
  27 +import { RoadToCategoryComponent } from './data/road-to-category/road-to-category.component';
27 28 import { CrossSectionComponent } from './data/cross-section/cross-section.component';
28 29 import { EditorComponent } from '../helpers/editor.component';
29 30 import { RendererComponent } from '../helpers/renderer.component';
... ... @@ -41,6 +42,8 @@ import { RoadSurfaceService } from '../services/road-surface.service';
41 42 import { RoadSurfaceCreateService } from '../services/road-surface-create.service';
42 43 import { RoadWidthService } from '../services/road-width.service';
43 44 import { RoadWidthCreateService } from '../services/road-width-create.service';
  45 +import { RoadToCategoryService } from '../services/road-to-category.service';
  46 +import { RoadToCategoryCreateService } from '../services/road-to-category-create.service';
44 47 import { CrossSectionService } from '../services/cross-section.service';
45 48 import { CrossSectionCreateService } from '../services/cross-section-create.service';
46 49 import { BooleanSelectListService } from '../services/boolean-select-list.service';
... ... @@ -71,6 +74,7 @@ const httpInterceptorProviders: Type<any>[] = [
71 74 EditorComponent,
72 75 RendererComponent,
73 76 RoadWidthComponent,
  77 + RoadToCategoryComponent,
74 78 FlowIntensityComponent,
75 79 RoadComponent,
76 80 CrossSectionComponent,
... ... @@ -86,6 +90,7 @@ const httpInterceptorProviders: Type<any>[] = [
86 90 RendererComponent,
87 91 RoadSurfaceComponent,
88 92 RoadWidthComponent,
  93 + RoadToCategoryComponent,
89 94 FlowIntensityComponent,
90 95 RoadComponent,
91 96 CrossSectionComponent,
... ... @@ -118,6 +123,8 @@ const httpInterceptorProviders: Type<any>[] = [
118 123 RoadSurfaceService,
119 124 RoadWidthCreateService,
120 125 RoadWidthService,
  126 + RoadToCategoryCreateService,
  127 + RoadToCategoryService,
121 128 FlowIntensityCreateService,
122 129 FlowIntensityService,
123 130 RoadCreateService,
... ...
src/app/app.routes.ts
... ... @@ -7,6 +7,7 @@ import { TemplatesComponent } from './templates/templates.component';
7 7 import { BusStopComponent } from './data/bus-stop/bus-stop.component';
8 8 import { RoadSurfaceComponent } from './data/road-surface/road-surface.component';
9 9 import { RoadWidthComponent } from './data/road-width/road-width.component';
  10 +import { RoadToCategoryComponent } from './data/road-to-category/road-to-category.component';
10 11 import { CrossSectionComponent } from './data/cross-section/cross-section.component';
11 12 import { ServiceObjectComponent } from './data/service-object/service-object.component';
12 13 import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component';
... ... @@ -27,6 +28,7 @@ const routes: Routes = [
27 28 {path: 'cross-section', component: CrossSectionComponent},
28 29 {path: 'road', component: RoadComponent},
29 30 {path: 'road-service', component: RoadServiceComponent},
  31 + {path: 'road-to-category', component: RoadToCategoryComponent},
30 32 {path: 'settlement-address-link', component: SettlementAddressLinkComponent},
31 33 ]},
32 34 ]},
... ...
src/app/data/data.component.html
... ... @@ -30,7 +30,7 @@
30 30 <md-icon md-list-icon>dashboard</md-icon>
31 31 Інтенсивності
32 32 </a>
33   - <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']">
  33 + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['road-to-category']">
34 34 <md-icon md-list-icon>dashboard</md-icon>
35 35 Категорія доріг
36 36 </a>
... ...
src/app/data/road-to-category/road-to-category.component.html 0 → 100644
  1 +<div class="grid_containert" *ngIf="showGrid">
  2 + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-blue" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups
  3 + toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)"
  4 + (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()"
  5 + (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged($event)" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)">
  6 + </ag-grid-ng2>
  7 + <div class="control_button">
  8 + <div *tdLoading="'loading'; mode:'indeterminate'; type:'circle'; strategy:'replace'; color:'accent'"></div>
  9 + <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button>
  10 + <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button>
  11 + </div>
  12 +</div>
0 13 \ No newline at end of file
... ...
src/app/data/road-to-category/road-to-category.component.ts 0 → 100644
  1 +import {Component, ViewEncapsulation} from '@angular/core';
  2 +import {GridOptions} from 'ag-grid/main';
  3 +import { TdLoadingService } from '@covalent/core';
  4 +
  5 +import { StatementBase } from '../../../models/statement.base';
  6 +
  7 +
  8 +import { RoadToCategory } from '../../../models/road-to-category';
  9 +import { EditorComponent } from '../../../helpers/editor.component';
  10 +import { RendererComponent } from '../../../helpers/renderer.component';
  11 +import { RoadToCategoryService } from '../../../services/road-to-category.service';
  12 +import { RoadToCategoryCreateService } from '../../../services/road-to-category-create.service';
  13 +import { RegionSelectList } from '../../../models/region-select-list';
  14 +import { RoadSelectList } from '../../../models/road-select-list';
  15 +import { RoadCategorySelectList } from '../../../models/road-category-select-list';
  16 +
  17 +
  18 +
  19 +import { routerTransition } from '../../../animations/router.animation';
  20 +
  21 +@Component({
  22 + selector: 'road-to-category',
  23 + templateUrl: 'road-to-category.component.html',
  24 + styleUrls: ['road-to-category.scss'],
  25 + encapsulation: ViewEncapsulation.None,
  26 +})
  27 +export class RoadToCategoryComponent extends StatementBase {
  28 +
  29 + public regions: RegionSelectList[];
  30 +
  31 + public roads: RoadSelectList[];
  32 +
  33 + public roadCategory: RoadCategorySelectList[];
  34 +
  35 + constructor(
  36 + protected service: RoadToCategoryService,
  37 + protected dataService: RoadToCategoryCreateService,
  38 + protected loadingService: TdLoadingService,
  39 + ) {
  40 + super();
  41 + }
  42 +
  43 + protected createColumnDefs(): any[] {
  44 + return [
  45 + {
  46 + headerName: '#',
  47 + width: 30,
  48 + checkboxSelection: true,
  49 + suppressSorting: true,
  50 + suppressMenu: true,
  51 + pinned: true,
  52 + },
  53 + {
  54 + headerName: 'ID',
  55 + field: 'id',
  56 + },
  57 + {
  58 + headerName: 'Назва дороги',
  59 + field: 'roadId',
  60 + editable: true,
  61 + cellEditorFramework: EditorComponent,
  62 + cellRendererFramework: RendererComponent,
  63 + cellEditorParams: {
  64 + data: this.roads,
  65 + valueCol: 'roadId',
  66 + labelCol: 'name',
  67 + },
  68 + },
  69 + {
  70 + headerName: 'Область',
  71 + field: 'regionId',
  72 + editable: true,
  73 + cellEditorFramework: EditorComponent,
  74 + cellRendererFramework: RendererComponent,
  75 + cellEditorParams: {
  76 + data: this.regions,
  77 + valueCol: 'regionId',
  78 + labelCol: 'name',
  79 + },
  80 + },
  81 + ];
  82 + }
  83 +
  84 + protected initFunction(): void {
  85 + this.dataService.getModels().then((models: any) => {
  86 + this.regions = models.regionSelectListDsM as RegionSelectList[];
  87 + this.roads = models.roadSelectListDsM as RoadSelectList[];
  88 + this.roadCategory = models.roadCategorySelectListDsM as RoadCategorySelectList[];
  89 + }).then(() => {
  90 + this.bootstrapGrid();
  91 + });
  92 + }
  93 +
  94 + // tslint:disable-next-line:member-ordering
  95 + public CreateModel(): Object {
  96 + return new RoadToCategory();
  97 + }
  98 +}
... ...
src/app/data/road-to-category/road-to-category.scss 0 → 100644
  1 +.toolbar button {
  2 + margin: 2px;
  3 + padding: 0;
  4 +}
0 5 \ No newline at end of file
... ...
src/models/road-category-select-list.ts 0 → 100644
  1 +export class RoadCategorySelectList {
  2 + roadCategoryId: number;
  3 + value: string;
  4 + }
... ...
src/models/road-to-category.ts 0 → 100644
  1 +export class RoadToCategory {
  2 + id: number;
  3 + roadId: number;
  4 + regionId: number;
  5 + begin: number;
  6 + end: number;
  7 + distance: number;
  8 + roadCategoryId: number;
  9 +}
... ...
src/models/service-object-type-select-list.ts
1 1 export class ServiceObjectTypeSelectList {
2   - stateCommonId: number;
  2 + serviceObjectTypeId: number;
3 3 value: string;
4 4 }
... ...
src/services/road-to-category-create.service.ts 0 → 100644
  1 +import { Injectable } from '@angular/core';
  2 +import { Http } from '@angular/http';
  3 +
  4 +import { CreateBaseService } from './create.base.service';
  5 +
  6 +@Injectable()
  7 +export class RoadToCategoryCreateService extends CreateBaseService {
  8 + protected apiUrl: string = 'http://localhost:5000/roadtocategory/directory';
  9 + constructor(protected http: Http) {
  10 + super(http);
  11 + }
  12 +}
... ...
src/services/road-to-category.service.ts 0 → 100644
  1 +import { Injectable } from '@angular/core';
  2 +import { Headers, Http } from '@angular/http';
  3 +
  4 +import { StatementBaseService } from './statement.base.service';
  5 +
  6 +import { RoadToCategory } from '../models/road-to-category';
  7 +
  8 +@Injectable()
  9 +export class RoadToCategoryService extends StatementBaseService {
  10 + protected url: string = 'http://localhost:5000/roadtocategory';
  11 + constructor(protected http: Http) {
  12 + super(http);
  13 + }
  14 + public createModel(): Object {
  15 + return new RoadToCategory();
  16 + }
  17 + protected parseModels(json: any): any {
  18 + return json.roadToCategoryEditDsM as RoadToCategory[];
  19 + }
  20 + protected parseModel(json: any): any {
  21 + return json as RoadToCategory;
  22 + }
  23 +}
... ...