Improve Leads list filters and mobile toolbar layout.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+422
-373
@@ -114,54 +114,13 @@ const FOLLOW_UP_OPTIONS: Array<{ value: FollowUpKey; label: string }> = [
|
||||
];
|
||||
const UNASSIGNED_VALUE = '__unassigned__';
|
||||
|
||||
/** ردیف آمار صفحه لیدها — ترتیب و نامها مطابق طرح */
|
||||
const LEAD_STAT_DEFS: Array<{
|
||||
label: string;
|
||||
/** نام وضعیتهای متناظر در دیتابیس */
|
||||
match: string[];
|
||||
tint: StageTint;
|
||||
slot: 'pair' | 'solo';
|
||||
}> = [
|
||||
{
|
||||
label: 'جدید',
|
||||
match: ['جدید'],
|
||||
tint: 'amber',
|
||||
slot: 'pair',
|
||||
},
|
||||
{
|
||||
label: 'در حال پیگیری',
|
||||
match: ['در حال پیگیری', 'پیگیری مجدد', 'تماس اولیه', 'تماس موفق'],
|
||||
tint: 'peach',
|
||||
slot: 'pair',
|
||||
},
|
||||
{
|
||||
label: 'مذاکره',
|
||||
match: ['مذاکره'],
|
||||
tint: 'mint',
|
||||
slot: 'solo',
|
||||
},
|
||||
{
|
||||
label: 'آماده خرید',
|
||||
match: ['آماده خرید'],
|
||||
tint: 'violet',
|
||||
slot: 'solo',
|
||||
},
|
||||
{
|
||||
label: 'عدم پاسخ',
|
||||
match: ['عدم پاسخ'],
|
||||
tint: 'rose',
|
||||
slot: 'solo',
|
||||
},
|
||||
];
|
||||
|
||||
type LeadStatCard = {
|
||||
key: string;
|
||||
label: string;
|
||||
tint: StageTint;
|
||||
count: number;
|
||||
/** مرحله اصلی برای فیلتر */
|
||||
/** شناسهٔ واقعی ستون برای فیلتر */
|
||||
stageId: string;
|
||||
slot: 'pair' | 'solo';
|
||||
};
|
||||
|
||||
const route = useRoute();
|
||||
@@ -342,11 +301,12 @@ function toggleFilterSection(name: NonNullable<typeof filterSection.value>) {
|
||||
|
||||
const filterAnchor = ref<HTMLElement | null>(null);
|
||||
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
||||
const filterPanelPos = ref({ top: 0, inlineEnd: 8 });
|
||||
|
||||
const filterPanelStyle = computed(() => ({
|
||||
position: 'absolute' as const,
|
||||
top: 'calc(100% + 6px)',
|
||||
insetInlineStart: '0',
|
||||
position: 'fixed' as const,
|
||||
top: `${filterPanelPos.value.top}px`,
|
||||
insetInlineEnd: `${filterPanelPos.value.inlineEnd}px`,
|
||||
zIndex: 1050,
|
||||
width: 'min(20rem, calc(100vw - 1.5rem))',
|
||||
maxHeight: filterPopoverMaxHeight.value,
|
||||
@@ -360,13 +320,19 @@ const filterPanelStyle = computed(() => ({
|
||||
function placeFilterPopover() {
|
||||
const el = filterAnchor.value;
|
||||
if (!el) return;
|
||||
const space = Math.floor(window.innerHeight - el.getBoundingClientRect().bottom - 12);
|
||||
const rect = el.getBoundingClientRect();
|
||||
const space = Math.floor(window.innerHeight - rect.bottom - 12);
|
||||
filterPopoverMaxHeight.value = `${Math.max(220, space)}px`;
|
||||
filterPanelPos.value = {
|
||||
top: rect.bottom + 6,
|
||||
inlineEnd: Math.max(8, Math.round(window.innerWidth - rect.right)),
|
||||
};
|
||||
}
|
||||
|
||||
function onFilterDocPointer(event: Event) {
|
||||
const target = event.target;
|
||||
if (!(target instanceof Node)) return;
|
||||
if (target instanceof Element && target.closest('[data-lead-filter]')) return;
|
||||
if (filterAnchor.value?.contains(target)) return;
|
||||
if (document.getElementById('jalali-picker')?.contains(target)) return;
|
||||
moreFiltersOpen.value = false;
|
||||
@@ -556,23 +522,15 @@ const sortLabels: Record<SortKey, string> = {
|
||||
last_contact: 'آخرین تماس',
|
||||
};
|
||||
|
||||
/** چیپهای فیلتر = ستونهای واقعی سازمان (نه نامهای ثابت قدیمی) */
|
||||
const stageCards = computed((): LeadStatCard[] => {
|
||||
return LEAD_STAT_DEFS.map((def) => {
|
||||
const matched = stages.value.filter((s) =>
|
||||
def.match.some((name) => s.name.trim() === name),
|
||||
);
|
||||
const count = matched.reduce((sum, s) => sum + (s.leadCount ?? 0), 0);
|
||||
const primary =
|
||||
matched.find((s) => s.name.trim() === def.match[0]) ?? matched[0];
|
||||
return {
|
||||
key: def.label,
|
||||
label: def.label,
|
||||
tint: def.tint,
|
||||
count,
|
||||
stageId: primary?.id ?? '',
|
||||
slot: def.slot,
|
||||
};
|
||||
});
|
||||
return stages.value.map((s) => ({
|
||||
key: s.id,
|
||||
label: s.name,
|
||||
tint: stageTint(s.color),
|
||||
count: s.leadCount ?? 0,
|
||||
stageId: s.id,
|
||||
}));
|
||||
});
|
||||
|
||||
const totalLeadsCount = computed(() => {
|
||||
@@ -580,22 +538,24 @@ const totalLeadsCount = computed(() => {
|
||||
return stages.value.reduce((sum, s) => sum + (s.leadCount ?? 0), 0) || total.value;
|
||||
});
|
||||
|
||||
/** گزینههای سلکت موبایل — برچسب + تعداد */
|
||||
const stageFilterOptions = computed(() => [
|
||||
{
|
||||
value: '',
|
||||
label: `همه لیدها (${formatCount(totalLeadsCount.value)})`,
|
||||
},
|
||||
...stageCards.value.map((card) => ({
|
||||
value: card.stageId,
|
||||
label: `${card.label} (${formatCount(card.count)})`,
|
||||
})),
|
||||
]);
|
||||
|
||||
function isStatActive(card: LeadStatCard) {
|
||||
if (!card.stageId || !stageId.value) return false;
|
||||
if (stageId.value === card.stageId) return true;
|
||||
const def = LEAD_STAT_DEFS.find((d) => d.label === card.label);
|
||||
if (!def) return false;
|
||||
const matchedIds = stages.value
|
||||
.filter((s) => def.match.some((name) => s.name.trim() === name))
|
||||
.map((s) => s.id);
|
||||
return matchedIds.includes(stageId.value);
|
||||
return Boolean(card.stageId && stageId.value === card.stageId);
|
||||
}
|
||||
|
||||
function selectStatCard(card: LeadStatCard) {
|
||||
if (!card.stageId) {
|
||||
setStageFilter('');
|
||||
return;
|
||||
}
|
||||
if (!card.stageId) return;
|
||||
setStageFilter(isStatActive(card) ? '' : card.stageId);
|
||||
}
|
||||
|
||||
@@ -1586,14 +1546,36 @@ onBeforeUnmount(() => {
|
||||
<template>
|
||||
<a-row :gutter="[16, 16]" align="top" :style="{ alignContent: 'flex-start' }" @click="closePopups">
|
||||
<a-col :span="24">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
|
||||
<a-flex
|
||||
v-if="isMobile"
|
||||
vertical
|
||||
:gap="8"
|
||||
:style="{ width: '100%' }"
|
||||
>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||
<a-space :size="8" wrap>
|
||||
<template v-if="isMobile">
|
||||
<a-flex :gap="8" align="center" :style="{ width: '100%' }">
|
||||
<div :style="{ flex: '1 1 0%', minWidth: 0 }">
|
||||
<a-button block type="primary" @click.stop="openCreate">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
جدید
|
||||
</a-button>
|
||||
</div>
|
||||
<a-radio-group
|
||||
value="list"
|
||||
button-style="solid"
|
||||
@change="(e: any) => { if (e?.target?.value === 'board') void router.push({ name: 'leads-board' }) }"
|
||||
>
|
||||
<a-radio-button value="list">
|
||||
<UnorderedListOutlined />
|
||||
</a-radio-button>
|
||||
<a-radio-button value="board">
|
||||
<AppstoreOutlined />
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
<div :style="{ flex: '0 0 auto' }">
|
||||
<a-dropdown :trigger="['click']" placement="bottomLeft">
|
||||
<a-button :disabled="busy">
|
||||
<a-button :disabled="busy" aria-label="بیشتر">
|
||||
<template #icon><MoreOutlined /></template>
|
||||
بیشتر
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
@@ -1641,92 +1623,196 @@ onBeforeUnmount(() => {
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-button :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
<ExcelImportFlow
|
||||
preview-path="/leads/import/preview"
|
||||
import-path="/leads/import/file"
|
||||
:disabled="busy"
|
||||
@start="onExcelImportStart"
|
||||
@done="onExcelImportDone"
|
||||
@fail="onExcelImportFail"
|
||||
@settled="onExcelImportSettled"
|
||||
>
|
||||
<template #default="{ loading: excelLoading }">
|
||||
<a-button :disabled="busy" :loading="excelLoading">
|
||||
<template #icon><FileExcelOutlined /></template>
|
||||
ورود از اکسل
|
||||
</a-button>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<PhoneContactsImport
|
||||
target="leads"
|
||||
:disabled="busy"
|
||||
@start="onPhoneImportStart"
|
||||
@done="onPhoneImportDone"
|
||||
@fail="onPhoneImportFail"
|
||||
@settled="onPhoneImportSettled"
|
||||
>
|
||||
<a-button :disabled="busy">
|
||||
<template #icon><PhoneOutlined /></template>
|
||||
از مخاطبین گوشی
|
||||
</a-button>
|
||||
</PhoneContactsImport>
|
||||
</template>
|
||||
<a-radio-group
|
||||
v-if="isMobile"
|
||||
value="list"
|
||||
button-style="solid"
|
||||
@change="(e: any) => { if (e?.target?.value === 'board') void router.push({ name: 'leads-board' }) }"
|
||||
</div>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
<a-flex
|
||||
v-else
|
||||
justify="space-between"
|
||||
align="center"
|
||||
wrap="wrap"
|
||||
:gap="token.marginSM"
|
||||
>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||
<a-space :size="8" wrap>
|
||||
<a-button :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
<ExcelImportFlow
|
||||
preview-path="/leads/import/preview"
|
||||
import-path="/leads/import/file"
|
||||
:disabled="busy"
|
||||
@start="onExcelImportStart"
|
||||
@done="onExcelImportDone"
|
||||
@fail="onExcelImportFail"
|
||||
@settled="onExcelImportSettled"
|
||||
>
|
||||
<a-radio-button value="list">
|
||||
<UnorderedListOutlined />
|
||||
</a-radio-button>
|
||||
<a-radio-button value="board">
|
||||
<AppstoreOutlined />
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
<template #default="{ loading: excelLoading }">
|
||||
<a-button :disabled="busy" :loading="excelLoading">
|
||||
<template #icon><FileExcelOutlined /></template>
|
||||
ورود از اکسل
|
||||
</a-button>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<PhoneContactsImport
|
||||
target="leads"
|
||||
:disabled="busy"
|
||||
@start="onPhoneImportStart"
|
||||
@done="onPhoneImportDone"
|
||||
@fail="onPhoneImportFail"
|
||||
@settled="onPhoneImportSettled"
|
||||
>
|
||||
<a-button :disabled="busy">
|
||||
<template #icon><PhoneOutlined /></template>
|
||||
از مخاطبین گوشی
|
||||
</a-button>
|
||||
</PhoneContactsImport>
|
||||
<a-button type="primary" @click.stop="openCreate">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
{{ isMobile ? 'جدید' : 'لید جدید' }}
|
||||
لید جدید
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24" @click.stop>
|
||||
<a-card :bordered="true">
|
||||
<a-flex vertical :gap="12">
|
||||
<a-flex v-if="!isMobile" justify="space-between" align="center" wrap="wrap" :gap="8">
|
||||
<a-flex wrap="wrap" :gap="8" align="center" flex="1 1 auto">
|
||||
<a-button :type="!stageId ? 'primary' : 'default'" @click="setStageFilter('')">
|
||||
همه لیدها
|
||||
<a-typography-text
|
||||
:type="!stageId ? undefined : 'secondary'"
|
||||
:style="{ color: !stageId ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
||||
>
|
||||
{{ formatCount(totalLeadsCount) }}
|
||||
</a-typography-text>
|
||||
</a-button>
|
||||
<a-button
|
||||
v-for="card in stageCards"
|
||||
:key="card.key"
|
||||
:type="isStatActive(card) ? 'primary' : 'default'"
|
||||
:disabled="!card.stageId"
|
||||
@click="selectStatCard(card)"
|
||||
<a-flex vertical :gap="8">
|
||||
<a-flex v-if="!isMobile" wrap="wrap" :gap="8" align="center">
|
||||
<a-button :type="!stageId ? 'primary' : 'default'" @click="setStageFilter('')">
|
||||
همه لیدها
|
||||
<a-typography-text
|
||||
:type="!stageId ? undefined : 'secondary'"
|
||||
:style="{ color: !stageId ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
||||
>
|
||||
{{ card.label }}
|
||||
{{ formatCount(totalLeadsCount) }}
|
||||
</a-typography-text>
|
||||
</a-button>
|
||||
<a-button
|
||||
v-for="card in stageCards"
|
||||
:key="card.key"
|
||||
:type="isStatActive(card) ? 'primary' : 'default'"
|
||||
@click="selectStatCard(card)"
|
||||
>
|
||||
{{ card.label }}
|
||||
<a-typography-text
|
||||
:type="isStatActive(card) ? undefined : 'secondary'"
|
||||
:style="{ color: isStatActive(card) ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
||||
>
|
||||
{{ formatCount(card.count) }}
|
||||
</a-typography-text>
|
||||
</a-button>
|
||||
</a-flex>
|
||||
|
||||
<a-flex
|
||||
v-if="isMobile"
|
||||
:wrap="false"
|
||||
:gap="8"
|
||||
align="center"
|
||||
:style="{ width: '100%' }"
|
||||
>
|
||||
<div :style="{ flex: '1 1 0%', minWidth: 0 }">
|
||||
<a-select
|
||||
:value="stageId"
|
||||
style="width: 100%"
|
||||
:options="stageFilterOptions"
|
||||
@update:value="(v) => setStageFilter(String(v ?? ''))"
|
||||
/>
|
||||
</div>
|
||||
<div :style="{ flex: '1 1 0%', minWidth: 0 }">
|
||||
<a-select
|
||||
:value="sort"
|
||||
style="width: 100%"
|
||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
|
||||
<!-- موبایل: جستجو + آیکن فیلتر داخل یک باکس (مثل مخاطبین) -->
|
||||
<a-input
|
||||
v-if="isMobile"
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="جستجو نام، موبایل، شهر…"
|
||||
style="width: 100%"
|
||||
@pressEnter="onSearch"
|
||||
>
|
||||
<template #prefix>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
<template #suffix>
|
||||
<span
|
||||
ref="filterAnchor"
|
||||
:style="{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: '4px',
|
||||
color: mobileFilterBadgeCount ? token.colorPrimary : token.colorTextSecondary,
|
||||
}"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="فیلتر"
|
||||
@click.stop="toggleFilterPopover"
|
||||
@keydown.enter.prevent="toggleFilterPopover"
|
||||
>
|
||||
<FilterOutlined />
|
||||
<a-typography-text
|
||||
:type="isStatActive(card) ? undefined : 'secondary'"
|
||||
:style="{ color: isStatActive(card) ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
||||
v-if="mobileFilterBadgeCount"
|
||||
:style="{ color: 'inherit', fontSize: `${token.fontSizeSM}px` }"
|
||||
>
|
||||
{{ formatCount(card.count) }}
|
||||
{{ toFaDigits(mobileFilterBadgeCount) }}
|
||||
</a-typography-text>
|
||||
</a-button>
|
||||
</span>
|
||||
</template>
|
||||
</a-input>
|
||||
|
||||
<a-flex
|
||||
v-else
|
||||
justify="space-between"
|
||||
align="center"
|
||||
wrap="wrap"
|
||||
:gap="8"
|
||||
:style="{ width: '100%' }"
|
||||
>
|
||||
<a-flex wrap="wrap" align="center" :gap="8">
|
||||
<a-input-search
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="جستجو نام، موبایل، شهر…"
|
||||
style="width: 15rem; max-width: 100%"
|
||||
@search="onSearch"
|
||||
>
|
||||
<template #enterButton>
|
||||
<a-button type="primary">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-input-search>
|
||||
<div ref="filterAnchor" :style="{ position: 'relative', flex: '0 0 auto' }">
|
||||
<a-button
|
||||
:style="mobileFilterBadgeCount
|
||||
? {
|
||||
borderColor: token.colorPrimary,
|
||||
color: token.colorPrimary,
|
||||
background: token.colorPrimaryBg,
|
||||
}
|
||||
: undefined"
|
||||
@click.stop="toggleFilterPopover"
|
||||
>
|
||||
<a-flex align="center" justify="center" :gap="6">
|
||||
<FilterOutlined />
|
||||
<span>{{ filterBtnLabel }}</span>
|
||||
<DownOutlined />
|
||||
</a-flex>
|
||||
</a-button>
|
||||
</div>
|
||||
<a-select
|
||||
:value="sort"
|
||||
style="width: 10rem"
|
||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-space :size="8">
|
||||
<TableColumnsMenu table-key="leads" align="end" />
|
||||
@@ -1745,236 +1831,199 @@ onBeforeUnmount(() => {
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<a-flex :vertical="isMobile" align="center" wrap="wrap" :gap="8">
|
||||
<a-input-search
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="جستجو نام، موبایل، شهر…"
|
||||
:style="isMobile ? { width: '100%' } : { width: '15rem', maxWidth: '100%' }"
|
||||
@search="onSearch"
|
||||
>
|
||||
<template #enterButton>
|
||||
<a-button type="primary">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-input-search>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
ref="filterAnchor"
|
||||
:style="{ position: 'relative', width: isMobile ? '100%' : undefined }"
|
||||
v-if="moreFiltersOpen"
|
||||
data-lead-filter
|
||||
:style="filterPanelStyle"
|
||||
@click.stop
|
||||
>
|
||||
<a-button
|
||||
:block="isMobile"
|
||||
:style="mobileFilterBadgeCount
|
||||
? {
|
||||
borderColor: token.colorPrimary,
|
||||
color: token.colorPrimary,
|
||||
background: token.colorPrimaryBg,
|
||||
}
|
||||
: undefined"
|
||||
@click.stop="toggleFilterPopover"
|
||||
>
|
||||
<a-flex align="center" justify="center" :gap="6">
|
||||
<FilterOutlined />
|
||||
<span>{{ filterBtnLabel }}</span>
|
||||
<DownOutlined />
|
||||
</a-flex>
|
||||
</a-button>
|
||||
<div v-if="moreFiltersOpen" data-lead-filter :style="filterPanelStyle" @click.stop>
|
||||
<a-flex vertical :gap="10">
|
||||
<div v-for="facet in textFacets" :key="facet.key">
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection(facet.key)"
|
||||
@keydown.enter.prevent="toggleFilterSection(facet.key)"
|
||||
<a-flex vertical :gap="10">
|
||||
<div v-for="facet in textFacets" :key="facet.key">
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection(facet.key)"
|
||||
@keydown.enter.prevent="toggleFilterSection(facet.key)"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>{{ facet.label }}</span>
|
||||
<a-typography-text :style="facetValueStyle(facet.active)">
|
||||
{{ facet.value }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-flex
|
||||
v-if="filterSection === facet.key"
|
||||
vertical
|
||||
:gap="4"
|
||||
:style="{ marginTop: '6px' }"
|
||||
>
|
||||
<a-input
|
||||
v-if="facet.searchable"
|
||||
v-model:value="filterQuery"
|
||||
allow-clear
|
||||
placeholder="جستجو"
|
||||
/>
|
||||
<div :style="{ maxHeight: '11.5rem', overflow: 'auto' }">
|
||||
<a-button
|
||||
v-for="option in visibleFacetOptions(facet.options).options"
|
||||
:key="option.value || 'all'"
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(facet.current === option.value)"
|
||||
@click="pickFacet(facet.key, option.value)"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>{{ facet.label }}</span>
|
||||
<a-typography-text :style="facetValueStyle(facet.active)">
|
||||
{{ facet.value }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-flex
|
||||
v-if="filterSection === facet.key"
|
||||
vertical
|
||||
:gap="4"
|
||||
:style="{ marginTop: '6px' }"
|
||||
{{ option.label }}
|
||||
</a-button>
|
||||
<a-typography-text
|
||||
v-if="visibleFacetOptions(facet.options).empty"
|
||||
type="secondary"
|
||||
>
|
||||
<a-input
|
||||
v-if="facet.searchable"
|
||||
v-model:value="filterQuery"
|
||||
allow-clear
|
||||
placeholder="جستجو"
|
||||
/>
|
||||
<div :style="{ maxHeight: '11.5rem', overflow: 'auto' }">
|
||||
<a-button
|
||||
v-for="option in visibleFacetOptions(facet.options).options"
|
||||
:key="option.value || 'all'"
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(facet.current === option.value)"
|
||||
@click="pickFacet(facet.key, option.value)"
|
||||
>
|
||||
{{ option.label }}
|
||||
</a-button>
|
||||
<a-typography-text
|
||||
v-if="visibleFacetOptions(facet.options).empty"
|
||||
type="secondary"
|
||||
>
|
||||
موردی پیدا نشد
|
||||
</a-typography-text>
|
||||
</div>
|
||||
<a-typography-text
|
||||
v-if="visibleFacetOptions(facet.options).hidden"
|
||||
type="secondary"
|
||||
>
|
||||
برای دیدن بقیه، نام را دقیقتر بنویسید
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
موردی پیدا نشد
|
||||
</a-typography-text>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('createdFrom')"
|
||||
@keydown.enter.prevent="toggleFilterSection('createdFrom')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>از تاریخ ثبت</span>
|
||||
<a-typography-text :style="facetValueStyle(Boolean(createdFromFilter))">
|
||||
{{ dateFacetLabel(createdFromFilter) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<div v-if="filterSection === 'createdFrom'" :style="{ marginTop: '6px' }">
|
||||
<JalaliDateInput
|
||||
:model-value="createdFromFilter"
|
||||
placeholder="از تاریخ"
|
||||
@update:model-value="(value: string) => { setCreatedFromFilter(value); filterSection = null }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('createdTo')"
|
||||
@keydown.enter.prevent="toggleFilterSection('createdTo')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>تا تاریخ ثبت</span>
|
||||
<a-typography-text :style="facetValueStyle(Boolean(createdToFilter))">
|
||||
{{ dateFacetLabel(createdToFilter) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<div v-if="filterSection === 'createdTo'" :style="{ marginTop: '6px' }">
|
||||
<JalaliDateInput
|
||||
:model-value="createdToFilter"
|
||||
placeholder="تا تاریخ"
|
||||
@update:model-value="(value: string) => { setCreatedToFilter(value); filterSection = null }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('converted')"
|
||||
@keydown.enter.prevent="toggleFilterSection('converted')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>تبدیلشده</span>
|
||||
<a-typography-text :style="facetValueStyle(convertedFilter)">
|
||||
{{ convertedFilter ? 'فقط' : 'همه' }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-flex v-if="filterSection === 'converted'" vertical :style="{ marginTop: '6px' }">
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(!convertedFilter)"
|
||||
@click="pickFlag('converted', false)"
|
||||
>
|
||||
همه
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(convertedFilter)"
|
||||
@click="pickFlag('converted', true)"
|
||||
>
|
||||
فقط تبدیلشدهها
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('archived')"
|
||||
@keydown.enter.prevent="toggleFilterSection('archived')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>بایگانی</span>
|
||||
<a-typography-text :style="facetValueStyle(archivedFilter)">
|
||||
{{ archivedFilter ? 'فقط' : 'همه' }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-flex v-if="filterSection === 'archived'" vertical :style="{ marginTop: '6px' }">
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(!archivedFilter)"
|
||||
@click="pickFlag('archived', false)"
|
||||
>
|
||||
همه
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(archivedFilter)"
|
||||
@click="pickFlag('archived', true)"
|
||||
>
|
||||
فقط بایگانیشدهها
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</div>
|
||||
|
||||
<a-button
|
||||
v-if="mobileFilterBadgeCount"
|
||||
type="text"
|
||||
danger
|
||||
block
|
||||
@click="clearMoreFilters"
|
||||
<a-typography-text
|
||||
v-if="visibleFacetOptions(facet.options).hidden"
|
||||
type="secondary"
|
||||
>
|
||||
پاک کردن فیلترها
|
||||
برای دیدن بقیه، نام را دقیقتر بنویسید
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('createdFrom')"
|
||||
@keydown.enter.prevent="toggleFilterSection('createdFrom')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>از تاریخ ثبت</span>
|
||||
<a-typography-text :style="facetValueStyle(Boolean(createdFromFilter))">
|
||||
{{ dateFacetLabel(createdFromFilter) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<div v-if="filterSection === 'createdFrom'" :style="{ marginTop: '6px' }">
|
||||
<JalaliDateInput
|
||||
:model-value="createdFromFilter"
|
||||
placeholder="از تاریخ"
|
||||
@update:model-value="(value: string) => { setCreatedFromFilter(value); filterSection = null }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('createdTo')"
|
||||
@keydown.enter.prevent="toggleFilterSection('createdTo')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>تا تاریخ ثبت</span>
|
||||
<a-typography-text :style="facetValueStyle(Boolean(createdToFilter))">
|
||||
{{ dateFacetLabel(createdToFilter) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<div v-if="filterSection === 'createdTo'" :style="{ marginTop: '6px' }">
|
||||
<JalaliDateInput
|
||||
:model-value="createdToFilter"
|
||||
placeholder="تا تاریخ"
|
||||
@update:model-value="(value: string) => { setCreatedToFilter(value); filterSection = null }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('converted')"
|
||||
@keydown.enter.prevent="toggleFilterSection('converted')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>تبدیلشده</span>
|
||||
<a-typography-text :style="facetValueStyle(convertedFilter)">
|
||||
{{ convertedFilter ? 'فقط' : 'همه' }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-flex v-if="filterSection === 'converted'" vertical :style="{ marginTop: '6px' }">
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(!convertedFilter)"
|
||||
@click="pickFlag('converted', false)"
|
||||
>
|
||||
همه
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(convertedFilter)"
|
||||
@click="pickFlag('converted', true)"
|
||||
>
|
||||
فقط تبدیلشدهها
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
@click="toggleFilterSection('archived')"
|
||||
@keydown.enter.prevent="toggleFilterSection('archived')"
|
||||
>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<span>بایگانی</span>
|
||||
<a-typography-text :style="facetValueStyle(archivedFilter)">
|
||||
{{ archivedFilter ? 'فقط' : 'همه' }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-flex v-if="filterSection === 'archived'" vertical :style="{ marginTop: '6px' }">
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(!archivedFilter)"
|
||||
@click="pickFlag('archived', false)"
|
||||
>
|
||||
همه
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
:style="facetOptionStyle(archivedFilter)"
|
||||
@click="pickFlag('archived', true)"
|
||||
>
|
||||
فقط بایگانیشدهها
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</div>
|
||||
|
||||
<a-button
|
||||
v-if="mobileFilterBadgeCount"
|
||||
type="text"
|
||||
danger
|
||||
block
|
||||
@click="clearMoreFilters"
|
||||
>
|
||||
پاک کردن فیلترها
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</div>
|
||||
<a-select
|
||||
:value="sort"
|
||||
:style="isMobile ? { width: '100%' } : { width: '10rem' }"
|
||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</Teleport>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="selectedIds.length" :span="24" @click.stop>
|
||||
|
||||
Reference in New Issue
Block a user