mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-23 09:40:39 +00:00
upgrade subscription popup
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="flex items-center justify-center"
|
class="flex items-center justify-center mx-auto"
|
||||||
:class="[
|
:class="[
|
||||||
borderRadius,
|
borderRadius,
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-13
@@ -79,7 +79,7 @@ import paystack from 'vue-paystack'
|
|||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SelectSingleChargeMethodPopup',
|
name: 'ChargePaymentPopup',
|
||||||
components: {
|
components: {
|
||||||
PaymentMethod,
|
PaymentMethod,
|
||||||
PopupWrapper,
|
PopupWrapper,
|
||||||
@@ -175,15 +175,3 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import '../../../sass/vuefilemanager/variables';
|
|
||||||
@import '../../../sass/vuefilemanager/mixins';
|
|
||||||
|
|
||||||
.mobile-actions {
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow-x: auto;
|
|
||||||
margin: 0 -20px;
|
|
||||||
padding: 10px 0 10px 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
<template>
|
||||||
|
<PopupWrapper name="change-plan-subscription">
|
||||||
|
<PopupHeader :title="$t('Change Your Plan')" icon="credit-card" />
|
||||||
|
|
||||||
|
<!--Select Payment Plans-->
|
||||||
|
<PopupContent v-if="plans">
|
||||||
|
<InfoBox v-if="plans.data.length === 0" class="!mb-0">
|
||||||
|
<p>There isn't any plan yet.</p>
|
||||||
|
</InfoBox>
|
||||||
|
|
||||||
|
<!--Toggle yearly billing-->
|
||||||
|
<PlanPeriodSwitcher v-if="yearlyPlans.length > 0" v-model="isSelectedYearlyPlans" />
|
||||||
|
|
||||||
|
<!--List available plans-->
|
||||||
|
<div>
|
||||||
|
<PlanDetail
|
||||||
|
v-for="(plan, i) in plans.data"
|
||||||
|
:plan="plan"
|
||||||
|
:key="plan.data.id"
|
||||||
|
v-if="plan.data.attributes.interval === intervalPlanType"
|
||||||
|
:class="{'opacity-50 pointer-events-none': userSubscribedPlanId === plan.data.id}"
|
||||||
|
:is-selected="selectedPlan && selectedPlan.data.id === plan.data.id"
|
||||||
|
@click.native="selectPlan(plan)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</PopupContent>
|
||||||
|
|
||||||
|
<!--Actions-->
|
||||||
|
<PopupActions>
|
||||||
|
<ButtonBase class="w-full" @click.native="$closePopup()" button-style="secondary"
|
||||||
|
>{{ $t('popup_move_item.cancel') }}
|
||||||
|
</ButtonBase>
|
||||||
|
|
||||||
|
<ButtonBase
|
||||||
|
class="w-full"
|
||||||
|
v-if="plans && plans.data.length !== 0"
|
||||||
|
:button-style="buttonStyle"
|
||||||
|
:loading="isLoading"
|
||||||
|
@click.native="proceedToPayment"
|
||||||
|
>{{ $t('Change Plan') }}
|
||||||
|
</ButtonBase>
|
||||||
|
</PopupActions>
|
||||||
|
</PopupWrapper>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import PaymentMethod from '../Others/PaymentMethod'
|
||||||
|
import {loadScript} from '@paypal/paypal-js'
|
||||||
|
import PopupWrapper from '../Others/Popup/PopupWrapper'
|
||||||
|
import PopupActions from '../Others/Popup/PopupActions'
|
||||||
|
import PopupContent from '../Others/Popup/PopupContent'
|
||||||
|
import PopupHeader from '../Others/Popup/PopupHeader'
|
||||||
|
import ButtonBase from '../FilesView/ButtonBase'
|
||||||
|
import PlanDetail from './PlanDetail'
|
||||||
|
import paystack from 'vue-paystack'
|
||||||
|
import {mapGetters} from 'vuex'
|
||||||
|
import {events} from '../../bus'
|
||||||
|
import axios from 'axios'
|
||||||
|
import Spinner from '../FilesView/Spinner'
|
||||||
|
import InfoBox from '../Others/Forms/InfoBox'
|
||||||
|
import PlanPeriodSwitcher from "./PlanPeriodSwitcher";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ChangeSubscriptionPopup',
|
||||||
|
components: {
|
||||||
|
PlanPeriodSwitcher,
|
||||||
|
InfoBox,
|
||||||
|
Spinner,
|
||||||
|
PaymentMethod,
|
||||||
|
paystack,
|
||||||
|
PlanDetail,
|
||||||
|
PopupWrapper,
|
||||||
|
PopupActions,
|
||||||
|
PopupContent,
|
||||||
|
PopupHeader,
|
||||||
|
ButtonBase,
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
isSelectedYearlyPlans() {
|
||||||
|
this.selectedPlan = undefined
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['config', 'user']),
|
||||||
|
intervalPlanType() {
|
||||||
|
return this.isSelectedYearlyPlans ? 'year' : 'month'
|
||||||
|
},
|
||||||
|
buttonStyle() {
|
||||||
|
return this.selectedPlan ? 'theme' : 'secondary'
|
||||||
|
},
|
||||||
|
userSubscribedPlanId() {
|
||||||
|
return (
|
||||||
|
this.user &&
|
||||||
|
this.user.data.relationships.subscription &&
|
||||||
|
this.user.data.relationships.subscription.data.relationships.plan.data.id
|
||||||
|
)
|
||||||
|
},
|
||||||
|
yearlyPlans() {
|
||||||
|
return this.plans.data.filter((plan) => plan.data.attributes.interval === 'year')
|
||||||
|
},
|
||||||
|
subscriptionDriver() {
|
||||||
|
return this.user.data.relationships.subscription.data.attributes.driver
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
stripe: {
|
||||||
|
isGettingCheckoutLink: false,
|
||||||
|
},
|
||||||
|
paypal: {
|
||||||
|
isMethodsLoaded: false,
|
||||||
|
isMethodLoading: false,
|
||||||
|
},
|
||||||
|
isPaymentOptionPage: false,
|
||||||
|
isSelectedYearlyPlans: false,
|
||||||
|
isLoading: false,
|
||||||
|
selectedPlan: undefined,
|
||||||
|
plans: undefined,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
proceedToPayment() {
|
||||||
|
// Start button spinner
|
||||||
|
this.isLoading = true
|
||||||
|
|
||||||
|
if (this.subscriptionDriver === 'stripe') {
|
||||||
|
this.payByStripe()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.subscriptionDriver === 'paypal') {
|
||||||
|
this.payByPayPal()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.subscriptionDriver === 'paystack') {
|
||||||
|
this.payByPaystack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
payByPayPal() {
|
||||||
|
axios.post(`/api/subscriptions/swap/${this.selectedPlan.data.id}`)
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response.data.links[0].href);
|
||||||
|
//window.location = response.data.links[0].href
|
||||||
|
})
|
||||||
|
},
|
||||||
|
payByStripe() {
|
||||||
|
axios
|
||||||
|
.post('/api/stripe/checkout', {
|
||||||
|
planCode: this.selectedPlan.data.meta.driver_plan_id.stripe,
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
window.location = response.data.url
|
||||||
|
})
|
||||||
|
},
|
||||||
|
payByPaystack() {
|
||||||
|
axios
|
||||||
|
.post('/api/paystack/checkout', {
|
||||||
|
planCode: this.selectedPlan.data.meta.driver_plan_id.stripe,
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response.data.data.authorization_url);
|
||||||
|
//window.location = response.data.data.authorization_url
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectPlan(plan) {
|
||||||
|
this.selectedPlan = plan
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// Load available plans
|
||||||
|
axios.get('/api/subscriptions/plans').then((response) => {
|
||||||
|
this.plans = response.data
|
||||||
|
})
|
||||||
|
|
||||||
|
// Reset states on popup close
|
||||||
|
events.$on('popup:close', () => {
|
||||||
|
this.isSelectedYearlyPlans = false
|
||||||
|
this.isPaymentOptionPage = false
|
||||||
|
this.selectedPlan = undefined
|
||||||
|
this.paypal.isMethodsLoaded = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mb-2 text-right">
|
||||||
|
<label
|
||||||
|
:class="{ 'text-gray-400': !isSelectedYearlyPlans }"
|
||||||
|
class="cursor-pointer text-xs font-bold"
|
||||||
|
>
|
||||||
|
{{ $t('Billed Annually') }}
|
||||||
|
</label>
|
||||||
|
<div class="relative inline-block w-12 select-none align-middle">
|
||||||
|
<SwitchInput
|
||||||
|
class="scale-75 transform"
|
||||||
|
v-model="isSelectedYearlyPlans"
|
||||||
|
:state="isSelectedYearlyPlans"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import SwitchInput from '../Others/Forms/SwitchInput'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PlanPeriodSwitcher',
|
||||||
|
components: {
|
||||||
|
SwitchInput
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'isSelectedYearlyPlans': function () {
|
||||||
|
this.$emit('input', this.isSelectedYearlyPlans)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isSelectedYearlyPlans: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
+6
-19
@@ -61,7 +61,7 @@
|
|||||||
v-if="user && config"
|
v-if="user && config"
|
||||||
:channels="['bank', 'ussd', 'qr', 'mobile_money', 'bank_transfer']"
|
:channels="['bank', 'ussd', 'qr', 'mobile_money', 'bank_transfer']"
|
||||||
class="font-bold"
|
class="font-bold"
|
||||||
currency="ZAR"
|
:currency="config.isDev ? 'ZAR' : selectedPlan.data.attributes.currency"
|
||||||
:plan="selectedPlan.data.meta.driver_plan_id.paystack"
|
:plan="selectedPlan.data.meta.driver_plan_id.paystack"
|
||||||
:amount="selectedPlan.data.attributes.amount * 100"
|
:amount="selectedPlan.data.attributes.amount * 100"
|
||||||
:email="user.data.attributes.email"
|
:email="user.data.attributes.email"
|
||||||
@@ -91,22 +91,7 @@
|
|||||||
<p>There isn't any plan yet.</p>
|
<p>There isn't any plan yet.</p>
|
||||||
</InfoBox>
|
</InfoBox>
|
||||||
|
|
||||||
<!--Toggle yearly billing-->
|
<PlanPeriodSwitcher v-if="yearlyPlans.length > 0" v-model="isSelectedYearlyPlans" />
|
||||||
<div v-if="hasYearlyPlans.length > 0" class="mb-2 text-right">
|
|
||||||
<label
|
|
||||||
:class="{ 'text-gray-400': !isSelectedYearlyPlans }"
|
|
||||||
class="cursor-pointer text-xs font-bold"
|
|
||||||
>
|
|
||||||
{{ $t('Billed Annually') }}
|
|
||||||
</label>
|
|
||||||
<div class="relative inline-block w-12 select-none align-middle">
|
|
||||||
<SwitchInput
|
|
||||||
class="scale-75 transform"
|
|
||||||
v-model="isSelectedYearlyPlans"
|
|
||||||
:state="isSelectedYearlyPlans"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--List available plans-->
|
<!--List available plans-->
|
||||||
<div>
|
<div>
|
||||||
@@ -155,10 +140,12 @@ import { events } from '../../bus'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import Spinner from '../FilesView/Spinner'
|
import Spinner from '../FilesView/Spinner'
|
||||||
import InfoBox from '../Others/Forms/InfoBox'
|
import InfoBox from '../Others/Forms/InfoBox'
|
||||||
|
import PlanPeriodSwitcher from "./PlanPeriodSwitcher"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SelectPlanSubscriptionPopup',
|
name: 'SubscribeAccountPopup',
|
||||||
components: {
|
components: {
|
||||||
|
PlanPeriodSwitcher,
|
||||||
InfoBox,
|
InfoBox,
|
||||||
Spinner,
|
Spinner,
|
||||||
PaymentMethod,
|
PaymentMethod,
|
||||||
@@ -191,7 +178,7 @@ export default {
|
|||||||
this.user.data.relationships.subscription.data.relationships.plan.data.id
|
this.user.data.relationships.subscription.data.relationships.plan.data.id
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
hasYearlyPlans() {
|
yearlyPlans() {
|
||||||
return this.plans.data.filter((plan) => plan.data.attributes.interval === 'year')
|
return this.plans.data.filter((plan) => plan.data.attributes.interval === 'year')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
:description="$t('You can upgrade your plan at any time you want.')"
|
:description="$t('You can upgrade your plan at any time you want.')"
|
||||||
:is-last="true"
|
:is-last="true"
|
||||||
>
|
>
|
||||||
<ButtonBase @click.native="$openUpgradeOptions" class="w-full sm:w-auto" button-style="secondary">
|
<ButtonBase @click.native="$changeSubscriptionOptions" class="w-full sm:w-auto" button-style="secondary">
|
||||||
{{ $t('Change Plan') }}
|
{{ $t('Change Plan') }}
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
</AppInputButton>
|
</AppInputButton>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
v-if="$store.getters.config.allowed_payments"
|
v-if="$store.getters.config.allowed_payments"
|
||||||
@click.native="$openUpgradeOptions"
|
@click.native="$openSubscribeOptions"
|
||||||
type="submit"
|
type="submit"
|
||||||
button-style="theme"
|
button-style="theme"
|
||||||
class="mt-4 w-full"
|
class="mt-4 w-full"
|
||||||
|
|||||||
+5
-1
@@ -559,9 +559,13 @@ const FunctionHelpers = {
|
|||||||
events.$emit('mobile-menu:show', name)
|
events.$emit('mobile-menu:show', name)
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.prototype.$openUpgradeOptions = function () {
|
Vue.prototype.$openSubscribeOptions = function () {
|
||||||
events.$emit('popup:open', { name: 'select-plan-subscription' })
|
events.$emit('popup:open', { name: 'select-plan-subscription' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vue.prototype.$changeSubscriptionOptions = function () {
|
||||||
|
events.$emit('popup:open', { name: 'change-plan-subscription' })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,9 @@
|
|||||||
<CreatePersonalTokenPopup />
|
<CreatePersonalTokenPopup />
|
||||||
|
|
||||||
<!--Payments Popup-->
|
<!--Payments Popup-->
|
||||||
<SelectPlanSubscriptionPopup v-if="config.subscriptionType === 'fixed'" />
|
<SubscribeAccountPopup v-if="config.subscriptionType === 'fixed'" />
|
||||||
<SelectSingleChargeMethodPopup v-if="config.subscriptionType === 'metered'" />
|
<ChangeSubscriptionPopup v-if="config.subscriptionType === 'fixed'" />
|
||||||
|
<ChargePaymentPopup v-if="config.subscriptionType === 'metered'" />
|
||||||
|
|
||||||
<SidebarNavigation />
|
<SidebarNavigation />
|
||||||
|
|
||||||
@@ -75,8 +76,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MobileNavigation from '../components/Others/MobileNavigation'
|
import MobileNavigation from '../components/Others/MobileNavigation'
|
||||||
import SelectSingleChargeMethodPopup from '../components/Others/SelectSingleChargeMethodPopup'
|
import ChargePaymentPopup from '../components/Others/ChargePaymentPopup'
|
||||||
import SelectPlanSubscriptionPopup from '../components/Subscription/SelectPlanSubscriptionPopup'
|
import SubscribeAccountPopup from '../components/Subscription/SubscribeAccountPopup'
|
||||||
import ConfirmPopup from '../components/Others/Popup/ConfirmPopup'
|
import ConfirmPopup from '../components/Others/Popup/ConfirmPopup'
|
||||||
import FilePreview from '../components/FilePreview/FilePreview'
|
import FilePreview from '../components/FilePreview/FilePreview'
|
||||||
import Spotlight from '../components/Spotlight/Spotlight'
|
import Spotlight from '../components/Spotlight/Spotlight'
|
||||||
@@ -93,17 +94,19 @@ import ConfirmPassword from '../components/Others/ConfirmPassword'
|
|||||||
import MobileNavigationToolbar from '../components/Mobile/MobileNavigationToolbar'
|
import MobileNavigationToolbar from '../components/Mobile/MobileNavigationToolbar'
|
||||||
import CreateUploadRequestPopup from "../components/Others/CreateUploadRequestPopup";
|
import CreateUploadRequestPopup from "../components/Others/CreateUploadRequestPopup";
|
||||||
import CreateTeamFolderPopup from "../components/Teams/CreateTeamFolderPopup";
|
import CreateTeamFolderPopup from "../components/Teams/CreateTeamFolderPopup";
|
||||||
|
import ChangeSubscriptionPopup from "../components/Subscription/ChangeSubscriptionPopup";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
components: {
|
components: {
|
||||||
|
ChangeSubscriptionPopup,
|
||||||
CreateTeamFolderPopup,
|
CreateTeamFolderPopup,
|
||||||
CreateUploadRequestPopup,
|
CreateUploadRequestPopup,
|
||||||
MobileNavigationToolbar,
|
MobileNavigationToolbar,
|
||||||
MobileNavigation,
|
MobileNavigation,
|
||||||
ConfirmPassword,
|
ConfirmPassword,
|
||||||
SelectSingleChargeMethodPopup,
|
ChargePaymentPopup,
|
||||||
SelectPlanSubscriptionPopup,
|
SubscribeAccountPopup,
|
||||||
ConfirmPopup,
|
ConfirmPopup,
|
||||||
CardNavigation,
|
CardNavigation,
|
||||||
FilePreview,
|
FilePreview,
|
||||||
|
|||||||
@@ -768,7 +768,7 @@ if (! function_exists('is_dev')) {
|
|||||||
*/
|
*/
|
||||||
function is_dev()
|
function is_dev()
|
||||||
{
|
{
|
||||||
return env('APP_ENV') === 'local';
|
return config('app.env') === 'local';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user