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 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 = {
|
type LeadStatCard = {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
tint: StageTint;
|
tint: StageTint;
|
||||||
count: number;
|
count: number;
|
||||||
/** مرحله اصلی برای فیلتر */
|
/** شناسهٔ واقعی ستون برای فیلتر */
|
||||||
stageId: string;
|
stageId: string;
|
||||||
slot: 'pair' | 'solo';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -342,11 +301,12 @@ function toggleFilterSection(name: NonNullable<typeof filterSection.value>) {
|
|||||||
|
|
||||||
const filterAnchor = ref<HTMLElement | null>(null);
|
const filterAnchor = ref<HTMLElement | null>(null);
|
||||||
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
||||||
|
const filterPanelPos = ref({ top: 0, inlineEnd: 8 });
|
||||||
|
|
||||||
const filterPanelStyle = computed(() => ({
|
const filterPanelStyle = computed(() => ({
|
||||||
position: 'absolute' as const,
|
position: 'fixed' as const,
|
||||||
top: 'calc(100% + 6px)',
|
top: `${filterPanelPos.value.top}px`,
|
||||||
insetInlineStart: '0',
|
insetInlineEnd: `${filterPanelPos.value.inlineEnd}px`,
|
||||||
zIndex: 1050,
|
zIndex: 1050,
|
||||||
width: 'min(20rem, calc(100vw - 1.5rem))',
|
width: 'min(20rem, calc(100vw - 1.5rem))',
|
||||||
maxHeight: filterPopoverMaxHeight.value,
|
maxHeight: filterPopoverMaxHeight.value,
|
||||||
@@ -360,13 +320,19 @@ const filterPanelStyle = computed(() => ({
|
|||||||
function placeFilterPopover() {
|
function placeFilterPopover() {
|
||||||
const el = filterAnchor.value;
|
const el = filterAnchor.value;
|
||||||
if (!el) return;
|
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`;
|
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) {
|
function onFilterDocPointer(event: Event) {
|
||||||
const target = event.target;
|
const target = event.target;
|
||||||
if (!(target instanceof Node)) return;
|
if (!(target instanceof Node)) return;
|
||||||
|
if (target instanceof Element && target.closest('[data-lead-filter]')) return;
|
||||||
if (filterAnchor.value?.contains(target)) return;
|
if (filterAnchor.value?.contains(target)) return;
|
||||||
if (document.getElementById('jalali-picker')?.contains(target)) return;
|
if (document.getElementById('jalali-picker')?.contains(target)) return;
|
||||||
moreFiltersOpen.value = false;
|
moreFiltersOpen.value = false;
|
||||||
@@ -556,23 +522,15 @@ const sortLabels: Record<SortKey, string> = {
|
|||||||
last_contact: 'آخرین تماس',
|
last_contact: 'آخرین تماس',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** چیپهای فیلتر = ستونهای واقعی سازمان (نه نامهای ثابت قدیمی) */
|
||||||
const stageCards = computed((): LeadStatCard[] => {
|
const stageCards = computed((): LeadStatCard[] => {
|
||||||
return LEAD_STAT_DEFS.map((def) => {
|
return stages.value.map((s) => ({
|
||||||
const matched = stages.value.filter((s) =>
|
key: s.id,
|
||||||
def.match.some((name) => s.name.trim() === name),
|
label: s.name,
|
||||||
);
|
tint: stageTint(s.color),
|
||||||
const count = matched.reduce((sum, s) => sum + (s.leadCount ?? 0), 0);
|
count: s.leadCount ?? 0,
|
||||||
const primary =
|
stageId: s.id,
|
||||||
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,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const totalLeadsCount = computed(() => {
|
const totalLeadsCount = computed(() => {
|
||||||
@@ -580,22 +538,24 @@ const totalLeadsCount = computed(() => {
|
|||||||
return stages.value.reduce((sum, s) => sum + (s.leadCount ?? 0), 0) || total.value;
|
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) {
|
function isStatActive(card: LeadStatCard) {
|
||||||
if (!card.stageId || !stageId.value) return false;
|
return Boolean(card.stageId && stageId.value === card.stageId);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectStatCard(card: LeadStatCard) {
|
function selectStatCard(card: LeadStatCard) {
|
||||||
if (!card.stageId) {
|
if (!card.stageId) return;
|
||||||
setStageFilter('');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setStageFilter(isStatActive(card) ? '' : card.stageId);
|
setStageFilter(isStatActive(card) ? '' : card.stageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1586,14 +1546,36 @@ onBeforeUnmount(() => {
|
|||||||
<template>
|
<template>
|
||||||
<a-row :gutter="[16, 16]" align="top" :style="{ alignContent: 'flex-start' }" @click="closePopups">
|
<a-row :gutter="[16, 16]" align="top" :style="{ alignContent: 'flex-start' }" @click="closePopups">
|
||||||
<a-col :span="24">
|
<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-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||||
<a-space :size="8" wrap>
|
<a-flex :gap="8" align="center" :style="{ width: '100%' }">
|
||||||
<template v-if="isMobile">
|
<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-dropdown :trigger="['click']" placement="bottomLeft">
|
||||||
<a-button :disabled="busy">
|
<a-button :disabled="busy" aria-label="بیشتر">
|
||||||
<template #icon><MoreOutlined /></template>
|
<template #icon><MoreOutlined /></template>
|
||||||
بیشتر
|
|
||||||
</a-button>
|
</a-button>
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu>
|
<a-menu>
|
||||||
@@ -1641,92 +1623,196 @@ onBeforeUnmount(() => {
|
|||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
</template>
|
</div>
|
||||||
<template v-else>
|
</a-flex>
|
||||||
<a-button :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
</a-flex>
|
||||||
<template #icon><ExportOutlined /></template>
|
<a-flex
|
||||||
خروجی اکسل
|
v-else
|
||||||
</a-button>
|
justify="space-between"
|
||||||
<ExcelImportFlow
|
align="center"
|
||||||
preview-path="/leads/import/preview"
|
wrap="wrap"
|
||||||
import-path="/leads/import/file"
|
:gap="token.marginSM"
|
||||||
:disabled="busy"
|
>
|
||||||
@start="onExcelImportStart"
|
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||||
@done="onExcelImportDone"
|
<a-space :size="8" wrap>
|
||||||
@fail="onExcelImportFail"
|
<a-button :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
||||||
@settled="onExcelImportSettled"
|
<template #icon><ExportOutlined /></template>
|
||||||
>
|
خروجی اکسل
|
||||||
<template #default="{ loading: excelLoading }">
|
</a-button>
|
||||||
<a-button :disabled="busy" :loading="excelLoading">
|
<ExcelImportFlow
|
||||||
<template #icon><FileExcelOutlined /></template>
|
preview-path="/leads/import/preview"
|
||||||
ورود از اکسل
|
import-path="/leads/import/file"
|
||||||
</a-button>
|
:disabled="busy"
|
||||||
</template>
|
@start="onExcelImportStart"
|
||||||
</ExcelImportFlow>
|
@done="onExcelImportDone"
|
||||||
<PhoneContactsImport
|
@fail="onExcelImportFail"
|
||||||
target="leads"
|
@settled="onExcelImportSettled"
|
||||||
: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' }) }"
|
|
||||||
>
|
>
|
||||||
<a-radio-button value="list">
|
<template #default="{ loading: excelLoading }">
|
||||||
<UnorderedListOutlined />
|
<a-button :disabled="busy" :loading="excelLoading">
|
||||||
</a-radio-button>
|
<template #icon><FileExcelOutlined /></template>
|
||||||
<a-radio-button value="board">
|
ورود از اکسل
|
||||||
<AppstoreOutlined />
|
</a-button>
|
||||||
</a-radio-button>
|
</template>
|
||||||
</a-radio-group>
|
</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">
|
<a-button type="primary" @click.stop="openCreate">
|
||||||
<template #icon><PlusOutlined /></template>
|
<template #icon><PlusOutlined /></template>
|
||||||
{{ isMobile ? 'جدید' : 'لید جدید' }}
|
لید جدید
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="24" @click.stop>
|
<a-col :span="24" @click.stop>
|
||||||
<a-card :bordered="true">
|
<a-flex vertical :gap="8">
|
||||||
<a-flex vertical :gap="12">
|
<a-flex v-if="!isMobile" wrap="wrap" :gap="8" align="center">
|
||||||
<a-flex v-if="!isMobile" justify="space-between" align="center" wrap="wrap" :gap="8">
|
<a-button :type="!stageId ? 'primary' : 'default'" @click="setStageFilter('')">
|
||||||
<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'"
|
||||||
<a-typography-text
|
:style="{ color: !stageId ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
||||||
: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)"
|
|
||||||
>
|
>
|
||||||
{{ 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
|
<a-typography-text
|
||||||
:type="isStatActive(card) ? undefined : 'secondary'"
|
v-if="mobileFilterBadgeCount"
|
||||||
:style="{ color: isStatActive(card) ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
:style="{ color: 'inherit', fontSize: `${token.fontSizeSM}px` }"
|
||||||
>
|
>
|
||||||
{{ formatCount(card.count) }}
|
{{ toFaDigits(mobileFilterBadgeCount) }}
|
||||||
</a-typography-text>
|
</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-flex>
|
||||||
<a-space :size="8">
|
<a-space :size="8">
|
||||||
<TableColumnsMenu table-key="leads" align="end" />
|
<TableColumnsMenu table-key="leads" align="end" />
|
||||||
@@ -1745,236 +1831,199 @@ onBeforeUnmount(() => {
|
|||||||
</a-space>
|
</a-space>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
|
|
||||||
<a-flex :vertical="isMobile" align="center" wrap="wrap" :gap="8">
|
<Teleport to="body">
|
||||||
<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>
|
|
||||||
<div
|
<div
|
||||||
ref="filterAnchor"
|
v-if="moreFiltersOpen"
|
||||||
:style="{ position: 'relative', width: isMobile ? '100%' : undefined }"
|
data-lead-filter
|
||||||
|
:style="filterPanelStyle"
|
||||||
|
@click.stop
|
||||||
>
|
>
|
||||||
<a-button
|
<a-flex vertical :gap="10">
|
||||||
:block="isMobile"
|
<div v-for="facet in textFacets" :key="facet.key">
|
||||||
:style="mobileFilterBadgeCount
|
<div
|
||||||
? {
|
role="button"
|
||||||
borderColor: token.colorPrimary,
|
tabindex="0"
|
||||||
color: token.colorPrimary,
|
:style="{ cursor: 'pointer' }"
|
||||||
background: token.colorPrimaryBg,
|
@click="toggleFilterSection(facet.key)"
|
||||||
}
|
@keydown.enter.prevent="toggleFilterSection(facet.key)"
|
||||||
: undefined"
|
>
|
||||||
@click.stop="toggleFilterPopover"
|
<a-flex justify="space-between" align="center">
|
||||||
>
|
<span>{{ facet.label }}</span>
|
||||||
<a-flex align="center" justify="center" :gap="6">
|
<a-typography-text :style="facetValueStyle(facet.active)">
|
||||||
<FilterOutlined />
|
{{ facet.value }}
|
||||||
<span>{{ filterBtnLabel }}</span>
|
</a-typography-text>
|
||||||
<DownOutlined />
|
</a-flex>
|
||||||
</a-flex>
|
</div>
|
||||||
</a-button>
|
<a-flex
|
||||||
<div v-if="moreFiltersOpen" data-lead-filter :style="filterPanelStyle" @click.stop>
|
v-if="filterSection === facet.key"
|
||||||
<a-flex vertical :gap="10">
|
vertical
|
||||||
<div v-for="facet in textFacets" :key="facet.key">
|
:gap="4"
|
||||||
<div
|
:style="{ marginTop: '6px' }"
|
||||||
role="button"
|
>
|
||||||
tabindex="0"
|
<a-input
|
||||||
:style="{ cursor: 'pointer' }"
|
v-if="facet.searchable"
|
||||||
@click="toggleFilterSection(facet.key)"
|
v-model:value="filterQuery"
|
||||||
@keydown.enter.prevent="toggleFilterSection(facet.key)"
|
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">
|
{{ option.label }}
|
||||||
<span>{{ facet.label }}</span>
|
</a-button>
|
||||||
<a-typography-text :style="facetValueStyle(facet.active)">
|
<a-typography-text
|
||||||
{{ facet.value }}
|
v-if="visibleFacetOptions(facet.options).empty"
|
||||||
</a-typography-text>
|
type="secondary"
|
||||||
</a-flex>
|
|
||||||
</div>
|
|
||||||
<a-flex
|
|
||||||
v-if="filterSection === facet.key"
|
|
||||||
vertical
|
|
||||||
:gap="4"
|
|
||||||
:style="{ marginTop: '6px' }"
|
|
||||||
>
|
>
|
||||||
<a-input
|
موردی پیدا نشد
|
||||||
v-if="facet.searchable"
|
</a-typography-text>
|
||||||
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>
|
|
||||||
</div>
|
</div>
|
||||||
|
<a-typography-text
|
||||||
<div>
|
v-if="visibleFacetOptions(facet.options).hidden"
|
||||||
<div
|
type="secondary"
|
||||||
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>
|
||||||
|
</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-button>
|
||||||
</a-flex>
|
</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>
|
</div>
|
||||||
<a-select
|
</Teleport>
|
||||||
:value="sort"
|
</a-flex>
|
||||||
: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>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col v-if="selectedIds.length" :span="24" @click.stop>
|
<a-col v-if="selectedIds.length" :span="24" @click.stop>
|
||||||
|
|||||||
Reference in New Issue
Block a user