Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trib -128: Review approve attributes #62

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ReviewAttributesApiService {

resolve(_data);
}, (err) => {
reject(err);
resolve(err.error);
albkappil marked this conversation as resolved.
Show resolved Hide resolved
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ export class ReviewAttributesModelService {
getNewPhrase() {
return new Promise((resolve, reject) => {
albkappil marked this conversation as resolved.
Show resolved Hide resolved
this.ReviewAttributesApiService.getPhrase().then((response) => {
if(response == null)
resolve(response);
else{
this.model = response;
resolve(this.model);
resolve(this.model);
}
})
})

Expand All @@ -34,9 +38,9 @@ export class ReviewAttributesModelService {
this.saveReview['reviewerId'] = this._authService.getUser().id;
this.saveReview['reasonId'] = reasonId;
return new Promise((resolve, reject) => {
albkappil marked this conversation as resolved.
Show resolved Hide resolved
this.ReviewAttributesApiService.saveRA(this.saveReview).then((data) =>{
this.ReviewAttributesApiService.saveRA(this.saveReview).then(() =>{
console.log("saved Review Attributes");
resolve(data);
resolve(this.saveReview);
});
})
}
Expand Down
51 changes: 32 additions & 19 deletions src/app/pages/review-attributes/review-attributes.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ export class ReviewAttributesPage implements OnInit {
onApprovePhraseBtnClick() {
const self = this;
const reasonIDApprove = 1;
self._reviewAttributesModelService.saveReviewAttributes(reasonIDApprove).then((data) =>{
console.log(data);
self._reviewAttributesModelService.saveReviewAttributes(reasonIDApprove).then(() =>{
this._alertService.show({
header: 'Message approved!',
buttons: [{
text: 'OK', role: 'cancel',
handler: () => {
}
}]
})

this.phraseToBeReviewed = "";
this.getNextPhraseButtonDisabled = false;
this.approveAndRejectButtonDisplayed = false;
});
self._alertService.show({
header: 'Message approved!',
buttons: [{
text: 'OK', role: 'cancel',
handler: () => {
}
}]
})

this.phraseToBeReviewed = "";
this.getNextPhraseButtonDisabled = false;
this.approveAndRejectButtonDisplayed = false;

}

onGetNextPhraseBtnClick() {
Expand All @@ -81,11 +81,24 @@ export class ReviewAttributesPage implements OnInit {

getNextPhraseToBeReviewed() {
this._reviewAttributesModelService.getNewPhrase().then((phrase) => {
const phraseTBRAsString = this.getAttrString(phrase);
console.log(phraseTBRAsString);
this.phraseToBeReviewed = phraseTBRAsString;
this.getNextPhraseButtonDisabled = true;
this.approveAndRejectButtonDisplayed = true;
if(phrase == null){
this._alertService.show({
header: 'No More Phrases',
buttons: [{
text: 'OK', role: 'cancel',
handler: () => {
}
}]
})
this.getNextPhraseButtonDisabled = false;
}
else{
const phraseTBRAsString = this.getAttrString(phrase);
console.log(phraseTBRAsString);
this.phraseToBeReviewed = phraseTBRAsString;
this.getNextPhraseButtonDisabled = true;
this.approveAndRejectButtonDisplayed = true;
}
});
}

Expand Down