|
- {{ column.label }}
+
+
@@ -125,353 +131,158 @@ import DatatableCell from '/resources/js/components/Others/Tables/DatatableCell'
import axios from "axios";
export default {
- name: 'DatatableWrapper',
- props: [
- 'columns', 'scope', 'paginator', 'api', 'tableData'
- ],
- components: {
- ChevronRightIcon,
- ChevronLeftIcon,
- DatatableCell,
- ChevronUpIcon,
- },
- computed: {
- hasData() {
- return this.data && this.data.data && this.data.data.length > 0
- },
- floatPages() {
- return [(this.pageIndex - 1), this.pageIndex, (this.pageIndex + 1)];
- }
- },
- data() {
- return {
- data: undefined,
- isLoading: true,
- pageIndex: 1,
- filter: {
- sort: 'DESC',
- field: undefined,
- }
- }
- },
- methods: {
- goToPage(index) {
- if (index > this.data.meta.last_page || index === 0) return
+ name: 'DatatableWrapper',
+ props: [
+ 'columns', 'scope', 'paginator', 'api', 'tableData'
+ ],
+ components: {
+ ChevronRightIcon,
+ ChevronLeftIcon,
+ DatatableCell,
+ ChevronUpIcon,
+ },
+ computed: {
+ hasData() {
+ return this.data && this.data.data && this.data.data.length > 0
+ },
+ floatPages() {
+ return [(this.pageIndex - 1), this.pageIndex, (this.pageIndex + 1)];
+ }
+ },
+ data() {
+ return {
+ data: undefined,
+ isLoading: true,
+ pageIndex: 1,
+ filter: {
+ sort: 'DESC',
+ field: undefined,
+ }
+ }
+ },
+ methods: {
+ goToPage(index) {
+ if (index > this.data.meta.last_page || index === 0) return
- this.pageIndex = index
+ this.pageIndex = index
- this.getPage(index)
- },
- sort(field, sortable) {
+ this.getPage(index)
+ },
+ sort(field, sortable) {
- // Prevent sortable if is disabled
- if (!sortable) return
+ // Prevent sortable if is disabled
+ if (!sortable) return
- // Set filter
- this.filter.field = field
+ // Set filter
+ this.filter.field = field
- // Set sorting direction
- if (this.filter.sort === 'DESC') {
- this.filter.sort = 'ASC'
- } else if (this.filter.sort === 'ASC') {
- this.filter.sort = 'DESC'
- }
+ // Set sorting direction
+ if (this.filter.sort === 'DESC') {
+ this.filter.sort = 'ASC'
+ } else if (this.filter.sort === 'ASC') {
+ this.filter.sort = 'DESC'
+ }
- this.getPage(this.pageIndex)
- },
- getPage(page) {
+ this.getPage(this.pageIndex)
+ },
+ getPage(page) {
- // Get api URI
- this.URI = this.api;
+ // Get api URI
+ this.URI = this.api;
- // Set page index
- if (this.paginator)
- this.URI = this.URI + '?page=' + page
+ // Set page index
+ if (this.paginator)
+ this.URI = this.URI + '?page=' + page
- // Add filder URI if is defined sorting
- if (this.filter.field)
+ // Add filder URI if is defined sorting
+ if (this.filter.field)
- this.URI = this.URI + (this.paginator ? '&' : '?') + 'sort=' + this.filter.field + '&direction=' + this.filter.sort
+ this.URI = this.URI + (this.paginator ? '&' : '?') + 'sort=' + this.filter.field + '&direction=' + this.filter.sort
- this.isLoading = true
+ this.isLoading = true
- // Get data
- axios.get(this.URI)
- .then(response => {
- this.data = response.data
- this.$emit('data', response.data)
+ // Get data
+ axios.get(this.URI)
+ .then(response => {
+ this.data = response.data
+ this.$emit('data', response.data)
- })
- .catch(() => this.$isSomethingWrong())
- .finally(() => {
- this.$emit('init', true)
- this.isLoading = false
- }
- )
- },
- },
- created() {
- if (this.api)
- this.getPage(this.pageIndex)
+ })
+ .catch(() => this.$isSomethingWrong())
+ .finally(() => {
+ this.$emit('init', true)
+ this.isLoading = false
+ }
+ )
+ },
+ },
+ created() {
+ if (this.api)
+ this.getPage(this.pageIndex)
- if (this.tableData)
- this.data = this.tableData,
- this.isLoading = false
- }
+ if (this.tableData)
+ this.data = this.tableData,
+ this.isLoading = false
+ }
}
+
\ No newline at end of file
diff --git a/resources/js/views/Admin/Users.vue b/resources/js/views/Admin/Users.vue
index 1307178e..103fa50e 100644
--- a/resources/js/views/Admin/Users.vue
+++ b/resources/js/views/Admin/Users.vue
@@ -14,10 +14,10 @@
-
+ |
| |
|---|