sorting datatables

This commit is contained in:
Čarodej
2021-11-29 08:01:12 +01:00
parent 5d4486a4ad
commit fa3cb93b19
11 changed files with 162 additions and 128 deletions
+2 -1
View File
@@ -139,7 +139,7 @@
},
{
label: this.$t('User'),
field: 'user',
field: 'user_id',
sortable: true
},
{
@@ -159,6 +159,7 @@
},
{
label: this.$t('Service'),
field: 'driver',
sortable: true
},
],
+1 -69
View File
@@ -17,7 +17,7 @@
</td>
<td>
<span class="text-sm font-bold">
<SwitchInput @input="changeStatus($event, row.data.attributes.slug)" class="switch" :state="row.data.attributes.visibility"/>
<SwitchInput @input="$updateText(`/admin/pages/${row.data.id}`, 'visibility', row.data.attributes.visibility)" v-model="row.data.attributes.visibility" :state="row.data.attributes.visibility" class="switch"/>
</span>
</td>
<td>
@@ -95,73 +95,5 @@
],
}
},
methods: {
changeStatus(val, slug) {
this.$updateText('/admin/pages/' + slug, 'visibility', val)
}
},
}
</script>
<style lang="scss" scoped>
@import '/resources/sass/vuefilemanager/_variables';
@import '/resources/sass/vuefilemanager/_mixins';
.table-tools {
background: white;
display: flex;
justify-content: space-between;
padding: 15px 0 10px;
position: sticky;
top: 40px;
z-index: 9;
}
.table {
.cell-item {
@include font-size(15);
white-space: nowrap;
}
.name {
font-weight: 700;
cursor: pointer;
}
}
@media only screen and (max-width: 690px) {
.table-tools {
padding: 0 0 5px;
}
}
.dark {
.table-tools {
background: $dark_mode_background;
}
.action-icons {
.icon {
cursor: pointer;
circle, path, line, polyline {
stroke: $dark_mode_text_primary;
}
}
}
.user-thumbnail {
.info {
.email {
color: $dark_mode_text_secondary;
}
}
}
}
</style>
+12 -12
View File
@@ -14,7 +14,7 @@
<template slot-scope="{ row }">
<tr class="border-b dark:border-opacity-5 border-light border-dashed">
<td class="py-4">
<SwitchInput @input="$updateInput(`/subscriptions/admin/plans/${row.data.id}`, 'visible', row.data.attributes.visible)" v-model="row.data.attributes.visible" class="switch" :state="row.data.attributes.visible"/>
<SwitchInput @input="$updateInput(`/subscriptions/admin/plans/${row.data.id}`, 'visible', row.data.attributes.visible)" v-model="row.data.attributes.visible" :state="row.data.attributes.visible" class="switch"/>
</td>
<td>
<router-link class="text-sm font-bold" :to="{name: 'PlanSettings', params: {id: row.data.id}}">
@@ -110,7 +110,9 @@
Spinner,
},
computed: {
...mapGetters(['config']),
...mapGetters([
'config'
]),
isEmptyPlans() {
return ! this.isLoading && this.plans.length === 0 && this.config.stripe_public_key
},
@@ -128,32 +130,30 @@
columns: [
{
label: this.$t('Visibility'),
field: 'data.attributes.status',
sortable: false
field: 'visible',
sortable: true
},
{
label: this.$t('Name'),
field: 'data.attributes.name',
sortable: false
field: 'name',
sortable: true
},
{
label: this.$t('Price'),
field: 'data.attributes.subscribers',
sortable: false
field: 'amount',
sortable: true
},
{
label: this.$t('Interval'),
field: 'data.attributes.price',
sortable: false
field: 'interval',
sortable: true
},
{
label: this.$t('admin_page_plans.table.subscribers'),
field: 'data.attributes.capacity',
sortable: false
},
{
label: this.$t('Storage'),
field: 'data.attributes.capacity',
sortable: false
},
{
@@ -91,30 +91,33 @@
columns: [
{
label: this.$t('admin_page_user.table.name'),
field: 'name',
field: 'user_id',
sortable: true
},
{
label: this.$t('Status'),
field: 'used',
sortable: false
field: 'status',
sortable: true
},
{
label: this.$t('Plan'),
field: 'name',
field: 'plan.name',
sortable: true
},
{
label: this.$t('Renews At'),
sortable: false
field: 'created_at',
sortable: true
},
{
label: this.$t('Ends At'),
sortable: false
field: 'ends_at',
sortable: true
},
{
label: this.$t('Service'),
sortable: false
field: 'driver',
sortable: true
},
],
}
+10 -7
View File
@@ -133,30 +133,33 @@
columns: [
{
label: this.$t('admin_page_user.table.name'),
field: 'name',
field: 'user_id',
sortable: true
},
{
label: this.$t('Status'),
field: 'used',
sortable: false
field: 'status',
sortable: true
},
{
label: this.$t('Plan'),
field: 'name',
field: 'plan.name',
sortable: true
},
{
label: this.$t('Renews At'),
sortable: false
field: 'created_at',
sortable: true
},
{
label: this.$t('Ends At'),
sortable: false
field: 'created_at',
sortable: true
},
{
label: this.$t('Service'),
sortable: false
field: 'driver.driver',
sortable: true
},
],
}
+2 -7
View File
@@ -149,19 +149,15 @@
},
{
label: this.$t('admin_page_user.table.plan'),
field: 'subscription',
sortable: false,
hidden: ! this.config.isSaaS,
},
{
label: this.$t('admin_page_user.table.storage_used'),
field: 'used',
sortable: true
sortable: false
},
{
label: this.$t('Max Storage'),
field: 'settings.max_storage_amount',
sortable: true,
sortable: false,
hidden: ! this.config.storageLimit,
},
{
@@ -171,7 +167,6 @@
},
{
label: this.$t('admin_page_user.table.action'),
field: 'data.action',
sortable: false
},
]
@@ -86,6 +86,7 @@
},
{
label: this.$t('Service'),
field: 'driver',
sortable: true
},
],