Adding registration date and multiple addresses for contacts and leads.
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
toFaDigits,
|
||||
} from '@/lib/jalali';
|
||||
import {
|
||||
UiBusyOverlay,
|
||||
UiButton,
|
||||
UiDropdownMenu,
|
||||
UiModal,
|
||||
@@ -123,6 +124,8 @@ const activityModal = ref<{
|
||||
} | null>(null);
|
||||
const menuId = ref<string | null>(null);
|
||||
const busy = ref(false);
|
||||
const pageBusy = ref(false);
|
||||
const busyMessage = ref('لطفاً صبر کنید…');
|
||||
const importMsg = ref('');
|
||||
const counts = ref<Record<ActivityFilter, number>>({
|
||||
today: 0,
|
||||
@@ -391,6 +394,8 @@ function closePopovers() {
|
||||
|
||||
async function exportExcel() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -405,11 +410,13 @@ async function exportExcel() {
|
||||
error.value = 'خروجی اکسل ناموفق بود.';
|
||||
} finally {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = false;
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -433,6 +440,7 @@ function onImportFail(message: string) {
|
||||
|
||||
function onImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -473,6 +481,7 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<section class="page" @click="closePopovers">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<nav class="crumbs" aria-label="مسیر">
|
||||
<RouterLink :to="{ name: 'home' }">خانه</RouterLink>
|
||||
<span>‹</span>
|
||||
@@ -484,7 +493,7 @@ onUnmounted(() => {
|
||||
lead="کارهای امروز، ارجاع به همکار و پیگیری وضعیت."
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" @click.stop="exportExcel">
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" :loading="pageBusy" @click.stop="exportExcel">
|
||||
<span class="btn-full">خروجی اکسل</span>
|
||||
<span class="btn-short">خروجی</span>
|
||||
</UiButton>
|
||||
@@ -497,10 +506,12 @@ onUnmounted(() => {
|
||||
@fail="onImportFail"
|
||||
@settled="onImportSettled"
|
||||
>
|
||||
<UiButton variant="ghost" type="button" :disabled="busy">
|
||||
<span class="btn-full">ورود از اکسل</span>
|
||||
<span class="btn-short">ورود</span>
|
||||
</UiButton>
|
||||
<template #default="{ loading }">
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" :loading="loading">
|
||||
<span class="btn-full">ورود از اکسل</span>
|
||||
<span class="btn-short">ورود</span>
|
||||
</UiButton>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<UiButton variant="primary" @click="activityModal = {}">
|
||||
<UiIcon name="plus" :size="16" />
|
||||
|
||||
@@ -8,6 +8,7 @@ import CustomerMoodFace from '@/components/CustomerMoodFace.vue';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
||||
import {
|
||||
UiBusyOverlay,
|
||||
UiButton,
|
||||
UiDropdownMenu,
|
||||
UiModal,
|
||||
@@ -52,6 +53,8 @@ const moodFilter = computed<PersonMood | 'all'>(() => {
|
||||
const q = ref(typeof route.query.q === 'string' ? route.query.q : '');
|
||||
const loading = ref(false);
|
||||
const busy = ref(false);
|
||||
const pageBusy = ref(false);
|
||||
const busyMessage = ref('لطفاً صبر کنید…');
|
||||
const error = ref('');
|
||||
const importMsg = ref('');
|
||||
const people = ref<PaginatedResponse<PersonDto> | null>(null);
|
||||
@@ -208,6 +211,8 @@ async function setMoodFor(person: PersonDto, mood: PersonMood) {
|
||||
|
||||
async function exportExcel() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -227,6 +232,7 @@ async function exportExcel() {
|
||||
error.value = 'خروجی اکسل ناموفق بود.';
|
||||
} finally {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +245,7 @@ const importPath = computed(() =>
|
||||
|
||||
function onImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = false;
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -258,6 +265,8 @@ async function onImportDone(data: ImportContactsResult) {
|
||||
|
||||
function onPhoneImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال ورود مخاطبین گوشی…';
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -279,6 +288,7 @@ function onPhoneImportFail(message: string) {
|
||||
|
||||
function onPhoneImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
function onImportFail(message: string) {
|
||||
@@ -287,6 +297,7 @@ function onImportFail(message: string) {
|
||||
|
||||
function onImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -302,12 +313,13 @@ onMounted(load);
|
||||
|
||||
<template>
|
||||
<section class="page" @click="closePopups">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<UiPageHeader
|
||||
title="مخاطبین"
|
||||
lead="مدیریت و مشاهده اشخاص و شرکتها"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy" @click.stop="exportExcel">
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
||||
<span class="btn-full">خروجی اکسل</span>
|
||||
<span class="btn-short">خروجی</span>
|
||||
</UiButton>
|
||||
@@ -320,10 +332,12 @@ onMounted(load);
|
||||
@fail="onImportFail"
|
||||
@settled="onImportSettled"
|
||||
>
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy">
|
||||
<span class="btn-full">ورود از اکسل</span>
|
||||
<span class="btn-short">ورود</span>
|
||||
</UiButton>
|
||||
<template #default="{ loading }">
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy" :loading="loading">
|
||||
<span class="btn-full">ورود از اکسل</span>
|
||||
<span class="btn-short">ورود</span>
|
||||
</UiButton>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<PhoneContactsImport
|
||||
v-if="tab === 'people'"
|
||||
|
||||
@@ -262,13 +262,21 @@ onMounted(load);
|
||||
<div><dt>تلفن</dt><dd dir="ltr">{{ lead.phone || '—' }}</dd></div>
|
||||
<div><dt>شهر</dt><dd>{{ lead.city || '—' }}</dd></div>
|
||||
<div><dt>منطقه</dt><dd>{{ lead.region || '—' }}</dd></div>
|
||||
<div><dt>اینستاگرام</dt><dd dir="ltr">{{ lead.instagram || '—' }}</dd></div>
|
||||
<div><dt>صنف</dt><dd>{{ lead.trade || '—' }}</dd></div>
|
||||
<div><dt>منبع</dt><dd>{{ lead.source || '—' }}</dd></div>
|
||||
<div><dt>وضعیت</dt><dd>{{ lead.stageName }}</dd></div>
|
||||
<div><dt>کارشناس</dt><dd>{{ lead.assigneeName || '—' }}</dd></div>
|
||||
<div><dt>تاریخ ثبت</dt><dd>{{ formatDate(lead.createdAt) }}</dd></div>
|
||||
<div><dt>آخرین تماس</dt><dd>{{ formatDate(lead.lastContactAt) }}</dd></div>
|
||||
<div><dt>پیگیری بعدی</dt><dd>{{ formatDate(lead.nextFollowUpAt) }}</dd></div>
|
||||
<div><dt>روز در مرحله</dt><dd>{{ toFaDigits(lead.daysInStage) }}</dd></div>
|
||||
<div v-if="lead.addresses?.length" class="full">
|
||||
<dt>آدرسها</dt>
|
||||
<dd>
|
||||
<p v-for="(addr, i) in lead.addresses" :key="i" class="addr-line">{{ addr }}</p>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="lead.notes" class="full">
|
||||
<dt>یادداشت</dt>
|
||||
<dd>{{ lead.notes }}</dd>
|
||||
@@ -398,6 +406,14 @@ onMounted(load);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.addr-line {
|
||||
margin: 0 0 0.25rem;
|
||||
}
|
||||
|
||||
.addr-line:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.timeline {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
|
||||
@@ -4,12 +4,14 @@ import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { api } from '@/lib/api';
|
||||
import {
|
||||
formatJalaliNumeric,
|
||||
formatRelativeContact,
|
||||
toFaDigits,
|
||||
} from '@/lib/jalali';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { canManageSettings } from '@/lib/roles';
|
||||
import {
|
||||
UiBusyOverlay,
|
||||
UiButton,
|
||||
UiDropdownMenu,
|
||||
UiEmptyState,
|
||||
@@ -102,6 +104,8 @@ const isAdmin = computed(() => canManageSettings(auth.user?.role));
|
||||
const q = ref(typeof route.query.q === 'string' ? route.query.q : '');
|
||||
const loading = ref(false);
|
||||
const busy = ref(false);
|
||||
const pageBusy = ref(false);
|
||||
const busyMessage = ref('لطفاً صبر کنید…');
|
||||
const error = ref('');
|
||||
const okMsg = ref('');
|
||||
const data = ref<PaginatedResponse<LeadDto> | null>(null);
|
||||
@@ -134,6 +138,8 @@ const createForm = ref({
|
||||
city: '',
|
||||
region: '',
|
||||
source: '',
|
||||
instagram: '',
|
||||
addresses: [''] as string[],
|
||||
stageId: '',
|
||||
assigneeId: '',
|
||||
});
|
||||
@@ -638,6 +644,8 @@ function openCreate() {
|
||||
city: '',
|
||||
region: '',
|
||||
source: '',
|
||||
instagram: '',
|
||||
addresses: [''],
|
||||
stageId: stages.value[0]?.id ?? '',
|
||||
assigneeId: '',
|
||||
};
|
||||
@@ -646,6 +654,18 @@ function openCreate() {
|
||||
createOpen.value = true;
|
||||
}
|
||||
|
||||
function addCreateAddress() {
|
||||
createForm.value.addresses.push('');
|
||||
}
|
||||
|
||||
function removeCreateAddress(index: number) {
|
||||
if (createForm.value.addresses.length <= 1) {
|
||||
createForm.value.addresses[0] = '';
|
||||
return;
|
||||
}
|
||||
createForm.value.addresses.splice(index, 1);
|
||||
}
|
||||
|
||||
function openEdit(lead: LeadDto) {
|
||||
rowMenuId.value = null;
|
||||
editingLeadId.value = lead.id;
|
||||
@@ -657,6 +677,8 @@ function openEdit(lead: LeadDto) {
|
||||
city: lead.city ?? '',
|
||||
region: lead.region ?? '',
|
||||
source: lead.source ?? '',
|
||||
instagram: lead.instagram ?? '',
|
||||
addresses: lead.addresses?.length ? [...lead.addresses] : [''],
|
||||
stageId: lead.stageId,
|
||||
assigneeId: lead.assigneeId ?? '',
|
||||
};
|
||||
@@ -803,6 +825,8 @@ async function submitCreate() {
|
||||
city: createForm.value.city.trim() || null,
|
||||
region: createForm.value.region.trim() || null,
|
||||
source: createForm.value.source.trim() || null,
|
||||
instagram: createForm.value.instagram.trim() || null,
|
||||
addresses: createForm.value.addresses.map((a) => a.trim()).filter(Boolean),
|
||||
stageId: createForm.value.stageId || undefined,
|
||||
assigneeId: createForm.value.assigneeId || null,
|
||||
};
|
||||
@@ -890,6 +914,8 @@ async function archiveSelected() {
|
||||
|
||||
async function exportExcel() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||
error.value = '';
|
||||
try {
|
||||
const { data: blob } = await api.get<Blob>('/leads/export', {
|
||||
@@ -905,6 +931,7 @@ async function exportExcel() {
|
||||
error.value = 'خروجی اکسل ناموفق بود.';
|
||||
} finally {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,13 +946,19 @@ async function pollImport(jobId: string) {
|
||||
try {
|
||||
const { data: job } = await api.get<LeadImportJobDto>(`/leads/imports/${jobId}`);
|
||||
importJob.value = job;
|
||||
if (job.status === 'pending' || job.status === 'processing') {
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = `در حال ورود لیدها… ${toFaDigits(job.processedCount)} از ${toFaDigits(job.totalCount || 0)}`;
|
||||
}
|
||||
if (job.status === 'done' || job.status === 'failed' || job.status === 'completed') {
|
||||
stopImportPoll();
|
||||
pageBusy.value = false;
|
||||
okMsg.value = `ورود: موفق ${toFaDigits(job.successCount)} · تکراری ${toFaDigits(job.duplicateCount)} · خطا ${toFaDigits(job.errorCount)}`;
|
||||
await load();
|
||||
}
|
||||
} catch {
|
||||
stopImportPoll();
|
||||
pageBusy.value = false;
|
||||
error.value = 'پیگیری وضعیت ورود ناموفق بود.';
|
||||
}
|
||||
}
|
||||
@@ -938,6 +971,7 @@ function startImportPoll(jobId: string) {
|
||||
|
||||
function onExcelImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = false;
|
||||
okMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -949,6 +983,8 @@ function onExcelImportDone(result: ImportContactsResult) {
|
||||
return;
|
||||
}
|
||||
importJob.value = job;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال ورود لیدها…';
|
||||
startImportPoll(job.id);
|
||||
}
|
||||
|
||||
@@ -962,6 +998,8 @@ function onExcelImportSettled() {
|
||||
|
||||
function onPhoneImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال ورود مخاطبین گوشی…';
|
||||
okMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -983,6 +1021,7 @@ function onPhoneImportFail(message: string) {
|
||||
|
||||
function onPhoneImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
function goDetail(id: string) {
|
||||
@@ -1027,12 +1066,13 @@ onBeforeUnmount(() => {
|
||||
|
||||
<template>
|
||||
<section class="page" @click="closePopups">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<UiPageHeader
|
||||
title="لیدها"
|
||||
lead="مدیریت و پیگیری تمام لیدهای ورودی"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy" @click.stop="exportExcel">
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
||||
<span class="btn-full">خروجی اکسل</span>
|
||||
<span class="btn-short">خروجی</span>
|
||||
</UiButton>
|
||||
@@ -1045,10 +1085,12 @@ onBeforeUnmount(() => {
|
||||
@fail="onExcelImportFail"
|
||||
@settled="onExcelImportSettled"
|
||||
>
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy">
|
||||
<span class="btn-full">ورود از اکسل</span>
|
||||
<span class="btn-short">ورود</span>
|
||||
</UiButton>
|
||||
<template #default="{ loading }">
|
||||
<UiButton variant="ghost" size="sm" :disabled="busy" :loading="loading">
|
||||
<span class="btn-full">ورود از اکسل</span>
|
||||
<span class="btn-short">ورود</span>
|
||||
</UiButton>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<input
|
||||
ref="logoFileInput"
|
||||
@@ -1383,6 +1425,7 @@ onBeforeUnmount(() => {
|
||||
<th>شماره تماس</th>
|
||||
<th>شهر / منطقه</th>
|
||||
<th>منبع لید</th>
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>وضعیت</th>
|
||||
<th>مسئول</th>
|
||||
<th>آخرین فعالیت</th>
|
||||
@@ -1454,6 +1497,7 @@ onBeforeUnmount(() => {
|
||||
<span v-if="lead.source" class="source-pill">{{ lead.source }}</span>
|
||||
<span v-else class="muted-dash">—</span>
|
||||
</td>
|
||||
<td class="date-col">{{ formatJalaliNumeric(new Date(lead.createdAt)) }}</td>
|
||||
<td>
|
||||
<span class="stage-pill" :data-tint="stageTintForLead(lead)">
|
||||
{{ lead.stageName }}
|
||||
@@ -1575,7 +1619,9 @@ onBeforeUnmount(() => {
|
||||
@fail="onExcelImportFail"
|
||||
@settled="onExcelImportSettled"
|
||||
>
|
||||
<UiButton variant="ghost" :disabled="busy">ورود از فایل</UiButton>
|
||||
<template #default="{ loading }">
|
||||
<UiButton variant="ghost" :disabled="busy" :loading="loading">ورود از فایل</UiButton>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1633,6 +1679,35 @@ onBeforeUnmount(() => {
|
||||
منبع
|
||||
<input v-model="createForm.source" placeholder="سایت، نمایشگاه…" />
|
||||
</label>
|
||||
<label>
|
||||
پیج اینستاگرام
|
||||
<input
|
||||
v-model="createForm.instagram"
|
||||
class="ltr"
|
||||
dir="ltr"
|
||||
placeholder="@username یا لینک"
|
||||
/>
|
||||
</label>
|
||||
<div class="addresses">
|
||||
<div class="addresses-head">
|
||||
<span>آدرسها</span>
|
||||
<button type="button" class="add-addr" @click="addCreateAddress">+ افزودن آدرس</button>
|
||||
</div>
|
||||
<div v-for="(_, idx) in createForm.addresses" :key="idx" class="addr-row">
|
||||
<input
|
||||
v-model="createForm.addresses[idx]"
|
||||
:placeholder="idx === 0 ? 'آدرس اصلی' : `آدرس ${idx + 1}`"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="rm-addr"
|
||||
aria-label="حذف آدرس"
|
||||
@click="removeCreateAddress(idx)"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="create-grid">
|
||||
<label>
|
||||
وضعیت
|
||||
@@ -2814,6 +2889,50 @@ button.m-line {
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.create-form .addresses {
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.create-form .addresses-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 0.86rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.create-form .add-addr {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--accent-deep, var(--accent));
|
||||
font: inherit;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.create-form .addr-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 0.45rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.create-form .rm-addr {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: #fff;
|
||||
color: var(--muted);
|
||||
font: inherit;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.create-form label {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
|
||||
@@ -60,7 +60,9 @@ const phone = ref('');
|
||||
const mobile = ref('');
|
||||
const position = ref('');
|
||||
const website = ref('');
|
||||
const instagram = ref('');
|
||||
const referrer = ref('');
|
||||
const addresses = ref<string[]>(['']);
|
||||
const notes = ref('');
|
||||
const tagsRaw = ref('');
|
||||
const companyId = ref('');
|
||||
@@ -204,7 +206,9 @@ function fill(p: PersonDto) {
|
||||
mobile.value = p.mobile ?? '';
|
||||
position.value = p.position ?? '';
|
||||
website.value = p.website ?? '';
|
||||
instagram.value = p.instagram ?? '';
|
||||
referrer.value = p.referrer ?? '';
|
||||
addresses.value = p.addresses?.length ? [...p.addresses] : [''];
|
||||
notes.value = p.notes ?? '';
|
||||
tagsRaw.value = (p.tags ?? []).join('، ');
|
||||
companyId.value = p.company?.id ?? '';
|
||||
@@ -214,6 +218,18 @@ function fill(p: PersonDto) {
|
||||
loyaltyTierName.value = p.loyaltyTier?.name ?? '';
|
||||
}
|
||||
|
||||
function addAddress() {
|
||||
addresses.value.push('');
|
||||
}
|
||||
|
||||
function removeAddress(index: number) {
|
||||
if (addresses.value.length <= 1) {
|
||||
addresses.value[0] = '';
|
||||
return;
|
||||
}
|
||||
addresses.value.splice(index, 1);
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
@@ -253,7 +269,9 @@ function payload(): CreatePersonRequest {
|
||||
mobile: mobile.value || undefined,
|
||||
position: position.value || undefined,
|
||||
website: website.value || undefined,
|
||||
instagram: instagram.value || undefined,
|
||||
referrer: referrer.value || undefined,
|
||||
addresses: addresses.value.map((a) => a.trim()).filter(Boolean),
|
||||
notes: notes.value || undefined,
|
||||
tags: parseTags(tagsRaw.value),
|
||||
companyId: companyId.value || null,
|
||||
@@ -446,10 +464,31 @@ onMounted(load);
|
||||
<UiInput id="website" v-model="website" dir="ltr" placeholder="https://example.com" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="پیج اینستاگرام" for-id="instagram">
|
||||
<UiInput id="instagram" v-model="instagram" dir="ltr" placeholder="@username یا لینک" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="معرف" for-id="referrer">
|
||||
<UiInput id="referrer" v-model="referrer" placeholder="نام معرف" />
|
||||
</UiField>
|
||||
|
||||
<div class="crm-col-span-full addresses">
|
||||
<div class="addresses-head">
|
||||
<span>آدرسها</span>
|
||||
<button type="button" class="add-addr" @click="addAddress">+ افزودن آدرس</button>
|
||||
</div>
|
||||
<div v-for="(_, idx) in addresses" :key="idx" class="addr-row">
|
||||
<UiInput
|
||||
:id="`address-${idx}`"
|
||||
v-model="addresses[idx]"
|
||||
:placeholder="idx === 0 ? 'آدرس اصلی' : `آدرس ${idx + 1}`"
|
||||
/>
|
||||
<button type="button" class="rm-addr" aria-label="حذف آدرس" @click="removeAddress(idx)">
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="crm-col-span-full">
|
||||
<UiField label="وضعیت مشتری">
|
||||
<div class="moods">
|
||||
@@ -550,6 +589,57 @@ onMounted(load);
|
||||
margin-bottom: var(--sp-3);
|
||||
}
|
||||
|
||||
.addresses {
|
||||
display: grid;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.addresses-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--sp-2);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.add-addr {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--accent-deep);
|
||||
font: inherit;
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: var(--fw-bold);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.addr-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--sp-2);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.rm-addr {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
color: var(--muted);
|
||||
font: inherit;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rm-addr:hover {
|
||||
color: #b91c1c;
|
||||
border-color: #fecaca;
|
||||
}
|
||||
|
||||
.moods {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -341,7 +341,9 @@ const infoEmpty = computed(() => {
|
||||
!p.email &&
|
||||
!p.position &&
|
||||
!p.website &&
|
||||
!p.instagram &&
|
||||
!p.referrer &&
|
||||
!(p.addresses?.length) &&
|
||||
!p.company &&
|
||||
!externalCode.value &&
|
||||
!p.notes?.trim() &&
|
||||
@@ -630,7 +632,17 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
||||
<div><dt>سمت</dt><dd>{{ person.position || '—' }}</dd></div>
|
||||
<div><dt>کد مبدأ</dt><dd dir="ltr">{{ externalCode ? toFaDigits(externalCode) : '—' }}</dd></div>
|
||||
<div><dt>وبسایت</dt><dd>{{ person.website || '—' }}</dd></div>
|
||||
<div><dt>اینستاگرام</dt><dd dir="ltr">{{ person.instagram || '—' }}</dd></div>
|
||||
<div><dt>معرف</dt><dd>{{ person.referrer || '—' }}</dd></div>
|
||||
<div class="wide">
|
||||
<dt>آدرسها</dt>
|
||||
<dd>
|
||||
<template v-if="person.addresses?.length">
|
||||
<p v-for="(addr, i) in person.addresses" :key="i" class="addr-line">{{ addr }}</p>
|
||||
</template>
|
||||
<template v-else>—</template>
|
||||
</dd>
|
||||
</div>
|
||||
<div><dt>شرکت</dt><dd>{{ person.company?.name || '—' }}</dd></div>
|
||||
<div><dt>تلفن</dt><dd>{{ phoneDisplay }}</dd></div>
|
||||
<div><dt>ایمیل</dt><dd>{{ emailDisplay }}</dd></div>
|
||||
@@ -906,9 +918,20 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
||||
<div><dt>سمت</dt><dd>{{ person.position || '—' }}</dd></div>
|
||||
<div><dt>کد مبدأ</dt><dd dir="ltr">{{ externalCode ? toFaDigits(externalCode) : '—' }}</dd></div>
|
||||
<div><dt>وبسایت</dt><dd>{{ person.website || '—' }}</dd></div>
|
||||
<div><dt>اینستاگرام</dt><dd dir="ltr">{{ person.instagram || '—' }}</dd></div>
|
||||
<div><dt>معرف</dt><dd>{{ person.referrer || '—' }}</dd></div>
|
||||
<div class="wide">
|
||||
<dt>آدرسها</dt>
|
||||
<dd>
|
||||
<template v-if="person.addresses?.length">
|
||||
<p v-for="(addr, i) in person.addresses" :key="i" class="addr-line">{{ addr }}</p>
|
||||
</template>
|
||||
<template v-else>—</template>
|
||||
</dd>
|
||||
</div>
|
||||
<div><dt>شرکت</dt><dd>{{ person.company?.name || '—' }}</dd></div>
|
||||
<div><dt>مسئول</dt><dd>{{ person.owner?.fullName || '—' }}</dd></div>
|
||||
<div><dt>تاریخ ثبت</dt><dd>{{ registeredAt }}</dd></div>
|
||||
<div>
|
||||
<dt>باشگاه</dt>
|
||||
<dd>
|
||||
@@ -1176,6 +1199,23 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.facts .wide,
|
||||
.info-panel .wide {
|
||||
grid-template-columns: 5.6rem minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.info-panel .wide {
|
||||
grid-template-columns: 7.5rem 1fr;
|
||||
}
|
||||
|
||||
.addr-line {
|
||||
margin: 0 0 0.25rem;
|
||||
}
|
||||
|
||||
.addr-line:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
updateDealStage,
|
||||
} from '@/lib/pipeline-board';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import UiBusyOverlay from '@/components/ui/UiBusyOverlay.vue';
|
||||
import UiButton from '@/components/ui/UiButton.vue';
|
||||
import UiInput from '@/components/ui/UiInput.vue';
|
||||
import UiModal from '@/components/ui/UiModal.vue';
|
||||
@@ -400,8 +401,13 @@ function onOpenDeal(dealId: string) {
|
||||
void router.push({ name: 'deal-detail', params: { id: dealId } });
|
||||
}
|
||||
|
||||
const pageBusy = ref(false);
|
||||
const busyMessage = ref('لطفاً صبر کنید…');
|
||||
|
||||
async function exportExcel() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -416,11 +422,13 @@ async function exportExcel() {
|
||||
error.value = 'خروجی اکسل ناموفق بود.';
|
||||
} finally {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = false;
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -448,6 +456,7 @@ function onImportFail(message: string) {
|
||||
|
||||
function onImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
function onMenuDeal(dealId: string) {
|
||||
@@ -478,6 +487,7 @@ defineExpose({ updateDealStage: applyUpdateDealStage });
|
||||
|
||||
<template>
|
||||
<section class="page" dir="rtl">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<PipelineToolbar
|
||||
pipeline-name="کاریز فروش"
|
||||
:pipeline-options="pipelineOptions"
|
||||
|
||||
@@ -7,6 +7,7 @@ import { formatClockFa, formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||
import { formatMoney } from '@/lib/money';
|
||||
import {
|
||||
UiBadge,
|
||||
UiBusyOverlay,
|
||||
UiButton,
|
||||
UiDropdownMenu,
|
||||
UiEmptyState,
|
||||
@@ -42,6 +43,8 @@ const sortOpen = ref(false);
|
||||
const moreOpen = ref(false);
|
||||
const productModal = ref(false);
|
||||
const busy = ref(false);
|
||||
const pageBusy = ref(false);
|
||||
const busyMessage = ref('لطفاً صبر کنید…');
|
||||
const importMsg = ref('');
|
||||
|
||||
const categories = computed(() => {
|
||||
@@ -168,6 +171,8 @@ async function load() {
|
||||
async function exportExcel() {
|
||||
closeMenus();
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -185,12 +190,14 @@ async function exportExcel() {
|
||||
error.value = 'خروجی اکسل ناموفق بود.';
|
||||
} finally {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onImportStart() {
|
||||
closeMenus();
|
||||
busy.value = true;
|
||||
pageBusy.value = false;
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -214,6 +221,7 @@ function onImportFail(message: string) {
|
||||
|
||||
function onImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
async function toggleActive(product: ProductDto) {
|
||||
@@ -250,12 +258,13 @@ onMounted(load);
|
||||
|
||||
<template>
|
||||
<section class="crm-page" @click="closeMenus">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<UiPageHeader
|
||||
title="محصولات"
|
||||
lead="مدیریت محصولات، قیمتها و موجودی"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" @click="exportExcel">
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" :loading="pageBusy" @click="exportExcel">
|
||||
خروجی اکسل
|
||||
</UiButton>
|
||||
<ExcelImportFlow
|
||||
@@ -267,7 +276,9 @@ onMounted(load);
|
||||
@fail="onImportFail"
|
||||
@settled="onImportSettled"
|
||||
>
|
||||
<UiButton variant="ghost" type="button" :disabled="busy">ورود از اکسل</UiButton>
|
||||
<template #default="{ loading }">
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" :loading="loading">ورود از اکسل</UiButton>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<UiButton variant="primary" @click="productModal = true">
|
||||
<UiIcon name="plus" :size="16" />
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
updateDealStage,
|
||||
} from '@/lib/pipeline-board';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import UiBusyOverlay from '@/components/ui/UiBusyOverlay.vue';
|
||||
import UiButton from '@/components/ui/UiButton.vue';
|
||||
import UiInput from '@/components/ui/UiInput.vue';
|
||||
import UiModal from '@/components/ui/UiModal.vue';
|
||||
@@ -379,8 +380,13 @@ function onOpenCard(cardId: string) {
|
||||
void router.push({ name: 'project-card-detail', params: { id: cardId } });
|
||||
}
|
||||
|
||||
const pageBusy = ref(false);
|
||||
const busyMessage = ref('لطفاً صبر کنید…');
|
||||
|
||||
async function exportExcel() {
|
||||
busy.value = true;
|
||||
pageBusy.value = true;
|
||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -397,11 +403,13 @@ async function exportExcel() {
|
||||
error.value = 'خروجی اکسل ناموفق بود.';
|
||||
} finally {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onImportStart() {
|
||||
busy.value = true;
|
||||
pageBusy.value = false;
|
||||
importMsg.value = '';
|
||||
error.value = '';
|
||||
}
|
||||
@@ -429,6 +437,7 @@ function onImportFail(message: string) {
|
||||
|
||||
function onImportSettled() {
|
||||
busy.value = false;
|
||||
pageBusy.value = false;
|
||||
}
|
||||
|
||||
function onMenuCard(cardId: string) {
|
||||
@@ -457,6 +466,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
<template>
|
||||
<section class="page" dir="rtl">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<PipelineToolbar
|
||||
pipeline-name="کاریز پروژه — کارهای تیمی"
|
||||
icon="grid"
|
||||
|
||||
Reference in New Issue
Block a user