fix(web): restore page header bindings so typecheck can pass.
The form builder, activities, contacts, and lead screens referenced header actions that were no longer in script, which blocked the push check. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,8 +21,14 @@ import {
|
|||||||
} from '@/components/ui';
|
} from '@/components/ui';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||||
|
import type { PageHeaderMenuItem, PageHeaderTab, PageHeaderViewOption } from '@/components/page';
|
||||||
|
import {
|
||||||
|
AppstoreOutlined,
|
||||||
|
FileExcelOutlined,
|
||||||
|
ScheduleOutlined,
|
||||||
|
UnorderedListOutlined,
|
||||||
|
} from '@/icons/ant-bridge';
|
||||||
import ActivitiesKanban from '@/components/activities/ActivitiesKanban.vue';
|
import ActivitiesKanban from '@/components/activities/ActivitiesKanban.vue';
|
||||||
import ActivityAccountBalances from '@/components/activities/ActivityAccountBalances.vue';
|
|
||||||
import ActivityDeskFilters from '@/components/activities/ActivityDeskFilters.vue';
|
import ActivityDeskFilters from '@/components/activities/ActivityDeskFilters.vue';
|
||||||
import ActivityStagesManager from '@/components/activities/ActivityStagesManager.vue';
|
import ActivityStagesManager from '@/components/activities/ActivityStagesManager.vue';
|
||||||
import ActivityTypesManager from '@/components/activities/ActivityTypesManager.vue';
|
import ActivityTypesManager from '@/components/activities/ActivityTypesManager.vue';
|
||||||
@@ -201,8 +207,6 @@ const stagesQuery = useQuery({
|
|||||||
});
|
});
|
||||||
const stages = computed(() => stagesQuery.data.value ?? []);
|
const stages = computed(() => stagesQuery.data.value ?? []);
|
||||||
const currentBoard = computed(() => boards.value.find((b) => b.id === board.value) ?? null);
|
const currentBoard = computed(() => boards.value.find((b) => b.id === board.value) ?? null);
|
||||||
const boardMenuOpen = ref(false);
|
|
||||||
const actionsMenuOpen = ref(false);
|
|
||||||
const importBtn = ref<HTMLButtonElement | null>(null);
|
const importBtn = ref<HTMLButtonElement | null>(null);
|
||||||
|
|
||||||
function triggerImport() {
|
function triggerImport() {
|
||||||
@@ -802,6 +806,70 @@ function onSearch() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSearchInput(value: string) {
|
||||||
|
q.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const headerMenuItems = computed<PageHeaderMenuItem[]>(() => [
|
||||||
|
{ key: 'export', label: 'خروجی اکسل', icon: FileExcelOutlined },
|
||||||
|
{ key: 'import', label: 'ورود از اکسل', icon: FileExcelOutlined },
|
||||||
|
]);
|
||||||
|
|
||||||
|
function onHeaderMenu(key: string) {
|
||||||
|
if (key === 'export') void exportExcel();
|
||||||
|
else if (key === 'import') triggerImport();
|
||||||
|
}
|
||||||
|
|
||||||
|
const stageTabs = computed<PageHeaderTab[]>(() => [
|
||||||
|
{ key: 'all', label: 'همه', count: stageCounts.value.total },
|
||||||
|
...stages.value.map((s) => ({
|
||||||
|
key: s.id,
|
||||||
|
label: s.name,
|
||||||
|
count: stageCounts.value.counts[s.id] ?? 0,
|
||||||
|
})),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const viewOptions: PageHeaderViewOption[] = [
|
||||||
|
{ value: 'tabs', label: 'فهرست', icon: UnorderedListOutlined },
|
||||||
|
{ value: 'board', label: 'بورد', icon: AppstoreOutlined },
|
||||||
|
];
|
||||||
|
|
||||||
|
function onHeaderTab(key: string | undefined) {
|
||||||
|
setStage(key || 'all');
|
||||||
|
}
|
||||||
|
|
||||||
|
function onHeaderView(value: string | undefined) {
|
||||||
|
setViewMode(value === 'board' ? 'board' : 'tabs');
|
||||||
|
}
|
||||||
|
|
||||||
|
const deskOptions = computed(() =>
|
||||||
|
DESK_TABS.map((tab) => ({ value: tab.key, label: tab.label })),
|
||||||
|
);
|
||||||
|
|
||||||
|
function onDeskChips(values: DeskScope[] | undefined) {
|
||||||
|
const next = values?.[0];
|
||||||
|
if (next === 'mine' || next === 'team') setDesk(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeOptions = computed(() =>
|
||||||
|
TIME_TABS.map((tab) => ({
|
||||||
|
value: tab.key,
|
||||||
|
label: `${tab.label} (${toFaDigits(counts.value[tab.key])})`,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
function onTimeChips(values: TimeFilter[] | undefined) {
|
||||||
|
const next = values?.[0];
|
||||||
|
if (next && TIME_KEYS.includes(next)) setFilter(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBoardMenuClick(info: { key: string | number }) {
|
||||||
|
const key = String(info.key);
|
||||||
|
if (key === '__create') openCreateBoard();
|
||||||
|
else if (key === '__edit') openEditBoard();
|
||||||
|
else setBoard(key);
|
||||||
|
}
|
||||||
|
|
||||||
function patchFacetQuery(patch: Record<string, string | undefined>) {
|
function patchFacetQuery(patch: Record<string, string | undefined>) {
|
||||||
void router.replace({
|
void router.replace({
|
||||||
name: 'activities',
|
name: 'activities',
|
||||||
@@ -1250,10 +1318,10 @@ onUnmounted(() => {
|
|||||||
:view="viewMode"
|
:view="viewMode"
|
||||||
@primary="activityModal = {}"
|
@primary="activityModal = {}"
|
||||||
@menu="onHeaderMenu"
|
@menu="onHeaderMenu"
|
||||||
@update:active-tab="(k) => setStage(k ?? 'all')"
|
@update:active-tab="onHeaderTab"
|
||||||
@update:search="onSearchInput"
|
@update:search="onSearchInput"
|
||||||
@search-submit="onSearch"
|
@search-submit="onSearch"
|
||||||
@update:view="(v) => setViewMode(v === 'board' ? 'board' : 'tabs')"
|
@update:view="onHeaderView"
|
||||||
>
|
>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<a-button aria-label="تقویم" title="تقویم" @click="router.push({ name: 'activities-calendar' })">
|
<a-button aria-label="تقویم" title="تقویم" @click="router.push({ name: 'activities-calendar' })">
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
|||||||
import ActivityCommentSheet from '@/components/activities/ActivityCommentSheet.vue';
|
import ActivityCommentSheet from '@/components/activities/ActivityCommentSheet.vue';
|
||||||
import ActivityPostponeSheet from '@/components/activities/ActivityPostponeSheet.vue';
|
import ActivityPostponeSheet from '@/components/activities/ActivityPostponeSheet.vue';
|
||||||
import ActivityFieldsView from '@/components/activities/ActivityFieldsView.vue';
|
import ActivityFieldsView from '@/components/activities/ActivityFieldsView.vue';
|
||||||
import ActivityAccountBalances from '@/components/activities/ActivityAccountBalances.vue';
|
|
||||||
import StagePathStrip from '@/components/StagePathStrip.vue';
|
import StagePathStrip from '@/components/StagePathStrip.vue';
|
||||||
|
import { ScheduleOutlined } from '@/icons/ant-bridge';
|
||||||
import { Button as AButton, message, Modal } from 'ant-design-vue';
|
import { Button as AButton, message, Modal } from 'ant-design-vue';
|
||||||
import type {
|
import type {
|
||||||
ActivityChecklistItem,
|
ActivityChecklistItem,
|
||||||
@@ -891,21 +891,6 @@ async function loadActivityImages(row: ActivityDto) {
|
|||||||
imageUrls.value = next;
|
imageUrls.value = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewMedia(item: NoteMedia) {
|
|
||||||
window.open(item.url, '_blank', 'noopener,noreferrer');
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadMedia(item: NoteMedia) {
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.href = item.url;
|
|
||||||
link.download = item.name || 'file';
|
|
||||||
link.rel = 'noopener';
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
link.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function loadUsers() {
|
async function loadUsers() {
|
||||||
try {
|
try {
|
||||||
const [usersRes, teamsRes] = await Promise.all([
|
const [usersRes, teamsRes] = await Promise.all([
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ import { canUseBehavior } from '@/lib/behavior-access';
|
|||||||
import DiscBadge from '@/components/behavior/DiscBadge.vue';
|
import DiscBadge from '@/components/behavior/DiscBadge.vue';
|
||||||
import { PAGE_SIZE_OPTIONS, usePageSize } from '@/lib/pageSize';
|
import { PAGE_SIZE_OPTIONS, usePageSize } from '@/lib/pageSize';
|
||||||
import { useCustomerGroups } from '@/lib/customer-groups';
|
import { useCustomerGroups } from '@/lib/customer-groups';
|
||||||
import { type ContactsFilterValue } from '@/components/ContactsFilterPanel.vue';
|
|
||||||
import { canManageSettings } from '@/lib/roles';
|
import { canManageSettings } from '@/lib/roles';
|
||||||
import { contactKeys } from '@/queries/keys';
|
import { contactKeys } from '@/queries/keys';
|
||||||
import {
|
import {
|
||||||
@@ -130,14 +129,6 @@ const { groups: customerGroups } = useCustomerGroups();
|
|||||||
const canManageGroups = computed(() => canManageSettings(auth.user?.role));
|
const canManageGroups = computed(() => canManageSettings(auth.user?.role));
|
||||||
const groupsManagerOpen = ref(false);
|
const groupsManagerOpen = ref(false);
|
||||||
|
|
||||||
const filterValue = computed<ContactsFilterValue>(() => ({
|
|
||||||
groups: groupFilters.value,
|
|
||||||
sources: sourceFilters.value,
|
|
||||||
moods: moodFilters.value,
|
|
||||||
disc: discFilter.value,
|
|
||||||
activityExperiences: activityExperienceFilters.value,
|
|
||||||
}));
|
|
||||||
|
|
||||||
type FilterTag = {
|
type FilterTag = {
|
||||||
kind: 'group' | 'source' | 'mood' | 'disc' | 'activityExperience';
|
kind: 'group' | 'source' | 'mood' | 'disc' | 'activityExperience';
|
||||||
value: string;
|
value: string;
|
||||||
@@ -190,11 +181,6 @@ function onMobileChange(e: MediaQueryListEvent) {
|
|||||||
onMounted(() => mobileMq?.addEventListener('change', onMobileChange));
|
onMounted(() => mobileMq?.addEventListener('change', onMobileChange));
|
||||||
onBeforeUnmount(() => mobileMq?.removeEventListener('change', onMobileChange));
|
onBeforeUnmount(() => mobileMq?.removeEventListener('change', onMobileChange));
|
||||||
|
|
||||||
const SORT_OPTIONS = [
|
|
||||||
{ value: 'name', label: 'نام' },
|
|
||||||
{ value: 'newest', label: 'جدیدترین' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const peopleParams = computed(() => ({
|
const peopleParams = computed(() => ({
|
||||||
q: q.value || undefined,
|
q: q.value || undefined,
|
||||||
page: page.value,
|
page: page.value,
|
||||||
@@ -484,42 +470,6 @@ function setSort(next: SortKey) {
|
|||||||
patchQuery({ sort: next === 'name' ? undefined : next, page: undefined });
|
patchQuery({ sort: next === 'name' ? undefined : next, page: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyFilters(next: ContactsFilterValue, nextSort?: string) {
|
|
||||||
filterOpen.value = false;
|
|
||||||
const people = tab.value === 'people';
|
|
||||||
patchQuery({
|
|
||||||
group: csv(next.groups),
|
|
||||||
...(people
|
|
||||||
? {
|
|
||||||
source: csv(next.sources),
|
|
||||||
mood: csv(next.moods),
|
|
||||||
activityExperience: csv(next.activityExperiences),
|
|
||||||
disc: next.disc || undefined,
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
// در موبایل مرتبسازی داخل همان شیت فیلتر است؛ یک patch تا query قبلی overwrite نشود
|
|
||||||
...(nextSort !== undefined
|
|
||||||
? { sort: nextSort === 'newest' ? 'newest' : undefined }
|
|
||||||
: {}),
|
|
||||||
page: undefined,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** شمارنده روی دکمه فیلتر موبایل (فیلترها + مرتبسازی غیرپیشفرض) */
|
|
||||||
const mobileFilterCount = computed(
|
|
||||||
() => activeTags.value.length + (sort.value !== 'name' ? 1 : 0),
|
|
||||||
);
|
|
||||||
|
|
||||||
function openSavedSheet() {
|
|
||||||
moreOpen.value = false;
|
|
||||||
savedSheetOpen.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function applySavedFromSheet(filters: Record<string, unknown>) {
|
|
||||||
savedSheetOpen.value = false;
|
|
||||||
applyPeopleSavedFilters(filters);
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeTag(tag: FilterTag) {
|
function removeTag(tag: FilterTag) {
|
||||||
const without = (list: string[]) => csv(list.filter((v) => v !== tag.value));
|
const without = (list: string[]) => csv(list.filter((v) => v !== tag.value));
|
||||||
if (tag.kind === 'group') patchQuery({ group: without(groupFilters.value), page: undefined });
|
if (tag.kind === 'group') patchQuery({ group: without(groupFilters.value), page: undefined });
|
||||||
@@ -548,10 +498,6 @@ function clearFilters() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onGroupsChanged() {
|
|
||||||
await load();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setPage(next: number) {
|
function setPage(next: number) {
|
||||||
if (next < 1 || next > pageCount.value) return;
|
if (next < 1 || next > pageCount.value) return;
|
||||||
patchQuery({ page: next === 1 ? undefined : String(next) });
|
patchQuery({ page: next === 1 ? undefined : String(next) });
|
||||||
@@ -731,8 +677,8 @@ function onHeaderMenu(key: string) {
|
|||||||
else if (key === 'groups') groupsManagerOpen.value = true;
|
else if (key === 'groups') groupsManagerOpen.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHeaderTab(key: string | number) {
|
function onHeaderTab(key: string | undefined) {
|
||||||
setTab(String(key) === 'companies' ? 'companies' : 'people');
|
setTab(key === 'companies' ? 'companies' : 'people');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSearchInput(value: string) {
|
function onSearchInput(value: string) {
|
||||||
|
|||||||
@@ -31,12 +31,10 @@ import {
|
|||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
Timeline as ATimeline,
|
Timeline as ATimeline,
|
||||||
TimelineItem as ATimelineItem,
|
TimelineItem as ATimelineItem,
|
||||||
Typography,
|
|
||||||
message,
|
message,
|
||||||
theme,
|
theme,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
ArrowLeftOutlined,
|
|
||||||
CopyOutlined,
|
CopyOutlined,
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
MessageOutlined,
|
MessageOutlined,
|
||||||
@@ -52,7 +50,6 @@ import {
|
|||||||
leadNoteFileIsImage,
|
leadNoteFileIsImage,
|
||||||
parseLeadFormNotes,
|
parseLeadFormNotes,
|
||||||
} from '@/lib/lead-form-notes';
|
} from '@/lib/lead-form-notes';
|
||||||
import { ACTIVITY_EXPERIENCE_OPTIONS } from '@mento/shared';
|
|
||||||
import {
|
import {
|
||||||
formatClockFa,
|
formatClockFa,
|
||||||
formatJalaliNumeric,
|
formatJalaliNumeric,
|
||||||
@@ -79,8 +76,6 @@ import { ACTIVITY_TYPE_LABELS, PERSON_GENDERS, PERSON_GENDER_LABELS, splitPerson
|
|||||||
import { canUseBehavior } from '@/lib/behavior-access';
|
import { canUseBehavior } from '@/lib/behavior-access';
|
||||||
import SalesCopilotPanel from '@/components/behavior/SalesCopilotPanel.vue';
|
import SalesCopilotPanel from '@/components/behavior/SalesCopilotPanel.vue';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
|
||||||
Typography;
|
|
||||||
const { token } = theme.useToken();
|
const { token } = theme.useToken();
|
||||||
|
|
||||||
type LeadDetail = LeadDto & { events: LeadEventDto[] };
|
type LeadDetail = LeadDto & { events: LeadEventDto[] };
|
||||||
@@ -94,17 +89,6 @@ const copilotOpen = ref(false);
|
|||||||
|
|
||||||
const id = computed(() => String(route.params.id));
|
const id = computed(() => String(route.params.id));
|
||||||
|
|
||||||
/** برگشت به همان جایی که از آن آمدهایم (فهرست یا مسیر/بورد لیدها). */
|
|
||||||
function goBack() {
|
|
||||||
const back = String((window.history.state as { back?: string | null } | null)?.back ?? '');
|
|
||||||
const path = back.split('?')[0];
|
|
||||||
if (path === '/leads' || path === '/leads/board') {
|
|
||||||
router.back();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
void router.push({ name: 'leads' });
|
|
||||||
}
|
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const busy = ref(false);
|
const busy = ref(false);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
@@ -150,11 +134,6 @@ const editForm = ref({
|
|||||||
notes: '',
|
notes: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const activityExperienceOptions = [
|
|
||||||
{ value: '', label: '—' },
|
|
||||||
...ACTIVITY_EXPERIENCE_OPTIONS.map((value) => ({ value, label: value })),
|
|
||||||
];
|
|
||||||
|
|
||||||
function formatDate(value: string | null | undefined) {
|
function formatDate(value: string | null | undefined) {
|
||||||
if (!value) return '—';
|
if (!value) return '—';
|
||||||
try {
|
try {
|
||||||
@@ -172,14 +151,6 @@ const shownBirthDate = computed(() => {
|
|||||||
if (lead.value?.birthDate) return formatDate(lead.value.birthDate);
|
if (lead.value?.birthDate) return formatDate(lead.value.birthDate);
|
||||||
return formBirthDate.value || '—';
|
return formBirthDate.value || '—';
|
||||||
});
|
});
|
||||||
const formActivityExperience = computed(
|
|
||||||
() =>
|
|
||||||
noteView.value.rows.find((row) => isActivityExperienceAnswer(row.label) && !row.file)?.text ??
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
const shownActivityExperience = computed(
|
|
||||||
() => lead.value?.activityExperience || formActivityExperience.value || '—',
|
|
||||||
);
|
|
||||||
const answerRows = computed(() =>
|
const answerRows = computed(() =>
|
||||||
noteView.value.rows.filter(
|
noteView.value.rows.filter(
|
||||||
(row) => !isBirthDateAnswer(row.label) && !isActivityExperienceAnswer(row.label),
|
(row) => !isBirthDateAnswer(row.label) && !isActivityExperienceAnswer(row.label),
|
||||||
@@ -309,20 +280,6 @@ async function saveEdit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openStageMove() {
|
|
||||||
if (!stageId.value || stageId.value === lead.value?.stageId) return;
|
|
||||||
stageMoveReason.value = '';
|
|
||||||
stageMoveError.value = '';
|
|
||||||
stageMoveOpen.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelStageMove() {
|
|
||||||
stageMoveOpen.value = false;
|
|
||||||
stageMoveReason.value = '';
|
|
||||||
stageMoveError.value = '';
|
|
||||||
if (lead.value) stageId.value = lead.value.stageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function changeStage() {
|
async function changeStage() {
|
||||||
if (!stageId.value || stageId.value === lead.value?.stageId) {
|
if (!stageId.value || stageId.value === lead.value?.stageId) {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
@@ -475,6 +432,19 @@ function convertLead() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const leadMenuItems = computed(() => [
|
||||||
|
{
|
||||||
|
key: 'archive',
|
||||||
|
label: 'بایگانی',
|
||||||
|
danger: true,
|
||||||
|
disabled: busy.value || !lead.value,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
function onLeadMenu(key: string) {
|
||||||
|
if (key === 'archive') archiveLead();
|
||||||
|
}
|
||||||
|
|
||||||
function archiveLead() {
|
function archiveLead() {
|
||||||
AModal.confirm({
|
AModal.confirm({
|
||||||
title: 'این لید بایگانی شود؟',
|
title: 'این لید بایگانی شود؟',
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
import { computed, nextTick, onMounted, ref, watch, type Component } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { theme, type UploadProps } from 'ant-design-vue';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import {
|
||||||
|
AppstoreOutlined,
|
||||||
|
BarChartOutlined,
|
||||||
|
CalendarOutlined,
|
||||||
|
CheckOutlined,
|
||||||
|
CommentOutlined,
|
||||||
|
FileOutlined,
|
||||||
|
FileTextOutlined,
|
||||||
|
MailOutlined,
|
||||||
|
NotificationOutlined,
|
||||||
|
PhoneOutlined,
|
||||||
|
SaveOutlined,
|
||||||
|
StarOutlined,
|
||||||
|
UnorderedListOutlined,
|
||||||
|
UserOutlined,
|
||||||
|
} from '@/icons/ant-bridge';
|
||||||
import type {
|
import type {
|
||||||
LeadFormDto,
|
LeadFormDto,
|
||||||
LeadFormDuplicateMode,
|
LeadFormDuplicateMode,
|
||||||
@@ -21,11 +38,29 @@ import { toFaDigits } from '@/lib/jalali';
|
|||||||
import { prepareFormCover } from '@/lib/form-cover';
|
import { prepareFormCover } from '@/lib/form-cover';
|
||||||
import { useEscClose } from '@/lib/modal-stack';
|
import { useEscClose } from '@/lib/modal-stack';
|
||||||
|
|
||||||
|
const { token } = theme.useToken();
|
||||||
|
|
||||||
type Tab = 'edit' | 'settings' | 'share' | 'responses';
|
type Tab = 'edit' | 'settings' | 'share' | 'responses';
|
||||||
type IconName =
|
type IconName =
|
||||||
| 'user' | 'chat' | 'mail' | 'phone' | 'list' | 'layers' | 'calendar'
|
| 'user' | 'chat' | 'mail' | 'phone' | 'list' | 'layers' | 'calendar'
|
||||||
| 'check' | 'chart' | 'document' | 'star' | 'megaphone' | 'building';
|
| 'check' | 'chart' | 'document' | 'star' | 'megaphone' | 'building';
|
||||||
|
|
||||||
|
const ICON_MAP: Record<IconName, Component> = {
|
||||||
|
user: UserOutlined,
|
||||||
|
chat: CommentOutlined,
|
||||||
|
mail: MailOutlined,
|
||||||
|
phone: PhoneOutlined,
|
||||||
|
list: UnorderedListOutlined,
|
||||||
|
layers: AppstoreOutlined,
|
||||||
|
calendar: CalendarOutlined,
|
||||||
|
check: CheckOutlined,
|
||||||
|
chart: BarChartOutlined,
|
||||||
|
document: FileOutlined,
|
||||||
|
star: StarOutlined,
|
||||||
|
megaphone: NotificationOutlined,
|
||||||
|
building: AppstoreOutlined,
|
||||||
|
};
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const id = computed(() => String(route.params.id || ''));
|
const id = computed(() => String(route.params.id || ''));
|
||||||
@@ -63,7 +98,6 @@ const users = ref<OrgUserDto[]>([]);
|
|||||||
const pipelines = ref<PipelineDto[]>([]);
|
const pipelines = ref<PipelineDto[]>([]);
|
||||||
const leadStages = ref<LeadStageDto[]>([]);
|
const leadStages = ref<LeadStageDto[]>([]);
|
||||||
const submissions = ref<LeadFormSubmissionDto[]>([]);
|
const submissions = ref<LeadFormSubmissionDto[]>([]);
|
||||||
const coverInput = ref<HTMLInputElement | null>(null);
|
|
||||||
|
|
||||||
const toolbox: Array<{ type: LeadFormFieldType; label: string; icon: IconName }> = [
|
const toolbox: Array<{ type: LeadFormFieldType; label: string; icon: IconName }> = [
|
||||||
{ type: 'text', label: 'متن کوتاه', icon: 'user' },
|
{ type: 'text', label: 'متن کوتاه', icon: 'user' },
|
||||||
@@ -260,6 +294,28 @@ const crmSummary = computed(() => {
|
|||||||
return parts.join(' · ') || 'اتصال CRM تنظیم نشده';
|
return parts.join(' · ') || 'اتصال CRM تنظیم نشده';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const leadStageOptions = computed(() => [
|
||||||
|
{ value: '', label: 'اولین مرحله فعال' },
|
||||||
|
...leadStages.value.map((s) => ({ value: s.id, label: s.name })),
|
||||||
|
]);
|
||||||
|
const pipelineOptions = computed(() => [
|
||||||
|
{ value: '', label: 'پیشفرض سازمان' },
|
||||||
|
...pipelines.value.map((p) => ({ value: p.id, label: p.name })),
|
||||||
|
]);
|
||||||
|
const duplicateOptions: { value: LeadFormDuplicateMode; label: string }[] = [
|
||||||
|
{ value: 'update', label: 'بهروزرسانی لید موجود' },
|
||||||
|
{ value: 'skip', label: 'رد کردن (ثبت نشود)' },
|
||||||
|
{ value: 'activity', label: 'فقط ثبت رویداد روی لید موجود' },
|
||||||
|
];
|
||||||
|
const settingsSummaryItems = computed(() => [
|
||||||
|
{ label: 'وضعیت', value: isActive.value ? 'فعال' : 'غیرفعال' },
|
||||||
|
{ label: 'ثبت لید', value: createLead.value ? 'بله' : 'خیر' },
|
||||||
|
{ label: 'ساخت شخص', value: createPerson.value ? 'بله' : 'خیر' },
|
||||||
|
{ label: 'ساخت معامله', value: createDeal.value ? 'بله' : 'خیر' },
|
||||||
|
{ label: 'منبع', value: source.value || '—' },
|
||||||
|
{ label: 'مسئولان', value: toFaDigits(assigneeIds.value.length) },
|
||||||
|
]);
|
||||||
|
|
||||||
function newKey(label: string) {
|
function newKey(label: string) {
|
||||||
const base = label.replace(/\s+/g, '_').slice(0, 24) || 'field';
|
const base = label.replace(/\s+/g, '_').slice(0, 24) || 'field';
|
||||||
let key = `${base}_${Math.random().toString(36).slice(2, 6)}`;
|
let key = `${base}_${Math.random().toString(36).slice(2, 6)}`;
|
||||||
@@ -461,11 +517,7 @@ async function save() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadCover(ev: Event) {
|
async function handleCoverFile(file: File) {
|
||||||
const input = ev.target as HTMLInputElement;
|
|
||||||
const file = input.files?.[0];
|
|
||||||
input.value = '';
|
|
||||||
if (!file) return;
|
|
||||||
error.value = '';
|
error.value = '';
|
||||||
coverUploading.value = true;
|
coverUploading.value = true;
|
||||||
try {
|
try {
|
||||||
@@ -482,6 +534,11 @@ async function uploadCover(ev: Event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const beforeCoverUpload: UploadProps['beforeUpload'] = (file) => {
|
||||||
|
void handleCoverFile(file as File);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
async function clearCover() {
|
async function clearCover() {
|
||||||
try {
|
try {
|
||||||
const { data } = await api.delete<LeadFormDto>(`/lead-forms/${id.value}/cover`);
|
const { data } = await api.delete<LeadFormDto>(`/lead-forms/${id.value}/cover`);
|
||||||
@@ -551,6 +608,15 @@ function toggleAssignee(uid: string) {
|
|||||||
: [...assigneeIds.value, uid];
|
: [...assigneeIds.value, uid];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onTabChange(key: string | number) {
|
||||||
|
const next = String(key) as Tab;
|
||||||
|
if (next === 'responses') {
|
||||||
|
void loadResponses();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tab.value = next;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(load);
|
onMounted(load);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -16,22 +16,17 @@ import {
|
|||||||
FormItem as AFormItem,
|
FormItem as AFormItem,
|
||||||
Grid,
|
Grid,
|
||||||
Input as AInput,
|
Input as AInput,
|
||||||
InputSearch as AInputSearch,
|
|
||||||
Menu as AMenu,
|
Menu as AMenu,
|
||||||
MenuItem as AMenuItem,
|
MenuItem as AMenuItem,
|
||||||
Modal,
|
Modal,
|
||||||
Modal as AModal,
|
Modal as AModal,
|
||||||
Pagination as APagination,
|
Pagination as APagination,
|
||||||
RadioButton as ARadioButton,
|
|
||||||
RadioGroup as ARadioGroup,
|
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
Space as ASpace,
|
||||||
Spin as ASpin,
|
Spin as ASpin,
|
||||||
Table as ATable,
|
Table as ATable,
|
||||||
Tag as ATag,
|
Tag as ATag,
|
||||||
Textarea as ATextarea,
|
|
||||||
Typography,
|
|
||||||
Upload as AUpload,
|
Upload as AUpload,
|
||||||
message,
|
message,
|
||||||
theme,
|
theme,
|
||||||
@@ -40,14 +35,11 @@ import type { TableColumnsType, UploadProps } from 'ant-design-vue';
|
|||||||
import {
|
import {
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
DownOutlined,
|
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
ExportOutlined,
|
|
||||||
FileExcelOutlined,
|
FileExcelOutlined,
|
||||||
FilterOutlined,
|
FilterOutlined,
|
||||||
MoreOutlined,
|
MoreOutlined,
|
||||||
PhoneOutlined,
|
PhoneOutlined,
|
||||||
PlusOutlined,
|
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
UserAddOutlined,
|
UserAddOutlined,
|
||||||
@@ -100,8 +92,6 @@ import {
|
|||||||
splitPersonHonorific,
|
splitPersonHonorific,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
|
||||||
Typography;
|
|
||||||
const { token } = theme.useToken();
|
const { token } = theme.useToken();
|
||||||
const screens = Grid.useBreakpoint();
|
const screens = Grid.useBreakpoint();
|
||||||
const isMobile = computed(() => !screens.value.md);
|
const isMobile = computed(() => !screens.value.md);
|
||||||
@@ -296,11 +286,6 @@ const mobileFilterBadgeCount = computed(() =>
|
|||||||
convertedFilter.value ? '1' : '',
|
convertedFilter.value ? '1' : '',
|
||||||
].filter(Boolean).length,
|
].filter(Boolean).length,
|
||||||
);
|
);
|
||||||
const filterBtnLabel = computed(() =>
|
|
||||||
mobileFilterBadgeCount.value
|
|
||||||
? `فیلتر (${toFaDigits(mobileFilterBadgeCount.value)})`
|
|
||||||
: 'فیلتر',
|
|
||||||
);
|
|
||||||
|
|
||||||
type LeadFacetKey =
|
type LeadFacetKey =
|
||||||
| 'assignee'
|
| 'assignee'
|
||||||
@@ -580,13 +565,6 @@ const rangeTo = computed(() =>
|
|||||||
);
|
);
|
||||||
const selectedIds = computed(() => [...selected.value]);
|
const selectedIds = computed(() => [...selected.value]);
|
||||||
|
|
||||||
const sortLabels: Record<SortKey, string> = {
|
|
||||||
newest: 'تاریخ جدیدترین',
|
|
||||||
updated: 'آخرین بهروزرسانی',
|
|
||||||
follow_up: 'پیگیری بعدی',
|
|
||||||
last_contact: 'آخرین تماس',
|
|
||||||
};
|
|
||||||
|
|
||||||
/** چیپهای فیلتر = ستونهای واقعی سازمان (نه نامهای ثابت قدیمی) */
|
/** چیپهای فیلتر = ستونهای واقعی سازمان (نه نامهای ثابت قدیمی) */
|
||||||
const stageCards = computed((): LeadStatCard[] => {
|
const stageCards = computed((): LeadStatCard[] => {
|
||||||
return stages.value.map((s) => ({
|
return stages.value.map((s) => ({
|
||||||
@@ -656,9 +634,9 @@ function onHeaderMenu(key: string) {
|
|||||||
else if (key === 'phone') phoneImportTrigger.value?.click();
|
else if (key === 'phone') phoneImportTrigger.value?.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHeaderTab(key: string | number) {
|
function onHeaderTab(key: string | undefined) {
|
||||||
const value = String(key);
|
if (!key) return;
|
||||||
setStageFilter(value === 'all' ? '' : value);
|
setStageFilter(key === 'all' ? '' : key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSearchInput(value: string) {
|
function onSearchInput(value: string) {
|
||||||
@@ -689,27 +667,6 @@ function onRemoveFilter(key: string) {
|
|||||||
else if (key === 'archived') setArchivedFilter(false);
|
else if (key === 'archived') setArchivedFilter(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** گزینههای سلکت موبایل — برچسب + تعداد */
|
|
||||||
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) {
|
|
||||||
return Boolean(card.stageId && stageId.value === card.stageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectStatCard(card: LeadStatCard) {
|
|
||||||
if (!card.stageId) return;
|
|
||||||
setStageFilter(isStatActive(card) ? '' : card.stageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stageTint(color: string | null | undefined): StageTint {
|
function stageTint(color: string | null | undefined): StageTint {
|
||||||
const c = (color || '').toLowerCase();
|
const c = (color || '').toLowerCase();
|
||||||
if (c === 'amber' || c === 'yellow' || c === 'orange') return 'amber';
|
if (c === 'amber' || c === 'yellow' || c === 'orange') return 'amber';
|
||||||
@@ -1427,13 +1384,6 @@ async function assignSelected() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openBulkStageReason() {
|
|
||||||
if (!bulkStageId.value || !selectedIds.value.length) return;
|
|
||||||
bulkStageReason.value = '';
|
|
||||||
bulkStageReasonError.value = '';
|
|
||||||
bulkStageReasonOpen.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelBulkStageReason() {
|
function cancelBulkStageReason() {
|
||||||
bulkStageReasonOpen.value = false;
|
bulkStageReasonOpen.value = false;
|
||||||
bulkStageReason.value = '';
|
bulkStageReason.value = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user