Commit 5d8a505f602e55b5cee1e98d03d194cc372e60f6
1 parent
366f081e
RoadService
Showing
10 changed files
with
206 additions
and
1 deletions
Show diff stats
src/app/app.module.ts
| ... | ... | @@ -29,6 +29,7 @@ import { EditorComponent } from '../helpers/editor.component'; |
| 29 | 29 | import { RendererComponent } from '../helpers/renderer.component'; |
| 30 | 30 | import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; |
| 31 | 31 | import { RoadComponent } from './data/road/road.component'; |
| 32 | +import { RoadServiceComponent } from './data/road-service/road-service.component'; | |
| 32 | 33 | |
| 33 | 34 | // Services |
| 34 | 35 | import { BusStopCreateService } from '../services/bus-stop-create.service'; |
| ... | ... | @@ -46,6 +47,8 @@ import { FlowIntensityCreateService } from '../services/flow-intensity-create.se |
| 46 | 47 | import { FlowIntensityService } from '../services/flow-intensity.service'; |
| 47 | 48 | import { RoadCreateService } from '../services/road-create.service'; |
| 48 | 49 | import { RoadService } from '../services/road.service'; |
| 50 | +import { RoadServiceService } from '../services/road-service.service'; | |
| 51 | +import { RoadServiceCreateService } from '../services/road-service-create.service'; | |
| 49 | 52 | |
| 50 | 53 | const httpInterceptorProviders: Type<any>[] = [ |
| 51 | 54 | RequestInterceptor, |
| ... | ... | @@ -68,6 +71,7 @@ const httpInterceptorProviders: Type<any>[] = [ |
| 68 | 71 | FlowIntensityComponent, |
| 69 | 72 | RoadComponent, |
| 70 | 73 | CrossSectionComponent, |
| 74 | + RoadServiceComponent, | |
| 71 | 75 | ], // directives, components, and pipes owned by this NgModule |
| 72 | 76 | imports: [ |
| 73 | 77 | BrowserModule, |
| ... | ... | @@ -81,6 +85,7 @@ const httpInterceptorProviders: Type<any>[] = [ |
| 81 | 85 | FlowIntensityComponent, |
| 82 | 86 | RoadComponent, |
| 83 | 87 | CrossSectionComponent, |
| 88 | + RoadServiceComponent, | |
| 84 | 89 | ]), |
| 85 | 90 | CovalentCoreModule.forRoot(), |
| 86 | 91 | CovalentChartsModule.forRoot(), |
| ... | ... | @@ -114,6 +119,8 @@ const httpInterceptorProviders: Type<any>[] = [ |
| 114 | 119 | RoadService, |
| 115 | 120 | CrossSectionCreateService, |
| 116 | 121 | CrossSectionService, |
| 122 | + RoadServiceService, | |
| 123 | + RoadServiceCreateService, | |
| 117 | 124 | ], // additional providers needed for this module |
| 118 | 125 | entryComponents: [ ], |
| 119 | 126 | bootstrap: [ AppComponent ], | ... | ... |
src/app/app.routes.ts
| ... | ... | @@ -11,6 +11,7 @@ import { CrossSectionComponent } from './data/cross-section/cross-section.compon |
| 11 | 11 | import { ServiceObjectComponent } from './data/service-object/service-object.component'; |
| 12 | 12 | import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; |
| 13 | 13 | import { RoadComponent } from './data/road/road.component'; |
| 14 | +import { RoadServiceComponent } from './data/road-service/road-service.component'; | |
| 14 | 15 | |
| 15 | 16 | const routes: Routes = [ |
| 16 | 17 | {path: 'login', component: LoginComponent}, |
| ... | ... | @@ -24,6 +25,7 @@ const routes: Routes = [ |
| 24 | 25 | {path: 'flow-intensity', component: FlowIntensityComponent}, |
| 25 | 26 | {path: 'cross-section', component: CrossSectionComponent}, |
| 26 | 27 | {path: 'road', component: RoadComponent}, |
| 28 | + {path: 'road-service', component: RoadServiceComponent}, | |
| 27 | 29 | ]}, |
| 28 | 30 | ]}, |
| 29 | 31 | ]; | ... | ... |
src/app/data/data.component.html
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | <md-icon md-list-icon>dashboard</md-icon> |
| 19 | 19 | Автомобільні дороги |
| 20 | 20 | </a> |
| 21 | - <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['stats']"> | |
| 21 | + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['road-service']"> | |
| 22 | 22 | <md-icon md-list-icon>insert_chart</md-icon> |
| 23 | 23 | Обслуговування |
| 24 | 24 | </a> | ... | ... |
src/app/data/road-service/road-service.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-service/road-service.component.ts
0 → 100644
| 1 | +import { Component, ViewEncapsulation, AfterViewInit } from '@angular/core'; | |
| 2 | +import { TdLoadingService } from '@covalent/core'; | |
| 3 | +import { GridOptions, IGetRowsParams, IRowModel } from 'ag-grid/main'; | |
| 4 | + | |
| 5 | +import { StatementBase } from '../../../models/statement.base'; | |
| 6 | + | |
| 7 | +import { RoadServiceService } from '../../../services/road-service.service'; | |
| 8 | +import { RoadService } from '../../../models/road-service'; | |
| 9 | +import { EditorComponent } from '../../../helpers/editor.component'; | |
| 10 | +import { RendererComponent } from '../../../helpers/renderer.component'; | |
| 11 | +import { RoadServiceCreateService } from '../../../services/road-service-create.service'; | |
| 12 | +import { RegionSelectList } from '../../../models/region-select-list'; | |
| 13 | +import { RoadSelectList } from '../../../models/road-select-list'; | |
| 14 | +import { RoadDirectionSelectList } from '../../../models/road-direction-select-list'; | |
| 15 | +import { OrganizationSelectList } from '../../../models/organization-select-list'; | |
| 16 | + | |
| 17 | +import { routerTransition } from '../../../animations/router.animation'; | |
| 18 | + | |
| 19 | +@Component({ | |
| 20 | + // tslint:disable-next-line:component-selector | |
| 21 | + selector: 'road-service-grid', | |
| 22 | + templateUrl: 'road-service.component.html', | |
| 23 | + styleUrls: ['road-service.scss'], | |
| 24 | + encapsulation: ViewEncapsulation.None, | |
| 25 | +}) | |
| 26 | +export class RoadServiceComponent extends StatementBase { | |
| 27 | + | |
| 28 | + public regions: RegionSelectList[]; | |
| 29 | + public roads: RoadSelectList[]; | |
| 30 | + public roadDirections: RoadDirectionSelectList[]; | |
| 31 | + public organizations: OrganizationSelectList[]; | |
| 32 | + | |
| 33 | + constructor( | |
| 34 | + protected service: RoadServiceService, | |
| 35 | + protected dataService: RoadServiceCreateService, | |
| 36 | + protected loadingService: TdLoadingService, | |
| 37 | + ) { | |
| 38 | + super(); | |
| 39 | + } | |
| 40 | + | |
| 41 | + protected createColumnDefs(): any[] { | |
| 42 | + return [ | |
| 43 | + { | |
| 44 | + headerName: '#', | |
| 45 | + width: 30, | |
| 46 | + checkboxSelection: true, | |
| 47 | + suppressSorting: true, | |
| 48 | + suppressMenu: true, | |
| 49 | + pinned: true, | |
| 50 | + }, | |
| 51 | + { | |
| 52 | + headerName: 'ID', | |
| 53 | + field: 'id', | |
| 54 | + }, | |
| 55 | + { | |
| 56 | + headerName: 'Назва дороги', | |
| 57 | + field: 'roadId', | |
| 58 | + editable: true, | |
| 59 | + cellEditorFramework: EditorComponent, | |
| 60 | + cellRendererFramework: RendererComponent, | |
| 61 | + cellEditorParams: { | |
| 62 | + data: this.roads, | |
| 63 | + valueCol: 'roadId', | |
| 64 | + labelCol: 'name', | |
| 65 | + }, | |
| 66 | + }, | |
| 67 | + { | |
| 68 | + headerName: 'Область', | |
| 69 | + field: 'regionId', | |
| 70 | + editable: true, | |
| 71 | + cellEditorFramework: EditorComponent, | |
| 72 | + cellRendererFramework: RendererComponent, | |
| 73 | + cellEditorParams: { | |
| 74 | + data: this.regions, | |
| 75 | + valueCol: 'regionId', | |
| 76 | + labelCol: 'name', | |
| 77 | + }, | |
| 78 | + }, | |
| 79 | + { | |
| 80 | + headerName: 'Місцезнаходження, км+ початок', | |
| 81 | + field: 'begin', | |
| 82 | + editable: true, | |
| 83 | + }, | |
| 84 | + { | |
| 85 | + headerName: 'Місцезнаходження, км+ кінець', | |
| 86 | + field: 'end', | |
| 87 | + editable: true, | |
| 88 | + }, | |
| 89 | + { | |
| 90 | + headerName: 'Напрямок смуги руху', | |
| 91 | + field: 'roadDirectionId', | |
| 92 | + editable: true, | |
| 93 | + cellEditorFramework: EditorComponent, | |
| 94 | + cellRendererFramework: RendererComponent, | |
| 95 | + cellEditorParams: { | |
| 96 | + data: this.roadDirections, | |
| 97 | + valueCol: 'roadDirectionId', | |
| 98 | + labelCol: 'name', | |
| 99 | + }, | |
| 100 | + }, | |
| 101 | + { | |
| 102 | + headerName: 'Назва організації чи підприємства, що обслуговує ділянку дороги', | |
| 103 | + field: 'organizationId', | |
| 104 | + editable: true, | |
| 105 | + cellEditorFramework: EditorComponent, | |
| 106 | + cellRendererFramework: RendererComponent, | |
| 107 | + cellEditorParams: { | |
| 108 | + data: this.organizations, | |
| 109 | + valueCol: 'id', | |
| 110 | + labelCol: 'name', | |
| 111 | + }, | |
| 112 | + }, | |
| 113 | + { | |
| 114 | + headerName: 'Рік початку обслуговування', | |
| 115 | + field: 'yearBegin', | |
| 116 | + editable: true, | |
| 117 | + }, | |
| 118 | + ]; | |
| 119 | + } | |
| 120 | + | |
| 121 | + protected initFunction(): void { | |
| 122 | + this.dataService.getModels().then((models: any) => { | |
| 123 | + this.regions = models.regionSelectListDsM as RegionSelectList[]; | |
| 124 | + this.roads = models.roadSelectListDsM as RoadSelectList[]; | |
| 125 | + this.roadDirections = models.roadDirectionSelectListDsM as RoadDirectionSelectList[]; | |
| 126 | + this.organizations = models.organizationSelectListDsM as OrganizationSelectList[]; | |
| 127 | + }).then(() => { | |
| 128 | + this.bootstrapGrid(); | |
| 129 | + }); | |
| 130 | + } | |
| 131 | +} | ... | ... |
| 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 RoadServiceCreateService extends CreateBaseService { | |
| 8 | + protected apiUrl: string = 'http://localhost:5000/roadservice/directory'; | |
| 9 | + constructor(protected http: Http) { | |
| 10 | + super(http); | |
| 11 | + } | |
| 12 | +} | ... | ... |
| 1 | +import { Injectable } from '@angular/core'; | |
| 2 | +import { Http } from '@angular/http'; | |
| 3 | + | |
| 4 | +import { StatementBaseService } from './statement.base.service'; | |
| 5 | + | |
| 6 | +import { RoadService } from '../models/road-service'; | |
| 7 | + | |
| 8 | +@Injectable() | |
| 9 | +export class RoadServiceService extends StatementBaseService { | |
| 10 | + protected url: string = 'http://localhost:5000/roadservice'; | |
| 11 | + constructor(protected http: Http) { | |
| 12 | + super(http); | |
| 13 | + } | |
| 14 | + public createModel(): Object { | |
| 15 | + return new RoadService(); | |
| 16 | + } | |
| 17 | + protected parseModels(json: any): any[] { | |
| 18 | + return json.roadServiceEditDsM as RoadService[]; | |
| 19 | + }; | |
| 20 | + protected parseModel(json: any): any { | |
| 21 | + return json as RoadService; | |
| 22 | + }; | |
| 23 | +} | ... | ... |