|
@@ -19,7 +19,7 @@ Exemple :
|
|
|
|
|
|
|
|
<div class="d-flex flex-row my-8">
|
|
<div class="d-flex flex-row my-8">
|
|
|
<v-text-field v-model="searchFilter" style="max-width: 200px" />
|
|
<v-text-field v-model="searchFilter" style="max-width: 200px" />
|
|
|
- <v-btn class="ma-4" @click="refresh">Refresh</v-btn>
|
|
|
|
|
|
|
+ <v-btn class="ma-4" @click="onRefreshClick">Refresh</v-btn>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<v-row>
|
|
<v-row>
|
|
@@ -39,6 +39,13 @@ Exemple :
|
|
|
</v-col>
|
|
</v-col>
|
|
|
</v-row>
|
|
</v-row>
|
|
|
|
|
|
|
|
|
|
+ <v-pagination
|
|
|
|
|
+ v-model="page"
|
|
|
|
|
+ :length="totalPages"
|
|
|
|
|
+ :total-visible="7"
|
|
|
|
|
+ @update:modelValue="refresh"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
<div class="d-flex flex-row">
|
|
<div class="d-flex flex-row">
|
|
|
<v-text-field v-model="newVal" class="my-4" style="max-width: 200px" />
|
|
<v-text-field v-model="newVal" class="my-4" style="max-width: 200px" />
|
|
|
<v-btn class="ma-4" @click="onAddClick">Add organization</v-btn>
|
|
<v-btn class="ma-4" @click="onAddClick">Add organization</v-btn>
|
|
@@ -53,20 +60,27 @@ import SearchFilter from '~/services/data/Filters/SearchFilter'
|
|
|
import {ORDER_BY_DIRECTION, SEARCH_STRATEGY} from '~/types/enum/data'
|
|
import {ORDER_BY_DIRECTION, SEARCH_STRATEGY} from '~/types/enum/data'
|
|
|
import Country from '~/models/Core/Country'
|
|
import Country from '~/models/Core/Country'
|
|
|
import OrderBy from "~/services/data/Filters/OrderBy"
|
|
import OrderBy from "~/services/data/Filters/OrderBy"
|
|
|
|
|
+import PageFilter from "~/services/data/Filters/PageFilter";
|
|
|
|
|
|
|
|
const { fetchCollection } = useEntityFetch()
|
|
const { fetchCollection } = useEntityFetch()
|
|
|
|
|
|
|
|
const query = new Query()
|
|
const query = new Query()
|
|
|
|
|
|
|
|
-const searchFilter = ref('fran')
|
|
|
|
|
|
|
+const searchFilter = ref('')
|
|
|
|
|
+
|
|
|
|
|
+const newVal = ref('')
|
|
|
|
|
|
|
|
-const newVal = ref('fran')
|
|
|
|
|
|
|
+const page = ref(1)
|
|
|
|
|
+const itemsPerPage = ref(10)
|
|
|
|
|
|
|
|
query.add(new SearchFilter('name', searchFilter, SEARCH_STRATEGY.IPARTIAL))
|
|
query.add(new SearchFilter('name', searchFilter, SEARCH_STRATEGY.IPARTIAL))
|
|
|
query.add(new OrderBy('name', ORDER_BY_DIRECTION.ASC))
|
|
query.add(new OrderBy('name', ORDER_BY_DIRECTION.ASC))
|
|
|
|
|
+query.add(new PageFilter(page, itemsPerPage))
|
|
|
|
|
|
|
|
const { data, pending, refresh } = fetchCollection(Country, null, query)
|
|
const { data, pending, refresh } = fetchCollection(Country, null, query)
|
|
|
|
|
|
|
|
|
|
+const totalPages = computed(() => data.value ? data.value?.pagination.last : 1)
|
|
|
|
|
+
|
|
|
console.log(data)
|
|
console.log(data)
|
|
|
// console.log(data.value!.items)
|
|
// console.log(data.value!.items)
|
|
|
|
|
|
|
@@ -85,6 +99,11 @@ const onAddClick = () => {
|
|
|
|
|
|
|
|
id += 1
|
|
id += 1
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+const onRefreshClick = () => {
|
|
|
|
|
+ refresh()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|