Blame view

src/app/data/cross-section/cross-section.component.ts 5.85 KB
14db241c   Administrator   add cross section
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  import {Component, ViewEncapsulation} from '@angular/core';
  import {GridOptions} from 'ag-grid/main';
  import { TdLoadingService } from '@covalent/core';
  
  import { StatementBase } from '../../../models/statement.base';
  
  import { CrossSectionService } from '../../../services/cross-section.service';
  import { CrossSection } from '../../../models/cross-section';
  import { EditorComponent } from '../../../helpers/editor.component';
  import { RendererComponent } from '../../../helpers/renderer.component';
  import { CrossSectionCreateService } from '../../../services/cross-section-create.service';
  import { RegionSelectList } from '../../../models/region-select-list';
  import { RoadSelectList } from '../../../models/road-select-list';
  import { StateCommonSelectList } from '../../../models/state-common-select-list';
  import { SurfaceTypeSelectList } from '../../../models/surface-type-select-list';
adf1208b   Administrator   add all filds in ...
16
17
  import { BooleanSelectListService } from '../../../services/boolean-select-list.service';
  import { BooleanSelectList } from '../../../models/boolean-select-list';
14db241c   Administrator   add cross section
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  import { routerTransition } from '../../../animations/router.animation';
  
  @Component({
      selector: 'cross-section',
      templateUrl: 'cross-section.component.html',
      styleUrls: ['cross-section.scss'],
      encapsulation: ViewEncapsulation.None,
  })
  export class CrossSectionComponent extends StatementBase {
  
      public regions: RegionSelectList[];
      public roads: RoadSelectList[];
      public surfaceTypes: SurfaceTypeSelectList[];
      public states: StateCommonSelectList[];
adf1208b   Administrator   add all filds in ...
32
      public boolean: BooleanSelectList[];
14db241c   Administrator   add cross section
33
34
      constructor(
          protected service: CrossSectionService,
adf1208b   Administrator   add all filds in ...
35
          protected booleanService: BooleanSelectListService,
14db241c   Administrator   add cross section
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
          protected dataService: CrossSectionCreateService,
          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: 'stateCommonId',
          editable: true,
          cellEditorFramework: EditorComponent,
          cellRendererFramework: RendererComponent,
          cellEditorParams: {
            data: this.states,
            valueCol: 'stateCommonId',
            labelCol: 'value',
          },
        },
adf1208b   Administrator   add all filds in ...
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
        {
          headerName: 'Наявність облаштування, труба',
          field: 'tubeAvailability',
          editable: true,
          cellEditorFramework: EditorComponent,
          cellRendererFramework: RendererComponent,
          cellEditorParams: {
            data: this.boolean,
            valueCol: 'value',
            labelCol: 'label',
          },
        },
              {
          headerName: 'Наявність облаштування, острівок безпеки',
          field: 'safetyAvailability',
          editable: true,
          cellEditorFramework: EditorComponent,
          cellRendererFramework: RendererComponent,
          cellEditorParams: {
            data: this.boolean,
            valueCol: 'value',
            labelCol: 'label',
          },
        },
        {
          headerName: 'Місцеположення, км+ зліва',
          field: 'locationLeft',
          editable: true,
        },
        {
          headerName: 'Місцеположення, км+ справа',
          field: 'locationRight',
          editable: true,
        },
        {
          headerName: 'Напрямок з\'їзду',
          field: 'direction',
          editable: true,
        },
        {
          headerName: 'Фактична довжина, м з\'їзду',
          field: 'lengthSection',
          editable: true,
        },
        {
          headerName: 'Фактична довжина, м покриття',
          field: 'lengthSurface',
          editable: true,
        },
        {
          headerName: 'Відстань від крайки проїзної частики, м',
          field: 'distanceEdge',
          editable: true,
        },
        {
          headerName: 'Ширина, м',
          field: 'width',
          editable: true,
        },
        {
          headerName: 'Кут примикання',
          field: 'angle',
          editable: true,
        },
              {
          headerName: 'Рік спорудження',
          field: 'yearBuild',
          editable: true,
        },
        {
          headerName: 'Рік ремонту',
          field: 'yearRepair',
          editable: true,
        },
14db241c   Administrator   add cross section
166
167
168
169
      ];
    }
  
    protected initFunction(): void {
adf1208b   Administrator   add all filds in ...
170
      this.booleanService.getModels().then((models: BooleanSelectList[]) => this.boolean = models);
14db241c   Administrator   add cross section
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
      this.dataService.getModels().then((models: any) => {
              this.regions = models.regionSelectListDsM as RegionSelectList[];
              this.roads = models.roadSelectListDsM as RoadSelectList[];
              this.surfaceTypes = models.surfaceTypeSelectListDsM as SurfaceTypeSelectList[];
              this.states = models.stateCommonSelectListDsM as StateCommonSelectList[];
        }).then(() => {
              this.bootstrapGrid();
        });
    }
  
    // tslint:disable-next-line:member-ordering
    public CreateModel(): Object {
      return new CrossSection();
    }
  }