change responsive]

This commit is contained in:
2026-05-31 11:51:52 +03:30
parent 06568c5858
commit 023b8ee5be
124 changed files with 6296 additions and 4233 deletions
@@ -0,0 +1,72 @@
<template>
<MobileCardList
v-model:search="search"
:loading="loading"
:has-more="hasMore"
:show-empty="!loading && items.length === 0"
empty-text="کارت هدیه‌ای یافت نشد"
search-placeholder="جستجو کارت هدیه"
show-refresh
@search="reload"
@refresh="reload"
@load-more="loadMore"
>
<GiftCardMobileListItem
v-for="item in items"
:key="item.id"
:item="item"
:hide-customer="!!customerId"
@open="openSheet"
@gift-card-codes="$emit('giftCardCodes', $event)"
/>
</MobileCardList>
<GiftCardMobileDetailSheet v-model:visible="sheetVisible" :item="selectedItem" />
</template>
<script setup lang="ts">
import { getGiftCardTable } from '@/api/giftCard'
import type { Giftcard } from '@/model/giftCard'
import MobileCardList from '@/components/mobile/MobileCardList.vue'
import { useMobileDetailSheet } from '@/components/mobile/composables/useMobileDetailSheet'
import { useMobileTableList } from '@/components/mobile/composables/useMobileTableList'
import type { TableInput } from '@core/type/baseTable'
import GiftCardMobileDetailSheet from './GiftCardMobileDetailSheet.vue'
import GiftCardMobileListItem from './GiftCardMobileListItem.vue'
type GiftCardRow = Giftcard & { customer?: { name?: string; mobile?: string } }
const props = defineProps<{
customerId?: number
}>()
defineEmits<{
(e: 'giftCardCodes', item: GiftCardRow): void
}>()
const { sheetVisible, selectedItem, openSheet, syncSelectedItem } = useMobileDetailSheet<GiftCardRow>()
function fetchGiftCards(params: TableInput) {
if (props.customerId) {
params.filters = params.filters ?? []
params.filters.push({
field: 'customer_id',
type: 'text',
value: props.customerId,
cr: 'and',
op: 'eq',
hidden: false
})
}
return getGiftCardTable(params)
}
const { loading, search, items, hasMore, reload, loadMore, fetch } = useMobileTableList<GiftCardRow>({
fetchApi: fetchGiftCards,
onFetched: (rows) => syncSelectedItem(rows)
})
onMounted(() => reload())
defineExpose({ fetch, openSheet })
</script>