Skip to content

Commit

Permalink
feat(#45) : redirection to summary on survey click if completed
Browse files Browse the repository at this point in the history
  • Loading branch information
philipperobertgh authored and iamkinetic committed May 23, 2018
1 parent cf3afa0 commit 87ec624
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

</ion-header>
<ion-content class="outer-content">
<ion-list>
<ion-list style="padding-bottom: 5px;">
<ion-item *ngFor="let category of inspectionQuestionSummaryCategory">
<ion-list-header *ngIf="category.title != ''">
{{category.title | uppercase}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class InspectionQuestionSummaryPage {
private messageTools: MessageToolsProvider,) {

this.idInspection = this.navParams.get('idInspection');
this.idInspection = '8e6d8188-9733-4f1c-9ade-dc57adcdd533';
this.loadInspectionQuestionSummary();
}

Expand Down
46 changes: 9 additions & 37 deletions src/pages/intervention-home/intervention-home.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {AlertController, IonicPage, MenuController, NavController, NavParams} from 'ionic-angular';
import {IonicPage, MenuController, NavController, NavParams} from 'ionic-angular';
import {InterventionGeneralPage} from '../intervention-general/intervention-general';
import {InterventionWaterSuppliesPage} from '../intervention-water-supplies/intervention-water-supplies';
import {InterventionBuildingsPage} from '../intervention-buildings/intervention-buildings';
Expand All @@ -26,8 +26,7 @@ export class InterventionHomePage {
constructor(public navCtrl: NavController,
public navParams: NavParams,
public menuCtrl: MenuController,
private controller: InspectionControllerProvider,
private alertCtrl: AlertController,) {
private controller: InspectionControllerProvider,) {
controller.setIdInterventionForm(this.navParams.data['id']);
}

Expand All @@ -48,46 +47,19 @@ export class InterventionHomePage {
}

goToInspectionQuestions() {
if (this.controller.inspectionDetail.isSurveyCompleted) {
this.SurveyNavigationPopup().present();
} else {
this.navCtrl.push('InspectionQuestionPage', {
if (this.controller.inspectionDetail.isSurveyCompleted)
{
this.navCtrl.push('InspectionQuestionSummaryPage', {idInspection: this.controller.idInspection});
}
else
{
this.navCtrl.push('InspectionQuestionPage', {
idInspection: this.controller.idInspection,
inspectionSurveyCompleted: this.controller.inspectionDetail.isSurveyCompleted
});
}
}

SurveyNavigationPopup() {
let alert = this.alertCtrl.create();
alert.setTitle('Questionnaire d\'inspection');
alert.setMessage('Le questionnaire est déjà complété, que voulez-vous faire : ');
alert.addButton({
text: 'Recommencer le questionnaire', handler: () => {
alert.dismiss(true);
this.navCtrl.push('InspectionQuestionPage', {
idInspection: this.controller.idInspection,
inspectionSurveyCompleted: this.controller.inspectionDetail.isSurveyCompleted
});
return false;
}
});
alert.addButton({
text: 'Voir le résumé du questionnaire', handler: () => {
alert.dismiss(true);
this.navCtrl.push('InspectionQuestionSummaryPage', {idInspection: this.controller.idInspection});
return false;
}
});
alert.addButton({
text: 'Retourner au détail de l\'inspection', handler: () => {
alert.dismiss(true);
return false;
}
});
return alert;
}

async goBackToInspectionList(){
await this.navCtrl.popToRoot();
await this.navCtrl.setRoot('InspectionListPage');
Expand Down

0 comments on commit 87ec624

Please sign in to comment.