You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.0 KiB
TypeScript
69 lines
2.0 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { NavController } from '@ionic/angular';
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
@Component({
|
|
selector: 'app-survey',
|
|
templateUrl: './survey.component.html',
|
|
styleUrls: ['./survey.component.scss'],
|
|
})
|
|
export class SurveyComponent implements OnInit {
|
|
rate: any;
|
|
isSkip: boolean = false;
|
|
setTime: number = 5;
|
|
satisfied: any = '5';
|
|
note: any;
|
|
constructor(public ts: TranslatorService, public cs: CommonService, public nav: NavController, public authService: AuthenticationService) { }
|
|
|
|
ngOnInit() {
|
|
this.setTimer();
|
|
}
|
|
skip() {
|
|
this.nav.pop();
|
|
CommonService.SKIP = true;
|
|
}
|
|
setTimer() {
|
|
setTimeout(() => {
|
|
this.setTime--;
|
|
if (this.setTime == 0) {
|
|
this.isSkip = true;
|
|
} else {
|
|
this.setTimer();
|
|
}
|
|
}, 1000);
|
|
}
|
|
saveSurvey() {
|
|
|
|
var data = this.cs.sharedService.getSharedData(
|
|
AuthenticationService.SERVEY_DATA,
|
|
false
|
|
)
|
|
|
|
var request =
|
|
{
|
|
"ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
|
|
{ "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
|
|
{ "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
|
|
]
|
|
};
|
|
|
|
|
|
|
|
this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
|
|
if (this.cs.validResponse(result)){
|
|
this.cs.greenToastPK("erm-channel", "survey-success");
|
|
CommonService.SKIP = true;
|
|
this.cs.openHome();
|
|
}else{
|
|
this.cs.redToastPK("erm-channel", "erm-failed");
|
|
}
|
|
});
|
|
}
|
|
select(rating) {
|
|
this.satisfied = rating;
|
|
|
|
}
|
|
}
|