diff --git a/src/model/giftCard.ts b/src/model/giftCard.ts index 2469ade..644b62f 100644 --- a/src/model/giftCard.ts +++ b/src/model/giftCard.ts @@ -1,6 +1,16 @@ +export interface GiftcardCustomer { + id: number + name: string + mobile: string +} + export interface Giftcard { id: number customer_id: any + name?: string + mobile?: string + customer?: GiftcardCustomer + show_in_app?: number | boolean count: number amount: number total: number @@ -35,9 +45,14 @@ export interface AssignedTo { mobile: string } +export type GiftCardAssignMode = 'customer' | 'public' + export interface GiftcardInput { - mobile: string - name: string + assignMode: GiftCardAssignMode + customer_id?: number + show_in_app?: number + mobile?: string + name?: string count: number amount: number unit: string diff --git a/src/pages/menuPages/giftCards/components/GiftCardCodesSheet.vue b/src/pages/menuPages/giftCards/components/GiftCardCodesSheet.vue index 222afa5..e66de5b 100644 --- a/src/pages/menuPages/giftCards/components/GiftCardCodesSheet.vue +++ b/src/pages/menuPages/giftCards/components/GiftCardCodesSheet.vue @@ -12,7 +12,13 @@ @close="close" >
-
+
+

+ مشتری: {{ giftCardCustomer.name }} — {{ giftCardCustomer.mobile }} +

+

+ کد عمومی — بدون مشتری مشخص +

{{ codes.length }} کد — دانلود به صورت اکسل یا PDF

@@ -102,6 +108,7 @@ import { downloadGiftCardCodesPdf, type GiftCardCodesExportMeta } from '../utils/exportGiftCardCodes' +import { resolveGiftCardCustomer } from '../utils/giftCardCustomer' import { SELECT_DROPDOWN_Z_INDEX } from '@/constants/overlayZIndex' const props = defineProps<{ @@ -129,20 +136,22 @@ const columns = [ { title: 'وضعیت', dataIndex: 'sts', key: 'sts' }, { title: 'تاریخ انقضا', dataIndex: 'expiry_date', key: 'expiry_date' }, { title: 'تاریخ استفاده', dataIndex: 'used_at', key: 'used_at' }, - { title: 'نام کاربر اختصاص داده شده', dataIndex: 'assigned_to.name', key: 'assigned_to_name' }, - { title: 'شماره موبایل کاربر اختصاص داده شده', dataIndex: 'assigned_to.mobile', key: 'assigned_to_mobile' } + { title: 'نام استفاده‌کننده', dataIndex: 'assigned_to.name', key: 'assigned_to_name' }, + { title: 'موبایل استفاده‌کننده', dataIndex: 'assigned_to.mobile', key: 'assigned_to_mobile' } ] function close() { visibleProxy.value = false } +const giftCardCustomer = computed(() => resolveGiftCardCustomer(props.giftCard)) + const exportMeta = computed(() => ({ 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, + customerName: giftCardCustomer.value?.name, + customerMobile: giftCardCustomer.value?.mobile, createdAt: props.giftCard?.created_at })) diff --git a/src/pages/menuPages/giftCards/components/GiftCardEditorFormBody.vue b/src/pages/menuPages/giftCards/components/GiftCardEditorFormBody.vue index ea7ff8a..4af2b3f 100644 --- a/src/pages/menuPages/giftCards/components/GiftCardEditorFormBody.vue +++ b/src/pages/menuPages/giftCards/components/GiftCardEditorFormBody.vue @@ -1,25 +1,48 @@