- Added status column to the fixed plan table

- Ability to delete fixed plan if there isn't any subscribed user
- Improved error handling in subscription module
This commit is contained in:
Čarodej
2022-04-02 17:52:48 +02:00
parent 086dab99cd
commit be37f95404
22 changed files with 220 additions and 169 deletions
@@ -141,6 +141,16 @@ export default {
.then((response) => {
window.location = response.data.url
})
.catch((error) => {
if (error.response.status === 500 && error.response.data.type) {
events.$emit('alert:open', {
title: error.response.data.title,
message: error.response.data.message,
})
} else {
this.$isSomethingWrong()
}
})
}
// Change active subscription
@@ -134,6 +134,7 @@ import Spinner from '../FilesView/Spinner'
import InfoBox from '../Others/Forms/InfoBox'
import PlanPeriodSwitcher from './PlanPeriodSwitcher'
export default {
name: 'SubscribeAccountPopup',
components: {
@@ -257,6 +258,26 @@ export default {
.then((response) => {
window.location = response.data.url
})
.catch((error) => {
this.$closePopup()
setTimeout(() => {
if (error.response.status === 500 && error.response.data.type) {
events.$emit('alert:open', {
title: error.response.data.title,
message: error.response.data.message,
})
} else {
events.$emit('alert:open', {
title: this.$t('popup_error.title'),
message: this.$t('popup_error.message'),
})
}
}, 100)
})
.finally(() => {
this.stripe.isGettingCheckoutLink = false
})
},
selectPlan(plan) {
this.selectedPlan = plan
@@ -189,7 +189,7 @@
class="ml-3 text-sm font-bold"
:class="value ? 'text-green-600 dark:text-green-600' : 'text-red-600 dark:text-red-600'"
>
{{ value ? 'Module Installed' : 'Missing Module' }}
{{ value ? 'Module Installed' : 'You have to install this module' }}
</span>
</div>
</div>
+10
View File
@@ -111,6 +111,11 @@
>
{{ row.data.attributes.name }}
</router-link>
</td>
<td class="px-3 md:px-1">
<ColorLabel :color="$getPlanStatusColor(row.data.attributes.status)">
{{ $t(row.data.attributes.status) }}
</ColorLabel>
</td>
<td class="px-3 md:px-1">
<span class="text-sm font-bold">
@@ -258,6 +263,11 @@ export default {
field: 'name',
sortable: true,
},
{
label: this.$t('status'),
field: 'status',
sortable: true,
},
{
label: this.$t('price'),
field: 'amount',
@@ -250,7 +250,12 @@ export default {
}
}
if (error.response.status === 500) {
if (error.response.status === 500 && error.response.data.type) {
events.$emit('alert:open', {
title: error.response.data.title,
message: error.response.data.message,
})
} else if (error.response.status === 500) {
this.isError = true
this.errorMessage = error.response.data.message
}
@@ -93,7 +93,7 @@
<x-icon v-if="!value" size="16" class="vue-feather dark:text-red-600 text-red-600" />
<span class="ml-3 text-sm font-bold" :class="value ? 'dark:text-green-600 text-green-600' : 'dark:text-red-600 text-red-600'">
{{ value ? 'Module Installed' : 'Missing Module' }}
{{ value ? 'Module Installed' : 'You have to install this module' }}
</span>
</div>
</div>