Skip to content

Commit

Permalink
Add pagination for Add/Current form in to New CE task. Fix CO count #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Dec 3, 2024
1 parent 2a3354a commit 83da95b
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:disabled="!ceId"
@click="showModal = true"
>
Add/Current ({{ list.length }})
Add/Current ({{ pagination.total }})
</button>
</div>
<modal-component
Expand Down Expand Up @@ -140,6 +140,10 @@
collecting event</span
>
<h3>Existing</h3>
<VPagination
:pagination="pagination"
@next-page="({ page }) => loadTable(page)"
/>
<table class="full_width table-striped">
<thead>
<tr>
Expand Down Expand Up @@ -204,14 +208,17 @@ import LabelComponent from './Label'
import TagComponent from './Tags'
import RadialAnnotator from '@/components/radials/annotator/annotator'
import RadialNavigation from '@/components/radials/navigation/radial'
import VPagination from '@/components/pagination.vue'
import {
BiocurationClassification,
CollectionObject,
TaxonDetermination
} from '@/routes/endpoints'
import { ref, watch } from 'vue'
import { getPagination } from '@/helpers'
const extend = ['taxon_determinations', 'identifiers']
const per = 50
const props = defineProps({
ceId: {
Expand Down Expand Up @@ -241,6 +248,7 @@ const repositoryId = ref()
const labelType = ref()
const tagList = ref([])
const count = ref(1)
const pagination = ref({})
watch(
() => props.ceId,
Expand Down Expand Up @@ -362,16 +370,19 @@ async function createCOs(index = 0) {
}
}
function loadTable() {
function loadTable(page = 1) {
const params = {
collecting_event_id: [props.ceId],
per,
page,
extend
}
isLoading.value = true
CollectionObject.where(params).then((response) => {
list.value = response.body
isLoading.value = false
pagination.value = getPagination(response)
})
}
Expand Down

0 comments on commit 83da95b

Please sign in to comment.