gift card export, new category, login theme fix

This commit is contained in:
2026-09-20 17:25:25 +03:30
parent 7ff90b05d0
commit 8004dd52b3
6 changed files with 359 additions and 13 deletions
@@ -11,7 +11,33 @@
@cancel="close"
@close="close"
>
<div v-if="isMobile" class="mb-3 text-base font-700">لیست کدهای کارت هدیه</div>
<div class="mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
<div class="min-w-0">
<p class="m-0 text-13px text-[var(--admin-text-secondary)]">
{{ codes.length }} کد — دانلود به صورت اکسل یا PDF
</p>
</div>
<a-dropdown
:trigger="['click']"
placement="bottomLeft"
:overlay-style="{ zIndex: SELECT_DROPDOWN_Z_INDEX }"
>
<BaseButton
type="default"
size="small"
icon="vuesax-linear:document-download"
:disabled="!codes.length"
>
دانلود
</BaseButton>
<template #overlay>
<a-menu @click="handleDownload">
<a-menu-item key="excel">اکسل (CSV)</a-menu-item>
<a-menu-item key="pdf">PDF</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</div>
<a-table
class="hidden md:block"
@@ -63,19 +89,25 @@
</template>
<script setup lang="ts">
import type { Giftcardcode } from '@/model/giftCard'
import type { Giftcard, Giftcardcode } from '@/model/giftCard'
import BasicActionSheet from '@/components/BasicActionSheet.vue'
import CustomTag from '@/components/CustomTag.vue'
import { useMobileDetailSheet } from '@/components/mobile/composables/useMobileDetailSheet'
import { isMobile } from '@core/utils/is'
import { metalLabel } from '@/utils/adminMetalLabels'
import { toJalali } from '@core/utils/useDataTime'
import GiftCardCodeMobileDetailSheet from './GiftCardCodeMobileDetailSheet.vue'
import GiftCardCodeMobileListItem from './GiftCardCodeMobileListItem.vue'
import {
downloadGiftCardCodesExcel,
downloadGiftCardCodesPdf,
type GiftCardCodesExportMeta
} from '../utils/exportGiftCardCodes'
import { SELECT_DROPDOWN_Z_INDEX } from '@/constants/overlayZIndex'
const props = defineProps<{
visible: boolean
codes: Giftcardcode[]
giftCard?: Giftcard | null
}>()
const emit = defineEmits<{
@@ -104,4 +136,24 @@ const columns = [
function close() {
visibleProxy.value = false
}
const exportMeta = computed<GiftCardCodesExportMeta>(() => ({
id: props.giftCard?.id,
unit: props.giftCard?.unit,
count: props.giftCard?.count,
customerName: (props.giftCard as Giftcard & { customer?: { name?: string } })?.customer?.name,
customerMobile: (props.giftCard as Giftcard & { customer?: { mobile?: string } })?.customer?.mobile,
createdAt: props.giftCard?.created_at
}))
function handleDownload({ key }: { key: string }) {
if (!props.codes.length) return
if (key === 'excel') {
downloadGiftCardCodesExcel(props.codes, exportMeta.value)
return
}
if (key === 'pdf') {
downloadGiftCardCodesPdf(props.codes, exportMeta.value)
}
}
</script>