Skip to content

Commit

Permalink
Merge pull request #349 from cultuurnet/UPS-3980-upgrade-passholder
Browse files Browse the repository at this point in the history
[UPS-3980] Go to newly added card
  • Loading branch information
hirviid authored Aug 29, 2022
2 parents fbf71d6 + 7dcf1dd commit b02c7a0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
6 changes: 3 additions & 3 deletions app/scripts/membership/membership.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 10 additions & 9 deletions app/scripts/passholder/card-upgrade/ubr.card-upgrade.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions app/scripts/passholder/detail.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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);
Expand All @@ -180,4 +185,5 @@ function PassholderDetailController (
$scope.$on('$destroy', cleanupSchoolUpdatedListener);
$scope.$on('$destroy', cleanupTicketRemovedListener);
$scope.$on('$destroy', cleanupActivityTariffClaimedListener);
$scope.$on('$destroy', cleanupSelectedPassListener);
}
5 changes: 5 additions & 0 deletions app/scripts/passholder/passholder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

Expand Down

0 comments on commit b02c7a0

Please sign in to comment.