mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-24 01:50:38 +00:00
backend pagination and sorting from laravel database
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
<div id="single-page">
|
||||
|
||||
<!--Page Content-->
|
||||
<div id="page-content" v-if="! isLoading && invoices.length > 0">
|
||||
<div id="page-content" v-show="! isLoading && config.stripe_public_key">
|
||||
<MobileHeader :title="$router.currentRoute.meta.title"/>
|
||||
<PageHeader :title="$router.currentRoute.meta.title"/>
|
||||
|
||||
<div class="content-page">
|
||||
<DatatableWrapper :paginator="true" :columns="columns" :data="invoices" class="table">
|
||||
<DatatableWrapper @data="invoices = $event" @init="isLoading = false" api="/api/invoices" :paginator="false" :columns="columns" class="table">
|
||||
<template slot-scope="{ row }">
|
||||
<tr>
|
||||
<td>
|
||||
@@ -126,27 +126,27 @@
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.number'),
|
||||
field: 'data.attributes.order',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.total'),
|
||||
field: 'data.attributes.bag.amount',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.plan'),
|
||||
field: 'data.attributes.bag.amount',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.payed'),
|
||||
field: 'data.attributes.created_at',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.user'),
|
||||
field: 'relationships.user.data.attributes.name',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.action'),
|
||||
@@ -156,15 +156,8 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.config.stripe_public_key) {
|
||||
axios.get('/api/invoices')
|
||||
.then(response => {
|
||||
this.invoices = response.data.data
|
||||
this.isLoading = false
|
||||
})
|
||||
} else {
|
||||
if (! this.config.stripe_public_key)
|
||||
this.isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div id="single-page">
|
||||
<div id="page-content" v-if="! isLoading && pages.length > 0">
|
||||
<div id="page-content" v-show="! isLoading">
|
||||
<MobileHeader :title="$router.currentRoute.meta.title"/>
|
||||
<PageHeader :title="$router.currentRoute.meta.title"/>
|
||||
|
||||
<div class="content-page">
|
||||
<DatatableWrapper :paginator="false" :columns="columns" :data="pages" class="table table-users">
|
||||
<DatatableWrapper @init="isLoading = false" api="/api/pages" :paginator="false" :columns="columns" class="table table-users">
|
||||
<template slot-scope="{ row }">
|
||||
<tr>
|
||||
<td class="name" style="min-width: 200px">
|
||||
@@ -75,21 +75,20 @@
|
||||
data() {
|
||||
return {
|
||||
isLoading: true,
|
||||
pages: undefined,
|
||||
columns: [
|
||||
{
|
||||
label: this.$t('admin_pages.table.page'),
|
||||
field: 'data.attributes.title',
|
||||
field: 'title',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_pages.table.slug'),
|
||||
field: 'data.attributes.slug',
|
||||
field: 'slug',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_pages.table.status'),
|
||||
field: 'data.attributes.visibility',
|
||||
field: 'visibility',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
@@ -104,13 +103,6 @@
|
||||
this.$updateText('/pages/' + slug, 'visibility', val)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
axios.get('/api/pages')
|
||||
.then(response => {
|
||||
this.pages = response.data.data
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div id="single-page">
|
||||
|
||||
<!--Page Content-->
|
||||
<div id="page-content" v-if="! isLoading && plans.length > 0">
|
||||
<!--Stripe plans-->
|
||||
<div id="page-content" v-show="stripeConfiguredWithPlans">
|
||||
<MobileHeader :title="$router.currentRoute.meta.title"/>
|
||||
<PageHeader :title="$router.currentRoute.meta.title"/>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<DatatableWrapper :paginator="false" :columns="columns" :data="plans" class="table table-users">
|
||||
<DatatableWrapper @data="plans = $event" @init="isLoading = false" api="/api/plans" :paginator="false" :columns="columns" class="table table-users">
|
||||
<template slot-scope="{ row }">
|
||||
<tr>
|
||||
<td style="max-width: 80px">
|
||||
@@ -64,9 +64,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Empty plans-->
|
||||
<!--Stripe configured but has empty plans-->
|
||||
<EmptyPageContent
|
||||
v-if="! isLoading && plans.length === 0 && config.stripe_public_key"
|
||||
v-if="isEmptyPlans"
|
||||
icon="file"
|
||||
:title="$t('admin_page_plans.empty.title')"
|
||||
:description="$t('admin_page_plans.empty.description')"
|
||||
@@ -76,9 +76,9 @@
|
||||
</router-link>
|
||||
</EmptyPageContent>
|
||||
|
||||
<!--Stripe Not Configured-->
|
||||
<!--Stripe is Not Configured-->
|
||||
<EmptyPageContent
|
||||
v-if="! config.stripe_public_key"
|
||||
v-if="stripeIsNotConfigured"
|
||||
icon="settings"
|
||||
:title="$t('activation.stripe.title')"
|
||||
:description="$t('activation.stripe.description')"
|
||||
@@ -126,6 +126,18 @@
|
||||
Edit2Icon,
|
||||
Spinner,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['config']),
|
||||
isEmptyPlans() {
|
||||
return ! this.isLoading && this.plans.length === 0 && this.config.stripe_public_key
|
||||
},
|
||||
stripeIsNotConfigured() {
|
||||
return ! this.config.stripe_public_key
|
||||
},
|
||||
stripeConfiguredWithPlans() {
|
||||
return ! this.isLoading && this.config.stripe_public_key
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: true,
|
||||
@@ -134,27 +146,27 @@
|
||||
{
|
||||
label: this.$t('admin_page_plans.table.status'),
|
||||
field: 'data.attributes.status',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_plans.table.name'),
|
||||
field: 'data.attributes.name',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_plans.table.subscribers'),
|
||||
field: 'data.attributes.subscribers',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_plans.table.price'),
|
||||
field: 'data.attributes.price',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_plans.table.storage_capacity'),
|
||||
field: 'data.attributes.capacity',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.action'),
|
||||
@@ -163,24 +175,14 @@
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['config']),
|
||||
},
|
||||
methods: {
|
||||
changeStatus(val, id) {
|
||||
this.$updateText('/plans/' + id + '/update', 'is_active', val)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.config.stripe_public_key) {
|
||||
axios.get('/api/plans')
|
||||
.then(response => {
|
||||
this.plans = response.data.data
|
||||
this.isLoading = false
|
||||
})
|
||||
} else {
|
||||
if (! this.config.stripe_public_key)
|
||||
this.isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<PageTab :is-loading="isLoading">
|
||||
<PageTabGroup v-if="subscribers && subscribers.length > 0">
|
||||
<DatatableWrapper :paginator="true" :columns="columns" :data="subscribers" class="table">
|
||||
<PageTabGroup>
|
||||
<DatatableWrapper @init="isLoading = false" :api="'/api/plans/' + this.$route.params.id + '/subscribers'" :paginator="false" :columns="columns" :data="subscribers" class="table">
|
||||
|
||||
<!--Table data content-->
|
||||
<template slot-scope="{ row }">
|
||||
<tr>
|
||||
<td>
|
||||
@@ -30,11 +32,15 @@
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<!--Empty page-->
|
||||
<template v-slot:empty-page>
|
||||
<InfoBox>
|
||||
<p>{{ $t('admin_page_plans.subscribers.empty') }}</p>
|
||||
</InfoBox>
|
||||
</template>
|
||||
</DatatableWrapper>
|
||||
</PageTabGroup>
|
||||
<InfoBox v-else>
|
||||
<p>{{ $t('admin_page_plans.subscribers.empty') }}</p>
|
||||
</InfoBox>
|
||||
</PageTab>
|
||||
</template>
|
||||
|
||||
@@ -62,17 +68,17 @@
|
||||
data() {
|
||||
return {
|
||||
subscribers: undefined,
|
||||
isLoading: false,
|
||||
isLoading: true,
|
||||
columns: [
|
||||
{
|
||||
label: this.$t('admin_page_user.table.name'),
|
||||
field: 'data.attributes.name',
|
||||
field: 'name',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.storage_used'),
|
||||
field: 'data.relationships.storage.data.attributes.used',
|
||||
sortable: true
|
||||
field: 'used',
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.action'),
|
||||
@@ -81,13 +87,6 @@
|
||||
],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
axios.get('/api/plans/' + this.$route.params.id + '/subscribers')
|
||||
.then(response => {
|
||||
this.subscribers = response.data.data
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<template>
|
||||
<div id="single-page">
|
||||
<div id="page-content" v-if="! isLoading">
|
||||
<div id="page-content">
|
||||
<MobileHeader :title="$router.currentRoute.meta.title"/>
|
||||
<PageHeader :title="$router.currentRoute.meta.title"/>
|
||||
|
||||
<div class="content-page">
|
||||
|
||||
<!--Table tools-->
|
||||
<div class="table-tools">
|
||||
<div class="buttons">
|
||||
<router-link :to="{name: 'UserCreate'}">
|
||||
@@ -13,11 +15,10 @@
|
||||
</MobileActionButton>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="searching">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<DatatableWrapper :paginator="true" :columns="columns" :data="users" class="table table-users">
|
||||
|
||||
<!--Datatable-->
|
||||
<DatatableWrapper @init="isLoading = false" api="/api/users" :paginator="true" :columns="columns" class="table table-users">
|
||||
<template slot-scope="{ row }">
|
||||
<tr>
|
||||
<td style="min-width: 320px">
|
||||
@@ -113,7 +114,6 @@
|
||||
data() {
|
||||
return {
|
||||
isLoading: true,
|
||||
users: [],
|
||||
columns: undefined,
|
||||
}
|
||||
},
|
||||
@@ -133,34 +133,34 @@
|
||||
this.columns = [
|
||||
{
|
||||
label: this.$t('admin_page_user.table.name'),
|
||||
field: 'data.attributes.name',
|
||||
field: 'name',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.role'),
|
||||
field: 'data.attributes.role',
|
||||
field: 'role',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.plan'),
|
||||
field: 'data.attributes.subscription',
|
||||
sortable: true,
|
||||
field: 'subscription',
|
||||
sortable: false,
|
||||
hidden: ! this.config.isSaaS,
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.storage_used'),
|
||||
field: 'relationships.storage.data.attributes.used',
|
||||
field: 'used',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.storage_capacity'),
|
||||
field: 'relationships.storage.data.attributes.capacity',
|
||||
field: 'settings.storage_capacity',
|
||||
sortable: true,
|
||||
hidden: ! this.config.storageLimit,
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.created_at'),
|
||||
field: 'data.attributes.created_at_formatted',
|
||||
field: 'created_at',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
@@ -169,12 +169,6 @@
|
||||
sortable: false
|
||||
},
|
||||
]
|
||||
|
||||
axios.get('/api/users')
|
||||
.then(response => {
|
||||
this.users = response.data.data
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<template>
|
||||
<PageTab :is-loading="isLoading" :class="{'form-fixed-width': ! isLoading && invoices.length === 0}">
|
||||
<PageTabGroup v-if="invoices && invoices.length > 0">
|
||||
<DatatableWrapper :paginator="true" :columns="columns" :data="invoices" class="table">
|
||||
<PageTab :is-loading="isLoading">
|
||||
<PageTabGroup>
|
||||
<DatatableWrapper
|
||||
@init="isLoading = false"
|
||||
:api="'/api/users/' + this.$route.params.id + '/invoices'"
|
||||
:paginator="false"
|
||||
:columns="columns"
|
||||
class="table"
|
||||
>
|
||||
|
||||
<!--Table data content-->
|
||||
<template slot-scope="{ row }">
|
||||
<tr>
|
||||
<td>
|
||||
@@ -33,11 +41,15 @@
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<!--Empty page-->
|
||||
<template v-slot:empty-page>
|
||||
<InfoBox class="form-fixed-width">
|
||||
<p>{{ $t('admin_page_user.invoices.empty') }}</p>
|
||||
</InfoBox>
|
||||
</template>
|
||||
</DatatableWrapper>
|
||||
</PageTabGroup>
|
||||
<InfoBox v-else>
|
||||
<p>{{ $t('admin_page_user.invoices.empty') }}</p>
|
||||
</InfoBox>
|
||||
</PageTab>
|
||||
</template>
|
||||
|
||||
@@ -63,27 +75,26 @@
|
||||
data() {
|
||||
return {
|
||||
isLoading: true,
|
||||
invoices: undefined,
|
||||
columns: [
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.number'),
|
||||
field: 'data.attributes.order',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.total'),
|
||||
field: 'data.attributes.bag.amount',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.plan'),
|
||||
field: 'data.attributes.bag.amount',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_invoices.table.payed'),
|
||||
field: 'data.attributes.created_at',
|
||||
sortable: true
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
label: this.$t('admin_page_user.table.action'),
|
||||
@@ -92,13 +103,6 @@
|
||||
],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
axios.get('/api/users/' + this.$route.params.id + '/invoices')
|
||||
.then(response => {
|
||||
this.invoices = response.data.data
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<PageTab :is-loading="isLoading" class="form-fixed-width">
|
||||
<PageTabGroup v-if="subscription">
|
||||
<PageTabGroup v-if="subscription && !isLoading">
|
||||
<FormLabel>
|
||||
{{ $t('user_subscription.title') }}
|
||||
</FormLabel>
|
||||
@@ -27,7 +27,7 @@
|
||||
</ListInfo>
|
||||
</div>
|
||||
</PageTabGroup>
|
||||
<PageTabGroup v-if="! subscription">
|
||||
<PageTabGroup v-if="! subscription && !isLoading">
|
||||
<InfoBox>
|
||||
<p>{{ $t('admin_page_user.subscription.empty') }}</p>
|
||||
</InfoBox>
|
||||
|
||||
Reference in New Issue
Block a user