Skip to content

Commit

Permalink
Store Premium Selection in ItemConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
reldredge71 committed Aug 16, 2021
1 parent 41098f3 commit 854f2e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app/branded/branded-checkout.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class BrandedCheckoutController {
this.fireAnalyticsEvents('contact', 'payment')
}, angular.noop)
this.$translate.use(this.language || 'en')

this.itemConfig = {}
}

formatDonorDetails () {
Expand Down
3 changes: 2 additions & 1 deletion src/app/branded/branded-checkout.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
premium-name="$ctrl.premiumName"
premium-image-url="$ctrl.premiumImageUrl"
radio-station-api-url="$ctrl.radioStationApiUrl"
radio-station-radius="$ctrl.radioStationRadius">
radio-station-radius="$ctrl.radioStationRadius"
item-config="$ctrl.itemConfig">
</branded-checkout-step-1>
<branded-checkout-step-2
ng-if="$ctrl.checkoutStep === 'review'"
Expand Down
11 changes: 10 additions & 1 deletion src/app/branded/step-1/branded-checkout-step-1.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ class BrandedCheckoutStep1Controller {
}
}

onSelectPremiumOption () {
if (this.premiumSelected) {
this.itemConfig['premium-code'] = this.premiumCode
} else {
this.itemConfig['premium-code'] = undefined
}
}

checkSuccessfulSubmission () {
if (every(this.submission, 'completed')) {
if (every(this.submission, { error: false })) {
Expand Down Expand Up @@ -189,6 +197,7 @@ export default angular
premiumName: '<',
premiumImageUrl: '<',
radioStationApiUrl: '<',
radioStationRadius: '<'
radioStationRadius: '<',
itemConfig: '='
}
})
6 changes: 4 additions & 2 deletions src/app/branded/step-1/branded-checkout-step-1.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ <h3 class="panel-name" translate>{{'PREMIUM'}}</h3>
type="radio"
name="premiumSelect"
ng-model="$ctrl.premiumSelected"
ng-value="true">
ng-value="true"
ng-change="$ctrl.onSelectPremiumOption()">
{{$ctrl.premiumName}}
</label>
</div>
Expand All @@ -59,7 +60,8 @@ <h3 class="panel-name" translate>{{'PREMIUM'}}</h3>
type="radio"
name="premiumSelect"
ng-model="$ctrl.premiumSelected"
ng-value="false">
ng-value="false"
ng-change="$ctrl.onSelectPremiumOption()">
<translate>{{'NO_THANK_YOU'}}</translate>
</label>
</div>
Expand Down

0 comments on commit 854f2e3

Please sign in to comment.