80 lines
3.1 KiB
Vue
80 lines
3.1 KiB
Vue
<template>
|
|
<div class="h-full min-h-0 min-w-0 max-w-full overflow-hidden">
|
|
<BasicShowContext title="پکیجهای قیمت ویژه" :help="specialPricePageIntro">
|
|
<template v-if="isMobile" #extra>
|
|
<BaseButton type="primary" size="small" icon="vuesax-linear:add" @click="emits('add')">
|
|
افزودن
|
|
</BaseButton>
|
|
</template>
|
|
|
|
<BaseTable v-bind="tblProps" @register="submit" class="h-full min-h-0">
|
|
<template #extraHeader>
|
|
<BaseButton type="primary" size="small" icon="vuesax-linear:add" @click="emits('add')">
|
|
افزودن پکیج
|
|
</BaseButton>
|
|
</template>
|
|
<template #action="{ record }">
|
|
<div class="flex items-center justify-center gap-2">
|
|
<a-tooltip v-if="can('edit')" placement="bottom" class="cursor-pointer" @click="emits('edit', record)">
|
|
<template #title><span>ویرایش</span></template>
|
|
<Icon icon="vuesax-linear:edit-2" color="#4572E9" />
|
|
</a-tooltip>
|
|
<a-tooltip v-if="can('toggle')" placement="bottom" class="cursor-pointer" @click="emits('toggle', record)">
|
|
<template #title>
|
|
<span>{{ record.is_active ? 'غیرفعال کردن' : 'فعال کردن' }}</span>
|
|
</template>
|
|
<Icon
|
|
:icon="record.is_active ? 'vuesax-linear:toggle-on-circle' : 'vuesax-linear:toggle-off-circle'"
|
|
:color="record.is_active ? '#54AD06' : '#ad0627'"
|
|
/>
|
|
</a-tooltip>
|
|
<a-popconfirm
|
|
v-if="can('delete')"
|
|
title="پکیج حذف شود؟"
|
|
ok-text="تایید"
|
|
cancel-text="انصراف"
|
|
@confirm="emits('delete', record)"
|
|
>
|
|
<a-tooltip placement="bottom" class="cursor-pointer">
|
|
<template #title><span>حذف</span></template>
|
|
<Icon icon="vuesax-linear:trash" color="#C53030" />
|
|
</a-tooltip>
|
|
</a-popconfirm>
|
|
</div>
|
|
</template>
|
|
</BaseTable>
|
|
</BasicShowContext>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { TableInput } from '@core/type/baseTable'
|
|
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
|
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
|
import BasicShowContext from '@/components/BasicShowContext.vue'
|
|
import { getCustomerSpecialPricePackageTable } from '@/api/customerSpecialPrice'
|
|
import { getSpecialPricePackageColumns } from '../hooks/specialPriceColumns'
|
|
import { isMobile } from '@core/utils/is'
|
|
import { ref } from 'vue'
|
|
import { specialPricePageIntro } from '@/utils/adminHelpCopy'
|
|
import { usePageActionAccess } from '@/composables/usePageActionAccess'
|
|
|
|
const { can } = usePageActionAccess()
|
|
|
|
const emits = defineEmits<{
|
|
(e: 'add'): void
|
|
(e: 'edit', record: any): void
|
|
(e: 'toggle', record: any): void
|
|
(e: 'delete', record: any): void
|
|
}>()
|
|
|
|
const [submit, reload] = useBaseTable()
|
|
|
|
const tblProps = ref({
|
|
columns: getSpecialPricePackageColumns(),
|
|
api: (params: TableInput) => getCustomerSpecialPricePackageTable(params)
|
|
})
|
|
|
|
defineExpose({ fetch: reload })
|
|
</script>
|