Commit 74a2441cad6e76dd21d3141882a99342fb083e49
1 parent
f4c3aace
Add ServiceObject
Showing
15 changed files
with
405 additions
and
52 deletions
Show diff stats
src/app/data/bus-stop/bus-stop.component.html
| 1 | -<md-card tdMediaToggle="gt-xs" [mediaClasses]="['push']"> | |
| 2 | - <div *ngIf="showGrid"> | |
| 3 | - <div class="control_button"> | |
| 4 | - <button md-fab color="accent" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | |
| 5 | - <button md-fab color="warn" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | |
| 6 | - </div> | |
| 7 | - <div *ngIf="isLoading" class=""> | |
| 8 | - ...Loading | |
| 9 | - </div> | |
| 10 | - <ag-grid-ng2 #agGrid style="width: 100%; height: 350px;" class="ag-dark" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 11 | - toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" | |
| 12 | - (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" | |
| 13 | - (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged()" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | |
| 14 | - </ag-grid-ng2> | |
| 1 | +<div class="grid_containert" *ngIf="showGrid"> | |
| 2 | + <div *ngIf="isLoading" class=""> | |
| 3 | + ...Loading | |
| 15 | 4 | </div> |
| 16 | -</md-card> | |
| 17 | 5 | \ No newline at end of file |
| 6 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-dark" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 7 | + toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" | |
| 8 | + (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" | |
| 9 | + (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged()" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | |
| 10 | + </ag-grid-ng2> | |
| 11 | + <div class="control_button"> | |
| 12 | + <button md-fab color="accent" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | |
| 13 | + <button md-fab color="warn" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | |
| 14 | + </div> | |
| 15 | +</div> | |
| 18 | 16 | \ No newline at end of file | ... | ... |
src/app/data/bus-stop/bus-stop.component.ts
| ... | ... | @@ -18,7 +18,7 @@ import { SurfaceTypeSelectList } from '../../../models/surface-type-select-list' |
| 18 | 18 | // only import this if you are using the ag-Grid-Enterprise |
| 19 | 19 | |
| 20 | 20 | @Component({ |
| 21 | - selector: 'rich-grid', | |
| 21 | + selector: 'bus-grid', | |
| 22 | 22 | templateUrl: 'bus-stop.component.html', |
| 23 | 23 | styleUrls: ['bus-stop.scss'], |
| 24 | 24 | encapsulation: ViewEncapsulation.None | ... | ... |
src/app/data/bus-stop/bus-stop.scss
src/app/data/service-object/service-object.component.html
0 โ 100644
| 1 | +<div class="grid_containert" *ngIf="showGrid"> | |
| 2 | + <div *ngIf="isLoading" class=""> | |
| 3 | + ...Loading | |
| 4 | + </div> | |
| 5 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-dark" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 6 | + toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" | |
| 7 | + (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" | |
| 8 | + (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged()" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | |
| 9 | + </ag-grid-ng2> | |
| 10 | + <div class="control_button"> | |
| 11 | + <button md-fab color="accent" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | |
| 12 | + <button md-fab color="warn" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | |
| 13 | + </div> | |
| 14 | +</div> | |
| 0 | 15 | \ No newline at end of file | ... | ... |
src/app/data/service-object/service-object.component.ts
0 โ 100644
| 1 | +import {Component, ViewEncapsulation} from "@angular/core"; | |
| 2 | +import {GridOptions} from "ag-grid/main"; | |
| 3 | + | |
| 4 | +import { ServiceObjectService } from '../../../services/service-object.service'; | |
| 5 | +import { ServiceObject } from '../../../models/service-object'; | |
| 6 | +import { EditorComponent } from '../../../helpers/editor.component'; | |
| 7 | +import { RendererComponent } from '../../../helpers/renderer.component'; | |
| 8 | +import { ServiceObjectCreateService } from '../../../services/service-object-create.service'; | |
| 9 | +import { BooleanSelectListService } from '../../../services/boolean-select-list.service'; | |
| 10 | +import { RegionSelectList } from '../../../models/region-select-list'; | |
| 11 | +import { StateCommonSelectList } from '../../../models/state-common-select-list'; | |
| 12 | +import { RoadSelectList } from '../../../models/road-select-list'; | |
| 13 | +import { BooleanSelectList } from '../../../models/boolean-select-list'; | |
| 14 | +import { SettlementSelectList } from '../../../models/settlement-select-list'; | |
| 15 | +import { SurfaceTypeSelectList } from '../../../models/surface-type-select-list'; | |
| 16 | + | |
| 17 | + | |
| 18 | +// only import this if you are using the ag-Grid-Enterprise | |
| 19 | + | |
| 20 | +@Component({ | |
| 21 | + selector: 'service-object', | |
| 22 | + templateUrl: 'service-object.component.html', | |
| 23 | + styleUrls: ['service-object.scss'], | |
| 24 | + encapsulation: ViewEncapsulation.None | |
| 25 | +}) | |
| 26 | +export class BusStopComponent { | |
| 27 | + | |
| 28 | + public showGrid: boolean; | |
| 29 | + public rowData: any[]; | |
| 30 | + public rowCount: string; | |
| 31 | + public regions: RegionSelectList[]; | |
| 32 | + public states: StateCommonSelectList[]; | |
| 33 | + public surfaceTypes: SurfaceTypeSelectList[]; | |
| 34 | + public settlements: SettlementSelectList[]; | |
| 35 | + public roads: RoadSelectList[]; | |
| 36 | + public boolean: BooleanSelectList[]; | |
| 37 | + public isLoading: boolean = false; | |
| 38 | + public isBootstrapping: boolean = true; | |
| 39 | + public isSelected: boolean = true; | |
| 40 | + private columnDefs: any[]; | |
| 41 | + private gridOptions: GridOptions; | |
| 42 | + | |
| 43 | + constructor( | |
| 44 | + protected service: ServiceObjectService, | |
| 45 | + private dataService: ServiceObjectCreateService, | |
| 46 | + private booleanService: BooleanSelectListService | |
| 47 | + ) { | |
| 48 | + this.gridOptions = <GridOptions>{}; | |
| 49 | + this.gridOptions.enableSorting = true; | |
| 50 | + this.showGrid = true; | |
| 51 | + this.gridOptions.rowModelType = 'virtual'; | |
| 52 | + this.booleanService.getModels().then((models) => this.boolean = models); | |
| 53 | + this.dataService.getModels().then(models => { | |
| 54 | + this.regions = models.regionSelectListDsM as RegionSelectList[]; | |
| 55 | + this.states = models.stateCommonSelectListDsM as StateCommonSelectList[]; | |
| 56 | + this.surfaceTypes = models.surfaceTypeSelectListDsM as SurfaceTypeSelectList[]; | |
| 57 | + this.settlements = models.settlementSelectListDsM as SettlementSelectList[]; | |
| 58 | + this.roads = models.roadSelectListDsM as RoadSelectList[]; | |
| 59 | + }).then(() => { | |
| 60 | + this.createColumnDefs(); | |
| 61 | + this.isBootstrapping = false; | |
| 62 | + }); | |
| 63 | + this.service.getData().then((data) => { | |
| 64 | + if (data.length){ | |
| 65 | + this.rowData = data; | |
| 66 | + } else { | |
| 67 | + this.rowData = [new ServiceObject]; | |
| 68 | + } | |
| 69 | + }).then(() => { | |
| 70 | + this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); | |
| 71 | + this.gridOptions.api.refreshVirtualPageCache(); | |
| 72 | + }); | |
| 73 | + } | |
| 74 | + setRowData(allOfTheData) { | |
| 75 | + let dataSource = { | |
| 76 | + rowCount: null, // behave as infinite scroll | |
| 77 | + getRows: function (params) { | |
| 78 | + console.log('asking for ' + params.startRow + ' to ' + params.endRow); | |
| 79 | + // At this point in your code, you would call the server, using $http if in AngularJS. | |
| 80 | + // To make the demo look real, wait for 500ms before returning | |
| 81 | + // take a slice of the total rows | |
| 82 | + let rowsThisPage = allOfTheData.slice(params.startRow, params.endRow); | |
| 83 | + // if on or after the last page, work out the last row. | |
| 84 | + let lastRow = -1; | |
| 85 | + if (allOfTheData.length <= params.endRow) { | |
| 86 | + lastRow = allOfTheData.length; | |
| 87 | + } | |
| 88 | + // call the success callback | |
| 89 | + params.successCallback(rowsThisPage, lastRow); | |
| 90 | + } | |
| 91 | + }; | |
| 92 | + return dataSource; | |
| 93 | + | |
| 94 | + } | |
| 95 | + onDeleteConfirm(event): void { | |
| 96 | + if (window.confirm('ะั ัะฒะตัะตะฝั ััะพ ั ะพัะธัะต ัะดะฐะปะธัั??')) { | |
| 97 | + event.confirm.resolve(); | |
| 98 | + } else { | |
| 99 | + event.confirm.reject(); | |
| 100 | + } | |
| 101 | + } | |
| 102 | + public addNewRow() { | |
| 103 | + this.rowData.unshift(new ServiceObject()); | |
| 104 | + this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); | |
| 105 | + this.gridOptions.api.refreshVirtualPageCache(); | |
| 106 | + } | |
| 107 | + | |
| 108 | + private createColumnDefs() { | |
| 109 | + this.columnDefs = [ | |
| 110 | + { | |
| 111 | + headerName: '#', | |
| 112 | + width: 30, | |
| 113 | + checkboxSelection: true, | |
| 114 | + suppressSorting: true, | |
| 115 | + suppressMenu: true, | |
| 116 | + pinned: true | |
| 117 | + }, | |
| 118 | + { | |
| 119 | + headerName: 'ID', | |
| 120 | + field: 'busStopId', | |
| 121 | + }, | |
| 122 | + { | |
| 123 | + headerName: 'ะะฐะทะฒะฐ ะดะพัะพะณะธ', | |
| 124 | + field: 'roadId', | |
| 125 | + editable: true, | |
| 126 | + cellEditorFramework: EditorComponent, | |
| 127 | + cellRendererFramework: RendererComponent, | |
| 128 | + cellEditorParams: { | |
| 129 | + data: this.roads, | |
| 130 | + valueCol: 'roadId', | |
| 131 | + labelCol: 'name' | |
| 132 | + } | |
| 133 | + }, | |
| 134 | + { | |
| 135 | + headerName: 'ะะฑะปะฐััั', | |
| 136 | + field: 'regionId', | |
| 137 | + editable: true, | |
| 138 | + cellEditorFramework: EditorComponent, | |
| 139 | + cellRendererFramework: RendererComponent, | |
| 140 | + cellEditorParams: { | |
| 141 | + data: this.regions, | |
| 142 | + valueCol: 'regionId', | |
| 143 | + labelCol: 'name' | |
| 144 | + } | |
| 145 | + }, | |
| 146 | + { | |
| 147 | + headerName: 'ะัััะตะทะฝะฐั ะพะดะถะตะฝะฝั, ะบะผ+ ัะฟัะฐะฒะฐ', | |
| 148 | + field: 'locationRight', | |
| 149 | + editable: true, | |
| 150 | + }, | |
| 151 | + { | |
| 152 | + headerName: 'ะัััะตะทะฝะฐั ะพะดะถะตะฝะฝั, ะบะผ+ ะทะปัะฒะฐ', | |
| 153 | + field: 'locationLeft', | |
| 154 | + editable: true, | |
| 155 | + }, | |
| 156 | + { | |
| 157 | + headerName: 'ะขะตั ะฝััะฝะธะน ััะฐะฝ', | |
| 158 | + field: 'stateCommonId', | |
| 159 | + editable: true, | |
| 160 | + cellEditorFramework: EditorComponent, | |
| 161 | + cellRendererFramework: RendererComponent, | |
| 162 | + cellEditorParams: { | |
| 163 | + data: this.states, | |
| 164 | + valueCol: 'stateCommonId', | |
| 165 | + labelCol: 'value' | |
| 166 | + } | |
| 167 | + }, | |
| 168 | + { | |
| 169 | + headerName: 'ะะฐัะฒะฝัััั ััะฐะปะตัั', | |
| 170 | + field: 'toiletAvailability', | |
| 171 | + editable: true, | |
| 172 | + cellEditorFramework: EditorComponent, | |
| 173 | + cellRendererFramework: RendererComponent, | |
| 174 | + cellEditorParams: { | |
| 175 | + data: this.boolean, | |
| 176 | + valueCol: 'value', | |
| 177 | + labelCol: 'label' | |
| 178 | + } | |
| 179 | + } | |
| 180 | + ]; | |
| 181 | + } | |
| 182 | + | |
| 183 | + private onCellClicked($event) { | |
| 184 | + console.log('onCellClicked: ' + $event.rowIndex + ' ' + $event.colDef.field); | |
| 185 | + } | |
| 186 | + | |
| 187 | + private onCellValueChanged($event) { | |
| 188 | + if ($event.oldValue !== $event.newValue) { | |
| 189 | + let data = JSON.stringify($event.data); | |
| 190 | + let id = $event.data.busStopId; | |
| 191 | + let result = null; | |
| 192 | + if (id) { | |
| 193 | + this.isLoading = true; | |
| 194 | + result = this.service.update(id, data).then(() => this.isLoading = false); | |
| 195 | + } else { | |
| 196 | + // Protection of posting new row being already sent. | |
| 197 | + if (this.isLoading) { | |
| 198 | + return ; | |
| 199 | + } | |
| 200 | + this.isLoading = true; | |
| 201 | + result = this.service.create(data).then((busStop) => { | |
| 202 | + this.rowData[$event.node.rowIndex] = busStop; | |
| 203 | + this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); | |
| 204 | + this.gridOptions.api.refreshVirtualPageCache(); | |
| 205 | + this.isLoading = false; | |
| 206 | + }); | |
| 207 | + } | |
| 208 | + } | |
| 209 | + } | |
| 210 | + | |
| 211 | + private deleteRows() { | |
| 212 | + let rows = this.gridOptions.api.getSelectedNodes(); | |
| 213 | + if (!rows.length) { | |
| 214 | + return ; | |
| 215 | + } | |
| 216 | + rows.forEach(element => { | |
| 217 | + let id = element.data.busStopId; | |
| 218 | + if (id) { | |
| 219 | + this.isLoading = true; | |
| 220 | + this.service.delete(id).then(() => this.isLoading = false); | |
| 221 | + } | |
| 222 | + }); | |
| 223 | + // Sort in order to protect array from reindexing (remove rear elements first) | |
| 224 | + let sorted = rows.sort((a, b) => { | |
| 225 | + if (a > b) { | |
| 226 | + return -1; | |
| 227 | + } else { | |
| 228 | + return 1; | |
| 229 | + } | |
| 230 | + }); | |
| 231 | + sorted.forEach(item => { | |
| 232 | + this.rowData.splice(item.rowIndex, 1); | |
| 233 | + }); | |
| 234 | + this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); | |
| 235 | + this.gridOptions.api.refreshVirtualPageCache(); | |
| 236 | + } | |
| 237 | + | |
| 238 | + private onCellDoubleClicked($event) { | |
| 239 | + console.log('onCellDoubleClicked: ' + $event.rowIndex + ' ' + $event.colDef.field); | |
| 240 | + } | |
| 241 | + | |
| 242 | + private onCellContextMenu($event) { | |
| 243 | + console.log('onCellContextMenu: ' + $event.rowIndex + ' ' + $event.colDef.field); | |
| 244 | + } | |
| 245 | + | |
| 246 | + private onCellFocused($event) { | |
| 247 | + console.log('onCellFocused: (' + $event.rowIndex + ',' + $event.colIndex + ')'); | |
| 248 | + } | |
| 249 | + | |
| 250 | + private onRowSelected($event) { | |
| 251 | + // taking out, as when we 'select all', it prints to much to the console!! | |
| 252 | + // console.log('onRowSelected: ' + $event.node.data.name); | |
| 253 | + } | |
| 254 | + | |
| 255 | + private onSelectionChanged() { | |
| 256 | + console.log('selectionChanged'); | |
| 257 | + } | |
| 258 | + | |
| 259 | + private onBeforeFilterChanged() { | |
| 260 | + console.log('beforeFilterChanged'); | |
| 261 | + } | |
| 262 | + | |
| 263 | + private onAfterFilterChanged() { | |
| 264 | + console.log('afterFilterChanged'); | |
| 265 | + } | |
| 266 | + | |
| 267 | + private onFilterModified() { | |
| 268 | + console.log('onFilterModified'); | |
| 269 | + } | |
| 270 | + | |
| 271 | + private onBeforeSortChanged() { | |
| 272 | + console.log('onBeforeSortChanged'); | |
| 273 | + } | |
| 274 | + | |
| 275 | + private onAfterSortChanged() { | |
| 276 | + console.log('onAfterSortChanged'); | |
| 277 | + } | |
| 278 | + | |
| 279 | + private onVirtualRowRemoved($event) { | |
| 280 | + // because this event gets fired LOTS of times, we don't print it to the | |
| 281 | + // console. if you want to see it, just uncomment out this line | |
| 282 | + // console.log('onVirtualRowRemoved: ' + $event.rowIndex); | |
| 283 | + } | |
| 284 | + | |
| 285 | + private onRowClicked($event) { | |
| 286 | + console.log('onRowClicked: ' + $event.node.data.name); | |
| 287 | + } | |
| 288 | + | |
| 289 | + public onQuickFilterChanged($event) { | |
| 290 | + this.gridOptions.api.setQuickFilter($event.target.value); | |
| 291 | + } | |
| 292 | + | |
| 293 | + // here we use one generic event to handle all the column type events. | |
| 294 | + // the method just prints the event name | |
| 295 | + private onColumnEvent($event) { | |
| 296 | + console.log('onColumnEvent: ' + $event); | |
| 297 | + } | |
| 298 | +} | ... | ... |
| 1 | +export class ServiceObject{ | |
| 2 | + serviceObjectID: number; | |
| 3 | + roadId: number; | |
| 4 | + regionId: number; | |
| 5 | + serviceObjectTypeId: number; | |
| 6 | + settlementId: number; | |
| 7 | + departmentAffiliationId: number; | |
| 8 | + locationLeft: string; | |
| 9 | + locationRight: string; | |
| 10 | + locationAxis: number; | |
| 11 | + distance: number; | |
| 12 | + capacity: number; | |
| 13 | + arrangementElements: string; | |
| 14 | +} | ... | ... |
src/services/road-select-list.service.ts deleted
src/services/region-select-list.service.ts renamed to src/services/service-object-create.service.ts
| ... | ... | @@ -3,17 +3,15 @@ import { Headers, Http } from '@angular/http'; |
| 3 | 3 | |
| 4 | 4 | import 'rxjs/add/operator/toPromise'; |
| 5 | 5 | |
| 6 | -import { RegionSelectList } from '../models/region-select-list'; | |
| 7 | - | |
| 8 | 6 | @Injectable() |
| 9 | -export class RegionSelectListService { | |
| 10 | - private apiUrl = 'http://localhost:5000/directory/regionds'; | |
| 7 | +export class ServiceObjectCreateService { | |
| 8 | + private apiUrl = 'http://localhost:5000/serviceobject/directory'; | |
| 11 | 9 | private headers = new Headers({'Content-Type': 'applicaton/json'}); |
| 12 | 10 | constructor(private http: Http) { } |
| 13 | - getModels(): Promise<RegionSelectList[]> { | |
| 11 | + getModels(): Promise<any> { | |
| 14 | 12 | return this.http.get(this.apiUrl) |
| 15 | 13 | .toPromise() |
| 16 | - .then(response => response.json().regionSelectListDsM as RegionSelectList[]) | |
| 14 | + .then(response => response.json()) | |
| 17 | 15 | .catch(this.handleError); |
| 18 | 16 | } |
| 19 | 17 | private handleError(error: any): Promise<any> { | ... | ... |
| 1 | +import { Injectable } from '@angular/core'; | |
| 2 | +import { Headers, Http } from '@angular/http'; | |
| 3 | + | |
| 4 | +import 'rxjs/add/operator/toPromise'; | |
| 5 | + | |
| 6 | +import { ServiceObject } from '../models/service-object'; | |
| 7 | + | |
| 8 | +@Injectable() | |
| 9 | +export class ServiceObjectService { | |
| 10 | + private url = 'http://localhost:5000/serviceobject'; | |
| 11 | + private headers = new Headers({'Content-Type': 'application/json'}); | |
| 12 | + constructor(private http: Http) { } | |
| 13 | + getData(): Promise<ServiceObject[]> { | |
| 14 | + return this.http.get(this.url) | |
| 15 | + .toPromise() | |
| 16 | + .then(response => response.json().busStopEditDsM as ServiceObject[]) | |
| 17 | + .catch(this.handleError); | |
| 18 | + } | |
| 19 | + update(id: number, data: string): Promise<any> { | |
| 20 | + return this.http.post(this.url + '/update?id=' + id, data, { headers: this.headers }) | |
| 21 | + .toPromise() | |
| 22 | + .then(response => response.json()) | |
| 23 | + .catch(this.handleError); | |
| 24 | + } | |
| 25 | + create(data: string): Promise<ServiceObject> { | |
| 26 | + return this.http.post(this.url + '/create', data, { headers: this.headers }) | |
| 27 | + .toPromise() | |
| 28 | + .then(response => response.json() as ServiceObject) | |
| 29 | + .catch(this.handleError); | |
| 30 | + } | |
| 31 | + delete(id: number): Promise<any> { | |
| 32 | + return this.http.delete(this.url + '/delete?id=' + id, { headers: this.headers }) | |
| 33 | + .toPromise() | |
| 34 | + .then(response => response.json()) | |
| 35 | + .catch(this.handleError); | |
| 36 | + } | |
| 37 | + private handleError(error: any): Promise<any> { | |
| 38 | + console.error('An error occured', error); | |
| 39 | + return Promise.reject(error.message || error); | |
| 40 | + } | |
| 41 | +} | ... | ... |
src/services/settlement-select-list.service.ts deleted
src/services/state-common-selectlist.service.ts deleted
| 1 | -import { Injectable } from '@angular/core'; | |
| 2 | -import { Headers, Http } from '@angular/http'; | |
| 3 | - | |
| 4 | -import 'rxjs/add/operator/toPromise'; | |
| 5 | - | |
| 6 | -import { StateCommonSelectList } from '../models/state-common-select-list'; | |
| 7 | - | |
| 8 | -@Injectable() | |
| 9 | -export class StateCommonSelectListService { | |
| 10 | - private apiUrl = 'http://localhost:5000/directory/statecommonds'; | |
| 11 | - private headers = new Headers({'Content-Type': 'applicaton/json'}); | |
| 12 | - constructor(private http: Http) { } | |
| 13 | - getModels(): Promise<StateCommonSelectList[]> { | |
| 14 | - return this.http.get(this.apiUrl) | |
| 15 | - .toPromise() | |
| 16 | - .then(response => response.json().stateCommonSelectListDsM as StateCommonSelectList[]) | |
| 17 | - .catch(this.handleError); | |
| 18 | - } | |
| 19 | - private handleError(error: any): Promise<any> { | |
| 20 | - console.error('An error occured', error); | |
| 21 | - return Promise.reject(error.message || error); | |
| 22 | - } | |
| 23 | -} |
src/services/surface-type-select-list.service.ts deleted
src/styles.scss
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | .will-load { |
| 3 | 3 | min-height: 80px; |
| 4 | 4 | } |
| 5 | + | |
| 5 | 6 | // Href line height wasn't right for md-icon-button |
| 6 | 7 | a[md-icon-button] { |
| 7 | 8 | line-height: 36px; |
| ... | ... | @@ -9,5 +10,15 @@ a[md-icon-button] { |
| 9 | 10 | |
| 10 | 11 | // Capitalize |
| 11 | 12 | .text-capital { |
| 12 | - text-transform: capitalize; | |
| 13 | + text-transform: capitalize; | |
| 14 | +} | |
| 15 | + | |
| 16 | +.grid_containert { | |
| 17 | + height: 100%; | |
| 18 | +} | |
| 19 | + | |
| 20 | +.control_button { | |
| 21 | + position: fixed; | |
| 22 | + bottom: 40px; | |
| 23 | + right: 40px; | |
| 13 | 24 | } |
| 14 | 25 | \ No newline at end of file | ... | ... |