summaryrefslogtreecommitdiff
path: root/pages/admin/reports.vue
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-13 22:35:20 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-10-13 22:35:20 +0200
commit2325d12395e0a7e7f944165e7de4d9e88915b4d6 (patch)
tree991ae85bb8dc9251f83a7055dab2ad183a512af0 /pages/admin/reports.vue
parente7051ff7dc705cee2360798df86613632b305ba2 (diff)
Add pagination on admin cp
Diffstat (limited to 'pages/admin/reports.vue')
-rw-r--r--pages/admin/reports.vue21
1 files changed, 18 insertions, 3 deletions
diff --git a/pages/admin/reports.vue b/pages/admin/reports.vue
index 7d49a40..074360a 100644
--- a/pages/admin/reports.vue
+++ b/pages/admin/reports.vue
@@ -9,12 +9,14 @@
:keys="['id', 'model_id', 'created', 'updated', 'user', 'resolved', 'note', 'admin_note']"
:fields="warnings"
)
+ pagination(:page="page" :pages="pages" v-if="count" path="/admin/reports")
</template>
<script>
import { mapGetters } from "vuex";
import AdminSidebar from "@/components/AdminSidebar.vue";
+import Pagination from "@/components/Pagination.vue";
import VTable from "@/components/VTable.vue";
export default {
@@ -22,9 +24,19 @@ export default {
head: { title: "Models ยท Verden" },
computed: {
...mapGetters("auth", ["isLogged", "me"]),
- ...mapGetters("warnings", ["warnings"]),
+ ...mapGetters("warnings", ["warnings", "count"]),
+ },
+ data() {
+ return {
+ page: 0,
+ pages: 0,
+ };
+ },
+ components: {
+ AdminSidebar,
+ pagination: Pagination,
+ "v-table": VTable,
},
- components: { AdminSidebar, "v-table": VTable },
async mounted() {
await this.$store.dispatch("auth/findMe");
@@ -32,7 +44,10 @@ export default {
window.location.href = "/";
}
- this.$store.dispatch("warnings/getWarnings", 0);
+ this.page = this.$route.query.page ?? 0;
+ this.$store.dispatch("warnings/getWarnings", this.page).then(() => {
+ this.pages = Math.ceil(this.count / 20);
+ });
},
};
</script>