feat(web): adopt vuesax icons and shared skeleton loading
Replace the inline SVG icon set with the vuesax linear pack, add skeleton primitives for loading states, and keep page scroll inside the app shell. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,7 +47,7 @@ import {
|
||||
StarOutlined,
|
||||
UploadOutlined,
|
||||
WarningOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import {
|
||||
calendarDaysBetween,
|
||||
@@ -57,6 +57,7 @@ import {
|
||||
toFaDigits,
|
||||
} from '@/lib/jalali';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import ActivitiesKanban from '@/components/activities/ActivitiesKanban.vue';
|
||||
import ActivityStagesManager from '@/components/activities/ActivityStagesManager.vue';
|
||||
import ActivityTypesManager from '@/components/activities/ActivityTypesManager.vue';
|
||||
@@ -1388,7 +1389,8 @@ onUnmounted(() => {
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="8" :card="false">
|
||||
<a-empty
|
||||
v-if="listEmpty"
|
||||
:description="
|
||||
@@ -1678,7 +1680,8 @@ onUnmounted(() => {
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Switch as ASwitch,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
@@ -71,7 +70,8 @@ import {
|
||||
TeamOutlined,
|
||||
ThunderboltOutlined,
|
||||
CarOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type {
|
||||
ActivityBoardDto,
|
||||
ActivityDto,
|
||||
@@ -670,7 +670,8 @@ watch([id, isNew], () => void load(), { immediate: true });
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-row :gutter="[24, 24]" align="top">
|
||||
<a-col :xs="24" :lg="17" :xl="18">
|
||||
<a-card :bordered="false">
|
||||
@@ -1027,7 +1028,8 @@ watch([id, isNew], () => void load(), { immediate: true });
|
||||
</a-affix>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-modal
|
||||
v-model:open="newPersonOpen"
|
||||
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
Card as ACard,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { DownloadOutlined } from '@ant-design/icons-vue';
|
||||
import { DownloadOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Link: ATypographyLink } = Typography;
|
||||
|
||||
@@ -109,7 +109,8 @@ onMounted(load);
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="5">
|
||||
<a-card v-if="listEmpty && !error" :bordered="false">
|
||||
<a-empty description="پیوستی ثبت نشده." />
|
||||
</a-card>
|
||||
@@ -152,6 +153,7 @@ onMounted(load);
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -30,15 +30,15 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tabs as ATabs,
|
||||
TabPane as ATabPane,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { ReloadOutlined } from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -526,7 +526,8 @@ onMounted(() => {
|
||||
<a-alert v-if="okMsg" type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="5">
|
||||
<a-card v-if="initialLoading" :bordered="false">
|
||||
<a-typography-text type="secondary">لطفاً صبر کنید.</a-typography-text>
|
||||
</a-card>
|
||||
@@ -724,7 +725,8 @@ onMounted(() => {
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-modal
|
||||
:open="!!purgeItem"
|
||||
|
||||
@@ -42,7 +42,6 @@ import {
|
||||
MenuItem as AMenuItem,
|
||||
Modal as AModal,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Switch as ASwitch,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
@@ -55,7 +54,8 @@ import {
|
||||
PlusOutlined,
|
||||
ReloadOutlined,
|
||||
SearchOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
@@ -613,11 +613,8 @@ watch(trigger, (next, prev) => {
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin
|
||||
:spinning="loading"
|
||||
:style="{ flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }"
|
||||
wrapper-class-name="auto-spin-fill"
|
||||
>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8" :min-height="360">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:style="{ flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }"
|
||||
@@ -871,7 +868,8 @@ watch(trigger, (next, prev) => {
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-modal
|
||||
v-model:open="createOpen"
|
||||
|
||||
@@ -32,15 +32,15 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
TabPane as ATabPane,
|
||||
Tabs as ATabs,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { PlusOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
|
||||
const {
|
||||
Title: ATypographyTitle,
|
||||
@@ -404,7 +404,8 @@ onMounted(load);
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="5">
|
||||
<a-empty
|
||||
v-if="!loading && !items.length"
|
||||
:description="emptyDescription"
|
||||
@@ -459,7 +460,8 @@ onMounted(load);
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
|
||||
<a-modal
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
Flex as AFlex,
|
||||
Progress as AProgress,
|
||||
Row as ARow,
|
||||
Spin as ASpin,
|
||||
Statistic as AStatistic,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
@@ -27,8 +26,9 @@ import {
|
||||
ReloadOutlined,
|
||||
RiseOutlined,
|
||||
WalletOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import type { CommissionEntryDto } from '@mento/shared';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||
|
||||
@@ -184,53 +184,55 @@ onMounted(load);
|
||||
:style="{ marginTop: '16px' }"
|
||||
/>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="items"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty
|
||||
description="پورسانتی ثبت نشده است؛ هنوز هیچ فاکتوری دارای پورسانت در سامانه ثبت نگردیده است."
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'کارشناس فروش'">
|
||||
<a-typography-text strong>{{ record.userName }}</a-typography-text>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="6" :card="false">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="items"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty
|
||||
description="پورسانتی ثبت نشده است؛ هنوز هیچ فاکتوری دارای پورسانت در سامانه ثبت نگردیده است."
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'شماره و عنوان فاکتور'">
|
||||
<a-flex vertical :gap="0">
|
||||
<RouterLink
|
||||
:to="{ name: 'invoice-detail', params: { id: record.invoiceId } }"
|
||||
custom
|
||||
v-slot="{ href, navigate }"
|
||||
>
|
||||
<a-typography-link :href="href" @click="navigate">
|
||||
{{ record.invoiceNumber }}
|
||||
</a-typography-link>
|
||||
</RouterLink>
|
||||
<a-typography-text v-if="record.invoiceTitle" type="secondary">
|
||||
{{ record.invoiceTitle }}
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'کارشناس فروش'">
|
||||
<a-typography-text strong>{{ record.userName }}</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'شماره و عنوان فاکتور'">
|
||||
<a-flex vertical :gap="0">
|
||||
<RouterLink
|
||||
:to="{ name: 'invoice-detail', params: { id: record.invoiceId } }"
|
||||
custom
|
||||
v-slot="{ href, navigate }"
|
||||
>
|
||||
<a-typography-link :href="href" @click="navigate">
|
||||
{{ record.invoiceNumber }}
|
||||
</a-typography-link>
|
||||
</RouterLink>
|
||||
<a-typography-text v-if="record.invoiceTitle" type="secondary">
|
||||
{{ record.invoiceTitle }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مبلغ پورسانت'">
|
||||
<a-typography-text strong>
|
||||
{{ formatMoney(record.amount, record.currency) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag :color="record.status === 'posted' ? 'success' : 'default'" :bordered="false">
|
||||
{{ record.status === 'posted' ? 'ثبتشده' : 'باطل' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مبلغ پورسانت'">
|
||||
<a-typography-text strong>
|
||||
{{ formatMoney(record.amount, record.currency) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag :color="record.status === 'posted' ? 'success' : 'default'" :bordered="false">
|
||||
{{ record.status === 'posted' ? 'ثبتشده' : 'باطل' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-table>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -2,6 +2,26 @@
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Breadcrumb as ABreadcrumb,
|
||||
BreadcrumbItem as ABreadcrumbItem,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
Divider as ADivider,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
Modal,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CheckOutlined, DeleteOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { api } from '@/lib/api';
|
||||
import type { CompanyDto, CreateCompanyRequest } from '@mento/shared';
|
||||
import CustomFieldsSection from '@/components/CustomFieldsSection.vue';
|
||||
@@ -10,15 +30,8 @@ import RelatedTasksPanel from '@/components/routines/RelatedTasksPanel.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import CustomerGroupPicker from '@/components/CustomerGroupPicker.vue';
|
||||
import { formatLocalDateInput, parseLocalInput } from '@/lib/jalali';
|
||||
import {
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiTextarea,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -181,13 +194,22 @@ async function submit() {
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
if (!id.value || !confirm('این شرکت حذف شود؟ افراد متصل بدون شرکت میمانند.')) return;
|
||||
try {
|
||||
await api.delete(`/companies/${id.value}`);
|
||||
await router.push({ name: 'contacts', query: { tab: 'companies' } });
|
||||
} catch {
|
||||
error.value = 'حذف ناموفق بود';
|
||||
}
|
||||
if (!id.value) return;
|
||||
Modal.confirm({
|
||||
title: 'حذف شرکت',
|
||||
content: 'این شرکت حذف شود؟ افراد متصل بدون شرکت میمانند.',
|
||||
okText: 'حذف',
|
||||
okType: 'danger',
|
||||
cancelText: 'انصراف',
|
||||
async onOk() {
|
||||
try {
|
||||
await api.delete(`/companies/${id.value}`);
|
||||
await router.push({ name: 'contacts', query: { tab: 'companies' } });
|
||||
} catch {
|
||||
error.value = 'حذف ناموفق بود';
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
@@ -202,232 +224,256 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="crm-page company-form-page" :class="{ embedded }" dir="rtl">
|
||||
<UiPageHeader
|
||||
<a-flex vertical :gap="16" dir="rtl">
|
||||
<a-flex
|
||||
v-if="!embedded"
|
||||
:title="pageTitle"
|
||||
description="ثبت و ویرایش مشخصات حقوقی، اطلاعات تماس و فیلدهای سفارشی شرکت"
|
||||
justify="space-between"
|
||||
align="center"
|
||||
wrap="wrap"
|
||||
:gap="12"
|
||||
>
|
||||
<template #breadcrumb>
|
||||
<RouterLink :to="{ name: 'contacts', query: { tab: 'companies' } }" class="breadcrumb-link">
|
||||
شرکتها
|
||||
</RouterLink>
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
<span>{{ pageTitle }}</span>
|
||||
</template>
|
||||
|
||||
<template #actions>
|
||||
<UiButton :loading="saving" @click="submit">
|
||||
<template #icon>
|
||||
<UiIcon name="check-plain" />
|
||||
</template>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-breadcrumb>
|
||||
<a-breadcrumb-item>
|
||||
<RouterLink :to="{ name: 'contacts', query: { tab: 'companies' } }">
|
||||
شرکتها
|
||||
</RouterLink>
|
||||
</a-breadcrumb-item>
|
||||
<a-breadcrumb-item>{{ pageTitle }}</a-breadcrumb-item>
|
||||
</a-breadcrumb>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
{{ pageTitle }}
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
ثبت و ویرایش مشخصات حقوقی، اطلاعات تماس و فیلدهای سفارشی شرکت
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-space :size="8" wrap>
|
||||
<a-button type="primary" :loading="saving" @click="submit">
|
||||
<template #icon><CheckOutlined /></template>
|
||||
ذخیره
|
||||
</UiButton>
|
||||
<UiButton variant="ghost" :disabled="saving" @click="cancel">
|
||||
انصراف
|
||||
</UiButton>
|
||||
<UiButton v-if="!isNew" variant="danger" :disabled="saving" @click="remove">
|
||||
<template #icon>
|
||||
<UiIcon name="trash" />
|
||||
</template>
|
||||
</a-button>
|
||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||
<a-button
|
||||
v-if="!isNew"
|
||||
danger
|
||||
:disabled="saving"
|
||||
@click="remove"
|
||||
>
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
حذف
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<form class="crm-form" @submit.prevent="submit">
|
||||
<UiCard title="اطلاعات اصلی شرکت" class="section-card">
|
||||
<div class="crm-form-grid-2">
|
||||
<UiField label="نام شرکت" required class="col-span-2">
|
||||
<UiInput
|
||||
id="name"
|
||||
v-model="name"
|
||||
required
|
||||
minlength="2"
|
||||
placeholder="مثال: دادهپردازی سپهر"
|
||||
/>
|
||||
</UiField>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-form layout="vertical" @finish="submit">
|
||||
<a-card :bordered="false">
|
||||
<a-divider orientation="right">اطلاعات اصلی شرکت</a-divider>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="نام شرکت" required>
|
||||
<a-input
|
||||
id="name"
|
||||
v-model:value="name"
|
||||
:minlength="2"
|
||||
placeholder="مثال: دادهپردازی سپهر"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="کد شرکت">
|
||||
<a-input id="code" v-model:value="code" placeholder="کد داخلی" dir="ltr" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="کد دیدار شرکت">
|
||||
<a-input
|
||||
id="sourceRef"
|
||||
v-model:value="sourceRef"
|
||||
placeholder="مثال: 5277"
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="گروههای شرکت">
|
||||
<CustomerGroupPicker v-model="groupIds" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="تاریخ ثبت شرکت">
|
||||
<JalaliDateInput id="registeredAt" v-model="registeredAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="برچسبها">
|
||||
<a-input
|
||||
id="company-tags"
|
||||
v-model:value="tagsRaw"
|
||||
placeholder="شرکتی، VIP (با کاما جدا کنید)"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="توضیحات شرکت">
|
||||
<a-textarea
|
||||
id="notes"
|
||||
v-model:value="notes"
|
||||
:rows="4"
|
||||
placeholder="توضیحات مهم، حوزههای همکاری..."
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<UiField label="کد شرکت">
|
||||
<UiInput id="code" v-model="code" placeholder="کد داخلی" dir="ltr" />
|
||||
</UiField>
|
||||
<a-card :bordered="false" :style="{ marginTop: '16px' }">
|
||||
<a-divider orientation="right">اطلاعات تماس و آدرس</a-divider>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="تلفن شرکت">
|
||||
<a-input
|
||||
id="phone"
|
||||
v-model:value="phone"
|
||||
type="tel"
|
||||
placeholder="۰۲۱..."
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="تلفن های دیگر شرکت">
|
||||
<a-input
|
||||
id="otherPhones"
|
||||
v-model:value="otherPhones"
|
||||
placeholder="با کاما جدا کنید"
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="ایمیل شرکت">
|
||||
<a-input
|
||||
id="email"
|
||||
v-model:value="email"
|
||||
type="email"
|
||||
placeholder="info@company.ir"
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="ایمیل های دیگر شرکت">
|
||||
<a-input
|
||||
id="otherEmails"
|
||||
v-model:value="otherEmails"
|
||||
placeholder="با کاما جدا کنید"
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شماره فکس">
|
||||
<a-input id="fax" v-model:value="fax" type="tel" dir="ltr" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="سایت های شرکت">
|
||||
<a-input
|
||||
id="website"
|
||||
v-model:value="website"
|
||||
placeholder="https://..."
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="استان">
|
||||
<a-input id="province" v-model:value="province" placeholder="مثال: تهران" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شهرستان">
|
||||
<a-input id="city" v-model:value="city" placeholder="مثال: تهران" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="کد پستی">
|
||||
<a-input id="postalCode" v-model:value="postalCode" dir="ltr" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="آدرس">
|
||||
<a-input
|
||||
id="address"
|
||||
v-model:value="address"
|
||||
placeholder="نشانی، طبقه، پلاک..."
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<UiField label="کد دیدار شرکت">
|
||||
<UiInput id="sourceRef" v-model="sourceRef" placeholder="مثال: 5277" dir="ltr" />
|
||||
</UiField>
|
||||
<a-card :bordered="false" :style="{ marginTop: '16px' }">
|
||||
<a-divider orientation="right">اطلاعات حقوقی و ثبتی</a-divider>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شناسه ملی">
|
||||
<a-input
|
||||
id="nationalId"
|
||||
v-model:value="nationalId"
|
||||
placeholder="شناسه ملی ۱۱ رقمی"
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شماره اقتصادی">
|
||||
<a-input id="economicCode" v-model:value="economicCode" dir="ltr" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شماره ثبت">
|
||||
<a-input
|
||||
id="registrationNumber"
|
||||
v-model:value="registrationNumber"
|
||||
dir="ltr"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<UiField label="گروههای شرکت" class="col-span-2">
|
||||
<CustomerGroupPicker v-model="groupIds" />
|
||||
</UiField>
|
||||
<CustomFieldsSection entity-type="company" v-model="customFields" />
|
||||
<RelatedTasksPanel
|
||||
v-if="!isNew && id"
|
||||
:entity="{ type: 'company', id, label: name }"
|
||||
/>
|
||||
<EntityTimeline v-if="!isNew && id" entity-type="company" :entity-id="id" />
|
||||
|
||||
<UiField label="تاریخ ثبت شرکت">
|
||||
<JalaliDateInput id="registeredAt" v-model="registeredAt" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="برچسبها" class="col-span-2">
|
||||
<UiInput
|
||||
id="company-tags"
|
||||
v-model="tagsRaw"
|
||||
placeholder="شرکتی، VIP (با کاما جدا کنید)"
|
||||
/>
|
||||
</UiField>
|
||||
|
||||
<UiField label="توضیحات شرکت" class="col-span-2">
|
||||
<UiTextarea
|
||||
id="notes"
|
||||
v-model="notes"
|
||||
:rows="4"
|
||||
placeholder="توضیحات مهم، حوزههای همکاری..."
|
||||
/>
|
||||
</UiField>
|
||||
</div>
|
||||
</UiCard>
|
||||
|
||||
<UiCard title="اطلاعات تماس و آدرس" class="section-card">
|
||||
<div class="crm-form-grid-2">
|
||||
<UiField label="تلفن شرکت">
|
||||
<UiInput id="phone" v-model="phone" type="tel" placeholder="۰۲۱..." dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="تلفن های دیگر شرکت">
|
||||
<UiInput id="otherPhones" v-model="otherPhones" placeholder="با کاما جدا کنید" dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="ایمیل شرکت">
|
||||
<UiInput
|
||||
id="email"
|
||||
v-model="email"
|
||||
type="email"
|
||||
placeholder="info@company.ir"
|
||||
dir="ltr"
|
||||
/>
|
||||
</UiField>
|
||||
|
||||
<UiField label="ایمیل های دیگر شرکت">
|
||||
<UiInput id="otherEmails" v-model="otherEmails" placeholder="با کاما جدا کنید" dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="شماره فکس">
|
||||
<UiInput id="fax" v-model="fax" type="tel" dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="سایت های شرکت">
|
||||
<UiInput id="website" v-model="website" placeholder="https://..." dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="استان">
|
||||
<UiInput id="province" v-model="province" placeholder="مثال: تهران" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="شهرستان">
|
||||
<UiInput id="city" v-model="city" placeholder="مثال: تهران" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="کد پستی">
|
||||
<UiInput id="postalCode" v-model="postalCode" dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="آدرس" class="col-span-2">
|
||||
<UiInput id="address" v-model="address" placeholder="نشانی، طبقه، پلاک..." />
|
||||
</UiField>
|
||||
</div>
|
||||
</UiCard>
|
||||
|
||||
<UiCard title="اطلاعات حقوقی و ثبتی" class="section-card">
|
||||
<div class="crm-form-grid-2">
|
||||
<UiField label="شناسه ملی">
|
||||
<UiInput id="nationalId" v-model="nationalId" placeholder="شناسه ملی ۱۱ رقمی" dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="شماره اقتصادی">
|
||||
<UiInput id="economicCode" v-model="economicCode" dir="ltr" />
|
||||
</UiField>
|
||||
|
||||
<UiField label="شماره ثبت">
|
||||
<UiInput id="registrationNumber" v-model="registrationNumber" dir="ltr" />
|
||||
</UiField>
|
||||
</div>
|
||||
</UiCard>
|
||||
|
||||
<CustomFieldsSection entity-type="company" v-model="customFields" />
|
||||
<RelatedTasksPanel v-if="!isNew && id" :entity="{ type: 'company', id, label: name }" />
|
||||
<EntityTimeline v-if="!isNew && id" entity-type="company" :entity-id="id" />
|
||||
|
||||
<div class="form-bottom-actions">
|
||||
<UiButton type="submit" :loading="saving">
|
||||
<template #icon>
|
||||
<UiIcon name="check-plain" />
|
||||
</template>
|
||||
ذخیره اطلاعات
|
||||
</UiButton>
|
||||
<UiButton variant="ghost" type="button" :disabled="saving" @click="cancel">
|
||||
انصراف
|
||||
</UiButton>
|
||||
<UiButton v-if="!isNew" variant="danger" type="button" :disabled="saving" @click="remove">
|
||||
حذف شرکت
|
||||
</UiButton>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<a-flex justify="flex-end" :style="{ marginTop: '16px' }">
|
||||
<a-space :size="8" wrap>
|
||||
<a-button type="primary" html-type="submit" :loading="saving">
|
||||
<template #icon><CheckOutlined /></template>
|
||||
ذخیره اطلاعات
|
||||
</a-button>
|
||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||
<a-button
|
||||
v-if="!isNew"
|
||||
danger
|
||||
:disabled="saving"
|
||||
@click="remove"
|
||||
>
|
||||
حذف شرکت
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-form>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.company-form-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-6);
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.company-form-page.embedded {
|
||||
max-width: none;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.embedded-actions {
|
||||
display: flex;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.breadcrumb-link {
|
||||
color: var(--color-text-secondary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.breadcrumb-link:hover {
|
||||
color: var(--color-brand-600);
|
||||
}
|
||||
|
||||
.breadcrumb-separator {
|
||||
margin: 0 var(--sp-2);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.section-card {
|
||||
padding: var(--sp-6);
|
||||
}
|
||||
|
||||
.col-span-2 {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
.form-bottom-actions {
|
||||
display: flex;
|
||||
gap: var(--sp-3);
|
||||
justify-content: flex-end;
|
||||
margin-top: var(--sp-4);
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.col-span-2 {
|
||||
grid-column: span 1;
|
||||
}
|
||||
|
||||
.form-bottom-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -46,13 +46,14 @@ import {
|
||||
PhoneOutlined,
|
||||
PlusOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||
import CustomerMoodFace from '@/components/CustomerMoodFace.vue';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import PersonFormView from '@/views/PersonFormView.vue';
|
||||
import CompanyFormView from '@/views/CompanyFormView.vue';
|
||||
import SavedFiltersBar from '@/components/SavedFiltersBar.vue';
|
||||
@@ -782,7 +783,8 @@ function peopleCustomRow(record: PersonDto) {
|
||||
<a-alert v-if="importMsg" type="success" show-icon :message="importMsg" />
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin v-if="!error" :spinning="loading" tip="در حال بارگذاری…">
|
||||
<CrmSkeleton v-if="!error" :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="10" :card="false">
|
||||
<template v-if="tab === 'people'">
|
||||
<template v-if="people?.items.length">
|
||||
<a-alert v-if="selectedIds.length" type="info" show-icon>
|
||||
@@ -1042,7 +1044,6 @@ function peopleCustomRow(record: PersonDto) {
|
||||
v-else-if="!loading"
|
||||
description="شخصی ثبت نشده است. اولین مخاطب یا مشتری را اضافه کنید."
|
||||
/>
|
||||
<div v-else :style="{ minHeight: '160px' }" />
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
@@ -1157,9 +1158,9 @@ function peopleCustomRow(record: PersonDto) {
|
||||
v-else-if="!loading"
|
||||
description="شرکتی ثبت نشده است. اولین شرکت یا سازمان را اضافه کنید."
|
||||
/>
|
||||
<div v-else :style="{ minHeight: '160px' }" />
|
||||
</template>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-flex v-if="total" justify="flex-start" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-pagination
|
||||
|
||||
@@ -17,9 +17,9 @@ import {
|
||||
FormItem as AFormItem,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Spin as ASpin,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -134,8 +134,9 @@ onMounted(load);
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-card v-if="!loading" :bordered="false">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="6">
|
||||
<a-card :bordered="false">
|
||||
<a-form layout="vertical" @finish="save">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12" :lg="8">
|
||||
@@ -218,6 +219,7 @@ onMounted(load);
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -26,11 +26,11 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { PlusOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -250,7 +250,8 @@ onMounted(load);
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="6" :avatar="false">
|
||||
<a-empty
|
||||
v-if="!loading && !visible.length"
|
||||
description="فیلدی تعریف نشده است. هیچ فیلد سفارشی برای این موجودیت وجود ندارد."
|
||||
@@ -285,7 +286,8 @@ onMounted(load);
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-spin>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
Select as ASelect,
|
||||
Space,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
@@ -35,7 +34,8 @@ import {
|
||||
FileTextOutlined,
|
||||
PlusOutlined,
|
||||
UserAddOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { api } from '@/lib/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { canAssignToOthers } from '@/lib/assign-access';
|
||||
@@ -607,7 +607,8 @@ onMounted(load);
|
||||
|
||||
<template>
|
||||
<div dir="rtl">
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-flex
|
||||
v-if="!embedded"
|
||||
justify="space-between"
|
||||
@@ -1026,7 +1027,8 @@ onMounted(load);
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-modal
|
||||
v-model:open="newPersonOpen"
|
||||
|
||||
@@ -30,11 +30,11 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tabs as ATabs,
|
||||
TabPane as ATabPane,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -585,7 +585,8 @@ void loadActors();
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="5">
|
||||
<a-card v-if="showDeletesEmpty" :bordered="false">
|
||||
<a-empty description="حذفی ثبت نشده. از این به بعد حذفها با نام کاربر و زمان اینجا دیده میشوند." />
|
||||
</a-card>
|
||||
@@ -661,7 +662,8 @@ void loadActors();
|
||||
</template>
|
||||
</a-list>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-flex
|
||||
v-if="listSource"
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { RouterLink } from 'vue-router';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { RouterLink, useRouter } from 'vue-router';
|
||||
import type { DiscDistributionRow } from '@mento/shared';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Progress as AProgress,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { ArrowRightOutlined, DownloadOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { UiButton, UiPageHeader } from '@/components/ui';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
const router = useRouter();
|
||||
const rows = ref<DiscDistributionRow[]>([]);
|
||||
const error = ref('');
|
||||
const loading = ref(true);
|
||||
@@ -40,36 +56,76 @@ async function exportExcel() {
|
||||
}
|
||||
}
|
||||
|
||||
const total = () => rows.value.reduce((sum, row) => sum + row.count, 0);
|
||||
const totalCount = computed(() => rows.value.reduce((sum, row) => sum + row.count, 0));
|
||||
|
||||
function percentOf(count: number) {
|
||||
return totalCount.value ? Math.round((count / totalCount.value) * 100) : 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="page">
|
||||
<UiPageHeader title="توزیع تیپهای DISC" lead="فقط ارزیابیهای تأییدشده و قابل اتکا، در محدودهٔ دسترسی شما" :back-to="{ name: 'contacts' }">
|
||||
<template #actions>
|
||||
<UiButton variant="outline" :disabled="exporting" @click="exportExcel">خروجی اکسل</UiButton>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
<p v-if="loading" class="muted">در حال بارگذاری…</p>
|
||||
<p v-else-if="error" class="error">{{ error }}</p>
|
||||
<p v-else-if="!rows.length" class="muted">هنوز تیپ قابل اتکایی ثبت نشده است.</p>
|
||||
<ul v-else class="list">
|
||||
<li v-for="row in rows" :key="row.label">
|
||||
<RouterLink :to="{ name: 'contacts', query: { disc: row.label } }">{{ row.label }}</RouterLink>
|
||||
<span>{{ toFaDigits(row.count) }}</span>
|
||||
<i><b :style="{ width: `${total() ? Math.round((row.count / total()) * 100) : 0}%` }" /></i>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="muted">درصدها سهم مشتریان دارای ارزیابی معتبر هستند، نه دقت یک آزمون روانشناسی.</p>
|
||||
</section>
|
||||
</template>
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :span="24">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
||||
<div>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
توزیع تیپهای DISC
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
فقط ارزیابیهای تأییدشده و قابل اتکا، در محدودهٔ دسترسی شما
|
||||
</a-typography-text>
|
||||
</div>
|
||||
<a-space wrap>
|
||||
<a-button @click="router.push({ name: 'contacts' })">
|
||||
<template #icon><ArrowRightOutlined /></template>
|
||||
بازگشت
|
||||
</a-button>
|
||||
<a-button :disabled="exporting" :loading="exporting" @click="exportExcel">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
|
||||
<style scoped>
|
||||
.page { display: flex; flex-direction: column; gap: 0.8rem; }
|
||||
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
|
||||
.list li { display: grid; grid-template-columns: 6rem auto 1fr; gap: 0.6rem; align-items: center; }
|
||||
.list i { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
|
||||
.list b { display: block; height: 100%; background: #0f766e; }
|
||||
.muted { color: #64748b; }
|
||||
.error { color: #b91c1c; }
|
||||
</style>
|
||||
<a-col :span="24">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="6">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-empty
|
||||
v-else-if="!rows.length"
|
||||
description="هنوز تیپ قابل اتکایی ثبت نشده است."
|
||||
/>
|
||||
<a-card v-else :bordered="false">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-row
|
||||
v-for="row in rows"
|
||||
:key="row.label"
|
||||
:gutter="[12, 8]"
|
||||
align="middle"
|
||||
>
|
||||
<a-col :xs="24" :sm="4">
|
||||
<RouterLink :to="{ name: 'contacts', query: { disc: row.label } }">
|
||||
{{ row.label }}
|
||||
</RouterLink>
|
||||
</a-col>
|
||||
<a-col :xs="8" :sm="4">
|
||||
<a-typography-text>{{ toFaDigits(row.count) }}</a-typography-text>
|
||||
</a-col>
|
||||
<a-col :xs="16" :sm="16">
|
||||
<a-progress :percent="percentOf(row.count)" :show-info="false" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-typography-text type="secondary">
|
||||
درصدها سهم مشتریان دارای ارزیابی معتبر هستند، نه دقت یک آزمون روانشناسی.
|
||||
</a-typography-text>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
@@ -21,12 +21,12 @@ import {
|
||||
InputNumber as AInputNumber,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { DeleteOutlined, EditOutlined } from '@ant-design/icons-vue';
|
||||
import { DeleteOutlined, EditOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -201,7 +201,8 @@ onMounted(load);
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="6">
|
||||
<a-empty
|
||||
v-if="!loading && !items.length"
|
||||
description="هنوز مقالهای ثبت نشده است. با ثبت اولین سؤال و پاسخ، پایگاه دانش را تکمیل کنید."
|
||||
@@ -240,6 +241,7 @@ onMounted(load);
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -9,13 +9,6 @@ import HomeHero from '@/components/dashboard/HomeHero.vue';
|
||||
import HomeAlertsSection from '@/components/dashboard/HomeAlertsSection.vue';
|
||||
import HomeKpiRow from '@/components/dashboard/HomeKpiRow.vue';
|
||||
import HomeBirthdayStrip from '@/components/dashboard/HomeBirthdayStrip.vue';
|
||||
import HomeSalesTrend from '@/components/dashboard/HomeSalesTrend.vue';
|
||||
import HomeCustomerGrowth from '@/components/dashboard/HomeCustomerGrowth.vue';
|
||||
import HomeDealOutcomeChart from '@/components/dashboard/HomeDealOutcomeChart.vue';
|
||||
import HomeFunnelChart from '@/components/dashboard/HomeFunnelChart.vue';
|
||||
import HomeSourcesChart from '@/components/dashboard/HomeSourcesChart.vue';
|
||||
import HomeLostReasonsChart from '@/components/dashboard/HomeLostReasonsChart.vue';
|
||||
import HomeActivityMixChart from '@/components/dashboard/HomeActivityMixChart.vue';
|
||||
import HomeAiAssistant from '@/components/dashboard/HomeAiAssistant.vue';
|
||||
import HomeRecentActivities from '@/components/dashboard/HomeRecentActivities.vue';
|
||||
import HomeMiniPipeline from '@/components/dashboard/HomeMiniPipeline.vue';
|
||||
@@ -88,26 +81,12 @@ function formatKpiValue(key: string, value: number) {
|
||||
return toFaDigits(value);
|
||||
}
|
||||
|
||||
const emptySalesSummary = {
|
||||
openCount: 0,
|
||||
wonCount: 0,
|
||||
lostCount: 0,
|
||||
openAmount: 0,
|
||||
wonAmount: 0,
|
||||
lostAmount: 0,
|
||||
winRate: 0,
|
||||
};
|
||||
|
||||
function formatChange(value: number | null) {
|
||||
if (value == null) return '';
|
||||
const sign = value >= 0 ? '+' : '';
|
||||
return `${sign}${toFaDigits(value)}٪`;
|
||||
}
|
||||
|
||||
function formatTrendAmount(value: number) {
|
||||
return formatMoney(value, home.value?.currency ?? 'IRR');
|
||||
}
|
||||
|
||||
function clearAsk() {
|
||||
askAnswer.value = '';
|
||||
askError.value = '';
|
||||
@@ -276,60 +255,6 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="flex items-center gap-2.5 border-b border-slate-200/80 pb-3">
|
||||
<div class="w-1.5 h-6 rounded-full bg-emerald-600"></div>
|
||||
<div>
|
||||
<h2 class="text-lg font-extrabold text-slate-800">تحلیل فروش</h2>
|
||||
<p class="text-xs text-slate-500">روند، نتیجه معاملات و قیف مراحل باز</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="grid grid-cols-1 lg:grid-cols-12 gap-6">
|
||||
<div class="lg:col-span-7 min-w-0">
|
||||
<HomeSalesTrend
|
||||
:trend="home?.salesTrend ?? []"
|
||||
:change-percent="home?.kpis?.[0]?.changePercent ?? null"
|
||||
:format-change="formatChange"
|
||||
:format-amount="formatTrendAmount"
|
||||
/>
|
||||
</div>
|
||||
<div class="lg:col-span-5 min-w-0">
|
||||
<HomeDealOutcomeChart
|
||||
:summary="home?.salesSummary ?? emptySalesSummary"
|
||||
:format-amount="formatTrendAmount"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="grid grid-cols-1 lg:grid-cols-12 gap-6">
|
||||
<div class="lg:col-span-7 min-w-0">
|
||||
<HomeCustomerGrowth :series="home?.customerGrowth ?? []" />
|
||||
</div>
|
||||
<div class="lg:col-span-5 min-w-0">
|
||||
<HomeFunnelChart
|
||||
:funnel="home?.funnel ?? []"
|
||||
:format-amount="formatTrendAmount"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="flex items-center gap-2.5 border-b border-slate-200/80 pb-3">
|
||||
<div class="w-1.5 h-6 rounded-full bg-teal-600"></div>
|
||||
<div>
|
||||
<h2 class="text-lg font-extrabold text-slate-800">منابع و عملیات</h2>
|
||||
<p class="text-xs text-slate-500">ورود مشتری، دلایل باخت و ترکیب پیگیریها</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<HomeSourcesChart :sources="home?.sources ?? []" />
|
||||
<HomeLostReasonsChart
|
||||
:reasons="home?.lostReasons ?? []"
|
||||
:format-amount="formatTrendAmount"
|
||||
/>
|
||||
<HomeActivityMixChart :items="home?.activityByType ?? []" />
|
||||
</section>
|
||||
|
||||
<section class="grid grid-cols-1 lg:grid-cols-12 gap-6 items-stretch">
|
||||
<div class="lg:col-span-6 min-w-0 flex">
|
||||
<HomeRecentActivities class="w-full" :activities="activities" :format-when="formatWhen" />
|
||||
|
||||
@@ -7,21 +7,48 @@ import { formatMoney } from '@/lib/money';
|
||||
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { canManageSettings } from '@/lib/roles';
|
||||
import { registerTableColumns, useTableColumns } from '@/lib/tableColumns';
|
||||
import {
|
||||
UiBadge,
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiSelect,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
InputNumber as AInputNumber,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Statistic as AStatistic,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import {
|
||||
BankOutlined,
|
||||
BoxPlotOutlined,
|
||||
HistoryOutlined,
|
||||
ReloadOutlined,
|
||||
WalletOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonKpi, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import type {
|
||||
InventoryStockRowDto,
|
||||
InventorySummaryDto,
|
||||
StockMovementDto,
|
||||
StockMovementType,
|
||||
} from '@mento/shared';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
const STOCK_COL_LABELS = ['نام کالا', 'واحد', 'موجودی'] as const;
|
||||
|
||||
registerTableColumns('inventory.stock', [...STOCK_COL_LABELS]);
|
||||
const tableCols = useTableColumns(() => 'inventory.stock');
|
||||
|
||||
const auth = useAuthStore();
|
||||
const canWrite = computed(() => canManageSettings(auth.user?.role));
|
||||
|
||||
@@ -31,7 +58,7 @@ const summary = ref<InventorySummaryDto | null>(null);
|
||||
const movements = ref<StockMovementDto[]>([]);
|
||||
const productId = ref('');
|
||||
const moveType = ref<'purchase' | 'adjustment'>('purchase');
|
||||
const quantity = ref('');
|
||||
const quantity = ref<number | undefined>(undefined);
|
||||
const note = ref('');
|
||||
const saving = ref(false);
|
||||
|
||||
@@ -43,12 +70,59 @@ const typeLabel: Record<StockMovementType, string> = {
|
||||
adjustment: 'اصلاح',
|
||||
};
|
||||
|
||||
const moveTypeOptions = [
|
||||
{ value: 'purchase', label: 'ورود خرید' },
|
||||
{ value: 'adjustment', label: 'اصلاح موجودی (عدد جدید)' },
|
||||
];
|
||||
|
||||
const productOptions = computed(() =>
|
||||
(summary.value?.products ?? []).map((p) => ({
|
||||
value: p.productId,
|
||||
label: p.name,
|
||||
})),
|
||||
);
|
||||
|
||||
const selectedStock = computed(
|
||||
() =>
|
||||
summary.value?.products.find((p) => p.productId === productId.value)
|
||||
?.stockQty ?? 0,
|
||||
);
|
||||
|
||||
const stockColumns = computed<TableColumnsType<InventoryStockRowDto>>(() => {
|
||||
const all: TableColumnsType<InventoryStockRowDto> = [
|
||||
{ title: 'نام کالا', key: 'نام کالا' },
|
||||
{
|
||||
title: 'واحد',
|
||||
key: 'واحد',
|
||||
customRender: ({ record }) => record.unit || 'عدد',
|
||||
},
|
||||
{ title: 'موجودی', key: 'موجودی' },
|
||||
];
|
||||
return all.filter((col) => {
|
||||
const key = String(col.key ?? '');
|
||||
if (!STOCK_COL_LABELS.includes(key as (typeof STOCK_COL_LABELS)[number])) {
|
||||
return true;
|
||||
}
|
||||
return tableCols.isVisible(key);
|
||||
});
|
||||
});
|
||||
|
||||
const movementColumns: TableColumnsType<StockMovementDto> = [
|
||||
{ title: 'کالا', key: 'کالا' },
|
||||
{
|
||||
title: 'نوع',
|
||||
key: 'نوع',
|
||||
customRender: ({ record }) => typeLabel[record.type],
|
||||
},
|
||||
{ title: 'مقدار', key: 'مقدار' },
|
||||
{
|
||||
title: 'تاریخ',
|
||||
key: 'تاریخ',
|
||||
customRender: ({ record }) =>
|
||||
formatJalaliNumeric(new Date(record.occurredAt)),
|
||||
},
|
||||
];
|
||||
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
@@ -94,7 +168,7 @@ async function submitMove() {
|
||||
quantity: sendQty,
|
||||
note: note.value.trim() || undefined,
|
||||
});
|
||||
quantity.value = '';
|
||||
quantity.value = undefined;
|
||||
note.value = '';
|
||||
await load();
|
||||
} catch (e) {
|
||||
@@ -111,278 +185,217 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="crm-page">
|
||||
<UiPageHeader
|
||||
title="انبار"
|
||||
lead="موجودی کالا، ورود خرید و مانده وقتی تهحساب وصل نباشد"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="ghost" type="button" :disabled="loading" @click="load">
|
||||
<UiIcon name="refresh" :size="16" />
|
||||
بروزرسانی
|
||||
</UiButton>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
||||
<div>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">انبار</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
موجودی کالا، ورود خرید و مانده وقتی تهحساب وصل نباشد
|
||||
</a-typography-text>
|
||||
</div>
|
||||
<a-button :disabled="loading" :loading="loading" @click="load">
|
||||
<template #icon><ReloadOutlined /></template>
|
||||
بروزرسانی
|
||||
</a-button>
|
||||
</a-flex>
|
||||
|
||||
<a-alert
|
||||
v-if="error"
|
||||
type="error"
|
||||
show-icon
|
||||
:message="error"
|
||||
closable
|
||||
@close="error = ''"
|
||||
/>
|
||||
|
||||
<CrmSkeleton :loading="loading && !summary">
|
||||
<a-alert
|
||||
v-if="summary && !summary.enabled"
|
||||
type="info"
|
||||
show-icon
|
||||
message="اتصال تهحساب فعال است؛ موجودی و مانده از حسابداری خارجی خوانده میشود."
|
||||
/>
|
||||
|
||||
<template v-else>
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="24" :md="8">
|
||||
<CrmSkeletonKpi>
|
||||
<a-card v-if="summary" :bordered="false">
|
||||
<a-statistic
|
||||
title="صندوق (وصولها)"
|
||||
:value="formatMoney(summary.cashTotal, summary.currency)"
|
||||
>
|
||||
<template #prefix><WalletOutlined /></template>
|
||||
</a-statistic>
|
||||
</a-card>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<CrmSkeletonKpi>
|
||||
<a-card v-if="summary" :bordered="false">
|
||||
<a-statistic
|
||||
title="مانده طرفحسابها"
|
||||
:value="formatMoney(summary.receivablesTotal, summary.currency)"
|
||||
>
|
||||
<template #prefix><BankOutlined /></template>
|
||||
</a-statistic>
|
||||
</a-card>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<CrmSkeletonKpi>
|
||||
<a-card v-if="summary" :bordered="false">
|
||||
<a-statistic title="نام انبار" :value="summary.warehouseName || '—'">
|
||||
<template #prefix><BoxPlotOutlined /></template>
|
||||
</a-statistic>
|
||||
</a-card>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-card v-if="summary && canWrite" :bordered="false" :style="{ marginTop: '16px' }">
|
||||
<a-form layout="vertical" @finish="submitMove">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :sm="12" :md="6">
|
||||
<a-form-item label="نوع گردش">
|
||||
<a-select v-model:value="moveType" :options="moveTypeOptions" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="6">
|
||||
<a-form-item label="محصول">
|
||||
<a-select
|
||||
v-model:value="productId"
|
||||
:options="productOptions"
|
||||
placeholder="انتخاب محصول"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="4">
|
||||
<a-form-item :label="moveType === 'adjustment' ? 'موجودی جدید' : 'تعداد'">
|
||||
<a-input-number
|
||||
v-model:value="quantity"
|
||||
:style="{ width: '100%' }"
|
||||
:placeholder="moveType === 'adjustment' ? 'موجودی جدید' : 'تعداد'"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="5">
|
||||
<a-form-item label="توضیح">
|
||||
<a-input v-model:value="note" placeholder="توضیح اختیاری…" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="3">
|
||||
<a-form-item label=" ">
|
||||
<a-button
|
||||
type="primary"
|
||||
html-type="submit"
|
||||
block
|
||||
:disabled="saving || !productId"
|
||||
:loading="saving"
|
||||
>
|
||||
ثبت گردش
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-row :gutter="[16, 16]" :style="{ marginTop: '16px' }">
|
||||
<a-col :xs="24" :lg="12">
|
||||
<CrmSkeletonTable :rows="8" :columns="3">
|
||||
<a-card v-if="summary" :bordered="false">
|
||||
<template #title>
|
||||
<a-flex align="center" :gap="8">
|
||||
<BoxPlotOutlined />
|
||||
<span>موجودی کالا</span>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template #extra>
|
||||
<TableColumnsMenu
|
||||
v-if="summary.products.length"
|
||||
table-key="inventory.stock"
|
||||
align="end"
|
||||
/>
|
||||
</template>
|
||||
<a-table
|
||||
:columns="stockColumns"
|
||||
:data-source="summary.products"
|
||||
:pagination="false"
|
||||
row-key="productId"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty description="محصولی در انبار تعریف نشده است." />
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'نام کالا'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>{{ record.name }}</a-typography-text>
|
||||
<a-typography-text v-if="record.sku" type="secondary">
|
||||
{{ record.sku }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'موجودی'">
|
||||
<a-tag
|
||||
:color="record.stockQty > 0 ? 'success' : 'error'"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ toFaDigits(String(record.stockQty)) }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</CrmSkeletonTable>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="24" :lg="12">
|
||||
<CrmSkeletonTable :rows="8" :columns="4">
|
||||
<a-card v-if="summary" :bordered="false">
|
||||
<template #title>
|
||||
<a-flex align="center" :gap="8">
|
||||
<HistoryOutlined />
|
||||
<span>گردش اخیر کالا</span>
|
||||
</a-flex>
|
||||
</template>
|
||||
<a-table
|
||||
:columns="movementColumns"
|
||||
:data-source="movements"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty description="هیچ گردشی ثبت نشده است." />
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'کالا'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>{{ record.productName }}</a-typography-text>
|
||||
<a-typography-text v-if="record.note" type="secondary">
|
||||
{{ record.note }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مقدار'">
|
||||
<a-tag
|
||||
:color="record.quantity > 0 ? 'success' : 'error'"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ record.quantity > 0 ? '+' : '' }}{{ toFaDigits(String(record.quantity)) }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</CrmSkeletonTable>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
|
||||
<p v-if="error" class="error-msg">{{ error }}</p>
|
||||
<p v-else-if="loading && !summary" class="muted">در حال بارگذاری…</p>
|
||||
|
||||
<div v-else-if="summary && !summary.enabled" class="notice-box">
|
||||
اتصال تهحساب فعال است؛ موجودی و مانده از حسابداری خارجی خوانده میشود.
|
||||
</div>
|
||||
|
||||
<template v-else-if="summary">
|
||||
<div class="kpis-grid">
|
||||
<UiCard padding="sm" class="kpi-card">
|
||||
<span class="kpi-label">صندوق (وصولها)</span>
|
||||
<strong class="kpi-value">{{ formatMoney(summary.cashTotal, summary.currency) }}</strong>
|
||||
</UiCard>
|
||||
<UiCard padding="sm" class="kpi-card">
|
||||
<span class="kpi-label">مانده طرفحسابها</span>
|
||||
<strong class="kpi-value">{{ formatMoney(summary.receivablesTotal, summary.currency) }}</strong>
|
||||
</UiCard>
|
||||
<UiCard padding="sm" class="kpi-card">
|
||||
<span class="kpi-label">نام انبار</span>
|
||||
<strong class="kpi-value">{{ summary.warehouseName }}</strong>
|
||||
</UiCard>
|
||||
</div>
|
||||
|
||||
<UiCard v-if="canWrite" padding="sm" class="move-form-card">
|
||||
<form class="move-form" @submit.prevent="submitMove">
|
||||
<UiSelect v-model="moveType">
|
||||
<option value="purchase">ورود خرید</option>
|
||||
<option value="adjustment">اصلاح موجودی (عدد جدید)</option>
|
||||
</UiSelect>
|
||||
<UiSelect v-model="productId">
|
||||
<option value="" disabled>انتخاب محصول</option>
|
||||
<option
|
||||
v-for="p in summary.products"
|
||||
:key="p.productId"
|
||||
:value="p.productId"
|
||||
>
|
||||
{{ p.name }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
<UiInput
|
||||
v-model="quantity"
|
||||
type="number"
|
||||
:placeholder="moveType === 'adjustment' ? 'موجودی جدید' : 'تعداد'"
|
||||
/>
|
||||
<UiInput v-model="note" placeholder="توضیح اختیاری…" />
|
||||
<UiButton variant="primary" type="submit" :disabled="saving || !productId" :loading="saving">
|
||||
ثبت گردش
|
||||
</UiButton>
|
||||
</form>
|
||||
</UiCard>
|
||||
|
||||
<div class="inventory-grid">
|
||||
<UiCard>
|
||||
<template #header>
|
||||
<div class="section-title">
|
||||
<UiIcon name="box" :size="18" />
|
||||
<h3>موجودی کالا</h3>
|
||||
<TableColumnsMenu
|
||||
v-if="summary.products.length"
|
||||
table-key="inventory.stock"
|
||||
align="end"
|
||||
style="margin-inline-start: auto"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<p v-if="!summary.products.length" class="muted empty-note">محصولی در انبار تعریف نشده است.</p>
|
||||
<table v-else v-table-cols="'inventory.stock'" class="crm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>نام کالا</th>
|
||||
<th>واحد</th>
|
||||
<th>موجودی</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="p in summary.products" :key="p.productId">
|
||||
<td>
|
||||
<strong>{{ p.name }}</strong>
|
||||
<small v-if="p.sku" class="sku-hint">{{ p.sku }}</small>
|
||||
</td>
|
||||
<td>{{ p.unit || 'عدد' }}</td>
|
||||
<td>
|
||||
<UiBadge :variant="p.stockQty > 0 ? 'success' : 'danger'" size="sm">
|
||||
{{ toFaDigits(String(p.stockQty)) }}
|
||||
</UiBadge>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</UiCard>
|
||||
|
||||
<UiCard>
|
||||
<template #header>
|
||||
<div class="section-title">
|
||||
<UiIcon name="clock" :size="18" />
|
||||
<h3>گردش اخیر کالا</h3>
|
||||
</div>
|
||||
</template>
|
||||
<p v-if="!movements.length" class="muted empty-note">هیچ گردشی ثبت نشده است.</p>
|
||||
<ul v-else class="moves-list">
|
||||
<li v-for="m in movements" :key="m.id">
|
||||
<div class="move-info">
|
||||
<strong>{{ m.productName }}</strong>
|
||||
<span class="move-type-tag">{{ typeLabel[m.type] }}</span>
|
||||
<small v-if="m.note" class="move-note">{{ m.note }}</small>
|
||||
</div>
|
||||
<div class="move-end">
|
||||
<UiBadge :variant="m.quantity > 0 ? 'success' : 'danger'" size="sm">
|
||||
{{ m.quantity > 0 ? '+' : '' }}{{ toFaDigits(String(m.quantity)) }}
|
||||
</UiBadge>
|
||||
<time class="move-time">{{ formatJalaliNumeric(new Date(m.occurredAt)) }}</time>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</UiCard>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.error-msg {
|
||||
color: var(--color-danger);
|
||||
font-weight: 600;
|
||||
font-size: var(--fs-sm);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.notice-box {
|
||||
background: var(--color-info-surface);
|
||||
border: 1px solid var(--color-info);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--sp-3) var(--sp-4);
|
||||
color: var(--color-info);
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
|
||||
.kpis-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.kpi-card {
|
||||
display: grid;
|
||||
gap: var(--sp-1);
|
||||
}
|
||||
|
||||
.kpi-label {
|
||||
display: block;
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.kpi-value {
|
||||
font-size: var(--fs-lg);
|
||||
color: var(--color-text-emphasis);
|
||||
}
|
||||
|
||||
.move-form-card {
|
||||
margin: var(--sp-2) 0;
|
||||
}
|
||||
|
||||
.move-form {
|
||||
display: grid;
|
||||
grid-template-columns: 10rem 1fr 8rem 1fr auto;
|
||||
gap: var(--sp-3);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.inventory-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.section-title h3 {
|
||||
margin: 0;
|
||||
font-size: var(--fs-base);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.sku-hint {
|
||||
display: block;
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
.empty-note {
|
||||
font-size: var(--fs-sm);
|
||||
padding: var(--sp-4) 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.moves-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.moves-list li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--sp-3);
|
||||
padding: var(--sp-2) 0;
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
}
|
||||
|
||||
.move-info {
|
||||
display: grid;
|
||||
gap: var(--sp-1);
|
||||
}
|
||||
|
||||
.move-info strong {
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--color-text-emphasis);
|
||||
}
|
||||
|
||||
.move-type-tag {
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
.move-note {
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
.move-end {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: var(--sp-1);
|
||||
}
|
||||
|
||||
.move-time {
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.kpis-grid,
|
||||
.inventory-grid,
|
||||
.move-form {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
@@ -42,7 +41,8 @@ import {
|
||||
FileTextOutlined,
|
||||
PlusOutlined,
|
||||
UserAddOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import InvoiceDocPreview from '@/components/InvoiceDocPreview.vue';
|
||||
@@ -1033,8 +1033,9 @@ onMounted(load);
|
||||
</a-button>
|
||||
</a-flex>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-form v-if="!loading" layout="vertical" @finish="save">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-form layout="vertical" @finish="save">
|
||||
<a-alert
|
||||
v-if="error"
|
||||
type="error"
|
||||
@@ -1547,7 +1548,8 @@ onMounted(load);
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<InvoiceDocPreview
|
||||
v-model:open="previewOpen"
|
||||
|
||||
@@ -33,7 +33,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
@@ -46,7 +45,8 @@ import {
|
||||
MoreOutlined,
|
||||
PlusOutlined,
|
||||
SearchOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import type {
|
||||
InvoiceDto,
|
||||
PaginatedResponse,
|
||||
@@ -641,87 +641,89 @@ defineExpose({ toggleSelect, pageCount, statusIcon });
|
||||
:style="{ marginTop: '16px' }"
|
||||
/>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
v-if="!error"
|
||||
:columns="columns"
|
||||
:data-source="pageItems"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedKeys,
|
||||
onChange: onTableSelectChange,
|
||||
onSelectAll: toggleSelectAll,
|
||||
}"
|
||||
:style="{ marginTop: '16px' }"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'مشتری'">
|
||||
<a-space :size="8">
|
||||
<a-avatar>{{ record.customerName.slice(0, 1) }}</a-avatar>
|
||||
<div>
|
||||
<div>{{ record.customerName }}</div>
|
||||
<a-typography-text v-if="record.personName" type="secondary">
|
||||
{{ record.personName }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="9" :card="false">
|
||||
<a-table
|
||||
v-if="!error"
|
||||
:columns="columns"
|
||||
:data-source="pageItems"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedKeys,
|
||||
onChange: onTableSelectChange,
|
||||
onSelectAll: toggleSelectAll,
|
||||
}"
|
||||
:style="{ marginTop: '16px' }"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'مشتری'">
|
||||
<a-space :size="8">
|
||||
<a-avatar>{{ record.customerName.slice(0, 1) }}</a-avatar>
|
||||
<div>
|
||||
<div>{{ record.customerName }}</div>
|
||||
<a-typography-text v-if="record.personName" type="secondary">
|
||||
{{ record.personName }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag :color="statusColor(record.statusKey)" :bordered="false">
|
||||
{{ record.statusLabel }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مبلغ کل'">
|
||||
<span dir="ltr">{{ money(record.amount, record.currency) }}</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-space :size="4" @click.stop>
|
||||
<RouterLink :to="record.href">
|
||||
<a-button type="text">
|
||||
<template #icon><EyeOutlined /></template>
|
||||
</a-button>
|
||||
</RouterLink>
|
||||
<a-dropdown
|
||||
:open="menuId === record.id"
|
||||
@update:open="(v) => (menuId = v ? record.id : null)"
|
||||
>
|
||||
<a-button type="text">
|
||||
<template #icon><MoreOutlined /></template>
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="(info) => onRowMenu(info, record as BillingRow)">
|
||||
<a-menu-item key="open">باز کردن</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag :color="statusColor(record.statusKey)" :bordered="false">
|
||||
{{ record.statusLabel }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مبلغ کل'">
|
||||
<span dir="ltr">{{ money(record.amount, record.currency) }}</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-space :size="4" @click.stop>
|
||||
<RouterLink :to="record.href">
|
||||
<a-button type="text">
|
||||
<template #icon><EyeOutlined /></template>
|
||||
</a-button>
|
||||
</RouterLink>
|
||||
<a-dropdown
|
||||
:open="menuId === record.id"
|
||||
@update:open="(v) => (menuId = v ? record.id : null)"
|
||||
>
|
||||
<a-button type="text">
|
||||
<template #icon><MoreOutlined /></template>
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="(info) => onRowMenu(info, record as BillingRow)">
|
||||
<a-menu-item key="open">باز کردن</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-table>
|
||||
|
||||
<a-empty
|
||||
v-if="!loading && !pageItems.length && !error"
|
||||
description="سندی یافت نشد."
|
||||
:style="{ marginTop: '24px' }"
|
||||
/>
|
||||
|
||||
<a-flex
|
||||
v-if="filtered.length"
|
||||
justify="flex-end"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<a-pagination
|
||||
v-model:current="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="filtered.length"
|
||||
:show-size-changer="true"
|
||||
:page-size-options="PAGE_SIZE_OPTIONS.map(String)"
|
||||
:show-total="(total) => `${toFaDigits(total)} مورد · ${toFaDigits(pageCount)} صفحه`"
|
||||
<a-empty
|
||||
v-if="!loading && !pageItems.length && !error"
|
||||
description="سندی یافت نشد."
|
||||
:style="{ marginTop: '24px' }"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
|
||||
<a-flex
|
||||
v-if="filtered.length"
|
||||
justify="flex-end"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<a-pagination
|
||||
v-model:current="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="filtered.length"
|
||||
:show-size-changer="true"
|
||||
:page-size-options="PAGE_SIZE_OPTIONS.map(String)"
|
||||
:show-total="(total) => `${toFaDigits(total)} مورد · ${toFaDigits(pageCount)} صفحه`"
|
||||
/>
|
||||
</a-flex>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
|
||||
<a-modal
|
||||
|
||||
@@ -28,13 +28,14 @@ import {
|
||||
PlusOutlined,
|
||||
ReloadOutlined,
|
||||
UnorderedListOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||
import { canManageSettings } from '@/lib/roles';
|
||||
import { pointerDropIndex } from '@/lib/pipeline-board';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import type { LeadBoardColumnDto, LeadDto, LeadStageDto } from '@mento/shared';
|
||||
import { CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
const { token } = theme.useToken();
|
||||
@@ -575,7 +576,7 @@ onMounted(load);
|
||||
|
||||
<div :style="boardShellStyle">
|
||||
<div
|
||||
v-if="loading || moving"
|
||||
v-if="moving"
|
||||
:style="{
|
||||
position: 'absolute',
|
||||
inset: 0,
|
||||
@@ -589,8 +590,22 @@ onMounted(load);
|
||||
<a-spin />
|
||||
</div>
|
||||
|
||||
<a-flex
|
||||
v-if="loading && !columns.length"
|
||||
:gap="GAP"
|
||||
:style="{ overflowX: 'auto', paddingBottom: `${GAP}px`, margin: 'auto 0' }"
|
||||
>
|
||||
<div
|
||||
v-for="i in 4"
|
||||
:key="i"
|
||||
:style="{ width: `${COL_WIDTH}px`, flex: `0 0 ${COL_WIDTH}px` }"
|
||||
>
|
||||
<CrmSkeletonCard :loading="true" :rows="5" :min-height="360" />
|
||||
</div>
|
||||
</a-flex>
|
||||
|
||||
<a-empty
|
||||
v-if="!loading && !columns.length"
|
||||
v-else-if="!loading && !columns.length"
|
||||
description="مرحلهای برای نمایش در مسیر لیدها نیست."
|
||||
:style="{ margin: 'auto' }"
|
||||
>
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
Timeline as ATimeline,
|
||||
@@ -44,7 +43,8 @@ import {
|
||||
PhoneOutlined,
|
||||
PlusOutlined,
|
||||
UserAddOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { api } from '@/lib/api';
|
||||
import { isBirthDateAnswer, leadNoteFileIsImage, parseLeadFormNotes } from '@/lib/lead-form-notes';
|
||||
import {
|
||||
@@ -568,7 +568,8 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<template v-if="lead">
|
||||
<a-row :gutter="[24, 24]">
|
||||
<a-col :xs="24" :lg="17" :xl="18">
|
||||
@@ -1180,7 +1181,8 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
||||
@close="smsOpen = false"
|
||||
/>
|
||||
</template>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
@@ -47,7 +47,6 @@ import {
|
||||
SelectOption as ASelectOption,
|
||||
SelectOptGroup as ASelectOptGroup,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Statistic as AStatistic,
|
||||
Switch as ASwitch,
|
||||
Tabs as ATabs,
|
||||
@@ -58,6 +57,7 @@ import {
|
||||
Upload as AUpload,
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type { UploadProps } from 'ant-design-vue';
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
@@ -80,7 +80,7 @@ import {
|
||||
StarOutlined,
|
||||
UnorderedListOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -690,7 +690,8 @@ onMounted(load);
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="10">
|
||||
<a-tabs :active-key="tab" @change="onTabChange">
|
||||
<a-tab-pane key="edit" tab="ویرایش فرم">
|
||||
<a-row :gutter="[16, 16]">
|
||||
@@ -1198,7 +1199,8 @@ onMounted(load);
|
||||
</a-card>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-modal
|
||||
v-model:open="desktopPreviewOpen"
|
||||
|
||||
@@ -15,17 +15,17 @@ import {
|
||||
ListItem as AListItem,
|
||||
ListItemMeta as AListItemMeta,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||
import {
|
||||
CopyOutlined,
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
EyeOutlined,
|
||||
PlusOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -121,7 +121,8 @@ onMounted(load);
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="6">
|
||||
<a-card v-if="listEmpty && !error" :bordered="false">
|
||||
<a-empty
|
||||
description="هنوز فرمی نساختهاید. با ساخت اولین فرم، میتوانید در وبسایت یا شبکههای اجتماعی سرنخ و مشتری جذب کنید."
|
||||
@@ -184,6 +185,7 @@ onMounted(load);
|
||||
</a-list>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -1,22 +1,42 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import {
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiEmptyState,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import type {
|
||||
CreateLeadStageRequest,
|
||||
LeadStageDto,
|
||||
UpdateLeadStageRequest,
|
||||
} from '@mento/shared';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
Modal,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import {
|
||||
ArrowDownOutlined,
|
||||
ArrowUpOutlined,
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
PlusOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
@@ -39,6 +59,16 @@ const editConverted = ref(false);
|
||||
const editLost = ref(false);
|
||||
const editUnqualified = ref(false);
|
||||
|
||||
const listEmpty = computed(() => !loading.value && !stages.value.length);
|
||||
|
||||
const columns: TableColumnsType<LeadStageDto> = [
|
||||
{ title: 'رنگ', key: 'color', width: 64 },
|
||||
{ title: 'نام', dataIndex: 'name', key: 'name' },
|
||||
{ title: 'وضعیت', key: 'flags' },
|
||||
{ title: 'لیدها', key: 'leadCount', width: 100 },
|
||||
{ title: 'عملیات', key: 'actions', width: 220 },
|
||||
];
|
||||
|
||||
function apiError(e: unknown, fallback: string) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
||||
@@ -110,7 +140,10 @@ function cancelEdit() {
|
||||
}
|
||||
|
||||
async function saveEdit() {
|
||||
if (!editingId.value || !editName.value.trim()) return;
|
||||
if (!editingId.value || !editName.value.trim()) {
|
||||
error.value = 'نام مرحله را وارد کنید.';
|
||||
return Promise.reject(new Error('validation'));
|
||||
}
|
||||
saving.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -128,21 +161,29 @@ async function saveEdit() {
|
||||
await load();
|
||||
} catch (e) {
|
||||
error.value = apiError(e, 'ویرایش مرحله ناموفق بود.');
|
||||
return Promise.reject(e);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function removeStage(stage: LeadStageDto) {
|
||||
if (!confirm(`مرحله «${stage.name}» حذف شود؟`)) return;
|
||||
error.value = '';
|
||||
try {
|
||||
await api.delete(`/leads/stages/${stage.id}`);
|
||||
okMsg.value = 'مرحله حذف شد.';
|
||||
await load();
|
||||
} catch (e) {
|
||||
error.value = apiError(e, 'حذف مرحله ناموفق بود.');
|
||||
}
|
||||
function removeStage(stage: LeadStageDto) {
|
||||
Modal.confirm({
|
||||
title: `مرحله «${stage.name}» حذف شود؟`,
|
||||
okText: 'حذف',
|
||||
cancelText: 'انصراف',
|
||||
okButtonProps: { danger: true },
|
||||
onOk: async () => {
|
||||
error.value = '';
|
||||
try {
|
||||
await api.delete(`/leads/stages/${stage.id}`);
|
||||
okMsg.value = 'مرحله حذف شد.';
|
||||
await load();
|
||||
} catch (e) {
|
||||
error.value = apiError(e, 'حذف مرحله ناموفق بود.');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function move(stage: LeadStageDto, dir: -1 | 1) {
|
||||
@@ -167,222 +208,166 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="crm-page">
|
||||
<UiPageHeader
|
||||
title="مراحل لید"
|
||||
lead="تعریف وضعیتهای مسیر لیدها و برچسبهای تبدیل/از دسترفته"
|
||||
/>
|
||||
|
||||
<p v-if="okMsg" class="ok">{{ okMsg }}</p>
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-else-if="loading" class="muted">در حال بارگذاری…</p>
|
||||
|
||||
<form class="crm-form" @submit.prevent="createStage">
|
||||
<UiCard>
|
||||
<template #header>
|
||||
<div class="card-title">
|
||||
<UiIcon name="plus" :size="18" />
|
||||
<h3>مرحله جدید</h3>
|
||||
</div>
|
||||
</template>
|
||||
<div class="form-grid">
|
||||
<UiField label="نام" required for-id="ls-name">
|
||||
<UiInput id="ls-name" v-model="name" required placeholder="مثلاً تماس اولیه" />
|
||||
</UiField>
|
||||
<UiField label="رنگ" for-id="ls-color">
|
||||
<input id="ls-color" v-model="color" class="color" type="color" />
|
||||
</UiField>
|
||||
<label class="check">
|
||||
<input v-model="showOnBoard" type="checkbox" />
|
||||
نمایش روی مسیر
|
||||
</label>
|
||||
<label class="check">
|
||||
<input v-model="isConverted" type="checkbox" />
|
||||
مرحله تبدیلشده
|
||||
</label>
|
||||
<label class="check">
|
||||
<input v-model="isLost" type="checkbox" />
|
||||
از دسترفته
|
||||
</label>
|
||||
<label class="check">
|
||||
<input v-model="isUnqualified" type="checkbox" />
|
||||
غیرواجد شرایط
|
||||
</label>
|
||||
</div>
|
||||
<template #footer>
|
||||
<UiButton type="submit" :loading="saving">افزودن مرحله</UiButton>
|
||||
</template>
|
||||
</UiCard>
|
||||
</form>
|
||||
|
||||
<div v-if="stages.length" class="list">
|
||||
<UiCard v-for="stage in stages" :key="stage.id" padding="sm" class="stage-card">
|
||||
<template v-if="editingId === stage.id">
|
||||
<div class="form-grid">
|
||||
<UiField label="نام">
|
||||
<UiInput v-model="editName" />
|
||||
</UiField>
|
||||
<UiField label="رنگ">
|
||||
<input v-model="editColor" class="color" type="color" />
|
||||
</UiField>
|
||||
<label class="check">
|
||||
<input v-model="editShowOnBoard" type="checkbox" />
|
||||
نمایش روی مسیر
|
||||
</label>
|
||||
<label class="check">
|
||||
<input v-model="editConverted" type="checkbox" />
|
||||
تبدیلشده
|
||||
</label>
|
||||
<label class="check">
|
||||
<input v-model="editLost" type="checkbox" />
|
||||
از دسترفته
|
||||
</label>
|
||||
<label class="check">
|
||||
<input v-model="editUnqualified" type="checkbox" />
|
||||
غیرواجد شرایط
|
||||
</label>
|
||||
</div>
|
||||
<div class="ops">
|
||||
<UiButton size="sm" :disabled="saving" @click="saveEdit">ذخیره</UiButton>
|
||||
<UiButton size="sm" variant="ghost" @click="cancelEdit">انصراف</UiButton>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="row">
|
||||
<span class="dot" :style="{ background: stage.color || 'var(--accent)' }" />
|
||||
<div class="info">
|
||||
<strong>{{ stage.name }}</strong>
|
||||
<span class="muted">
|
||||
{{ stage.showOnBoard ? 'روی مسیر' : 'مخفی از مسیر' }}
|
||||
<template v-if="stage.leadCount != null">
|
||||
· {{ toFaDigits(stage.leadCount) }} لید
|
||||
</template>
|
||||
</span>
|
||||
<span class="flags">
|
||||
<em v-if="stage.isConverted">تبدیل</em>
|
||||
<em v-if="stage.isLost">از دسترفته</em>
|
||||
<em v-if="stage.isUnqualified">غیرواجد</em>
|
||||
</span>
|
||||
</div>
|
||||
<div class="ops">
|
||||
<UiButton size="sm" variant="ghost" @click="move(stage, -1)">↑</UiButton>
|
||||
<UiButton size="sm" variant="ghost" @click="move(stage, 1)">↓</UiButton>
|
||||
<UiButton size="sm" variant="ghost" @click="startEdit(stage)">ویرایش</UiButton>
|
||||
<UiButton size="sm" variant="ghost" @click="removeStage(stage)">حذف</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</UiCard>
|
||||
<a-flex vertical :gap="16">
|
||||
<div>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">مراحل لید</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
تعریف وضعیتهای مسیر لیدها و برچسبهای تبدیل/از دسترفته
|
||||
</a-typography-text>
|
||||
</div>
|
||||
|
||||
<UiEmptyState
|
||||
v-else-if="!loading"
|
||||
title="مرحلهای تعریف نشده."
|
||||
description="اولین وضعیت لید را اضافه کنید."
|
||||
/>
|
||||
</section>
|
||||
<a-alert v-if="okMsg" type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
|
||||
<a-card title="مرحله جدید" :bordered="false">
|
||||
<a-form layout="vertical" @finish="createStage">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12" :lg="8">
|
||||
<a-form-item label="نام" name="name" required>
|
||||
<a-input v-model:value="name" placeholder="مثلاً تماس اولیه" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12" :lg="4">
|
||||
<a-form-item label="رنگ" name="color">
|
||||
<a-input v-model:value="color" type="color" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-col :xs="24" :sm="12" :md="6">
|
||||
<a-checkbox v-model:checked="showOnBoard">نمایش روی مسیر</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="6">
|
||||
<a-checkbox v-model:checked="isConverted">مرحله تبدیلشده</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="6">
|
||||
<a-checkbox v-model:checked="isLost">از دسترفته</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="6">
|
||||
<a-checkbox v-model:checked="isUnqualified">غیرواجد شرایط</a-checkbox>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item :style="{ marginTop: '16px', marginBottom: 0 }">
|
||||
<a-button type="primary" html-type="submit" :loading="saving">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
افزودن مرحله
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card title="فهرست مراحل" :bordered="false">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="6" :columns="5" :card="false">
|
||||
<a-empty
|
||||
v-if="listEmpty"
|
||||
description="مرحلهای تعریف نشده. اولین وضعیت لید را اضافه کنید."
|
||||
/>
|
||||
<a-table
|
||||
v-else-if="stages.length"
|
||||
:columns="columns"
|
||||
:data-source="stages"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'color'">
|
||||
<span
|
||||
:style="{
|
||||
display: 'inline-block',
|
||||
width: '12px',
|
||||
height: '12px',
|
||||
borderRadius: '50%',
|
||||
background: record.color || 'var(--ant-color-primary)',
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'flags'">
|
||||
<a-space wrap>
|
||||
<a-tag :bordered="false" :color="record.showOnBoard ? 'processing' : 'default'">
|
||||
{{ record.showOnBoard ? 'روی مسیر' : 'مخفی از مسیر' }}
|
||||
</a-tag>
|
||||
<a-tag v-if="record.isConverted" color="success" :bordered="false">تبدیل</a-tag>
|
||||
<a-tag v-if="record.isLost" color="error" :bordered="false">از دسترفته</a-tag>
|
||||
<a-tag v-if="record.isUnqualified" color="warning" :bordered="false">غیرواجد</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'leadCount'">
|
||||
<a-typography-text v-if="record.leadCount != null" type="secondary">
|
||||
{{ toFaDigits(record.leadCount) }} لید
|
||||
</a-typography-text>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<a-space wrap>
|
||||
<a-button
|
||||
type="text"
|
||||
:disabled="index === 0"
|
||||
@click="move(record as LeadStageDto, -1)"
|
||||
>
|
||||
<template #icon><ArrowUpOutlined /></template>
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
:disabled="index === stages.length - 1"
|
||||
@click="move(record as LeadStageDto, 1)"
|
||||
>
|
||||
<template #icon><ArrowDownOutlined /></template>
|
||||
</a-button>
|
||||
<a-button type="text" @click="startEdit(record as LeadStageDto)">
|
||||
<template #icon><EditOutlined /></template>
|
||||
ویرایش
|
||||
</a-button>
|
||||
<a-button type="text" danger @click="removeStage(record as LeadStageDto)">
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
|
||||
<a-modal
|
||||
:open="editingId != null"
|
||||
title="ویرایش مرحله"
|
||||
ok-text="ذخیره"
|
||||
cancel-text="انصراف"
|
||||
:confirm-loading="saving"
|
||||
destroy-on-close
|
||||
@ok="saveEdit"
|
||||
@cancel="cancelEdit"
|
||||
>
|
||||
<a-form layout="vertical">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="16">
|
||||
<a-form-item label="نام" required>
|
||||
<a-input v-model:value="editName" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="رنگ">
|
||||
<a-input v-model:value="editColor" type="color" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-checkbox v-model:checked="editShowOnBoard">نمایش روی مسیر</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-checkbox v-model:checked="editConverted">تبدیلشده</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-checkbox v-model:checked="editLost">از دسترفته</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-checkbox v-model:checked="editUnqualified">غیرواجد شرایط</a-checkbox>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.crm-page {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.card-title h3 {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
.color {
|
||||
width: 100%;
|
||||
min-height: var(--control-h);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: #fff;
|
||||
padding: 0.2rem;
|
||||
}
|
||||
|
||||
.check {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.9rem;
|
||||
min-height: var(--control-h);
|
||||
}
|
||||
|
||||
.list {
|
||||
display: grid;
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 0.7rem;
|
||||
height: 0.7rem;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1 1 10rem;
|
||||
display: grid;
|
||||
gap: 0.15rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.flags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.flags em {
|
||||
font-style: normal;
|
||||
font-size: 0.75rem;
|
||||
padding: 0.1rem 0.45rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.ops {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.ok {
|
||||
color: #0f766e;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #b91c1c;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
+194
-160
@@ -9,6 +9,7 @@ import {
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Divider as ADivider,
|
||||
Dropdown as ADropdown,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
@@ -48,8 +49,7 @@ import {
|
||||
PlusOutlined,
|
||||
SearchOutlined,
|
||||
UnorderedListOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import {
|
||||
formatJalaliNumeric,
|
||||
@@ -63,6 +63,7 @@ import { registerTableColumns, useTableColumns } from '@/lib/tableColumns';
|
||||
import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import {
|
||||
filterPhoneContacts,
|
||||
isContactPickerSupported,
|
||||
@@ -88,6 +89,7 @@ const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyPa
|
||||
const { token } = theme.useToken();
|
||||
const screens = Grid.useBreakpoint();
|
||||
const isMobile = computed(() => !screens.value.md);
|
||||
const emptySimple = AEmpty.PRESENTED_IMAGE_SIMPLE;
|
||||
|
||||
const PAGE_SIZE = 10;
|
||||
|
||||
@@ -1136,6 +1138,20 @@ const tintColor = (tint: StageTint) => {
|
||||
return map[tint] ?? 'default';
|
||||
};
|
||||
|
||||
function tintAccent(tint: StageTint) {
|
||||
const t = token.value;
|
||||
const map: Record<StageTint, string> = {
|
||||
mint: t.colorSuccess,
|
||||
teal: t.colorInfo,
|
||||
amber: t.colorWarning,
|
||||
peach: t.colorWarning,
|
||||
sky: t.colorInfo,
|
||||
violet: t.colorPrimary,
|
||||
rose: t.colorError,
|
||||
};
|
||||
return map[tint] ?? t.colorPrimary;
|
||||
}
|
||||
|
||||
const tableColumns = computed<TableColumnsType<LeadDto>>(() => {
|
||||
const all: TableColumnsType<LeadDto> = [
|
||||
{
|
||||
@@ -1181,13 +1197,15 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-row :gutter="[24, 24]" @click="closePopups">
|
||||
<a-col :span="24">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
|
||||
<div>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||
</div>
|
||||
<a-space :size="8" wrap>
|
||||
<!-- wrapper absorbs AppLayout flex:1 so a-row/a-flex children are not stretch-spaced -->
|
||||
<div :style="{ width: '100%' }" @click="closePopups">
|
||||
<a-flex vertical :gap="token.marginSM" :style="{ width: '100%' }">
|
||||
<a-row :gutter="[12, 12]" align="middle">
|
||||
<a-col :xs="24" :md="6" :lg="5">
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="18" :lg="19">
|
||||
<a-flex justify="end" wrap="wrap" :gap="8">
|
||||
<a-button :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
خروجی اکسل
|
||||
@@ -1225,111 +1243,76 @@ onBeforeUnmount(() => {
|
||||
<template #icon><PlusOutlined /></template>
|
||||
لید جدید
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-row :gutter="[12, 12]">
|
||||
<a-col :xs="12" :sm="8" :md="4">
|
||||
<a-card
|
||||
:bordered="true"
|
||||
hoverable
|
||||
:style="{
|
||||
borderColor: !stageId ? token.colorPrimary : undefined,
|
||||
cursor: 'pointer',
|
||||
}"
|
||||
@click="setStageFilter('')"
|
||||
>
|
||||
<a-flex align="center" :gap="12">
|
||||
<a-avatar :style="{ background: token.colorPrimaryBg, color: token.colorPrimary }">
|
||||
<template #icon><UserOutlined /></template>
|
||||
</a-avatar>
|
||||
<div>
|
||||
<a-typography-text type="secondary">همه لیدها</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong>{{ formatCount(totalLeadsCount) }}</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-for="card in stageCards"
|
||||
:key="card.key"
|
||||
:xs="12"
|
||||
:sm="8"
|
||||
:md="4"
|
||||
<a-row :gutter="[12, 12]">
|
||||
<a-col :xs="12" :sm="8" :md="4">
|
||||
<a-card
|
||||
hoverable
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="{
|
||||
height: '100%',
|
||||
borderColor: !stageId ? token.colorPrimary : undefined,
|
||||
cursor: 'pointer',
|
||||
}"
|
||||
@click="setStageFilter('')"
|
||||
>
|
||||
<a-card
|
||||
:bordered="true"
|
||||
hoverable
|
||||
:style="{
|
||||
borderColor: isStatActive(card) ? token.colorPrimary : undefined,
|
||||
cursor: card.stageId ? 'pointer' : 'not-allowed',
|
||||
opacity: card.stageId ? 1 : 0.55,
|
||||
}"
|
||||
@click="card.stageId && selectStatCard(card)"
|
||||
>
|
||||
<a-typography-text type="secondary">{{ card.label }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong>{{ formatCount(card.count) }}</a-typography-text>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24" @click.stop>
|
||||
<a-card :bordered="true">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
||||
<a-flex align="center" wrap="wrap" :gap="8" flex="1 1 auto">
|
||||
<a-space :size="8">
|
||||
<FilterOutlined />
|
||||
<a-typography-text strong>فیلترها</a-typography-text>
|
||||
</a-space>
|
||||
<a-select
|
||||
:value="sort"
|
||||
style="width: 11rem"
|
||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
||||
/>
|
||||
<a-input-search
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="جستجو..."
|
||||
enter-button="جستجو"
|
||||
style="width: 16rem; max-width: 100%"
|
||||
@search="onSearch"
|
||||
>
|
||||
<template #prefix><SearchOutlined /></template>
|
||||
</a-input-search>
|
||||
<a-select
|
||||
:value="cityFilter || undefined"
|
||||
allow-clear
|
||||
placeholder="همه مناطق"
|
||||
style="width: 9.5rem"
|
||||
:options="cityOptions.map((c) => ({ value: c, label: c }))"
|
||||
@update:value="(v) => setCityFilter(v == null ? '' : String(v))"
|
||||
/>
|
||||
<a-select
|
||||
:value="sourceFilter || undefined"
|
||||
allow-clear
|
||||
placeholder="همه منابع"
|
||||
style="width: 9.5rem"
|
||||
:options="sourceOptions.map((s) => ({ value: s, label: s }))"
|
||||
@update:value="(v) => setSourceFilter(v == null ? '' : String(v))"
|
||||
/>
|
||||
<a-select
|
||||
:value="stageId || undefined"
|
||||
allow-clear
|
||||
placeholder="همه وضعیت"
|
||||
style="width: 9.5rem"
|
||||
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
||||
@update:value="(v) => setStageFilter(v == null ? '' : String(v))"
|
||||
/>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-text type="secondary">همه لیدها</a-typography-text>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, fontSize: `${token.fontSizeHeading3}px` }">
|
||||
{{ formatCount(totalLeadsCount) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-for="card in stageCards"
|
||||
:key="card.key"
|
||||
:xs="12"
|
||||
:sm="8"
|
||||
:md="4"
|
||||
>
|
||||
<a-card
|
||||
hoverable
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="{
|
||||
height: '100%',
|
||||
borderColor: isStatActive(card) ? token.colorPrimary : undefined,
|
||||
cursor: card.stageId ? 'pointer' : 'not-allowed',
|
||||
opacity: card.stageId ? 1 : 0.55,
|
||||
}"
|
||||
@click="card.stageId && selectStatCard(card)"
|
||||
>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-text type="secondary">{{ card.label }}</a-typography-text>
|
||||
<a-typography-text strong :style="{ color: tintAccent(card.tint), fontSize: `${token.fontSizeHeading3}px` }">
|
||||
{{ formatCount(card.count) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-alert
|
||||
v-if="importJob && importJob.status !== 'done' && importJob.status !== 'completed' && importJob.status !== 'failed'"
|
||||
type="info"
|
||||
show-icon
|
||||
:message="`ورود فایل: ${toFaDigits(importJob.processedCount)} / ${toFaDigits(importJob.totalCount)}`"
|
||||
/>
|
||||
<a-alert v-if="okMsg" type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
|
||||
<a-card @click.stop>
|
||||
<template #title>
|
||||
<a-space :size="8">
|
||||
<FilterOutlined />
|
||||
<span>فیلترها</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #extra>
|
||||
<a-space :size="8" wrap>
|
||||
<TableColumnsMenu table-key="leads" align="end" />
|
||||
<a-radio-group
|
||||
value="list"
|
||||
@@ -1344,65 +1327,111 @@ onBeforeUnmount(() => {
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</template>
|
||||
|
||||
<a-col v-if="selectedIds.length" :span="24" @click.stop>
|
||||
<a-card :bordered="false" :style="{ background: token.colorPrimaryBg }">
|
||||
<a-space :size="8" wrap>
|
||||
<a-typography-text>
|
||||
{{ toFaDigits(selectedIds.length) }} مورد انتخابشده
|
||||
</a-typography-text>
|
||||
<template v-if="canAssignOthers">
|
||||
<a-row :gutter="[12, 12]">
|
||||
<a-col :xs="24" :sm="12" :md="8" :lg="5">
|
||||
<a-select
|
||||
v-model:value="assignUserId"
|
||||
placeholder="تخصیص به کارشناس"
|
||||
style="min-width: 12rem"
|
||||
allow-clear
|
||||
:options="users.map((u) => ({ value: u.id, label: u.fullName }))"
|
||||
:value="sort"
|
||||
style="width: 100%"
|
||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
||||
/>
|
||||
<a-button :disabled="!assignUserId || busy" @click="assignSelected">اعمال تخصیص</a-button>
|
||||
</template>
|
||||
<template v-if="isAdmin">
|
||||
<a-select
|
||||
v-model:value="bulkStageId"
|
||||
placeholder="تغییر وضعیت"
|
||||
style="min-width: 12rem"
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8" :lg="7">
|
||||
<a-input-search
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="جستجو در لیدها…"
|
||||
enter-button="جستجو"
|
||||
style="width: 100%"
|
||||
@search="onSearch"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :md="8" :lg="4">
|
||||
<a-select
|
||||
:value="cityFilter || undefined"
|
||||
allow-clear
|
||||
placeholder="همه مناطق"
|
||||
style="width: 100%"
|
||||
:options="cityOptions.map((c) => ({ value: c, label: c }))"
|
||||
@update:value="(v) => setCityFilter(v == null ? '' : String(v))"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :md="8" :lg="4">
|
||||
<a-select
|
||||
:value="sourceFilter || undefined"
|
||||
allow-clear
|
||||
placeholder="همه منابع"
|
||||
style="width: 100%"
|
||||
:options="sourceOptions.map((s) => ({ value: s, label: s }))"
|
||||
@update:value="(v) => setSourceFilter(v == null ? '' : String(v))"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="4">
|
||||
<a-select
|
||||
:value="stageId || undefined"
|
||||
allow-clear
|
||||
placeholder="همه وضعیت"
|
||||
style="width: 100%"
|
||||
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
||||
@update:value="(v) => setStageFilter(v == null ? '' : String(v))"
|
||||
/>
|
||||
<a-button :disabled="!bulkStageId || busy" @click="bulkStageSelected">اعمال وضعیت</a-button>
|
||||
</template>
|
||||
<a-button danger :disabled="busy" @click="archiveSelected">بایگانی</a-button>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-col
|
||||
v-if="importJob && importJob.status !== 'done' && importJob.status !== 'completed' && importJob.status !== 'failed'"
|
||||
:span="24"
|
||||
>
|
||||
<a-alert
|
||||
type="info"
|
||||
show-icon
|
||||
:message="`ورود فایل: ${toFaDigits(importJob.processedCount)} / ${toFaDigits(importJob.totalCount)}`"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col v-if="okMsg" :span="24">
|
||||
<a-alert type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
||||
</a-col>
|
||||
<a-col v-if="error" :span="24">
|
||||
<a-alert type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
</a-col>
|
||||
<a-card
|
||||
v-if="selectedIds.length"
|
||||
:bordered="false"
|
||||
:style="{
|
||||
background: token.colorPrimaryBg,
|
||||
marginTop: `${token.marginMD}px`,
|
||||
marginBottom: `${token.marginSM}px`,
|
||||
}"
|
||||
>
|
||||
<a-row :gutter="[12, 12]" align="middle">
|
||||
<a-col :xs="24" :md="6">
|
||||
<a-typography-text>
|
||||
{{ toFaDigits(selectedIds.length) }} مورد انتخابشده
|
||||
</a-typography-text>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="18">
|
||||
<a-flex wrap="wrap" :gap="8" justify="end">
|
||||
<template v-if="canAssignOthers">
|
||||
<a-select
|
||||
v-model:value="assignUserId"
|
||||
placeholder="تخصیص به کارشناس"
|
||||
style="min-width: 12rem; flex: 1 1 12rem"
|
||||
allow-clear
|
||||
:options="users.map((u) => ({ value: u.id, label: u.fullName }))"
|
||||
/>
|
||||
<a-button :disabled="!assignUserId || busy" @click="assignSelected">اعمال تخصیص</a-button>
|
||||
</template>
|
||||
<template v-if="isAdmin">
|
||||
<a-select
|
||||
v-model:value="bulkStageId"
|
||||
placeholder="تغییر وضعیت"
|
||||
style="min-width: 12rem; flex: 1 1 12rem"
|
||||
allow-clear
|
||||
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
||||
/>
|
||||
<a-button :disabled="!bulkStageId || busy" @click="bulkStageSelected">اعمال وضعیت</a-button>
|
||||
</template>
|
||||
<a-button danger :disabled="busy" @click="archiveSelected">بایگانی</a-button>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-spin :spinning="loading || pageBusy" :tip="pageBusy ? busyMessage : undefined">
|
||||
<a-divider :style="{ marginTop: `${token.marginSM}px`, marginBottom: `${token.marginSM}px` }" />
|
||||
|
||||
<a-spin :spinning="pageBusy" :tip="busyMessage">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="9" :card="false">
|
||||
<template v-if="data?.items.length">
|
||||
<a-row v-if="isMobile" :gutter="[12, 12]">
|
||||
<a-col v-for="(lead, idx) in data.items" :key="`m-${lead.id}`" :span="24">
|
||||
<a-card
|
||||
:bordered="true"
|
||||
hoverable
|
||||
:style="{
|
||||
borderColor: selected.has(lead.id) ? token.colorPrimary : undefined,
|
||||
@@ -1509,7 +1538,7 @@ onBeforeUnmount(() => {
|
||||
:data-source="data.items"
|
||||
:pagination="false"
|
||||
:row-key="(r: LeadDto) => r.id"
|
||||
:scroll="{ x: 1100 }"
|
||||
:scroll="screens.xl ? undefined : { x: 960 }"
|
||||
:custom-row="(record: LeadDto) => ({ onClick: () => goDetail(record.id) })"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
@@ -1613,7 +1642,9 @@ onBeforeUnmount(() => {
|
||||
|
||||
<a-empty
|
||||
v-else-if="!loading"
|
||||
:image="emptySimple"
|
||||
description="لیدی ثبت نشده است. از ورود فایل استفاده کنید یا لید جدید بسازید."
|
||||
:style="{ paddingBlock: `${token.paddingXS}px` }"
|
||||
>
|
||||
<a-space :size="8">
|
||||
<a-button type="primary" @click="openCreate">ثبت لید جدید</a-button>
|
||||
@@ -1633,8 +1664,10 @@ onBeforeUnmount(() => {
|
||||
</ExcelImportFlow>
|
||||
</a-space>
|
||||
</a-empty>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-spin>
|
||||
</a-col>
|
||||
</a-card>
|
||||
|
||||
<a-modal
|
||||
v-model:open="createOpen"
|
||||
@@ -1848,5 +1881,6 @@ onBeforeUnmount(() => {
|
||||
</a-button>
|
||||
</template>
|
||||
</a-modal>
|
||||
</a-row>
|
||||
</a-flex>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
LockOutlined,
|
||||
PhoneOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||
const { token } = theme.useToken();
|
||||
|
||||
@@ -48,7 +48,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Switch as ASwitch,
|
||||
Table as ATable,
|
||||
TabPane as ATabPane,
|
||||
@@ -74,7 +73,8 @@ import {
|
||||
StarOutlined,
|
||||
TrophyOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard, CrmSkeletonKpi } from '@/components/skeleton';
|
||||
import type { Component } from 'vue';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
@@ -746,33 +746,36 @@ onBeforeUnmount(() => {
|
||||
message="باشگاه فعلاً غیرفعال است؛ تنظیمات را بررسی کنید."
|
||||
/>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col v-for="k in kpis" :key="k.key" :xs="12" :sm="12" :md="6">
|
||||
<a-card :bordered="false" :style="{ height: '100%' }">
|
||||
<a-flex :gap="12" align="flex-start">
|
||||
<component
|
||||
:is="k.icon"
|
||||
:style="{ color: 'var(--ant-color-primary)', fontSize: '20px' }"
|
||||
/>
|
||||
<a-flex vertical :gap="0" :style="{ flex: 1, minWidth: 0 }">
|
||||
<a-typography-text type="secondary">{{ k.label }}</a-typography-text>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
{{ faNum(k.value) }}{{ k.suffix || '' }}
|
||||
</a-typography-title>
|
||||
<a-tag
|
||||
v-if="k.pct != null"
|
||||
:color="(k.pct ?? 0) >= 0 ? 'success' : 'error'"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ trendText(k.pct) }}
|
||||
</a-tag>
|
||||
<CrmSkeletonKpi>
|
||||
<a-card :bordered="false" :style="{ height: '100%' }">
|
||||
<a-flex :gap="12" align="flex-start">
|
||||
<component
|
||||
:is="k.icon"
|
||||
:style="{ color: 'var(--ant-color-primary)', fontSize: '20px' }"
|
||||
/>
|
||||
<a-flex vertical :gap="0" :style="{ flex: 1, minWidth: 0 }">
|
||||
<a-typography-text type="secondary">{{ k.label }}</a-typography-text>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
{{ faNum(k.value) }}{{ k.suffix || '' }}
|
||||
</a-typography-title>
|
||||
<a-tag
|
||||
v-if="k.pct != null"
|
||||
:color="(k.pct ?? 0) >= 0 ? 'success' : 'error'"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ trendText(k.pct) }}
|
||||
</a-tag>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-card>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-card :bordered="false" :style="{ marginTop: '16px' }">
|
||||
<a-tabs v-model:activeKey="activeTab">
|
||||
<a-tab-pane key="levels" tab="سطوح">
|
||||
@@ -1135,7 +1138,8 @@ onBeforeUnmount(() => {
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-modal
|
||||
v-model:open="modalOpen"
|
||||
|
||||
@@ -47,7 +47,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Steps as ASteps,
|
||||
Step as AStep,
|
||||
Switch as ASwitch,
|
||||
@@ -71,7 +70,8 @@ import {
|
||||
SmileOutlined,
|
||||
ThunderboltOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonList, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -508,7 +508,8 @@ onUnmounted(() => {
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="6">
|
||||
<a-empty
|
||||
v-if="!loading && !visibleItems.length"
|
||||
description="هنوز قانون پیامی نیست."
|
||||
@@ -553,7 +554,8 @@ onUnmounted(() => {
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</template>
|
||||
|
||||
<!-- Mobile wizard -->
|
||||
@@ -1032,7 +1034,8 @@ onUnmounted(() => {
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="6" :columns="6">
|
||||
<a-card :bordered="false">
|
||||
<a-flex justify="space-between" align="center" :style="{ marginBottom: '12px' }">
|
||||
<a-typography-text strong>قوانین تعریفشده</a-typography-text>
|
||||
@@ -1089,7 +1092,8 @@ onUnmounted(() => {
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</template>
|
||||
|
||||
<a-modal
|
||||
|
||||
@@ -27,13 +27,13 @@ import {
|
||||
ListItem as AListItem,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { ReloadOutlined } from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -282,7 +282,8 @@ onBeforeUnmount(() => {
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-card :title="editingId ? 'ویرایش فروشگاه' : 'افزودن فروشگاه'" :bordered="false">
|
||||
<a-typography-paragraph type="secondary">
|
||||
@@ -513,6 +514,7 @@ onBeforeUnmount(() => {
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -75,7 +75,8 @@ import {
|
||||
PushpinOutlined,
|
||||
ThunderboltOutlined,
|
||||
UnorderedListOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const ACheckableTag = ATag.CheckableTag;
|
||||
|
||||
@@ -880,7 +881,8 @@ onBeforeUnmount(() => {
|
||||
</a-flex>
|
||||
</a-card>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="6">
|
||||
<a-empty
|
||||
v-if="!loading && !notes.length"
|
||||
description="هنوز یادداشتی نیست — یکی اضافه کنید."
|
||||
@@ -1150,7 +1152,8 @@ onBeforeUnmount(() => {
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-button
|
||||
type="primary"
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
Select as ASelect,
|
||||
Space,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
Upload as AUpload,
|
||||
@@ -33,7 +32,8 @@ import {
|
||||
PhoneOutlined,
|
||||
PlusOutlined,
|
||||
SearchOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { api } from '@/lib/api';
|
||||
import type { CompanyDto, CreatePersonRequest, PersonDto, PersonGender, PersonMood } from '@mento/shared';
|
||||
import { PERSON_GENDER_LABELS, PERSON_GENDERS, splitPersonHonorific } from '@mento/shared';
|
||||
@@ -466,8 +466,9 @@ onMounted(load);
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-form v-if="!loading" layout="vertical" @finish="submit">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-form layout="vertical" @finish="submit">
|
||||
<a-card :bordered="false">
|
||||
<a-divider orientation="right">اطلاعات اصلی</a-divider>
|
||||
<a-row :gutter="[16, 0]">
|
||||
@@ -688,7 +689,8 @@ onMounted(load);
|
||||
<a-button v-if="!isNew" danger :disabled="saving" @click="remove">حذف</a-button>
|
||||
</a-space>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-upload
|
||||
ref="vcfUploadRef"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@ import {
|
||||
DeleteOutlined,
|
||||
DownloadOutlined,
|
||||
UploadOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
} from '@mento/shared';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { canManageSettings } from '@/lib/roles';
|
||||
import { CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { bindMenuDismiss, cardMenuStyle } from '@/lib/anchored-menu';
|
||||
|
||||
const dealExcelFields = DEAL_EXCEL_COLUMNS.filter((c) => c.key !== '_type').map((c) => ({
|
||||
@@ -729,7 +730,19 @@ defineExpose({ updateDealStage: applyUpdateDealStage });
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="importMsg" type="success" show-icon :message="importMsg" />
|
||||
<a-spin v-if="loading && !stages.length" tip="در حال بارگذاری مسیر فروش…" />
|
||||
<a-flex
|
||||
v-if="loading && !stages.length"
|
||||
:gap="GAP"
|
||||
:style="{ overflowX: 'auto', paddingBottom: `${GAP}px` }"
|
||||
>
|
||||
<div
|
||||
v-for="i in 4"
|
||||
:key="i"
|
||||
:style="{ width: '280px', flex: '0 0 280px' }"
|
||||
>
|
||||
<CrmSkeletonCard :loading="true" :rows="5" :min-height="360" />
|
||||
</div>
|
||||
</a-flex>
|
||||
|
||||
<a-alert
|
||||
v-if="selectMode"
|
||||
|
||||
@@ -22,11 +22,11 @@ import {
|
||||
Modal as AModal,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { PlusOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -206,7 +206,8 @@ onMounted(load);
|
||||
|
||||
<a-divider orientation="right">فهرست کاریزها</a-divider>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="5" :avatar="false">
|
||||
<a-empty
|
||||
v-if="listEmpty"
|
||||
description="کاریزی تعریف نشده. اولین مسیر فروش را اضافه کنید."
|
||||
@@ -232,7 +233,8 @@ onMounted(load);
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-spin>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
|
||||
<a-modal
|
||||
|
||||
@@ -22,13 +22,13 @@ import {
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Switch as ASwitch,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CheckOutlined } from '@ant-design/icons-vue';
|
||||
import { CheckOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type {
|
||||
CreateProductRequest,
|
||||
OrganizationDto,
|
||||
@@ -267,7 +267,8 @@ onMounted(async () => {
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-card :bordered="false">
|
||||
<a-form layout="vertical" @finish="submit">
|
||||
<a-divider orientation="right">مشخصات اصلی کالا / خدمت</a-divider>
|
||||
@@ -412,6 +413,7 @@ onMounted(async () => {
|
||||
</a-flex>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -46,9 +46,10 @@ import {
|
||||
ShoppingOutlined,
|
||||
ToolOutlined,
|
||||
UploadOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||
import ProductFormView from '@/views/ProductFormView.vue';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import type { ImportContactsResult, ProductDto } from '@mento/shared';
|
||||
import { brand } from '@mento/shared';
|
||||
|
||||
@@ -516,105 +517,109 @@ onMounted(load);
|
||||
:style="{ marginTop: '16px' }"
|
||||
/>
|
||||
|
||||
<a-spin :spinning="loading || pageBusy" :tip="pageBusy ? busyMessage : undefined">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="pageItems"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedKeys,
|
||||
onChange: onTableSelectChange,
|
||||
onSelectAll: toggleSelectAll,
|
||||
}"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty
|
||||
description="محصولی یافت نشد؛ هیچ محصولی با معیارهای جستجو مطابقت ندارد."
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'نام محصول'">
|
||||
<a-space :size="12" align="start">
|
||||
<a-avatar shape="square">
|
||||
<template #icon>
|
||||
<ToolOutlined v-if="record.kind === 'service'" />
|
||||
<ShoppingOutlined v-else />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>{{ record.name }}</a-typography-text>
|
||||
<a-typography-text v-if="record.description" type="secondary">
|
||||
{{ record.description }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'دستهبندی'">
|
||||
<a-tag v-if="record.category" :bordered="false">{{ record.category }}</a-tag>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'قیمت'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>
|
||||
{{ formatPrice(record.unitPrice, record.currency) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ currencyLabel(record.currency) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag :color="record.isActive ? 'success' : 'default'" :bordered="false">
|
||||
{{ record.isActive ? 'فعال' : 'غیرفعال' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'تاریخ ایجاد'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>{{ formatDate(record.createdAt) }}</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ formatTime(record.createdAt) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-dropdown
|
||||
:open="menuId === record.id"
|
||||
trigger="click"
|
||||
@update:open="(v: boolean) => (menuId = v ? record.id : null)"
|
||||
>
|
||||
<a-button type="text" aria-label="عملیات" @click.stop>
|
||||
<template #icon><MoreOutlined /></template>
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="(info) => onRowMenu(info, record as ProductDto)">
|
||||
<a-menu-item key="edit">ویرایش</a-menu-item>
|
||||
<a-menu-item key="toggle-active">
|
||||
{{ record.isActive ? 'غیرفعال کردن' : 'فعال کردن' }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="remove" danger>حذف</a-menu-item>
|
||||
</a-menu>
|
||||
<a-spin :spinning="pageBusy" :tip="busyMessage">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="8" :card="false">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="pageItems"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedKeys,
|
||||
onChange: onTableSelectChange,
|
||||
onSelectAll: toggleSelectAll,
|
||||
}"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty
|
||||
description="محصولی یافت نشد؛ هیچ محصولی با معیارهای جستجو مطابقت ندارد."
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'نام محصول'">
|
||||
<a-space :size="12" align="start">
|
||||
<a-avatar shape="square">
|
||||
<template #icon>
|
||||
<ToolOutlined v-if="record.kind === 'service'" />
|
||||
<ShoppingOutlined v-else />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>{{ record.name }}</a-typography-text>
|
||||
<a-typography-text v-if="record.description" type="secondary">
|
||||
{{ record.description }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<template v-else-if="column.key === 'دستهبندی'">
|
||||
<a-tag v-if="record.category" :bordered="false">{{ record.category }}</a-tag>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'قیمت'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>
|
||||
{{ formatPrice(record.unitPrice, record.currency) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ currencyLabel(record.currency) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag :color="record.isActive ? 'success' : 'default'" :bordered="false">
|
||||
{{ record.isActive ? 'فعال' : 'غیرفعال' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'تاریخ ایجاد'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>{{ formatDate(record.createdAt) }}</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ formatTime(record.createdAt) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-dropdown
|
||||
:open="menuId === record.id"
|
||||
trigger="click"
|
||||
@update:open="(v: boolean) => (menuId = v ? record.id : null)"
|
||||
>
|
||||
<a-button type="text" aria-label="عملیات" @click.stop>
|
||||
<template #icon><MoreOutlined /></template>
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="(info) => onRowMenu(info, record as ProductDto)">
|
||||
<a-menu-item key="edit">ویرایش</a-menu-item>
|
||||
<a-menu-item key="toggle-active">
|
||||
{{ record.isActive ? 'غیرفعال کردن' : 'فعال کردن' }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="remove" danger>حذف</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<a-flex v-if="filtered.length" justify="flex-end" :style="{ marginTop: '16px' }">
|
||||
<a-pagination
|
||||
v-model:current="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="filtered.length"
|
||||
:show-size-changer="true"
|
||||
:page-size-options="PAGE_SIZE_OPTIONS.map(String)"
|
||||
:show-total="
|
||||
(total: number) =>
|
||||
`${toFaDigits(total)} مورد · ${toFaDigits(Math.max(1, Math.ceil(total / pageSize)))} صفحه`
|
||||
"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-flex v-if="filtered.length" justify="flex-end" :style="{ marginTop: '16px' }">
|
||||
<a-pagination
|
||||
v-model:current="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="filtered.length"
|
||||
:show-size-changer="true"
|
||||
:page-size-options="PAGE_SIZE_OPTIONS.map(String)"
|
||||
:show-total="
|
||||
(total: number) =>
|
||||
`${toFaDigits(total)} مورد · ${toFaDigits(Math.max(1, Math.ceil(total / pageSize)))} صفحه`
|
||||
"
|
||||
/>
|
||||
</a-flex>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
|
||||
@@ -50,7 +50,6 @@ import {
|
||||
MenuItem as AMenuItem,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
TabPane as ATabPane,
|
||||
Tabs as ATabs,
|
||||
Tag as ATag,
|
||||
@@ -76,7 +75,8 @@ import {
|
||||
ThunderboltOutlined,
|
||||
UserAddOutlined,
|
||||
FileTextOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
||||
|
||||
@@ -580,7 +580,8 @@ watch(
|
||||
</div>
|
||||
</a-flex>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-flex v-else vertical :gap="16">
|
||||
@@ -938,7 +939,8 @@ watch(
|
||||
</div>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-affix v-if="!loading && !error" :offset-bottom="16">
|
||||
<a-card :bordered="false">
|
||||
|
||||
@@ -18,11 +18,28 @@ 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';
|
||||
import ProjectCardFormView from '@/views/ProjectCardFormView.vue';
|
||||
import {
|
||||
DownloadOutlined,
|
||||
UploadOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
Menu as AMenu,
|
||||
MenuItem as AMenuItem,
|
||||
Modal,
|
||||
Modal as AModal,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import type {
|
||||
ImportContactsResult,
|
||||
ProjectBoardBoardDto,
|
||||
@@ -31,8 +48,26 @@ import type {
|
||||
import { brand } from '@mento/shared';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { canManageSettings } from '@/lib/roles';
|
||||
import { CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { bindMenuDismiss, cardMenuStyle } from '@/lib/anchored-menu';
|
||||
|
||||
const { token } = theme.useToken();
|
||||
const GAP = 16;
|
||||
|
||||
const pageStyle = {
|
||||
boxSizing: 'border-box' as const,
|
||||
display: 'flex',
|
||||
flexDirection: 'column' as const,
|
||||
gap: `${GAP}px`,
|
||||
flex: '1 1 auto',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
};
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
@@ -50,7 +85,6 @@ const mineOnly = ref(route.query.mine === '1');
|
||||
const showCreate = ref(false);
|
||||
const newName = ref('');
|
||||
const cardModal = ref<{ cardId?: string; stageId?: string } | null>(null);
|
||||
const deleteStageId = ref<string | null>(null);
|
||||
const stageBusy = ref(false);
|
||||
const busy = ref(false);
|
||||
const importMsg = ref('');
|
||||
@@ -347,28 +381,28 @@ async function onAddStage(name: string) {
|
||||
}
|
||||
|
||||
function onDeleteStage(stageId: string) {
|
||||
deleteStageId.value = stageId;
|
||||
}
|
||||
|
||||
const deleteStageTitle = computed(() => {
|
||||
const id = deleteStageId.value;
|
||||
return stages.value.find((s) => s.id === id)?.title ?? '';
|
||||
});
|
||||
|
||||
async function confirmDeleteStage() {
|
||||
const stageId = deleteStageId.value;
|
||||
if (!stageId || !currentBoardId.value || stageBusy.value) return;
|
||||
stageBusy.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
await api.delete(`/project-boards/${currentBoardId.value}/stages/${stageId}`);
|
||||
deleteStageId.value = null;
|
||||
await load();
|
||||
} catch (e) {
|
||||
error.value = apiMessage(e, 'حذف ستون ناموفق بود.');
|
||||
} finally {
|
||||
stageBusy.value = false;
|
||||
}
|
||||
const title = stages.value.find((s) => s.id === stageId)?.title ?? '';
|
||||
Modal.confirm({
|
||||
title: 'حذف ستون',
|
||||
content: `ستون «${title}» حذف شود؟ اگر کارتی داخل آن باشد باید اول آنها را جابهجا کنید.`,
|
||||
okText: 'حذف',
|
||||
cancelText: 'انصراف',
|
||||
okButtonProps: { danger: true },
|
||||
async onOk() {
|
||||
if (!currentBoardId.value || stageBusy.value) return;
|
||||
stageBusy.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
await api.delete(`/project-boards/${currentBoardId.value}/stages/${stageId}`);
|
||||
await load();
|
||||
} catch (e) {
|
||||
error.value = apiMessage(e, 'حذف ستون ناموفق بود.');
|
||||
throw e;
|
||||
} finally {
|
||||
stageBusy.value = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function onCardSaved() {
|
||||
@@ -452,6 +486,22 @@ function onMenuCard(cardId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function onCardMenuClick(info: { key: string | number }) {
|
||||
const cardId = menuOpenId.value;
|
||||
if (!cardId) return;
|
||||
const key = String(info.key);
|
||||
if (key === 'view') {
|
||||
onOpenCard(cardId);
|
||||
return;
|
||||
}
|
||||
if (key === 'edit') {
|
||||
cardModal.value = { cardId };
|
||||
menuOpenId.value = null;
|
||||
return;
|
||||
}
|
||||
menuOpenId.value = null;
|
||||
}
|
||||
|
||||
const unbindMenuDismiss = bindMenuDismiss(
|
||||
() => menuOpenId.value != null,
|
||||
() => (menuOpenId.value = null),
|
||||
@@ -479,77 +529,115 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="page" dir="rtl">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<PipelineToolbar
|
||||
pipeline-name="تابلوی پروژه — کارهای تیمی"
|
||||
icon="grid"
|
||||
create-option-label="تابلوی جدید…"
|
||||
:pipeline-options="boardOptions"
|
||||
v-model:selected-pipeline-id="selectedBoardId"
|
||||
v-model:view-mode="viewMode"
|
||||
v-model:search="search"
|
||||
:show-amount-filters="false"
|
||||
:can-create="canCreateBoard"
|
||||
@create="showCreate = true"
|
||||
>
|
||||
<template #excel>
|
||||
<label class="mine-toggle">
|
||||
<input v-model="mineOnly" type="checkbox" />
|
||||
<span>فقط کارهای من</span>
|
||||
</label>
|
||||
<button class="btn-ghost-sm" type="button" :disabled="loading || busy" @click="exportExcel">
|
||||
خروجی اکسل
|
||||
</button>
|
||||
<ExcelImportFlow
|
||||
preview-path="/project-cards/import/preview"
|
||||
import-path="/project-cards/import"
|
||||
:disabled="loading || busy"
|
||||
@start="onImportStart"
|
||||
@done="onImportDone"
|
||||
@fail="onImportFail"
|
||||
@settled="onImportSettled"
|
||||
<div class="project-board-page" dir="rtl" :style="pageStyle">
|
||||
<a-row :gutter="[GAP, GAP]" :style="{ flexShrink: 0 }">
|
||||
<a-col :span="24">
|
||||
<PipelineToolbar
|
||||
pipeline-name="تابلوی پروژه — کارهای تیمی"
|
||||
icon="grid"
|
||||
create-option-label="تابلوی جدید…"
|
||||
:pipeline-options="boardOptions"
|
||||
v-model:selected-pipeline-id="selectedBoardId"
|
||||
v-model:view-mode="viewMode"
|
||||
v-model:search="search"
|
||||
:show-amount-filters="false"
|
||||
:can-create="canCreateBoard"
|
||||
@create="showCreate = true"
|
||||
>
|
||||
<button class="btn-ghost-sm" type="button" :disabled="loading || busy">
|
||||
ورود از اکسل
|
||||
</button>
|
||||
</ExcelImportFlow>
|
||||
</template>
|
||||
</PipelineToolbar>
|
||||
<template #excel>
|
||||
<a-space>
|
||||
<a-checkbox v-model:checked="mineOnly">فقط کارهای من</a-checkbox>
|
||||
<a-button :disabled="loading || busy" @click="exportExcel">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
<ExcelImportFlow
|
||||
preview-path="/project-cards/import/preview"
|
||||
import-path="/project-cards/import"
|
||||
:disabled="loading || busy"
|
||||
@start="onImportStart"
|
||||
@done="onImportDone"
|
||||
@fail="onImportFail"
|
||||
@settled="onImportSettled"
|
||||
>
|
||||
<a-button :disabled="loading || busy">
|
||||
<template #icon><UploadOutlined /></template>
|
||||
ورود از اکسل
|
||||
</a-button>
|
||||
</ExcelImportFlow>
|
||||
</a-space>
|
||||
</template>
|
||||
</PipelineToolbar>
|
||||
</a-col>
|
||||
<a-col v-if="error" :span="24">
|
||||
<a-alert type="error" show-icon :message="error" />
|
||||
</a-col>
|
||||
<a-col v-if="importMsg" :span="24">
|
||||
<a-alert type="success" show-icon :message="importMsg" />
|
||||
</a-col>
|
||||
<a-col v-if="loading && !stages.length" :span="24">
|
||||
<a-row :gutter="[GAP, GAP]">
|
||||
<a-col v-for="i in 4" :key="i" :xs="24" :sm="12" :md="6">
|
||||
<CrmSkeletonCard :loading="true" :rows="5" :min-height="360" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-if="importMsg" class="ok">{{ importMsg }}</p>
|
||||
<p v-else-if="loading && !stages.length" class="muted">در حال بارگذاری تابلو…</p>
|
||||
<div
|
||||
:style="{
|
||||
position: 'relative',
|
||||
flex: '1 1 auto',
|
||||
minHeight: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<div
|
||||
v-if="pageBusy"
|
||||
:style="{
|
||||
position: 'absolute',
|
||||
inset: 0,
|
||||
zIndex: 2,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background: token.colorBgMask,
|
||||
}"
|
||||
>
|
||||
<a-spin :tip="busyMessage" />
|
||||
</div>
|
||||
|
||||
<PipelineList
|
||||
v-if="viewMode === 'list' && (!loading || stages.length)"
|
||||
:stages="visibleStages"
|
||||
:copy="PROJECT_BOARD_COPY"
|
||||
@open-deal="onOpenCard"
|
||||
@menu-deal="onMenuCard"
|
||||
/>
|
||||
<PipelineList
|
||||
v-if="viewMode === 'list' && (!loading || stages.length)"
|
||||
:stages="visibleStages"
|
||||
:copy="PROJECT_BOARD_COPY"
|
||||
@open-deal="onOpenCard"
|
||||
@menu-deal="onMenuCard"
|
||||
/>
|
||||
|
||||
<PipelineBoard
|
||||
v-else-if="viewMode === 'kanban' && stages.length"
|
||||
:stages="visibleStages"
|
||||
:dragging-id="draggingId"
|
||||
:drop-stage-id="dropStageId"
|
||||
:can-manage="canCreateBoard"
|
||||
:copy="PROJECT_BOARD_COPY"
|
||||
@drag-start="onDragStart"
|
||||
@drag-end="onDragEnd"
|
||||
@drag-over="onDragOver"
|
||||
@drop="onDrop"
|
||||
@add-deal="onAddCard"
|
||||
@open-deal="onOpenCard"
|
||||
@menu-deal="onMenuCard"
|
||||
@rename-stage="onRenameStage"
|
||||
@delete-stage="onDeleteStage"
|
||||
@move-stage="onMoveStage"
|
||||
@column-drag-start="onColumnDragStart"
|
||||
@column-drag-end="onColumnDragEnd"
|
||||
@add-stage="onAddStage"
|
||||
/>
|
||||
<PipelineBoard
|
||||
v-else-if="viewMode === 'kanban' && stages.length"
|
||||
:stages="visibleStages"
|
||||
:dragging-id="draggingId"
|
||||
:drop-stage-id="dropStageId"
|
||||
:can-manage="canCreateBoard"
|
||||
:copy="PROJECT_BOARD_COPY"
|
||||
@drag-start="onDragStart"
|
||||
@drag-end="onDragEnd"
|
||||
@drag-over="onDragOver"
|
||||
@drop="onDrop"
|
||||
@add-deal="onAddCard"
|
||||
@open-deal="onOpenCard"
|
||||
@menu-deal="onMenuCard"
|
||||
@rename-stage="onRenameStage"
|
||||
@delete-stage="onDeleteStage"
|
||||
@move-stage="onMoveStage"
|
||||
@column-drag-start="onColumnDragStart"
|
||||
@column-drag-end="onColumnDragEnd"
|
||||
@add-stage="onAddStage"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<DealCardOverlay
|
||||
@@ -563,79 +651,55 @@ onBeforeUnmount(() => {
|
||||
</Teleport>
|
||||
|
||||
<Teleport to="body">
|
||||
<div v-if="menuOpenId" class="menu-pop" role="menu" :style="menuStyle ?? undefined">
|
||||
<button type="button" role="menuitem" @click="onOpenCard(menuOpenId)">
|
||||
مشاهده کارت
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="menuitem"
|
||||
@click="cardModal = { cardId: menuOpenId ?? undefined }; menuOpenId = null"
|
||||
<div
|
||||
v-if="menuOpenId"
|
||||
class="menu-pop"
|
||||
:style="{
|
||||
position: 'fixed',
|
||||
zIndex: 1080,
|
||||
...(menuStyle ?? {}),
|
||||
}"
|
||||
>
|
||||
<a-menu
|
||||
:style="{ minWidth: '160px', boxShadow: token.boxShadowSecondary }"
|
||||
@click="onCardMenuClick"
|
||||
>
|
||||
ویرایش
|
||||
</button>
|
||||
<button type="button" role="menuitem" @click="menuOpenId = null">بستن</button>
|
||||
<a-menu-item key="view">مشاهده کارت</a-menu-item>
|
||||
<a-menu-item key="edit">ویرایش</a-menu-item>
|
||||
<a-menu-item key="close">بستن</a-menu-item>
|
||||
</a-menu>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<UiModal
|
||||
<a-modal
|
||||
:open="showCreate && canCreateBoard"
|
||||
title="تابلوی جدید"
|
||||
@close="showCreate = false"
|
||||
:confirm-loading="saving"
|
||||
ok-text="ساخت"
|
||||
cancel-text="انصراف"
|
||||
:ok-button-props="{ disabled: newName.trim().length < 2 }"
|
||||
destroy-on-close
|
||||
@ok="createBoard"
|
||||
@cancel="showCreate = false"
|
||||
>
|
||||
<form class="create-form" @submit.prevent="createBoard">
|
||||
<label class="field">
|
||||
<span>نام تابلو</span>
|
||||
<UiInput
|
||||
v-model="newName"
|
||||
<a-form layout="vertical" @finish="createBoard">
|
||||
<a-form-item label="نام تابلو" required>
|
||||
<a-input
|
||||
v-model:value="newName"
|
||||
placeholder="نام تابلوی جدید…"
|
||||
:maxlength="120"
|
||||
required
|
||||
:minlength="2"
|
||||
/>
|
||||
</label>
|
||||
</form>
|
||||
<template #footer>
|
||||
<UiButton
|
||||
type="button"
|
||||
:disabled="saving || newName.trim().length < 2"
|
||||
@click="createBoard"
|
||||
>
|
||||
{{ saving ? 'در حال ساخت…' : 'ساخت' }}
|
||||
</UiButton>
|
||||
<UiButton variant="ghost" type="button" @click="showCreate = false">
|
||||
انصراف
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiModal>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<UiModal
|
||||
:open="Boolean(deleteStageId)"
|
||||
title="حذف ستون"
|
||||
@close="deleteStageId = null"
|
||||
>
|
||||
<p class="delete-copy">
|
||||
ستون «{{ deleteStageTitle }}» حذف شود؟ اگر کارتی داخل آن باشد باید
|
||||
اول آنها را جابهجا کنید.
|
||||
</p>
|
||||
<template #footer>
|
||||
<UiButton
|
||||
type="button"
|
||||
:disabled="stageBusy"
|
||||
@click="confirmDeleteStage"
|
||||
>
|
||||
{{ stageBusy ? 'در حال حذف…' : 'حذف' }}
|
||||
</UiButton>
|
||||
<UiButton variant="ghost" type="button" @click="deleteStageId = null">
|
||||
انصراف
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiModal>
|
||||
|
||||
<UiModal
|
||||
<a-modal
|
||||
:open="Boolean(cardModal)"
|
||||
:title="cardModal?.cardId ? 'ویرایش کارت' : 'کارت جدید'"
|
||||
@close="cardModal = null"
|
||||
:footer="null"
|
||||
destroy-on-close
|
||||
width="720px"
|
||||
@cancel="cardModal = null"
|
||||
>
|
||||
<ProjectCardFormView
|
||||
v-if="cardModal"
|
||||
@@ -646,103 +710,13 @@ onBeforeUnmount(() => {
|
||||
@saved="onCardSaved"
|
||||
@cancel="cardModal = null"
|
||||
/>
|
||||
</UiModal>
|
||||
</section>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
display: grid;
|
||||
gap: 0.15rem;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
direction: rtl;
|
||||
text-align: right;
|
||||
container-type: inline-size;
|
||||
container-name: pipeline;
|
||||
}
|
||||
|
||||
.mine-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin-inline-end: 0.35rem;
|
||||
padding: 0.4rem 0.7rem;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
color: #0f172a;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.mine-toggle input {
|
||||
accent-color: #0f766e;
|
||||
}
|
||||
|
||||
.btn-ghost-sm {
|
||||
border: 1px solid #e2e8f0;
|
||||
background: #fff;
|
||||
color: #0f766e;
|
||||
border-radius: 10px;
|
||||
padding: 0.45rem 0.75rem;
|
||||
font-weight: 700;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.create-form .field {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.create-form .field span {
|
||||
font-size: 0.85rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--danger);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ok {
|
||||
color: #0f766e;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.delete-copy {
|
||||
.project-board-page {
|
||||
margin: 0;
|
||||
line-height: 1.7;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.menu-pop {
|
||||
position: fixed;
|
||||
z-index: 80;
|
||||
background: #fff;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
padding: 0.35rem;
|
||||
display: grid;
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.menu-pop button {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0.45rem 0.85rem;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
color: var(--ink);
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
@@ -34,7 +33,8 @@ import {
|
||||
DeleteOutlined,
|
||||
FileTextOutlined,
|
||||
SaveOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -264,8 +264,9 @@ onMounted(async () => {
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-row v-if="!loading" :gutter="[24, 24]" align="top">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="6">
|
||||
<a-row :gutter="[24, 24]" align="top">
|
||||
<a-col :xs="24" :lg="17" :xl="18">
|
||||
<a-card :bordered="false">
|
||||
<a-form layout="vertical" @finish="save">
|
||||
@@ -356,6 +357,7 @@ onMounted(async () => {
|
||||
</a-affix>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -30,13 +30,13 @@ import {
|
||||
ListItemMeta as AListItemMeta,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { CopyOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { CopyOutlined, PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
||||
const ACheckableTag = ATag.CheckableTag;
|
||||
@@ -240,7 +240,8 @@ onMounted(() => {
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-card :bordered="false">
|
||||
<a-divider orientation="right">کلیدهای API</a-divider>
|
||||
<a-typography-paragraph type="secondary">
|
||||
@@ -453,6 +454,7 @@ onMounted(() => {
|
||||
</a-table>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
+785
-231
File diff suppressed because it is too large
Load Diff
@@ -42,13 +42,13 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
TabPane as ATabPane,
|
||||
Tabs as ATabs,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { PlusOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -406,129 +406,133 @@ onMounted(() => {
|
||||
@close="ok = ''"
|
||||
/>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<template v-if="tab === 'appointments'">
|
||||
<a-form layout="vertical">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :sm="12" :md="8" :lg="6">
|
||||
<a-form-item label="وضعیت">
|
||||
<a-select
|
||||
v-model:value="statusFilter"
|
||||
:options="statusFilterOptions"
|
||||
style="width: 100%"
|
||||
@change="load"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<template v-if="tab === 'appointments'">
|
||||
<a-form layout="vertical">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :sm="12" :md="8" :lg="6">
|
||||
<a-form-item label="وضعیت">
|
||||
<a-select
|
||||
v-model:value="statusFilter"
|
||||
:options="statusFilterOptions"
|
||||
style="width: 100%"
|
||||
@change="load"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
|
||||
<a-empty
|
||||
v-if="!loading && !appointments.length"
|
||||
description="نوبتی نیست — اول خدمت تعریف کنید، بعد نوبت بسازید."
|
||||
/>
|
||||
<a-list v-else :data-source="appointments" item-layout="horizontal">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-space wrap :size="8">
|
||||
<a-button
|
||||
v-if="(item as ReservationAppointmentDto).status === 'pending'"
|
||||
@click="setStatus((item as ReservationAppointmentDto).id, 'confirmed')"
|
||||
>
|
||||
تأیید
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="
|
||||
(item as ReservationAppointmentDto).status === 'confirmed' ||
|
||||
(item as ReservationAppointmentDto).status === 'pending'
|
||||
"
|
||||
@click="setStatus((item as ReservationAppointmentDto).id, 'done')"
|
||||
>
|
||||
انجام شد
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="
|
||||
(item as ReservationAppointmentDto).status !== 'canceled' &&
|
||||
(item as ReservationAppointmentDto).status !== 'done'
|
||||
"
|
||||
@click="setStatus((item as ReservationAppointmentDto).id, 'canceled')"
|
||||
>
|
||||
لغو
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
@click="removeAppointment((item as ReservationAppointmentDto).id)"
|
||||
>
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>
|
||||
{{ (item as ReservationAppointmentDto).serviceName }} —
|
||||
{{ (item as ReservationAppointmentDto).personName }}
|
||||
</template>
|
||||
<template #description>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-text type="secondary">
|
||||
{{ appointmentDescription(item as ReservationAppointmentDto) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text
|
||||
v-if="(item as ReservationAppointmentDto).notes"
|
||||
type="secondary"
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="8">
|
||||
<template v-if="tab === 'appointments'">
|
||||
<a-empty
|
||||
v-if="!loading && !appointments.length"
|
||||
description="نوبتی نیست — اول خدمت تعریف کنید، بعد نوبت بسازید."
|
||||
/>
|
||||
<a-list v-else :data-source="appointments" item-layout="horizontal">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-space wrap :size="8">
|
||||
<a-button
|
||||
v-if="(item as ReservationAppointmentDto).status === 'pending'"
|
||||
@click="setStatus((item as ReservationAppointmentDto).id, 'confirmed')"
|
||||
>
|
||||
{{ (item as ReservationAppointmentDto).notes }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
تأیید
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="
|
||||
(item as ReservationAppointmentDto).status === 'confirmed' ||
|
||||
(item as ReservationAppointmentDto).status === 'pending'
|
||||
"
|
||||
@click="setStatus((item as ReservationAppointmentDto).id, 'done')"
|
||||
>
|
||||
انجام شد
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="
|
||||
(item as ReservationAppointmentDto).status !== 'canceled' &&
|
||||
(item as ReservationAppointmentDto).status !== 'done'
|
||||
"
|
||||
@click="setStatus((item as ReservationAppointmentDto).id, 'canceled')"
|
||||
>
|
||||
لغو
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
@click="removeAppointment((item as ReservationAppointmentDto).id)"
|
||||
>
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>
|
||||
{{ (item as ReservationAppointmentDto).serviceName }} —
|
||||
{{ (item as ReservationAppointmentDto).personName }}
|
||||
</template>
|
||||
<template #description>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-text type="secondary">
|
||||
{{ appointmentDescription(item as ReservationAppointmentDto) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text
|
||||
v-if="(item as ReservationAppointmentDto).notes"
|
||||
type="secondary"
|
||||
>
|
||||
{{ (item as ReservationAppointmentDto).notes }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<a-empty
|
||||
v-if="!loading && !services.length"
|
||||
description="خدمتی نیست — مثلاً مشاوره ۳۰ دقیقهای تعریف کنید."
|
||||
/>
|
||||
<a-list v-else :data-source="services" item-layout="horizontal">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template v-if="canEditServices" #actions>
|
||||
<a-space wrap :size="8">
|
||||
<a-button @click="openServiceEdit(item as ReservationServiceDto)">
|
||||
ویرایش
|
||||
</a-button>
|
||||
<a-button danger @click="removeService((item as ReservationServiceDto).id)">
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>
|
||||
{{ (item as ReservationServiceDto).name }}
|
||||
<template v-else>
|
||||
<a-empty
|
||||
v-if="!loading && !services.length"
|
||||
description="خدمتی نیست — مثلاً مشاوره ۳۰ دقیقهای تعریف کنید."
|
||||
/>
|
||||
<a-list v-else :data-source="services" item-layout="horizontal">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template v-if="canEditServices" #actions>
|
||||
<a-space wrap :size="8">
|
||||
<a-button @click="openServiceEdit(item as ReservationServiceDto)">
|
||||
ویرایش
|
||||
</a-button>
|
||||
<a-button danger @click="removeService((item as ReservationServiceDto).id)">
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #description>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-text type="secondary">
|
||||
{{ serviceDescription(item as ReservationServiceDto) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text
|
||||
v-if="(item as ReservationServiceDto).description"
|
||||
type="secondary"
|
||||
>
|
||||
{{ (item as ReservationServiceDto).description }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</template>
|
||||
</a-spin>
|
||||
<a-list-item-meta>
|
||||
<template #title>
|
||||
{{ (item as ReservationServiceDto).name }}
|
||||
</template>
|
||||
<template #description>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-text type="secondary">
|
||||
{{ serviceDescription(item as ReservationServiceDto) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text
|
||||
v-if="(item as ReservationServiceDto).description"
|
||||
type="secondary"
|
||||
>
|
||||
{{ (item as ReservationServiceDto).description }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</template>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
|
||||
<a-modal v-model:open="formOpen" title="نوبت جدید" destroy-on-close :footer="null" width="640px">
|
||||
|
||||
@@ -50,7 +50,6 @@ import {
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
@@ -69,7 +68,8 @@ import {
|
||||
SearchOutlined,
|
||||
StarOutlined,
|
||||
TeamOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
import type {
|
||||
CreateSalesGoalRequest,
|
||||
OrgUserDto,
|
||||
@@ -736,7 +736,8 @@ onBeforeUnmount(() => {
|
||||
<TableColumnsMenu table-key="sales-forecast" align="end" />
|
||||
</a-flex>
|
||||
|
||||
<a-spin v-if="!isMobile || mobTab === 'goals'" :spinning="loading">
|
||||
<CrmSkeleton v-if="!isMobile || mobTab === 'goals'" :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="6" :card="false">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="pageItems"
|
||||
@@ -832,7 +833,8 @@ onBeforeUnmount(() => {
|
||||
"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
|
||||
<!-- خلاصه پیشبینی در main فقط تب «پیشبینی» موبایل است -->
|
||||
<template v-if="isMobile && mobTab === 'forecast'">
|
||||
|
||||
@@ -39,7 +39,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Switch as ASwitch,
|
||||
Table as ATable,
|
||||
TabPane as ATabPane,
|
||||
@@ -54,7 +53,8 @@ import {
|
||||
SendOutlined,
|
||||
StopOutlined,
|
||||
BarChartOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonList, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
const AListItemMeta = AList.Item.Meta;
|
||||
@@ -427,134 +427,134 @@ onMounted(() => {
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-card :bordered="false" title="کمپین جدید">
|
||||
<a-form layout="vertical" @finish="createCampaign">
|
||||
<a-divider orientation="right">متن و تنظیمات</a-divider>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="نام کمپین" required>
|
||||
<a-input
|
||||
v-model:value="name"
|
||||
placeholder="مثلاً اطلاعرسانی جشنواره"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="ارسال">
|
||||
<a-space :size="8">
|
||||
<a-switch v-model:checked="queueNow" />
|
||||
<a-typography-text>ارسال فوری پس از ذخیره</a-typography-text>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="متن پیامک" required>
|
||||
<template #extra>
|
||||
<a-dropdown v-model:open="fieldsOpen" :trigger="['click']">
|
||||
<a-button type="link">{ } فیلدهای پویا</a-button>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item
|
||||
v-for="item in MESSAGE_AUTOMATION_FIELDS"
|
||||
:key="item.token"
|
||||
@click="insertField(item.token)"
|
||||
>
|
||||
{{ item.token }} — {{ item.label }}
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<a-textarea
|
||||
v-model:value="body"
|
||||
:rows="4"
|
||||
placeholder="متن پیامک را بنویسید… از فیلدهای پویا استفاده کنید. لینک http(s) برای هر مخاطب یکتا میشود."
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-card :bordered="false" title="کمپین جدید">
|
||||
<a-form layout="vertical" @finish="createCampaign">
|
||||
<a-divider orientation="right">متن و تنظیمات</a-divider>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="نام کمپین" required>
|
||||
<a-input
|
||||
v-model:value="name"
|
||||
placeholder="مثلاً اطلاعرسانی جشنواره"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="ارسال">
|
||||
<a-space :size="8">
|
||||
<a-switch v-model:checked="queueNow" />
|
||||
<a-typography-text>ارسال فوری پس از ذخیره</a-typography-text>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="متن پیامک" required>
|
||||
<template #extra>
|
||||
<a-dropdown v-model:open="fieldsOpen" :trigger="['click']">
|
||||
<a-button type="link">{ } فیلدهای پویا</a-button>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item
|
||||
v-for="item in MESSAGE_AUTOMATION_FIELDS"
|
||||
:key="item.token"
|
||||
@click="insertField(item.token)"
|
||||
>
|
||||
{{ item.token }} — {{ item.label }}
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<a-textarea
|
||||
v-model:value="body"
|
||||
:rows="4"
|
||||
placeholder="متن پیامک را بنویسید… از فیلدهای پویا استفاده کنید. لینک http(s) برای هر مخاطب یکتا میشود."
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-divider orientation="right">مخاطبان</a-divider>
|
||||
<a-tabs :active-key="audience" @change="onAudienceChange">
|
||||
<a-tab-pane key="people" tab="اشخاص" />
|
||||
<a-tab-pane key="leads" tab="لیدها" />
|
||||
</a-tabs>
|
||||
<a-divider orientation="right">مخاطبان</a-divider>
|
||||
<a-tabs :active-key="audience" @change="onAudienceChange">
|
||||
<a-tab-pane key="people" tab="اشخاص" />
|
||||
<a-tab-pane key="leads" tab="لیدها" />
|
||||
</a-tabs>
|
||||
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="جستجو">
|
||||
<a-input
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="نام یا موبایل…"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="audience === 'people'" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="استان">
|
||||
<a-input
|
||||
v-model:value="province"
|
||||
allow-clear
|
||||
placeholder="مثلاً اصفهان"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="شهر">
|
||||
<a-input
|
||||
v-model:value="city"
|
||||
allow-clear
|
||||
placeholder="شهر…"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="audience === 'leads'" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="منطقه / استان">
|
||||
<a-input
|
||||
v-model:value="region"
|
||||
allow-clear
|
||||
placeholder="منطقه یا استان…"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="audience === 'leads'" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="مرحله">
|
||||
<a-select
|
||||
v-model:value="stageId"
|
||||
:options="stageOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="موبایل">
|
||||
<a-space :size="8">
|
||||
<a-checkbox v-model:checked="hasMobile" />
|
||||
<a-typography-text>فقط با موبایل</a-typography-text>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="جستجو">
|
||||
<a-input
|
||||
v-model:value="q"
|
||||
allow-clear
|
||||
placeholder="نام یا موبایل…"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="audience === 'people'" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="استان">
|
||||
<a-input
|
||||
v-model:value="province"
|
||||
allow-clear
|
||||
placeholder="مثلاً اصفهان"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="شهر">
|
||||
<a-input
|
||||
v-model:value="city"
|
||||
allow-clear
|
||||
placeholder="شهر…"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="audience === 'leads'" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="منطقه / استان">
|
||||
<a-input
|
||||
v-model:value="region"
|
||||
allow-clear
|
||||
placeholder="منطقه یا استان…"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="audience === 'leads'" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="مرحله">
|
||||
<a-select
|
||||
v-model:value="stageId"
|
||||
:options="stageOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="موبایل">
|
||||
<a-space :size="8">
|
||||
<a-checkbox v-model:checked="hasMobile" />
|
||||
<a-typography-text>فقط با موبایل</a-typography-text>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="8" :style="{ marginBottom: '12px' }">
|
||||
<a-typography-text type="secondary">
|
||||
انتخابشده: {{ toFaDigits(selectedIds.length) }} نفر · نتایج فیلتر:
|
||||
{{ toFaDigits(total) }}
|
||||
</a-typography-text>
|
||||
<a-space wrap :size="8">
|
||||
<a-button @click="selectVisible">انتخاب صفحه</a-button>
|
||||
<a-button @click="selectAllFiltered">انتخاب همهٔ نتایج فیلتر</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="8" :style="{ marginBottom: '12px' }">
|
||||
<a-typography-text type="secondary">
|
||||
انتخابشده: {{ toFaDigits(selectedIds.length) }} نفر · نتایج فیلتر:
|
||||
{{ toFaDigits(total) }}
|
||||
</a-typography-text>
|
||||
<a-space wrap :size="8">
|
||||
<a-button @click="selectVisible">انتخاب صفحه</a-button>
|
||||
<a-button @click="selectAllFiltered">انتخاب همهٔ نتایج فیلتر</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<a-spin :spinning="listLoading">
|
||||
<CrmSkeleton :loading="listLoading || loading">
|
||||
<CrmSkeletonTable :rows="6" :columns="2" :card="false">
|
||||
<a-table
|
||||
:columns="audienceColumns"
|
||||
:data-source="tableData"
|
||||
@@ -589,77 +589,81 @@ onMounted(() => {
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-flex justify="center" :style="{ marginTop: '12px', marginBottom: '16px' }">
|
||||
<a-pagination
|
||||
v-model:current="page"
|
||||
:total="total"
|
||||
:page-size="pageSize"
|
||||
:show-size-changer="false"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-flex justify="center" :style="{ marginTop: '12px', marginBottom: '16px' }">
|
||||
<a-pagination
|
||||
v-model:current="page"
|
||||
:total="total"
|
||||
:page-size="pageSize"
|
||||
:show-size-changer="false"
|
||||
/>
|
||||
</a-flex>
|
||||
|
||||
<a-button type="primary" html-type="submit" :loading="saving" :disabled="saving">
|
||||
ساخت کمپین
|
||||
</a-button>
|
||||
</a-form>
|
||||
</a-card>
|
||||
<a-button type="primary" html-type="submit" :loading="saving" :disabled="saving">
|
||||
ساخت کمپین
|
||||
</a-button>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" title="کمپینها" :style="{ marginTop: '16px' }">
|
||||
<a-empty
|
||||
v-if="!loading && !campaigns.length"
|
||||
description="کمپینی نیست. اولین کمپین پیامک گروهی را بسازید."
|
||||
/>
|
||||
<a-list v-else :data-source="campaigns" item-layout="horizontal">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<a-list-item-meta
|
||||
:title="(item as SmsCampaignDto).name"
|
||||
:description="(item as SmsCampaignDto).body"
|
||||
/>
|
||||
<template #actions>
|
||||
<a-tag
|
||||
:color="statusColor[(item as SmsCampaignDto).status] || 'default'"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ statusLabel[(item as SmsCampaignDto).status] ?? (item as SmsCampaignDto).status }}
|
||||
</a-tag>
|
||||
<a-typography-text type="secondary">
|
||||
کل {{ toFaDigits((item as SmsCampaignDto).totalCount) }}
|
||||
· ارسال {{ toFaDigits((item as SmsCampaignDto).sentCount) }}
|
||||
· ناموفق {{ toFaDigits((item as SmsCampaignDto).failedCount) }}
|
||||
· ردشده {{ toFaDigits((item as SmsCampaignDto).skippedCount) }}
|
||||
· {{ formatJalaliNumeric(new Date((item as SmsCampaignDto).createdAt)) }}
|
||||
</a-typography-text>
|
||||
<a-button @click="goReport((item as SmsCampaignDto).id)">
|
||||
<template #icon><BarChartOutlined /></template>
|
||||
گزارش
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="(item as SmsCampaignDto).status === 'draft' || (item as SmsCampaignDto).status === 'cancelled'"
|
||||
@click="queue((item as SmsCampaignDto).id)"
|
||||
>
|
||||
<template #icon><SendOutlined /></template>
|
||||
صف ارسال
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="
|
||||
(item as SmsCampaignDto).status === 'queued' ||
|
||||
(item as SmsCampaignDto).status === 'sending' ||
|
||||
(item as SmsCampaignDto).status === 'draft'
|
||||
"
|
||||
danger
|
||||
@click="cancel((item as SmsCampaignDto).id)"
|
||||
>
|
||||
<template #icon><StopOutlined /></template>
|
||||
لغو
|
||||
</a-button>
|
||||
</template>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
<a-card :bordered="false" title="کمپینها" :style="{ marginTop: '16px' }">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonList :rows="6">
|
||||
<a-empty
|
||||
v-if="!loading && !campaigns.length"
|
||||
description="کمپینی نیست. اولین کمپین پیامک گروهی را بسازید."
|
||||
/>
|
||||
<a-list v-else :data-source="campaigns" item-layout="horizontal">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<a-list-item-meta
|
||||
:title="(item as SmsCampaignDto).name"
|
||||
:description="(item as SmsCampaignDto).body"
|
||||
/>
|
||||
<template #actions>
|
||||
<a-tag
|
||||
:color="statusColor[(item as SmsCampaignDto).status] || 'default'"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ statusLabel[(item as SmsCampaignDto).status] ?? (item as SmsCampaignDto).status }}
|
||||
</a-tag>
|
||||
<a-typography-text type="secondary">
|
||||
کل {{ toFaDigits((item as SmsCampaignDto).totalCount) }}
|
||||
· ارسال {{ toFaDigits((item as SmsCampaignDto).sentCount) }}
|
||||
· ناموفق {{ toFaDigits((item as SmsCampaignDto).failedCount) }}
|
||||
· ردشده {{ toFaDigits((item as SmsCampaignDto).skippedCount) }}
|
||||
· {{ formatJalaliNumeric(new Date((item as SmsCampaignDto).createdAt)) }}
|
||||
</a-typography-text>
|
||||
<a-button @click="goReport((item as SmsCampaignDto).id)">
|
||||
<template #icon><BarChartOutlined /></template>
|
||||
گزارش
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="(item as SmsCampaignDto).status === 'draft' || (item as SmsCampaignDto).status === 'cancelled'"
|
||||
@click="queue((item as SmsCampaignDto).id)"
|
||||
>
|
||||
<template #icon><SendOutlined /></template>
|
||||
صف ارسال
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="
|
||||
(item as SmsCampaignDto).status === 'queued' ||
|
||||
(item as SmsCampaignDto).status === 'sending' ||
|
||||
(item as SmsCampaignDto).status === 'draft'
|
||||
"
|
||||
danger
|
||||
@click="cancel((item as SmsCampaignDto).id)"
|
||||
>
|
||||
<template #icon><StopOutlined /></template>
|
||||
لغو
|
||||
</a-button>
|
||||
</template>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</CrmSkeletonList>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
FilterOutlined,
|
||||
SearchOutlined,
|
||||
SyncOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import axios from 'axios';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
EditOutlined,
|
||||
ReloadOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Statistic as AStatistic,
|
||||
Table as ATable,
|
||||
Tabs as ATabs,
|
||||
@@ -71,6 +70,7 @@ import {
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import {
|
||||
CheckOutlined,
|
||||
@@ -81,7 +81,7 @@ import {
|
||||
SearchOutlined,
|
||||
StopOutlined,
|
||||
TeamOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -1286,7 +1286,8 @@ onUnmounted(() => {
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<template v-if="tab === 'users'">
|
||||
<a-flex
|
||||
justify="space-between"
|
||||
@@ -1518,7 +1519,8 @@ onUnmounted(() => {
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
|
||||
@@ -2,21 +2,42 @@
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Breadcrumb as ABreadcrumb,
|
||||
BreadcrumbItem as ABreadcrumbItem,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Collapse as ACollapse,
|
||||
CollapsePanel as ACollapsePanel,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
Modal,
|
||||
RadioButton as ARadioButton,
|
||||
RadioGroup as ARadioGroup,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
CheckOutlined,
|
||||
ClockCircleOutlined,
|
||||
DeleteOutlined,
|
||||
BulbOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatJalaliDateTime } from '@/lib/jalali';
|
||||
import { canAssignToOthers } from '@/lib/assign-access';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import {
|
||||
UiBadge,
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiSelect,
|
||||
UiTextarea,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import type {
|
||||
CompanyDto,
|
||||
CreateTicketRequest,
|
||||
@@ -29,6 +50,9 @@ import type {
|
||||
TicketStatus,
|
||||
} from '@mento/shared';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
@@ -84,6 +108,37 @@ const priorityLabel: Record<TicketPriority, string> = {
|
||||
urgent: 'فوری',
|
||||
};
|
||||
|
||||
const statusOptions = computed(() =>
|
||||
(Object.keys(statusLabel) as TicketStatus[]).map((key) => ({
|
||||
value: key,
|
||||
label: statusLabel[key],
|
||||
})),
|
||||
);
|
||||
|
||||
const priorityOptions = computed(() =>
|
||||
(Object.keys(priorityLabel) as TicketPriority[]).map((key) => ({
|
||||
value: key,
|
||||
label: priorityLabel[key],
|
||||
})),
|
||||
);
|
||||
|
||||
const personOptions = computed(() => [
|
||||
{ value: '', label: 'بدون شخص' },
|
||||
...people.value.map((p) => ({ value: p.id, label: p.fullName })),
|
||||
]);
|
||||
|
||||
const companyOptions = computed(() => [
|
||||
{ value: '', label: 'بدون شرکت' },
|
||||
...companies.value.map((c) => ({ value: c.id, label: c.name })),
|
||||
]);
|
||||
|
||||
const assigneeOptions = computed(() => [
|
||||
{ value: '', label: 'بدون مسئول' },
|
||||
...users.value.map((u) => ({ value: u.id, label: u.fullName })),
|
||||
]);
|
||||
|
||||
const faqActiveKeys = ref<string[]>([]);
|
||||
|
||||
function formatWhen(iso: string) {
|
||||
const d = new Date(iso);
|
||||
if (Number.isNaN(d.getTime())) return iso;
|
||||
@@ -269,9 +324,18 @@ async function sendReply() {
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
if (!id.value || !confirm('این تیکت حذف شود؟')) return;
|
||||
await api.delete(`/tickets/${id.value}`);
|
||||
await router.push({ name: 'tickets' });
|
||||
if (!id.value) return;
|
||||
Modal.confirm({
|
||||
title: 'حذف تیکت',
|
||||
content: 'این تیکت حذف شود؟',
|
||||
okText: 'حذف',
|
||||
okType: 'danger',
|
||||
cancelText: 'انصراف',
|
||||
async onOk() {
|
||||
await api.delete(`/tickets/${id.value}`);
|
||||
await router.push({ name: 'tickets' });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
@@ -282,444 +346,263 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="crm-page narrow">
|
||||
<UiPageHeader
|
||||
:title="pageTitle"
|
||||
:back-to="{ name: 'tickets' }"
|
||||
>
|
||||
<template #lead>
|
||||
<span class="crumb">
|
||||
<RouterLink :to="{ name: 'tickets' }">تیکتها</RouterLink>
|
||||
<span>›</span>
|
||||
<strong>{{ pageTitle }}</strong>
|
||||
</span>
|
||||
</template>
|
||||
<template #actions>
|
||||
<UiButton
|
||||
variant="primary"
|
||||
:disabled="saving"
|
||||
:loading="saving"
|
||||
@click="save"
|
||||
>
|
||||
<UiIcon name="check" :size="16" />
|
||||
<a-flex vertical :gap="16">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
||||
<a-flex vertical :gap="4">
|
||||
<a-breadcrumb>
|
||||
<a-breadcrumb-item>
|
||||
<RouterLink :to="{ name: 'tickets' }">تیکتها</RouterLink>
|
||||
</a-breadcrumb-item>
|
||||
<a-breadcrumb-item>{{ pageTitle }}</a-breadcrumb-item>
|
||||
</a-breadcrumb>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
{{ pageTitle }}
|
||||
</a-typography-title>
|
||||
</a-flex>
|
||||
<a-space :size="8" wrap>
|
||||
<a-button type="primary" :loading="saving" @click="save">
|
||||
<template #icon><CheckOutlined /></template>
|
||||
{{ saving ? 'در حال ذخیره…' : 'ذخیره' }}
|
||||
</UiButton>
|
||||
<UiButton variant="ghost" :disabled="saving" @click="cancel">
|
||||
انصراف
|
||||
</UiButton>
|
||||
<UiButton
|
||||
v-if="!isNew"
|
||||
variant="danger"
|
||||
:disabled="saving"
|
||||
@click="remove"
|
||||
>
|
||||
</a-button>
|
||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||
<a-button v-if="!isNew" danger :disabled="saving" @click="remove">
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
حذف
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<p v-if="loading" class="muted">در حال بارگذاری…</p>
|
||||
|
||||
<template v-else>
|
||||
<aside
|
||||
v-if="!isNew && ticket?.slaDueAt"
|
||||
class="sla-box"
|
||||
:class="{ bad: ticket.slaBreached }"
|
||||
>
|
||||
<UiIcon name="clock" :size="18" />
|
||||
<div>
|
||||
<template v-if="ticket.slaBreached">
|
||||
مهلت پاسخ اول گذشته است.
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-alert
|
||||
v-if="!isNew && ticket?.slaDueAt"
|
||||
:type="ticket.slaBreached ? 'error' : 'info'"
|
||||
show-icon
|
||||
>
|
||||
<template #icon><ClockCircleOutlined /></template>
|
||||
<template #message>
|
||||
<template v-if="ticket.slaBreached">
|
||||
مهلت پاسخ اول گذشته است.
|
||||
</template>
|
||||
<template v-else-if="ticket.firstRespondedAt">
|
||||
پاسخ اول ثبت شد ({{ formatWhen(ticket.firstRespondedAt) }}).
|
||||
</template>
|
||||
<template v-else>
|
||||
مهلت پاسخ اول: {{ formatWhen(ticket.slaDueAt) }}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="ticket.firstRespondedAt">
|
||||
پاسخ اول ثبت شد ({{ formatWhen(ticket.firstRespondedAt) }}).
|
||||
</template>
|
||||
<template v-else>
|
||||
مهلت پاسخ اول: {{ formatWhen(ticket.slaDueAt) }}
|
||||
</template>
|
||||
</div>
|
||||
</aside>
|
||||
</a-alert>
|
||||
|
||||
<form class="crm-form" @submit.prevent="save">
|
||||
<UiCard>
|
||||
<div class="crm-form-grid-2">
|
||||
<div class="crm-col-span-full">
|
||||
<UiField label="موضوع" required for-id="subject">
|
||||
<UiInput
|
||||
id="subject"
|
||||
v-model="subject"
|
||||
required
|
||||
maxlength="200"
|
||||
placeholder="موضوع تیکت را وارد کنید…"
|
||||
/>
|
||||
</UiField>
|
||||
</div>
|
||||
<a-form layout="vertical" @finish="save">
|
||||
<a-card :bordered="false">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="موضوع" required>
|
||||
<a-input
|
||||
id="subject"
|
||||
v-model:value="subject"
|
||||
:maxlength="200"
|
||||
placeholder="موضوع تیکت را وارد کنید…"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<UiField label="وضعیت" for-id="status">
|
||||
<UiSelect id="status" v-model="status">
|
||||
<option
|
||||
v-for="(label, key) in statusLabel"
|
||||
:key="key"
|
||||
:value="key"
|
||||
>
|
||||
{{ label }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="وضعیت">
|
||||
<a-select
|
||||
id="status"
|
||||
v-model:value="status"
|
||||
:options="statusOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<UiField label="اولویت" for-id="priority">
|
||||
<UiSelect id="priority" v-model="priority">
|
||||
<option
|
||||
v-for="(label, key) in priorityLabel"
|
||||
:key="key"
|
||||
:value="key"
|
||||
>
|
||||
{{ label }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="اولویت">
|
||||
<a-select
|
||||
id="priority"
|
||||
v-model:value="priority"
|
||||
:options="priorityOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<UiField label="شخص مرتبط" for-id="personId">
|
||||
<UiSelect id="personId" v-model="personId">
|
||||
<option value="">بدون شخص</option>
|
||||
<option v-for="p in people" :key="p.id" :value="p.id">
|
||||
{{ p.fullName }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شخص مرتبط">
|
||||
<a-select
|
||||
id="personId"
|
||||
v-model:value="personId"
|
||||
:options="personOptions"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<UiField label="شرکت مرتبط" for-id="companyId">
|
||||
<UiSelect id="companyId" v-model="companyId">
|
||||
<option value="">بدون شرکت</option>
|
||||
<option v-for="c in companies" :key="c.id" :value="c.id">
|
||||
{{ c.name }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شرکت مرتبط">
|
||||
<a-select
|
||||
id="companyId"
|
||||
v-model:value="companyId"
|
||||
:options="companyOptions"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<UiField v-if="canAssignOthers" label="مسئول" for-id="assigneeId">
|
||||
<UiSelect id="assigneeId" v-model="assigneeId">
|
||||
<option value="">بدون مسئول</option>
|
||||
<option v-for="u in users" :key="u.id" :value="u.id">
|
||||
{{ u.fullName }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-col v-if="canAssignOthers" :xs="24" :md="12">
|
||||
<a-form-item label="مسئول">
|
||||
<a-select
|
||||
id="assigneeId"
|
||||
v-model:value="assigneeId"
|
||||
:options="assigneeOptions"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<div class="crm-col-span-full">
|
||||
<UiField :label="isNew ? 'شرح اولیه' : 'شرح'" for-id="description">
|
||||
<UiTextarea
|
||||
id="description"
|
||||
v-model="description"
|
||||
:rows="4"
|
||||
placeholder="جزئیات و توضیحات تیکت را بنویسید…"
|
||||
/>
|
||||
</UiField>
|
||||
</div>
|
||||
</div>
|
||||
</UiCard>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="isNew ? 'شرح اولیه' : 'شرح'">
|
||||
<a-textarea
|
||||
id="description"
|
||||
v-model:value="description"
|
||||
:rows="4"
|
||||
placeholder="جزئیات و توضیحات تیکت را بنویسید…"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<UiCard v-if="isNew && faqHints.length" class="faq-hints-card" padding="sm">
|
||||
<p class="faq-title">
|
||||
<UiIcon name="lightbulb" :size="16" />
|
||||
شاید این مقالات راهنما (FAQ) کمک کند:
|
||||
</p>
|
||||
<details v-for="f in faqHints" :key="f.id" class="faq-item">
|
||||
<summary>{{ f.question }}</summary>
|
||||
<p>{{ f.answer }}</p>
|
||||
</details>
|
||||
</UiCard>
|
||||
<a-card
|
||||
v-if="isNew && faqHints.length"
|
||||
:bordered="false"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<a-flex align="center" :gap="8" :style="{ marginBottom: '8px' }">
|
||||
<BulbOutlined />
|
||||
<a-typography-text strong>
|
||||
شاید این مقالات راهنما (FAQ) کمک کند:
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-collapse v-model:activeKey="faqActiveKeys" accordion>
|
||||
<a-collapse-panel
|
||||
v-for="f in faqHints"
|
||||
:key="f.id"
|
||||
:header="f.question"
|
||||
>
|
||||
<a-typography-paragraph :style="{ whiteSpace: 'pre-wrap', marginBottom: 0 }">
|
||||
{{ f.answer }}
|
||||
</a-typography-paragraph>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</a-card>
|
||||
|
||||
<p v-if="error" class="error-msg">{{ error }}</p>
|
||||
</form>
|
||||
|
||||
<UiCard v-if="showCsat" class="csat-card">
|
||||
<template #header>
|
||||
<div class="csat-header">
|
||||
<h3>رضایت مشتری (CSAT)</h3>
|
||||
<span v-if="ticket?.csatAt" class="muted">
|
||||
آخرین ثبت: {{ formatWhen(ticket.csatAt) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="csat-body">
|
||||
<div class="csat-scores">
|
||||
<button
|
||||
v-for="n in 5"
|
||||
:key="n"
|
||||
type="button"
|
||||
class="score"
|
||||
:class="{ active: csatScore === n }"
|
||||
@click="csatScore = n"
|
||||
>
|
||||
{{ n }}
|
||||
</button>
|
||||
</div>
|
||||
<UiTextarea
|
||||
v-model="csatComment"
|
||||
:rows="2"
|
||||
placeholder="نظر یا بازخورد مشتری (اختیاری)…"
|
||||
<a-alert
|
||||
v-if="error"
|
||||
type="error"
|
||||
show-icon
|
||||
:message="error"
|
||||
:style="{ marginTop: '16px' }"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<UiButton
|
||||
variant="secondary"
|
||||
:disabled="csatSaving || csatScore == null"
|
||||
:loading="csatSaving"
|
||||
@click="saveCsat"
|
||||
>
|
||||
{{ ticket?.csatAt ? 'بهروزرسانی رضایت' : 'ثبت رضایت' }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiCard>
|
||||
</a-form>
|
||||
|
||||
<UiCard v-if="!isNew && ticket" class="thread-card">
|
||||
<template #header>
|
||||
<div class="thread-header">
|
||||
<h3>گفتگو و پیامها</h3>
|
||||
<UiBadge variant="neutral" size="sm">
|
||||
{{ ticket.messages.length }} پیام
|
||||
</UiBadge>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="ticket.messages.length" class="messages">
|
||||
<article
|
||||
v-for="msg in ticket.messages"
|
||||
:key="msg.id"
|
||||
class="msg"
|
||||
:class="{ internal: msg.isInternal }"
|
||||
>
|
||||
<header>
|
||||
<strong>{{ msg.author?.fullName || 'سیستم' }}</strong>
|
||||
<span class="muted">{{ formatWhen(msg.createdAt) }}</span>
|
||||
<UiBadge v-if="msg.isInternal" variant="warning" size="sm">داخلی</UiBadge>
|
||||
</header>
|
||||
<p>{{ msg.body }}</p>
|
||||
</article>
|
||||
</div>
|
||||
<p v-else class="muted empty-messages">هنوز پیامی ثبت نشده است.</p>
|
||||
|
||||
<template #footer>
|
||||
<form class="reply-form" @submit.prevent="sendReply">
|
||||
<UiTextarea
|
||||
v-model="reply"
|
||||
:rows="3"
|
||||
placeholder="پاسخ به تیکت یا یادداشت جدید…"
|
||||
required
|
||||
<a-card v-if="showCsat" :bordered="false">
|
||||
<template #title>رضایت مشتری (CSAT)</template>
|
||||
<template v-if="ticket?.csatAt" #extra>
|
||||
<a-typography-text type="secondary">
|
||||
آخرین ثبت: {{ formatWhen(ticket.csatAt) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<a-flex vertical :gap="12">
|
||||
<a-radio-group
|
||||
:value="csatScore ?? undefined"
|
||||
button-style="solid"
|
||||
@update:value="(v) => (csatScore = typeof v === 'number' ? v : Number(v))"
|
||||
>
|
||||
<a-radio-button v-for="n in 5" :key="n" :value="n">
|
||||
{{ n }}
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
<a-textarea
|
||||
v-model:value="csatComment"
|
||||
:rows="2"
|
||||
placeholder="نظر یا بازخورد مشتری (اختیاری)…"
|
||||
/>
|
||||
<div class="reply-actions">
|
||||
<label class="check">
|
||||
<input v-model="replyInternal" type="checkbox" />
|
||||
<span>یادداشت داخلی (فقط همکاران)</span>
|
||||
</label>
|
||||
<UiButton
|
||||
variant="primary"
|
||||
type="submit"
|
||||
<a-flex justify="flex-end">
|
||||
<a-button
|
||||
type="default"
|
||||
:disabled="csatSaving || csatScore == null"
|
||||
:loading="csatSaving"
|
||||
@click="saveCsat"
|
||||
>
|
||||
{{ ticket?.csatAt ? 'بهروزرسانی رضایت' : 'ثبت رضایت' }}
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
|
||||
<a-card v-if="!isNew && ticket" :bordered="false">
|
||||
<template #title>گفتگو و پیامها</template>
|
||||
<template #extra>
|
||||
<a-tag>{{ ticket.messages.length }} پیام</a-tag>
|
||||
</template>
|
||||
|
||||
<a-flex v-if="ticket.messages.length" vertical :gap="12">
|
||||
<a-card
|
||||
v-for="msg in ticket.messages"
|
||||
:key="msg.id"
|
||||
:type="msg.isInternal ? 'inner' : undefined"
|
||||
>
|
||||
<a-flex align="center" wrap="wrap" :gap="8" :style="{ marginBottom: '8px' }">
|
||||
<a-typography-text strong>
|
||||
{{ msg.author?.fullName || 'سیستم' }}
|
||||
</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ formatWhen(msg.createdAt) }}
|
||||
</a-typography-text>
|
||||
<a-tag v-if="msg.isInternal" color="warning">داخلی</a-tag>
|
||||
</a-flex>
|
||||
<a-typography-paragraph :style="{ whiteSpace: 'pre-wrap', marginBottom: 0 }">
|
||||
{{ msg.body }}
|
||||
</a-typography-paragraph>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
<a-empty v-else description="هنوز پیامی ثبت نشده است." />
|
||||
|
||||
<a-form layout="vertical" :style="{ marginTop: '16px' }" @finish="sendReply">
|
||||
<a-form-item>
|
||||
<a-textarea
|
||||
v-model:value="reply"
|
||||
:rows="3"
|
||||
placeholder="پاسخ به تیکت یا یادداشت جدید…"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
||||
<a-checkbox v-model:checked="replyInternal">
|
||||
یادداشت داخلی (فقط همکاران)
|
||||
</a-checkbox>
|
||||
<a-button
|
||||
type="primary"
|
||||
html-type="submit"
|
||||
:disabled="messaging || !reply.trim()"
|
||||
:loading="messaging"
|
||||
>
|
||||
ارسال پیام
|
||||
</UiButton>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
</UiCard>
|
||||
</template>
|
||||
</section>
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.crumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
.crumb a {
|
||||
color: var(--color-primary-dark);
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.sla-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-3);
|
||||
padding: var(--sp-3) var(--sp-4);
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--color-primary-light);
|
||||
background: var(--color-primary-surface);
|
||||
color: var(--color-primary-dark);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sla-box.bad {
|
||||
border-color: color-mix(in srgb, var(--color-danger) 40%, var(--color-border));
|
||||
background: var(--color-danger-surface);
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.faq-hints-card {
|
||||
border: 1px dashed var(--color-border);
|
||||
background: var(--color-surface-sunken);
|
||||
}
|
||||
|
||||
.faq-title {
|
||||
margin: 0 0 var(--sp-2);
|
||||
font-weight: 700;
|
||||
font-size: var(--fs-sm);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.faq-item {
|
||||
font-size: var(--fs-sm);
|
||||
margin-top: var(--sp-2);
|
||||
}
|
||||
|
||||
.faq-item summary {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-emphasis);
|
||||
}
|
||||
|
||||
.faq-item p {
|
||||
margin: var(--sp-2) 0 0;
|
||||
color: var(--color-text-muted);
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.error-msg {
|
||||
color: var(--color-danger);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.csat-card,
|
||||
.thread-card {
|
||||
margin-top: var(--sp-4);
|
||||
}
|
||||
|
||||
.csat-header,
|
||||
.thread-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.csat-header h3,
|
||||
.thread-header h3 {
|
||||
margin: 0;
|
||||
font-size: var(--fs-base);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.csat-body {
|
||||
display: grid;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.csat-scores {
|
||||
display: flex;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.score {
|
||||
width: 2.6rem;
|
||||
height: 2.6rem;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--color-border);
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
font-weight: 600;
|
||||
font-size: var(--fs-base);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.score:hover {
|
||||
border-color: var(--color-primary);
|
||||
background: var(--color-primary-surface);
|
||||
}
|
||||
|
||||
.score.active {
|
||||
border-color: var(--color-primary);
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.messages {
|
||||
display: grid;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.msg {
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--sp-3) var(--sp-4);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.msg.internal {
|
||||
background: var(--color-warning-surface);
|
||||
border-color: color-mix(in srgb, var(--color-warning) 30%, var(--color-border));
|
||||
}
|
||||
|
||||
.msg header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--sp-2);
|
||||
align-items: center;
|
||||
margin-bottom: var(--sp-2);
|
||||
}
|
||||
|
||||
.msg p {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.6;
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.empty-messages {
|
||||
font-size: var(--fs-sm);
|
||||
padding: var(--sp-4) 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.reply-form {
|
||||
display: grid;
|
||||
gap: var(--sp-3);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.reply-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--color-text-muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -25,13 +25,13 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { FilterOutlined, PlusOutlined, SearchOutlined } from '@ant-design/icons-vue';
|
||||
import { FilterOutlined, PlusOutlined, SearchOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||
|
||||
@@ -263,90 +263,92 @@ onMounted(load);
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-card v-if="listEmpty" :bordered="false">
|
||||
<a-empty
|
||||
description="هنوز تیکتی ثبت نشده است. اولین درخواست پشتیبانی را ثبت کنید تا پیگیریها اینجا جمع شوند."
|
||||
>
|
||||
<a-button type="primary" @click="goNew">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
تیکت جدید
|
||||
</a-button>
|
||||
</a-empty>
|
||||
</a-card>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="6">
|
||||
<a-card v-if="listEmpty" :bordered="false">
|
||||
<a-empty
|
||||
description="هنوز تیکتی ثبت نشده است. اولین درخواست پشتیبانی را ثبت کنید تا پیگیریها اینجا جمع شوند."
|
||||
>
|
||||
<a-button type="primary" @click="goNew">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
تیکت جدید
|
||||
</a-button>
|
||||
</a-empty>
|
||||
</a-card>
|
||||
|
||||
<a-card v-else-if="!error" :bordered="false">
|
||||
<a-flex justify="space-between" align="center" :gap="12" :style="{ marginBottom: '12px' }">
|
||||
<a-typography-text strong>
|
||||
{{ toFaDigits(items.length) }} تیکت
|
||||
</a-typography-text>
|
||||
<TableColumnsMenu table-key="tickets" align="end" />
|
||||
</a-flex>
|
||||
<a-card v-else-if="!error" :bordered="false">
|
||||
<a-flex justify="space-between" align="center" :gap="12" :style="{ marginBottom: '12px' }">
|
||||
<a-typography-text strong>
|
||||
{{ toFaDigits(items.length) }} تیکت
|
||||
</a-typography-text>
|
||||
<TableColumnsMenu table-key="tickets" align="end" />
|
||||
</a-flex>
|
||||
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="items"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 720 }"
|
||||
:custom-row="(record: TicketDto) => ({
|
||||
style: record.slaBreached
|
||||
? { background: 'var(--ant-color-error-bg)' }
|
||||
: undefined,
|
||||
onClick: () => goDetail(record.id),
|
||||
})"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'موضوع'">
|
||||
<a-typography-link @click.stop="goDetail((record as TicketDto).id)">
|
||||
{{ (record as TicketDto).subject }}
|
||||
</a-typography-link>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="items"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 720 }"
|
||||
:custom-row="(record: TicketDto) => ({
|
||||
style: record.slaBreached
|
||||
? { background: 'var(--ant-color-error-bg)' }
|
||||
: undefined,
|
||||
onClick: () => goDetail(record.id),
|
||||
})"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'موضوع'">
|
||||
<a-typography-link @click.stop="goDetail((record as TicketDto).id)">
|
||||
{{ (record as TicketDto).subject }}
|
||||
</a-typography-link>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'شماره'">
|
||||
<a-typography-text type="secondary">
|
||||
{{ (record as TicketDto).number }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag
|
||||
:color="statusTagColor((record as TicketDto).status)"
|
||||
:bordered="false"
|
||||
>
|
||||
{{
|
||||
statusLabel[(record as TicketDto).status as TicketStatus] ||
|
||||
(record as TicketDto).status
|
||||
}}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'اولویت'">
|
||||
<a-tag
|
||||
:color="priorityTagColor((record as TicketDto).priority)"
|
||||
:bordered="false"
|
||||
>
|
||||
{{
|
||||
priorityLabel[(record as TicketDto).priority as TicketPriority] ||
|
||||
(record as TicketDto).priority
|
||||
}}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مشتری / مسئول'">
|
||||
<a-typography-text type="secondary">
|
||||
{{ personAssigneeText(record as TicketDto) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'SLA'">
|
||||
<a-tag
|
||||
v-if="slaText(record as TicketDto).text !== '—'"
|
||||
:color="slaText(record as TicketDto).color"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ slaText(record as TicketDto).text }}
|
||||
</a-tag>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'شماره'">
|
||||
<a-typography-text type="secondary">
|
||||
{{ (record as TicketDto).number }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-tag
|
||||
:color="statusTagColor((record as TicketDto).status)"
|
||||
:bordered="false"
|
||||
>
|
||||
{{
|
||||
statusLabel[(record as TicketDto).status as TicketStatus] ||
|
||||
(record as TicketDto).status
|
||||
}}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'اولویت'">
|
||||
<a-tag
|
||||
:color="priorityTagColor((record as TicketDto).priority)"
|
||||
:bordered="false"
|
||||
>
|
||||
{{
|
||||
priorityLabel[(record as TicketDto).priority as TicketPriority] ||
|
||||
(record as TicketDto).priority
|
||||
}}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مشتری / مسئول'">
|
||||
<a-typography-text type="secondary">
|
||||
{{ personAssigneeText(record as TicketDto) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'SLA'">
|
||||
<a-tag
|
||||
v-if="slaText(record as TicketDto).text !== '—'"
|
||||
:color="slaText(record as TicketDto).color"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ slaText(record as TicketDto).text }}
|
||||
</a-tag>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -23,13 +23,13 @@ import {
|
||||
Input as AInput,
|
||||
InputPassword as AInputPassword,
|
||||
Row as ARow,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { CopyOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { CopyOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -203,7 +203,8 @@ onMounted(() => {
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-card title="اتصال جدید" :bordered="false">
|
||||
<a-typography-paragraph type="secondary">
|
||||
@@ -388,6 +389,7 @@ onMounted(() => {
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
@@ -24,12 +24,12 @@ import {
|
||||
InputPassword as AInputPassword,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { CopyOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||
import { CopyOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
@@ -204,7 +204,8 @@ onMounted(() => {
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-card title="اتصال جدید" :bordered="false">
|
||||
<a-typography-paragraph type="secondary">
|
||||
@@ -359,6 +360,7 @@ onMounted(() => {
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,30 +1,46 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, onMounted, reactive, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Breadcrumb as ABreadcrumb,
|
||||
BreadcrumbItem as ABreadcrumbItem,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
InputNumber as AInputNumber,
|
||||
RadioButton as ARadioButton,
|
||||
RadioGroup as ARadioGroup,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { ActivityPriority, RoutineDto, RoutineEntityLink, SaveRoutineRequest } from '@mento/shared';
|
||||
import { ROUTINE_ENTITY_LINK_LABELS, ROUTINE_WEEKDAY_LABELS } from '@mento/shared';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import RecurrencePicker, { type RecurrenceValue } from '@/components/routines/RecurrencePicker.vue';
|
||||
import {
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiSegmented,
|
||||
UiSelect,
|
||||
UiTextarea,
|
||||
} from '@/components/ui';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { PRIORITY_LABELS, ROUTINES_CTX, apiError, formatDayNumeric, todayKey } from '@/lib/routines';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
|
||||
const shell = inject(ROUTINES_CTX)!;
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const id = computed(() => (typeof route.params.id === 'string' ? route.params.id : null));
|
||||
const isEdit = computed(() => !!id.value);
|
||||
const pageTitle = computed(() => (isEdit.value ? 'ویرایش روتین' : 'روتین جدید'));
|
||||
|
||||
const form = reactive({
|
||||
title: '',
|
||||
@@ -35,7 +51,7 @@ const form = reactive({
|
||||
categoryId: '',
|
||||
priority: 'medium' as ActivityPriority,
|
||||
timeOfDay: '09:00',
|
||||
durationMinutes: '' as string | number,
|
||||
durationMinutes: null as number | null,
|
||||
startDate: todayKey(),
|
||||
endDate: '',
|
||||
isMandatory: true,
|
||||
@@ -61,13 +77,26 @@ const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const error = ref('');
|
||||
|
||||
const targetOptions = [
|
||||
{ value: 'user' as const, label: 'یک کاربر' },
|
||||
{ value: 'team' as const, label: 'همه اعضای یک تیم' },
|
||||
];
|
||||
|
||||
const priorities = Object.entries(PRIORITY_LABELS) as Array<[ActivityPriority, string]>;
|
||||
const entityLinks = Object.entries(ROUTINE_ENTITY_LINK_LABELS) as Array<[RoutineEntityLink, string]>;
|
||||
|
||||
const categoryOptions = computed(() => [
|
||||
{ value: '', label: 'بدون دسته' },
|
||||
...categories.value.map((c) => ({ value: c.id, label: c.name })),
|
||||
]);
|
||||
|
||||
const priorityOptions = priorities.map(([value, label]) => ({ value, label }));
|
||||
|
||||
const userOptions = computed(() =>
|
||||
users.value.map((u) => ({ value: u.id, label: u.fullName })),
|
||||
);
|
||||
|
||||
const teamOptions = computed(() =>
|
||||
teams.value.map((t) => ({ value: t.id, label: t.name })),
|
||||
);
|
||||
|
||||
const entityLinkOptions = entityLinks.map(([value, label]) => ({ value, label }));
|
||||
|
||||
const reminderOptions = [
|
||||
{ value: '', label: 'طبق تنظیمات هر کاربر' },
|
||||
{ value: '0', label: 'سر ساعت' },
|
||||
@@ -88,7 +117,7 @@ function fill(r: RoutineDto) {
|
||||
categoryId: r.category?.id ?? '',
|
||||
priority: r.priority,
|
||||
timeOfDay: r.timeOfDay,
|
||||
durationMinutes: r.durationMinutes ?? '',
|
||||
durationMinutes: r.durationMinutes ?? null,
|
||||
startDate: r.startDate,
|
||||
endDate: r.endDate ?? '',
|
||||
isMandatory: r.isMandatory,
|
||||
@@ -230,301 +259,240 @@ async function save() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="rform">
|
||||
<UiPageHeader
|
||||
:title="isEdit ? 'ویرایش روتین' : 'روتین جدید'"
|
||||
lead="کاری که باید بهصورت منظم انجام شود؛ هر روزِ تکرار، یک کار برای مسئول ساخته میشود."
|
||||
back-to="/routines/manage"
|
||||
/>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-flex vertical :gap="4">
|
||||
<a-breadcrumb>
|
||||
<a-breadcrumb-item>
|
||||
<RouterLink to="/routines/manage">مدیریت روتینها</RouterLink>
|
||||
</a-breadcrumb-item>
|
||||
<a-breadcrumb-item>{{ pageTitle }}</a-breadcrumb-item>
|
||||
</a-breadcrumb>
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
{{ pageTitle }}
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
کاری که باید بهصورت منظم انجام شود؛ هر روزِ تکرار، یک کار برای مسئول ساخته میشود.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
|
||||
<div v-if="loading" class="state">در حال بارگذاری…</div>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-form layout="vertical" @finish="save">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="24" :lg="16">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-card :bordered="false" title="اطلاعات پایه">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="عنوان" required>
|
||||
<a-input
|
||||
v-model:value="form.title"
|
||||
placeholder="مثلاً: تماس با لیدهای جدید"
|
||||
:maxlength="200"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="توضیحات">
|
||||
<a-textarea
|
||||
v-model:value="form.description"
|
||||
:rows="3"
|
||||
placeholder="جزئیات یا دستورالعمل انجام کار"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="دستهبندی">
|
||||
<a-select
|
||||
v-model:value="form.categoryId"
|
||||
:options="categoryOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="اولویت">
|
||||
<a-select
|
||||
v-model:value="form.priority"
|
||||
:options="priorityOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<form v-else class="grid" @submit.prevent="save">
|
||||
<div class="col">
|
||||
<UiCard>
|
||||
<h3 class="sec-title">اطلاعات پایه</h3>
|
||||
<div class="fields">
|
||||
<UiField label="عنوان" required>
|
||||
<UiInput v-model="form.title" placeholder="مثلاً: تماس با لیدهای جدید" :maxlength="200" />
|
||||
</UiField>
|
||||
<UiField label="توضیحات">
|
||||
<UiTextarea v-model="form.description" :rows="3" placeholder="جزئیات یا دستورالعمل انجام کار" />
|
||||
</UiField>
|
||||
<div class="grid-2">
|
||||
<UiField label="دستهبندی">
|
||||
<UiSelect v-model="form.categoryId">
|
||||
<option value="">بدون دسته</option>
|
||||
<option v-for="c in categories" :key="c.id" :value="c.id">{{ c.name }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<UiField label="اولویت">
|
||||
<UiSelect v-model="form.priority">
|
||||
<option v-for="[k, label] in priorities" :key="k" :value="k">{{ label }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
</div>
|
||||
</div>
|
||||
</UiCard>
|
||||
<a-card :bordered="false" title="مسئول">
|
||||
<a-form-item>
|
||||
<a-radio-group v-model:value="form.target" button-style="solid">
|
||||
<a-radio-button value="user">یک کاربر</a-radio-button>
|
||||
<a-radio-button value="team">همه اعضای یک تیم</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="form.target === 'user'" label="کاربر" required>
|
||||
<a-select
|
||||
v-model:value="form.assigneeId"
|
||||
:options="userOptions"
|
||||
placeholder="انتخاب کنید"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-else
|
||||
label="تیم"
|
||||
required
|
||||
extra="برای هر عضو فعال تیم یک کار جداگانه ساخته میشود."
|
||||
>
|
||||
<a-select
|
||||
v-model:value="form.teamId"
|
||||
:options="teamOptions"
|
||||
placeholder="انتخاب کنید"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-card>
|
||||
|
||||
<UiCard>
|
||||
<h3 class="sec-title">مسئول</h3>
|
||||
<div class="fields">
|
||||
<UiSegmented v-model="form.target" :options="targetOptions" />
|
||||
<UiField v-if="form.target === 'user'" label="کاربر" required>
|
||||
<UiSelect v-model="form.assigneeId">
|
||||
<option value="" disabled>انتخاب کنید</option>
|
||||
<option v-for="u in users" :key="u.id" :value="u.id">{{ u.fullName }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<UiField v-else label="تیم" required hint="برای هر عضو فعال تیم یک کار جداگانه ساخته میشود.">
|
||||
<UiSelect v-model="form.teamId">
|
||||
<option value="" disabled>انتخاب کنید</option>
|
||||
<option v-for="t in teams" :key="t.id" :value="t.id">{{ t.name }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
</div>
|
||||
</UiCard>
|
||||
<a-card :bordered="false" title="زمانبندی و تکرار">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="ساعت انجام" required>
|
||||
<JalaliDateInput v-model="form.timeOfDay" mode="time" :clearable="false" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="مدت تقریبی (دقیقه)">
|
||||
<a-input-number
|
||||
:value="form.durationMinutes ?? undefined"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
placeholder="اختیاری"
|
||||
style="width: 100%"
|
||||
@update:value="(v: number | string | null) => { form.durationMinutes = typeof v === 'number' && v > 0 ? Math.floor(v) : null }"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="تاریخ شروع" required>
|
||||
<JalaliDateInput v-model="form.startDate" mode="date" :clearable="false" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="تاریخ پایان" extra="خالی = بدون پایان">
|
||||
<JalaliDateInput v-model="form.endDate" mode="date" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="الگوی تکرار" required>
|
||||
<RecurrencePicker v-model="recurrence" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
|
||||
<UiCard>
|
||||
<h3 class="sec-title">زمانبندی و تکرار</h3>
|
||||
<div class="fields">
|
||||
<div class="grid-2">
|
||||
<UiField label="ساعت انجام" required>
|
||||
<JalaliDateInput v-model="form.timeOfDay" mode="time" :clearable="false" />
|
||||
</UiField>
|
||||
<UiField label="مدت تقریبی (دقیقه)">
|
||||
<UiInput v-model="form.durationMinutes" type="number" placeholder="اختیاری" />
|
||||
</UiField>
|
||||
<UiField label="تاریخ شروع" required>
|
||||
<JalaliDateInput v-model="form.startDate" mode="date" :clearable="false" />
|
||||
</UiField>
|
||||
<UiField label="تاریخ پایان" hint="خالی = بدون پایان">
|
||||
<JalaliDateInput v-model="form.endDate" mode="date" />
|
||||
</UiField>
|
||||
</div>
|
||||
<UiField label="الگوی تکرار" required>
|
||||
<RecurrencePicker v-model="recurrence" />
|
||||
</UiField>
|
||||
</div>
|
||||
</UiCard>
|
||||
</div>
|
||||
<a-col :xs="24" :lg="8">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-card :bordered="false" title="قوانین انجام">
|
||||
<a-flex vertical :gap="12">
|
||||
<a-checkbox v-model:checked="form.isMandatory">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>اجباری</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
در امتیاز روزانه و روزهای پیاپی کامل حساب میشود.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
<a-checkbox v-model:checked="form.allowSkip">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>امکان رد کردن</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
کاربر میتواند این کار را برای یک روز رد کند.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
<a-checkbox
|
||||
v-if="form.allowSkip"
|
||||
v-model:checked="form.skipReasonRequired"
|
||||
:style="{ marginInlineStart: '24px' }"
|
||||
>
|
||||
<a-typography-text>ثبت دلیل رد کردن الزامی باشد</a-typography-text>
|
||||
</a-checkbox>
|
||||
<a-checkbox v-model:checked="form.reportRequired">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>گزارش نتیجه الزامی</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
قبل از انجامشدن، کاربر باید نتیجه را بنویسد.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
<a-checkbox v-model:checked="form.allowAfterDeadline">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>انجام بعد از مهلت مجاز باشد</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
اگر خاموش باشد، کار عقبافتاده فقط توسط مدیر بسته میشود.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
<a-checkbox v-model:checked="form.carryOverOverdue">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text>انتقال به روز بعد</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
کار انجامنشده در فهرست «کارهای امروز» روز بعد هم نمایش داده میشود.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
</a-flex>
|
||||
<a-form-item label="اتصال به پرونده" :style="{ marginTop: '16px', marginBottom: 0 }">
|
||||
<a-select
|
||||
v-model:value="form.entityLink"
|
||||
:options="entityLinkOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-card>
|
||||
|
||||
<div class="col side">
|
||||
<UiCard>
|
||||
<h3 class="sec-title">قوانین انجام</h3>
|
||||
<div class="toggles">
|
||||
<label class="tg">
|
||||
<input v-model="form.isMandatory" type="checkbox" />
|
||||
<span>
|
||||
<strong>اجباری</strong>
|
||||
<small>در امتیاز روزانه و روزهای پیاپی کامل حساب میشود.</small>
|
||||
</span>
|
||||
</label>
|
||||
<label class="tg">
|
||||
<input v-model="form.allowSkip" type="checkbox" />
|
||||
<span>
|
||||
<strong>امکان رد کردن</strong>
|
||||
<small>کاربر میتواند این کار را برای یک روز رد کند.</small>
|
||||
</span>
|
||||
</label>
|
||||
<label v-if="form.allowSkip" class="tg nested">
|
||||
<input v-model="form.skipReasonRequired" type="checkbox" />
|
||||
<span><strong>ثبت دلیل رد کردن الزامی باشد</strong></span>
|
||||
</label>
|
||||
<label class="tg">
|
||||
<input v-model="form.reportRequired" type="checkbox" />
|
||||
<span>
|
||||
<strong>گزارش نتیجه الزامی</strong>
|
||||
<small>قبل از انجامشدن، کاربر باید نتیجه را بنویسد.</small>
|
||||
</span>
|
||||
</label>
|
||||
<label class="tg">
|
||||
<input v-model="form.allowAfterDeadline" type="checkbox" />
|
||||
<span>
|
||||
<strong>انجام بعد از مهلت مجاز باشد</strong>
|
||||
<small>اگر خاموش باشد، کار عقبافتاده فقط توسط مدیر بسته میشود.</small>
|
||||
</span>
|
||||
</label>
|
||||
<label class="tg">
|
||||
<input v-model="form.carryOverOverdue" type="checkbox" />
|
||||
<span>
|
||||
<strong>انتقال به روز بعد</strong>
|
||||
<small>کار انجامنشده در فهرست «کارهای امروز» روز بعد هم نمایش داده میشود.</small>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<UiField label="اتصال به پرونده" class="mt">
|
||||
<UiSelect v-model="form.entityLink">
|
||||
<option v-for="[k, label] in entityLinks" :key="k" :value="k">{{ label }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
</UiCard>
|
||||
<a-card :bordered="false" title="یادآوری و وضعیت">
|
||||
<a-form-item label="یادآوری">
|
||||
<a-select
|
||||
v-model:value="form.reminderMinutesBefore"
|
||||
:options="reminderOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-checkbox v-model:checked="form.isActive">
|
||||
<a-typography-text>روتین فعال است</a-typography-text>
|
||||
</a-checkbox>
|
||||
</a-card>
|
||||
|
||||
<UiCard>
|
||||
<h3 class="sec-title">یادآوری و وضعیت</h3>
|
||||
<div class="fields">
|
||||
<UiField label="یادآوری">
|
||||
<UiSelect v-model="form.reminderMinutesBefore">
|
||||
<option v-for="o in reminderOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<label class="tg">
|
||||
<input v-model="form.isActive" type="checkbox" />
|
||||
<span><strong>روتین فعال است</strong></span>
|
||||
</label>
|
||||
</div>
|
||||
</UiCard>
|
||||
<a-alert type="info" show-icon>
|
||||
<template #message>خلاصه</template>
|
||||
<template #description>
|
||||
<a-typography-paragraph :style="{ marginBottom: 0 }">
|
||||
{{ summary }}
|
||||
</a-typography-paragraph>
|
||||
</template>
|
||||
</a-alert>
|
||||
|
||||
<div class="summary">
|
||||
<span>خلاصه</span>
|
||||
<p>{{ summary }}</p>
|
||||
</div>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<div class="actions">
|
||||
<UiButton type="submit" :loading="saving" block>{{ isEdit ? 'ذخیره تغییرات' : 'ایجاد روتین' }}</UiButton>
|
||||
<UiButton variant="ghost" block @click="router.push('/routines/manage')">انصراف</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<a-space direction="vertical" style="width: 100%">
|
||||
<a-button type="primary" html-type="submit" block :loading="saving">
|
||||
{{ isEdit ? 'ذخیره تغییرات' : 'ایجاد روتین' }}
|
||||
</a-button>
|
||||
<a-button block :disabled="saving" @click="router.push('/routines/manage')">
|
||||
انصراف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.rform {
|
||||
display: grid;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.state {
|
||||
padding: var(--sp-8);
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 360px;
|
||||
gap: var(--sp-4);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.col {
|
||||
display: grid;
|
||||
gap: var(--sp-4);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.side {
|
||||
position: sticky;
|
||||
top: var(--sp-4);
|
||||
}
|
||||
|
||||
.sec-title {
|
||||
margin: 0 0 var(--sp-4);
|
||||
font-size: var(--fs-md);
|
||||
font-weight: var(--fw-semibold);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.fields {
|
||||
display: grid;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.grid-2 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.toggles {
|
||||
display: grid;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.tg {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-2);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tg.nested {
|
||||
margin-inline-start: 26px;
|
||||
}
|
||||
|
||||
.tg input {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: 2px;
|
||||
accent-color: var(--accent);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tg span {
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.tg strong {
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.tg small {
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--muted);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.mt {
|
||||
margin-top: var(--sp-4);
|
||||
}
|
||||
|
||||
.summary {
|
||||
padding: var(--sp-3) var(--sp-4);
|
||||
border-radius: var(--radius);
|
||||
background: var(--accent-subtle);
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
|
||||
}
|
||||
|
||||
.summary span {
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--accent-deep);
|
||||
font-weight: var(--fw-semibold);
|
||||
}
|
||||
|
||||
.summary p {
|
||||
margin: 4px 0 0;
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--ink);
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: grid;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.error {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.side {
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.grid-2 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -33,12 +33,12 @@ import {
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
|
||||
import { LeftOutlined, RightOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
const { token } = theme.useToken();
|
||||
@@ -251,91 +251,93 @@ const legendItems = [
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="actions.error.value" type="error" show-icon :message="actions.error.value" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<RoutineMonthGrid
|
||||
v-if="view === 'month'"
|
||||
:from="range.from"
|
||||
:to="range.to"
|
||||
:days="cal.days"
|
||||
:selected="selected"
|
||||
@select="selectDay"
|
||||
/>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="8" :min-height="320">
|
||||
<RoutineMonthGrid
|
||||
v-if="view === 'month'"
|
||||
:from="range.from"
|
||||
:to="range.to"
|
||||
:days="cal.days"
|
||||
:selected="selected"
|
||||
@select="selectDay"
|
||||
/>
|
||||
|
||||
<a-flex v-else-if="view === 'week'" wrap="wrap" :gap="6" align="stretch">
|
||||
<a-card
|
||||
v-for="(d, i) in weekDays"
|
||||
:key="d.key"
|
||||
:bordered="true"
|
||||
:style="{
|
||||
flex: '1 1 150px',
|
||||
minWidth: 0,
|
||||
borderColor: d.key === today ? token.colorPrimary : undefined,
|
||||
boxShadow: d.key === selected ? `0 0 0 1px ${token.colorPrimary}` : undefined,
|
||||
}"
|
||||
:body-style="{ padding: '8px' }"
|
||||
>
|
||||
<a-button
|
||||
type="text"
|
||||
block
|
||||
<a-flex v-else-if="view === 'week'" wrap="wrap" :gap="6" align="stretch">
|
||||
<a-card
|
||||
v-for="(d, i) in weekDays"
|
||||
:key="d.key"
|
||||
:bordered="true"
|
||||
:style="{
|
||||
height: 'auto',
|
||||
padding: '8px',
|
||||
textAlign: 'right',
|
||||
background: STATE_HEAD_BG[d.day?.state ?? 'empty'],
|
||||
flex: '1 1 150px',
|
||||
minWidth: 0,
|
||||
borderColor: d.key === today ? token.colorPrimary : undefined,
|
||||
boxShadow: d.key === selected ? `0 0 0 1px ${token.colorPrimary}` : undefined,
|
||||
}"
|
||||
@click="openDay(d.key)"
|
||||
:body-style="{ padding: '8px' }"
|
||||
>
|
||||
<a-flex vertical align="start" :gap="0" :style="{ width: '100%' }">
|
||||
<a-typography-text type="secondary">{{ ROUTINE_WEEKDAY_LABELS[i] }}</a-typography-text>
|
||||
<a-typography-text strong>{{ formatDayNumeric(d.key) }}</a-typography-text>
|
||||
<a-typography-text v-if="d.day?.total" type="secondary">
|
||||
{{ toFaDigits(d.day.completed) }}/{{ toFaDigits(d.day.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-button>
|
||||
<a-flex vertical :gap="4" :style="{ marginTop: '8px' }">
|
||||
<a-button
|
||||
v-for="t in d.tasks"
|
||||
:key="t.id"
|
||||
type="text"
|
||||
block
|
||||
:style="{ height: 'auto', padding: '6px', textAlign: 'right' }"
|
||||
@click="shell.openTask(t.id)"
|
||||
:style="{
|
||||
height: 'auto',
|
||||
padding: '8px',
|
||||
textAlign: 'right',
|
||||
background: STATE_HEAD_BG[d.day?.state ?? 'empty'],
|
||||
}"
|
||||
@click="openDay(d.key)"
|
||||
>
|
||||
<a-flex align="center" :gap="6" :style="{ width: '100%' }">
|
||||
<a-flex
|
||||
:style="{
|
||||
width: '8px',
|
||||
height: '8px',
|
||||
borderRadius: token.borderRadiusLG,
|
||||
background: TASK_DOT_COLORS[t.status] ?? 'var(--ant-color-text-quaternary)',
|
||||
flexShrink: 0,
|
||||
}"
|
||||
/>
|
||||
<a-typography-text
|
||||
:delete="t.status === 'completed'"
|
||||
type="secondary"
|
||||
ellipsis
|
||||
:style="{ flex: 1, minWidth: 0, textAlign: 'right' }"
|
||||
>
|
||||
{{ t.title }}
|
||||
<a-flex vertical align="start" :gap="0" :style="{ width: '100%' }">
|
||||
<a-typography-text type="secondary">{{ ROUTINE_WEEKDAY_LABELS[i] }}</a-typography-text>
|
||||
<a-typography-text strong>{{ formatDayNumeric(d.key) }}</a-typography-text>
|
||||
<a-typography-text v-if="d.day?.total" type="secondary">
|
||||
{{ toFaDigits(d.day.completed) }}/{{ toFaDigits(d.day.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-typography-text v-if="hasExplicitTime(t)" type="secondary">
|
||||
{{ formatTime(t.dueAt) }}
|
||||
</a-typography-text>
|
||||
</a-button>
|
||||
<a-typography-text
|
||||
v-if="!d.tasks.length"
|
||||
type="secondary"
|
||||
:style="{ textAlign: 'center' }"
|
||||
>
|
||||
—
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
<a-flex vertical :gap="4" :style="{ marginTop: '8px' }">
|
||||
<a-button
|
||||
v-for="t in d.tasks"
|
||||
:key="t.id"
|
||||
type="text"
|
||||
block
|
||||
:style="{ height: 'auto', padding: '6px', textAlign: 'right' }"
|
||||
@click="shell.openTask(t.id)"
|
||||
>
|
||||
<a-flex align="center" :gap="6" :style="{ width: '100%' }">
|
||||
<a-flex
|
||||
:style="{
|
||||
width: '8px',
|
||||
height: '8px',
|
||||
borderRadius: token.borderRadiusLG,
|
||||
background: TASK_DOT_COLORS[t.status] ?? 'var(--ant-color-text-quaternary)',
|
||||
flexShrink: 0,
|
||||
}"
|
||||
/>
|
||||
<a-typography-text
|
||||
:delete="t.status === 'completed'"
|
||||
type="secondary"
|
||||
ellipsis
|
||||
:style="{ flex: 1, minWidth: 0, textAlign: 'right' }"
|
||||
>
|
||||
{{ t.title }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-typography-text v-if="hasExplicitTime(t)" type="secondary">
|
||||
{{ formatTime(t.dueAt) }}
|
||||
</a-typography-text>
|
||||
</a-button>
|
||||
<a-typography-text
|
||||
v-if="!d.tasks.length"
|
||||
type="secondary"
|
||||
:style="{ textAlign: 'center' }"
|
||||
>
|
||||
—
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<template v-if="view !== 'week'">
|
||||
<a-divider orientation="right">جزئیات روز</a-divider>
|
||||
|
||||
@@ -24,12 +24,12 @@ import {
|
||||
Progress as AProgress,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import { SearchOutlined, SyncOutlined } from '@ant-design/icons-vue';
|
||||
import { SearchOutlined, SyncOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
||||
const { token } = theme.useToken();
|
||||
@@ -102,75 +102,84 @@ const TONE_COLORS: Record<string, string> = {
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-empty
|
||||
v-if="!loading && !filtered.length"
|
||||
:description="
|
||||
q
|
||||
? 'روتینی با این عنوان پیدا نشد'
|
||||
: 'هنوز روتینی برای شما تعریف نشده؛ روتینها توسط مدیر تیم تعریف میشوند و هر روز بهصورت خودکار در «کارهای امروز» ظاهر میشوند.'
|
||||
"
|
||||
/>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<template v-if="loading">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col v-for="i in 6" :key="i" :xs="24" :sm="12" :xl="8">
|
||||
<CrmSkeletonCard :rows="4" :min-height="180" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-empty
|
||||
v-if="!filtered.length"
|
||||
:description="
|
||||
q
|
||||
? 'روتینی با این عنوان پیدا نشد'
|
||||
: 'هنوز روتینی برای شما تعریف نشده؛ روتینها توسط مدیر تیم تعریف میشوند و هر روز بهصورت خودکار در «کارهای امروز» ظاهر میشوند.'
|
||||
"
|
||||
/>
|
||||
|
||||
<a-row v-else :gutter="[16, 16]">
|
||||
<a-col v-for="r in filtered" :key="r.id" :xs="24" :sm="12" :xl="8">
|
||||
<a-card :bordered="false" :style="{ height: '100%', background: token.colorFillQuaternary }">
|
||||
<a-flex vertical :gap="12" :style="{ height: '100%' }">
|
||||
<a-flex align="center" :gap="12">
|
||||
<a-avatar
|
||||
shape="square"
|
||||
:style="{
|
||||
background: r.category?.color ?? token.colorPrimary,
|
||||
color: token.colorWhite,
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<template #icon><SyncOutlined /></template>
|
||||
</a-avatar>
|
||||
<a-flex vertical :gap="0" :style="{ minWidth: 0 }">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">
|
||||
{{ r.title }}
|
||||
</a-typography-title>
|
||||
<a-row v-else :gutter="[16, 16]">
|
||||
<a-col v-for="r in filtered" :key="r.id" :xs="24" :sm="12" :xl="8">
|
||||
<a-card :bordered="false" :style="{ height: '100%', background: token.colorFillQuaternary }">
|
||||
<a-flex vertical :gap="12" :style="{ height: '100%' }">
|
||||
<a-flex align="center" :gap="12">
|
||||
<a-avatar
|
||||
shape="square"
|
||||
:style="{
|
||||
background: r.category?.color ?? token.colorPrimary,
|
||||
color: token.colorWhite,
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<template #icon><SyncOutlined /></template>
|
||||
</a-avatar>
|
||||
<a-flex vertical :gap="0" :style="{ minWidth: 0 }">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">
|
||||
{{ r.title }}
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
{{ r.recurrenceLabel }} · ساعت {{ toFaDigits(r.timeOfDay) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
|
||||
<a-typography-paragraph v-if="r.description" type="secondary" :style="{ margin: 0 }">
|
||||
{{ r.description }}
|
||||
</a-typography-paragraph>
|
||||
|
||||
<a-space :size="6" wrap>
|
||||
<a-tag v-if="r.category" :bordered="false">{{ r.category.name }}</a-tag>
|
||||
<a-tag :color="priorityColor(r.priority)" :bordered="false">
|
||||
{{ PRIORITY_LABELS[r.priority] }}
|
||||
</a-tag>
|
||||
<a-tag v-if="r.isMandatory" color="warning" :bordered="false">اجباری</a-tag>
|
||||
<a-tag v-if="r.reportRequired" color="processing" :bordered="false">گزارش الزامی</a-tag>
|
||||
<a-tag v-if="r.team" color="cyan" :bordered="false">تیم {{ r.team.name }}</a-tag>
|
||||
</a-space>
|
||||
|
||||
<a-flex vertical :gap="4" :style="{ marginTop: 'auto' }">
|
||||
<a-divider :style="{ margin: 0 }" />
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text type="secondary">اجرا در ۳۰ روز اخیر</a-typography-text>
|
||||
<a-typography-text strong>{{ formatPercent(r.executionRate) }}</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(r.executionRate ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(r.executionRate)]"
|
||||
/>
|
||||
<a-typography-text type="secondary">
|
||||
{{ r.recurrenceLabel }} · ساعت {{ toFaDigits(r.timeOfDay) }}
|
||||
از {{ formatDayNumeric(r.startDate) }}{{ r.endDate ? ` تا ${formatDayNumeric(r.endDate)}` : '' }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
|
||||
<a-typography-paragraph v-if="r.description" type="secondary" :style="{ margin: 0 }">
|
||||
{{ r.description }}
|
||||
</a-typography-paragraph>
|
||||
|
||||
<a-space :size="6" wrap>
|
||||
<a-tag v-if="r.category" :bordered="false">{{ r.category.name }}</a-tag>
|
||||
<a-tag :color="priorityColor(r.priority)" :bordered="false">
|
||||
{{ PRIORITY_LABELS[r.priority] }}
|
||||
</a-tag>
|
||||
<a-tag v-if="r.isMandatory" color="warning" :bordered="false">اجباری</a-tag>
|
||||
<a-tag v-if="r.reportRequired" color="processing" :bordered="false">گزارش الزامی</a-tag>
|
||||
<a-tag v-if="r.team" color="cyan" :bordered="false">تیم {{ r.team.name }}</a-tag>
|
||||
</a-space>
|
||||
|
||||
<a-flex vertical :gap="4" :style="{ marginTop: 'auto' }">
|
||||
<a-divider :style="{ margin: 0 }" />
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text type="secondary">اجرا در ۳۰ روز اخیر</a-typography-text>
|
||||
<a-typography-text strong>{{ formatPercent(r.executionRate) }}</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(r.executionRate ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(r.executionRate)]"
|
||||
/>
|
||||
<a-typography-text type="secondary">
|
||||
از {{ formatDayNumeric(r.startDate) }}{{ r.endDate ? ` تا ${formatDayNumeric(r.endDate)}` : '' }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Switch as ASwitch,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
@@ -46,7 +45,8 @@ import {
|
||||
PlusOutlined,
|
||||
SearchOutlined,
|
||||
TeamOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Text: ATypographyText } = Typography;
|
||||
const { token } = theme.useToken();
|
||||
@@ -372,122 +372,124 @@ const teams = computed(() => shell.context.value?.teams ?? []);
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="filtered"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty
|
||||
:description="
|
||||
items.length
|
||||
? 'روتینی با این فیلتر پیدا نشد'
|
||||
: 'هنوز روتینی تعریف نشده؛ روتینها کارهای تکرارشوندهای هستند که هر روز بهصورت خودکار برای مسئولشان ساخته میشوند.'
|
||||
"
|
||||
>
|
||||
<a-button
|
||||
v-if="!items.length"
|
||||
type="primary"
|
||||
@click="router.push('/routines/manage/new')"
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="5" :card="false">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="filtered"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty
|
||||
:description="
|
||||
items.length
|
||||
? 'روتینی با این فیلتر پیدا نشد'
|
||||
: 'هنوز روتینی تعریف نشده؛ روتینها کارهای تکرارشوندهای هستند که هر روز بهصورت خودکار برای مسئولشان ساخته میشوند.'
|
||||
"
|
||||
>
|
||||
ساخت اولین روتین
|
||||
</a-button>
|
||||
</a-empty>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'عنوان'">
|
||||
<a-space :size="8" align="start">
|
||||
<a-badge :color="record.category?.color ?? undefined" />
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong :type="record.isActive ? undefined : 'secondary'">
|
||||
{{ record.title }}
|
||||
</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ record.category?.name ?? 'بدون دسته' }}
|
||||
<template v-if="record.isMandatory"> · اجباری</template>
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مسئول'">
|
||||
<a-space v-if="record.team" :size="8">
|
||||
<a-typography-text :style="{ color: 'var(--ant-color-primary)' }">
|
||||
<TeamOutlined />
|
||||
</a-typography-text>
|
||||
<a-typography-text>تیم {{ record.team.name }}</a-typography-text>
|
||||
</a-space>
|
||||
<a-space v-else-if="record.assignee" :size="8">
|
||||
<UserAvatar :name="record.assignee.fullName" :user-id="record.assignee.id" :size="24" />
|
||||
<a-typography-text>{{ record.assignee.fullName }}</a-typography-text>
|
||||
</a-space>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-space :size="8">
|
||||
<a-switch
|
||||
:checked="record.isActive"
|
||||
:loading="busyId === record.id"
|
||||
:aria-label="record.isActive ? 'غیرفعال کردن' : 'فعال کردن'"
|
||||
@change="toggle(record as RoutineDto)"
|
||||
/>
|
||||
<a-tag :color="record.isActive ? 'success' : 'default'" :bordered="false">
|
||||
{{ record.isActive ? 'فعال' : 'غیرفعال' }}
|
||||
</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'درصد انجام'">
|
||||
<a-flex vertical :gap="0" :style="{ minWidth: '8rem' }">
|
||||
<a-flex align="center" :gap="8">
|
||||
<a-typography-text strong>{{ formatPercent(record.executionRate) }}</a-typography-text>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(record.executionRate ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(record.executionRate)]"
|
||||
:style="{ flex: 1 }"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-typography-text v-if="record.executionTotal" type="secondary">
|
||||
{{ toFaDigits(record.executionDone) }} از {{ toFaDigits(record.executionTotal) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-space :size="4">
|
||||
<a-button
|
||||
type="text"
|
||||
aria-label="ویرایش"
|
||||
@click="router.push(`/routines/manage/${record.id}/edit`)"
|
||||
v-if="!items.length"
|
||||
type="primary"
|
||||
@click="router.push('/routines/manage/new')"
|
||||
>
|
||||
<template #icon><EditOutlined /></template>
|
||||
ساخت اولین روتین
|
||||
</a-button>
|
||||
<a-dropdown
|
||||
:open="menuFor === record.id"
|
||||
trigger="click"
|
||||
@update:open="(v: boolean) => (menuFor = v ? record.id : null)"
|
||||
>
|
||||
<a-button type="text" aria-label="عملیات بیشتر">
|
||||
<template #icon><MoreOutlined /></template>
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="(info) => onRowMenu(info, record as RoutineDto)">
|
||||
<a-menu-item key="edit">ویرایش</a-menu-item>
|
||||
<a-menu-item key="reassign">تغییر مسئول</a-menu-item>
|
||||
<a-menu-item key="duplicate">کپی روتین</a-menu-item>
|
||||
<a-menu-item key="toggle">
|
||||
{{ record.isActive ? 'غیرفعال کردن' : 'فعال کردن' }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="remove" danger>حذف</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</a-empty>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'عنوان'">
|
||||
<a-space :size="8" align="start">
|
||||
<a-badge :color="record.category?.color ?? undefined" />
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong :type="record.isActive ? undefined : 'secondary'">
|
||||
{{ record.title }}
|
||||
</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
{{ record.category?.name ?? 'بدون دسته' }}
|
||||
<template v-if="record.isMandatory"> · اجباری</template>
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مسئول'">
|
||||
<a-space v-if="record.team" :size="8">
|
||||
<a-typography-text :style="{ color: 'var(--ant-color-primary)' }">
|
||||
<TeamOutlined />
|
||||
</a-typography-text>
|
||||
<a-typography-text>تیم {{ record.team.name }}</a-typography-text>
|
||||
</a-space>
|
||||
<a-space v-else-if="record.assignee" :size="8">
|
||||
<UserAvatar :name="record.assignee.fullName" :user-id="record.assignee.id" :size="24" />
|
||||
<a-typography-text>{{ record.assignee.fullName }}</a-typography-text>
|
||||
</a-space>
|
||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'وضعیت'">
|
||||
<a-space :size="8">
|
||||
<a-switch
|
||||
:checked="record.isActive"
|
||||
:loading="busyId === record.id"
|
||||
:aria-label="record.isActive ? 'غیرفعال کردن' : 'فعال کردن'"
|
||||
@change="toggle(record as RoutineDto)"
|
||||
/>
|
||||
<a-tag :color="record.isActive ? 'success' : 'default'" :bordered="false">
|
||||
{{ record.isActive ? 'فعال' : 'غیرفعال' }}
|
||||
</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'درصد انجام'">
|
||||
<a-flex vertical :gap="0" :style="{ minWidth: '8rem' }">
|
||||
<a-flex align="center" :gap="8">
|
||||
<a-typography-text strong>{{ formatPercent(record.executionRate) }}</a-typography-text>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(record.executionRate ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(record.executionRate)]"
|
||||
:style="{ flex: 1 }"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-typography-text v-if="record.executionTotal" type="secondary">
|
||||
{{ toFaDigits(record.executionDone) }} از {{ toFaDigits(record.executionTotal) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-space :size="4">
|
||||
<a-button
|
||||
type="text"
|
||||
aria-label="ویرایش"
|
||||
@click="router.push(`/routines/manage/${record.id}/edit`)"
|
||||
>
|
||||
<template #icon><EditOutlined /></template>
|
||||
</a-button>
|
||||
<a-dropdown
|
||||
:open="menuFor === record.id"
|
||||
trigger="click"
|
||||
@update:open="(v: boolean) => (menuFor = v ? record.id : null)"
|
||||
>
|
||||
<a-button type="text" aria-label="عملیات بیشتر">
|
||||
<template #icon><MoreOutlined /></template>
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="(info) => onRowMenu(info, record as RoutineDto)">
|
||||
<a-menu-item key="edit">ویرایش</a-menu-item>
|
||||
<a-menu-item key="reassign">تغییر مسئول</a-menu-item>
|
||||
<a-menu-item key="duplicate">کپی روتین</a-menu-item>
|
||||
<a-menu-item key="toggle">
|
||||
{{ record.isActive ? 'غیرفعال کردن' : 'فعال کردن' }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="remove" danger>حذف</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
|
||||
<a-modal
|
||||
|
||||
@@ -29,10 +29,14 @@ import {
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tooltip as ATooltip,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
CrmSkeleton,
|
||||
CrmSkeletonCard,
|
||||
CrmSkeletonKpi,
|
||||
} from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -132,128 +136,142 @@ const statusRows = computed(() => {
|
||||
بازه {{ formatDayNumeric(d.from) }} تا {{ formatDayNumeric(d.to) }}
|
||||
</a-typography-text>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="12" :sm="8" :xl="4">
|
||||
<KpiCard label="درصد انجام" :value="formatPercent(d?.percent)" icon="target" tone="accent" />
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard label="درصد انجام" :value="formatPercent(d?.percent)" icon="target" tone="accent" />
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :xl="4">
|
||||
<KpiCard
|
||||
label="کارهای انجامشده"
|
||||
:value="toFaDigits(d?.completed ?? 0)"
|
||||
:hint="`از ${toFaDigits(d?.total ?? 0)} کار`"
|
||||
icon="check"
|
||||
tone="success"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="کارهای انجامشده"
|
||||
:value="toFaDigits(d?.completed ?? 0)"
|
||||
:hint="`از ${toFaDigits(d?.total ?? 0)} کار`"
|
||||
icon="check"
|
||||
tone="success"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :xl="4">
|
||||
<KpiCard
|
||||
label="انجامنشده"
|
||||
:value="toFaDigits(d?.notDone ?? 0)"
|
||||
:hint="`عقبافتاده ${toFaDigits(d?.overdue ?? 0)}`"
|
||||
icon="x-circle"
|
||||
tone="danger"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="انجامنشده"
|
||||
:value="toFaDigits(d?.notDone ?? 0)"
|
||||
:hint="`عقبافتاده ${toFaDigits(d?.overdue ?? 0)}`"
|
||||
icon="x-circle"
|
||||
tone="danger"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :xl="4">
|
||||
<KpiCard
|
||||
label="میانگین زمان انجام"
|
||||
:value="formatMinutes(d?.avgCompletionMinutes)"
|
||||
hint="از زمان برنامه تا انجام"
|
||||
icon="clock"
|
||||
tone="info"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="میانگین زمان انجام"
|
||||
:value="formatMinutes(d?.avgCompletionMinutes)"
|
||||
hint="از زمان برنامه تا انجام"
|
||||
icon="clock"
|
||||
tone="info"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :xl="4">
|
||||
<KpiCard
|
||||
label="روزهای کامل"
|
||||
:value="toFaDigits(d?.completeDays ?? 0)"
|
||||
:hint="`ناقص ${toFaDigits(d?.partialDays ?? 0)} · از دست رفته ${toFaDigits(d?.missedDays ?? 0)}`"
|
||||
icon="calendar"
|
||||
tone="success"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="روزهای کامل"
|
||||
:value="toFaDigits(d?.completeDays ?? 0)"
|
||||
:hint="`ناقص ${toFaDigits(d?.partialDays ?? 0)} · از دست رفته ${toFaDigits(d?.missedDays ?? 0)}`"
|
||||
icon="calendar"
|
||||
tone="success"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :sm="8" :xl="4">
|
||||
<KpiCard
|
||||
label="روزهای پیاپی کامل"
|
||||
:value="toFaDigits(d?.streak ?? 0)"
|
||||
hint="انجام همه کارهای اجباری"
|
||||
icon="flag"
|
||||
tone="warning"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="روزهای پیاپی کامل"
|
||||
:value="toFaDigits(d?.streak ?? 0)"
|
||||
hint="انجام همه کارهای اجباری"
|
||||
icon="flag"
|
||||
tone="warning"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="[24, 24]" :style="{ marginTop: '24px' }">
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">روند درصد انجام</a-typography-title>
|
||||
<a-flex
|
||||
align="end"
|
||||
:gap="2"
|
||||
:style="{ height: '180px', marginTop: '16px' }"
|
||||
>
|
||||
<a-tooltip
|
||||
v-for="p in d?.trend ?? []"
|
||||
:key="p.date"
|
||||
:title="`${formatDayNumeric(p.date)} — ${formatPercent(p.percent)} (${toFaDigits(p.completed)} از ${toFaDigits(p.total)})`"
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-row :gutter="[24, 24]" :style="{ marginTop: '24px' }">
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">روند درصد انجام</a-typography-title>
|
||||
<a-flex
|
||||
align="end"
|
||||
:gap="2"
|
||||
:style="{ height: '180px', marginTop: '16px' }"
|
||||
>
|
||||
<a-flex
|
||||
:style="{
|
||||
flex: 1,
|
||||
minWidth: '3px',
|
||||
height: `${Math.max(2, Math.round(p.percent ?? 0))}%`,
|
||||
background:
|
||||
p.percent == null
|
||||
? 'var(--ant-color-fill-secondary)'
|
||||
: 'var(--ant-color-primary)',
|
||||
borderRadius: '2px 2px 0 0',
|
||||
}"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-typography-text v-if="!d?.trend?.length" type="secondary">
|
||||
دادهای برای نمایش نیست.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">وضعیت کارها</a-typography-title>
|
||||
<a-flex vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="r in statusRows" :key="r.key">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ r.label }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ toFaDigits(r.value) }} ({{ toFaDigits(r.percent) }}٪)
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="r.percent"
|
||||
:show-info="false"
|
||||
:stroke-color="r.color"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">انجام به تفکیک دستهبندی</a-typography-title>
|
||||
<a-flex v-if="d?.byCategory.length" vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="c in d.byCategory" :key="c.categoryId ?? c.name">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ c.name }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ formatPercent(c.percent) }} · {{ toFaDigits(c.completed) }} از {{ toFaDigits(c.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(c.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="c.color"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." :style="{ marginTop: '16px' }" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
<a-tooltip
|
||||
v-for="p in d?.trend ?? []"
|
||||
:key="p.date"
|
||||
:title="`${formatDayNumeric(p.date)} — ${formatPercent(p.percent)} (${toFaDigits(p.completed)} از ${toFaDigits(p.total)})`"
|
||||
>
|
||||
<a-flex
|
||||
:style="{
|
||||
flex: 1,
|
||||
minWidth: '3px',
|
||||
height: `${Math.max(2, Math.round(p.percent ?? 0))}%`,
|
||||
background:
|
||||
p.percent == null
|
||||
? 'var(--ant-color-fill-secondary)'
|
||||
: 'var(--ant-color-primary)',
|
||||
borderRadius: '2px 2px 0 0',
|
||||
}"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-typography-text v-if="!d?.trend?.length" type="secondary">
|
||||
دادهای برای نمایش نیست.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">وضعیت کارها</a-typography-title>
|
||||
<a-flex vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="r in statusRows" :key="r.key">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ r.label }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ toFaDigits(r.value) }} ({{ toFaDigits(r.percent) }}٪)
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="r.percent"
|
||||
:show-info="false"
|
||||
:stroke-color="r.color"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">انجام به تفکیک دستهبندی</a-typography-title>
|
||||
<a-flex v-if="d?.byCategory.length" vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="c in d.byCategory" :key="c.categoryId ?? c.name">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ c.name }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ formatPercent(c.percent) }} · {{ toFaDigits(c.completed) }} از {{ toFaDigits(c.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(c.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="c.color"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." :style="{ marginTop: '16px' }" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
|
||||
@@ -33,12 +33,12 @@ import {
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { WarningOutlined } from '@ant-design/icons-vue';
|
||||
import { WarningOutlined } from '@/icons/ant-bridge';
|
||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||
|
||||
const { Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||
|
||||
@@ -182,92 +182,94 @@ function rowProps(record: RoutineTaskDto) {
|
||||
<TableColumnsMenu table-key="routines-overdue" align="end" />
|
||||
</a-flex>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="items"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:custom-row="rowProps"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty description="همه چیز بهروز است؛ هیچ کاری از مهلتش عقب نیفتاده." />
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'کار'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>{{ record.title }}</a-typography-text>
|
||||
<a-space v-if="record.category" :size="6">
|
||||
<a-badge :color="record.category.color" />
|
||||
<a-typography-text type="secondary">{{ record.category.name }}</a-typography-text>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="7" :card="false">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="items"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
:custom-row="rowProps"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:style="{ marginTop: '16px' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty description="همه چیز بهروز است؛ هیچ کاری از مهلتش عقب نیفتاده." />
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مهلت'">
|
||||
<a-typography-text>
|
||||
{{ formatDayNumeric(record.scheduledFor) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text v-if="hasExplicitTime(record as RoutineTaskDto)" type="secondary">
|
||||
· {{ formatTime((record as RoutineTaskDto).dueAt) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'تأخیر'">
|
||||
<a-typography-text strong type="danger">
|
||||
{{ formatDelay((record as RoutineTaskDto).dueAt) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مسئول'">
|
||||
<a-space v-if="record.assignee" :size="8">
|
||||
<UserAvatar
|
||||
:name="record.assignee.fullName"
|
||||
:user-id="record.assignee.id"
|
||||
:size="24"
|
||||
/>
|
||||
<a-typography-text>{{ record.assignee.fullName }}</a-typography-text>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'اولویت'">
|
||||
<a-tag :color="priorityColor((record as RoutineTaskDto).priority)" :bordered="false">
|
||||
{{ PRIORITY_LABELS[(record as RoutineTaskDto).priority] }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'پرونده'">
|
||||
<a-flex vertical align="start" :gap="2" @click.stop>
|
||||
<RouterLink
|
||||
v-for="ent in (record as RoutineTaskDto).entities"
|
||||
:key="ent.id"
|
||||
:to="entityRoute(ent)"
|
||||
custom
|
||||
v-slot="{ href, navigate }"
|
||||
>
|
||||
<a-typography-link :href="href" @click="navigate">
|
||||
{{ ENTITY_TYPE_LABELS[ent.type] }}: {{ ent.label }}
|
||||
</a-typography-link>
|
||||
</RouterLink>
|
||||
<a-typography-text v-if="!record.entities.length" type="secondary">
|
||||
—
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'کار'">
|
||||
<a-flex vertical :gap="0">
|
||||
<a-typography-text strong>{{ record.title }}</a-typography-text>
|
||||
<a-space v-if="record.category" :size="6">
|
||||
<a-badge :color="record.category.color" />
|
||||
<a-typography-text type="secondary">{{ record.category.name }}</a-typography-text>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مهلت'">
|
||||
<a-typography-text>
|
||||
{{ formatDayNumeric(record.scheduledFor) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-typography-text v-if="hasExplicitTime(record as RoutineTaskDto)" type="secondary">
|
||||
· {{ formatTime((record as RoutineTaskDto).dueAt) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'تأخیر'">
|
||||
<a-typography-text strong type="danger">
|
||||
{{ formatDelay((record as RoutineTaskDto).dueAt) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'مسئول'">
|
||||
<a-space v-if="record.assignee" :size="8">
|
||||
<UserAvatar
|
||||
:name="record.assignee.fullName"
|
||||
:user-id="record.assignee.id"
|
||||
:size="24"
|
||||
/>
|
||||
<a-typography-text>{{ record.assignee.fullName }}</a-typography-text>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'اولویت'">
|
||||
<a-tag :color="priorityColor((record as RoutineTaskDto).priority)" :bordered="false">
|
||||
{{ PRIORITY_LABELS[(record as RoutineTaskDto).priority] }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'پرونده'">
|
||||
<a-flex vertical align="start" :gap="2" @click.stop>
|
||||
<RouterLink
|
||||
v-for="ent in (record as RoutineTaskDto).entities"
|
||||
:key="ent.id"
|
||||
:to="entityRoute(ent)"
|
||||
custom
|
||||
v-slot="{ href, navigate }"
|
||||
>
|
||||
<a-typography-link :href="href" @click="navigate">
|
||||
{{ ENTITY_TYPE_LABELS[ent.type] }}: {{ ent.label }}
|
||||
</a-typography-link>
|
||||
</RouterLink>
|
||||
<a-typography-text v-if="!record.entities.length" type="secondary">
|
||||
—
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-space :size="8" wrap @click.stop>
|
||||
<a-button
|
||||
type="primary"
|
||||
:loading="actions.busyId.value === record.id"
|
||||
@click="actions.toggle(record as RoutineTaskDto)"
|
||||
>
|
||||
انجام شد
|
||||
</a-button>
|
||||
<a-button @click="actions.moveToday(record as RoutineTaskDto)">به امروز</a-button>
|
||||
<a-button @click="actions.openReschedule(record as RoutineTaskDto)">تغییر زمان</a-button>
|
||||
<a-button danger @click="actions.openCancel(record as RoutineTaskDto)">لغو</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'عملیات'">
|
||||
<a-space :size="8" wrap @click.stop>
|
||||
<a-button
|
||||
type="primary"
|
||||
:loading="actions.busyId.value === record.id"
|
||||
@click="actions.toggle(record as RoutineTaskDto)"
|
||||
>
|
||||
انجام شد
|
||||
</a-button>
|
||||
<a-button @click="actions.moveToday(record as RoutineTaskDto)">به امروز</a-button>
|
||||
<a-button @click="actions.openReschedule(record as RoutineTaskDto)">تغییر زمان</a-button>
|
||||
<a-button danger @click="actions.openCancel(record as RoutineTaskDto)">لغو</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-table>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
|
||||
<RoutineTaskModals :actions="actions" />
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import type { RoutineUserSettingsDto } from '@mento/shared';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import { UiButton, UiCard, UiField, UiSelect } from '@/components/ui';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { BellOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { apiError } from '@/lib/routines';
|
||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
|
||||
const form = reactive({
|
||||
remind: '30',
|
||||
@@ -30,6 +46,11 @@ const remindOptions = [
|
||||
|
||||
const hours = Array.from({ length: 12 }, (_, i) => i + 12);
|
||||
|
||||
const hourOptions = hours.map((h) => ({
|
||||
value: String(h),
|
||||
label: `ساعت ${toFaDigits(h)}:۰۰`,
|
||||
}));
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const { data } = await api.get<RoutineUserSettingsDto>('/routine-tasks/settings');
|
||||
@@ -67,153 +88,97 @@ async function save() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="settings">
|
||||
<UiCard>
|
||||
<header class="head">
|
||||
<span class="ico"><UiIcon name="bell" :size="18" /></span>
|
||||
<div>
|
||||
<h3>یادآوریها و اعلانهای کارهای روتین</h3>
|
||||
<p>این تنظیمات فقط برای حساب شما اعمال میشود. اعلانها در زنگوله بالای صفحه نمایش داده میشوند.</p>
|
||||
</div>
|
||||
</header>
|
||||
<a-row>
|
||||
<a-col :xs="24" :md="20" :lg="16" :xl="14">
|
||||
<a-card :bordered="false">
|
||||
<a-flex align="flex-start" :gap="12" style="margin-bottom: 16px">
|
||||
<BellOutlined style="font-size: 18px; margin-top: 4px" />
|
||||
<div>
|
||||
<a-typography-title :level="4" :style="{ margin: 0 }">
|
||||
یادآوریها و اعلانهای کارهای روتین
|
||||
</a-typography-title>
|
||||
<a-typography-paragraph type="secondary" :style="{ margin: '4px 0 0' }">
|
||||
این تنظیمات فقط برای حساب شما اعمال میشود. اعلانها در زنگوله بالای صفحه نمایش داده
|
||||
میشوند.
|
||||
</a-typography-paragraph>
|
||||
</div>
|
||||
</a-flex>
|
||||
|
||||
<div v-if="loading" class="state">در حال بارگذاری…</div>
|
||||
<form v-else class="form" @submit.prevent="save">
|
||||
<UiField label="یادآوری قبل از مهلت" hint="برای کارهایی که ساعت مشخص دارند. روتینها ممکن است یادآوری اختصاصی داشته باشند.">
|
||||
<UiSelect v-model="form.remind">
|
||||
<option v-for="o in remindOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonCard :rows="6">
|
||||
<a-form layout="vertical" @finish="save">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :span="24">
|
||||
<a-form-item
|
||||
label="یادآوری قبل از مهلت"
|
||||
extra="برای کارهایی که ساعت مشخص دارند. روتینها ممکن است یادآوری اختصاصی داشته باشند."
|
||||
>
|
||||
<a-select v-model:value="form.remind" :options="remindOptions" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<label class="tg">
|
||||
<input v-model="form.overdueAlert" type="checkbox" />
|
||||
<span>
|
||||
<strong>هشدار کار اجباری انجامنشده</strong>
|
||||
<small>وقتی مهلت یک کار اجباری بگذرد و هنوز انجام نشده باشد.</small>
|
||||
</span>
|
||||
</label>
|
||||
<a-col :span="24">
|
||||
<a-form-item>
|
||||
<a-checkbox v-model:checked="form.overdueAlert">
|
||||
<a-flex vertical :gap="2">
|
||||
<a-typography-text strong>هشدار کار اجباری انجامنشده</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
وقتی مهلت یک کار اجباری بگذرد و هنوز انجام نشده باشد.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<label class="tg">
|
||||
<input v-model="form.endOfDaySummary" type="checkbox" />
|
||||
<span>
|
||||
<strong>خلاصه پایان روز</strong>
|
||||
<small>اگر کاری باقی مانده باشد، یک اعلان خلاصه دریافت میکنید؛ مثل «۳ کار تا پایان امروز باقی مانده است».</small>
|
||||
</span>
|
||||
</label>
|
||||
<a-col :span="24">
|
||||
<a-form-item>
|
||||
<a-checkbox v-model:checked="form.endOfDaySummary">
|
||||
<a-flex vertical :gap="2">
|
||||
<a-typography-text strong>خلاصه پایان روز</a-typography-text>
|
||||
<a-typography-text type="secondary">
|
||||
اگر کاری باقی مانده باشد، یک اعلان خلاصه دریافت میکنید؛ مثل «۳ کار تا پایان
|
||||
امروز باقی مانده است».
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-checkbox>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<UiField v-if="form.endOfDaySummary" label="ساعت ارسال خلاصه" class="nested">
|
||||
<UiSelect v-model="form.summaryHour">
|
||||
<option v-for="h in hours" :key="h" :value="String(h)">ساعت {{ toFaDigits(h) }}:۰۰</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-col v-if="form.endOfDaySummary" :xs="24" :sm="12" :md="10">
|
||||
<a-form-item label="ساعت ارسال خلاصه">
|
||||
<a-select
|
||||
v-model:value="form.summaryHour"
|
||||
:options="hourOptions"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-if="saved" class="ok">تنظیمات ذخیره شد.</p>
|
||||
<a-alert
|
||||
v-if="error"
|
||||
type="error"
|
||||
show-icon
|
||||
:message="error"
|
||||
style="margin-bottom: 16px"
|
||||
/>
|
||||
<a-alert
|
||||
v-if="saved"
|
||||
type="success"
|
||||
show-icon
|
||||
message="تنظیمات ذخیره شد."
|
||||
style="margin-bottom: 16px"
|
||||
/>
|
||||
|
||||
<div class="actions">
|
||||
<UiButton type="submit" :loading="saving">ذخیره تنظیمات</UiButton>
|
||||
</div>
|
||||
</form>
|
||||
</UiCard>
|
||||
</div>
|
||||
<a-form-item>
|
||||
<a-button type="primary" html-type="submit" :loading="saving">
|
||||
ذخیره تنظیمات
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.settings {
|
||||
max-width: 680px;
|
||||
}
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-3);
|
||||
margin-bottom: var(--sp-5);
|
||||
}
|
||||
|
||||
.ico {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 10px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--accent-subtle);
|
||||
color: var(--accent-deep);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.head h3 {
|
||||
margin: 0;
|
||||
font-size: var(--fs-md);
|
||||
font-weight: var(--fw-semibold);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.head p {
|
||||
margin: 4px 0 0;
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--muted);
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.state {
|
||||
padding: var(--sp-6);
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.form {
|
||||
display: grid;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.tg {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-2);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tg input {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: 2px;
|
||||
accent-color: var(--accent);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tg span {
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.tg strong {
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.tg small {
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--muted);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.nested {
|
||||
margin-inline-start: 26px;
|
||||
max-width: 260px;
|
||||
}
|
||||
|
||||
.ok {
|
||||
margin: 0;
|
||||
color: var(--success-deep);
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
|
||||
.error {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
SyncOutlined,
|
||||
TeamOutlined,
|
||||
WarningOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
|
||||
const { Title: ATypographyTitle } = Typography;
|
||||
|
||||
|
||||
@@ -39,12 +39,17 @@ import {
|
||||
Row as ARow,
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Spin as ASpin,
|
||||
Table as ATable,
|
||||
Tooltip as ATooltip,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CloseOutlined } from '@ant-design/icons-vue';
|
||||
import { CloseOutlined } from '@/icons/ant-bridge';
|
||||
import {
|
||||
CrmSkeleton,
|
||||
CrmSkeletonCard,
|
||||
CrmSkeletonKpi,
|
||||
CrmSkeletonTable,
|
||||
} from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
@@ -273,112 +278,122 @@ const execColumns: TableColumnsType<RoutineExecutionRowDto> = [
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<template v-if="section === 'overview'">
|
||||
<a-spin :spinning="loading">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard label="درصد انجام تیم" :value="formatPercent(d?.percent)" icon="target" tone="accent" />
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard label="درصد انجام تیم" :value="formatPercent(d?.percent)" icon="target" tone="accent" />
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard
|
||||
label="انجامشده"
|
||||
:value="toFaDigits(d?.completed ?? 0)"
|
||||
:hint="`از ${toFaDigits(d?.total ?? 0)} کار`"
|
||||
icon="check"
|
||||
tone="success"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="انجامشده"
|
||||
:value="toFaDigits(d?.completed ?? 0)"
|
||||
:hint="`از ${toFaDigits(d?.total ?? 0)} کار`"
|
||||
icon="check"
|
||||
tone="success"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard label="عقبافتاده" :value="toFaDigits(d?.overdue ?? 0)" icon="warning" tone="danger" />
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard label="عقبافتاده" :value="toFaDigits(d?.overdue ?? 0)" icon="warning" tone="danger" />
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard
|
||||
label="اعضای فعال"
|
||||
:value="toFaDigits(activeMembers)"
|
||||
:hint="`از ${toFaDigits(d?.members.length ?? 0)} نفر`"
|
||||
icon="users"
|
||||
tone="info"
|
||||
/>
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="اعضای فعال"
|
||||
:value="toFaDigits(activeMembers)"
|
||||
:hint="`از ${toFaDigits(d?.members.length ?? 0)} نفر`"
|
||||
icon="users"
|
||||
tone="info"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="[24, 24]" :style="{ marginTop: '24px' }">
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">روند درصد انجام تیم</a-typography-title>
|
||||
<a-flex align="end" :gap="2" :style="{ height: '180px', marginTop: '16px' }">
|
||||
<a-tooltip
|
||||
v-for="p in d?.trend ?? []"
|
||||
:key="p.date"
|
||||
:title="`${formatDayNumeric(p.date)} — ${formatPercent(p.percent)} (${toFaDigits(p.completed)} از ${toFaDigits(p.total)})`"
|
||||
>
|
||||
<a-flex
|
||||
:style="{
|
||||
flex: 1,
|
||||
minWidth: '3px',
|
||||
height: `${Math.max(2, Math.round(p.percent ?? 0))}%`,
|
||||
background: p.percent == null ? 'var(--ant-color-fill-secondary)' : 'var(--ant-color-primary)',
|
||||
borderRadius: '2px 2px 0 0',
|
||||
}"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-typography-text v-if="!d?.trend?.length" type="secondary">
|
||||
دادهای برای نمایش نیست.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">وضعیت کارها</a-typography-title>
|
||||
<a-flex vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="r in statusRows" :key="r.key">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ r.label }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ toFaDigits(r.value) }} ({{ toFaDigits(r.percent) }}٪)
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress :percent="r.percent" :show-info="false" :stroke-color="r.color" />
|
||||
</div>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">مقایسه اعضا</a-typography-title>
|
||||
<a-flex v-if="memberRows.length" vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="m in memberRows" :key="m.user.id">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ m.user.fullName }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ formatPercent(m.percent) }} · {{ toFaDigits(m.completed) }} از {{ toFaDigits(m.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(m.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(m.percent)]"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." :style="{ marginTop: '16px' }" />
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">انجام به تفکیک دستهبندی</a-typography-title>
|
||||
<a-flex v-if="d?.byCategory.length" vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="c in d.byCategory" :key="c.categoryId ?? c.name">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ c.name }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ formatPercent(c.percent) }} · {{ toFaDigits(c.completed) }} از {{ toFaDigits(c.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(c.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="c.color"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." :style="{ marginTop: '16px' }" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
<CrmSkeletonCard :rows="8">
|
||||
<a-row :gutter="[24, 24]" :style="{ marginTop: '24px' }">
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">روند درصد انجام تیم</a-typography-title>
|
||||
<a-flex align="end" :gap="2" :style="{ height: '180px', marginTop: '16px' }">
|
||||
<a-tooltip
|
||||
v-for="p in d?.trend ?? []"
|
||||
:key="p.date"
|
||||
:title="`${formatDayNumeric(p.date)} — ${formatPercent(p.percent)} (${toFaDigits(p.completed)} از ${toFaDigits(p.total)})`"
|
||||
>
|
||||
<a-flex
|
||||
:style="{
|
||||
flex: 1,
|
||||
minWidth: '3px',
|
||||
height: `${Math.max(2, Math.round(p.percent ?? 0))}%`,
|
||||
background: p.percent == null ? 'var(--ant-color-fill-secondary)' : 'var(--ant-color-primary)',
|
||||
borderRadius: '2px 2px 0 0',
|
||||
}"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-typography-text v-if="!d?.trend?.length" type="secondary">
|
||||
دادهای برای نمایش نیست.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">وضعیت کارها</a-typography-title>
|
||||
<a-flex vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="r in statusRows" :key="r.key">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ r.label }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ toFaDigits(r.value) }} ({{ toFaDigits(r.percent) }}٪)
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress :percent="r.percent" :show-info="false" :stroke-color="r.color" />
|
||||
</div>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">مقایسه اعضا</a-typography-title>
|
||||
<a-flex v-if="memberRows.length" vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="m in memberRows" :key="m.user.id">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ m.user.fullName }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ formatPercent(m.percent) }} · {{ toFaDigits(m.completed) }} از {{ toFaDigits(m.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(m.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(m.percent)]"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." :style="{ marginTop: '16px' }" />
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">انجام به تفکیک دستهبندی</a-typography-title>
|
||||
<a-flex v-if="d?.byCategory.length" vertical :gap="12" :style="{ marginTop: '16px' }">
|
||||
<div v-for="c in d.byCategory" :key="c.categoryId ?? c.name">
|
||||
<a-flex justify="space-between" align="center" :gap="8">
|
||||
<a-typography-text>{{ c.name }}</a-typography-text>
|
||||
<a-typography-text strong>
|
||||
{{ formatPercent(c.percent) }} · {{ toFaDigits(c.completed) }} از {{ toFaDigits(c.total) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(c.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="c.color"
|
||||
/>
|
||||
</div>
|
||||
</a-flex>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." :style="{ marginTop: '16px' }" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</CrmSkeletonCard>
|
||||
</CrmSkeleton>
|
||||
|
||||
<a-divider orientation="right">عملکرد اعضا</a-divider>
|
||||
<TeamPerformanceTable :members="d?.members ?? []" @select="(id) => (f.userId = id)" />
|
||||
@@ -406,35 +421,37 @@ const execColumns: TableColumnsType<RoutineExecutionRowDto> = [
|
||||
:style="{ width: '240px' }"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:columns="execColumns"
|
||||
:data-source="execRows"
|
||||
:pagination="false"
|
||||
:row-key="(r: RoutineExecutionRowDto) => r.routineId"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty description="در این بازه روتینی اجرا نشده است." />
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'title'">
|
||||
<a-typography-text strong>{{ record.title }}</a-typography-text>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<CrmSkeletonTable :rows="8" :columns="4" :card="false">
|
||||
<a-table
|
||||
:columns="execColumns"
|
||||
:data-source="execRows"
|
||||
:pagination="false"
|
||||
:row-key="(r: RoutineExecutionRowDto) => r.routineId"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #emptyText>
|
||||
<a-empty description="در این بازه روتینی اجرا نشده است." />
|
||||
</template>
|
||||
<template v-else-if="column.key === 'percent'">
|
||||
<a-flex align="center" :gap="8" :style="{ minWidth: '8rem' }">
|
||||
<a-typography-text strong>{{ formatPercent(record.percent) }}</a-typography-text>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(record.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(record.percent)]"
|
||||
:style="{ flex: 1 }"
|
||||
/>
|
||||
</a-flex>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'title'">
|
||||
<a-typography-text strong>{{ record.title }}</a-typography-text>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'percent'">
|
||||
<a-flex align="center" :gap="8" :style="{ minWidth: '8rem' }">
|
||||
<a-typography-text strong>{{ formatPercent(record.percent) }}</a-typography-text>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, Math.round(record.percent ?? 0)))"
|
||||
:show-info="false"
|
||||
:stroke-color="TONE_COLORS[percentTone(record.percent)]"
|
||||
:style="{ flex: 1 }"
|
||||
/>
|
||||
</a-flex>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-table>
|
||||
</CrmSkeletonTable>
|
||||
</CrmSkeleton>
|
||||
</template>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
|
||||
@@ -32,10 +32,15 @@ import {
|
||||
Row as ARow,
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Skeleton as ASkeleton,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { CalendarOutlined, WarningOutlined } from '@ant-design/icons-vue';
|
||||
import { CalendarOutlined, WarningOutlined } from '@/icons/ant-bridge';
|
||||
import {
|
||||
CrmSkeleton,
|
||||
CrmSkeletonCard,
|
||||
CrmSkeletonKpi,
|
||||
CrmSkeletonList,
|
||||
} from '@/components/skeleton';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||
|
||||
@@ -130,164 +135,180 @@ const userOptions = computed(() => [
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-card :bordered="false">
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="16">
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">کارهای امروز</a-typography-title>
|
||||
<a-typography-text strong :style="{ color: 'var(--ant-color-primary)' }">
|
||||
<CalendarOutlined />
|
||||
{{ formatDayLong(data?.date ?? todayKey()) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-flex
|
||||
align="center"
|
||||
:gap="16"
|
||||
:aria-label="`${stats.completed} از ${stats.total} کار انجام شده`"
|
||||
>
|
||||
<a-progress
|
||||
type="circle"
|
||||
:percent="Math.max(0, Math.min(100, Math.round(progressPct)))"
|
||||
:size="76"
|
||||
:format="() => formatPercent(stats.percent)"
|
||||
/>
|
||||
<a-flex vertical :gap="0" :style="{ minWidth: '10rem' }">
|
||||
<a-typography-title :level="4" :style="{ margin: 0 }">
|
||||
{{ toFaDigits(stats.completed) }} از {{ toFaDigits(stats.total) }}
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">کار امروز انجام شده</a-typography-text>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, progressPct))"
|
||||
:show-info="false"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
<a-select
|
||||
v-if="showUserPicker"
|
||||
v-model:value="userId"
|
||||
:options="userOptions"
|
||||
:style="{ width: '220px' }"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard label="انجام شده" :value="toFaDigits(stats.completed)" icon="check" tone="success" />
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard label="باقیمانده" :value="toFaDigits(stats.remaining)" icon="clock" tone="info" />
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard
|
||||
label="عقبافتاده"
|
||||
:value="toFaDigits(stats.overdue)"
|
||||
icon="warning"
|
||||
:tone="stats.overdue ? 'danger' : 'neutral'"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<KpiCard label="درصد تکمیل" :value="formatPercent(stats.percent)" icon="target" tone="accent" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="actions.error.value" type="error" show-icon :message="actions.error.value" />
|
||||
|
||||
<a-row :gutter="[24, 24]" align="top">
|
||||
<a-col :xs="24" :lg="16" :xl="17">
|
||||
<CrmSkeleton :loading="loading">
|
||||
<a-flex vertical :gap="16">
|
||||
<CrmSkeletonCard :rows="3" :min-height="120">
|
||||
<a-card :bordered="false">
|
||||
<a-segmented v-model:value="filter" :options="filterOptions" />
|
||||
|
||||
<a-skeleton v-if="loading" active :style="{ marginTop: '16px' }" />
|
||||
|
||||
<a-empty
|
||||
v-else-if="!data?.tasks.length"
|
||||
:style="{ marginTop: '24px' }"
|
||||
description="برای امروز کاری ثبت نشده؛ روتینهای فعال بهصورت خودکار هر روز کار میسازند. میتوانید یک کار دستی هم اضافه کنید."
|
||||
/>
|
||||
|
||||
<template v-else>
|
||||
<template v-if="openTasks.length">
|
||||
<a-divider orientation="right">
|
||||
باقیمانده ({{ toFaDigits(openTasks.length) }})
|
||||
</a-divider>
|
||||
<a-flex vertical :gap="8">
|
||||
<RoutineTaskRow
|
||||
v-for="t in openTasks"
|
||||
:key="t.id"
|
||||
:task="t"
|
||||
:busy="actions.busyId.value === t.id"
|
||||
show-delay
|
||||
@toggle="actions.toggle"
|
||||
@open="shell.openTask(t.id)"
|
||||
@action="onAction"
|
||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="16">
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">کارهای امروز</a-typography-title>
|
||||
<a-typography-text strong :style="{ color: 'var(--ant-color-primary)' }">
|
||||
<CalendarOutlined />
|
||||
{{ formatDayLong(data?.date ?? todayKey()) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
<a-flex
|
||||
align="center"
|
||||
:gap="16"
|
||||
:aria-label="`${stats.completed} از ${stats.total} کار انجام شده`"
|
||||
>
|
||||
<a-progress
|
||||
type="circle"
|
||||
:percent="Math.max(0, Math.min(100, Math.round(progressPct)))"
|
||||
:size="76"
|
||||
:format="() => formatPercent(stats.percent)"
|
||||
/>
|
||||
<a-flex vertical :gap="0" :style="{ minWidth: '10rem' }">
|
||||
<a-typography-title :level="4" :style="{ margin: 0 }">
|
||||
{{ toFaDigits(stats.completed) }} از {{ toFaDigits(stats.total) }}
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">کار امروز انجام شده</a-typography-text>
|
||||
<a-progress
|
||||
:percent="Math.max(0, Math.min(100, progressPct))"
|
||||
:show-info="false"
|
||||
/>
|
||||
</a-flex>
|
||||
</template>
|
||||
<a-result
|
||||
v-else-if="filter !== 'done'"
|
||||
status="success"
|
||||
title="همه کارهای امروز انجام شد."
|
||||
</a-flex>
|
||||
<a-select
|
||||
v-if="showUserPicker"
|
||||
v-model:value="userId"
|
||||
:options="userOptions"
|
||||
:style="{ width: '220px' }"
|
||||
/>
|
||||
|
||||
<template v-if="closedTasks.length">
|
||||
<a-divider orientation="right">
|
||||
انجامشده / بسته ({{ toFaDigits(closedTasks.length) }})
|
||||
</a-divider>
|
||||
<a-flex vertical :gap="8">
|
||||
<RoutineTaskRow
|
||||
v-for="t in closedTasks"
|
||||
:key="t.id"
|
||||
:task="t"
|
||||
:busy="actions.busyId.value === t.id"
|
||||
@toggle="actions.toggle"
|
||||
@open="shell.openTask(t.id)"
|
||||
@action="onAction"
|
||||
/>
|
||||
</a-flex>
|
||||
</template>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="24" :lg="8" :xl="7">
|
||||
<a-affix :offset-top="24">
|
||||
<a-flex vertical :gap="16">
|
||||
<DailyScoreCard :score="data?.score ?? null" :days="recent" />
|
||||
|
||||
<a-card v-if="data?.overdue.length" :bordered="false">
|
||||
<template #title>
|
||||
<a-typography-text strong type="danger">
|
||||
<WarningOutlined />
|
||||
عقبافتاده از روزهای قبل
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template #extra>
|
||||
<RouterLink to="/routines/overdue" custom v-slot="{ href, navigate }">
|
||||
<a-typography-link :href="href" @click="navigate">
|
||||
همه ({{ toFaDigits(data.overdue.length) }})
|
||||
</a-typography-link>
|
||||
</RouterLink>
|
||||
</template>
|
||||
<a-flex vertical :gap="8">
|
||||
<RoutineTaskRow
|
||||
v-for="t in data.overdue.slice(0, 4)"
|
||||
:key="t.id"
|
||||
:task="t"
|
||||
:busy="actions.busyId.value === t.id"
|
||||
show-date
|
||||
@toggle="actions.toggle"
|
||||
@open="shell.openTask(t.id)"
|
||||
@action="onAction"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-affix>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</CrmSkeletonCard>
|
||||
|
||||
<RoutineTaskModals :actions="actions" />
|
||||
</a-flex>
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="12" :lg="6">
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard label="انجام شده" :value="toFaDigits(stats.completed)" icon="check" tone="success" />
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard label="باقیمانده" :value="toFaDigits(stats.remaining)" icon="clock" tone="info" />
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard
|
||||
label="عقبافتاده"
|
||||
:value="toFaDigits(stats.overdue)"
|
||||
icon="warning"
|
||||
:tone="stats.overdue ? 'danger' : 'neutral'"
|
||||
/>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
<a-col :xs="12" :lg="6">
|
||||
<CrmSkeletonKpi>
|
||||
<KpiCard label="درصد تکمیل" :value="formatPercent(stats.percent)" icon="target" tone="accent" />
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="actions.error.value" type="error" show-icon :message="actions.error.value" />
|
||||
|
||||
<a-row :gutter="[24, 24]" align="top">
|
||||
<a-col :xs="24" :lg="16" :xl="17">
|
||||
<a-card :bordered="false">
|
||||
<a-segmented v-model:value="filter" :options="filterOptions" />
|
||||
|
||||
<div :style="{ marginTop: '16px' }">
|
||||
<CrmSkeletonList :rows="6">
|
||||
<a-empty
|
||||
v-if="!data?.tasks.length"
|
||||
:style="{ marginTop: '24px' }"
|
||||
description="برای امروز کاری ثبت نشده؛ روتینهای فعال بهصورت خودکار هر روز کار میسازند. میتوانید یک کار دستی هم اضافه کنید."
|
||||
/>
|
||||
|
||||
<template v-else>
|
||||
<template v-if="openTasks.length">
|
||||
<a-divider orientation="right">
|
||||
باقیمانده ({{ toFaDigits(openTasks.length) }})
|
||||
</a-divider>
|
||||
<a-flex vertical :gap="8">
|
||||
<RoutineTaskRow
|
||||
v-for="t in openTasks"
|
||||
:key="t.id"
|
||||
:task="t"
|
||||
:busy="actions.busyId.value === t.id"
|
||||
show-delay
|
||||
@toggle="actions.toggle"
|
||||
@open="shell.openTask(t.id)"
|
||||
@action="onAction"
|
||||
/>
|
||||
</a-flex>
|
||||
</template>
|
||||
<a-result
|
||||
v-else-if="filter !== 'done'"
|
||||
status="success"
|
||||
title="همه کارهای امروز انجام شد."
|
||||
/>
|
||||
|
||||
<template v-if="closedTasks.length">
|
||||
<a-divider orientation="right">
|
||||
انجامشده / بسته ({{ toFaDigits(closedTasks.length) }})
|
||||
</a-divider>
|
||||
<a-flex vertical :gap="8">
|
||||
<RoutineTaskRow
|
||||
v-for="t in closedTasks"
|
||||
:key="t.id"
|
||||
:task="t"
|
||||
:busy="actions.busyId.value === t.id"
|
||||
@toggle="actions.toggle"
|
||||
@open="shell.openTask(t.id)"
|
||||
@action="onAction"
|
||||
/>
|
||||
</a-flex>
|
||||
</template>
|
||||
</template>
|
||||
</CrmSkeletonList>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="24" :lg="8" :xl="7">
|
||||
<a-affix :offset-top="24">
|
||||
<a-flex vertical :gap="16">
|
||||
<CrmSkeletonCard :rows="4">
|
||||
<DailyScoreCard :score="data?.score ?? null" :days="recent" />
|
||||
</CrmSkeletonCard>
|
||||
|
||||
<a-card v-if="data?.overdue.length" :bordered="false">
|
||||
<template #title>
|
||||
<a-typography-text strong type="danger">
|
||||
<WarningOutlined />
|
||||
عقبافتاده از روزهای قبل
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template #extra>
|
||||
<RouterLink to="/routines/overdue" custom v-slot="{ href, navigate }">
|
||||
<a-typography-link :href="href" @click="navigate">
|
||||
همه ({{ toFaDigits(data.overdue.length) }})
|
||||
</a-typography-link>
|
||||
</RouterLink>
|
||||
</template>
|
||||
<a-flex vertical :gap="8">
|
||||
<RoutineTaskRow
|
||||
v-for="t in data.overdue.slice(0, 4)"
|
||||
:key="t.id"
|
||||
:task="t"
|
||||
:busy="actions.busyId.value === t.id"
|
||||
show-date
|
||||
@toggle="actions.toggle"
|
||||
@open="shell.openTask(t.id)"
|
||||
@action="onAction"
|
||||
/>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-affix>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<RoutineTaskModals :actions="actions" />
|
||||
</a-flex>
|
||||
</CrmSkeleton>
|
||||
</template>
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Row as ARow,
|
||||
Spin as ASpin,
|
||||
Typography,
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
@@ -22,7 +21,13 @@ import {
|
||||
FallOutlined,
|
||||
RiseOutlined,
|
||||
WalletOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import {
|
||||
CrmSkeleton,
|
||||
CrmSkeletonCard,
|
||||
CrmSkeletonKpi,
|
||||
CrmSkeletonList,
|
||||
} from '@/components/skeleton';
|
||||
import { use } from 'echarts/core';
|
||||
import { CanvasRenderer } from 'echarts/renderers';
|
||||
import { BarChart, PieChart } from 'echarts/charts';
|
||||
@@ -314,17 +319,18 @@ onMounted(async () => {
|
||||
description="وقتی سند و حساب واقعی ثبت شود، همین صفحه دادهٔ واقعی API را نشان میدهد."
|
||||
/>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
<template v-if="data">
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]">
|
||||
<a-col
|
||||
v-for="card in heroCards"
|
||||
:key="card.key"
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:lg="8"
|
||||
>
|
||||
<CrmSkeleton :loading="loading">
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]">
|
||||
<a-col
|
||||
v-for="card in heroCards"
|
||||
:key="card.key"
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:lg="8"
|
||||
>
|
||||
<CrmSkeletonKpi>
|
||||
<a-card
|
||||
v-if="data"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: `${token.padding}px` }"
|
||||
:style="softCardStyle"
|
||||
@@ -360,19 +366,22 @@ onMounted(async () => {
|
||||
</a-avatar>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-col
|
||||
v-for="card in secondaryCards"
|
||||
:key="card.key"
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:md="8"
|
||||
:lg="8"
|
||||
>
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-col
|
||||
v-for="card in secondaryCards"
|
||||
:key="card.key"
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:md="8"
|
||||
:lg="8"
|
||||
>
|
||||
<CrmSkeletonKpi>
|
||||
<a-card
|
||||
v-if="data"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="secondaryCardStyle"
|
||||
@@ -406,162 +415,189 @@ onMounted(async () => {
|
||||
</a-avatar>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</CrmSkeletonKpi>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<template v-if="data">
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-col :xs="24" :lg="14">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:style="secondaryCardStyle"
|
||||
>
|
||||
<a-typography-text strong>جریان تعهدی و نقدی</a-typography-text>
|
||||
<a-typography-text
|
||||
type="secondary"
|
||||
:style="{ display: 'block', marginBottom: `${token.marginSM}px`, fontSize: '12px' }"
|
||||
<CrmSkeletonCard :rows="6" :min-height="320">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:style="secondaryCardStyle"
|
||||
>
|
||||
مقایسه درآمد/هزینه ثبتشده با دریافت و پرداخت واقعی
|
||||
</a-typography-text>
|
||||
<VChart
|
||||
:option="flowChartOption"
|
||||
autoresize
|
||||
:style="{ height: '260px', width: '100%' }"
|
||||
/>
|
||||
</a-card>
|
||||
<a-typography-text strong>جریان تعهدی و نقدی</a-typography-text>
|
||||
<a-typography-text
|
||||
type="secondary"
|
||||
:style="{ display: 'block', marginBottom: `${token.marginSM}px`, fontSize: '12px' }"
|
||||
>
|
||||
مقایسه درآمد/هزینه ثبتشده با دریافت و پرداخت واقعی
|
||||
</a-typography-text>
|
||||
<VChart
|
||||
:option="flowChartOption"
|
||||
autoresize
|
||||
:style="{ height: '260px', width: '100%' }"
|
||||
/>
|
||||
</a-card>
|
||||
</CrmSkeletonCard>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:style="secondaryCardStyle"
|
||||
>
|
||||
<a-typography-text strong>ترکیب وضعیت مالی</a-typography-text>
|
||||
<a-typography-text
|
||||
type="secondary"
|
||||
:style="{ display: 'block', marginBottom: `${token.marginSM}px`, fontSize: '12px' }"
|
||||
<CrmSkeletonCard :rows="6" :min-height="320">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:style="secondaryCardStyle"
|
||||
>
|
||||
سهم موجودی، مطالبات و تعهدات
|
||||
</a-typography-text>
|
||||
<VChart
|
||||
:option="mixChartOption"
|
||||
autoresize
|
||||
:style="{ height: '260px', width: '100%' }"
|
||||
/>
|
||||
</a-card>
|
||||
<a-typography-text strong>ترکیب وضعیت مالی</a-typography-text>
|
||||
<a-typography-text
|
||||
type="secondary"
|
||||
:style="{ display: 'block', marginBottom: `${token.marginSM}px`, fontSize: '12px' }"
|
||||
>
|
||||
سهم موجودی، مطالبات و تعهدات
|
||||
</a-typography-text>
|
||||
<VChart
|
||||
:option="mixChartOption"
|
||||
autoresize
|
||||
:style="{ height: '260px', width: '100%' }"
|
||||
/>
|
||||
</a-card>
|
||||
</CrmSkeletonCard>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-col :xs="24" :lg="8">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="اقساط نزدیک یا معوق"
|
||||
:style="secondaryCardStyle"
|
||||
:body-style="{ paddingBlock: `${token.paddingSM}px` }"
|
||||
>
|
||||
<a-empty
|
||||
v-if="!data.upcomingInstallments.length"
|
||||
description="قسط بازی نیست."
|
||||
:image-style="{ height: '48px' }"
|
||||
/>
|
||||
<a-flex v-else vertical :gap="token.marginXS">
|
||||
<a-flex
|
||||
v-for="item in data.upcomingInstallments"
|
||||
:key="item.id"
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
:gap="8"
|
||||
>
|
||||
<div :style="{ minWidth: 0 }">
|
||||
<a-typography-text>قسط {{ item.position }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
{{ item.status === 'overdue' ? 'معوق' : item.status === 'partial' ? 'جزئی' : 'باز' }}
|
||||
· مانده {{ toman(item.remaining) }}
|
||||
</a-typography-text>
|
||||
<CrmSkeletonList :rows="4" :avatar="false">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="اقساط نزدیک یا معوق"
|
||||
:style="secondaryCardStyle"
|
||||
:body-style="{ paddingBlock: `${token.paddingSM}px` }"
|
||||
>
|
||||
<a-empty
|
||||
v-if="!data.upcomingInstallments.length"
|
||||
description="قسط بازی نیست."
|
||||
:image-style="{ height: '48px' }"
|
||||
/>
|
||||
<a-flex v-else vertical :gap="token.marginXS">
|
||||
<a-flex
|
||||
v-for="item in data.upcomingInstallments"
|
||||
:key="item.id"
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
:gap="8"
|
||||
>
|
||||
<div :style="{ minWidth: 0 }">
|
||||
<a-typography-text>قسط {{ item.position }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
{{ item.status === 'overdue' ? 'معوق' : item.status === 'partial' ? 'جزئی' : 'باز' }}
|
||||
· مانده {{ toman(item.remaining) }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, whiteSpace: 'nowrap' }">
|
||||
{{ toman(item.amount) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, whiteSpace: 'nowrap' }">
|
||||
{{ toman(item.amount) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-card>
|
||||
</CrmSkeletonList>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="24" :lg="8">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="پرداختهای آینده"
|
||||
:style="secondaryCardStyle"
|
||||
:body-style="{ paddingBlock: `${token.paddingSM}px` }"
|
||||
>
|
||||
<a-empty
|
||||
v-if="!data.upcomingPayables.length"
|
||||
description="تعهد پرداخت بازی نیست."
|
||||
:image-style="{ height: '48px' }"
|
||||
/>
|
||||
<a-flex v-else vertical :gap="token.marginXS">
|
||||
<a-flex
|
||||
v-for="item in data.upcomingPayables"
|
||||
:key="item.id"
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
:gap="8"
|
||||
>
|
||||
<div :style="{ minWidth: 0 }">
|
||||
<a-typography-text>{{ item.title }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
مانده {{ toman(item.remaining) }}
|
||||
</a-typography-text>
|
||||
<CrmSkeletonList :rows="4" :avatar="false">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="پرداختهای آینده"
|
||||
:style="secondaryCardStyle"
|
||||
:body-style="{ paddingBlock: `${token.paddingSM}px` }"
|
||||
>
|
||||
<a-empty
|
||||
v-if="!data.upcomingPayables.length"
|
||||
description="تعهد پرداخت بازی نیست."
|
||||
:image-style="{ height: '48px' }"
|
||||
/>
|
||||
<a-flex v-else vertical :gap="token.marginXS">
|
||||
<a-flex
|
||||
v-for="item in data.upcomingPayables"
|
||||
:key="item.id"
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
:gap="8"
|
||||
>
|
||||
<div :style="{ minWidth: 0 }">
|
||||
<a-typography-text>{{ item.title }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
مانده {{ toman(item.remaining) }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, whiteSpace: 'nowrap' }">
|
||||
{{ toman(item.amount) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, whiteSpace: 'nowrap' }">
|
||||
{{ toman(item.amount) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-card>
|
||||
</CrmSkeletonList>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="24" :lg="8">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="آخرین اسناد"
|
||||
:style="secondaryCardStyle"
|
||||
:body-style="{ paddingBlock: `${token.paddingSM}px` }"
|
||||
>
|
||||
<a-empty
|
||||
v-if="!data.recent.length"
|
||||
description="هنوز سندی ثبت نشده است."
|
||||
:image-style="{ height: '48px' }"
|
||||
/>
|
||||
<a-flex v-else vertical :gap="token.marginXS">
|
||||
<a-flex
|
||||
v-for="item in data.recent"
|
||||
:key="item.id"
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
:gap="8"
|
||||
>
|
||||
<div :style="{ minWidth: 0 }">
|
||||
<a-typography-text>{{ item.title }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
{{ item.kind === 'income' ? 'درآمد' : 'هزینه' }} · {{ item.status }}
|
||||
</a-typography-text>
|
||||
<CrmSkeletonList :rows="4" :avatar="false">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="آخرین اسناد"
|
||||
:style="secondaryCardStyle"
|
||||
:body-style="{ paddingBlock: `${token.paddingSM}px` }"
|
||||
>
|
||||
<a-empty
|
||||
v-if="!data.recent.length"
|
||||
description="هنوز سندی ثبت نشده است."
|
||||
:image-style="{ height: '48px' }"
|
||||
/>
|
||||
<a-flex v-else vertical :gap="token.marginXS">
|
||||
<a-flex
|
||||
v-for="item in data.recent"
|
||||
:key="item.id"
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
:gap="8"
|
||||
>
|
||||
<div :style="{ minWidth: 0 }">
|
||||
<a-typography-text>{{ item.title }}</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
{{ item.kind === 'income' ? 'درآمد' : 'هزینه' }} · {{ item.status }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, whiteSpace: 'nowrap' }">
|
||||
{{ toman(item.amount) }}
|
||||
</a-typography-text>
|
||||
<a-typography-text strong :style="{ color: token.colorPrimary, whiteSpace: 'nowrap' }">
|
||||
{{ toman(item.amount) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-card>
|
||||
</CrmSkeletonList>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
</a-spin>
|
||||
<template v-else-if="loading">
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-col :xs="24" :lg="14">
|
||||
<CrmSkeletonCard :rows="6" :min-height="320" />
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="10">
|
||||
<CrmSkeletonCard :rows="6" :min-height="320" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[token.marginSM, token.marginSM]" :style="{ marginTop: `${token.margin}px` }">
|
||||
<a-col v-for="i in 3" :key="i" :xs="24" :lg="8">
|
||||
<CrmSkeletonList :rows="4" :avatar="false" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
</CrmSkeleton>
|
||||
</a-flex>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
PlusOutlined,
|
||||
TagOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatLocalDateInput } from '@/lib/jalali';
|
||||
import type {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { DownloadOutlined } from '@ant-design/icons-vue';
|
||||
import { DownloadOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { toman } from './treasury-format';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user