mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
update: work on success modal, update to payment mixin to calculate monthly billing date
This commit is contained in:
@@ -343,9 +343,9 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TEMP CODE
|
// TEMP CODE
|
||||||
if (this.paymentMethod === this.PAYMENTS.OTHER) {
|
// if (this.paymentMethod === this.PAYMENTS.OTHER) {
|
||||||
console.log(paymentData);
|
// console.log(paymentData);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -65,53 +65,28 @@
|
|||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- not sure this is right -->
|
<template v-if="paymentData.paymentType === 'groupPlan'">
|
||||||
<template
|
|
||||||
v-if="paymentData.paymentType === 'groupPlan'
|
|
||||||
&& paymentData.paymentType === 'newGroup'"
|
|
||||||
>
|
|
||||||
<span
|
<span
|
||||||
v-html="$t('groupPlanCreated', {groupName: paymentData.group.name})"
|
v-html="$t(paymentData.newGroup
|
||||||
|
? 'groupPlanCreated' : 'groupPlanUpgraded', {groupName: paymentData.group.name})"
|
||||||
></span>
|
></span>
|
||||||
<div class="details-block">
|
<!-- <div class="details-block">
|
||||||
<span
|
<span
|
||||||
v-html="$t('paymentSubBilling', {
|
v-html="$t('paymentSubBilling', {
|
||||||
amount: groupPlanCost, months: paymentData.subscription.months})"
|
amount: groupPlanCost, months: paymentData.subscription.months})"
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div> -->
|
||||||
</template>
|
|
||||||
|
|
||||||
<template
|
|
||||||
v-if="paymentData.paymentType === 'groupPlan'
|
|
||||||
|| paymentData.paymentType === 'subscription'"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
v-once
|
|
||||||
class="small-text auto-renew"
|
|
||||||
>{{ $t('paymentAutoRenew') }}</span>
|
|
||||||
</template>
|
|
||||||
<!-- not sure this is right -->
|
|
||||||
<template
|
|
||||||
v-if="paymentData.newGroup === 'groupPlanUpgraded'
|
|
||||||
&& paymentData.paymentType === 'upgradedGroup'"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
v-html="$t('groupPlanUpdated', {groupName: paymentData.group.name})"
|
|
||||||
></span>
|
|
||||||
<div class="details-block">
|
|
||||||
<span
|
|
||||||
v-html="$t('paymentSubBilling', {
|
|
||||||
amount: groupPlanCost, months: paymentData.subscription.months})"
|
|
||||||
></span>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
|
v-if="!paymentData.newGroup"
|
||||||
class="form-group"
|
class="form-group"
|
||||||
>
|
>
|
||||||
<span>{{ $t('groupUse') }}</span>
|
<div class="details-block">
|
||||||
<p>this is text</p>
|
<span>
|
||||||
|
Your next billing date is <strong>{{ dateRenewal }}</strong>.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<lockable-label
|
<lockable-label
|
||||||
:text="$t('groupUse')"
|
:text="$t('groupUse')"
|
||||||
class="justify-content-center"
|
|
||||||
/>
|
/>
|
||||||
<select-translated-array
|
<select-translated-array
|
||||||
:items="[
|
:items="[
|
||||||
@@ -124,24 +99,36 @@
|
|||||||
]"
|
]"
|
||||||
class="group-input"
|
class="group-input"
|
||||||
:placeholder="'groupUseDefault'"
|
:placeholder="'groupUseDefault'"
|
||||||
:value="upgradedGroup.demographics"
|
:value="groupPlanUpgraded.demographics"
|
||||||
@select="upgradedGroup.demographics = $event"
|
@select="groupPlanUpgraded.demographics = $event"
|
||||||
/>
|
/>
|
||||||
<button
|
|
||||||
class="btn btn-primary btn-lg btn-block btn-payment"
|
|
||||||
@click="close()"
|
|
||||||
>
|
|
||||||
{{ $t('submit') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<button
|
<template
|
||||||
v-else
|
v-if="paymentData.paymentType === 'groupPlan'
|
||||||
class="btn btn-primary"
|
|| paymentData.paymentType === 'subscription'"
|
||||||
@click="close()"
|
|
||||||
>
|
>
|
||||||
{{ $t('onwards') }}
|
<span
|
||||||
</button>
|
v-once
|
||||||
|
class="small-text auto-renew"
|
||||||
|
>{{ $t('paymentAutoRenew') }}</span>
|
||||||
|
</template>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
v-if="!paymentData.newGroup"
|
||||||
|
class="btn btn-primary"
|
||||||
|
@click="close()"
|
||||||
|
>
|
||||||
|
{{ $t('submit') }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn btn-primary"
|
||||||
|
@click="close()"
|
||||||
|
>
|
||||||
|
{{ $t('onwards') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
@@ -151,7 +138,7 @@
|
|||||||
@import '~@/assets/scss/colors.scss';
|
@import '~@/assets/scss/colors.scss';
|
||||||
|
|
||||||
#payments-success-modal .modal-md {
|
#payments-success-modal .modal-md {
|
||||||
max-width: 20.5rem;
|
max-width: 448px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#payments-success-modal .modal-content {
|
#payments-success-modal .modal-content {
|
||||||
@@ -193,9 +180,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#payments-success-modal .modal-body {
|
#payments-success-modal .modal-body {
|
||||||
padding-top: 16px;
|
padding: 16px 32px 24px 32px;
|
||||||
padding-bottom: 24px;
|
background: $white;
|
||||||
background: white;
|
|
||||||
|
|
||||||
.modal-body-col {
|
.modal-body-col {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -249,9 +235,6 @@
|
|||||||
.small-text {
|
.small-text {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
.group-input {
|
|
||||||
margin-top: -4px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -261,24 +244,22 @@ import gemIcon from '@/assets/svg/gem.svg';
|
|||||||
import subscriptionBlocks from '@/../../common/script/content/subscriptionBlocks';
|
import subscriptionBlocks from '@/../../common/script/content/subscriptionBlocks';
|
||||||
import selectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
|
import selectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
|
||||||
import lockableLabel from '@/components/tasks/modal-controls/lockableLabel';
|
import lockableLabel from '@/components/tasks/modal-controls/lockableLabel';
|
||||||
|
import paymentsMixin from '@/mixins/payments';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
selectTranslatedArray,
|
||||||
|
lockableLabel,
|
||||||
|
},
|
||||||
|
mixins: [paymentsMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
components: {
|
|
||||||
selectTranslatedArray,
|
|
||||||
lockableLabel,
|
|
||||||
},
|
|
||||||
icons: Object.freeze({
|
icons: Object.freeze({
|
||||||
check: checkIcon,
|
check: checkIcon,
|
||||||
gem: gemIcon,
|
gem: gemIcon,
|
||||||
}),
|
}),
|
||||||
paymentData: {},
|
paymentData: {},
|
||||||
newGroup: {
|
groupPlanUpgraded: {
|
||||||
name: '',
|
|
||||||
},
|
|
||||||
upgradedGroup: {
|
|
||||||
name: '',
|
|
||||||
demographics: null,
|
demographics: null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -287,6 +268,7 @@ export default {
|
|||||||
groupPlanCost () {
|
groupPlanCost () {
|
||||||
const sub = this.paymentData.subscription;
|
const sub = this.paymentData.subscription;
|
||||||
const memberCount = this.paymentData.group.memberCount || 1;
|
const memberCount = this.paymentData.group.memberCount || 1;
|
||||||
|
console.log(this.paymentData);
|
||||||
return sub.price + 3 * (memberCount - 1);
|
return sub.price + 3 * (memberCount - 1);
|
||||||
},
|
},
|
||||||
isFromBalance () {
|
isFromBalance () {
|
||||||
@@ -308,7 +290,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close () {
|
close () {
|
||||||
console.log(this.upgradedGroup.demographics);
|
|
||||||
this.paymentData = {};
|
this.paymentData = {};
|
||||||
this.$root.$emit('bv::hide::modal', 'payments-success-modal');
|
this.$root.$emit('bv::hide::modal', 'payments-success-modal');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ export default {
|
|||||||
return moment(this.user.purchased.plan.dateTerminated)
|
return moment(this.user.purchased.plan.dateTerminated)
|
||||||
.format(this.user.preferences.dateFormat.toUpperCase());
|
.format(this.user.preferences.dateFormat.toUpperCase());
|
||||||
},
|
},
|
||||||
|
dateRenewal () {
|
||||||
|
if (!this.user.preferences || !this.user.preferences.dateFormat) {
|
||||||
|
return this.user.purchased.plan.dateRenewal;
|
||||||
|
}
|
||||||
|
return moment(this.user.purchased.plan.dateRenewal).add(1, 'months')
|
||||||
|
.format(this.user.preferences.dateFormat.toUpperCase());
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
encodeGift (uuid, gift) {
|
encodeGift (uuid, gift) {
|
||||||
|
|||||||
Reference in New Issue
Block a user