update padding dan paginasi

This commit is contained in:
bagus-arie05
2025-08-20 15:04:15 +07:00
parent 6c27987f53
commit b1c1ff86f0
3 changed files with 417 additions and 195 deletions

View File

@@ -73,7 +73,7 @@
<!-- Area konten utama aplikasi --> <!-- Area konten utama aplikasi -->
<v-main> <v-main>
<v-container fluid> <v-container fluid class="pa-0">
<!-- Di sini, konten halaman akan di-render oleh Nuxt --> <!-- Di sini, konten halaman akan di-render oleh Nuxt -->
<slot></slot> <slot></slot>
</v-container> </v-container>

View File

@@ -1,3 +1,5 @@
<!-- eslint-disable vue/valid-v-slot -->
<!-- eslint-disable vue/no-unused-vars -->
<template> <template>
<v-app> <v-app>
<v-app-bar> <v-app-bar>
@@ -23,7 +25,7 @@
</div> </div>
</div> </div>
</v-col> </v-col>
<v-spacer></v-spacer> <v-spacer />
<v-col cols="auto"> <v-col cols="auto">
<div class="d-flex align-center text-body-2"> <div class="d-flex align-center text-body-2">
<v-icon size="small" class="mr-2">mdi-view-dashboard</v-icon> <v-icon size="small" class="mr-2">mdi-view-dashboard</v-icon>
@@ -36,7 +38,7 @@
</v-app-bar> </v-app-bar>
<!-- Cyan Divider --> <!-- Cyan Divider -->
<div class="bg-cyan" style="height: 3px"></div> <div class="bg-cyan" style="height: 3px" />
<!-- Main Content --> <!-- Main Content -->
<v-main> <v-main>
@@ -48,7 +50,7 @@
Loket 12 | Rabu, 13 Agustus 2025 - Pelayanan : Loket 12 | Rabu, 13 Agustus 2025 - Pelayanan :
</div> </div>
</v-col> </v-col>
<v-spacer></v-spacer> <v-spacer />
<!-- Queue Number Buttons on the right --> <!-- Queue Number Buttons on the right -->
<v-col cols="auto"> <v-col cols="auto">
<div class="d-flex align-center"> <div class="d-flex align-center">
@@ -140,7 +142,7 @@
hide-details hide-details
class="mx-2" class="mx-2"
style="width: 80px" style="width: 80px"
></v-select> />
<span>entries</span> <span>entries</span>
</div> </div>
@@ -152,7 +154,7 @@
hide-details hide-details
density="compact" density="compact"
style="min-width: 200px" style="min-width: 200px"
></v-text-field> />
</div> </div>
</div> </div>
@@ -163,7 +165,7 @@
hide-default-footer hide-default-footer
class="elevation-1" class="elevation-1"
> >
<template v-slot:item.aksi="{ item }"> <template #item.aksi="{ item }">
<div class="d-flex ga-1"> <div class="d-flex ga-1">
<v-btn size="small" color="success" variant="flat" <v-btn size="small" color="success" variant="flat"
>Panggil</v-btn >Panggil</v-btn
@@ -174,7 +176,7 @@
> >
</div> </div>
</template> </template>
<template v-slot:item.jamPanggil="{ item }"> <template #item.jamPanggil="{ item }">
<span :class="getRowClass(item)">{{ item.jamPanggil }}</span> <span :class="getRowClass(item)">{{ item.jamPanggil }}</span>
</template> </template>
</v-data-table> </v-data-table>
@@ -194,7 +196,7 @@
of {{ filteredMainPatients.length }} entries of {{ filteredMainPatients.length }} entries
</span> </span>
</v-col> </v-col>
<v-spacer></v-spacer> <v-spacer />
<v-col cols="auto"> <v-col cols="auto">
<div class="d-flex align-center"> <div class="d-flex align-center">
<v-btn <v-btn
@@ -265,7 +267,7 @@
hide-details hide-details
class="mx-2" class="mx-2"
style="width: 80px" style="width: 80px"
></v-select> />
<span>entries</span> <span>entries</span>
</div> </div>
@@ -277,7 +279,7 @@
hide-details hide-details
density="compact" density="compact"
style="min-width: 200px" style="min-width: 200px"
></v-text-field> />
</div> </div>
</div> </div>
@@ -288,16 +290,16 @@
hide-default-footer hide-default-footer
class="elevation-1" class="elevation-1"
> >
<template v-slot:no-data> <template #no-data>
<div class="text-center pa-4">No data available in table</div> <div class="text-center pa-4">No data available in table</div>
</template> </template>
</v-data-table> </v-data-table>
<!-- Custom Pagination for Late Patients --> <!-- Custom Pagination for Late Patients -->
<v-row <v-row
v-if="filteredLatePatients.length > 0"
align="center" align="center"
class="pa-4" class="pa-4"
v-if="filteredLatePatients.length > 0"
> >
<v-col cols="auto"> <v-col cols="auto">
<span class="text-body-2 text-grey-darken-1"> <span class="text-body-2 text-grey-darken-1">
@@ -313,7 +315,7 @@
of {{ filteredLatePatients.length }} entries of {{ filteredLatePatients.length }} entries
</span> </span>
</v-col> </v-col>
<v-spacer></v-spacer> <v-spacer />
<v-col cols="auto"> <v-col cols="auto">
<div class="d-flex align-center"> <div class="d-flex align-center">
<v-btn <v-btn
@@ -377,7 +379,7 @@
hide-details hide-details
class="mx-2" class="mx-2"
style="width: 80px" style="width: 80px"
></v-select> />
<span>entries</span> <span>entries</span>
</div> </div>
@@ -389,7 +391,7 @@
hide-details hide-details
density="compact" density="compact"
style="min-width: 200px" style="min-width: 200px"
></v-text-field> />
</div> </div>
</div> </div>
@@ -400,16 +402,16 @@
hide-default-footer hide-default-footer
class="elevation-1" class="elevation-1"
> >
<template v-slot:no-data> <template #no-data>
<div class="text-center pa-4">No data available in table</div> <div class="text-center pa-4">No data available in table</div>
</template> </template>
</v-data-table> </v-data-table>
<!-- Custom Pagination for Clinic Patients --> <!-- Custom Pagination for Clinic Patients -->
<v-row <v-row
v-if="filteredClinicPatients.length > 0"
align="center" align="center"
class="pa-4" class="pa-4"
v-if="filteredClinicPatients.length > 0"
> >
<v-col cols="auto"> <v-col cols="auto">
<span class="text-body-2 text-grey-darken-1"> <span class="text-body-2 text-grey-darken-1">
@@ -425,7 +427,7 @@
of {{ filteredClinicPatients.length }} entries of {{ filteredClinicPatients.length }} entries
</span> </span>
</v-col> </v-col>
<v-spacer></v-spacer> <v-spacer />
<v-col cols="auto"> <v-col cols="auto">
<div class="d-flex align-center"> <div class="d-flex align-center">
<v-btn <v-btn
@@ -477,39 +479,74 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from "vue"; import { ref, computed } from "vue";
// Define interfaces for type safety
interface Patient {
no: number;
jamPanggil: string;
barcode: string;
noAntrian: string;
shift: string;
klinik: string;
fastTrack: string;
pembayaran: string;
panggil: string;
status: string;
}
interface LatePatient {
no: number;
barcode: string;
noAntrian: string;
shift: string;
klinik: string;
aksi: string;
}
interface ClinicPatient {
no: number;
barcode: string;
noAntrian: string;
noRM: string;
shift: string;
klinik: string;
fastTrack: string;
pembayaran: string;
aksi: string;
}
// Reactive data // Reactive data
const search = ref(""); const search = ref<string>("");
const lateSearch = ref(""); const lateSearch = ref<string>("");
const clinicSearch = ref(""); const clinicSearch = ref<string>("");
const itemsPerPage = ref(10); const itemsPerPage = ref<number>(10);
const lateItemsPerPage = ref(10); const lateItemsPerPage = ref<number>(10);
const clinicItemsPerPage = ref(10); const clinicItemsPerPage = ref<number>(10);
// Pagination current pages // Pagination current pages
const mainCurrentPage = ref(1); const mainCurrentPage = ref<number>(1);
const lateCurrentPage = ref(1); const lateCurrentPage = ref<number>(1);
const clinicCurrentPage = ref(1); const clinicCurrentPage = ref<number>(1);
// Table headers // Table headers
const mainHeaders = ref([ const mainHeaders = ref([
{ title: "No", value: "no", sortable: false }, { title: "No", value: "no", sortable: false },
{ title: "Jam Panggil", value: "jamPanggil" }, { title: "Jam Panggil", value: "jamPanggil", sortable: true },
{ title: "Barcode", value: "barcode" }, { title: "Barcode", value: "barcode", sortable: true },
{ title: "No Antrian", value: "noAntrian" }, { title: "No Antrian", value: "noAntrian", sortable: true },
{ title: "Shift", value: "shift" }, { title: "Shift", value: "shift", sortable: true },
{ title: "Klinik", value: "klinik" }, { title: "Klinik", value: "klinik", sortable: true },
{ title: "Fast Track", value: "fastTrack" }, { title: "Fast Track", value: "fastTrack", sortable: true },
{ title: "Pembayaran", value: "pembayaran" }, { title: "Pembayaran", value: "pembayaran", sortable: true },
{ title: "Panggil", value: "panggil" }, { title: "Panggil", value: "panggil", sortable: true },
{ title: "Aksi", value: "aksi", sortable: false }, { title: "Aksi", value: "aksi", sortable: false },
]); ]);
const lateHeaders = ref([ const lateHeaders = ref([
{ title: "No", value: "no", sortable: false }, { title: "No", value: "no", sortable: false },
{ title: "Barcode", value: "barcode" }, { title: "Barcode", value: "barcode", sortable: true },
{ title: "No Antrian", value: "noAntrian" }, { title: "No Antrian", value: "noAntrian", sortable: true },
{ title: "Shift", value: "shift" }, { title: "Shift", value: "shift", sortable: true},
{ title: "Klinik", value: "klinik" }, { title: "Klinik", value: "klinik", sortable: true },
{ title: "Aksi", value: "aksi", sortable: false }, { title: "Aksi", value: "aksi", sortable: false },
]); ]);
@@ -526,7 +563,7 @@ const clinicHeaders = ref([
]); ]);
// Sample data - Extended for pagination demo // Sample data - Extended for pagination demo
const mainPatients = ref([ const mainPatients = ref<Patient[]>([
{ {
no: 1, no: 1,
jamPanggil: "12:49", jamPanggil: "12:49",
@@ -566,8 +603,8 @@ const mainPatients = ref([
})), })),
]); ]);
const latePatients = ref([]); const latePatients = ref<LatePatient[]>([]);
const clinicPatients = ref([]); const clinicPatients = ref<ClinicPatient[]>([]);
// Computed properties for filtering // Computed properties for filtering
const filteredMainPatients = computed(() => { const filteredMainPatients = computed(() => {
@@ -631,24 +668,24 @@ const paginatedClinicPatients = computed(() => {
}); });
// Methods // Methods
const getRowClass = (item) => { const getRowClass = (item: Patient): string => {
if (item.status === "current") { if (item.status === "current") {
return "text-green font-weight-bold"; return "text-green font-weight-bold";
} }
return ""; return "";
}; };
const getStartEntry = (currentPage, itemsPerPage) => { const getStartEntry = (currentPage: number, itemsPerPage: number): number => {
return (currentPage - 1) * itemsPerPage + 1; return (currentPage - 1) * itemsPerPage + 1;
}; };
const getEndEntry = (currentPage, itemsPerPage, totalItems) => { const getEndEntry = (currentPage: number, itemsPerPage: number, totalItems: number): number => {
const end = currentPage * itemsPerPage; const end = currentPage * itemsPerPage;
return Math.min(end, totalItems); return Math.min(end, totalItems);
}; };
const getVisiblePages = (currentPage, totalPages) => { const getVisiblePages = (currentPage: number, totalPages: number): (number | string)[] => {
const pages = []; const pages: (number | string)[] = [];
const total = totalPages; const total = totalPages;
const current = currentPage; const current = currentPage;
@@ -680,7 +717,7 @@ const getVisiblePages = (currentPage, totalPages) => {
return pages; return pages;
}; };
const goToMainPage = (page) => { const goToMainPage = (page: number): void => {
if ( if (
page >= 1 && page >= 1 &&
page <= getMainTotalPages.value && page <= getMainTotalPages.value &&
@@ -690,7 +727,7 @@ const goToMainPage = (page) => {
} }
}; };
const goToLatePage = (page) => { const goToLatePage = (page: number): void => {
if ( if (
page >= 1 && page >= 1 &&
page <= getLateTotalPages.value && page <= getLateTotalPages.value &&
@@ -700,7 +737,7 @@ const goToLatePage = (page) => {
} }
}; };
const goToClinicPage = (page) => { const goToClinicPage = (page: number): void => {
if ( if (
page >= 1 && page >= 1 &&
page <= getClinicTotalPages.value && page <= getClinicTotalPages.value &&

View File

@@ -1,6 +1,10 @@
<!-- eslint-disable vue/valid-v-slot -->
<!-- eslint-disable vue/no-unused-vars -->
<template> <template>
<p>Admin Anjungan</p> <v-container fluid class="bg-grey-lighten-4 pa-4">
<v-card class="pa-5 mb-5" color="white" flat> <p class="mb-4">Admin Anjungan</p>
<v-card flat>
<v-card-text>
<v-row align="center"> <v-row align="center">
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<v-text-field <v-text-field
@@ -12,7 +16,7 @@
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col cols="12" md="6"> <v-col cols="12" md="6">
<v-chip color="#B71C1C" class="text-caption"> <v-chip color="#B71C1C" class="text-caption" text-color="white">
Tekan Enter. (Barcode depan nomor selalu ada huruf lain, Ex: Tekan Enter. (Barcode depan nomor selalu ada huruf lain, Ex:
J20073010005 "Hiraukan huruf 'J' nya") J20073010005 "Hiraukan huruf 'J' nya")
</v-chip> </v-chip>
@@ -21,40 +25,30 @@
<v-btn block color="info">Pendaftaran Online</v-btn> <v-btn block color="info">Pendaftaran Online</v-btn>
</v-col> </v-col>
</v-row> </v-row>
</v-card> </v-card-text>
<v-divider <v-divider :thickness="5" color="deep-orange-darken-4"></v-divider>
class="my-5"
color="deep-orange-darken-4"
thickness="8"
></v-divider>
<v-card class="mb-5"> <v-card-text>
<v-toolbar flat color="transparent" dense> <v-toolbar flat color="transparent" dense>
<v-toolbar-title <v-toolbar-title class="text-subtitle-1 font-weight-bold red--text">
class="text-subtitle-1 font-weight-bold red--text" DATA PENGUNJUNG TERLAMBAT
>DATA PENGUNJUNG TERLAMBAT</v-toolbar-title </v-toolbar-title>
>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-text-field <div class="d-flex align-center">
v-model="searchLate" <span>Show</span>
append-icon="mdi-magnify"
label="Search"
single-line
hide-details
dense
class="mr-2"
></v-text-field>
<v-select <v-select
:items="[10, 25, 50, 100]" :items="[10, 25, 50, 100]"
label="Show" label="entries"
dense dense
single-line single-line
hide-details hide-details
class="shrink" class="shrink mx-2"
style="width: 80px"
></v-select> ></v-select>
<span>entries</span>
</div>
</v-toolbar> </v-toolbar>
<v-card-text>
<v-data-table <v-data-table
:headers="lateHeaders" :headers="lateHeaders"
:items="lateVisitors" :items="lateVisitors"
@@ -62,33 +56,64 @@
no-data-text="No data available in table" no-data-text="No data available in table"
hide-default-footer hide-default-footer
class="elevation-1" class="elevation-1"
></v-data-table> >
<div class="d-flex justify-end pt-2"> </v-data-table>
<v-pagination <!-- Custom Pagination for Late Visitors -->
v-model="page" <div class="d-flex justify-space-between align-center pt-4">
:length="10" <div class="text-body-2 text-grey-darken-1">
:total-visible="5" Showing {{ currentPageStart }} to {{ currentPageEnd }} of {{ totalLateEntries }} entries
></v-pagination> </div>
<div class="d-flex align-center">
<v-btn
:disabled="currentPage === 1"
@click="previousPage"
variant="text"
size="small"
class="text-body-2"
>
Previous
</v-btn>
<template v-for="page in visiblePages" :key="page">
<v-btn
v-if="page !== '...'"
:color="page === currentPage ? 'primary' : ''"
:variant="page === currentPage ? 'flat' : 'text'"
@click="goToPage(page)"
size="small"
class="mx-1"
min-width="40"
>
{{ page }}
</v-btn>
<span v-else class="mx-1">...</span>
</template>
<v-btn
:disabled="currentPage === totalPages"
@click="nextPage"
variant="text"
size="small"
class="text-body-2"
>
Next
</v-btn>
</div>
</div> </div>
</v-card-text> </v-card-text>
</v-card>
<v-divider <v-divider :thickness="5" color="deep-orange-darken-4"></v-divider>
class="my-5"
color="blue-darken-4"
thickness="8"
></v-divider>
<v-card> <v-card-text>
<v-card-title class="text-subtitle-1 font-weight-bold bg-red-lighten-3"> <v-toolbar flat color="transparent" dense>
<v-toolbar-title class="text-subtitle-1 font-weight-bold">
DATA PENGUNJUNG DATA PENGUNJUNG
</v-card-title> </v-toolbar-title>
</v-card> </v-toolbar>
<div class="d-flex justify-space-between align-center ps-4"> <div class="d-flex justify-space-between align-center px-4">
<div class="d-flex align-center"> <div class="d-flex align-center">
<span>Show</span> <span>Show</span>
<v-select <v-select
:items="[10, 25, 50]" :items="[10, 25, 50]"
v-model="itemsPerPage"
label="Entries" label="Entries"
density="compact" density="compact"
hide-details hide-details
@@ -97,10 +122,10 @@
></v-select> ></v-select>
<span>entries</span> <span>entries</span>
</div> </div>
<div class="d-flex align-center"> <div class="d-flex align-center">
<span class="mr-2">Search:</span> <span class="mr-2">Search:</span>
<v-text-field <v-text-field
v-model="search"
label="Search" label="Search"
hide-details hide-details
density="compact" density="compact"
@@ -108,17 +133,13 @@
></v-text-field> ></v-text-field>
</div> </div>
</div> </div>
<v-card-text>
<v-data-table <v-data-table
:headers="headers" :headers="headers"
:items="mainPatients" :items="paginatedMainPatients"
:search="search" :search="search"
no-data-text="No data available in table" no-data-text="No data available in table"
class="elevation-1" class="elevation-1"
:footer-props="{ hide-default-footer
'items-per-page-options': [10, 25, 50, 100],
'show-current-page': true,
}"
> >
<template v-slot:item.aksi="{ item }"> <template v-slot:item.aksi="{ item }">
<div class="d-flex ga-1"> <div class="d-flex ga-1">
@@ -130,15 +151,53 @@
</div> </div>
</template> </template>
</v-data-table> </v-data-table>
<!-- Custom Pagination for Main Patients -->
<div class="d-flex justify-space-between align-center pt-4">
<div class="text-body-2 text-grey-darken-1">
Showing {{ mainCurrentPageStart }} to {{ mainCurrentPageEnd }} of {{ totalMainEntries }} entries
</div>
<div class="d-flex align-center">
<v-btn
:disabled="mainCurrentPage === 1"
@click="mainPreviousPage"
variant="text"
size="small"
class="text-body-2"
>
Previous
</v-btn>
<template v-for="page in mainVisiblePages" :key="page">
<v-btn
v-if="page !== '...'"
:color="page === mainCurrentPage ? 'primary' : ''"
:variant="page === mainCurrentPage ? 'flat' : 'text'"
@click="mainGoToPage(page)"
size="small"
class="mx-1"
min-width="40"
>
{{ page }}
</v-btn>
<span v-else class="mx-1">...</span>
</template>
<v-btn
:disabled="mainCurrentPage === mainTotalPages"
@click="mainNextPage"
variant="text"
size="small"
class="text-body-2"
>
Next
</v-btn>
</div>
</div>
</v-card-text> </v-card-text>
</v-card>
</v-container>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref, computed } from "vue";
// const drawer = ref(true); // Nilai awal true agar sidebar terlihat
// const rail = ref(true); // Nilai awal true agar sidebar dimulai dalam mode rail
// Struktur data yang memisahkan menu dengan dan tanpa submenu // Struktur data yang memisahkan menu dengan dan tanpa submenu
const items = ref([ const items = ref([
@@ -165,6 +224,7 @@ const items = ref([
{ title: "Screen", icon: "mdi-monitor" }, { title: "Screen", icon: "mdi-monitor" },
{ title: "List Pasien", icon: "mdi-format-list-bulleted" }, { title: "List Pasien", icon: "mdi-format-list-bulleted" },
]); ]);
const headers = ref([ const headers = ref([
{ title: "No", value: "no", sortable: false }, { title: "No", value: "no", sortable: false },
{ title: "Tgl Daftar", value: "tglDaftar", sortable: true }, { title: "Tgl Daftar", value: "tglDaftar", sortable: true },
@@ -178,6 +238,7 @@ const headers = ref([
{ title: "Masuk", value: "masuk", sortable: true }, { title: "Masuk", value: "masuk", sortable: true },
{ title: "Aksi", value: "aksi", sortable: false }, { title: "Aksi", value: "aksi", sortable: false },
]); ]);
const mainPatients = ref([ const mainPatients = ref([
{ {
no: 1, no: 1,
@@ -231,14 +292,138 @@ const mainPatients = ref([
masuk : "TIDAK", masuk : "TIDAK",
status: "current", status: "current",
}, },
]); ]);
const search = ref(""); const search = ref("");
// const searchLate = ref(''); const itemsPerPage = ref(10);
// const page = ref(1);
// const lateVisitors = ref(''); // Pagination for Late Visitors
// // const lateHeaders = ref (''); const searchLate = ref('');
// definePageMeta({ const lateHeaders = ref([]);
// layout: 'MainL' const lateVisitors = ref([]);
// }); const currentPage = ref(1);
const totalLateEntries = computed(() => lateVisitors.value.length);
const totalPages = computed(() => Math.ceil(totalLateEntries.value / itemsPerPage.value));
const currentPageStart = computed(() => (currentPage.value - 1) * itemsPerPage.value + 1);
const currentPageEnd = computed(() => Math.min(currentPage.value * itemsPerPage.value, totalLateEntries.value));
// Pagination for Main Patients
const mainCurrentPage = ref(1);
const totalMainEntries = computed(() => mainPatients.value.length);
const mainTotalPages = computed(() => Math.ceil(totalMainEntries.value / itemsPerPage.value));
const mainCurrentPageStart = computed(() => (mainCurrentPage.value - 1) * itemsPerPage.value + 1);
const mainCurrentPageEnd = computed(() => Math.min(mainCurrentPage.value * itemsPerPage.value, totalMainEntries.value));
// Paginated data for main patients
const paginatedMainPatients = computed(() => {
const start = (mainCurrentPage.value - 1) * itemsPerPage.value;
const end = start + itemsPerPage.value;
return mainPatients.value.slice(start, end);
});
// Visible pages calculation for Late Visitors
const visiblePages = computed(() => {
const pages = [];
const total = totalPages.value;
const current = currentPage.value;
if (total <= 7) {
for (let i = 1; i <= total; i++) {
pages.push(i);
}
} else {
if (current <= 4) {
for (let i = 1; i <= 5; i++) {
pages.push(i);
}
pages.push('...');
pages.push(total);
} else if (current >= total - 3) {
pages.push(1);
pages.push('...');
for (let i = total - 4; i <= total; i++) {
pages.push(i);
}
} else {
pages.push(1);
pages.push('...');
for (let i = current - 1; i <= current + 1; i++) {
pages.push(i);
}
pages.push('...');
pages.push(total);
}
}
return pages;
});
// Visible pages calculation for Main Patients
const mainVisiblePages = computed(() => {
const pages = [];
const total = mainTotalPages.value;
const current = mainCurrentPage.value;
if (total <= 7) {
for (let i = 1; i <= total; i++) {
pages.push(i);
}
} else {
if (current <= 4) {
for (let i = 1; i <= 5; i++) {
pages.push(i);
}
pages.push('...');
pages.push(total);
} else if (current >= total - 3) {
pages.push(1);
pages.push('...');
for (let i = total - 4; i <= total; i++) {
pages.push(i);
}
} else {
pages.push(1);
pages.push('...');
for (let i = current - 1; i <= current + 1; i++) {
pages.push(i);
}
pages.push('...');
pages.push(total);
}
}
return pages;
});
// Pagination methods for Late Visitors
const previousPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const goToPage = (page: number) => {
currentPage.value = page;
};
// Pagination methods for Main Patients
const mainPreviousPage = () => {
if (mainCurrentPage.value > 1) {
mainCurrentPage.value--;
}
};
const mainNextPage = () => {
if (mainCurrentPage.value < mainTotalPages.value) {
mainCurrentPage.value++;
}
};
const mainGoToPage = (page: number) => {
mainCurrentPage.value = page;
};
</script> </script>