|
|
|
@ -220,6 +220,22 @@ export class CuratorComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveCurator() {
|
|
|
|
|
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => {
|
|
|
|
|
if (curator) {
|
|
|
|
|
this.handleSuccessfulSave('Your data has been saved successfully!');
|
|
|
|
|
this.newCurator = false;
|
|
|
|
|
this.file = null;
|
|
|
|
|
this.deletePhoto = false;
|
|
|
|
|
this.resetChange();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error => {
|
|
|
|
|
this.handleUpdateError('An error has occurred. Try again later!', error);
|
|
|
|
|
this.resetChange();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateCurator() {
|
|
|
|
|
if (!Session.isLoggedIn()) {
|
|
|
|
@ -236,36 +252,19 @@ export class CuratorComponent implements OnInit {
|
|
|
|
|
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe();
|
|
|
|
|
}
|
|
|
|
|
this.curator.photo = res.filename;
|
|
|
|
|
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => {
|
|
|
|
|
if (curator) {
|
|
|
|
|
this.handleSuccessfulSave('Your data has been saved successfully!');
|
|
|
|
|
this.newCurator = false;
|
|
|
|
|
this.resetChange();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error => {
|
|
|
|
|
this.handleUpdateError('An error has occurred. Try again later!', error);
|
|
|
|
|
this.resetChange();
|
|
|
|
|
});
|
|
|
|
|
this.saveCurator();
|
|
|
|
|
}, error => {
|
|
|
|
|
this.handleUpdateError('An error has occurred during photo uploading.', error);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
if (this.deletePhoto) {
|
|
|
|
|
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe();
|
|
|
|
|
this.curator.photo = '';
|
|
|
|
|
if(this.curator.photo && this.curator.photo != '') {
|
|
|
|
|
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe();
|
|
|
|
|
this.curator.photo = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => {
|
|
|
|
|
if (curator) {
|
|
|
|
|
this.handleSuccessfulSave('Your data has been saved successfully!');
|
|
|
|
|
this.resetChange();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error => {
|
|
|
|
|
this.handleUpdateError('An error has occurred. Try again later!', error);
|
|
|
|
|
this.resetChange();
|
|
|
|
|
});
|
|
|
|
|
this.saveCurator();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -273,16 +272,13 @@ export class CuratorComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
onNameChange() {
|
|
|
|
|
this.hasChanged = true;
|
|
|
|
|
if (!this.curator.name || this.curator.name === '') {
|
|
|
|
|
this.enabled = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.enabled = true;
|
|
|
|
|
}
|
|
|
|
|
this.enabled = !(!this.curator.name || this.curator.name === '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removePhoto() {
|
|
|
|
|
this.deletePhoto = true;
|
|
|
|
|
this.hasChanged = true;
|
|
|
|
|
this.file = null;
|
|
|
|
|
this.photo = 'assets/common-assets/curator-default.png';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|