File ClientApp/package-lock.json changed (mode: 100644) (index f48a656..4dd482a) |
1186 |
1186 |
"integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==",
|
"integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==",
|
1187 |
1187 |
"dev": true
|
"dev": true
|
1188 |
1188 |
},
|
},
|
|
1189 |
|
"@types/underscore": {
|
|
1190 |
|
"version": "1.8.9",
|
|
1191 |
|
"resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.8.9.tgz",
|
|
1192 |
|
"integrity": "sha512-vfzZGgZKRFy7KEWcBGfIFk+h6B+thDCLfkD1exMBMRlUsx2icA+J6y4kAbZs/TjSTeY1duw89QUU133TSzr60Q=="
|
|
1193 |
|
},
|
1189 |
1194 |
"@types/webpack-sources": {
|
"@types/webpack-sources": {
|
1190 |
1195 |
"version": "0.1.5",
|
"version": "0.1.5",
|
1191 |
1196 |
"resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.5.tgz",
|
|
11742 |
11747 |
"integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==",
|
"integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==",
|
11743 |
11748 |
"dev": true
|
"dev": true
|
11744 |
11749 |
},
|
},
|
|
11750 |
|
"underscore": {
|
|
11751 |
|
"version": "1.9.1",
|
|
11752 |
|
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz",
|
|
11753 |
|
"integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg=="
|
|
11754 |
|
},
|
11745 |
11755 |
"union-value": {
|
"union-value": {
|
11746 |
11756 |
"version": "1.0.0",
|
"version": "1.0.0",
|
11747 |
11757 |
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
|
File ClientApp/package.json changed (mode: 100644) (index 5e2d001..4b13d71) |
24 |
24 |
"@angular/platform-server": "7.2.0", |
"@angular/platform-server": "7.2.0", |
25 |
25 |
"@angular/router": "7.2.0", |
"@angular/router": "7.2.0", |
26 |
26 |
"@nguniversal/module-map-ngfactory-loader": "^7.0.2", |
"@nguniversal/module-map-ngfactory-loader": "^7.0.2", |
|
27 |
|
"@types/underscore": "^1.8.9", |
27 |
28 |
"aspnet-prerendering": "^3.0.1", |
"aspnet-prerendering": "^3.0.1", |
28 |
29 |
"bootstrap": "^4.2.1", |
"bootstrap": "^4.2.1", |
29 |
30 |
"core-js": "^2.6.1", |
"core-js": "^2.6.1", |
|
31 |
32 |
"ngx-toasta": "^0.1.0", |
"ngx-toasta": "^0.1.0", |
32 |
33 |
"rxjs": "^6.3.3", |
"rxjs": "^6.3.3", |
33 |
34 |
"tslib": "^1.9.0", |
"tslib": "^1.9.0", |
|
35 |
|
"underscore": "^1.9.1", |
34 |
36 |
"zone.js": "^0.8.26" |
"zone.js": "^0.8.26" |
35 |
37 |
}, |
}, |
36 |
38 |
"devDependencies": { |
"devDependencies": { |
File ClientApp/src/app/vehicule-form/vehicule-form.component.ts changed (mode: 100644) (index 2800045..03d1140) |
... |
... |
import { VehicleService } from '../services/vehicle.service'; |
2 |
2 |
import { Component, OnInit } from '@angular/core'; |
import { Component, OnInit } from '@angular/core'; |
3 |
3 |
import { Router, ActivatedRoute } from '@angular/router'; |
import { Router, ActivatedRoute } from '@angular/router'; |
4 |
4 |
import { forkJoin } from 'rxjs'; |
import { forkJoin } from 'rxjs'; |
|
5 |
|
import { SaveVehicle, Vehicle } from '../models/vehicle'; |
|
6 |
|
import * as _ from 'underscore'; |
5 |
7 |
|
|
6 |
8 |
@Component({ |
@Component({ |
7 |
9 |
selector: 'app-vehicule-form', |
selector: 'app-vehicule-form', |
|
... |
... |
import { forkJoin } from 'rxjs'; |
10 |
12 |
}) |
}) |
11 |
13 |
export class VehiculeFormComponent implements OnInit { |
export class VehiculeFormComponent implements OnInit { |
12 |
14 |
makes: any[]; |
makes: any[]; |
13 |
|
vehicle: any = { |
|
|
15 |
|
vehicle: SaveVehicle = { |
|
16 |
|
id: 0, |
|
17 |
|
makeId: 0, |
|
18 |
|
modelId: 0, |
|
19 |
|
isRegister: false, |
14 |
20 |
features: [], |
features: [], |
15 |
|
contact:{} |
|
|
21 |
|
contact: { |
|
22 |
|
name: '', |
|
23 |
|
email: '', |
|
24 |
|
phone: '', |
|
25 |
|
} |
16 |
26 |
}; |
}; |
17 |
27 |
models: any[]; |
models: any[]; |
18 |
28 |
features: any[]; |
features: any[]; |
|
... |
... |
export class VehiculeFormComponent implements OnInit { |
41 |
51 |
this.makes = data[0]; |
this.makes = data[0]; |
42 |
52 |
this.features =data[1]; |
this.features =data[1]; |
43 |
53 |
if (this.vehicle.id) |
if (this.vehicle.id) |
44 |
|
this.vehicle = data[2]; |
|
|
54 |
|
this.setVehicle(data[2]); |
45 |
55 |
}, err => { |
}, err => { |
46 |
56 |
if (err.status == 404) |
if (err.status == 404) |
47 |
57 |
this.router.navigate(['/home']); |
this.router.navigate(['/home']); |
48 |
58 |
}); |
}); |
49 |
59 |
} |
} |
50 |
60 |
|
|
|
61 |
|
private setVehicle(v : Vehicle) { |
|
62 |
|
this.vehicle.id = v.id; |
|
63 |
|
this.vehicle.makeId = v.make.id; |
|
64 |
|
this.vehicle.modelId = v.model.id; |
|
65 |
|
this.vehicle.isRegister = v.isRegister; |
|
66 |
|
this.vehicle.contact = v.contact; |
|
67 |
|
this.vehicle.features = _.pluck(v.features, 'id'); |
|
68 |
|
} |
|
69 |
|
|
51 |
70 |
onMakeChange(){ |
onMakeChange(){ |
52 |
71 |
var selectedMake = this.makes.find(m => m.id == this.vehicle.makeId); |
var selectedMake = this.makes.find(m => m.id == this.vehicle.makeId); |
53 |
72 |
this.models = selectedMake? selectedMake.models : []; |
this.models = selectedMake? selectedMake.models : []; |