Revision 59484
Added by Konstantinos Triantafyllou over 3 years ago
modules/uoa-admin-portal/trunk/src/app/pages/curator/curator.component.ts | ||
---|---|---|
220 | 220 |
} |
221 | 221 |
} |
222 | 222 |
|
223 |
saveCurator() { |
|
224 |
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => { |
|
225 |
if (curator) { |
|
226 |
this.handleSuccessfulSave('Your data has been saved successfully!'); |
|
227 |
this.newCurator = false; |
|
228 |
this.file = null; |
|
229 |
this.deletePhoto = false; |
|
230 |
this.resetChange(); |
|
231 |
} |
|
232 |
}, |
|
233 |
error => { |
|
234 |
this.handleUpdateError('An error has occurred. Try again later!', error); |
|
235 |
this.resetChange(); |
|
236 |
}); |
|
237 |
} |
|
223 | 238 |
|
239 |
|
|
224 | 240 |
updateCurator() { |
225 | 241 |
if (!Session.isLoggedIn()) { |
226 | 242 |
this._router.navigate(['/user-info'], { |
... | ... | |
236 | 252 |
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe(); |
237 | 253 |
} |
238 | 254 |
this.curator.photo = res.filename; |
239 |
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => { |
|
240 |
if (curator) { |
|
241 |
this.handleSuccessfulSave('Your data has been saved successfully!'); |
|
242 |
this.newCurator = false; |
|
243 |
this.resetChange(); |
|
244 |
} |
|
245 |
}, |
|
246 |
error => { |
|
247 |
this.handleUpdateError('An error has occurred. Try again later!', error); |
|
248 |
this.resetChange(); |
|
249 |
}); |
|
255 |
this.saveCurator(); |
|
250 | 256 |
}, error => { |
251 | 257 |
this.handleUpdateError('An error has occurred during photo uploading.', error); |
252 | 258 |
} |
253 | 259 |
); |
254 | 260 |
} else { |
255 | 261 |
if (this.deletePhoto) { |
256 |
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe(); |
|
257 |
this.curator.photo = ''; |
|
262 |
if(this.curator.photo && this.curator.photo != '') { |
|
263 |
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe(); |
|
264 |
this.curator.photo = ''; |
|
265 |
} |
|
258 | 266 |
} |
259 |
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => { |
|
260 |
if (curator) { |
|
261 |
this.handleSuccessfulSave('Your data has been saved successfully!'); |
|
262 |
this.resetChange(); |
|
263 |
} |
|
264 |
}, |
|
265 |
error => { |
|
266 |
this.handleUpdateError('An error has occurred. Try again later!', error); |
|
267 |
this.resetChange(); |
|
268 |
}); |
|
267 |
this.saveCurator(); |
|
269 | 268 |
} |
270 | 269 |
} |
271 | 270 |
} |
... | ... | |
273 | 272 |
|
274 | 273 |
onNameChange() { |
275 | 274 |
this.hasChanged = true; |
276 |
if (!this.curator.name || this.curator.name === '') { |
|
277 |
this.enabled = false; |
|
278 |
} else { |
|
279 |
this.enabled = true; |
|
280 |
} |
|
275 |
this.enabled = !(!this.curator.name || this.curator.name === ''); |
|
281 | 276 |
} |
282 | 277 |
|
283 | 278 |
removePhoto() { |
284 | 279 |
this.deletePhoto = true; |
285 | 280 |
this.hasChanged = true; |
281 |
this.file = null; |
|
286 | 282 |
this.photo = 'assets/common-assets/curator-default.png'; |
287 | 283 |
} |
288 | 284 |
|
Also available in: Unified diff
[Admin | Trunk]: Fix upload/delete photo of curator bug