Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadCatalogs(client) {
- this.catalogServ.getAssetsApiVehicleBrandsForCatalog(client).subscribe(res => {
- this.brandList = JSON.parse(res['_body']);
- this.catalogServ.getApiModelsForCatalog(client).subscribe(res => {
- this.modelList = JSON.parse(res['_body']);
- this.catalogServ.getApiYearsForCatalog(client).subscribe(res => {
- this.yearList = JSON.parse(res['_body']);
- this.brandList.forEach(elementBrand => {
- this.modelList.forEach(elementModel => {
- this.yearList.forEach(elementYear => {
- if (elementYear.modelId == elementModel.modelId) {
- elementYear.model = elementModel;
- elementModel.tieneAño = true;
- }
- });
- if (elementModel.brandId == elementBrand.brandId) {
- elementModel.brand = elementBrand;
- elementBrand.tieneModelo = true;
- }
- });
- });
- this.yearList.forEach(element => {
- this.finalList.push(element);
- });
- this.brandList.forEach(element => {
- if (!element.tieneModelo) {
- this.finalList.push({ year: "-", model: { name: "-", brand: { name: element.name, brandId: element.brandId } } });
- }
- });
- console.log(this.finalList);
- this.makeList();
- this.clearList(this.finalList);
- });
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement