Skip to content

Commit

Permalink
Merge pull request #5025 from kiva/update-monthly-good-sign-up-to-ref…
Browse files Browse the repository at this point in the history
…lect-donation-learnings

feat: update default percentage to 0.18 and hide covid category to ne…
  • Loading branch information
christian14b authored Oct 13, 2023
2 parents 4a0ebd3 + b483c4d commit 84a742a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/components/Forms/MonthlyGoodUpdateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ export default {
{ label: 'Preserve existing settings', value: '', shortName: '' }
);
}
// Removing Covid 19 category option if it is not active for the user
if (this.category?.marketingName !== 'COVID-19') {
this.lendingCategories = this.lendingCategories.filter(category => category.marketingName !== 'COVID-19');
}
/** After initial value is loaded, setup watch to make form dirty on value changes
* and emit values on value changes. Setting this in mounted prevents the form
* from being dirty on initial load
Expand Down
20 changes: 12 additions & 8 deletions src/pages/MonthlyGood/MonthlyGoodSetupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
v-model="donationCheckbox"
>
<span class="tw-font-medium">
Monthly donation to Kiva (optional)
Help cover the cost of your loans (optional donation to Kiva)
</span>
<div class="tw-text-small" v-if="isMGTaglineActive">
<!-- eslint-disable-next-line max-len -->
Expand Down Expand Up @@ -376,6 +376,8 @@ const startDay = nextmonth => {
return dayToStartMG.getDate();
};
const defaultDonationPercentage = 0.18;
export default {
name: 'MonthlyGoodSetupPage',
props: {
Expand All @@ -385,7 +387,7 @@ export default {
},
initDonation: {
type: Number,
default: 25 * 0.15,
default: 25 * defaultDonationPercentage,
},
day: {
type: Number,
Expand Down Expand Up @@ -424,9 +426,9 @@ export default {
mgAmount: 25,
isDayInputShown: false,
dayOfMonth: startDay(this.nextmonth),
donation: 25 * 0.15,
donation: 25 * defaultDonationPercentage,
donationCheckbox: true,
donationOptionSelected: '15',
donationOptionSelected: '18',
isDonationOptionsDirty: false,
submitting: false,
legacySubs: [],
Expand Down Expand Up @@ -540,6 +542,8 @@ export default {
// Sanitize and set initial form values.
// Initial group from prop
// Removing covid-19 as a category option
this.lendingCategories = this.lendingCategories.filter(category => category.marketingName !== 'COVID-19');
if (this.lendingCategories.find(category => category.value === this.category)) {
this.selectedGroup = this.category;
}
Expand All @@ -555,7 +559,7 @@ export default {
this.donationOptionSelected = 'other';
this.donation = this.initDonation;
} else {
this.donation = this.amount * 0.15;
this.donation = this.amount * defaultDonationPercentage;
}
// Initial day from prop
Expand Down Expand Up @@ -724,9 +728,9 @@ export default {
monetaryValue: Math.round(amountToBasePercentageOn * 0.20 * 100) / 100
},
{
value: '15',
label: `${numeral(amountToBasePercentageOn * 0.15).format('$0,0.00')}`,
monetaryValue: Math.round(amountToBasePercentageOn * 0.15 * 100) / 100
value: '18',
label: `${numeral(amountToBasePercentageOn * defaultDonationPercentage).format('$0,0.00')}`,
monetaryValue: Math.round(amountToBasePercentageOn * defaultDonationPercentage * 100) / 100
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/loan-group-categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
marketingName: 'COVID-19',
marketingOrder: 7,
expLoansIds: [2319451, 2320833, 2320176]
},
}
],
};
}
Expand Down

0 comments on commit 84a742a

Please sign in to comment.