Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m48s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m48s
This commit is contained in:
commit
28bcf6ab2f
1 changed files with 55 additions and 126 deletions
|
|
@ -3,7 +3,6 @@ import { ref, watch, computed, onUnmounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
@ -29,9 +28,6 @@ const currentObjectUrl = ref<string | null>(null);
|
||||||
// Computed properties for navigation
|
// Computed properties for navigation
|
||||||
const canGoPrevious = computed(() => page.value > 1);
|
const canGoPrevious = computed(() => page.value > 1);
|
||||||
const canGoNext = computed(() => page.value < numOfPages.value);
|
const canGoNext = computed(() => page.value < numOfPages.value);
|
||||||
const pageInfo = computed(
|
|
||||||
() => `หน้าที่ ${page.value} จาก ${numOfPages.value}`
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to previous page
|
* Navigate to previous page
|
||||||
|
|
@ -164,102 +160,57 @@ onUnmounted(() => {
|
||||||
transition-show="slide-up"
|
transition-show="slide-up"
|
||||||
transition-hide="slide-down"
|
transition-hide="slide-down"
|
||||||
>
|
>
|
||||||
<q-card>
|
<q-card class="column full-height bg-grey-2">
|
||||||
<DialogHeader :tittle="`${title}`" :close="onClose" />
|
<DialogHeader :tittle="title" :close="onClose" class="bg-white" />
|
||||||
|
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
||||||
<!-- PDF Content -->
|
<div
|
||||||
|
v-if="isLoadPDF"
|
||||||
|
class="bg-white q-py-xs q-px-md row justify-center items-center q-gutter-sm shadow-1"
|
||||||
|
>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
icon="mdi-chevron-left"
|
||||||
|
:disable="!canGoPrevious"
|
||||||
|
@click="goToPreviousPage"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-chip
|
||||||
|
outline
|
||||||
|
color="primary"
|
||||||
|
label-color="grey-9"
|
||||||
|
class="q-px-lg text-weight-bold"
|
||||||
|
>
|
||||||
|
หน้า {{ page }} / {{ numOfPages || "-" }}
|
||||||
|
</q-chip>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
icon="mdi-chevron-right"
|
||||||
|
:disable="!canGoNext"
|
||||||
|
@click="goToNextPage"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<q-card-section
|
<q-card-section
|
||||||
v-if="isLoadPDF"
|
v-if="isLoadPDF"
|
||||||
bordered
|
class="col scroll q-pa-md flex flex-center"
|
||||||
:class="
|
|
||||||
$q.screen.gt.xs
|
|
||||||
? ['q-ma-xl', 'q-pa-xl', 'scroll']
|
|
||||||
: ['q-ma-xs', 'q-pa-xs', 'scroll']
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<!-- Top Navigation -->
|
<div class="pdf-viewer-wrapper shadow-5">
|
||||||
<div class="pagination-controls">
|
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
|
||||||
<q-btn
|
|
||||||
class="nav-button"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
:disable="!canGoPrevious"
|
|
||||||
@click="goToPreviousPage"
|
|
||||||
>
|
|
||||||
<q-icon name="mdi-chevron-left" />
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<span class="page-info">{{ pageInfo }}</span>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
class="nav-button"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
:disable="!canGoNext"
|
|
||||||
@click="goToNextPage"
|
|
||||||
>
|
|
||||||
<q-icon name="mdi-chevron-right" />
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- PDF Viewer -->
|
|
||||||
<div class="pdf-container">
|
|
||||||
<VuePDF
|
|
||||||
ref="vuePDFRef"
|
|
||||||
:pdf="pdfSrc"
|
|
||||||
:page="page"
|
|
||||||
fit-parent
|
|
||||||
:scale="0.1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Bottom Navigation -->
|
|
||||||
<div class="pagination-controls">
|
|
||||||
<q-btn
|
|
||||||
class="nav-button"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
:disable="!canGoPrevious"
|
|
||||||
@click="goToPreviousPage"
|
|
||||||
>
|
|
||||||
<q-icon name="mdi-chevron-left" />
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<span class="page-info">{{ pageInfo }}</span>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
class="nav-button"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
:disable="!canGoNext"
|
|
||||||
@click="goToNextPage"
|
|
||||||
>
|
|
||||||
<q-icon name="mdi-chevron-right" />
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<!-- Loading State -->
|
<q-card-section v-else class="col flex flex-center">
|
||||||
<q-card-section v-else>
|
<div class="text-center">
|
||||||
<div class="full-width row flex-center text-accent q-gutter-sm">
|
<q-spinner color="primary" size="4em" :thickness="10" />
|
||||||
<span
|
|
||||||
><div
|
|
||||||
style="
|
|
||||||
height: 60vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
"
|
|
||||||
class="text-grey-5"
|
|
||||||
>
|
|
||||||
<q-spinner color="primary" size="3em" :thickness="10" />
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<q-page-sticky position="bottom-right" :offset="[20, 20]">
|
<q-page-sticky position="bottom-right" :offset="[20, 20]">
|
||||||
<q-btn
|
<q-btn
|
||||||
fab
|
fab
|
||||||
|
|
@ -277,45 +228,23 @@ onUnmounted(() => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.pagination-controls {
|
/* สไตล์เพื่อให้ PDF ดูเหมือนวางบนโต๊ะ */
|
||||||
display: flex;
|
.pdf-viewer-wrapper {
|
||||||
justify-content: space-between;
|
background-color: white;
|
||||||
align-items: center;
|
|
||||||
padding: 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-button {
|
|
||||||
color: #424242;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-button:hover {
|
|
||||||
background-color: #eeeeee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-info {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #424242;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pdf-container {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 16px 0;
|
max-width: 900px; /* จำกัดความกว้างเพื่อความสวยงามบนจอใหญ่ */
|
||||||
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-container {
|
/* ปรับแต่ง Scrollbar ให้ดูสะอาดตา */
|
||||||
height: 60vh;
|
.scroll::-webkit-scrollbar {
|
||||||
display: flex;
|
width: 8px;
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
color: #9e9e9e;
|
|
||||||
}
|
}
|
||||||
|
.scroll::-webkit-scrollbar-thumb {
|
||||||
.loading-text {
|
background: #bdbdbd;
|
||||||
color: #757575;
|
border-radius: 4px;
|
||||||
font-size: 16px;
|
}
|
||||||
margin: 0;
|
.scroll::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: #9e9e9e;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue