From f6cd74fb8766205349839991336a7cda14a8c59d Mon Sep 17 00:00:00 2001 From: Jalen Sowell Date: Tue, 17 Oct 2023 15:13:57 -0500 Subject: [PATCH] FMRPA-164 | Making notes consistent across booking process --- app/scripts/controllers/plan.js | 14 ++++++++++++-- app/views/plan-summary.html.haml | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/scripts/controllers/plan.js b/app/scripts/controllers/plan.js index 68cb262..591ca75 100644 --- a/app/scripts/controllers/plan.js +++ b/app/scripts/controllers/plan.js @@ -118,6 +118,10 @@ app.controller('PlanController', ['$scope', '$http','$routeParams', '$location', $location.path("/plan/where"); }; + $scope.$watch('howLong', function(newVal) { + $scope.isRoundTrip = newVal && newVal.minutes > 0; + }); + $scope.goPlanWhere = function(){ planService.backToConfirm = true; $location.path('/plan/where'); @@ -510,7 +514,7 @@ app.controller('PlanController', ['$scope', '$http','$routeParams', '$location', // When if ($scope.fromMoment) params.date = $scope.fromMoment.format('dddd-MM-D'); if ($scope.fromTimeUpdated) params.start_time = $scope.fromMoment.format('h:mm:ss'); - + switch($scope.step) { case 'where': // delete params.purpose; @@ -671,6 +675,8 @@ app.controller('PlanController', ['$scope', '$http','$routeParams', '$location', res.success((result) => { $scope.stopSpin(); $location.path('/plan/my_rides'); + planService.driverInstructions = ''; + planService.driverInstructionsReturn = ''; }).error((err) => { $scope.stopSpin(); console.log(err); @@ -702,6 +708,8 @@ app.controller('PlanController', ['$scope', '$http','$routeParams', '$location', break; case 'summary': step = 'instructions_for_driver'; + $scope.driverInstructions = planService.driverInstructions; + $scope.driverInstructionsReturn = planService.driverInstructionsReturn; break; } } @@ -726,6 +734,8 @@ app.controller('PlanController', ['$scope', '$http','$routeParams', '$location', case 'assistant': case 'instructions_for_driver': case 'summary': + $scope.driverInstructions = planService.driverInstructions; + $scope.driverInstructionsReturn = planService.driverInstructionsReturn; break; } @@ -2110,7 +2120,7 @@ app.controller('PlanController', ['$scope', '$http','$routeParams', '$location', case 'instructions_for_driver': $scope.driverInstructions = planService.driverInstructions; - planService.driverInstructionsReturn = ''; + $scope.driverInstructions = planService.driverInstructionsReturn; $scope.$watch('howLong', function(newVal) { // Show return leg note text box if selected howLong value is more than 0 $scope.isRoundTrip = newVal && newVal.minutes > 0; diff --git a/app/views/plan-summary.html.haml b/app/views/plan-summary.html.haml index 3e27d91..230eabb 100644 --- a/app/views/plan-summary.html.haml +++ b/app/views/plan-summary.html.haml @@ -62,12 +62,12 @@ .input-group %textarea#driverNotesInput.form-control{style: 'width: 100%;', cols: '4', maxlength: '75', ng: {model: 'planService.driverInstructions'}} - .row{'ng-init' => 'returnNoteInteracted = false', 'ng-show' => 'planService.driverInstructionsReturn || returnNoteInteracted', style: 'margin-top: 30px'} + .row{ng: {show: 'isRoundTrip'}, style: 'margin-top: 30px'} .col-lg-6.col-lg-offset-3.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1.col-xs-12 %label{for: 'returnDriverNotesInput'} Return Driver's Notes: .input-group - %textarea#returnDriverNotesInput.form-control{style: 'width: 100%;', cols: '4', maxlength: '45', ng: {model: 'planService.driverInstructionsReturn', change: 'returnNoteInteracted = true'}} + %textarea#returnDriverNotesInput.form-control{style: 'width: 100%;', cols: '4', maxlength: '75', ng: {model: 'planService.driverInstructionsReturn'}} .row.unstuck-foot.btn-spacing .col-lg-6.col-lg-offset-3.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1.col-xs-12