Commit feb1ac3791b7960a066b0ab70b8e08815e3b52d2

Authored by Yarik
2 parents 907e8b4e 14db241c

Merge

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 { CrossSectionComponent } from './data/cross-section/cross-section.component';
27 28 import { EditorComponent } from '../helpers/editor.component';
28 29 import { RendererComponent } from '../helpers/renderer.component';
29 30 import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component';
... ... @@ -37,6 +38,8 @@ import { RoadSurfaceService } from '../services/road-surface.service';
37 38 import { RoadSurfaceCreateService } from '../services/road-surface-create.service';
38 39 import { RoadWidthService } from '../services/road-width.service';
39 40 import { RoadWidthCreateService } from '../services/road-width-create.service';
  41 +import { CrossSectionService } from '../services/cross-section.service';
  42 +import { CrossSectionCreateService } from '../services/cross-section-create.service';
40 43 import { BooleanSelectListService } from '../services/boolean-select-list.service';
41 44 import { FlowIntensityCreateService } from '../services/flow-intensity-create.service';
42 45 import { FlowIntensityService } from '../services/flow-intensity.service';
... ... @@ -60,6 +63,7 @@ const httpInterceptorProviders: Type<any>[] = [
60 63 RendererComponent,
61 64 RoadWidthComponent,
62 65 FlowIntensityComponent,
  66 + CrossSectionComponent,
63 67 ], // directives, components, and pipes owned by this NgModule
64 68 imports: [
65 69 BrowserModule,
... ... @@ -71,6 +75,7 @@ const httpInterceptorProviders: Type<any>[] = [
71 75 RoadSurfaceComponent,
72 76 RoadWidthComponent,
73 77 FlowIntensityComponent,
  78 + CrossSectionComponent,
74 79 ]),
75 80 CovalentCoreModule.forRoot(),
76 81 CovalentChartsModule.forRoot(),
... ... @@ -100,6 +105,8 @@ const httpInterceptorProviders: Type<any>[] = [
100 105 RoadWidthService,
101 106 FlowIntensityCreateService,
102 107 FlowIntensityService,
  108 + CrossSectionCreateService,
  109 + CrossSectionService,
103 110 ], // additional providers needed for this module
104 111 entryComponents: [ ],
105 112 bootstrap: [ AppComponent ],
... ...
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 { CrossSectionComponent } from './data/cross-section/cross-section.component';
10 11 import { ServiceObjectComponent } from './data/service-object/service-object.component';
11 12 import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component';
12 13  
... ... @@ -20,6 +21,7 @@ const routes: Routes = [
20 21 {path: 'road-surface', component: RoadSurfaceComponent},
21 22 {path: 'road-width', component: RoadWidthComponent},
22 23 {path: 'flow-intensity', component: FlowIntensityComponent},
  24 + {path: 'cross-section', component: CrossSectionComponent},
23 25 ]},
24 26 ]},
25 27 ];
... ...
src/app/data/cross-section/cross-section.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()" (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" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button>
  10 + <button md-fab color="warn" (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/cross-section/cross-section.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 +import { CrossSectionService } from '../../../services/cross-section.service';
  8 +import { CrossSection } from '../../../models/cross-section';
  9 +import { EditorComponent } from '../../../helpers/editor.component';
  10 +import { RendererComponent } from '../../../helpers/renderer.component';
  11 +import { CrossSectionCreateService } from '../../../services/cross-section-create.service';
  12 +import { RegionSelectList } from '../../../models/region-select-list';
  13 +import { RoadSelectList } from '../../../models/road-select-list';
  14 +import { StateCommonSelectList } from '../../../models/state-common-select-list';
  15 +import { SurfaceTypeSelectList } from '../../../models/surface-type-select-list';
  16 +
  17 +import { routerTransition } from '../../../animations/router.animation';
  18 +
  19 +@Component({
  20 + selector: 'cross-section',
  21 + templateUrl: 'cross-section.component.html',
  22 + styleUrls: ['cross-section.scss'],
  23 + encapsulation: ViewEncapsulation.None,
  24 +})
  25 +export class CrossSectionComponent extends StatementBase {
  26 +
  27 + public regions: RegionSelectList[];
  28 + public roads: RoadSelectList[];
  29 + public surfaceTypes: SurfaceTypeSelectList[];
  30 + public states: StateCommonSelectList[];
  31 +
  32 + constructor(
  33 + protected service: CrossSectionService,
  34 + protected dataService: CrossSectionCreateService,
  35 + protected loadingService: TdLoadingService,
  36 + ) {
  37 + super();
  38 + }
  39 +
  40 + protected createColumnDefs(): any[] {
  41 + return [
  42 + {
  43 + headerName: '#',
  44 + width: 30,
  45 + checkboxSelection: true,
  46 + suppressSorting: true,
  47 + suppressMenu: true,
  48 + pinned: true,
  49 + },
  50 + {
  51 + headerName: 'ID',
  52 + field: 'id',
  53 + },
  54 + {
  55 + headerName: 'Назва дороги',
  56 + field: 'roadId',
  57 + editable: true,
  58 + cellEditorFramework: EditorComponent,
  59 + cellRendererFramework: RendererComponent,
  60 + cellEditorParams: {
  61 + data: this.roads,
  62 + valueCol: 'roadId',
  63 + labelCol: 'name',
  64 + },
  65 + },
  66 + {
  67 + headerName: 'Область',
  68 + field: 'regionId',
  69 + editable: true,
  70 + cellEditorFramework: EditorComponent,
  71 + cellRendererFramework: RendererComponent,
  72 + cellEditorParams: {
  73 + data: this.regions,
  74 + valueCol: 'regionId',
  75 + labelCol: 'name',
  76 + },
  77 + },
  78 + {
  79 + headerName: 'Стан покриття',
  80 + field: 'stateCommonId',
  81 + editable: true,
  82 + cellEditorFramework: EditorComponent,
  83 + cellRendererFramework: RendererComponent,
  84 + cellEditorParams: {
  85 + data: this.states,
  86 + valueCol: 'stateCommonId',
  87 + labelCol: 'value',
  88 + },
  89 + },
  90 + ];
  91 + }
  92 +
  93 + protected initFunction(): void {
  94 + this.dataService.getModels().then((models: any) => {
  95 + this.regions = models.regionSelectListDsM as RegionSelectList[];
  96 + this.roads = models.roadSelectListDsM as RoadSelectList[];
  97 + this.surfaceTypes = models.surfaceTypeSelectListDsM as SurfaceTypeSelectList[];
  98 + this.states = models.stateCommonSelectListDsM as StateCommonSelectList[];
  99 + }).then(() => {
  100 + this.bootstrapGrid();
  101 + });
  102 + }
  103 +
  104 + // tslint:disable-next-line:member-ordering
  105 + public CreateModel(): Object {
  106 + return new CrossSection();
  107 + }
  108 +}
... ...
src/app/data/cross-section/cross-section.scss 0 → 100644
  1 +.toolbar button {
  2 + margin: 2px;
  3 + padding: 0;
  4 +}
0 5 \ No newline at end of file
... ...
src/app/data/data.component.html
... ... @@ -26,15 +26,15 @@
26 26 <md-icon md-list-icon>star</md-icon>
27 27 Прив'язки населених пунктів
28 28 </a>
29   - <a md-list-item (click)="!media.query('gt-sm') && manageList.close()" md-ripple class="block relative">
30   - <md-icon md-list-icon>people</md-icon>
  29 + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']">
  30 + <md-icon md-list-icon>dashboard</md-icon>
31 31 Інтенсивності
32 32 </a>
33 33 <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']">
34 34 <md-icon md-list-icon>dashboard</md-icon>
35 35 Категорія доріг
36 36 </a>
37   - <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']">
  37 + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['cross-section']">
38 38 <md-icon md-list-icon>dashboard</md-icon>
39 39 З'їзди
40 40 </a>
... ...
src/models/cross-section.ts 0 → 100644
  1 +export class CrossSection {
  2 + id: number;
  3 + roadId: number;
  4 + regionId: number;
  5 + stateCommonid: number;
  6 + locationLeft: number;
  7 + locationRight: number;
  8 + direction: string;
  9 + surfaceTypeId: number;
  10 + lengthSection: number;
  11 + lengthSurface: number;
  12 + distanceEdge: number;
  13 + width: number;
  14 + angle: number;
  15 + tubeAvailability: number;
  16 + safetyAvailability: number;
  17 + yearBuild: number;
  18 + yearRepair: number;
  19 +
  20 +}
... ...
src/services/cross-section-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 CrossSectionCreateService extends CreateBaseService {
  8 + protected apiUrl: string = 'http://localhost:5000/crosssection/directory';
  9 + constructor(protected http: Http) {
  10 + super(http);
  11 + }
  12 +}
... ...
src/services/cross-section.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 { CrossSection } from '../models/cross-section';
  7 +
  8 +@Injectable()
  9 +export class CrossSectionService extends StatementBaseService {
  10 + protected url: string = 'http://localhost:5000/crosssection';
  11 + constructor(protected http: Http) {
  12 + super(http);
  13 + }
  14 + public createModel(): Object {
  15 + return new CrossSection();
  16 + }
  17 + protected parseModels(json: any): any {
  18 + return json.crossSectionEditDsM as CrossSection[];
  19 + }
  20 + protected parseModel(json: any): any {
  21 + return json as CrossSection;
  22 + }
  23 +}
... ...