Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions app/components/common/detail/DownloadAndPurchaseButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,67 +26,67 @@
</v-icon>
</div>
<v-btn
v-if="files.word.exist"
v-if="files.pdf.exist"
rounded="pill"
class="width-btn btn-word d-flex align-center justify-center"
color="#2e90fa35"
class="width-btn btn-pdf d-flex align-center justify-center"
color="#f0443835"
flat
height="42"
:loading="isDownloading('word')"
@click="handleDownloadClick('word', files.word.price)"
:loading="isDownloading('pdf')"
@click="handleDownloadClick('pdf', files.pdf.price)"
>
<template #loader>
<v-progress-circular
:model-value="getDownloadProgress('word')"
color="#2e90fa"
:model-value="getDownloadProgress('pdf')"
color="#f04438"
size="24"
width="3"
/>
</template>
<v-icon
color="#2e90fa"
color="#f04438"
size="20"
>
md:description_outlined
md:picture_as_pdf_outlined
</v-icon>
<span class="text-word text-h5 font-weight-bold mt-1 mx-2">Download Question Doc</span>
<span class="text-pdf text-h5 font-weight-bold mt-1 mx-2">Download {{ isPaper ? 'Question Paper' : 'PDF' }}</span>

<span
v-if="files.word.price && files.word.price !=0"
class="text-word text-h5 font-weight-bold mt-1"
>{{ files.word.price }} <span class="text-h6 font-weight-normal">GEM</span></span>
v-if="files.pdf.price && files.pdf.price != 0"
class="text-pdf text-h5 font-weight-bold mt-1"
>{{ files.pdf.price }} <span class="text-h6 font-weight-normal">GEM</span></span>
</v-btn>

<v-btn
v-if="files.pdf.exist"
v-if="files.word.exist"
rounded="pill"
class="width-btn btn-pdf d-flex align-center justify-center"
color="#f0443835"
class="width-btn btn-word d-flex align-center justify-center"
color="#2e90fa35"
flat
height="42"
:loading="isDownloading('pdf')"
@click="handleDownloadClick('pdf', files.pdf.price)"
:loading="isDownloading('word')"
@click="handleDownloadClick('word', files.word.price)"
>
<template #loader>
<v-progress-circular
:model-value="getDownloadProgress('pdf')"
color="#f04438"
:model-value="getDownloadProgress('word')"
color="#2e90fa"
size="24"
width="3"
/>
</template>
<v-icon
color="#f04438"
color="#2e90fa"
size="20"
>
md:picture_as_pdf_outlined
md:description_outlined
</v-icon>
<span class="text-pdf text-h5 font-weight-bold mt-1 mx-2">Download Question Paper</span>
<span class="text-word text-h5 font-weight-bold mt-1 mx-2">Download {{ isPaper ? 'Question Doc': 'DOC' }}</span>

<span
v-if="files.pdf.price && files.pdf.price != 0"
class="text-pdf text-h5 font-weight-bold mt-1"
>{{ files.pdf.price }} <span class="text-h6 font-weight-normal">GEM</span></span>
v-if="files.word.price && files.word.price !=0"
class="text-word text-h5 font-weight-bold mt-1"
>{{ files.word.price }} <span class="text-h6 font-weight-normal">GEM</span></span>
</v-btn>

<v-btn
Expand Down Expand Up @@ -258,6 +258,7 @@ interface IDownloadAndPurchaseButtons {
base: string
lesson: string
testType: string
isPaper: boolean
}

type TypeFile = 'word' | 'pdf' | 'answer' | 'extra'
Expand Down
48 changes: 24 additions & 24 deletions app/components/common/detail/PreviewActionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</template>

<script setup lang="ts">
import type { ApiResult, PDFResponseDTO } from '@/types'
// import type { ApiResult, PDFResponseDTO } from '@/types'

interface IPreviewActionCard {
thumbPic: string
Expand All @@ -96,35 +96,35 @@ const props = withDefaults(defineProps<IPreviewActionCard>(), {
})
const emit = defineEmits(['share'])

const previewDialog = ref(false)
const previewPdfUrl = ref('')
const previewFileName = ref('')
const previewTitle = ref('')
// const previewDialog = ref(false)
// const previewPdfUrl = ref('')
// const previewFileName = ref('')
// const previewTitle = ref('')

const openWebPDF = async () => {
if (!props.id) {
console.warn('No paper ID provided for PDF preview')
return
}

try {
const response = await useApiService.get<ApiResult<PDFResponseDTO>>(
`/api/v1/tests/download/${props.id}/pdf`,
)
// try {
// const response = await useApiService.get<ApiResult<PDFResponseDTO>>(
// `/api/v1/tests/download/${props.id}/pdf`,
// )

if (response.status === 1 && response.data?.url) {
previewPdfUrl.value = response.data.url
previewFileName.value = response.data.name || 'document.pdf'
previewTitle.value = props.title || 'PDF Preview'
previewDialog.value = true
}
else {
console.error('Unable to load PDF preview')
}
}
catch (err) {
console.error('Error loading PDF preview:', err)
}
// if (response.status === 1 && response.data?.url) {
// previewPdfUrl.value = response.data.url
// previewFileName.value = response.data.name || 'document.pdf'
// previewTitle.value = props.title || 'PDF Preview'
// previewDialog.value = true
// }
// else {
// console.error('Unable to load PDF preview')
// }
// }
// catch (err) {
// console.error('Error loading PDF preview:', err)
// }
}

const shareContent = () => {
Expand All @@ -138,8 +138,8 @@ const shareContent = () => {
border: 1px solid #f2f4f7;
max-width: 360px;
height: 100%;
/* min-height: 400px; */
max-height: 500px;
min-height: 400px;
max-height: 400px;
}
.button-div {
min-width: 60px;
Expand Down
2 changes: 1 addition & 1 deletion app/components/common/modal/auth/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
>
<template #label>
<span class="text-h6 text-grey700">
<span class="font-weight-bold">A agree</span>
<span class="font-weight-bold">I agree</span>
<span class="font-weight-bold text-primary"> terms and conditions</span>
</span>
</template>
Expand Down
8 changes: 5 additions & 3 deletions app/components/user/wallet/TransactionHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<div
class="text-grey700 text-h6 d-flex justify-center align-center font-weight-bold text-center ga-1"
>
{{ $numberFormat(item.points) }}<span class="text-subtitle-1 text-grey500 font-weight-regular">GEM</span>
{{ $numberFormat(item.points) }}<span class="text-subtitle-1 text-grey500 font-weight-regular">{{ item.points > 1 ? 'GEMS' : 'GEM' }}</span>
</div>
</template>
<template #[`item.isDebit`]="{ item }">
Expand Down Expand Up @@ -303,8 +303,9 @@ const getData = async () => {
}
else {
return {
list: [],
list: [] as TransactionDTO[],
totalRecordsCount: 0,
num: 0,
}
}
}
Expand All @@ -314,8 +315,9 @@ const getData = async () => {
$toast.error(error.response.data?.message || '')
}
return {
list: [],
list: [] as TransactionDTO[],
totalRecordsCount: 0,
num: 0,
}
}
finally {
Expand Down
1 change: 1 addition & 0 deletions app/pages/paper/[id]/[[slug]].vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
:lesson="contentData.lesson"
:exams="contentData.exams"
:test-type="contentData.test_type"
:is-paper="contentData.is_paper"
/>
<lazy-common-detail-subject-directory-nav :content-data="contentData" />
</v-col>
Expand Down
Loading