diff --git a/app/scripts/membership/membership.controller.js b/app/scripts/membership/membership.controller.js index e5066223..a96a79be 100644 --- a/app/scripts/membership/membership.controller.js +++ b/app/scripts/membership/membership.controller.js @@ -143,16 +143,16 @@ function PassholderMembershipController (passholder, moment, $rootScope, $scope, if (currentCardKey) { var cardSystemInfo = legacyPassholder.cardSystemSpecific[currentCardKey]; if ( - cardSystemInfo.status ==='ACTIVE' || + cardSystemInfo.status ==='ACTIVE' || cardSystemInfo.kansenStatuut === false || cardSystemInfo.kansenStatuutExpired === false || - cardSystemInfo.kansenStatuutInGracePeriod + cardSystemInfo.kansenStatuutInGracePeriod ) { return false; } } } - + return true; }; diff --git a/app/scripts/passholder/card-upgrade/card-upgrade-modal.controller.js b/app/scripts/passholder/card-upgrade/card-upgrade-modal.controller.js index 1b96cde4..e7122f3c 100644 --- a/app/scripts/passholder/card-upgrade/card-upgrade-modal.controller.js +++ b/app/scripts/passholder/card-upgrade/card-upgrade-modal.controller.js @@ -47,8 +47,8 @@ function UpgradeModalController ( controller.upgradeData = { passToCheck: angular.copy(pass), withKansenstatuut: 'NO_KANSENSTATUUT', - kansenstatuutEndDate: moment().month() < 4 ? - moment('30/04/' + moment().year(), 'DD/MM/YYYY') : + kansenstatuutEndDate: moment().month() < 4 ? + moment('30/04/' + moment().year(), 'DD/MM/YYYY') : moment('30/04/' + (moment().year() + 1), 'DD/MM/YYYY'), withNewCard: 'NO_NEW_CARD', uitpasNewNumber: '', @@ -252,6 +252,11 @@ function UpgradeModalController ( controller.submitUpgrade = function () { var showUpgradedPassholder = function () { $uibModalInstance.close(); + + $rootScope.$emit('membershipModified'); + $rootScope.$emit('selectedPass', + controller.upgradeData.withNewCard === 'NEW_CARD' ? controller.upgradeData.uitpasNewNumber : controller.passholder.passNumber + ); }; controller.formSubmitBusy = true; diff --git a/app/scripts/passholder/card-upgrade/ubr.card-upgrade.module.js b/app/scripts/passholder/card-upgrade/ubr.card-upgrade.module.js index 5d6941b5..98cdeb3e 100644 --- a/app/scripts/passholder/card-upgrade/ubr.card-upgrade.module.js +++ b/app/scripts/passholder/card-upgrade/ubr.card-upgrade.module.js @@ -69,15 +69,16 @@ angular } function cardUpgraded() { - $state.go( - 'counter.main.passholder', - { - identification: pass.number - }, - { - reload: true - } - ); + // This is handled in `submitUpgrade` in card-upgrade-modal.controller.js now + // $state.go( + // 'counter.main.passholder', + // { + // identification: pass.number + // }, + // { + // reload: true + // } + // ); } upgradeModalInstance diff --git a/app/scripts/passholder/detail.controller.js b/app/scripts/passholder/detail.controller.js index 2d81bc62..1e189744 100644 --- a/app/scripts/passholder/detail.controller.js +++ b/app/scripts/passholder/detail.controller.js @@ -129,6 +129,10 @@ function PassholderDetailController ( $state.go('counter.main.passholder', {identification: $scope.selectedPass.number}); }; + var selectPassByNumber = function (event, number) { + $state.go('counter.main.passholder', {identification: number}, { reload: true }); + }; + /** * Toggle all coupons. */ @@ -171,6 +175,7 @@ function PassholderDetailController ( var cleanupSchoolUpdatedListener = $rootScope.$on('schoolUpdated', refreshPassholder); var cleanupTicketRemovedListener = $rootScope.$on('ticketRemoved', loadCoupons); var cleanupActivityTariffClaimedListener = $rootScope.$on('activityTariffClaimed', loadCoupons); + var cleanupSelectedPassListener = $rootScope.$on('selectedPass', selectPassByNumber); $scope.$on('$destroy', cleanupMembershipModifiedListener); $scope.$on('$destroy', cleanupAdvantageExchangedListener); @@ -180,4 +185,5 @@ function PassholderDetailController ( $scope.$on('$destroy', cleanupSchoolUpdatedListener); $scope.$on('$destroy', cleanupTicketRemovedListener); $scope.$on('$destroy', cleanupActivityTariffClaimedListener); + $scope.$on('$destroy', cleanupSelectedPassListener); } diff --git a/app/scripts/passholder/passholder.service.js b/app/scripts/passholder/passholder.service.js index d8b664a4..d2ae0727 100644 --- a/app/scripts/passholder/passholder.service.js +++ b/app/scripts/passholder/passholder.service.js @@ -645,6 +645,11 @@ function passholderService($q, $http, $cacheFactory, appConfig, Pass, $rootScope passholderIdCache.remove(passholderNumber); passholderCache.remove(passholderNumber); + if (extraCardNumber) { + passholderIdCache.remove(extraCardNumber); + passholderCache.remove(extraCardNumber); + } + deferredRequest.resolve(); };