From 87ec6241ac96490e097a9adb0dd0abcfc14e09e5 Mon Sep 17 00:00:00 2001 From: Philippe Robert Date: Tue, 22 May 2018 15:06:19 -0400 Subject: [PATCH] feat(#45) : redirection to summary on survey click if completed --- .../inspection-question-summary.html | 2 +- .../inspection-question-summary.ts | 1 - .../intervention-home/intervention-home.ts | 46 ++++--------------- 3 files changed, 10 insertions(+), 39 deletions(-) diff --git a/src/pages/inspection-question-summary/inspection-question-summary.html b/src/pages/inspection-question-summary/inspection-question-summary.html index 75ab9f84..a8117f45 100644 --- a/src/pages/inspection-question-summary/inspection-question-summary.html +++ b/src/pages/inspection-question-summary/inspection-question-summary.html @@ -6,7 +6,7 @@ - + {{category.title | uppercase}} diff --git a/src/pages/inspection-question-summary/inspection-question-summary.ts b/src/pages/inspection-question-summary/inspection-question-summary.ts index 4267329b..6fe7479f 100644 --- a/src/pages/inspection-question-summary/inspection-question-summary.ts +++ b/src/pages/inspection-question-summary/inspection-question-summary.ts @@ -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(); } diff --git a/src/pages/intervention-home/intervention-home.ts b/src/pages/intervention-home/intervention-home.ts index 1eb46314..142b1dd4 100644 --- a/src/pages/intervention-home/intervention-home.ts +++ b/src/pages/intervention-home/intervention-home.ts @@ -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'; @@ -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']); } @@ -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');