-
Notifications
You must be signed in to change notification settings - Fork 4k
/
successModal.vue
144 lines (130 loc) · 3.33 KB
/
successModal.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<template lang="pug">
b-modal#payments-success-modal(
:title="$t('accountSuspendedTitle')",
size='sm',
)
div(slot="modal-header")
.check-container.d-flex.align-items-center.justify-content-center
.svg-icon.check(v-html="icons.check", v-once)
h2(v-once) {{ $t('paymentSuccessful') }}
div(slot="modal-footer")
.small-text(v-once) {{ $t('giftSubscriptionText4') }}
.row
.col-12.modal-body-col
template(v-if="paymentData.paymentType === 'gems'")
strong(v-once) {{ $t('youReceived') }}
.details-block.gems
.svg-icon(v-html="icons.gem", v-once)
span 20
template(v-if="paymentData.paymentType === 'subscription'")
strong(v-once) {{ $t('nowSubscribed') }}
.details-block
span(v-html="$t('paymentSubBilling', {amount: paymentData.subscription.price, months: paymentData.subscription.months})")
button.btn.btn-primary(@click='close()', v-once) {{$t('onwards')}}
</template>
<style lang="scss">
@import '~client/assets/scss/colors.scss';
#payments-success-modal .modal-content {
background: transparent;
}
#payments-success-modal .modal-header {
justify-content: center;
padding-top: 24px;
padding-bottom: 0px;
background: $green-10;
border-top-right-radius: 8px;
border-top-left-radius: 8px;
h2 {
color: white;
}
.check-container {
width: 64px;
height: 64px;
border-radius: 50%;
background: #1CA372;
margin: 0 auto;
margin-bottom: 16px;
}
.check {
width: 35.1px;
height: 28px;
color: white;
}
}
#payments-success-modal .modal-body {
padding-top: 16px;
padding-bottom: 24px;
background: white;
.modal-body-col {
display: flex;
flex-direction: column;
align-items: center;
}
.details-block {
background: $gray-700;
border-radius: 4px;
padding: 8px 24px;
margin-top: 16px;
margin-bottom: 24px;
display: flex;
flex-direction: row;
text-align: center;
&.gems {
padding: 12px 16px 12px 20px;
color: $green-10;
font-size: 24px;
font-weight: bold;
line-height: 1.33;
.svg-icon {
margin-right: 8px;
width: 32px;
height: 32px;
}
}
}
}
#payments-success-modal .modal-footer {
background: $gray-700;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
justify-content: center;
.small-text {
font-style: normal;
}
}
</style>
<script>
import checkIcon from 'assets/svg/check.svg';
import gemIcon from 'assets/svg/gem.svg';
import subscriptionBlocks from '../../../common/script/content/subscriptionBlocks';
export default {
data () {
return {
icons: Object.freeze({
check: checkIcon,
gem: gemIcon,
}),
paymentData: {},
};
},
mounted () {
this.$root.$on('habitica:payment-success', (data) => {
if (data.paymentType === 'subscription') {
data.subscription = subscriptionBlocks[data.subscriptionKey];
}
this.paymentData = data;
this.$root.$emit('bv::show::modal', 'payments-success-modal');
});
},
destroyed () {
this.paymentData = {};
this.$root.$off('habitica:payments-success');
},
methods: {
close () {
this.paymentData = null;
this.$root.$emit('bv::hide::modal', 'payments-success-modal');
},
},
};
</script>