- Timestamp:
- 01/24/22 21:08:32 (3 years ago)
- Branches:
- master
- Children:
- 76712b2
- Parents:
- bdd6491
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/location/location.component.ts
rbdd6491 rb738035 93 93 94 94 this.ref.onClose.subscribe((planner: Planner) => { 95 if (planner){96 this.plannerLocationDto.locationId = location.id;97 this.plannerLocationDto.plannerId = planner.id;98 console.log("LOC ID: " + this.plannerLocationDto.locationId);99 console.log("PLANNER ID: " + this.plannerLocationDto.plannerId);95 if (planner) { 96 this.plannerLocationDto.locationId = location.id; 97 this.plannerLocationDto.plannerId = planner.id; 98 console.log("LOC ID: " + this.plannerLocationDto.locationId); 99 console.log("PLANNER ID: " + this.plannerLocationDto.plannerId); 100 100 101 this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe( 102 lid => { 103 if (lid.length == 0) { 104 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 105 data => { 106 console.log(data); 107 } 108 ); 109 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 110 111 } else if (lid.length > 0) { 112 if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) { 113 console.log("LOKACIJATA VEKE JA IMA VO PLANEROT"); 114 this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' }); 115 } else { 101 this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe( 102 lid => { 103 if (lid.length == 0) { 116 104 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 117 105 data => { … … 120 108 ); 121 109 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 110 111 } else if (lid.length > 0) { 112 if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) { 113 console.log("LOKACIJATA VEKE JA IMA VO PLANEROT"); 114 this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' }); 115 } else { 116 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 117 data => { 118 console.log(data); 119 } 120 ); 121 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 122 } 123 122 124 } 123 124 125 } 125 } 126 ); 126 ); 127 127 } 128 128 }); 129 129 130 130 } 131 131
Note:
See TracChangeset
for help on using the changeset viewer.