feat(web): add Ant workspace tabs and harden page chrome
Persist workspace tabs in the app shell with Ant Design styling aligned to the desktop top bar, and fix tab bar layout flicker on select. Add shared PageHeader components, query helpers, and missing header state across CRM views; improve mobile shell layout and Vite HMR stability on Windows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+13
-6
@@ -10,7 +10,10 @@
|
|||||||
.app-frame {
|
.app-frame {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 244px minmax(0, 1fr);
|
grid-template-columns: 244px minmax(0, 1fr);
|
||||||
min-height: 100vh;
|
grid-template-rows: minmax(0, 1fr);
|
||||||
|
height: 100dvh;
|
||||||
|
max-height: 100dvh;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.app-frame.collapsed {
|
.app-frame.collapsed {
|
||||||
grid-template-columns: 80px minmax(0, 1fr);
|
grid-template-columns: 80px minmax(0, 1fr);
|
||||||
@@ -18,14 +21,18 @@
|
|||||||
.app-frame > .sidebar {
|
.app-frame > .sidebar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-self: start;
|
align-self: stretch;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: calc(100vh - 28px);
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
min-height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.app-frame.collapsed > .sidebar {
|
@media (min-width: 901px) {
|
||||||
width: 64px;
|
.app-frame.collapsed > .sidebar {
|
||||||
overflow: visible;
|
width: 64px;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.app-frame .mobile-only {
|
.app-frame .mobile-only {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons-vue": "^7.0.1",
|
"@ant-design/icons-vue": "^7.0.1",
|
||||||
"@mento/shared": "*",
|
"@mento/shared": "*",
|
||||||
|
"@tanstack/vue-query": "^5.108.4",
|
||||||
"ant-design-vue": "^4.2.6",
|
"ant-design-vue": "^4.2.6",
|
||||||
"axios": "^1.8.4",
|
"axios": "^1.8.4",
|
||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 197.7 151.02">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #10897d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #16c1a8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
fill: #43f7dd;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<g id="Layer_1-2" data-name="Layer 1">
|
||||||
|
<path class="cls-1" d="M43.57,77.15v64.37c0,4.79-3.88,8.67-8.67,8.67H8.67c-4.79,0-8.67-3.88-8.67-8.67V51.62c0-2.96,1.51-5.71,3.99-7.3l41.67-26.69c3.67-2.35,8.52-1.61,11.32,1.73l35.74,42.59c.57.68,1.6.72,2.22.09l26.07-26.6c3.38-3.45,8.92-3.47,12.33-.06l19.42,19.42c3.39,3.39,3.39,8.88,0,12.26l-55.06,55.06c-3.58,3.58-9.45,3.35-12.73-.5l-38.76-45.42c-.9-1.06-2.64-.42-2.64.97Z"/>
|
||||||
|
<circle class="cls-3" cx="167.06" cy="21.02" r="21.02"/>
|
||||||
|
<rect class="cls-3" x="172.68" y="52.7" width="25.02" height="98.32" rx="12.51" ry="12.51"/>
|
||||||
|
<rect class="cls-2" x="142.38" y="83.17" width="25.02" height="67.85" rx="12.51" ry="12.51"/>
|
||||||
|
<rect class="cls-1" x="111.4" y="114.24" width="25.02" height="36.78" rx="12.51" ry="12.51"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { RouterView } from 'vue-router';
|
import { RouterView } from 'vue-router';
|
||||||
import {
|
import {
|
||||||
|
App as AApp,
|
||||||
ConfigProvider as AConfigProvider,
|
ConfigProvider as AConfigProvider,
|
||||||
StyleProvider as AStyleProvider,
|
StyleProvider as AStyleProvider,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
@@ -11,7 +12,9 @@ import { antdTheme } from '@/theme/antdTheme';
|
|||||||
<template>
|
<template>
|
||||||
<a-style-provider hash-priority="high">
|
<a-style-provider hash-priority="high">
|
||||||
<a-config-provider direction="rtl" :locale="faIR" :theme="antdTheme">
|
<a-config-provider direction="rtl" :locale="faIR" :theme="antdTheme">
|
||||||
<RouterView />
|
<a-app>
|
||||||
|
<RouterView />
|
||||||
|
</a-app>
|
||||||
</a-config-provider>
|
</a-config-provider>
|
||||||
</a-style-provider>
|
</a-style-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import type { CustomerGroupColor, CustomerGroupDto, OrgUserDto } from '@mento/shared';
|
import type { CustomerGroupColor, CustomerGroupDto } from '@mento/shared';
|
||||||
import { CUSTOMER_GROUP_COLORS } from '@mento/shared';
|
import { CUSTOMER_GROUP_COLORS } from '@mento/shared';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { toFaDigits } from '@/lib/jalali';
|
import { toFaDigits } from '@/lib/jalali';
|
||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
groupSwatch,
|
groupSwatch,
|
||||||
useCustomerGroups,
|
useCustomerGroups,
|
||||||
} from '@/lib/customer-groups';
|
} from '@/lib/customer-groups';
|
||||||
|
import { useOrgUsersQuery } from '@/queries/useOrgUsersQuery';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { UiButton, UiInput, UiModal } from '@/components/ui';
|
import { UiButton, UiInput, UiModal } from '@/components/ui';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
@@ -25,7 +26,8 @@ const canManage = computed(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { groups, load } = useCustomerGroups();
|
const { groups, load } = useCustomerGroups();
|
||||||
const users = ref<OrgUserDto[]>([]);
|
const usersQuery = useOrgUsersQuery({ enabled: computed(() => props.open) });
|
||||||
|
const users = usersQuery.users;
|
||||||
const newName = ref('');
|
const newName = ref('');
|
||||||
const newColor = ref<CustomerGroupColor>('teal');
|
const newColor = ref<CustomerGroupColor>('teal');
|
||||||
const newAssigneeIds = ref<string[]>([]);
|
const newAssigneeIds = ref<string[]>([]);
|
||||||
@@ -58,15 +60,6 @@ function errorText(e: unknown, fallback: string) {
|
|||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadUsers() {
|
|
||||||
try {
|
|
||||||
const { data } = await api.get<OrgUserDto[]>('/users');
|
|
||||||
users.value = data.filter((u) => u.isActive !== false);
|
|
||||||
} catch {
|
|
||||||
users.value = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncAssigneeDraft() {
|
function syncAssigneeDraft() {
|
||||||
const next: Record<string, string[]> = {};
|
const next: Record<string, string[]> = {};
|
||||||
for (const g of groups.value) {
|
for (const g of groups.value) {
|
||||||
@@ -165,7 +158,7 @@ watch(
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
editingId.value = null;
|
editingId.value = null;
|
||||||
listQuery.value = '';
|
listQuery.value = '';
|
||||||
void Promise.all([load(true), loadUsers()])
|
void Promise.all([load(true), usersQuery.refetch()])
|
||||||
.then(() => syncAssigneeDraft())
|
.then(() => syncAssigneeDraft())
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
error.value = 'بارگذاری گروهها ناموفق بود.';
|
error.value = 'بارگذاری گروهها ناموفق بود.';
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ const currentInitial = computed(() => {
|
|||||||
|
|
||||||
const canSwitch = computed(() => orgs.value.length > 1);
|
const canSwitch = computed(() => orgs.value.length > 1);
|
||||||
const isWorkspace = computed(() => props.variant === 'workspace');
|
const isWorkspace = computed(() => props.variant === 'workspace');
|
||||||
/** در حالت workspace منو همیشه باز میشود؛ در حالت پیشفرض فقط وقتی بیش از یکی باشد */
|
/** فقط وقتی بیش از یک محیط باشد نمایش و تعویض فعال است */
|
||||||
const menuEnabled = computed(() => isWorkspace.value || canSwitch.value);
|
const menuEnabled = computed(() => canSwitch.value);
|
||||||
|
|
||||||
function apiError(e: unknown, fallback: string) {
|
function apiError(e: unknown, fallback: string) {
|
||||||
if (axios.isAxiosError(e)) {
|
if (axios.isAxiosError(e)) {
|
||||||
@@ -163,20 +163,23 @@ onUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="rootEl" class="org-switch" :class="{ 'org-ws': isWorkspace, compact }">
|
<div
|
||||||
|
v-if="canSwitch"
|
||||||
|
ref="rootEl"
|
||||||
|
class="org-switch"
|
||||||
|
:class="{ 'org-ws': isWorkspace, compact }"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
class="org-btn"
|
class="org-btn"
|
||||||
:class="{
|
:class="{
|
||||||
compact,
|
compact,
|
||||||
static: !menuEnabled,
|
|
||||||
'org-ws': isWorkspace,
|
'org-ws': isWorkspace,
|
||||||
open,
|
open,
|
||||||
}"
|
}"
|
||||||
type="button"
|
type="button"
|
||||||
:title="currentName"
|
:title="currentName"
|
||||||
:aria-expanded="open"
|
:aria-expanded="open"
|
||||||
:aria-haspopup="menuEnabled ? 'listbox' : undefined"
|
aria-haspopup="listbox"
|
||||||
:aria-disabled="!menuEnabled"
|
|
||||||
@click.stop="toggle"
|
@click.stop="toggle"
|
||||||
>
|
>
|
||||||
<template v-if="isWorkspace">
|
<template v-if="isWorkspace">
|
||||||
@@ -306,20 +309,24 @@ onUnmounted(() => {
|
|||||||
.org-btn.org-ws {
|
.org-btn.org-ws {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.7rem;
|
gap: 0.7rem;
|
||||||
padding: 0.45rem 0.55rem;
|
padding: 0.5rem 0.65rem;
|
||||||
border-radius: 16px;
|
border-radius: 12px;
|
||||||
|
border: 1px solid transparent;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.org-btn.org-ws:hover,
|
.org-btn.org-ws:hover,
|
||||||
.org-btn.org-ws.open {
|
.org-btn.org-ws.open {
|
||||||
background: #f8fafc;
|
background: #f3f4f6;
|
||||||
|
border-color: #eef2f7;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.org-btn.org-ws.static:hover {
|
.org-btn.org-ws.static:hover {
|
||||||
background: #f8fafc;
|
background: #f3f4f6;
|
||||||
|
border-color: #eef2f7;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
countSmsParts,
|
countSmsParts,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import { formatJalaliDay, formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
import { formatJalaliDay, formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||||
import { formatTahesabBedBes } from '@/lib/tahesab';
|
import { formatTahesabBedBes } from '@/lib/tahesab';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
@@ -51,11 +52,11 @@ const emit = defineEmits<{
|
|||||||
type Panel = 'none' | 'fields' | 'templates';
|
type Panel = 'none' | 'fields' | 'templates';
|
||||||
|
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
|
const feedback = useFeedback();
|
||||||
const text = ref('');
|
const text = ref('');
|
||||||
const busy = ref(false);
|
const busy = ref(false);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const done = ref('');
|
const sent = ref(false);
|
||||||
const notice = ref('');
|
|
||||||
const panel = ref<Panel>('none');
|
const panel = ref<Panel>('none');
|
||||||
const savingTemplate = ref(false);
|
const savingTemplate = ref(false);
|
||||||
const templateName = ref('');
|
const templateName = ref('');
|
||||||
@@ -122,8 +123,7 @@ watch(
|
|||||||
if (!open) return;
|
if (!open) return;
|
||||||
text.value = props.defaultText;
|
text.value = props.defaultText;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
done.value = '';
|
sent.value = false;
|
||||||
notice.value = '';
|
|
||||||
panel.value = 'none';
|
panel.value = 'none';
|
||||||
templateName.value = '';
|
templateName.value = '';
|
||||||
templateBody.value = '';
|
templateBody.value = '';
|
||||||
@@ -183,7 +183,7 @@ async function loadTemplates() {
|
|||||||
templates.value = Array.isArray(data) ? data : [];
|
templates.value = Array.isArray(data) ? data : [];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
templates.value = [];
|
templates.value = [];
|
||||||
error.value = apiMessage(e, 'بارگذاری پیامکهای آماده ناموفق بود.');
|
feedback.fromError(e, 'بارگذاری پیامکهای آماده ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
templatesLoading.value = false;
|
templatesLoading.value = false;
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,6 @@ function insertInto(
|
|||||||
|
|
||||||
function openPanel(next: Panel) {
|
function openPanel(next: Panel) {
|
||||||
panel.value = panel.value === next ? 'none' : next;
|
panel.value = panel.value === next ? 'none' : next;
|
||||||
notice.value = '';
|
|
||||||
if (panel.value === 'templates') {
|
if (panel.value === 'templates') {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
void loadTemplates();
|
void loadTemplates();
|
||||||
@@ -294,7 +293,7 @@ function openPanel(next: Panel) {
|
|||||||
function applyTemplate(item: SmsTemplateDto) {
|
function applyTemplate(item: SmsTemplateDto) {
|
||||||
text.value = item.body;
|
text.value = item.body;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
notice.value = `قالب «${item.name}» در متن پیام قرار گرفت.`;
|
feedback.info(`قالب «${item.name}» در متن پیام قرار گرفت.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveTemplate() {
|
async function saveTemplate() {
|
||||||
@@ -303,15 +302,14 @@ async function saveTemplate() {
|
|||||||
if (!canSaveTemplate.value || !name || body.length < 2) return;
|
if (!canSaveTemplate.value || !name || body.length < 2) return;
|
||||||
savingTemplate.value = true;
|
savingTemplate.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
notice.value = '';
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post<SmsTemplateDto[]>('/sms-templates', { name, body });
|
const { data } = await api.post<SmsTemplateDto[]>('/sms-templates', { name, body });
|
||||||
templates.value = Array.isArray(data) ? data : [];
|
templates.value = Array.isArray(data) ? data : [];
|
||||||
templateName.value = '';
|
templateName.value = '';
|
||||||
templateBody.value = '';
|
templateBody.value = '';
|
||||||
notice.value = `پیامک آماده «${name}» ذخیره شد.`;
|
feedback.success(`پیامک آماده «${name}» ذخیره شد.`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiMessage(e, 'ذخیره پیامک آماده ناموفق بود.');
|
feedback.fromError(e, 'ذخیره پیامک آماده ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
savingTemplate.value = false;
|
savingTemplate.value = false;
|
||||||
}
|
}
|
||||||
@@ -320,45 +318,38 @@ async function saveTemplate() {
|
|||||||
async function removeTemplate(item: SmsTemplateDto) {
|
async function removeTemplate(item: SmsTemplateDto) {
|
||||||
if (!confirm(`پیامک آماده «${item.name}» حذف شود؟`)) return;
|
if (!confirm(`پیامک آماده «${item.name}» حذف شود؟`)) return;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
notice.value = '';
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.delete<SmsTemplateDto[]>(`/sms-templates/${item.id}`);
|
const { data } = await api.delete<SmsTemplateDto[]>(`/sms-templates/${item.id}`);
|
||||||
templates.value = Array.isArray(data) ? data : [];
|
templates.value = Array.isArray(data) ? data : [];
|
||||||
notice.value = `«${item.name}» حذف شد.`;
|
feedback.success(`«${item.name}» حذف شد.`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiMessage(e, 'حذف پیامک آماده ناموفق بود.');
|
feedback.fromError(e, 'حذف پیامک آماده ناموفق بود.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiMessage(e: unknown, fallback: string) {
|
|
||||||
if (!axios.isAxiosError(e)) return fallback;
|
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
if (Array.isArray(msg)) return msg.join('، ') || fallback;
|
|
||||||
if (typeof msg === 'string' && msg.trim()) return msg;
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function send(force = false) {
|
async function send(force = false) {
|
||||||
if (!props.endpoint || busy.value || done.value) return;
|
if (!props.endpoint || busy.value || sent.value) return;
|
||||||
busy.value = true;
|
busy.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
notice.value = '';
|
|
||||||
try {
|
try {
|
||||||
await api.post(props.endpoint, { text: text.value, ...(force ? { force: true } : {}) });
|
await api.post(props.endpoint, { text: text.value, ...(force ? { force: true } : {}) });
|
||||||
done.value = 'پیامک ارسال شد.';
|
sent.value = true;
|
||||||
|
feedback.success('پیامک ارسال شد.');
|
||||||
emit('sent');
|
emit('sent');
|
||||||
void loadHistory();
|
void loadHistory();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e) && e.response?.status === 409) {
|
if (axios.isAxiosError(e) && e.response?.status === 409) {
|
||||||
const msg = apiMessage(e, 'قبلاً پیامک تبریک فرستاده شده است. دوباره بفرستیم؟');
|
const msg =
|
||||||
|
(e.response?.data as { message?: string } | undefined)?.message?.trim() ||
|
||||||
|
'قبلاً پیامک تبریک فرستاده شده است. دوباره بفرستیم؟';
|
||||||
if (confirm(msg)) {
|
if (confirm(msg)) {
|
||||||
busy.value = false;
|
busy.value = false;
|
||||||
await send(true);
|
await send(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error.value = msg;
|
feedback.warning(msg);
|
||||||
} else {
|
} else {
|
||||||
error.value = apiMessage(e, 'ارسال پیامک ناموفق بود.');
|
feedback.fromError(e, 'ارسال پیامک ناموفق بود.');
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
busy.value = false;
|
busy.value = false;
|
||||||
@@ -541,15 +532,13 @@ function statusLabel(status: OutboundSmsLogDto['status']) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-if="error" class="err">{{ error }}</p>
|
<p v-if="error" class="err">{{ error }}</p>
|
||||||
<p v-else-if="notice" class="ok">{{ notice }}</p>
|
|
||||||
<p v-if="done" class="ok">{{ done }}</p>
|
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<UiButton variant="ghost" :disabled="busy" @click="emit('close')">بستن</UiButton>
|
<UiButton variant="ghost" :disabled="busy" @click="emit('close')">بستن</UiButton>
|
||||||
<UiButton
|
<UiButton
|
||||||
variant="primary"
|
variant="primary"
|
||||||
:loading="busy"
|
:loading="busy"
|
||||||
:disabled="busy || !!done || !phone || text.trim().length < 2"
|
:disabled="busy || sent || !phone || text.trim().length < 2"
|
||||||
@click="send"
|
@click="send"
|
||||||
>
|
>
|
||||||
ارسال پیامک
|
ارسال پیامک
|
||||||
|
|||||||
@@ -141,8 +141,9 @@ const statusMessage = computed(() => {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
border: 1px solid rgb(16 137 125 / 0.28);
|
border: 1px solid color-mix(in srgb, var(--accent, #10897d) 22%, #e2e8f0);
|
||||||
box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
|
background: #fff;
|
||||||
|
box-shadow: 0 1px 2px rgb(15 23 42 / 0.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__gradient,
|
.home-hero__gradient,
|
||||||
@@ -159,55 +160,49 @@ const statusMessage = computed(() => {
|
|||||||
|
|
||||||
.home-hero__gradient {
|
.home-hero__gradient {
|
||||||
background:
|
background:
|
||||||
linear-gradient(
|
radial-gradient(
|
||||||
115deg,
|
120% 140% at 100% 0%,
|
||||||
#eef8f7 0%,
|
color-mix(in srgb, var(--accent, #10897d) 16%, white) 0%,
|
||||||
#d0ebe8 28%,
|
transparent 55%
|
||||||
#c5e6e2 55%,
|
),
|
||||||
#eef8f7 78%,
|
radial-gradient(
|
||||||
#ffffff 100%
|
90% 120% at 0% 100%,
|
||||||
);
|
color-mix(in srgb, var(--accent, #10897d) 10%, white) 0%,
|
||||||
|
transparent 50%
|
||||||
|
),
|
||||||
|
linear-gradient(180deg, var(--accent-subtle, #eef8f7) 0%, #ffffff 72%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__pattern {
|
.home-hero__pattern {
|
||||||
opacity: 0.45;
|
opacity: 0.32;
|
||||||
background-image:
|
background-image: radial-gradient(
|
||||||
radial-gradient(circle at 1px 1px, rgba(16, 137, 125, 0.28) 1px, transparent 0),
|
circle at 1px 1px,
|
||||||
linear-gradient(
|
color-mix(in srgb, var(--accent, #10897d) 26%, transparent) 1px,
|
||||||
135deg,
|
transparent 0
|
||||||
rgba(16, 137, 125, 0.08) 25%,
|
);
|
||||||
transparent 25%,
|
background-size: 16px 16px;
|
||||||
transparent 50%,
|
mask-image: linear-gradient(to left, rgb(0 0 0 / 0.5), rgb(0 0 0 / 0.06));
|
||||||
rgba(16, 137, 125, 0.08) 50%,
|
|
||||||
rgba(16, 137, 125, 0.08) 75%,
|
|
||||||
transparent 75%,
|
|
||||||
transparent
|
|
||||||
);
|
|
||||||
background-size:
|
|
||||||
18px 18px,
|
|
||||||
28px 28px;
|
|
||||||
mask-image: linear-gradient(to left, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.25));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__orb {
|
.home-hero__orb {
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
filter: blur(48px);
|
filter: blur(56px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__orb--start {
|
.home-hero__orb--start {
|
||||||
inset-inline-end: -5rem;
|
inset-inline-end: -4.5rem;
|
||||||
top: -6rem;
|
top: -5.5rem;
|
||||||
width: 13rem;
|
width: 12rem;
|
||||||
height: 13rem;
|
height: 12rem;
|
||||||
background: rgb(22 193 168 / 0.22);
|
background: color-mix(in srgb, var(--accent, #10897d) 22%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__orb--end {
|
.home-hero__orb--end {
|
||||||
inset-inline-start: -4rem;
|
inset-inline-start: -3.5rem;
|
||||||
bottom: -5rem;
|
bottom: -4.5rem;
|
||||||
width: 12rem;
|
width: 11rem;
|
||||||
height: 12rem;
|
height: 11rem;
|
||||||
background: rgb(16 137 125 / 0.16);
|
background: color-mix(in srgb, var(--accent-deep, #0a5c54) 14%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__row {
|
.home-hero__row {
|
||||||
@@ -253,8 +248,13 @@ const statusMessage = computed(() => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color: #eef8f7;
|
color: #fff;
|
||||||
background: linear-gradient(160deg, #16c1a8 0%, #10897d 100%);
|
background: linear-gradient(
|
||||||
|
160deg,
|
||||||
|
color-mix(in srgb, var(--accent, #10897d) 82%, white) 0%,
|
||||||
|
var(--accent, #10897d) 48%,
|
||||||
|
var(--accent-deep, #0a5c54) 100%
|
||||||
|
);
|
||||||
letter-spacing: -0.02em;
|
letter-spacing: -0.02em;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ const statusMessage = computed(() => {
|
|||||||
width: 0.7rem;
|
width: 0.7rem;
|
||||||
height: 0.7rem;
|
height: 0.7rem;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #10897d;
|
background: var(--accent, #10897d);
|
||||||
border: 2px solid #fff;
|
border: 2px solid #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ const statusMessage = computed(() => {
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 0.02em;
|
letter-spacing: 0.02em;
|
||||||
color: rgb(4 120 87 / 0.8);
|
color: var(--accent-deep, #0a5c54);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__title {
|
.home-hero__title {
|
||||||
@@ -316,7 +316,7 @@ const statusMessage = computed(() => {
|
|||||||
border: 1px solid rgb(255 255 255 / 0.8);
|
border: 1px solid rgb(255 255 255 / 0.8);
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 4px 12px rgb(6 78 59 / 0.05),
|
0 4px 12px color-mix(in srgb, var(--accent, #10897d) 8%, transparent),
|
||||||
0 1px 2px rgb(15 23 42 / 0.04);
|
0 1px 2px rgb(15 23 42 / 0.04);
|
||||||
transition:
|
transition:
|
||||||
border-color 0.15s ease,
|
border-color 0.15s ease,
|
||||||
@@ -324,10 +324,10 @@ const statusMessage = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__ask:focus-within {
|
.home-hero__ask:focus-within {
|
||||||
border-color: #16c1a8;
|
border-color: color-mix(in srgb, var(--accent, #10897d) 55%, #e2e8f0);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 0 0 2px rgb(16 137 125 / 0.18),
|
0 0 0 2px color-mix(in srgb, var(--accent, #10897d) 16%, transparent),
|
||||||
0 4px 12px rgb(10 92 84 / 0.06);
|
0 4px 12px color-mix(in srgb, var(--accent-deep, #0a5c54) 8%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero__ask-input {
|
.home-hero__ask-input {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
import {
|
import {
|
||||||
CalendarOutlined,
|
CalendarOutlined,
|
||||||
CheckCircleOutlined,
|
CheckCircleOutlined,
|
||||||
@@ -18,6 +19,17 @@ const props = defineProps<{
|
|||||||
formatChange: (value: number | null) => string;
|
formatChange: (value: number | null) => string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
/** ستونها با تعداد کارت همخوان باشد تا ردیف تمامعرض پر شود */
|
||||||
|
const gridClass = computed(() => {
|
||||||
|
const n = props.kpis.length;
|
||||||
|
if (n <= 1) return 'grid grid-cols-1 gap-4';
|
||||||
|
if (n === 2) return 'grid grid-cols-1 sm:grid-cols-2 gap-4';
|
||||||
|
if (n === 3) return 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4';
|
||||||
|
if (n === 4) return 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4';
|
||||||
|
if (n === 5) return 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4';
|
||||||
|
return 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4';
|
||||||
|
});
|
||||||
|
|
||||||
function salesAmount(value: number) {
|
function salesAmount(value: number) {
|
||||||
return new Intl.NumberFormat('fa-IR').format(value);
|
return new Intl.NumberFormat('fa-IR').format(value);
|
||||||
}
|
}
|
||||||
@@ -43,11 +55,11 @@ function pillClass(kpi: HomeDashboardKpiDto) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4">
|
<section :class="gridClass">
|
||||||
<div
|
<div
|
||||||
v-for="kpi in kpis"
|
v-for="kpi in kpis"
|
||||||
:key="kpi.key"
|
:key="kpi.key"
|
||||||
class="rounded-2xl p-4 border shadow-sm flex flex-col justify-between transition duration-200 hover:-translate-y-0.5"
|
class="min-w-0 w-full rounded-2xl p-4 border shadow-sm flex flex-col justify-between transition duration-200 hover:-translate-y-0.5"
|
||||||
:class="
|
:class="
|
||||||
kpi.key === 'overdue'
|
kpi.key === 'overdue'
|
||||||
? 'border-rose-200/70 bg-gradient-to-b from-white to-rose-50/20'
|
? 'border-rose-200/70 bg-gradient-to-b from-white to-rose-50/20'
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<script setup lang="ts" generic="T extends string">
|
||||||
|
/**
|
||||||
|
* فیلتر چیپی برای نوار ابزار PageHeader (اسلات quick-filters).
|
||||||
|
*
|
||||||
|
* برای فیلترهایی با گزینههای کم و ثابت (حدود ۲ تا ۶ مورد، مثل تیپ DISC):
|
||||||
|
* همه گزینهها همیشه دیده میشوند، با یک کلیک روشن/خاموش میشوند و
|
||||||
|
* کشوی «فیلتر» لازم ندارند. «همه» یعنی آرایهٔ خالی.
|
||||||
|
* گزینههای زیاد یا پویا (منبع، مسئول…) همچنان a-select هستند.
|
||||||
|
*/
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { Flex as AFlex, Tag as ATag, Typography, theme } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
label?: string;
|
||||||
|
options: Array<{ value: T; label: string }>;
|
||||||
|
/** false = فقط یک گزینه در هر لحظه */
|
||||||
|
multiple?: boolean;
|
||||||
|
allLabel?: string;
|
||||||
|
/**
|
||||||
|
* false = بدون چیپ «همه»؛ با multiple=false همیشه دقیقاً یک گزینه روشن است
|
||||||
|
* (مثل مرتبسازی: نام / جدیدترین).
|
||||||
|
*/
|
||||||
|
showAll?: boolean;
|
||||||
|
}>(),
|
||||||
|
{ label: undefined, multiple: true, allLabel: 'همه', showAll: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
const model = defineModel<T[]>({ default: () => [] });
|
||||||
|
|
||||||
|
const ACheckableTag = ATag.CheckableTag;
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
|
const { token } = theme.useToken();
|
||||||
|
|
||||||
|
function chipStyle(checked: boolean) {
|
||||||
|
const t = token.value;
|
||||||
|
return {
|
||||||
|
marginInlineEnd: 0,
|
||||||
|
paddingInline: `${t.paddingSM}px`,
|
||||||
|
lineHeight: `${t.controlHeightSM - t.lineWidth * 2}px`,
|
||||||
|
border: `${t.lineWidth}px ${t.lineType} ${checked ? t.colorPrimary : t.colorBorder}`,
|
||||||
|
fontWeight: checked ? t.fontWeightStrong : undefined,
|
||||||
|
userSelect: 'none' as const,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const allChecked = computed(() => model.value.length === 0);
|
||||||
|
|
||||||
|
function toggle(value: T, checked: boolean) {
|
||||||
|
if (!props.multiple) {
|
||||||
|
// انتخاب اجباری: کلیک روی چیپ روشن چیزی را خاموش نمیکند
|
||||||
|
if (!checked && !props.showAll) return;
|
||||||
|
model.value = checked ? [value] : [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const next = checked
|
||||||
|
? [...model.value, value]
|
||||||
|
: model.value.filter((v) => v !== value);
|
||||||
|
// ترتیب ثابت مطابق options، تا مقدار URL/ذخیرهشده پایدار بماند
|
||||||
|
model.value = props.options.map((o) => o.value).filter((v) => next.includes(v));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<a-flex align="center" wrap="wrap" :gap="token.marginXXS" role="group" :aria-label="label">
|
||||||
|
<a-typography-text v-if="label" type="secondary" :style="{ marginInlineEnd: `${token.marginXXS}px` }">
|
||||||
|
{{ label }}
|
||||||
|
</a-typography-text>
|
||||||
|
<a-checkable-tag
|
||||||
|
v-if="showAll"
|
||||||
|
:checked="allChecked"
|
||||||
|
:style="chipStyle(allChecked)"
|
||||||
|
@change="model = []"
|
||||||
|
>
|
||||||
|
{{ allLabel }}
|
||||||
|
</a-checkable-tag>
|
||||||
|
<a-checkable-tag
|
||||||
|
v-for="opt in options"
|
||||||
|
:key="opt.value"
|
||||||
|
:checked="model.includes(opt.value)"
|
||||||
|
:style="chipStyle(model.includes(opt.value))"
|
||||||
|
@change="(checked: boolean) => toggle(opt.value, checked)"
|
||||||
|
>
|
||||||
|
{{ opt.label }}
|
||||||
|
</a-checkable-tag>
|
||||||
|
</a-flex>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,489 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
/**
|
||||||
|
* هدر یکپارچهٔ صفحههای لیستی (مخاطبین، مسیر فروش، لیدها، روتین و…).
|
||||||
|
*
|
||||||
|
* چهار ردیف ثابت؛ هر صفحه فقط ردیفهایی را که لازم دارد روشن میکند:
|
||||||
|
* ۱. عنوان و اکشنها — همیشه: آیکن + عنوان + شمارنده | «⋯» + اکشن فرعی + یک دکمهٔ اصلی
|
||||||
|
* ۲. تبها — فقط با prop `tabs`
|
||||||
|
* ۳. نوار ابزار — جستجو → سلکتهای سریع → «فیلتر» → ذخیرهشده | ستونها → نمای نمایش
|
||||||
|
* ۳ب. ردیف چیپ — اسلات chips (FilterChips فیلترها) | اسلات chips-end (مرتبسازی چیپی)
|
||||||
|
* ۴. فیلترهای فعال — فقط وقتی `activeFilters` خالی نیست
|
||||||
|
*
|
||||||
|
* ظاهر فقط از توکنهای تم Ant (theme.useToken) میآید؛ CSS دستی ندارد.
|
||||||
|
*/
|
||||||
|
import { computed, h, onBeforeUnmount, ref, useSlots, type Component } from 'vue';
|
||||||
|
import { useRouter, type RouteLocationRaw } from 'vue-router';
|
||||||
|
import {
|
||||||
|
Badge as ABadge,
|
||||||
|
Button as AButton,
|
||||||
|
Card as ACard,
|
||||||
|
ConfigProvider as AConfigProvider,
|
||||||
|
Divider as ADivider,
|
||||||
|
Dropdown as ADropdown,
|
||||||
|
Flex as AFlex,
|
||||||
|
Input as AInput,
|
||||||
|
Menu as AMenu,
|
||||||
|
Segmented as ASegmented,
|
||||||
|
TabPane as ATabPane,
|
||||||
|
Tabs as ATabs,
|
||||||
|
Tag as ATag,
|
||||||
|
Typography,
|
||||||
|
theme,
|
||||||
|
} from 'ant-design-vue';
|
||||||
|
import type { MenuProps } from 'ant-design-vue';
|
||||||
|
import {
|
||||||
|
ArrowRightOutlined,
|
||||||
|
FilterOutlined,
|
||||||
|
MoreOutlined,
|
||||||
|
PlusOutlined,
|
||||||
|
SearchOutlined,
|
||||||
|
} from '@/icons/ant-bridge';
|
||||||
|
import type {
|
||||||
|
PageHeaderActiveFilter,
|
||||||
|
PageHeaderMenuItem,
|
||||||
|
PageHeaderTab,
|
||||||
|
PageHeaderViewOption,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/* ردیف ۱ */
|
||||||
|
title: string;
|
||||||
|
subtitle?: string;
|
||||||
|
icon?: Component;
|
||||||
|
/** شمارندهٔ کل کنار عنوان */
|
||||||
|
count?: number;
|
||||||
|
/** صفحههای جزئیات: دکمهٔ بازگشت قبل از عنوان */
|
||||||
|
backTo?: RouteLocationRaw;
|
||||||
|
/** دکمهٔ بازگشت بدون مسیر ثابت؛ صفحه خودش رویداد back را هندل میکند (مثلاً چک تغییرات ذخیرهنشده) */
|
||||||
|
backable?: boolean;
|
||||||
|
/** متن دکمهٔ اصلی؛ خالی = بدون دکمهٔ اصلی */
|
||||||
|
primaryLabel?: string;
|
||||||
|
primaryIcon?: Component;
|
||||||
|
primaryDisabled?: boolean;
|
||||||
|
primaryLoading?: boolean;
|
||||||
|
/** آیتمهای منوی «⋯» */
|
||||||
|
menuItems?: PageHeaderMenuItem[];
|
||||||
|
|
||||||
|
/* ردیف ۲ */
|
||||||
|
tabs?: PageHeaderTab[];
|
||||||
|
|
||||||
|
/* ردیف ۳ */
|
||||||
|
searchable?: boolean;
|
||||||
|
searchPlaceholder?: string;
|
||||||
|
/** نمایش دکمهٔ «فیلتر» (کشوی فیلترهای پیشرفته) */
|
||||||
|
filterable?: boolean;
|
||||||
|
/** تعداد فیلترهای پیشرفتهٔ فعال روی دکمهٔ «فیلتر» */
|
||||||
|
filterCount?: number;
|
||||||
|
viewOptions?: PageHeaderViewOption[];
|
||||||
|
|
||||||
|
/* ردیف ۴ */
|
||||||
|
activeFilters?: PageHeaderActiveFilter[];
|
||||||
|
resultCount?: number;
|
||||||
|
totalCount?: number;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
subtitle: undefined,
|
||||||
|
icon: undefined,
|
||||||
|
count: undefined,
|
||||||
|
backTo: undefined,
|
||||||
|
backable: false,
|
||||||
|
primaryLabel: undefined,
|
||||||
|
primaryIcon: undefined,
|
||||||
|
primaryDisabled: false,
|
||||||
|
primaryLoading: false,
|
||||||
|
menuItems: () => [],
|
||||||
|
tabs: () => [],
|
||||||
|
searchable: false,
|
||||||
|
searchPlaceholder: 'جستجو…',
|
||||||
|
filterable: false,
|
||||||
|
filterCount: 0,
|
||||||
|
viewOptions: () => [],
|
||||||
|
activeFilters: () => [],
|
||||||
|
resultCount: undefined,
|
||||||
|
totalCount: undefined,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
primary: [];
|
||||||
|
back: [];
|
||||||
|
menu: [key: string];
|
||||||
|
filters: [];
|
||||||
|
searchSubmit: [value: string];
|
||||||
|
removeFilter: [key: string];
|
||||||
|
clearFilters: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const activeTab = defineModel<string>('activeTab');
|
||||||
|
const search = defineModel<string>('search', { default: '' });
|
||||||
|
const view = defineModel<string>('view');
|
||||||
|
|
||||||
|
const slots = useSlots();
|
||||||
|
const router = useRouter();
|
||||||
|
const { token } = theme.useToken();
|
||||||
|
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
|
const fa = (n: number) => n.toLocaleString('fa-IR');
|
||||||
|
|
||||||
|
/* ---------- موبایل ---------- */
|
||||||
|
/**
|
||||||
|
* matchMedia همزمان (نه Grid.useBreakpoint که تا بعد از mount خالی است)؛
|
||||||
|
* در عرض کم، عنوان همیشه ردیف خودش را دارد و اکشنها زیرش میآیند تا با رسیدن
|
||||||
|
* دیتای دیرهنگام (شمارنده، زیرعنوان) ارتفاع هدر عوض نشود و صفحه نپرد.
|
||||||
|
*/
|
||||||
|
const narrowMq = typeof window !== 'undefined' ? window.matchMedia('(max-width: 767.98px)') : null;
|
||||||
|
const narrow = ref(narrowMq?.matches ?? false);
|
||||||
|
const onNarrowChange = (e: MediaQueryListEvent) => {
|
||||||
|
narrow.value = e.matches;
|
||||||
|
};
|
||||||
|
narrowMq?.addEventListener('change', onNarrowChange);
|
||||||
|
onBeforeUnmount(() => narrowMq?.removeEventListener('change', onNarrowChange));
|
||||||
|
|
||||||
|
const hasActions = computed(
|
||||||
|
() => props.menuItems.length > 0 || !!props.primaryLabel || !!slots.actions || !!slots.primary,
|
||||||
|
);
|
||||||
|
|
||||||
|
/* ---------- layout (همه از توکن) ---------- */
|
||||||
|
const rowPad = computed(() => `${token.value.paddingSM}px ${token.value.paddingMD}px`);
|
||||||
|
|
||||||
|
const hasTabs = computed(() => props.tabs.length > 0);
|
||||||
|
|
||||||
|
const hasToolbar = computed(
|
||||||
|
() =>
|
||||||
|
props.searchable ||
|
||||||
|
props.filterable ||
|
||||||
|
props.viewOptions.length > 0 ||
|
||||||
|
!!slots['quick-filters'] ||
|
||||||
|
!!slots['saved-filters'] ||
|
||||||
|
!!slots['toolbar-end'],
|
||||||
|
);
|
||||||
|
|
||||||
|
/** ردیف ۳ب: فیلترهای چیپی (FilterChips) — شروع: فیلترها، پایان: مرتبسازی */
|
||||||
|
const hasChipRow = computed(() => !!slots.chips || !!slots['chips-end']);
|
||||||
|
|
||||||
|
const chipRowStyle = computed(() => {
|
||||||
|
const t = token.value;
|
||||||
|
// زیر نوار ابزار: فقط پدینگ پایین؛ اگر نوار ابزار نباشد خودش ردیف کامل است
|
||||||
|
if (hasToolbar.value) return { padding: `0 ${t.paddingMD}px ${t.paddingSM}px` };
|
||||||
|
return {
|
||||||
|
padding: rowPad.value,
|
||||||
|
borderTop: hasTabs.value ? undefined : `${t.lineWidth}px ${t.lineType} ${t.colorBorderSecondary}`,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasChips = computed(() => props.activeFilters.length > 0);
|
||||||
|
|
||||||
|
/** تبها آخرین ردیف کارتاند ← خط زیر نوار تب لازم نیست (بوردر کارت هست) */
|
||||||
|
const tabsAreLast = computed(() => !hasToolbar.value && !hasChipRow.value && !hasChips.value);
|
||||||
|
|
||||||
|
const tabsTheme = computed(() =>
|
||||||
|
tabsAreLast.value
|
||||||
|
? // خط nav-list در استایل Tabs از colorSplit میآید
|
||||||
|
{ components: { Tabs: { colorSplit: 'transparent' } } }
|
||||||
|
: {},
|
||||||
|
);
|
||||||
|
|
||||||
|
const toolbarStyle = computed(() => ({
|
||||||
|
padding: rowPad.value,
|
||||||
|
// بدون ردیف تب، خط جداکننده را خود نوار ابزار میکشد
|
||||||
|
borderTop: hasTabs.value ? undefined : `${token.value.lineWidth}px ${token.value.lineType} ${token.value.colorBorderSecondary}`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const chipsStyle = computed(() => ({
|
||||||
|
padding: `0 ${token.value.paddingMD}px ${token.value.paddingSM}px`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const iconTileStyle = computed(() => ({
|
||||||
|
width: `${token.value.controlHeight}px`,
|
||||||
|
height: `${token.value.controlHeight}px`,
|
||||||
|
borderRadius: `${token.value.borderRadius}px`,
|
||||||
|
background: token.value.colorPrimaryBg,
|
||||||
|
color: token.value.colorPrimary,
|
||||||
|
fontSize: `${token.value.fontSizeLG}px`,
|
||||||
|
display: 'inline-flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
}));
|
||||||
|
|
||||||
|
/* ---------- شمارندهها ---------- */
|
||||||
|
function countStyle(kind: 'neutral' | 'active' | 'warning') {
|
||||||
|
const t = token.value;
|
||||||
|
const map = {
|
||||||
|
neutral: { bg: t.colorFillSecondary, fg: t.colorTextSecondary },
|
||||||
|
active: { bg: t.colorPrimaryBg, fg: t.colorPrimary },
|
||||||
|
warning: { bg: t.colorWarningBg, fg: t.colorWarningText },
|
||||||
|
} as const;
|
||||||
|
return {
|
||||||
|
backgroundColor: map[kind].bg,
|
||||||
|
color: map[kind].fg,
|
||||||
|
boxShadow: 'none',
|
||||||
|
fontWeight: t.fontWeightStrong,
|
||||||
|
fontVariantNumeric: 'tabular-nums',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function tabCountKind(tab: PageHeaderTab): 'neutral' | 'active' | 'warning' {
|
||||||
|
if (tab.tone === 'warning' && (tab.count ?? 0) > 0) return 'warning';
|
||||||
|
return tab.key === activeTab.value ? 'active' : 'neutral';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- منوی «⋯» ---------- */
|
||||||
|
const menuAntItems = computed<NonNullable<MenuProps['items']>>(() => {
|
||||||
|
const out: NonNullable<MenuProps['items']> = [];
|
||||||
|
for (const item of props.menuItems) {
|
||||||
|
if (item.dividerBefore && out.length) out.push({ type: 'divider' });
|
||||||
|
out.push({
|
||||||
|
key: item.key,
|
||||||
|
label: item.label,
|
||||||
|
danger: item.danger,
|
||||||
|
disabled: item.disabled,
|
||||||
|
icon: item.icon ? () => h(item.icon as Component) : undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
});
|
||||||
|
|
||||||
|
const onMenuClick: MenuProps['onClick'] = (info) => emit('menu', String(info.key));
|
||||||
|
|
||||||
|
/* ---------- نمای نمایش ---------- */
|
||||||
|
const segOptions = computed(() =>
|
||||||
|
props.viewOptions.map((o) => ({ value: o.value, payload: o })),
|
||||||
|
);
|
||||||
|
|
||||||
|
/* ---------- ردیف ۴ ---------- */
|
||||||
|
function onTagClose(e: Event, key: string) {
|
||||||
|
// a-tag خودش را مخفی میکند؛ کنترل دست صفحه بماند
|
||||||
|
e.preventDefault();
|
||||||
|
emit('removeFilter', key);
|
||||||
|
}
|
||||||
|
|
||||||
|
const resultText = computed(() => {
|
||||||
|
if (props.resultCount == null) return '';
|
||||||
|
if (props.totalCount == null) return `${fa(props.resultCount)} نتیجه`;
|
||||||
|
return `${fa(props.resultCount)} نتیجه از ${fa(props.totalCount)}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
function goBack() {
|
||||||
|
emit('back');
|
||||||
|
if (props.backTo) void router.push(props.backTo);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- overflow: خط و ink-bar تبها از گوشههای گرد کارت بیرون نزنند -->
|
||||||
|
<a-card :bordered="true" :body-style="{ padding: 0 }" :style="{ overflow: 'hidden' }" dir="rtl">
|
||||||
|
<!-- ۱ · عنوان و اکشنها -->
|
||||||
|
<a-flex
|
||||||
|
justify="space-between"
|
||||||
|
align="center"
|
||||||
|
wrap="wrap"
|
||||||
|
:gap="token.margin"
|
||||||
|
:style="{ padding: rowPad, minHeight: `${token.controlHeight + token.paddingSM * 2}px` }"
|
||||||
|
>
|
||||||
|
<a-flex
|
||||||
|
align="center"
|
||||||
|
:gap="token.marginSM"
|
||||||
|
:style="{ minWidth: 0, flexBasis: narrow && hasActions ? '100%' : undefined }"
|
||||||
|
>
|
||||||
|
<a-button v-if="backTo || backable" aria-label="بازگشت" title="بازگشت" @click="goBack">
|
||||||
|
<template #icon><ArrowRightOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
|
||||||
|
<span v-if="icon || $slots.icon" :style="iconTileStyle" aria-hidden="true">
|
||||||
|
<slot name="icon"><component :is="icon" /></slot>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<a-flex vertical :style="{ minWidth: 0 }">
|
||||||
|
<a-flex align="center" wrap="wrap" :gap="token.marginXS">
|
||||||
|
<a-typography-title :level="3" :style="{ margin: 0 }" :ellipsis="true" :title="title">
|
||||||
|
{{ title }}
|
||||||
|
</a-typography-title>
|
||||||
|
<a-badge
|
||||||
|
v-if="count != null"
|
||||||
|
:count="fa(count)"
|
||||||
|
:number-style="countStyle('neutral')"
|
||||||
|
:overflow-count="Number.MAX_SAFE_INTEGER"
|
||||||
|
/>
|
||||||
|
<!-- مثلاً انتخاب مسیر فروش: زمینهٔ صفحه، نه فیلتر -->
|
||||||
|
<slot name="title-extra" />
|
||||||
|
</a-flex>
|
||||||
|
<a-typography-text
|
||||||
|
v-if="subtitle || $slots.subtitle"
|
||||||
|
type="secondary"
|
||||||
|
:style="{ fontSize: `${token.fontSizeSM}px` }"
|
||||||
|
>
|
||||||
|
<slot name="subtitle">{{ subtitle }}</slot>
|
||||||
|
</a-typography-text>
|
||||||
|
</a-flex>
|
||||||
|
</a-flex>
|
||||||
|
|
||||||
|
<!-- a-flex نه a-space: Space تا بعد از mount از gap استفاده نمیکند و فریم اول پرش دارد -->
|
||||||
|
<a-flex v-if="hasActions" align="center" wrap="wrap" :gap="token.marginXS">
|
||||||
|
<a-dropdown v-if="menuItems.length" :trigger="['click']" placement="bottomLeft">
|
||||||
|
<a-button aria-label="اکشنهای بیشتر" title="بیشتر">
|
||||||
|
<template #icon><MoreOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu :items="menuAntItems" @click="onMenuClick" />
|
||||||
|
</template>
|
||||||
|
</a-dropdown>
|
||||||
|
|
||||||
|
<!-- حداکثر یک دکمهٔ فرعی (default) یا دکمهٔ آیکنی -->
|
||||||
|
<slot name="actions" />
|
||||||
|
|
||||||
|
<slot name="primary">
|
||||||
|
<a-button
|
||||||
|
v-if="primaryLabel"
|
||||||
|
type="primary"
|
||||||
|
:disabled="primaryDisabled"
|
||||||
|
:loading="primaryLoading"
|
||||||
|
@click="emit('primary')"
|
||||||
|
>
|
||||||
|
<template #icon><component :is="primaryIcon ?? PlusOutlined" /></template>
|
||||||
|
{{ primaryLabel }}
|
||||||
|
</a-button>
|
||||||
|
</slot>
|
||||||
|
</a-flex>
|
||||||
|
</a-flex>
|
||||||
|
|
||||||
|
<!-- ۲ · تبها -->
|
||||||
|
<!--
|
||||||
|
وقتی تبها آخرین ردیف کارتاند، خط زیر نوار تب با بوردر کارت دوتا میشود؛
|
||||||
|
رنگ خط تب را فقط برای همین Tabs شفاف میکنیم (توکن کامپوننت، نه CSS).
|
||||||
|
-->
|
||||||
|
<!-- direction صریح: پیشفرض prop در ConfigProvider «ltr» است و از والد ارث نمیبرد؛
|
||||||
|
بدون آن تبها LTR حساب میشوند (جای ink-bar میپرد و اسکرول تبها برعکس میشود) -->
|
||||||
|
<a-config-provider v-if="hasTabs" direction="rtl" :theme="tabsTheme">
|
||||||
|
<a-tabs
|
||||||
|
v-model:activeKey="activeTab"
|
||||||
|
:tab-bar-style="{ margin: 0, paddingInline: `${token.paddingMD}px` }"
|
||||||
|
>
|
||||||
|
<a-tab-pane v-for="tab in tabs" :key="tab.key" :disabled="tab.disabled">
|
||||||
|
<template #tab>
|
||||||
|
<a-flex align="center" :gap="token.marginXS">
|
||||||
|
<component :is="tab.icon" v-if="tab.icon" />
|
||||||
|
<span>{{ tab.label }}</span>
|
||||||
|
<a-badge
|
||||||
|
v-if="tab.count != null"
|
||||||
|
:count="fa(tab.count)"
|
||||||
|
:number-style="countStyle(tabCountKind(tab))"
|
||||||
|
:overflow-count="Number.MAX_SAFE_INTEGER"
|
||||||
|
/>
|
||||||
|
</a-flex>
|
||||||
|
</template>
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
</a-config-provider>
|
||||||
|
|
||||||
|
<!-- ۳ · نوار ابزار -->
|
||||||
|
<a-flex
|
||||||
|
v-if="hasToolbar"
|
||||||
|
justify="space-between"
|
||||||
|
align="center"
|
||||||
|
wrap="wrap"
|
||||||
|
:gap="token.marginSM"
|
||||||
|
:style="toolbarStyle"
|
||||||
|
>
|
||||||
|
<a-flex align="center" wrap="wrap" :gap="token.marginXS" :style="{ minWidth: 0, flex: '1 1 auto' }">
|
||||||
|
<a-input
|
||||||
|
v-if="searchable"
|
||||||
|
v-model:value="search"
|
||||||
|
allow-clear
|
||||||
|
:placeholder="searchPlaceholder"
|
||||||
|
:style="{ flex: '1 1 220px', minWidth: '200px', maxWidth: '320px' }"
|
||||||
|
@press-enter="emit('searchSubmit', search)"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<SearchOutlined :style="{ color: token.colorTextTertiary }" />
|
||||||
|
</template>
|
||||||
|
</a-input>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
فقط کنترلهای «کادری» (a-select) برای گزینههای زیاد/پویا، حداکثر دو تا.
|
||||||
|
گزینههای کم و ثابت (DISC، اولویت…) و مرتبسازی → اسلاتهای chips / chips-end.
|
||||||
|
بقیه داخل کشوی «فیلتر».
|
||||||
|
-->
|
||||||
|
<slot name="quick-filters" />
|
||||||
|
|
||||||
|
<a-button
|
||||||
|
v-if="filterable"
|
||||||
|
:type="filterCount ? 'primary' : 'default'"
|
||||||
|
:ghost="!!filterCount"
|
||||||
|
@click="emit('filters')"
|
||||||
|
>
|
||||||
|
<template #icon><FilterOutlined /></template>
|
||||||
|
فیلتر
|
||||||
|
<a-badge
|
||||||
|
v-if="filterCount"
|
||||||
|
:count="fa(filterCount)"
|
||||||
|
:number-style="{ backgroundColor: token.colorPrimary, boxShadow: 'none' }"
|
||||||
|
:style="{ marginInlineStart: `${token.marginXXS}px` }"
|
||||||
|
/>
|
||||||
|
</a-button>
|
||||||
|
|
||||||
|
<!-- SavedFiltersBar compact -->
|
||||||
|
<slot name="saved-filters" />
|
||||||
|
</a-flex>
|
||||||
|
|
||||||
|
<a-flex
|
||||||
|
v-if="$slots['toolbar-end'] || viewOptions.length"
|
||||||
|
align="center"
|
||||||
|
wrap="wrap"
|
||||||
|
:gap="token.marginXS"
|
||||||
|
>
|
||||||
|
<!-- تنظیمات نما: ستونها (مرتبسازی چیپی است و در ردیف چیپ میآید) -->
|
||||||
|
<slot name="toolbar-end" />
|
||||||
|
<a-divider v-if="$slots['toolbar-end'] && viewOptions.length" type="vertical" :style="{ margin: 0 }" />
|
||||||
|
<a-segmented v-if="viewOptions.length" v-model:value="view" :options="segOptions">
|
||||||
|
<template #label="{ payload }">
|
||||||
|
<span :title="payload.label" :aria-label="payload.label">
|
||||||
|
<component :is="payload.icon" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</a-segmented>
|
||||||
|
</a-flex>
|
||||||
|
</a-flex>
|
||||||
|
|
||||||
|
<!-- ۳ب · ردیف چیپ: FilterChips فیلترها در شروع، مرتبسازی در پایان -->
|
||||||
|
<a-flex
|
||||||
|
v-if="hasChipRow"
|
||||||
|
justify="space-between"
|
||||||
|
align="center"
|
||||||
|
wrap="wrap"
|
||||||
|
:gap="token.marginSM"
|
||||||
|
:style="chipRowStyle"
|
||||||
|
>
|
||||||
|
<a-flex align="center" wrap="wrap" :gap="token.margin" :style="{ minWidth: 0 }">
|
||||||
|
<slot name="chips" />
|
||||||
|
</a-flex>
|
||||||
|
<a-flex v-if="$slots['chips-end']" align="center" wrap="wrap" :gap="token.margin">
|
||||||
|
<slot name="chips-end" />
|
||||||
|
</a-flex>
|
||||||
|
</a-flex>
|
||||||
|
|
||||||
|
<!-- ۴ · فیلترهای فعال -->
|
||||||
|
<a-flex v-if="hasChips" align="center" wrap="wrap" :gap="token.marginXS" :style="chipsStyle">
|
||||||
|
<a-tag
|
||||||
|
v-for="f in activeFilters"
|
||||||
|
:key="f.key"
|
||||||
|
closable
|
||||||
|
:bordered="false"
|
||||||
|
:style="{ marginInlineEnd: 0, background: token.colorPrimaryBg }"
|
||||||
|
@close="onTagClose($event, f.key)"
|
||||||
|
>
|
||||||
|
<a-typography-text type="secondary">{{ f.label }}:</a-typography-text>
|
||||||
|
{{ f.value }}
|
||||||
|
</a-tag>
|
||||||
|
<a-button type="link" size="small" @click="emit('clearFilters')">پاک کردن همه</a-button>
|
||||||
|
<a-typography-text
|
||||||
|
v-if="resultText"
|
||||||
|
type="secondary"
|
||||||
|
:style="{ marginInlineStart: 'auto', fontSize: `${token.fontSizeSM}px` }"
|
||||||
|
>
|
||||||
|
{{ resultText }}
|
||||||
|
</a-typography-text>
|
||||||
|
</a-flex>
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export { default as PageHeader } from './PageHeader.vue';
|
||||||
|
export { default as FilterChips } from './FilterChips.vue';
|
||||||
|
export type {
|
||||||
|
PageHeaderActiveFilter,
|
||||||
|
PageHeaderMenuItem,
|
||||||
|
PageHeaderTab,
|
||||||
|
PageHeaderViewOption,
|
||||||
|
} from './types';
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import type { Component } from 'vue';
|
||||||
|
|
||||||
|
/** تب ردیف ۲ هدر صفحه (زیرنماها / وضعیتها) */
|
||||||
|
export interface PageHeaderTab {
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
/** شمارنده کنار تب؛ undefined = بدون شمارنده */
|
||||||
|
count?: number;
|
||||||
|
icon?: Component;
|
||||||
|
/** warning برای مواردی مثل «عقبافتاده» */
|
||||||
|
tone?: 'default' | 'warning';
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** آیتم منوی «⋯» در ردیف عنوان (اکسل، ورود داده، تنظیمات کمکاربرد) */
|
||||||
|
export interface PageHeaderMenuItem {
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
icon?: Component;
|
||||||
|
danger?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
/** خط جداکننده قبل از این آیتم */
|
||||||
|
dividerBefore?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** گزینهٔ نمای نمایش (لیست / ستونی / شبکه / تقویم) */
|
||||||
|
export interface PageHeaderViewOption {
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
icon: Component;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** چیپ فیلتر فعال در ردیف ۴ */
|
||||||
|
export interface PageHeaderActiveFilter {
|
||||||
|
key: string;
|
||||||
|
/** نام فیلتر، مثل «منبع» */
|
||||||
|
label: string;
|
||||||
|
/** مقدار خوانا، مثل «اینستاگرام، تلگرام» */
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
@@ -1,19 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
/**
|
||||||
|
* هدر صفحههای بردی (مسیر فروش، تابلوی پروژه) روی PageHeader سراسری.
|
||||||
|
* API قبلی (v-model ها، create، اسلاتهای excel/filters) حفظ شده تا صفحهها نشکنند.
|
||||||
|
*/
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import {
|
import {
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
FundOutlined,
|
FundOutlined,
|
||||||
|
UnorderedListOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import {
|
import {
|
||||||
Flex as AFlex,
|
|
||||||
InputNumber as AInputNumber,
|
InputNumber as AInputNumber,
|
||||||
InputSearch as AInputSearch,
|
|
||||||
Segmented as ASegmented,
|
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
|
||||||
Typography,
|
|
||||||
theme,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import type { PageHeaderMenuItem, PageHeaderViewOption } from '@/components/page';
|
||||||
|
|
||||||
export type PipelineViewMode = 'kanban' | 'list';
|
export type PipelineViewMode = 'kanban' | 'list';
|
||||||
|
|
||||||
@@ -25,33 +26,45 @@ const props = withDefaults(
|
|||||||
icon?: 'briefcase' | 'grid';
|
icon?: 'briefcase' | 'grid';
|
||||||
createOptionLabel?: string;
|
createOptionLabel?: string;
|
||||||
showAmountFilters?: boolean;
|
showAmountFilters?: boolean;
|
||||||
|
subtitle?: string;
|
||||||
|
/** شمارندهٔ کنار عنوان (مثلاً تعداد معاملات) */
|
||||||
|
count?: number;
|
||||||
|
/** دکمهٔ اصلی هدر (مثلاً «معامله جدید») */
|
||||||
|
primaryLabel?: string;
|
||||||
|
/** آیتمهای منوی «⋯» (خروجی/ورود اکسل و…) */
|
||||||
|
menuItems?: PageHeaderMenuItem[];
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
canCreate: false,
|
canCreate: false,
|
||||||
icon: 'briefcase',
|
icon: 'briefcase',
|
||||||
createOptionLabel: 'مسیر فروش جدید…',
|
createOptionLabel: 'مسیر فروش جدید…',
|
||||||
showAmountFilters: true,
|
showAmountFilters: true,
|
||||||
|
subtitle: undefined,
|
||||||
|
count: undefined,
|
||||||
|
primaryLabel: undefined,
|
||||||
|
menuItems: () => [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
create: [];
|
create: [];
|
||||||
|
primary: [];
|
||||||
|
menu: [key: string];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { Title: ATypographyTitle } = Typography;
|
|
||||||
const { token } = theme.useToken();
|
|
||||||
|
|
||||||
const viewMode = defineModel<PipelineViewMode>('viewMode', { required: true });
|
const viewMode = defineModel<PipelineViewMode>('viewMode', { required: true });
|
||||||
const search = defineModel<string>('search', { default: '' });
|
const search = defineModel<string>('search', { default: '' });
|
||||||
const selectedPipelineId = defineModel<string>('selectedPipelineId', { required: true });
|
const selectedPipelineId = defineModel<string>('selectedPipelineId', { required: true });
|
||||||
const amountMin = defineModel<string>('amountMin', { default: '' });
|
const amountMin = defineModel<string>('amountMin', { default: '' });
|
||||||
const amountMax = defineModel<string>('amountMax', { default: '' });
|
const amountMax = defineModel<string>('amountMax', { default: '' });
|
||||||
|
|
||||||
const viewOptions = [
|
const viewOptions: PageHeaderViewOption[] = [
|
||||||
{ value: 'kanban' as const, label: 'ستونی' },
|
{ value: 'kanban', label: 'ستونی', icon: AppstoreOutlined },
|
||||||
{ value: 'list' as const, label: 'لیست' },
|
{ value: 'list', label: 'لیست', icon: UnorderedListOutlined },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const headerIcon = computed(() => (props.icon === 'grid' ? AppstoreOutlined : FundOutlined));
|
||||||
|
|
||||||
const pipelineSelectOptions = computed(() => {
|
const pipelineSelectOptions = computed(() => {
|
||||||
const list = props.pipelineOptions.map((o) => ({ value: o.id, label: o.name }));
|
const list = props.pipelineOptions.map((o) => ({ value: o.id, label: o.name }));
|
||||||
if (props.canCreate) {
|
if (props.canCreate) {
|
||||||
@@ -69,6 +82,10 @@ function onPick(value: unknown) {
|
|||||||
selectedPipelineId.value = v;
|
selectedPipelineId.value = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onView(value: string | undefined) {
|
||||||
|
viewMode.value = value === 'list' ? 'list' : 'kanban';
|
||||||
|
}
|
||||||
|
|
||||||
const amountMinNum = computed({
|
const amountMinNum = computed({
|
||||||
get: () => (amountMin.value === '' ? undefined : Number(amountMin.value)),
|
get: () => (amountMin.value === '' ? undefined : Number(amountMin.value)),
|
||||||
set: (v: number | string | null | undefined) => {
|
set: (v: number | string | null | undefined) => {
|
||||||
@@ -87,73 +104,55 @@ const amountMaxNum = computed({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="12" dir="rtl">
|
<PageHeader
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
:title="pipelineName"
|
||||||
<a-space :size="10" align="center">
|
:subtitle="subtitle"
|
||||||
<span
|
:icon="headerIcon"
|
||||||
:style="{
|
:count="count"
|
||||||
width: `${token.controlHeight}px`,
|
:primary-label="primaryLabel"
|
||||||
height: `${token.controlHeight}px`,
|
:menu-items="menuItems"
|
||||||
borderRadius: `${token.borderRadius}px`,
|
searchable
|
||||||
display: 'inline-flex',
|
search-placeholder="جستجو در معاملات…"
|
||||||
alignItems: 'center',
|
v-model:search="search"
|
||||||
justifyContent: 'center',
|
:view-options="viewOptions"
|
||||||
background: token.colorPrimary,
|
:view="viewMode"
|
||||||
color: token.colorTextLightSolid,
|
@update:view="onView"
|
||||||
flexShrink: 0,
|
@primary="emit('primary')"
|
||||||
}"
|
@menu="(key) => emit('menu', key)"
|
||||||
aria-hidden="true"
|
>
|
||||||
>
|
<!-- انتخاب مسیر: زمینهٔ صفحه، نه فیلتر ← کنار عنوان -->
|
||||||
<AppstoreOutlined v-if="icon === 'grid'" />
|
<template #title-extra>
|
||||||
<FundOutlined v-else />
|
<a-select
|
||||||
</span>
|
:value="selectedPipelineId"
|
||||||
<a-typography-title :level="4" :style="{ margin: 0 }">
|
:options="pipelineSelectOptions"
|
||||||
{{ pipelineName }}
|
:style="{ width: '180px' }"
|
||||||
</a-typography-title>
|
@update:value="onPick"
|
||||||
</a-space>
|
|
||||||
|
|
||||||
<a-space wrap :size="8">
|
|
||||||
<a-segmented v-model:value="viewMode" :options="viewOptions" />
|
|
||||||
<a-select
|
|
||||||
:value="selectedPipelineId"
|
|
||||||
:options="pipelineSelectOptions"
|
|
||||||
:style="{ width: '180px' }"
|
|
||||||
@update:value="onPick"
|
|
||||||
/>
|
|
||||||
<slot name="excel" />
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<!-- یک نوار فیلتر تکردیفه؛ بدون a-row و بدون فاصلهٔ ول -->
|
|
||||||
<a-flex
|
|
||||||
wrap="wrap"
|
|
||||||
align="center"
|
|
||||||
:gap="8"
|
|
||||||
:style="{ width: '100%', minWidth: 0 }"
|
|
||||||
>
|
|
||||||
<a-input-search
|
|
||||||
v-model:value="search"
|
|
||||||
allow-clear
|
|
||||||
placeholder="جستجو در معاملات…"
|
|
||||||
:style="{ flex: '1 1 220px', minWidth: '180px', maxWidth: '100%' }"
|
|
||||||
/>
|
/>
|
||||||
<template v-if="showAmountFilters">
|
</template>
|
||||||
<a-input-number
|
|
||||||
v-model:value="amountMinNum"
|
<template v-if="$slots.excel" #actions>
|
||||||
:min="0"
|
<slot name="excel" />
|
||||||
placeholder="حداقل مبلغ"
|
</template>
|
||||||
:style="{ width: '140px', flex: '0 0 auto' }"
|
|
||||||
/>
|
<template v-if="showAmountFilters" #quick-filters>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
v-model:value="amountMaxNum"
|
v-model:value="amountMinNum"
|
||||||
:min="0"
|
:min="0"
|
||||||
placeholder="حداکثر مبلغ"
|
placeholder="حداقل مبلغ"
|
||||||
:style="{ width: '140px', flex: '0 0 auto' }"
|
:style="{ width: '140px' }"
|
||||||
/>
|
/>
|
||||||
</template>
|
<a-input-number
|
||||||
<div :style="{ flex: '1 1 240px', minWidth: '200px', maxWidth: '100%' }">
|
v-model:value="amountMaxNum"
|
||||||
|
:min="0"
|
||||||
|
placeholder="حداکثر مبلغ"
|
||||||
|
:style="{ width: '140px' }"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="$slots.filters" #saved-filters>
|
||||||
|
<div :style="{ width: '280px', maxWidth: '100%' }">
|
||||||
<slot name="filters" />
|
<slot name="filters" />
|
||||||
</div>
|
</div>
|
||||||
</a-flex>
|
</template>
|
||||||
</a-flex>
|
</PageHeader>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import { apiErrorMessage } from '@/lib/apiErrorMessage';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Central CRM feedback via Ant static Message (portal on document.body).
|
||||||
|
* Configured once in main.ts — do not use App.useApp() message here.
|
||||||
|
*/
|
||||||
|
export function useFeedback() {
|
||||||
|
return {
|
||||||
|
success: (content: string) => {
|
||||||
|
void message.success(content);
|
||||||
|
},
|
||||||
|
error: (content: string) => {
|
||||||
|
void message.error(content);
|
||||||
|
},
|
||||||
|
warning: (content: string) => {
|
||||||
|
void message.warning(content);
|
||||||
|
},
|
||||||
|
info: (content: string) => {
|
||||||
|
void message.info(content);
|
||||||
|
},
|
||||||
|
fromError: (e: unknown, fallback: string) => {
|
||||||
|
void message.error(apiErrorMessage(e, fallback));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
+1356
-508
File diff suppressed because it is too large
Load Diff
@@ -1,33 +1,44 @@
|
|||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import type { ActivityPriority, ActivityPrioritySetting } from '@mento/shared';
|
import type { ActivityPriority, ActivityPrioritySetting } from '@mento/shared';
|
||||||
import {
|
import {
|
||||||
DEFAULT_ACTIVITY_PRIORITY_SETTINGS,
|
DEFAULT_ACTIVITY_PRIORITY_SETTINGS,
|
||||||
parseActivityPrioritySettings,
|
parseActivityPrioritySettings,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { activityPriorityKeys } from '@/queries/keys';
|
||||||
|
import { queryClient } from '@/queries/queryClient';
|
||||||
|
|
||||||
const items = ref<ActivityPrioritySetting[]>([...DEFAULT_ACTIVITY_PRIORITY_SETTINGS]);
|
const REF_STALE_MS = 5 * 60_000;
|
||||||
const loaded = ref(false);
|
|
||||||
let pending: Promise<void> | null = null;
|
|
||||||
|
|
||||||
/** تنظیمات اولویت فعالیت/روتین (کش مشترک) */
|
async function fetchActivityPriorities(): Promise<ActivityPrioritySetting[]> {
|
||||||
|
try {
|
||||||
|
const { data } = await api.get<ActivityPrioritySetting[]>('/activities/priorities');
|
||||||
|
return parseActivityPrioritySettings(data);
|
||||||
|
} catch {
|
||||||
|
return [...DEFAULT_ACTIVITY_PRIORITY_SETTINGS];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** تنظیمات اولویت فعالیت/روتین (کش مشترک Vue Query) */
|
||||||
export function useActivityPriorities() {
|
export function useActivityPriorities() {
|
||||||
|
const query = useQuery({
|
||||||
|
queryKey: activityPriorityKeys.list(),
|
||||||
|
queryFn: fetchActivityPriorities,
|
||||||
|
staleTime: REF_STALE_MS,
|
||||||
|
placeholderData: [...DEFAULT_ACTIVITY_PRIORITY_SETTINGS],
|
||||||
|
});
|
||||||
|
|
||||||
|
const items = computed(
|
||||||
|
() => query.data.value ?? [...DEFAULT_ACTIVITY_PRIORITY_SETTINGS],
|
||||||
|
);
|
||||||
|
const loaded = computed(() => query.isFetched.value);
|
||||||
|
|
||||||
async function load(force = false): Promise<void> {
|
async function load(force = false): Promise<void> {
|
||||||
if (loaded.value && !force) return;
|
if (force) {
|
||||||
if (pending && !force) return pending;
|
await queryClient.invalidateQueries({ queryKey: activityPriorityKeys.all });
|
||||||
pending = api
|
}
|
||||||
.get<ActivityPrioritySetting[]>('/activities/priorities')
|
await query.refetch();
|
||||||
.then(({ data }) => {
|
|
||||||
items.value = parseActivityPrioritySettings(data);
|
|
||||||
loaded.value = true;
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
if (!loaded.value) items.value = [...DEFAULT_ACTIVITY_PRIORITY_SETTINGS];
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
pending = null;
|
|
||||||
});
|
|
||||||
return pending;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const byKey = computed(() => {
|
const byKey = computed(() => {
|
||||||
@@ -59,9 +70,11 @@ export function useActivityPriorities() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setLocal(next: ActivityPrioritySetting[]) {
|
function setLocal(next: ActivityPrioritySetting[]) {
|
||||||
items.value = parseActivityPrioritySettings(next);
|
queryClient.setQueryData(
|
||||||
loaded.value = true;
|
activityPriorityKeys.list(),
|
||||||
|
parseActivityPrioritySettings(next),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { items, byKey, labels, colors, loaded, load, labelOf, colorOf, setLocal };
|
return { items, byKey, labels, colors, loaded, load, labelOf, colorOf, setLocal, query };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import type {
|
import type {
|
||||||
ActivityDto,
|
ActivityDto,
|
||||||
ActivityStageColor,
|
ActivityStageColor,
|
||||||
@@ -9,6 +10,8 @@ import type {
|
|||||||
import { ACTIVITY_TYPE_LABELS } from '@mento/shared';
|
import { ACTIVITY_TYPE_LABELS } from '@mento/shared';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { PIPELINE_ACCENT } from '@/lib/pipeline-board';
|
import { PIPELINE_ACCENT } from '@/lib/pipeline-board';
|
||||||
|
import { activityTypeKeys } from '@/queries/keys';
|
||||||
|
import { queryClient } from '@/queries/queryClient';
|
||||||
|
|
||||||
export const BASE_TYPE_ICON: Record<ActivityType, ActivityTypeIcon> = {
|
export const BASE_TYPE_ICON: Record<ActivityType, ActivityTypeIcon> = {
|
||||||
call: 'phone',
|
call: 'phone',
|
||||||
@@ -45,28 +48,29 @@ export const ACTIVITY_TYPE_ICON_LABELS: Record<ActivityTypeIcon, string> = {
|
|||||||
sparkle: 'درخشش',
|
sparkle: 'درخشش',
|
||||||
};
|
};
|
||||||
|
|
||||||
const types = ref<ActivityTypeDefDto[]>([]);
|
const REF_STALE_MS = 5 * 60_000;
|
||||||
const loaded = ref(false);
|
|
||||||
let pending: Promise<void> | null = null;
|
|
||||||
|
|
||||||
/** انواع فعالیت سازمان (کش مشترک بین صفحات) */
|
async function fetchActivityTypes(): Promise<ActivityTypeDefDto[]> {
|
||||||
|
const { data } = await api.get<ActivityTypeDefDto[]>('/activities/types');
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** انواع فعالیت سازمان (کش مشترک Vue Query) */
|
||||||
export function useActivityTypes() {
|
export function useActivityTypes() {
|
||||||
|
const query = useQuery({
|
||||||
|
queryKey: activityTypeKeys.list(),
|
||||||
|
queryFn: fetchActivityTypes,
|
||||||
|
staleTime: REF_STALE_MS,
|
||||||
|
});
|
||||||
|
|
||||||
|
const types = computed(() => query.data.value ?? []);
|
||||||
|
const loaded = computed(() => query.isFetched.value);
|
||||||
|
|
||||||
async function load(force = false): Promise<void> {
|
async function load(force = false): Promise<void> {
|
||||||
if (loaded.value && !force) return;
|
if (force) {
|
||||||
if (pending && !force) return pending;
|
await queryClient.invalidateQueries({ queryKey: activityTypeKeys.all });
|
||||||
pending = api
|
}
|
||||||
.get<ActivityTypeDefDto[]>('/activities/types')
|
await query.refetch();
|
||||||
.then(({ data }) => {
|
|
||||||
types.value = data;
|
|
||||||
loaded.value = true;
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
if (!loaded.value) types.value = [];
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
pending = null;
|
|
||||||
});
|
|
||||||
return pending;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const active = computed(() => types.value.filter((t) => t.isActive));
|
const active = computed(() => types.value.filter((t) => t.isActive));
|
||||||
@@ -84,7 +88,7 @@ export function useActivityTypes() {
|
|||||||
return systemOf.value[a.type] ?? null;
|
return systemOf.value[a.type] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { types, active, byId, systemOf, loaded, load, defOf };
|
return { types, active, byId, systemOf, loaded, load, defOf, query };
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TypeView = { name: string; icon: ActivityTypeIcon; color: ActivityStageColor };
|
export type TypeView = { name: string; icon: ActivityTypeIcon; color: ActivityStageColor };
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
/** Extract a user-facing message from an API/axios error. */
|
||||||
|
export function apiErrorMessage(e: unknown, fallback: string): string {
|
||||||
|
if (axios.isAxiosError(e)) {
|
||||||
|
const msg = (e.response?.data as { message?: string | string[] } | undefined)?.message;
|
||||||
|
if (Array.isArray(msg)) return msg.join('، ');
|
||||||
|
if (msg) return msg;
|
||||||
|
if (!e.response) return 'اتصال به سرور برقرار نشد.';
|
||||||
|
}
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
import { ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import type { CustomerGroupColor, CustomerGroupDto } from '@mento/shared';
|
import type { CustomerGroupColor, CustomerGroupDto } from '@mento/shared';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { customerGroupKeys } from '@/queries/keys';
|
||||||
|
import { queryClient } from '@/queries/queryClient';
|
||||||
|
|
||||||
export const CUSTOMER_GROUP_COLOR_LABELS: Record<CustomerGroupColor, string> = {
|
export const CUSTOMER_GROUP_COLOR_LABELS: Record<CustomerGroupColor, string> = {
|
||||||
teal: 'سبزآبی',
|
teal: 'سبزآبی',
|
||||||
@@ -27,27 +30,31 @@ export function groupSwatch(color: string | null | undefined) {
|
|||||||
return CUSTOMER_GROUP_SWATCH[(color ?? 'teal') as CustomerGroupColor] ?? CUSTOMER_GROUP_SWATCH.teal;
|
return CUSTOMER_GROUP_SWATCH[(color ?? 'teal') as CustomerGroupColor] ?? CUSTOMER_GROUP_SWATCH.teal;
|
||||||
}
|
}
|
||||||
|
|
||||||
const groups = ref<CustomerGroupDto[]>([]);
|
const REF_STALE_MS = 5 * 60_000;
|
||||||
const loaded = ref(false);
|
|
||||||
let pending: Promise<CustomerGroupDto[]> | null = null;
|
|
||||||
|
|
||||||
/** فهرست گروههای مشتری محیط (مشترک بین صفحهها) */
|
async function fetchCustomerGroups(): Promise<CustomerGroupDto[]> {
|
||||||
|
const { data } = await api.get<CustomerGroupDto[]>('/customer-groups');
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** فهرست گروههای مشتری محیط (کش مشترک Vue Query) */
|
||||||
export function useCustomerGroups() {
|
export function useCustomerGroups() {
|
||||||
|
const query = useQuery({
|
||||||
|
queryKey: customerGroupKeys.list(),
|
||||||
|
queryFn: fetchCustomerGroups,
|
||||||
|
staleTime: REF_STALE_MS,
|
||||||
|
});
|
||||||
|
|
||||||
|
const groups = computed(() => query.data.value ?? []);
|
||||||
|
const loaded = computed(() => query.isFetched.value);
|
||||||
|
|
||||||
async function load(force = false): Promise<CustomerGroupDto[]> {
|
async function load(force = false): Promise<CustomerGroupDto[]> {
|
||||||
if (loaded.value && !force) return groups.value;
|
if (force) {
|
||||||
if (pending && !force) return pending;
|
await queryClient.invalidateQueries({ queryKey: customerGroupKeys.all });
|
||||||
pending = api
|
}
|
||||||
.get<CustomerGroupDto[]>('/customer-groups')
|
const result = await query.refetch();
|
||||||
.then(({ data }) => {
|
return result.data ?? groups.value;
|
||||||
groups.value = data;
|
|
||||||
loaded.value = true;
|
|
||||||
return data;
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
pending = null;
|
|
||||||
});
|
|
||||||
return pending;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { groups, loaded, load };
|
return { groups, loaded, load, query };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,234 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
||||||
|
|
||||||
|
export type WorkspaceTab = {
|
||||||
|
id: string;
|
||||||
|
fullPath: string;
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'mento_workspace_tabs_v1';
|
||||||
|
const MAX_TABS = 14;
|
||||||
|
|
||||||
|
const tabs = ref<WorkspaceTab[]>([]);
|
||||||
|
const hydrated = ref(false);
|
||||||
|
|
||||||
|
const ROUTE_TITLES: Record<string, string> = {
|
||||||
|
home: 'داشبورد',
|
||||||
|
profile: 'حساب کاربری',
|
||||||
|
reports: 'گزارشها',
|
||||||
|
'tahesab-sales-report': 'گزارش فروش تهحساب',
|
||||||
|
'disc-report': 'گزارش دیسک',
|
||||||
|
'sales-forecast': 'هدف و پیشبینی',
|
||||||
|
tickets: 'تیکتها',
|
||||||
|
conversations: 'گفتگو',
|
||||||
|
'ticket-new': 'تیکت جدید',
|
||||||
|
'ticket-detail': 'جزئیات تیکت',
|
||||||
|
activities: 'میز کار من',
|
||||||
|
'activities-calendar': 'تقویم کارها',
|
||||||
|
'activity-new': 'کار جدید',
|
||||||
|
'activity-edit': 'ویرایش کار',
|
||||||
|
'activity-detail': 'جزئیات کار',
|
||||||
|
'routines-today': 'روتین امروز',
|
||||||
|
'routines-overdue': 'روتین معوق',
|
||||||
|
'routines-calendar': 'تقویم روتین',
|
||||||
|
'routines-list': 'فهرست روتین',
|
||||||
|
'routines-me': 'روتین من',
|
||||||
|
'routines-team': 'روتین تیم',
|
||||||
|
'routines-manage': 'مدیریت روتین',
|
||||||
|
'routine-new': 'روتین جدید',
|
||||||
|
'routine-edit': 'ویرایش روتین',
|
||||||
|
'routines-settings': 'تنظیمات روتین',
|
||||||
|
quotes: 'پیشفاکتورها',
|
||||||
|
'quote-new': 'پیشفاکتور جدید',
|
||||||
|
'quote-detail': 'جزئیات پیشفاکتور',
|
||||||
|
invoices: 'فاکتورها',
|
||||||
|
'invoice-new': 'فاکتور جدید',
|
||||||
|
'invoice-detail': 'جزئیات فاکتور',
|
||||||
|
inventory: 'انبار',
|
||||||
|
cheques: 'چکها',
|
||||||
|
finance: 'مدیریت مالی',
|
||||||
|
'finance-accounts': 'حسابها',
|
||||||
|
'finance-account': 'جزئیات حساب',
|
||||||
|
'finance-incomes': 'دریافتها',
|
||||||
|
'finance-expenses': 'پرداختها',
|
||||||
|
'finance-receivables': 'مطالبات',
|
||||||
|
'finance-payroll': 'حقوق',
|
||||||
|
'finance-recurring': 'تراکنشهای تکراری',
|
||||||
|
'finance-reports': 'گزارش مالی',
|
||||||
|
'finance-audit': 'حسابرسی مالی',
|
||||||
|
'finance-categories': 'دستهبندی مالی',
|
||||||
|
reservations: 'رزرو و نوبتدهی',
|
||||||
|
commissions: 'پورسانت',
|
||||||
|
pipeline: 'مسیر فروش',
|
||||||
|
leads: 'فهرست لیدها',
|
||||||
|
'leads-board': 'مسیر لیدها',
|
||||||
|
'lead-detail': 'جزئیات لید',
|
||||||
|
projects: 'تابلوی پروژه',
|
||||||
|
'project-card-new': 'کارت پروژه جدید',
|
||||||
|
'project-card-detail': 'جزئیات کارت پروژه',
|
||||||
|
loyalty: 'باشگاه مشتریان',
|
||||||
|
gamification: 'باشگاه امتیازات',
|
||||||
|
'gamification-admin': 'مدیریت باشگاه',
|
||||||
|
'deal-new': 'معامله جدید',
|
||||||
|
'deal-detail': 'جزئیات معامله',
|
||||||
|
contacts: 'مشتریان',
|
||||||
|
notes: 'یادداشتها',
|
||||||
|
attachments: 'پیوستها',
|
||||||
|
automations: 'اتوماسیون گردش کار',
|
||||||
|
'message-automations': 'اتوماسیون پیامکها',
|
||||||
|
'lead-stages': 'مراحل و وضعیتها',
|
||||||
|
'pipeline-settings': 'تنظیمات مسیر فروش',
|
||||||
|
'lead-forms': 'فرمساز سرنخ',
|
||||||
|
'lead-form-builder': 'ویرایش فرم لید',
|
||||||
|
'team-settings': 'تیم و نقشها',
|
||||||
|
'audit-logs': 'لاگ فعالیت کاربران',
|
||||||
|
'deletion-archives': 'تاریخچه کارها',
|
||||||
|
'public-api': 'API و وبهوک',
|
||||||
|
'sms-campaigns': 'پیامک گروهی',
|
||||||
|
'sms-campaign-report': 'گزارش پیامک گروهی',
|
||||||
|
'custom-fields': 'فیلدهای سفارشی',
|
||||||
|
products: 'محصولات و خدمات',
|
||||||
|
'product-new': 'محصول جدید',
|
||||||
|
'product-edit': 'ویرایش محصول',
|
||||||
|
currencies: 'ارزها',
|
||||||
|
'tahesab-settings': 'تهحساب',
|
||||||
|
'account-balance-settings': 'مانده حساب',
|
||||||
|
'woocommerce-settings': 'ووکامرس',
|
||||||
|
'montify-settings': 'فروشگاههای مونتیفای',
|
||||||
|
'voip-settings': 'تلفن سازمانی',
|
||||||
|
'faq-settings': 'FAQ',
|
||||||
|
'person-new': 'شخص جدید',
|
||||||
|
'person-edit': 'ویرایش شخص',
|
||||||
|
'person-detail': 'پروفایل شخص',
|
||||||
|
'company-new': 'شرکت جدید',
|
||||||
|
'company-edit': 'ویرایش شرکت',
|
||||||
|
'company-detail': 'پروفایل شرکت',
|
||||||
|
settings: 'تنظیمات',
|
||||||
|
};
|
||||||
|
|
||||||
|
function readStorage(): WorkspaceTab[] {
|
||||||
|
try {
|
||||||
|
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||||
|
if (!raw) return [];
|
||||||
|
const parsed = JSON.parse(raw) as WorkspaceTab[];
|
||||||
|
if (!Array.isArray(parsed)) return [];
|
||||||
|
return parsed.filter(
|
||||||
|
(t) =>
|
||||||
|
t &&
|
||||||
|
typeof t.id === 'string' &&
|
||||||
|
typeof t.fullPath === 'string' &&
|
||||||
|
typeof t.title === 'string',
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeStorage(next: WorkspaceTab[]) {
|
||||||
|
try {
|
||||||
|
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(next));
|
||||||
|
} catch {
|
||||||
|
/* ignore quota */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureHydrated() {
|
||||||
|
if (hydrated.value) return;
|
||||||
|
tabs.value = readStorage();
|
||||||
|
hydrated.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function titleForRoute(route: RouteLocationNormalizedLoaded): string {
|
||||||
|
const metaTitle = route.meta?.title;
|
||||||
|
if (typeof metaTitle === 'string' && metaTitle.trim()) return metaTitle.trim();
|
||||||
|
|
||||||
|
const name = typeof route.name === 'string' ? route.name : '';
|
||||||
|
if (name && ROUTE_TITLES[name]) return ROUTE_TITLES[name];
|
||||||
|
|
||||||
|
for (let i = route.matched.length - 1; i >= 0; i -= 1) {
|
||||||
|
const matchedName = route.matched[i]?.name;
|
||||||
|
if (typeof matchedName === 'string' && ROUTE_TITLES[matchedName]) {
|
||||||
|
return ROUTE_TITLES[matchedName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const leaf = route.path.split('/').filter(Boolean).pop();
|
||||||
|
if (!leaf) return 'صفحه';
|
||||||
|
if (/^\d+$/.test(leaf) || leaf.length > 24) {
|
||||||
|
const parent = route.path.split('/').filter(Boolean).slice(-2, -1)[0];
|
||||||
|
if (parent && ROUTE_TITLES[parent]) return ROUTE_TITLES[parent];
|
||||||
|
}
|
||||||
|
return decodeURIComponent(leaf);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useWorkspaceTabs() {
|
||||||
|
ensureHydrated();
|
||||||
|
|
||||||
|
function syncFromRoute(route: RouteLocationNormalizedLoaded) {
|
||||||
|
if (route.meta?.public) return;
|
||||||
|
const fullPath = route.fullPath;
|
||||||
|
const path = route.path;
|
||||||
|
if (!path || path.startsWith('/login') || path.startsWith('/adm')) return;
|
||||||
|
|
||||||
|
const id = path;
|
||||||
|
const title = titleForRoute(route);
|
||||||
|
const existing = tabs.value.find((t) => t.id === id);
|
||||||
|
if (existing) {
|
||||||
|
let dirty = false;
|
||||||
|
if (existing.fullPath !== fullPath) {
|
||||||
|
existing.fullPath = fullPath;
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
if (existing.title !== title) {
|
||||||
|
existing.title = title;
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
if (dirty) writeStorage(tabs.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const next = [
|
||||||
|
...tabs.value,
|
||||||
|
{
|
||||||
|
id,
|
||||||
|
fullPath,
|
||||||
|
path,
|
||||||
|
title,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
while (next.length > MAX_TABS) next.shift();
|
||||||
|
tabs.value = next;
|
||||||
|
writeStorage(tabs.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function activateTab(id: string, push: (to: string) => void) {
|
||||||
|
const tab = tabs.value.find((t) => t.id === id);
|
||||||
|
if (!tab) return;
|
||||||
|
push(tab.fullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeTab(
|
||||||
|
id: string,
|
||||||
|
currentPath: string,
|
||||||
|
push: (to: string) => void,
|
||||||
|
) {
|
||||||
|
const index = tabs.value.findIndex((t) => t.id === id);
|
||||||
|
if (index < 0) return;
|
||||||
|
const wasActive = currentPath === id;
|
||||||
|
const next = tabs.value.filter((t) => t.id !== id);
|
||||||
|
tabs.value = next;
|
||||||
|
writeStorage(next);
|
||||||
|
if (!wasActive) return;
|
||||||
|
const fallback = next[index] ?? next[index - 1] ?? next[next.length - 1];
|
||||||
|
push(fallback?.fullPath || '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
tabs,
|
||||||
|
syncFromRoute,
|
||||||
|
activateTab,
|
||||||
|
closeTab,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,18 +1,59 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
|
import { VueQueryPlugin } from '@tanstack/vue-query';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
import { brand } from '@mento/shared';
|
import { brand } from '@mento/shared';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import { router } from './router';
|
import { router } from './router';
|
||||||
import { vTableCols } from './lib/tableColumns';
|
import { vTableCols } from './lib/tableColumns';
|
||||||
|
import { queryClient } from './queries/queryClient';
|
||||||
import './styles/fonts.css';
|
import './styles/fonts.css';
|
||||||
import './styles/main.css';
|
import './styles/main.css';
|
||||||
|
|
||||||
|
/** Toast on document.body — App.useApp() holder can silent-no-op in this shell. */
|
||||||
|
message.config({
|
||||||
|
top: '64px',
|
||||||
|
duration: 3,
|
||||||
|
maxCount: 3,
|
||||||
|
rtl: true,
|
||||||
|
getContainer: () => document.body,
|
||||||
|
});
|
||||||
|
|
||||||
document.title = `${brand.nameFa} | ${brand.fullName}`;
|
document.title = `${brand.nameFa} | ${brand.fullName}`;
|
||||||
const favicon = document.querySelector<HTMLLinkElement>('link[rel="icon"]');
|
const favicon = document.querySelector<HTMLLinkElement>('link[rel="icon"]');
|
||||||
if (favicon) favicon.href = brand.logo;
|
if (favicon) favicon.href = brand.logo;
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
app.use(createPinia());
|
app.use(createPinia());
|
||||||
|
app.use(VueQueryPlugin, { queryClient });
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.directive('table-cols', vTableCols);
|
app.directive('table-cols', vTableCols);
|
||||||
|
|
||||||
|
if (import.meta.hot) {
|
||||||
|
// Vue's HMR unmount throws "Cannot destructure property 'type' of 'vnode'"
|
||||||
|
// after the DOM is already removed, and the exception is outside the HMR
|
||||||
|
// try/catch — #app stays empty until a manual refresh. Reload once.
|
||||||
|
let recovering = false;
|
||||||
|
const recoverBlankApp = () => {
|
||||||
|
if (recovering) return;
|
||||||
|
const root = document.getElementById('app');
|
||||||
|
if (!root || root.childElementCount > 0) return;
|
||||||
|
const key = 'mento:blank-recover-at';
|
||||||
|
const last = Number(sessionStorage.getItem(key) || 0);
|
||||||
|
if (Date.now() - last < 8000) return;
|
||||||
|
sessionStorage.setItem(key, String(Date.now()));
|
||||||
|
recovering = true;
|
||||||
|
window.location.reload();
|
||||||
|
};
|
||||||
|
window.addEventListener('error', (event) => {
|
||||||
|
const message = event.message || '';
|
||||||
|
if (message.includes('vnode') || message.includes('unmount')) {
|
||||||
|
queueMicrotask(recoverBlankApp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
import.meta.hot.on('vite:afterUpdate', () => {
|
||||||
|
setTimeout(recoverBlankApp, 80);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import type {
|
||||||
|
ActivityBoardDto,
|
||||||
|
ActivityDto,
|
||||||
|
ActivityStageCountsDto,
|
||||||
|
ActivityStageDto,
|
||||||
|
PaginatedResponse,
|
||||||
|
} from '@mento/shared';
|
||||||
|
import { api } from '@/lib/api';
|
||||||
|
import { activityKeys } from '@/queries/keys';
|
||||||
|
import { queryClient } from '@/queries/queryClient';
|
||||||
|
|
||||||
|
export async function fetchActivityBoards(): Promise<ActivityBoardDto[]> {
|
||||||
|
const { data } = await api.get<ActivityBoardDto[]>('/activities/boards');
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchActivityStages(
|
||||||
|
boardId: string | undefined,
|
||||||
|
): Promise<ActivityStageDto[]> {
|
||||||
|
const { data } = await api.get<ActivityStageDto[]>('/activities/stages', {
|
||||||
|
params: { boardId: boardId || undefined },
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchActivityList(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<PaginatedResponse<ActivityDto>> {
|
||||||
|
const { data } = await api.get<PaginatedResponse<ActivityDto>>('/activities', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchActivityStageCounts(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<ActivityStageCountsDto> {
|
||||||
|
const { data } = await api.get<ActivityStageCountsDto>('/activities/stage-counts', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Time-tab badge totals (limit=1 per filter key). */
|
||||||
|
export async function fetchActivityTimeCounts(
|
||||||
|
base: Record<string, unknown>,
|
||||||
|
timeKeys: string[],
|
||||||
|
stageId: string,
|
||||||
|
): Promise<Record<string, number>> {
|
||||||
|
const results = await Promise.all(
|
||||||
|
timeKeys.map((key) =>
|
||||||
|
api.get<PaginatedResponse<ActivityDto>>('/activities', {
|
||||||
|
params: { ...base, filter: key, stageId, limit: 1 },
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const next: Record<string, number> = {};
|
||||||
|
timeKeys.forEach((key, i) => {
|
||||||
|
next[key] = results[i]?.data.total ?? 0;
|
||||||
|
});
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function invalidateActivityQueries() {
|
||||||
|
return queryClient.invalidateQueries({ queryKey: activityKeys.all });
|
||||||
|
}
|
||||||
|
|
||||||
|
export function invalidateActivityBoards() {
|
||||||
|
return queryClient.invalidateQueries({ queryKey: activityKeys.boards() });
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import type {
|
||||||
|
CompanyDto,
|
||||||
|
CustomerGroupDto,
|
||||||
|
PaginatedResponse,
|
||||||
|
PersonDto,
|
||||||
|
PersonImportSourceStatDto,
|
||||||
|
} from '@mento/shared';
|
||||||
|
import { api } from '@/lib/api';
|
||||||
|
import { contactKeys } from '@/queries/keys';
|
||||||
|
import { queryClient } from '@/queries/queryClient';
|
||||||
|
|
||||||
|
export async function fetchPeople(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<PaginatedResponse<PersonDto>> {
|
||||||
|
const { data } = await api.get<PaginatedResponse<PersonDto>>('/people', { params });
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchCompanies(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<PaginatedResponse<CompanyDto>> {
|
||||||
|
const { data } = await api.get<PaginatedResponse<CompanyDto>>('/companies', { params });
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchPeopleSourceStats(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<PersonImportSourceStatDto[]> {
|
||||||
|
try {
|
||||||
|
const { data } = await api.get<PersonImportSourceStatDto[]>('/people/source-stats', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchPeopleGroupStats(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<CustomerGroupDto[]> {
|
||||||
|
try {
|
||||||
|
const { data } = await api.get<CustomerGroupDto[]>('/people/group-stats', { params });
|
||||||
|
return data;
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchCompanyGroupStats(
|
||||||
|
params: Record<string, unknown>,
|
||||||
|
): Promise<CustomerGroupDto[]> {
|
||||||
|
try {
|
||||||
|
const { data } = await api.get<CustomerGroupDto[]>('/companies/group-stats', { params });
|
||||||
|
return data;
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function invalidateContactQueries() {
|
||||||
|
return queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/** Hierarchical TanStack Query keys for CRM server state. */
|
||||||
|
|
||||||
|
export const userKeys = {
|
||||||
|
all: ['users'] as const,
|
||||||
|
org: () => [...userKeys.all, 'org'] as const,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const activityTypeKeys = {
|
||||||
|
all: ['activity-types'] as const,
|
||||||
|
list: () => [...activityTypeKeys.all, 'list'] as const,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const activityPriorityKeys = {
|
||||||
|
all: ['activity-priorities'] as const,
|
||||||
|
list: () => [...activityPriorityKeys.all, 'list'] as const,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const customerGroupKeys = {
|
||||||
|
all: ['customer-groups'] as const,
|
||||||
|
list: () => [...customerGroupKeys.all, 'list'] as const,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const activityKeys = {
|
||||||
|
all: ['activities'] as const,
|
||||||
|
boards: () => [...activityKeys.all, 'boards'] as const,
|
||||||
|
stages: (boardId: string | undefined) =>
|
||||||
|
[...activityKeys.all, 'stages', boardId ?? ''] as const,
|
||||||
|
list: (params: Record<string, unknown>) =>
|
||||||
|
[...activityKeys.all, 'list', params] as const,
|
||||||
|
counts: (params: Record<string, unknown>) =>
|
||||||
|
[...activityKeys.all, 'counts', params] as const,
|
||||||
|
stageCounts: (params: Record<string, unknown>) =>
|
||||||
|
[...activityKeys.all, 'stage-counts', params] as const,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const contactKeys = {
|
||||||
|
all: ['contacts'] as const,
|
||||||
|
people: (params: Record<string, unknown>) =>
|
||||||
|
[...contactKeys.all, 'people', params] as const,
|
||||||
|
companies: (params: Record<string, unknown>) =>
|
||||||
|
[...contactKeys.all, 'companies', params] as const,
|
||||||
|
peopleSourceStats: (params: Record<string, unknown>) =>
|
||||||
|
[...contactKeys.all, 'people-source-stats', params] as const,
|
||||||
|
peopleGroupStats: (params: Record<string, unknown>) =>
|
||||||
|
[...contactKeys.all, 'people-group-stats', params] as const,
|
||||||
|
companyGroupStats: (params: Record<string, unknown>) =>
|
||||||
|
[...contactKeys.all, 'company-group-stats', params] as const,
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { QueryClient } from '@tanstack/vue-query';
|
||||||
|
|
||||||
|
/** Shared QueryClient — used by VueQueryPlugin and for clear/invalidate outside setup. */
|
||||||
|
export const queryClient = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
staleTime: 30_000,
|
||||||
|
retry: 1,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { computed, unref, type MaybeRef } from 'vue';
|
||||||
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
|
import type { OrgUserDto } from '@mento/shared';
|
||||||
|
import { api } from '@/lib/api';
|
||||||
|
import { userKeys } from '@/queries/keys';
|
||||||
|
|
||||||
|
const REF_STALE_MS = 5 * 60_000;
|
||||||
|
|
||||||
|
async function fetchOrgUsers(): Promise<OrgUserDto[]> {
|
||||||
|
const { data } = await api.get<OrgUserDto[]>('/users');
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Org members list — shared across assign pickers and desk tabs. */
|
||||||
|
export function useOrgUsersQuery(options?: {
|
||||||
|
enabled?: MaybeRef<boolean>;
|
||||||
|
/** When true (default), only users with isActive !== false. */
|
||||||
|
activeOnly?: boolean;
|
||||||
|
}) {
|
||||||
|
const enabled = computed(() => unref(options?.enabled) ?? true);
|
||||||
|
const activeOnly = options?.activeOnly !== false;
|
||||||
|
|
||||||
|
const query = useQuery({
|
||||||
|
queryKey: userKeys.org(),
|
||||||
|
queryFn: fetchOrgUsers,
|
||||||
|
staleTime: REF_STALE_MS,
|
||||||
|
enabled,
|
||||||
|
});
|
||||||
|
|
||||||
|
const users = computed(() => {
|
||||||
|
const rows = query.data.value ?? [];
|
||||||
|
return activeOnly ? rows.filter((u) => u.isActive !== false) : rows;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
...query,
|
||||||
|
users,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import type {
|
|||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
import { isLoginOrganizationChoice } from '@mento/shared';
|
import { isLoginOrganizationChoice } from '@mento/shared';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { queryClient } from '@/queries/queryClient';
|
||||||
|
|
||||||
const TOKEN_KEY = 'mento_token';
|
const TOKEN_KEY = 'mento_token';
|
||||||
const USER_KEY = 'mento_user';
|
const USER_KEY = 'mento_user';
|
||||||
@@ -74,7 +75,16 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearServerStateCache() {
|
||||||
|
queryClient.clear();
|
||||||
|
}
|
||||||
|
|
||||||
function persist(payload: LoginResponse) {
|
function persist(payload: LoginResponse) {
|
||||||
|
const prevOrgId = user.value?.organizationId;
|
||||||
|
const nextOrgId = payload.user.organizationId;
|
||||||
|
if (prevOrgId && nextOrgId && prevOrgId !== nextOrgId) {
|
||||||
|
clearServerStateCache();
|
||||||
|
}
|
||||||
token.value = payload.accessToken;
|
token.value = payload.accessToken;
|
||||||
user.value = payload.user;
|
user.value = payload.user;
|
||||||
localStorage.setItem(TOKEN_KEY, payload.accessToken);
|
localStorage.setItem(TOKEN_KEY, payload.accessToken);
|
||||||
@@ -169,6 +179,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
localStorage.removeItem(TOKEN_KEY);
|
localStorage.removeItem(TOKEN_KEY);
|
||||||
localStorage.removeItem(USER_KEY);
|
localStorage.removeItem(USER_KEY);
|
||||||
clearLegacy();
|
clearLegacy();
|
||||||
|
clearServerStateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUser(next: AuthUserDto) {
|
function setUser(next: AuthUserDto) {
|
||||||
|
|||||||
@@ -49,22 +49,27 @@
|
|||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
/* 900 → Bold too: Black is a display cut and reads as shouting in UI chrome */
|
||||||
font-family: "IRANSans";
|
|
||||||
src:
|
|
||||||
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Black.woff2") format("woff2"),
|
|
||||||
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Black.woff") format("woff");
|
|
||||||
font-weight: 900;
|
|
||||||
font-style: normal;
|
|
||||||
font-display: swap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* map common 600 → Bold so font-weight:600 works */
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "IRANSans";
|
font-family: "IRANSans";
|
||||||
src:
|
src:
|
||||||
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
|
||||||
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff");
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff");
|
||||||
|
font-weight: 900;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRANSans has no semibold cut. 600 is Ant's fontWeightStrong (table heads,
|
||||||
|
* titles, <strong>, active items) and the most used weight in the app, so it
|
||||||
|
* maps to Medium; mapping it to Bold made the whole UI look heavy.
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Medium.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Medium.woff") format("woff");
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
|
|||||||
@@ -150,13 +150,28 @@ body,
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ant Message portals to body; keep above shell chrome (header/sidebar/modals). */
|
||||||
|
.ant-message {
|
||||||
|
z-index: 11000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: var(--font);
|
font-family: var(--font);
|
||||||
|
/* match Ant's 14px base; without it plain markup inherited the browser's 16px */
|
||||||
|
font-size: var(--fs-base);
|
||||||
|
line-height: var(--lh-normal);
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* UA default is `bold` (700 → IRANSans Bold); emphasis in UI should be semibold */
|
||||||
|
strong,
|
||||||
|
b,
|
||||||
|
th {
|
||||||
|
font-weight: var(--fw-semibold);
|
||||||
|
}
|
||||||
|
|
||||||
img,
|
img,
|
||||||
svg,
|
svg,
|
||||||
video,
|
video,
|
||||||
|
|||||||
@@ -15,8 +15,28 @@ const GRAY_200 = '#e5e7eb';
|
|||||||
export const antdTheme = {
|
export const antdTheme = {
|
||||||
token: {
|
token: {
|
||||||
colorPrimary: '#10897d',
|
colorPrimary: '#10897d',
|
||||||
|
/**
|
||||||
|
* Ant's generated tint for #10897d is a muddy grey-green; pin the light
|
||||||
|
* brand tints (main.css --accent-subtle / --accent-soft) for selected items.
|
||||||
|
*/
|
||||||
|
colorPrimaryBg: '#eef8f7',
|
||||||
|
colorPrimaryBgHover: '#d0ebe8',
|
||||||
|
controlItemBgActive: '#eef8f7',
|
||||||
|
controlItemBgActiveHover: '#e2f3f1',
|
||||||
fontFamily: '"IRANSans", Tahoma, sans-serif',
|
fontFamily: '"IRANSans", Tahoma, sans-serif',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ant's default heading scale (38/30/24/20/16) is sized for Latin
|
||||||
|
* marketing pages; IRANSans runs large, so page titles (level 3) were 24px.
|
||||||
|
* Compact app scale: page title 20, section 16, card title 14.
|
||||||
|
*/
|
||||||
|
fontSizeHeading1: 28,
|
||||||
|
fontSizeHeading2: 24,
|
||||||
|
fontSizeHeading3: 20,
|
||||||
|
fontSizeHeading4: 16,
|
||||||
|
fontSizeHeading5: 14,
|
||||||
|
fontWeightStrong: 600,
|
||||||
|
|
||||||
/** Page / subtle surface fill */
|
/** Page / subtle surface fill */
|
||||||
colorBgLayout: GRAY_50,
|
colorBgLayout: GRAY_50,
|
||||||
colorFillQuaternary: GRAY_50,
|
colorFillQuaternary: GRAY_50,
|
||||||
@@ -78,6 +98,10 @@ export const antdTheme = {
|
|||||||
},
|
},
|
||||||
Select: {
|
Select: {
|
||||||
colorBorder: GRAY_200,
|
colorBorder: GRAY_200,
|
||||||
|
optionSelectedBg: '#eef8f7',
|
||||||
|
optionSelectedColor: '#0a5c54',
|
||||||
|
optionSelectedFontWeight: 600,
|
||||||
|
optionPadding: '7px 12px',
|
||||||
},
|
},
|
||||||
Form: {
|
Form: {
|
||||||
itemMarginBottom: 18,
|
itemMarginBottom: 18,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { computed, onMounted, ref, watch } from 'vue';
|
|||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
|
||||||
import type { ActivityDto, PaginatedResponse } from '@mento/shared';
|
import type { ActivityDto, PaginatedResponse } from '@mento/shared';
|
||||||
import {
|
import {
|
||||||
addJalaliMonths,
|
addJalaliMonths,
|
||||||
@@ -15,6 +14,8 @@ import {
|
|||||||
jalaliToDate,
|
jalaliToDate,
|
||||||
toFaDigits,
|
toFaDigits,
|
||||||
} from '@/lib/jalali';
|
} from '@/lib/jalali';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { CalendarOutlined, UnorderedListOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -257,30 +258,19 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<nav class="crumbs" aria-label="مسیر">
|
<PageHeader
|
||||||
<RouterLink :to="{ name: 'home' }">خانه</RouterLink>
|
title="تقویم فعالیتها"
|
||||||
<span>‹</span>
|
subtitle="نمای ماهانه شمسی موعد تماس، جلسه و وظیفه."
|
||||||
<RouterLink :to="{ name: 'activities' }">فعالیتها</RouterLink>
|
:icon="CalendarOutlined"
|
||||||
<span>‹</span>
|
primary-label="فعالیت جدید"
|
||||||
<span>تقویم</span>
|
:view-options="[
|
||||||
</nav>
|
{ value: 'list', label: 'لیست', icon: UnorderedListOutlined },
|
||||||
|
{ value: 'calendar', label: 'تقویم', icon: CalendarOutlined },
|
||||||
<header class="page-head">
|
]"
|
||||||
<div class="head-copy">
|
view="calendar"
|
||||||
<h1>تقویم فعالیتها</h1>
|
@primary="router.push(newForSelected())"
|
||||||
<p class="lead">نمای ماهانه شمسی موعد تماس، جلسه و وظیفه.</p>
|
@update:view="(v) => { if (v === 'list') void router.push({ name: 'activities' }) }"
|
||||||
</div>
|
/>
|
||||||
<div class="head-actions">
|
|
||||||
<RouterLink class="btn ghost" :to="{ name: 'activities' }">
|
|
||||||
<UiIcon name="list" :size="18" />
|
|
||||||
لیست
|
|
||||||
</RouterLink>
|
|
||||||
<RouterLink class="btn primary" :to="newForSelected()">
|
|
||||||
<span>+</span>
|
|
||||||
فعالیت جدید
|
|
||||||
</RouterLink>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<button class="btn ghost nav-btn" type="button" @click="goMonth(-1)">ماه قبل</button>
|
<button class="btn ghost nav-btn" type="button" @click="goMonth(-1)">ماه قبل</button>
|
||||||
@@ -366,48 +356,6 @@ onMounted(() => {
|
|||||||
overflow-x: clip;
|
overflow-x: clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
.crumbs {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 0.35rem;
|
|
||||||
align-items: center;
|
|
||||||
color: #94a3b8;
|
|
||||||
font-size: 0.78rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.crumbs a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.crumbs a:hover {
|
|
||||||
color: #0f766e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-head {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 1rem;
|
|
||||||
align-items: flex-start;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-copy {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.55rem;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0 0 0.3rem;
|
|
||||||
font-size: clamp(1.45rem, 2.5vw, 1.85rem);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
@@ -650,26 +598,10 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.crumbs {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout {
|
.layout {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-actions {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-actions .btn {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.day {
|
.day {
|
||||||
min-height: 68px;
|
min-height: 68px;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1199,21 +1199,23 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<header class="nav">
|
<PageHeader
|
||||||
<a class="icon-btn back" href="/activities" aria-label="بازگشت" @click.prevent="goBack">
|
title="جزئیات فعالیت"
|
||||||
<UiIcon name="chevron" :size="18" />
|
:subtitle="activity?.title"
|
||||||
</a>
|
:icon="ScheduleOutlined"
|
||||||
<h1>جزئیات فعالیت</h1>
|
backable
|
||||||
<nav v-if="showNav" class="neighbors" aria-label="فعالیتهای همین فهرست">
|
@back="goBack"
|
||||||
<button type="button" class="neighbor" :disabled="!prevNavId" @click="goNeighbor(prevNavId)">
|
>
|
||||||
قبلی
|
<template v-if="showNav" #actions>
|
||||||
</button>
|
<a-space :size="4" aria-label="فعالیتهای همین فهرست">
|
||||||
<span>{{ toFaDigits(navIndex + 1) }} از {{ toFaDigits(navIds.length) }}</span>
|
<a-button type="text" :disabled="!prevNavId" @click="goNeighbor(prevNavId)">قبلی</a-button>
|
||||||
<button type="button" class="neighbor" :disabled="!nextNavId" @click="goNeighbor(nextNavId)">
|
<a-typography-text type="secondary">
|
||||||
بعدی
|
{{ toFaDigits(navIndex + 1) }} از {{ toFaDigits(navIds.length) }}
|
||||||
</button>
|
</a-typography-text>
|
||||||
</nav>
|
<a-button type="text" :disabled="!nextNavId" @click="goNeighbor(nextNavId)">بعدی</a-button>
|
||||||
</header>
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
<p v-if="loading && !activity" class="muted">در حال بارگذاری…</p>
|
<p v-if="loading && !activity" class="muted">در حال بارگذاری…</p>
|
||||||
<p v-else-if="error && !activity" class="error">{{ error }}</p>
|
<p v-else-if="error && !activity" class="error">{{ error }}</p>
|
||||||
|
|
||||||
@@ -1245,9 +1247,6 @@ onUnmounted(() => {
|
|||||||
#{{ t }}
|
#{{ t }}
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="activity.accountBalance" class="claim-balances">
|
|
||||||
<ActivityAccountBalances :balance="activity.accountBalance" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="type-ico" :style="typeColorStyle(draftTypeView!.color)">
|
<span class="type-ico" :style="typeColorStyle(draftTypeView!.color)">
|
||||||
<UiIcon :name="draftTypeView!.icon" :size="22" />
|
<UiIcon :name="draftTypeView!.icon" :size="22" />
|
||||||
@@ -1698,11 +1697,7 @@ onUnmounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<ul v-if="entry.media.some((image) => image.kind === 'file')" class="note-files">
|
<ul v-if="entry.media.some((image) => image.kind === 'file')" class="note-files">
|
||||||
<li v-for="image in entry.media.filter((item) => item.kind === 'file')" :key="image.id">
|
<li v-for="image in entry.media.filter((item) => item.kind === 'file')" :key="image.id">
|
||||||
<span class="note-file-name">{{ image.name }}</span>
|
<a :href="image.url" :download="image.name">{{ image.name }}</a>
|
||||||
<span class="note-file-actions">
|
|
||||||
<button type="button" class="note-file-btn" @click="viewMedia(image)">مشاهده</button>
|
|
||||||
<button type="button" class="note-file-btn" @click="downloadMedia(image)">دانلود</button>
|
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
@@ -1785,11 +1780,7 @@ onUnmounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<ul v-if="looseMedia.some((image) => image.kind === 'file')" class="note-files">
|
<ul v-if="looseMedia.some((image) => image.kind === 'file')" class="note-files">
|
||||||
<li v-for="image in looseMedia.filter((item) => item.kind === 'file')" :key="image.id">
|
<li v-for="image in looseMedia.filter((item) => item.kind === 'file')" :key="image.id">
|
||||||
<span class="note-file-name">{{ image.name }}</span>
|
<a :href="image.url" :download="image.name">{{ image.name }}</a>
|
||||||
<span class="note-file-actions">
|
|
||||||
<button type="button" class="note-file-btn" @click="viewMedia(image)">مشاهده</button>
|
|
||||||
<button type="button" class="note-file-btn" @click="downloadMedia(image)">دانلود</button>
|
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -1885,77 +1876,6 @@ onUnmounted(() => {
|
|||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.45rem;
|
|
||||||
min-height: 32px;
|
|
||||||
/* زیر هدر دسکتاپ اپ (۱۶ + control + ۱۶) بماند تا با اسکرول در دسترس باشد */
|
|
||||||
position: sticky;
|
|
||||||
top: calc(16px + var(--control-h) + 16px);
|
|
||||||
z-index: 15;
|
|
||||||
margin-inline: -16px;
|
|
||||||
padding: 0.4rem 16px;
|
|
||||||
background: color-mix(in srgb, var(--bg, #f8fafc) 92%, transparent);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
-webkit-backdrop-filter: blur(10px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.2;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-btn {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border: 0;
|
|
||||||
background: transparent;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
color: #334155;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back :deep(.ico) {
|
|
||||||
transform: scaleX(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.neighbors {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.15rem;
|
|
||||||
margin-inline-start: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.neighbors span {
|
|
||||||
color: #64748b;
|
|
||||||
font-size: 0.78rem;
|
|
||||||
font-weight: 600;
|
|
||||||
padding-inline: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.neighbor {
|
|
||||||
border: 0;
|
|
||||||
background: transparent;
|
|
||||||
color: #0f766e;
|
|
||||||
font: inherit;
|
|
||||||
font-size: 0.82rem;
|
|
||||||
font-weight: 700;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
padding: 0.2rem 0.45rem;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.neighbor:disabled {
|
|
||||||
color: #94a3b8;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.muted,
|
.muted,
|
||||||
.error {
|
.error {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -2048,10 +1968,6 @@ onUnmounted(() => {
|
|||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.claim-balances {
|
|
||||||
margin-top: 0.65rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
background: #f0fdfa;
|
background: #f0fdfa;
|
||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
@@ -2150,10 +2066,6 @@ onUnmounted(() => {
|
|||||||
.meta {
|
.meta {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dt,
|
dt,
|
||||||
@@ -2731,35 +2643,8 @@ dd {
|
|||||||
gap: 0.35rem;
|
gap: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-files li {
|
.note-files a {
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-file-name {
|
|
||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
font-weight: 600;
|
|
||||||
word-break: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-file-actions {
|
|
||||||
display: inline-flex;
|
|
||||||
gap: 0.35rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-file-btn {
|
|
||||||
border: 1px solid #99f6e4;
|
|
||||||
background: #fff;
|
|
||||||
color: #0f766e;
|
|
||||||
border-radius: 0.45rem;
|
|
||||||
font: inherit;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
font-weight: 700;
|
|
||||||
padding: 0.2rem 0.55rem;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dock {
|
.dock {
|
||||||
@@ -2797,13 +2682,6 @@ dd {
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.nav {
|
|
||||||
/* زیر هدر موبایل اپ (۰٫۷۵rem + control + ۰٫۷۵rem) */
|
|
||||||
top: calc(0.75rem + var(--control-h) + 0.75rem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 899px) {
|
@media (max-width: 899px) {
|
||||||
.page {
|
.page {
|
||||||
padding-bottom: calc(1rem + var(--mobile-tabbar-h));
|
padding-bottom: calc(1rem + var(--mobile-tabbar-h));
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
|
import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { canAssignToOthers } from '@/lib/assign-access';
|
import { canAssignToOthers } from '@/lib/assign-access';
|
||||||
import {
|
import {
|
||||||
@@ -71,6 +71,7 @@ const emit = defineEmits<{ saved: []; cancel: [] }>();
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const id = computed(() => {
|
const id = computed(() => {
|
||||||
if (props.embedded) return props.entityId ?? '';
|
if (props.embedded) return props.entityId ?? '';
|
||||||
@@ -820,9 +821,14 @@ function removePendingPhoto(localId: string) {
|
|||||||
async function removeSavedPhoto(photo: SavedPhoto) {
|
async function removeSavedPhoto(photo: SavedPhoto) {
|
||||||
const activityId = id.value || createdActivityId.value;
|
const activityId = id.value || createdActivityId.value;
|
||||||
if (!activityId) return;
|
if (!activityId) return;
|
||||||
await api.delete(`/activities/${activityId}/images/${photo.id}`);
|
try {
|
||||||
if (photo.previewUrl.startsWith('blob:')) URL.revokeObjectURL(photo.previewUrl);
|
await api.delete(`/activities/${activityId}/images/${photo.id}`);
|
||||||
savedPhotos.value = savedPhotos.value.filter((item) => item.id !== photo.id);
|
if (photo.previewUrl.startsWith('blob:')) URL.revokeObjectURL(photo.previewUrl);
|
||||||
|
savedPhotos.value = savedPhotos.value.filter((item) => item.id !== photo.id);
|
||||||
|
feedback.success('تصویر حذف شد.');
|
||||||
|
} catch (e) {
|
||||||
|
feedback.fromError(e, 'حذف تصویر ناموفق بود.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatVoiceClock(total: number) {
|
function formatVoiceClock(total: number) {
|
||||||
@@ -896,9 +902,14 @@ function removePendingVoice(localId: string) {
|
|||||||
async function removeSavedVoice(voice: SavedVoice) {
|
async function removeSavedVoice(voice: SavedVoice) {
|
||||||
const activityId = id.value || createdActivityId.value;
|
const activityId = id.value || createdActivityId.value;
|
||||||
if (!activityId) return;
|
if (!activityId) return;
|
||||||
await api.delete(`/activities/${activityId}/images/${voice.id}`);
|
try {
|
||||||
if (voice.previewUrl.startsWith('blob:')) URL.revokeObjectURL(voice.previewUrl);
|
await api.delete(`/activities/${activityId}/images/${voice.id}`);
|
||||||
savedVoices.value = savedVoices.value.filter((item) => item.id !== voice.id);
|
if (voice.previewUrl.startsWith('blob:')) URL.revokeObjectURL(voice.previewUrl);
|
||||||
|
savedVoices.value = savedVoices.value.filter((item) => item.id !== voice.id);
|
||||||
|
feedback.success('صوت حذف شد.');
|
||||||
|
} catch (e) {
|
||||||
|
feedback.fromError(e, 'حذف صوت ناموفق بود.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removePendingFile(localId: string) {
|
function removePendingFile(localId: string) {
|
||||||
@@ -908,8 +919,13 @@ function removePendingFile(localId: string) {
|
|||||||
async function removeSavedFile(file: SavedFile) {
|
async function removeSavedFile(file: SavedFile) {
|
||||||
const activityId = id.value || createdActivityId.value;
|
const activityId = id.value || createdActivityId.value;
|
||||||
if (!activityId) return;
|
if (!activityId) return;
|
||||||
await api.delete(`/activities/${activityId}/images/${file.id}`);
|
try {
|
||||||
savedFiles.value = savedFiles.value.filter((item) => item.id !== file.id);
|
await api.delete(`/activities/${activityId}/images/${file.id}`);
|
||||||
|
savedFiles.value = savedFiles.value.filter((item) => item.id !== file.id);
|
||||||
|
feedback.success('فایل حذف شد.');
|
||||||
|
} catch (e) {
|
||||||
|
feedback.fromError(e, 'حذف فایل ناموفق بود.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadPendingFiles(activityId: string) {
|
async function uploadPendingFiles(activityId: string) {
|
||||||
@@ -1018,6 +1034,7 @@ async function submit(next: 'detail' | 'new' = 'detail') {
|
|||||||
await uploadPendingPhotos(savedId);
|
await uploadPendingPhotos(savedId);
|
||||||
await uploadPendingVoices(savedId);
|
await uploadPendingVoices(savedId);
|
||||||
await uploadPendingFiles(savedId);
|
await uploadPendingFiles(savedId);
|
||||||
|
feedback.success('فعالیت ذخیره شد.');
|
||||||
if (props.embedded) {
|
if (props.embedded) {
|
||||||
emit('saved');
|
emit('saved');
|
||||||
return;
|
return;
|
||||||
@@ -1031,15 +1048,7 @@ async function submit(next: 'detail' | 'new' = 'detail') {
|
|||||||
}
|
}
|
||||||
await router.replace({ name: 'activity-detail', params: { id: savedId } });
|
await router.replace({ name: 'activity-detail', params: { id: savedId } });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'ذخیره ناموفق بود');
|
||||||
if (!e.response) error.value = 'اتصال به سرور برقرار نشد.';
|
|
||||||
else {
|
|
||||||
const msg = (e.response.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg) ? msg.join('، ') : (msg ?? 'ذخیره ناموفق بود');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error.value = 'ذخیره ناموفق بود';
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import type { TableColumnsType } from 'ant-design-vue';
|
|||||||
import { DownloadOutlined } from '@/icons/ant-bridge';
|
import { DownloadOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Link: ATypographyLink } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { PaperClipOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Link: ATypographyLink } = Typography;
|
||||||
|
|
||||||
type Row = NoteAttachmentDto & {
|
type Row = NoteAttachmentDto & {
|
||||||
noteId: string;
|
noteId: string;
|
||||||
@@ -105,7 +107,12 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">پیوستها</a-typography-title>
|
<PageHeader
|
||||||
|
title="پیوستها"
|
||||||
|
subtitle="فایلهای پیوستشده به یادداشتها"
|
||||||
|
:icon="PaperClipOutlined"
|
||||||
|
:count="loading ? undefined : items.length"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ import {
|
|||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
Space as ASpace,
|
||||||
Table as ATable,
|
Table as ATable,
|
||||||
Tabs as ATabs,
|
|
||||||
TabPane as ATabPane,
|
|
||||||
Tag as ATag,
|
Tag as ATag,
|
||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
@@ -40,7 +38,9 @@ import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
|||||||
import type { TableColumnsType } from 'ant-design-vue';
|
import type { TableColumnsType } from 'ant-design-vue';
|
||||||
import { ReloadOutlined } from '@/icons/ant-bridge';
|
import { ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { HistoryOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
type LogTab = 'all' | 'creates' | 'edits' | 'deletes' | 'attendance';
|
type LogTab = 'all' | 'creates' | 'edits' | 'deletes' | 'attendance';
|
||||||
|
|
||||||
@@ -454,17 +454,20 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">لاگ فعالیت کاربران</a-typography-title>
|
title="لاگ فعالیت کاربران"
|
||||||
<a-button :disabled="loading" @click="load()">
|
subtitle="چه کسی، چه زمانی، چه تغییری داده است"
|
||||||
<template #icon><ReloadOutlined /></template>
|
:icon="HistoryOutlined"
|
||||||
بروزرسانی
|
:tabs="visibleTabs.map((item) => ({ key: item.key, label: item.label }))"
|
||||||
</a-button>
|
:active-tab="tab"
|
||||||
</a-flex>
|
@update:active-tab="(k) => selectTab(k ?? 'all')"
|
||||||
|
>
|
||||||
<a-tabs :active-key="tab" @change="selectTab">
|
<template #actions>
|
||||||
<a-tab-pane v-for="item in visibleTabs" :key="item.key" :tab="item.label" />
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load()">
|
||||||
</a-tabs>
|
<template #icon><ReloadOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-card v-if="showingArchive" :bordered="false">
|
<a-card v-if="showingArchive" :bordered="false">
|
||||||
<a-form layout="vertical">
|
<a-form layout="vertical">
|
||||||
|
|||||||
@@ -56,9 +56,11 @@ import {
|
|||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ThunderboltOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
const { token } = theme.useToken();
|
const { token } = theme.useToken();
|
||||||
|
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
@@ -587,12 +589,17 @@ watch(trigger, (next, prev) => {
|
|||||||
:gap="token.margin"
|
:gap="token.margin"
|
||||||
:style="{ flex: 1, minHeight: 0, height: '100%' }"
|
:style="{ flex: 1, minHeight: 0, height: '100%' }"
|
||||||
>
|
>
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">اتوماسیون</a-typography-title>
|
title="اتوماسیون"
|
||||||
<a-space wrap>
|
subtitle="قانونهایی که با رخدادهای CRM خودکار اجرا میشوند"
|
||||||
<a-button :disabled="loading" @click="load">
|
:icon="ThunderboltOutlined"
|
||||||
|
primary-label="قانون جدید"
|
||||||
|
:style="{ flex: '0 0 auto' }"
|
||||||
|
@primary="openCreateModal"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
<template #icon><ReloadOutlined /></template>
|
<template #icon><ReloadOutlined /></template>
|
||||||
بروزرسانی
|
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
v-if="editingId"
|
v-if="editingId"
|
||||||
@@ -604,12 +611,8 @@ watch(trigger, (next, prev) => {
|
|||||||
>
|
>
|
||||||
ذخیره قانون
|
ذخیره قانون
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" @click="openCreateModal">
|
</template>
|
||||||
<template #icon><PlusOutlined /></template>
|
</PageHeader>
|
||||||
قانون جدید
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -31,19 +31,17 @@ import {
|
|||||||
Modal as AModal,
|
Modal as AModal,
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
|
||||||
Table as ATable,
|
Table as ATable,
|
||||||
TabPane as ATabPane,
|
|
||||||
Tabs as ATabs,
|
|
||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
import type { TableColumnsType } from 'ant-design-vue';
|
import type { TableColumnsType } from 'ant-design-vue';
|
||||||
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
import { ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { CreditCardOutlined } from '@/icons/ant-bridge';
|
||||||
const {
|
const {
|
||||||
Title: ATypographyTitle,
|
|
||||||
Text: ATypographyText,
|
Text: ATypographyText,
|
||||||
Link: ATypographyLink,
|
Link: ATypographyLink,
|
||||||
Paragraph: ATypographyParagraph,
|
Paragraph: ATypographyParagraph,
|
||||||
@@ -350,26 +348,25 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">چکها</a-typography-title>
|
title="چکها"
|
||||||
<a-space wrap :size="8">
|
subtitle="چکهای دریافتی و پرداختی و وضعیت وصول"
|
||||||
<a-button type="primary" @click="openForm('in')">
|
:icon="CreditCardOutlined"
|
||||||
<template #icon><PlusOutlined /></template>
|
primary-label="دریافت چک"
|
||||||
دریافت چک
|
:tabs="[{ key: 'in', label: 'دریافتی' }, { key: 'out', label: 'پرداختی' }]"
|
||||||
|
:active-tab="tab"
|
||||||
|
@primary="openForm('in')"
|
||||||
|
@update:active-tab="(k) => onTabChange(k ?? 'in')"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button @click="openForm('out')">پرداخت چک</a-button>
|
<a-button @click="openForm('out')">پرداخت چک</a-button>
|
||||||
<a-button :disabled="loading" @click="load">
|
</template>
|
||||||
<template #icon><ReloadOutlined /></template>
|
</PageHeader>
|
||||||
بروزرسانی
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<a-tabs :active-key="tab" @change="onTabChange">
|
|
||||||
<a-tab-pane key="in" tab="دریافتی" />
|
|
||||||
<a-tab-pane key="out" tab="پرداختی" />
|
|
||||||
</a-tabs>
|
|
||||||
|
|
||||||
<a-form layout="vertical" @finish="load">
|
<a-form layout="vertical" @finish="load">
|
||||||
<a-row :gutter="[16, 0]" align="bottom">
|
<a-row :gutter="[16, 0]" align="bottom">
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ import {
|
|||||||
import type { CommissionEntryDto } from '@mento/shared';
|
import type { CommissionEntryDto } from '@mento/shared';
|
||||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
const { Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||||
|
|
||||||
const COMMISSION_COL_LABELS = [
|
const COMMISSION_COL_LABELS = [
|
||||||
'کارشناس فروش',
|
'کارشناس فروش',
|
||||||
@@ -111,15 +112,17 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<div>
|
title="پورسانت فروش"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">پورسانت فروش</a-typography-title>
|
subtitle="پورسانت کارشناسان از فاکتورهای تأییدشده"
|
||||||
</div>
|
:icon="WalletOutlined"
|
||||||
<a-button :disabled="loading" :loading="loading" @click="load">
|
>
|
||||||
<template #icon><ReloadOutlined /></template>
|
<template #actions>
|
||||||
بروزرسانی
|
<a-button :disabled="loading" :loading="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
</a-button>
|
<template #icon><ReloadOutlined /></template>
|
||||||
</a-flex>
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-row :gutter="[16, 16]">
|
<a-row :gutter="[16, 16]">
|
||||||
<a-col :xs="24" :md="8">
|
<a-col :xs="24" :md="8">
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
Breadcrumb as ABreadcrumb,
|
|
||||||
BreadcrumbItem as ABreadcrumbItem,
|
|
||||||
Button as AButton,
|
Button as AButton,
|
||||||
Card as ACard,
|
Card as ACard,
|
||||||
Col as ACol,
|
Col as ACol,
|
||||||
@@ -18,7 +16,6 @@ import {
|
|||||||
Row as ARow,
|
Row as ARow,
|
||||||
Space as ASpace,
|
Space as ASpace,
|
||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
Typography,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { CheckOutlined, DeleteOutlined } from '@/icons/ant-bridge';
|
import { CheckOutlined, DeleteOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
@@ -30,8 +27,9 @@ import RelatedTasksPanel from '@/components/routines/RelatedTasksPanel.vue';
|
|||||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||||
import CustomerGroupPicker from '@/components/CustomerGroupPicker.vue';
|
import CustomerGroupPicker from '@/components/CustomerGroupPicker.vue';
|
||||||
import { formatLocalDateInput, parseLocalInput } from '@/lib/jalali';
|
import { formatLocalDateInput, parseLocalInput } from '@/lib/jalali';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { BankOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -225,46 +223,22 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16" dir="rtl">
|
<a-flex vertical :gap="16" dir="rtl">
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
justify="space-between"
|
:title="pageTitle"
|
||||||
align="center"
|
subtitle="ثبت و ویرایش مشخصات حقوقی، اطلاعات تماس و فیلدهای سفارشی شرکت"
|
||||||
wrap="wrap"
|
:icon="BankOutlined"
|
||||||
:gap="12"
|
primary-label="ذخیره"
|
||||||
|
:primary-icon="CheckOutlined"
|
||||||
|
:primary-loading="saving"
|
||||||
|
:menu-items="isNew ? [] : [{ key: 'delete', label: 'حذف شرکت', icon: DeleteOutlined, danger: true, disabled: saving }]"
|
||||||
|
@primary="submit"
|
||||||
|
@menu="remove"
|
||||||
>
|
>
|
||||||
<a-flex vertical :gap="4">
|
<template #actions>
|
||||||
<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>
|
|
||||||
ذخیره
|
|
||||||
</a-button>
|
|
||||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||||
<a-button
|
</template>
|
||||||
v-if="!isNew"
|
</PageHeader>
|
||||||
danger
|
|
||||||
:disabled="saving"
|
|
||||||
@click="remove"
|
|
||||||
>
|
|
||||||
<template #icon><DeleteOutlined /></template>
|
|
||||||
حذف
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
+523
-218
@@ -1,50 +1,93 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||||
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import {
|
||||||
|
Alert as AAlert,
|
||||||
|
Button as AButton,
|
||||||
|
Card as ACard,
|
||||||
|
Checkbox as ACheckbox,
|
||||||
|
Dropdown as ADropdown,
|
||||||
|
Empty as AEmpty,
|
||||||
|
Flex as AFlex,
|
||||||
|
Grid,
|
||||||
|
List as AList,
|
||||||
|
ListItem as AListItem,
|
||||||
|
Menu as AMenu,
|
||||||
|
MenuItem as AMenuItem,
|
||||||
|
Modal as AModal,
|
||||||
|
Pagination as APagination,
|
||||||
|
Select as ASelect,
|
||||||
|
Space as ASpace,
|
||||||
|
Spin as ASpin,
|
||||||
|
Table as ATable,
|
||||||
|
Tag as ATag,
|
||||||
|
Typography,
|
||||||
|
theme,
|
||||||
|
} from 'ant-design-vue';
|
||||||
|
import type { TableColumnsType } from 'ant-design-vue';
|
||||||
|
import {
|
||||||
|
BankOutlined,
|
||||||
|
DeleteOutlined,
|
||||||
|
EditOutlined,
|
||||||
|
FileExcelOutlined,
|
||||||
|
IdcardOutlined,
|
||||||
|
MailOutlined,
|
||||||
|
MoreOutlined,
|
||||||
|
PhoneOutlined,
|
||||||
|
TeamOutlined,
|
||||||
|
} from '@/icons/ant-bridge';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||||
import CustomerMoodFace from '@/components/CustomerMoodFace.vue';
|
import CustomerMoodFace from '@/components/CustomerMoodFace.vue';
|
||||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||||
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
||||||
import {
|
import { FilterChips, PageHeader } from '@/components/page';
|
||||||
UiBusyOverlay,
|
import type {
|
||||||
UiButton,
|
PageHeaderActiveFilter,
|
||||||
UiDropdownMenu,
|
PageHeaderMenuItem,
|
||||||
UiModal,
|
PageHeaderTab,
|
||||||
UiPagination,
|
} from '@/components/page';
|
||||||
UiEmptyState,
|
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
} from '@/components/ui';
|
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
|
||||||
import { Drawer as ADrawer } from 'ant-design-vue';
|
|
||||||
import PersonFormView from '@/views/PersonFormView.vue';
|
import PersonFormView from '@/views/PersonFormView.vue';
|
||||||
import CompanyFormView from '@/views/CompanyFormView.vue';
|
import CompanyFormView from '@/views/CompanyFormView.vue';
|
||||||
import SavedFiltersBar from '@/components/SavedFiltersBar.vue';
|
import SavedFiltersBar from '@/components/SavedFiltersBar.vue';
|
||||||
import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
||||||
|
import { registerTableColumns, useTableColumns } from '@/lib/tableColumns';
|
||||||
import type {
|
import type {
|
||||||
CompanyDto,
|
CompanyDto,
|
||||||
CustomerGroupDto,
|
|
||||||
ImportContactsResult,
|
ImportContactsResult,
|
||||||
PaginatedResponse,
|
|
||||||
PersonDto,
|
PersonDto,
|
||||||
PersonImportSource,
|
PersonImportSource,
|
||||||
PersonImportSourceStatDto,
|
|
||||||
PersonMood,
|
PersonMood,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
import {
|
import {
|
||||||
brand,
|
brand,
|
||||||
PERSON_IMPORT_SOURCE_LABELS,
|
PERSON_IMPORT_SOURCE_LABELS,
|
||||||
|
PERSON_IMPORT_SOURCES,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
import { PERSON_MOOD_LABELS, PERSON_MOODS } from '@/lib/person-mood';
|
import { PERSON_MOOD_LABELS, PERSON_MOODS } from '@/lib/person-mood';
|
||||||
import { canUseBehavior } from '@/lib/behavior-access';
|
import { canUseBehavior } from '@/lib/behavior-access';
|
||||||
import DiscBadge from '@/components/behavior/DiscBadge.vue';
|
import DiscBadge from '@/components/behavior/DiscBadge.vue';
|
||||||
import { PAGE_SIZE_OPTIONS, usePageSize } from '@/lib/pageSize';
|
import { PAGE_SIZE_OPTIONS, usePageSize } from '@/lib/pageSize';
|
||||||
import CustomerGroupChips from '@/components/CustomerGroupChips.vue';
|
import { useCustomerGroups } from '@/lib/customer-groups';
|
||||||
import CustomerGroupsManager from '@/components/CustomerGroupsManager.vue';
|
import { type ContactsFilterValue } from '@/components/ContactsFilterPanel.vue';
|
||||||
import { groupSwatch, useCustomerGroups } from '@/lib/customer-groups';
|
|
||||||
import ContactsFilterPanel, { type ContactsFilterValue } from '@/components/ContactsFilterPanel.vue';
|
|
||||||
import { canManageSettings } from '@/lib/roles';
|
import { canManageSettings } from '@/lib/roles';
|
||||||
|
import { contactKeys } from '@/queries/keys';
|
||||||
|
import {
|
||||||
|
fetchCompanies,
|
||||||
|
fetchCompanyGroupStats,
|
||||||
|
fetchPeople,
|
||||||
|
fetchPeopleGroupStats,
|
||||||
|
fetchPeopleSourceStats,
|
||||||
|
invalidateContactQueries,
|
||||||
|
} from '@/queries/contacts';
|
||||||
|
|
||||||
|
const { Link: ATypographyLink, Text: ATypographyText } = Typography;
|
||||||
|
const { token } = theme.useToken();
|
||||||
|
const screens = Grid.useBreakpoint();
|
||||||
|
|
||||||
type Tab = 'people' | 'companies';
|
type Tab = 'people' | 'companies';
|
||||||
type SortKey = 'name' | 'newest';
|
type SortKey = 'name' | 'newest';
|
||||||
@@ -83,9 +126,7 @@ const discFilter = computed(() => {
|
|||||||
const sourceFilters = computed(() => queryList('source'));
|
const sourceFilters = computed(() => queryList('source'));
|
||||||
const activityExperienceFilters = computed(() => queryList('activityExperience'));
|
const activityExperienceFilters = computed(() => queryList('activityExperience'));
|
||||||
const groupFilters = computed(() => queryList('group'));
|
const groupFilters = computed(() => queryList('group'));
|
||||||
const { groups: customerGroups, load: loadCustomerGroups } = useCustomerGroups();
|
const { groups: customerGroups } = useCustomerGroups();
|
||||||
/** گروههای فیلتر — با شمارش scoped بر اساس دسترسی کاربر */
|
|
||||||
const filterGroups = ref<CustomerGroupDto[]>([]);
|
|
||||||
const canManageGroups = computed(() => canManageSettings(auth.user?.role));
|
const canManageGroups = computed(() => canManageSettings(auth.user?.role));
|
||||||
const groupsManagerOpen = ref(false);
|
const groupsManagerOpen = ref(false);
|
||||||
|
|
||||||
@@ -124,15 +165,11 @@ const activeTags = computed<FilterTag[]>(() => {
|
|||||||
return tags;
|
return tags;
|
||||||
});
|
});
|
||||||
const q = ref(typeof route.query.q === 'string' ? route.query.q : '');
|
const q = ref(typeof route.query.q === 'string' ? route.query.q : '');
|
||||||
const loading = ref(false);
|
|
||||||
const busy = ref(false);
|
const busy = ref(false);
|
||||||
const pageBusy = ref(false);
|
const pageBusy = ref(false);
|
||||||
const busyMessage = ref('لطفاً صبر کنید…');
|
const busyMessage = ref('لطفاً صبر کنید…');
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const importMsg = ref('');
|
const importMsg = ref('');
|
||||||
const people = ref<PaginatedResponse<PersonDto> | null>(null);
|
|
||||||
const companies = ref<PaginatedResponse<CompanyDto> | null>(null);
|
|
||||||
const sourceStats = ref<PersonImportSourceStatDto[]>([]);
|
|
||||||
const menuId = ref<string | null>(null);
|
const menuId = ref<string | null>(null);
|
||||||
const sortOpen = ref(false);
|
const sortOpen = ref(false);
|
||||||
const filterOpen = ref(false);
|
const filterOpen = ref(false);
|
||||||
@@ -158,6 +195,91 @@ const SORT_OPTIONS = [
|
|||||||
{ value: 'newest', label: 'جدیدترین' },
|
{ value: 'newest', label: 'جدیدترین' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const peopleParams = computed(() => ({
|
||||||
|
q: q.value || undefined,
|
||||||
|
page: page.value,
|
||||||
|
limit: pageSize.value,
|
||||||
|
sort: sort.value,
|
||||||
|
mood: csv(moodFilters.value),
|
||||||
|
importSource: csv(sourceFilters.value),
|
||||||
|
activityExperience: csv(activityExperienceFilters.value),
|
||||||
|
disc: discFilter.value || undefined,
|
||||||
|
groupId: csv(groupFilters.value),
|
||||||
|
}));
|
||||||
|
|
||||||
|
const companyParams = computed(() => ({
|
||||||
|
q: q.value || undefined,
|
||||||
|
page: page.value,
|
||||||
|
limit: pageSize.value,
|
||||||
|
groupId: csv(groupFilters.value),
|
||||||
|
}));
|
||||||
|
|
||||||
|
const peopleQuery = useQuery({
|
||||||
|
queryKey: computed(() => contactKeys.people({ ...peopleParams.value })),
|
||||||
|
queryFn: () => fetchPeople({ ...peopleParams.value }),
|
||||||
|
enabled: computed(() => tab.value === 'people'),
|
||||||
|
placeholderData: (prev) => prev,
|
||||||
|
});
|
||||||
|
|
||||||
|
const companiesQuery = useQuery({
|
||||||
|
queryKey: computed(() => contactKeys.companies({ ...companyParams.value })),
|
||||||
|
queryFn: () => fetchCompanies({ ...companyParams.value }),
|
||||||
|
enabled: computed(() => tab.value === 'companies'),
|
||||||
|
placeholderData: (prev) => prev,
|
||||||
|
});
|
||||||
|
|
||||||
|
const peopleSourceStatsQuery = useQuery({
|
||||||
|
queryKey: computed(() => contactKeys.peopleSourceStats({ ...peopleParams.value })),
|
||||||
|
queryFn: () => fetchPeopleSourceStats({ ...peopleParams.value }),
|
||||||
|
enabled: computed(() => tab.value === 'people'),
|
||||||
|
staleTime: 60_000,
|
||||||
|
placeholderData: (prev) => prev,
|
||||||
|
});
|
||||||
|
|
||||||
|
const peopleGroupStatsQuery = useQuery({
|
||||||
|
queryKey: computed(() => contactKeys.peopleGroupStats({ ...peopleParams.value })),
|
||||||
|
queryFn: () => fetchPeopleGroupStats({ ...peopleParams.value }),
|
||||||
|
enabled: computed(() => tab.value === 'people'),
|
||||||
|
staleTime: 60_000,
|
||||||
|
placeholderData: (prev) => prev,
|
||||||
|
});
|
||||||
|
|
||||||
|
const companyGroupStatsQuery = useQuery({
|
||||||
|
queryKey: computed(() => contactKeys.companyGroupStats({ ...companyParams.value })),
|
||||||
|
queryFn: () => fetchCompanyGroupStats({ ...companyParams.value }),
|
||||||
|
enabled: computed(() => tab.value === 'companies'),
|
||||||
|
staleTime: 60_000,
|
||||||
|
placeholderData: (prev) => prev,
|
||||||
|
});
|
||||||
|
|
||||||
|
const people = computed(() => peopleQuery.data.value ?? null);
|
||||||
|
const companies = computed(() => companiesQuery.data.value ?? null);
|
||||||
|
const sourceStats = computed(() => peopleSourceStatsQuery.data.value ?? []);
|
||||||
|
const filterGroups = computed(() =>
|
||||||
|
tab.value === 'people'
|
||||||
|
? (peopleGroupStatsQuery.data.value ?? [])
|
||||||
|
: (companyGroupStatsQuery.data.value ?? []),
|
||||||
|
);
|
||||||
|
|
||||||
|
const loading = computed(() => {
|
||||||
|
if (tab.value === 'people') {
|
||||||
|
return peopleQuery.isFetching.value && peopleQuery.data.value == null;
|
||||||
|
}
|
||||||
|
return companiesQuery.isFetching.value && companiesQuery.data.value == null;
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => (tab.value === 'people' ? peopleQuery.error.value : companiesQuery.error.value),
|
||||||
|
(err) => {
|
||||||
|
if (!err) return;
|
||||||
|
if (axios.isAxiosError(err) && !err.response) {
|
||||||
|
error.value = 'اتصال به API برقرار نشد.';
|
||||||
|
} else {
|
||||||
|
error.value = 'بارگذاری مخاطبین ناموفق بود.';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const total = computed(() =>
|
const total = computed(() =>
|
||||||
tab.value === 'people' ? people.value?.total ?? 0 : companies.value?.total ?? 0,
|
tab.value === 'people' ? people.value?.total ?? 0 : companies.value?.total ?? 0,
|
||||||
);
|
);
|
||||||
@@ -166,6 +288,14 @@ const rowOffset = computed(() => (page.value - 1) * pageSize.value);
|
|||||||
|
|
||||||
const selectedIds = ref<string[]>([]);
|
const selectedIds = ref<string[]>([]);
|
||||||
const pageIds = computed(() => people.value?.items.map((p) => p.id) ?? []);
|
const pageIds = computed(() => people.value?.items.map((p) => p.id) ?? []);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => people.value?.items.map((p) => p.id) ?? [],
|
||||||
|
(ids) => {
|
||||||
|
const visible = new Set(ids);
|
||||||
|
selectedIds.value = selectedIds.value.filter((id) => visible.has(id));
|
||||||
|
},
|
||||||
|
);
|
||||||
const allSelected = computed(
|
const allSelected = computed(
|
||||||
() => pageIds.value.length > 0 && pageIds.value.every((id) => selectedIds.value.includes(id)),
|
() => pageIds.value.length > 0 && pageIds.value.every((id) => selectedIds.value.includes(id)),
|
||||||
);
|
);
|
||||||
@@ -206,7 +336,7 @@ async function deleteSelected() {
|
|||||||
|
|
||||||
function onPageSize(size: number) {
|
function onPageSize(size: number) {
|
||||||
pageSize.value = size;
|
pageSize.value = size;
|
||||||
if (page.value === 1) void load();
|
/* peopleParams/companyParams include limit → query key refetch */
|
||||||
}
|
}
|
||||||
|
|
||||||
const peopleSavedFilters = computed(() => {
|
const peopleSavedFilters = computed(() => {
|
||||||
@@ -316,63 +446,17 @@ function closePopups() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
loading.value = true;
|
|
||||||
error.value = '';
|
error.value = '';
|
||||||
closePopups();
|
closePopups();
|
||||||
void loadCustomerGroups(true).catch(() => undefined);
|
await invalidateContactQueries();
|
||||||
try {
|
if (tab.value === 'people') {
|
||||||
if (tab.value === 'people') {
|
await Promise.all([
|
||||||
const [peopleRes, statsRes, groupStatsRes] = await Promise.all([
|
peopleQuery.refetch(),
|
||||||
api.get<PaginatedResponse<PersonDto>>('/people', {
|
peopleSourceStatsQuery.refetch(),
|
||||||
params: {
|
peopleGroupStatsQuery.refetch(),
|
||||||
q: q.value || undefined,
|
]);
|
||||||
page: page.value,
|
} else {
|
||||||
limit: pageSize.value,
|
await Promise.all([companiesQuery.refetch(), companyGroupStatsQuery.refetch()]);
|
||||||
sort: sort.value,
|
|
||||||
mood: csv(moodFilters.value),
|
|
||||||
importSource: csv(sourceFilters.value),
|
|
||||||
activityExperience: csv(activityExperienceFilters.value),
|
|
||||||
disc: discFilter.value || undefined,
|
|
||||||
groupId: csv(groupFilters.value),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
api.get<PersonImportSourceStatDto[]>('/people/source-stats').catch(() => ({
|
|
||||||
data: [] as PersonImportSourceStatDto[],
|
|
||||||
})),
|
|
||||||
api.get<CustomerGroupDto[]>('/people/group-stats').catch(() => ({
|
|
||||||
data: [] as CustomerGroupDto[],
|
|
||||||
})),
|
|
||||||
]);
|
|
||||||
people.value = peopleRes.data;
|
|
||||||
sourceStats.value = statsRes.data;
|
|
||||||
filterGroups.value = groupStatsRes.data;
|
|
||||||
const visible = new Set(peopleRes.data.items.map((p) => p.id));
|
|
||||||
selectedIds.value = selectedIds.value.filter((id) => visible.has(id));
|
|
||||||
} else {
|
|
||||||
const [companiesRes, groupStatsRes] = await Promise.all([
|
|
||||||
api.get<PaginatedResponse<CompanyDto>>('/companies', {
|
|
||||||
params: {
|
|
||||||
q: q.value || undefined,
|
|
||||||
page: page.value,
|
|
||||||
limit: pageSize.value,
|
|
||||||
groupId: csv(groupFilters.value),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
api.get<CustomerGroupDto[]>('/companies/group-stats').catch(() => ({
|
|
||||||
data: [] as CustomerGroupDto[],
|
|
||||||
})),
|
|
||||||
]);
|
|
||||||
companies.value = companiesRes.data;
|
|
||||||
filterGroups.value = groupStatsRes.data;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (axios.isAxiosError(e) && !e.response) {
|
|
||||||
error.value = 'اتصال به API برقرار نشد.';
|
|
||||||
} else {
|
|
||||||
error.value = 'بارگذاری مخاطبین ناموفق بود.';
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,161 +659,381 @@ function onImportSettled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [route.query.tab, route.query.q, route.query.page, route.query.sort, route.query.mood, route.query.disc, route.query.source, route.query.group],
|
() => route.query.q,
|
||||||
() => {
|
() => {
|
||||||
q.value = typeof route.query.q === 'string' ? route.query.q : '';
|
q.value = typeof route.query.q === 'string' ? route.query.q : '';
|
||||||
void load();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(load);
|
const isCompact = computed(() => !screens.value.lg);
|
||||||
|
const excelImportTrigger = ref<HTMLElement | null>(null);
|
||||||
|
const phoneImportTrigger = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
|
const contactModalOpen = computed({
|
||||||
|
get: () => contactModal.value !== null,
|
||||||
|
set: (open: boolean) => {
|
||||||
|
if (!open) contactModal.value = null;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/** سلکت سریع هدر — تکمقدار روی query چندمقداری */
|
||||||
|
const moodFilter = computed<PersonMood | 'all'>(() => moodFilters.value[0] ?? 'all');
|
||||||
|
const sourceFilter = computed<PersonImportSource | 'all'>(() => {
|
||||||
|
const value = sourceFilters.value[0];
|
||||||
|
return value && PERSON_IMPORT_SOURCES.includes(value as PersonImportSource)
|
||||||
|
? (value as PersonImportSource)
|
||||||
|
: 'all';
|
||||||
|
});
|
||||||
|
|
||||||
|
const headerTabs: PageHeaderTab[] = [
|
||||||
|
{ key: 'people', label: 'اشخاص' },
|
||||||
|
{ key: 'companies', label: 'شرکتها' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const headerMenuItems = computed<PageHeaderMenuItem[]>(() => {
|
||||||
|
const items: PageHeaderMenuItem[] = [
|
||||||
|
{ key: 'export', label: 'خروجی اکسل', icon: FileExcelOutlined },
|
||||||
|
{ key: 'import', label: 'ورود از اکسل', icon: FileExcelOutlined },
|
||||||
|
];
|
||||||
|
if (tab.value === 'people') {
|
||||||
|
items.push({ key: 'phone', label: 'از مخاطبین گوشی', icon: PhoneOutlined });
|
||||||
|
}
|
||||||
|
if (canManageGroups.value) {
|
||||||
|
items.push({
|
||||||
|
key: 'groups',
|
||||||
|
label: 'مدیریت گروهها',
|
||||||
|
dividerBefore: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
});
|
||||||
|
|
||||||
|
const KIND_LABEL: Record<FilterTag['kind'], string> = {
|
||||||
|
group: 'گروه',
|
||||||
|
source: 'منبع',
|
||||||
|
mood: 'وضعیت',
|
||||||
|
disc: 'DISC',
|
||||||
|
activityExperience: 'سابقه',
|
||||||
|
};
|
||||||
|
|
||||||
|
const activeFilterChips = computed<PageHeaderActiveFilter[]>(() =>
|
||||||
|
activeTags.value.map((tag) => ({
|
||||||
|
key: `${tag.kind}:${tag.value}`,
|
||||||
|
label: KIND_LABEL[tag.kind],
|
||||||
|
value: tag.label,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
function onHeaderMenu(key: string) {
|
||||||
|
if (key === 'export') void exportExcel();
|
||||||
|
else if (key === 'import') excelImportTrigger.value?.click();
|
||||||
|
else if (key === 'phone') phoneImportTrigger.value?.click();
|
||||||
|
else if (key === 'groups') groupsManagerOpen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onHeaderTab(key: string | number) {
|
||||||
|
setTab(String(key) === 'companies' ? 'companies' : 'people');
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSearchInput(value: string) {
|
||||||
|
q.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRemoveFilter(key: string) {
|
||||||
|
const sep = key.indexOf(':');
|
||||||
|
if (sep < 0) return;
|
||||||
|
const kind = key.slice(0, sep) as FilterTag['kind'];
|
||||||
|
const value = key.slice(sep + 1);
|
||||||
|
const tag = activeTags.value.find((t) => t.kind === kind && t.value === value);
|
||||||
|
if (tag) removeTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearPeopleFilters() {
|
||||||
|
clearFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
const PEOPLE_COL_LABELS = [
|
||||||
|
'#',
|
||||||
|
'وضعیت',
|
||||||
|
'نام شخص',
|
||||||
|
'منبع',
|
||||||
|
'کد مبدأ',
|
||||||
|
'سمت',
|
||||||
|
'شرکت',
|
||||||
|
'تلفن',
|
||||||
|
'ایمیل',
|
||||||
|
'تاریخ ثبت',
|
||||||
|
];
|
||||||
|
const COMPANY_COL_LABELS = [
|
||||||
|
'#',
|
||||||
|
'نام شرکت',
|
||||||
|
'کد دیدار شرکت',
|
||||||
|
'کد شرکت',
|
||||||
|
'منبع',
|
||||||
|
'گروه بندی',
|
||||||
|
'استان',
|
||||||
|
'شهرستان',
|
||||||
|
'تلفن شرکت',
|
||||||
|
'ایمیل شرکت',
|
||||||
|
'شناسه ملی',
|
||||||
|
'شماره اقتصادی',
|
||||||
|
'مسئول شرکت',
|
||||||
|
'تاریخ ثبت',
|
||||||
|
'افراد',
|
||||||
|
];
|
||||||
|
registerTableColumns('contacts.people', PEOPLE_COL_LABELS);
|
||||||
|
registerTableColumns('contacts.companies', COMPANY_COL_LABELS);
|
||||||
|
const peopleCols = useTableColumns(() => 'contacts.people');
|
||||||
|
const companyCols = useTableColumns(() => 'contacts.companies');
|
||||||
|
|
||||||
|
function shownColumns<T>(cols: TableColumnsType<T>, visible: (label: string) => boolean) {
|
||||||
|
return cols.filter((col) => {
|
||||||
|
const title = typeof col.title === 'string' ? col.title : '';
|
||||||
|
if (!title || col.key === 'select' || col.key === 'actions') return true;
|
||||||
|
return visible(title);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const peopleColumns = computed<TableColumnsType<PersonDto>>(() =>
|
||||||
|
shownColumns(
|
||||||
|
[
|
||||||
|
{ title: '', key: 'select', width: 48 },
|
||||||
|
{ title: '#', key: 'row', width: 72 },
|
||||||
|
{ title: 'وضعیت', key: 'mood', width: 88 },
|
||||||
|
{ title: 'نام شخص', key: 'name' },
|
||||||
|
{ title: 'منبع', key: 'source' },
|
||||||
|
{ title: 'کد مبدأ', key: 'code', width: 120 },
|
||||||
|
{ title: 'سمت', key: 'position' },
|
||||||
|
{ title: 'شرکت', key: 'company' },
|
||||||
|
{ title: 'تلفن', key: 'phone' },
|
||||||
|
{ title: 'ایمیل', key: 'email' },
|
||||||
|
{ title: 'تاریخ ثبت', key: 'createdAt', width: 130 },
|
||||||
|
{ title: '', key: 'actions', width: 56 },
|
||||||
|
],
|
||||||
|
(label) => peopleCols.isVisible(label),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const companyColumns = computed<TableColumnsType<CompanyDto>>(() =>
|
||||||
|
shownColumns(
|
||||||
|
[
|
||||||
|
{ title: '#', key: 'row', width: 72 },
|
||||||
|
{ title: 'نام شرکت', key: 'name' },
|
||||||
|
{ title: 'کد دیدار شرکت', key: 'sourceRef' },
|
||||||
|
{ title: 'کد شرکت', key: 'code' },
|
||||||
|
{ title: 'منبع', key: 'source' },
|
||||||
|
{ title: 'گروه بندی', key: 'group' },
|
||||||
|
{ title: 'استان', key: 'province' },
|
||||||
|
{ title: 'شهرستان', key: 'city' },
|
||||||
|
{ title: 'تلفن شرکت', key: 'phone' },
|
||||||
|
{ title: 'ایمیل شرکت', key: 'email' },
|
||||||
|
{ title: 'شناسه ملی', key: 'nationalId' },
|
||||||
|
{ title: 'شماره اقتصادی', key: 'economicCode' },
|
||||||
|
{ title: 'مسئول شرکت', key: 'owner' },
|
||||||
|
{ title: 'تاریخ ثبت', key: 'createdAt', width: 130 },
|
||||||
|
{ title: 'افراد', key: 'peopleCount', width: 80 },
|
||||||
|
],
|
||||||
|
(label) => companyCols.isVisible(label),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const sortOptions: Array<{ value: SortKey; label: string }> = [
|
||||||
|
{ value: 'name', label: 'نام' },
|
||||||
|
{ value: 'newest', label: 'جدیدترین' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const moodOptions = computed(() => [
|
||||||
|
{ value: 'all', label: 'همه' },
|
||||||
|
...PERSON_MOODS.map((mood) => ({ value: mood, label: moodLabel(mood) })),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const sourceOptions = computed(() => [
|
||||||
|
{ value: 'all', label: 'همه منابع' },
|
||||||
|
...sourceStats.value.map((row) => ({
|
||||||
|
value: row.source,
|
||||||
|
label: `${row.label} (${toFaDigits(row.count)})`,
|
||||||
|
})),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const discOptions = [
|
||||||
|
{ value: 'D', label: 'D' },
|
||||||
|
{ value: 'I', label: 'I' },
|
||||||
|
{ value: 'S', label: 'S' },
|
||||||
|
{ value: 'C', label: 'C' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const discSelected = computed(() =>
|
||||||
|
discFilter.value ? discFilter.value.split('/').filter(Boolean) : [],
|
||||||
|
);
|
||||||
|
|
||||||
|
function onDiscChange(next: string[]) {
|
||||||
|
const cleaned = discOptions.map((o) => o.value).filter((v) => next.includes(v));
|
||||||
|
patchQuery({ disc: cleaned.length ? cleaned.join('/') : undefined, page: undefined });
|
||||||
|
}
|
||||||
|
|
||||||
|
function moodTagColor(mood: PersonMood) {
|
||||||
|
if (mood === 'happy') return 'purple';
|
||||||
|
if (mood === 'unhappy') return 'error';
|
||||||
|
if (mood === 'special') return 'warning';
|
||||||
|
return 'success';
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSortChange(value: unknown) {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
setSort(value[0] === 'newest' ? 'newest' : 'name');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSort(value === 'newest' ? 'newest' : 'name');
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMoodChange(value: unknown) {
|
||||||
|
const next =
|
||||||
|
typeof value === 'string' && PERSON_MOODS.includes(value as PersonMood)
|
||||||
|
? (value as PersonMood)
|
||||||
|
: undefined;
|
||||||
|
patchQuery({ mood: next, page: undefined });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSourceChange(value: unknown) {
|
||||||
|
const next =
|
||||||
|
typeof value === 'string' && PERSON_IMPORT_SOURCES.includes(value as PersonImportSource)
|
||||||
|
? value
|
||||||
|
: undefined;
|
||||||
|
patchQuery({ source: next, page: undefined });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPersonMenu(id: string, prefix: 't' | 'm', open: boolean) {
|
||||||
|
menuId.value = open ? `${prefix}:${id}` : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTablePage(nextPage: number, nextSize: number) {
|
||||||
|
const size = Number(nextSize);
|
||||||
|
if (size !== pageSize.value) onPageSize(size);
|
||||||
|
if (nextPage !== page.value) setPage(nextPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pageTotalText(totalCount: number, range: [number, number]) {
|
||||||
|
return `نمایش ${toFaDigits(range[0])} تا ${toFaDigits(range[1])} از ${toFaDigits(totalCount)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function peopleCustomRow(record: PersonDto) {
|
||||||
|
return {
|
||||||
|
style: selectedIds.value.includes(record.id)
|
||||||
|
? { background: token.value.colorPrimaryBg }
|
||||||
|
: undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16" @click="closePopups">
|
<a-flex vertical :gap="16" @click="closePopups">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<div>
|
title="مخاطبین"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">مخاطبین</a-typography-title>
|
:icon="TeamOutlined"
|
||||||
</div>
|
:primary-label="tab === 'companies' ? 'شرکت جدید' : 'شخص جدید'"
|
||||||
<a-space wrap>
|
:menu-items="headerMenuItems"
|
||||||
<RouterLink v-if="canBehavior" :to="{ name: 'disc-report' }">
|
:tabs="headerTabs"
|
||||||
<a-button>گزارش DISC</a-button>
|
:active-tab="tab"
|
||||||
</RouterLink>
|
searchable
|
||||||
<a-button
|
:search="q"
|
||||||
:disabled="busy"
|
:search-placeholder="tab === 'people' ? 'جستجو در اشخاص…' : 'جستجو در شرکتها…'"
|
||||||
:loading="pageBusy && busyMessage.includes('خروجی')"
|
:active-filters="activeFilterChips"
|
||||||
@click.stop="exportExcel"
|
:result-count="activeFilterChips.length ? total : undefined"
|
||||||
>
|
@primary="contactModal = tab === 'companies' ? 'company' : 'person'"
|
||||||
<template #icon><DownloadOutlined /></template>
|
@menu="onHeaderMenu"
|
||||||
{{ isCompact ? 'خروجی' : 'خروجی اکسل' }}
|
@update:active-tab="onHeaderTab"
|
||||||
</a-button>
|
@update:search="onSearchInput"
|
||||||
<ExcelImportFlow
|
@search-submit="onSearch"
|
||||||
:preview-path="importPreviewPath"
|
@remove-filter="onRemoveFilter"
|
||||||
:import-path="importPath"
|
@clear-filters="clearPeopleFilters"
|
||||||
:disabled="busy"
|
>
|
||||||
@start="onImportStart"
|
<template #quick-filters>
|
||||||
@done="onImportDone"
|
<template v-if="tab === 'people'">
|
||||||
@fail="onImportFail"
|
<a-select
|
||||||
@settled="onImportSettled"
|
:value="moodFilter"
|
||||||
>
|
:options="moodOptions"
|
||||||
<template #default="{ loading: excelLoading }">
|
:style="{ width: '150px' }"
|
||||||
<a-button :disabled="busy" :loading="excelLoading">
|
@update:value="onMoodChange"
|
||||||
<template #icon><FileExcelOutlined /></template>
|
|
||||||
{{ isCompact ? 'ورود' : 'ورود از اکسل' }}
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
</ExcelImportFlow>
|
|
||||||
<PhoneContactsImport
|
|
||||||
v-if="tab === 'people'"
|
|
||||||
:disabled="busy"
|
|
||||||
@start="onPhoneImportStart"
|
|
||||||
@done="onPhoneImportDone"
|
|
||||||
@fail="onPhoneImportFail"
|
|
||||||
@settled="onPhoneImportSettled"
|
|
||||||
>
|
|
||||||
<a-button :disabled="busy">
|
|
||||||
<template #icon><PhoneOutlined /></template>
|
|
||||||
{{ isCompact ? 'گوشی' : 'از مخاطبین گوشی' }}
|
|
||||||
</a-button>
|
|
||||||
</PhoneContactsImport>
|
|
||||||
<a-button type="primary" @click="contactModal = tab === 'companies' ? 'company' : 'person'">
|
|
||||||
<template #icon><PlusOutlined /></template>
|
|
||||||
{{ tab === 'companies' ? 'شرکت جدید' : 'شخص جدید' }}
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-spin :spinning="pageBusy" :tip="busyMessage">
|
|
||||||
<a-card :bordered="false">
|
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
|
||||||
<a-radio-group :value="tab" button-style="solid" @change="onTabChange">
|
|
||||||
<a-radio-button value="people">
|
|
||||||
<UserOutlined />
|
|
||||||
اشخاص
|
|
||||||
<template v-if="people"> {{ toFaDigits(people.total) }}</template>
|
|
||||||
</a-radio-button>
|
|
||||||
<a-radio-button value="companies">
|
|
||||||
<BankOutlined />
|
|
||||||
شرکتها
|
|
||||||
<template v-if="companies"> {{ toFaDigits(companies.total) }}</template>
|
|
||||||
</a-radio-button>
|
|
||||||
</a-radio-group>
|
|
||||||
<TableColumnsMenu
|
|
||||||
:table-key="tab === 'people' ? 'contacts.people' : 'contacts.companies'"
|
|
||||||
/>
|
/>
|
||||||
</a-flex>
|
<a-select
|
||||||
|
v-if="sourceStats.length"
|
||||||
<a-divider orientation="left">جستجو و فیلتر</a-divider>
|
:value="sourceFilter"
|
||||||
|
:options="sourceOptions"
|
||||||
<a-form layout="vertical" @submit.prevent="onSearch">
|
:style="{ width: '170px' }"
|
||||||
<a-row :gutter="[16, 16]">
|
@update:value="onSourceChange"
|
||||||
<a-col :xs="24" :md="tab === 'people' ? 8 : 12">
|
/>
|
||||||
<a-form-item label="جستجو">
|
</template>
|
||||||
<a-input-search
|
</template>
|
||||||
v-model:value="q"
|
|
||||||
allow-clear
|
|
||||||
:placeholder="tab === 'people' ? 'جستجو در اشخاص…' : 'جستجو در شرکتها…'"
|
|
||||||
style="width: 100%"
|
|
||||||
@search="onSearch"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :xs="24" :md="tab === 'people' ? 8 : 12">
|
|
||||||
<a-form-item label="مرتبسازی">
|
|
||||||
<a-select
|
|
||||||
:value="sort"
|
|
||||||
:options="sortOptions"
|
|
||||||
style="width: 100%"
|
|
||||||
@update:value="onSortChange"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col v-if="tab === 'people'" :xs="24" :md="8">
|
|
||||||
<a-form-item label="وضعیت">
|
|
||||||
<a-select
|
|
||||||
:value="moodFilter"
|
|
||||||
:options="moodOptions"
|
|
||||||
style="width: 100%"
|
|
||||||
@update:value="onMoodChange"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col v-if="tab === 'people' && sourceStats.length" :xs="24" :md="8">
|
|
||||||
<a-form-item label="منبع">
|
|
||||||
<a-select
|
|
||||||
:value="sourceFilter"
|
|
||||||
:options="sourceOptions"
|
|
||||||
style="width: 100%"
|
|
||||||
@update:value="onSourceChange"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col v-if="tab === 'people' && canBehavior" :xs="24" :md="sourceStats.length ? 16 : 24">
|
|
||||||
<a-form-item label="تیپ DISC">
|
|
||||||
<a-space wrap :size="8">
|
|
||||||
<a-button
|
|
||||||
v-for="chip in discChipItems"
|
|
||||||
:key="chip.value || 'all'"
|
|
||||||
:type="(chip.value ? discFilter === chip.value : !discFilter) ? 'primary' : 'default'"
|
|
||||||
@click="setDisc(chip.value)"
|
|
||||||
>
|
|
||||||
{{ chip.label }}
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</a-form>
|
|
||||||
|
|
||||||
|
<template v-if="tab === 'people'" #saved-filters>
|
||||||
|
<div :style="{ width: '280px', maxWidth: '100%' }">
|
||||||
<SavedFiltersBar
|
<SavedFiltersBar
|
||||||
v-if="tab === 'people'"
|
|
||||||
scope="people"
|
scope="people"
|
||||||
|
compact
|
||||||
:current-filters="peopleSavedFilters"
|
:current-filters="peopleSavedFilters"
|
||||||
@apply="applyPeopleSavedFilters"
|
@apply="applyPeopleSavedFilters"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<a-divider orientation="left">فهرست</a-divider>
|
<template #toolbar-end>
|
||||||
|
<TableColumnsMenu
|
||||||
|
icon-only
|
||||||
|
align="end"
|
||||||
|
:table-key="tab === 'people' ? 'contacts.people' : 'contacts.companies'"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="tab === 'people' && canBehavior" #chips>
|
||||||
|
<FilterChips
|
||||||
|
label="DISC"
|
||||||
|
:options="discOptions"
|
||||||
|
:model-value="discSelected"
|
||||||
|
@update:model-value="onDiscChange"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- مرتبسازی فقط روی لیست اشخاص اثر دارد -->
|
||||||
|
<template v-if="tab === 'people'" #chips-end>
|
||||||
|
<FilterChips
|
||||||
|
label="مرتبسازی"
|
||||||
|
:options="sortOptions"
|
||||||
|
:multiple="false"
|
||||||
|
:show-all="false"
|
||||||
|
:model-value="[sort]"
|
||||||
|
@update:model-value="onSortChange"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
|
<!-- تریگرهای ورود داده؛ از منوی «⋯» هدر کلیک میشوند (مودالهایشان به body تلپورت میشوند) -->
|
||||||
|
<div hidden>
|
||||||
|
<ExcelImportFlow
|
||||||
|
:preview-path="importPreviewPath"
|
||||||
|
:import-path="importPath"
|
||||||
|
:disabled="busy"
|
||||||
|
@start="onImportStart"
|
||||||
|
@done="onImportDone"
|
||||||
|
@fail="onImportFail"
|
||||||
|
@settled="onImportSettled"
|
||||||
|
>
|
||||||
|
<span ref="excelImportTrigger"></span>
|
||||||
|
</ExcelImportFlow>
|
||||||
|
<PhoneContactsImport
|
||||||
|
v-if="tab === 'people'"
|
||||||
|
:disabled="busy"
|
||||||
|
@start="onPhoneImportStart"
|
||||||
|
@done="onPhoneImportDone"
|
||||||
|
@fail="onPhoneImportFail"
|
||||||
|
@settled="onPhoneImportSettled"
|
||||||
|
>
|
||||||
|
<span ref="phoneImportTrigger"></span>
|
||||||
|
</PhoneContactsImport>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a-spin :spinning="pageBusy" :tip="busyMessage">
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<a-flex vertical :gap="16">
|
||||||
<a-alert v-if="importMsg" type="success" show-icon :message="importMsg" />
|
<a-alert v-if="importMsg" type="success" show-icon :message="importMsg" />
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
@@ -1112,7 +1416,7 @@ onMounted(load);
|
|||||||
</CrmSkeletonTable>
|
</CrmSkeletonTable>
|
||||||
</CrmSkeleton>
|
</CrmSkeleton>
|
||||||
|
|
||||||
<a-flex v-if="total" justify="flex-start" :style="{ marginTop: `${token.margin}px` }">
|
<a-flex v-if="total" justify="flex-start">
|
||||||
<a-pagination
|
<a-pagination
|
||||||
:current="page"
|
:current="page"
|
||||||
:page-size="pageSize"
|
:page-size="pageSize"
|
||||||
@@ -1123,6 +1427,7 @@ onMounted(load);
|
|||||||
@change="onTablePage"
|
@change="onTablePage"
|
||||||
/>
|
/>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
|
</a-flex>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ import {
|
|||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import AskMentoPanel from '@/components/AskMentoPanel.vue';
|
import AskMentoPanel from '@/components/AskMentoPanel.vue';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
import { Badge as ABadge } from 'ant-design-vue';
|
||||||
|
import { MessageOutlined } from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
import UserAvatar from '@/components/UserAvatar.vue';
|
import UserAvatar from '@/components/UserAvatar.vue';
|
||||||
import {
|
import {
|
||||||
brand,
|
brand,
|
||||||
@@ -1824,16 +1827,22 @@ onUnmounted(() => {
|
|||||||
<div class="conv-page" :class="{ 'chat-open': mobileChatOpen }">
|
<div class="conv-page" :class="{ 'chat-open': mobileChatOpen }">
|
||||||
<div class="conv-aurora" aria-hidden="true" />
|
<div class="conv-aurora" aria-hidden="true" />
|
||||||
|
|
||||||
<header class="conv-head desktop-head">
|
<!-- هدر یکپارچه (فقط دسکتاپ؛ موبایل هدر فشردهٔ خودش را دارد) -->
|
||||||
<div>
|
<div class="conv-head desktop-head">
|
||||||
<p class="eyebrow">درون سازمان</p>
|
<PageHeader
|
||||||
<h1>گفتگو</h1>
|
title="گفتگو"
|
||||||
<p class="sub">فضای زنده برای هماهنگی تیم — بدون پیامرسان بیرونی.</p>
|
subtitle="فضای زنده برای هماهنگی تیم درون سازمان، بدون پیامرسان بیرونی"
|
||||||
</div>
|
:icon="MessageOutlined"
|
||||||
<div class="head-actions">
|
:style="{ flex: '1 1 auto', minWidth: 0 }"
|
||||||
<span class="ws-pill" :data-state="status">{{ status === 'open' ? 'آنلاین' : '…' }}</span>
|
>
|
||||||
</div>
|
<template #title-extra>
|
||||||
</header>
|
<a-badge
|
||||||
|
:status="status === 'open' ? 'success' : 'default'"
|
||||||
|
:text="status === 'open' ? 'آنلاین' : 'در حال اتصال…'"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
</div>
|
||||||
|
|
||||||
<header class="mobile-list-head" :hidden="mobileChatOpen">
|
<header class="mobile-list-head" :hidden="mobileChatOpen">
|
||||||
<h1>گفتگو</h1>
|
<h1>گفتگو</h1>
|
||||||
@@ -2981,32 +2990,6 @@ onUnmounted(() => {
|
|||||||
.mobile-list-head {
|
.mobile-list-head {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.eyebrow {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--muted);
|
|
||||||
margin: 0 0 0.25rem;
|
|
||||||
}
|
|
||||||
.conv-head h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.75rem;
|
|
||||||
font-weight: 800;
|
|
||||||
background: linear-gradient(120deg, #0f766e, #7c3aed 55%, #db2777);
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
background-clip: text;
|
|
||||||
color: transparent;
|
|
||||||
}
|
|
||||||
.sub {
|
|
||||||
margin: 0.35rem 0 0;
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: 0.92rem;
|
|
||||||
}
|
|
||||||
.head-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
.ws-pill {
|
.ws-pill {
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
padding: 0.25rem 0.65rem;
|
padding: 0.25rem 0.65rem;
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ import {
|
|||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { DollarOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
@@ -129,7 +131,11 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">ارزها و نرخ تبدیل</a-typography-title>
|
<PageHeader
|
||||||
|
title="ارزها و نرخ تبدیل"
|
||||||
|
subtitle="ارز پایه و ارزهای فعال در فاکتورها و معاملات"
|
||||||
|
:icon="DollarOutlined"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ import {
|
|||||||
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ControlOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
@@ -179,7 +181,11 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">فیلدهای سفارشی</a-typography-title>
|
<PageHeader
|
||||||
|
title="فیلدهای سفارشی"
|
||||||
|
subtitle="فیلدهای اضافه برای مخاطبین، معاملات و سایر بخشها"
|
||||||
|
:icon="ControlOutlined"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
|
||||||
import {
|
import {
|
||||||
Affix as AAffix,
|
Affix as AAffix,
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
@@ -13,7 +12,6 @@ import {
|
|||||||
Descriptions as ADescriptions,
|
Descriptions as ADescriptions,
|
||||||
DescriptionsItem as ADescriptionsItem,
|
DescriptionsItem as ADescriptionsItem,
|
||||||
Divider as ADivider,
|
Divider as ADivider,
|
||||||
Flex as AFlex,
|
|
||||||
Form as AForm,
|
Form as AForm,
|
||||||
FormItem as AFormItem,
|
FormItem as AFormItem,
|
||||||
Input as AInput,
|
Input as AInput,
|
||||||
@@ -30,7 +28,6 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
ArrowLeftOutlined,
|
|
||||||
CheckOutlined,
|
CheckOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
FileTextOutlined,
|
FileTextOutlined,
|
||||||
@@ -38,6 +35,7 @@ import {
|
|||||||
UserAddOutlined,
|
UserAddOutlined,
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { canAssignToOthers } from '@/lib/assign-access';
|
import { canAssignToOthers } from '@/lib/assign-access';
|
||||||
import { canUseBehavior } from '@/lib/behavior-access';
|
import { canUseBehavior } from '@/lib/behavior-access';
|
||||||
@@ -65,8 +63,11 @@ import type {
|
|||||||
PipelineDto,
|
PipelineDto,
|
||||||
ProductDto,
|
ProductDto,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { FundOutlined, FileOutlined, BulbOutlined } from '@/icons/ant-bridge';
|
||||||
|
import type { PageHeaderMenuItem } from '@/components/page';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
const ASpaceCompact = Space.Compact;
|
const ASpaceCompact = Space.Compact;
|
||||||
type LineDraft = {
|
type LineDraft = {
|
||||||
key: string;
|
key: string;
|
||||||
@@ -96,6 +97,7 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const canBehavior = computed(() => canUseBehavior(auth.user));
|
const canBehavior = computed(() => canUseBehavior(auth.user));
|
||||||
const id = computed(() => {
|
const id = computed(() => {
|
||||||
@@ -221,16 +223,10 @@ function onStageSelect(nextId: string) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.patch(`/deals/${id.value}/move`, { stageId: nextId });
|
await api.patch(`/deals/${id.value}/move`, { stageId: nextId });
|
||||||
|
feedback.success('مرحله معامله بهروز شد.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
stageId.value = prev;
|
stageId.value = prev;
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'جابهجایی مرحله ناموفق بود.');
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg)
|
|
||||||
? msg.join('، ')
|
|
||||||
: (msg ?? 'جابهجایی مرحله ناموفق بود.');
|
|
||||||
} else {
|
|
||||||
error.value = 'جابهجایی مرحله ناموفق بود.';
|
|
||||||
}
|
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
stageMoving.value = false;
|
stageMoving.value = false;
|
||||||
@@ -593,6 +589,7 @@ async function submit() {
|
|||||||
} catch {
|
} catch {
|
||||||
/* deal saved; follow-up is optional */
|
/* deal saved; follow-up is optional */
|
||||||
}
|
}
|
||||||
|
feedback.success('معامله ذخیره شد.');
|
||||||
if (props.embedded) {
|
if (props.embedded) {
|
||||||
emit('saved');
|
emit('saved');
|
||||||
return;
|
return;
|
||||||
@@ -614,6 +611,7 @@ async function submit() {
|
|||||||
} catch {
|
} catch {
|
||||||
/* deal saved; follow-up is optional */
|
/* deal saved; follow-up is optional */
|
||||||
}
|
}
|
||||||
|
feedback.success('معامله ذخیره شد.');
|
||||||
if (props.embedded) {
|
if (props.embedded) {
|
||||||
emit('saved');
|
emit('saved');
|
||||||
return;
|
return;
|
||||||
@@ -621,16 +619,7 @@ async function submit() {
|
|||||||
await router.push({ name: 'pipeline' });
|
await router.push({ name: 'pipeline' });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'ذخیره ناموفق بود');
|
||||||
if (!e.response) {
|
|
||||||
error.value = 'اتصال به سرور برقرار نشد.';
|
|
||||||
} else {
|
|
||||||
const msg = (e.response.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg) ? msg.join('، ') : (msg ?? 'ذخیره ناموفق بود');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error.value = 'ذخیره ناموفق بود';
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -644,67 +633,54 @@ watch(othersKeys, (keys) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(load);
|
onMounted(load);
|
||||||
|
|
||||||
|
/* ---------- هدر صفحه ---------- */
|
||||||
|
const dealMenuItems = computed<PageHeaderMenuItem[]>(() => {
|
||||||
|
if (isNew.value || !id.value) return [];
|
||||||
|
const items: PageHeaderMenuItem[] = [
|
||||||
|
{ key: 'quote', label: 'صدور پیشفاکتور', icon: FileOutlined },
|
||||||
|
{ key: 'invoice', label: 'صدور فاکتور', icon: FileTextOutlined },
|
||||||
|
];
|
||||||
|
if (personId.value && canBehavior.value) {
|
||||||
|
items.push({ key: 'copilot', label: 'کمک برای ادامه مذاکره', icon: BulbOutlined, dividerBefore: true });
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
});
|
||||||
|
|
||||||
|
function onDealMenu(key: string) {
|
||||||
|
if (key === 'quote') void router.push({ name: 'quote-new', query: { fromDealId: id.value } });
|
||||||
|
else if (key === 'invoice') void router.push({ name: 'invoice-new', query: { fromDealId: id.value } });
|
||||||
|
else if (key === 'copilot' && personId.value) {
|
||||||
|
void router.push({
|
||||||
|
name: 'person-detail',
|
||||||
|
params: { id: personId.value },
|
||||||
|
query: { tab: 'copilot', dealId: id.value },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div dir="rtl">
|
<div dir="rtl">
|
||||||
<a-spin :spinning="loading">
|
<a-spin :spinning="loading">
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
justify="space-between"
|
:title="pageTitle"
|
||||||
align="center"
|
subtitle="مشتری، مبلغ، مرحله و پیگیری معامله"
|
||||||
wrap="wrap"
|
:icon="FundOutlined"
|
||||||
:gap="12"
|
:back-to="{ name: 'pipeline' }"
|
||||||
|
:primary-label="saving ? 'در حال ذخیره…' : 'ذخیره معامله'"
|
||||||
|
:primary-icon="CheckOutlined"
|
||||||
|
:primary-loading="saving"
|
||||||
|
:menu-items="dealMenuItems"
|
||||||
:style="{ marginBottom: '16px' }"
|
:style="{ marginBottom: '16px' }"
|
||||||
|
@primary="submit"
|
||||||
|
@menu="onDealMenu"
|
||||||
>
|
>
|
||||||
<div>
|
<template #actions>
|
||||||
<a-space :size="8">
|
|
||||||
<RouterLink :to="{ name: 'pipeline' }" custom v-slot="{ navigate }">
|
|
||||||
<a-button type="text" @click="navigate">
|
|
||||||
<template #icon><ArrowLeftOutlined /></template>
|
|
||||||
</a-button>
|
|
||||||
</RouterLink>
|
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">{{ pageTitle }}</a-typography-title>
|
|
||||||
</a-space>
|
|
||||||
<div>
|
|
||||||
<a-typography-text type="secondary">
|
|
||||||
<RouterLink :to="{ name: 'pipeline' }">مسیر فروش</RouterLink>
|
|
||||||
· {{ pageTitle }}
|
|
||||||
</a-typography-text>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<a-space wrap :size="8">
|
|
||||||
<RouterLink
|
|
||||||
v-if="!isNew && id"
|
|
||||||
:to="{ name: 'quote-new', query: { fromDealId: id } }"
|
|
||||||
custom
|
|
||||||
v-slot="{ navigate }"
|
|
||||||
>
|
|
||||||
<a-button @click="navigate">صدور پیشفاکتور</a-button>
|
|
||||||
</RouterLink>
|
|
||||||
<RouterLink
|
|
||||||
v-if="!isNew && id"
|
|
||||||
:to="{ name: 'invoice-new', query: { fromDealId: id } }"
|
|
||||||
custom
|
|
||||||
v-slot="{ navigate }"
|
|
||||||
>
|
|
||||||
<a-button @click="navigate">صدور فاکتور</a-button>
|
|
||||||
</RouterLink>
|
|
||||||
<RouterLink
|
|
||||||
v-if="!isNew && personId && canBehavior"
|
|
||||||
:to="{ name: 'person-detail', params: { id: personId }, query: { tab: 'copilot', dealId: id } }"
|
|
||||||
custom
|
|
||||||
v-slot="{ navigate }"
|
|
||||||
>
|
|
||||||
<a-button @click="navigate">کمک برای ادامه مذاکره</a-button>
|
|
||||||
</RouterLink>
|
|
||||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||||
<a-button type="primary" :loading="saving" @click="submit">
|
</template>
|
||||||
<template #icon><CheckOutlined /></template>
|
</PageHeader>
|
||||||
{{ saving ? 'در حال ذخیره…' : 'ذخیره معامله' }}
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="stagePathItems.length"
|
v-if="stagePathItems.length"
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ import {
|
|||||||
Row as ARow,
|
Row as ARow,
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
Space as ASpace,
|
||||||
Tabs as ATabs,
|
|
||||||
TabPane as ATabPane,
|
|
||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { HistoryOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
type HistoryTab = 'creates' | 'edits' | 'deletes';
|
type HistoryTab = 'creates' | 'edits' | 'deletes';
|
||||||
|
|
||||||
@@ -517,11 +517,14 @@ void loadActors();
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">تاریخچه کارها</a-typography-title>
|
<PageHeader
|
||||||
|
title="تاریخچه کارها"
|
||||||
<a-tabs :active-key="tab" @change="selectTab">
|
subtitle="موارد حذفشده و بایگانیشده و امکان بازگردانی"
|
||||||
<a-tab-pane v-for="item in TABS" :key="item.key" :tab="item.label" />
|
:icon="HistoryOutlined"
|
||||||
</a-tabs>
|
:tabs="TABS.map((item) => ({ key: item.key, label: item.label }))"
|
||||||
|
:active-tab="tab"
|
||||||
|
@update:active-tab="(k) => selectTab(k ?? TABS[0]!.key)"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="okMsg" type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
<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-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { RouterLink, useRouter } from 'vue-router';
|
import { RouterLink } from 'vue-router';
|
||||||
import type { DiscDistributionRow } from '@mento/shared';
|
import type { DiscDistributionRow } from '@mento/shared';
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
@@ -11,17 +11,17 @@ import {
|
|||||||
Flex as AFlex,
|
Flex as AFlex,
|
||||||
Progress as AProgress,
|
Progress as AProgress,
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
Space as ASpace,
|
|
||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { ArrowRightOutlined, DownloadOutlined } from '@/icons/ant-bridge';
|
import { DownloadOutlined } from '@/icons/ant-bridge';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { toFaDigits } from '@/lib/jalali';
|
import { toFaDigits } from '@/lib/jalali';
|
||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { BarChartOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const rows = ref<DiscDistributionRow[]>([]);
|
const rows = ref<DiscDistributionRow[]>([]);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
@@ -66,26 +66,19 @@ function percentOf(count: number) {
|
|||||||
<template>
|
<template>
|
||||||
<a-row :gutter="[16, 16]">
|
<a-row :gutter="[16, 16]">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<div>
|
title="توزیع تیپهای DISC"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
subtitle="فقط ارزیابیهای تأییدشده و قابل اتکا، در محدودهٔ دسترسی شما"
|
||||||
توزیع تیپهای DISC
|
:icon="BarChartOutlined"
|
||||||
</a-typography-title>
|
:back-to="{ name: 'contacts' }"
|
||||||
<a-typography-text type="secondary">
|
>
|
||||||
فقط ارزیابیهای تأییدشده و قابل اتکا، در محدودهٔ دسترسی شما
|
<template #actions>
|
||||||
</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">
|
<a-button :disabled="exporting" :loading="exporting" @click="exportExcel">
|
||||||
<template #icon><DownloadOutlined /></template>
|
<template #icon><DownloadOutlined /></template>
|
||||||
خروجی اکسل
|
خروجی اکسل
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</template>
|
||||||
</a-flex>
|
</PageHeader>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ import {
|
|||||||
import { DeleteOutlined, EditOutlined } from '@/icons/ant-bridge';
|
import { DeleteOutlined, EditOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { QuestionCircleOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -140,9 +142,11 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
<PageHeader
|
||||||
پایگاه دانش و سؤالات متداول
|
title="پایگاه دانش و سؤالات متداول"
|
||||||
</a-typography-title>
|
subtitle="مقالهها و پاسخهای آماده برای تیم و مشتریان"
|
||||||
|
:icon="QuestionCircleOutlined"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ import type {
|
|||||||
StockMovementType,
|
StockMovementType,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ContainerOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const STOCK_COL_LABELS = ['نام کالا', 'واحد', 'موجودی'] as const;
|
const STOCK_COL_LABELS = ['نام کالا', 'واحد', 'موجودی'] as const;
|
||||||
|
|
||||||
@@ -186,18 +188,17 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<div>
|
title="انبار"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">انبار</a-typography-title>
|
subtitle="موجودی کالا، ورود خرید و مانده وقتی تهحساب وصل نباشد"
|
||||||
<a-typography-text type="secondary">
|
:icon="ContainerOutlined"
|
||||||
موجودی کالا، ورود خرید و مانده وقتی تهحساب وصل نباشد
|
>
|
||||||
</a-typography-text>
|
<template #actions>
|
||||||
</div>
|
<a-button :disabled="loading" :loading="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
<a-button :disabled="loading" :loading="loading" @click="load">
|
<template #icon><ReloadOutlined /></template>
|
||||||
<template #icon><ReloadOutlined /></template>
|
</a-button>
|
||||||
بروزرسانی
|
</template>
|
||||||
</a-button>
|
</PageHeader>
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert
|
<a-alert
|
||||||
v-if="error"
|
v-if="error"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
import { matchesSearch } from '@/lib/search';
|
import { matchesSearch } from '@/lib/search';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import {
|
import {
|
||||||
CURRENCY_OPTIONS,
|
CURRENCY_OPTIONS,
|
||||||
currencySuffix,
|
currencySuffix,
|
||||||
@@ -66,6 +66,7 @@ import type {
|
|||||||
QuoteDto,
|
QuoteDto,
|
||||||
QuoteStatus,
|
QuoteStatus,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
|
||||||
type DocMode = 'invoice' | 'quote' | 'credit';
|
type DocMode = 'invoice' | 'quote' | 'credit';
|
||||||
|
|
||||||
@@ -99,6 +100,7 @@ const emit = defineEmits<{ saved: []; cancel: [] }>();
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
const loadedInvoiceKind = ref<'invoice' | 'credit' | null>(null);
|
const loadedInvoiceKind = ref<'invoice' | 'credit' | null>(null);
|
||||||
|
|
||||||
const docMode = computed<DocMode>(() => {
|
const docMode = computed<DocMode>(() => {
|
||||||
@@ -681,14 +683,6 @@ function quotePayload(): CreateQuoteRequest {
|
|||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
function axiosMessage(e: unknown, fallback: string) {
|
|
||||||
if (axios.isAxiosError(e)) {
|
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
return Array.isArray(msg) ? msg.join('، ') : (msg ?? fallback);
|
|
||||||
}
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
if (!issuedAt.value) {
|
if (!issuedAt.value) {
|
||||||
error.value = 'تاریخ را وارد کنید.';
|
error.value = 'تاریخ را وارد کنید.';
|
||||||
@@ -713,13 +707,20 @@ async function save() {
|
|||||||
} else {
|
} else {
|
||||||
await api.patch(`/invoices/${id.value}`, invoicePayload());
|
await api.patch(`/invoices/${id.value}`, invoicePayload());
|
||||||
}
|
}
|
||||||
|
feedback.success(
|
||||||
|
docMode.value === 'quote'
|
||||||
|
? 'پیشفاکتور ذخیره شد.'
|
||||||
|
: docMode.value === 'credit'
|
||||||
|
? 'فاکتور برگشتی ذخیره شد.'
|
||||||
|
: 'فاکتور ذخیره شد.',
|
||||||
|
);
|
||||||
if (props.embedded) {
|
if (props.embedded) {
|
||||||
emit('saved');
|
emit('saved');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await router.push({ name: listRouteName });
|
await router.push({ name: listRouteName });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = axiosMessage(e, 'ذخیره ناموفق بود');
|
feedback.fromError(e, 'ذخیره ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -733,12 +734,23 @@ async function remove() {
|
|||||||
? 'این فاکتور برگشتی حذف شود؟'
|
? 'این فاکتور برگشتی حذف شود؟'
|
||||||
: 'این فاکتور حذف شود؟';
|
: 'این فاکتور حذف شود؟';
|
||||||
if (!id.value || !confirm(label)) return;
|
if (!id.value || !confirm(label)) return;
|
||||||
if (docMode.value === 'quote') {
|
try {
|
||||||
await api.delete(`/quotes/${id.value}`);
|
if (docMode.value === 'quote') {
|
||||||
} else {
|
await api.delete(`/quotes/${id.value}`);
|
||||||
await api.delete(`/invoices/${id.value}`);
|
} else {
|
||||||
|
await api.delete(`/invoices/${id.value}`);
|
||||||
|
}
|
||||||
|
feedback.success(
|
||||||
|
docMode.value === 'quote'
|
||||||
|
? 'پیشفاکتور حذف شد.'
|
||||||
|
: docMode.value === 'credit'
|
||||||
|
? 'فاکتور برگشتی حذف شد.'
|
||||||
|
: 'فاکتور حذف شد.',
|
||||||
|
);
|
||||||
|
await router.push({ name: listRouteName });
|
||||||
|
} catch (e) {
|
||||||
|
feedback.fromError(e, 'حذف ناموفق بود');
|
||||||
}
|
}
|
||||||
await router.push({ name: listRouteName });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitPayment() {
|
async function submitPayment() {
|
||||||
@@ -781,9 +793,10 @@ async function submitPayment() {
|
|||||||
chequeBank.value = '';
|
chequeBank.value = '';
|
||||||
chequeDue.value = '';
|
chequeDue.value = '';
|
||||||
chequeStatus.value = 'pending';
|
chequeStatus.value = 'pending';
|
||||||
|
feedback.success('پرداخت ثبت شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = axiosMessage(e, 'ثبت پرداخت ناموفق بود');
|
feedback.fromError(e, 'ثبت پرداخت ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
paying.value = false;
|
paying.value = false;
|
||||||
}
|
}
|
||||||
@@ -791,8 +804,13 @@ async function submitPayment() {
|
|||||||
|
|
||||||
async function removePayment(paymentId: string) {
|
async function removePayment(paymentId: string) {
|
||||||
if (!id.value || !confirm('این پرداخت حذف شود؟')) return;
|
if (!id.value || !confirm('این پرداخت حذف شود؟')) return;
|
||||||
await api.delete(`/invoices/${id.value}/payments/${paymentId}`);
|
try {
|
||||||
await load();
|
await api.delete(`/invoices/${id.value}/payments/${paymentId}`);
|
||||||
|
feedback.success('پرداخت حذف شد.');
|
||||||
|
await load();
|
||||||
|
} catch (e) {
|
||||||
|
feedback.fromError(e, 'حذف پرداخت ناموفق بود');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInstallment() {
|
function addInstallment() {
|
||||||
@@ -1012,26 +1030,21 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
justify="space-between"
|
:title="pageTitle"
|
||||||
align="center"
|
subtitle="اقلام، تخفیف، مالیات و تسویه فاکتور"
|
||||||
wrap="wrap"
|
:icon="FileTextOutlined"
|
||||||
:gap="12"
|
|
||||||
class="no-print"
|
class="no-print"
|
||||||
:style="{ marginBottom: '16px' }"
|
:style="{ marginBottom: '16px' }"
|
||||||
>
|
>
|
||||||
<a-space :size="12" align="start">
|
<template #actions>
|
||||||
<FileTextOutlined />
|
<a-button @click="goBack">
|
||||||
<div>
|
<template #icon><ArrowLeftOutlined /></template>
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">{{ pageTitle }}</a-typography-title>
|
بازگشت
|
||||||
</div>
|
</a-button>
|
||||||
</a-space>
|
</template>
|
||||||
<a-button @click="goBack">
|
</PageHeader>
|
||||||
<template #icon><ArrowLeftOutlined /></template>
|
|
||||||
بازگشت
|
|
||||||
</a-button>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<CrmSkeleton :loading="loading">
|
<CrmSkeleton :loading="loading">
|
||||||
<CrmSkeletonCard :rows="8">
|
<CrmSkeletonCard :rows="8">
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ import type {
|
|||||||
QuoteDto,
|
QuoteDto,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { FileTextOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText } = Typography;
|
||||||
const AMenuItem = AMenu.Item;
|
const AMenuItem = AMenu.Item;
|
||||||
|
|
||||||
type DocTab = 'all' | 'invoice' | 'quote' | 'credit';
|
type DocTab = 'all' | 'invoice' | 'quote' | 'credit';
|
||||||
@@ -547,33 +549,31 @@ defineExpose({ toggleSelect, pageCount, statusIcon });
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div @click="closeMenus">
|
<div @click="closeMenus">
|
||||||
<a-flex
|
<PageHeader
|
||||||
justify="space-between"
|
title="فاکتورها"
|
||||||
align="center"
|
subtitle="فاکتورها، پیشفاکتورها و فاکتورهای برگشتی"
|
||||||
wrap="wrap"
|
:icon="FileTextOutlined"
|
||||||
:gap="12"
|
|
||||||
:style="{ marginBottom: '16px' }"
|
:style="{ marginBottom: '16px' }"
|
||||||
>
|
>
|
||||||
<div>
|
<template #primary>
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">فاکتور ها</a-typography-title>
|
<span @click.stop>
|
||||||
</div>
|
<a-dropdown v-model:open="addOpen">
|
||||||
<a-space :size="8" @click.stop>
|
<a-button type="primary">
|
||||||
<a-dropdown v-model:open="addOpen">
|
<template #icon><PlusOutlined /></template>
|
||||||
<a-button type="primary">
|
افزودن فاکتور
|
||||||
<template #icon><PlusOutlined /></template>
|
<DownOutlined />
|
||||||
افزودن فاکتور
|
</a-button>
|
||||||
<DownOutlined />
|
<template #overlay>
|
||||||
</a-button>
|
<a-menu @click="onAddMenu">
|
||||||
<template #overlay>
|
<a-menu-item key="invoice">فاکتور جدید</a-menu-item>
|
||||||
<a-menu @click="onAddMenu">
|
<a-menu-item key="quote">پیش فاکتور جدید</a-menu-item>
|
||||||
<a-menu-item key="invoice">فاکتور جدید</a-menu-item>
|
<a-menu-item key="credit">فاکتور برگشتی</a-menu-item>
|
||||||
<a-menu-item key="quote">پیش فاکتور جدید</a-menu-item>
|
</a-menu>
|
||||||
<a-menu-item key="credit">فاکتور برگشتی</a-menu-item>
|
</template>
|
||||||
</a-menu>
|
</a-dropdown>
|
||||||
</template>
|
</span>
|
||||||
</a-dropdown>
|
</template>
|
||||||
</a-space>
|
</PageHeader>
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<a-row :gutter="[16, 12]">
|
<a-row :gutter="[16, 12]">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { RouterLink, useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
MenuItem as AMenuItem,
|
MenuItem as AMenuItem,
|
||||||
Modal as AModal,
|
Modal as AModal,
|
||||||
Space as ASpace,
|
Space as ASpace,
|
||||||
|
Tooltip as ATooltip,
|
||||||
Spin as ASpin,
|
Spin as ASpin,
|
||||||
Tag as ATag,
|
Tag as ATag,
|
||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
@@ -29,7 +30,11 @@ import {
|
|||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
ReloadOutlined,
|
ReloadOutlined,
|
||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
|
AppstoreOutlined,
|
||||||
|
UserAddOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import type { PageHeaderViewOption } from '@/components/page';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
import { formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||||
import { canManageSettings } from '@/lib/roles';
|
import { canManageSettings } from '@/lib/roles';
|
||||||
@@ -38,13 +43,24 @@ import { useAuthStore } from '@/stores/auth';
|
|||||||
import type { LeadBoardColumnDto, LeadDto, LeadStageDto } from '@mento/shared';
|
import type { LeadBoardColumnDto, LeadDto, LeadStageDto } from '@mento/shared';
|
||||||
import { CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeletonCard } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
const { token } = theme.useToken();
|
const { token } = theme.useToken();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const canManage = computed(() => canManageSettings(auth.user?.role));
|
const canManage = computed(() => canManageSettings(auth.user?.role));
|
||||||
|
|
||||||
const GAP = 16;
|
const GAP = 16;
|
||||||
|
|
||||||
|
const viewOptions: PageHeaderViewOption[] = [
|
||||||
|
{ value: 'list', label: 'لیست', icon: UnorderedListOutlined },
|
||||||
|
{ value: 'board', label: 'بورد', icon: AppstoreOutlined },
|
||||||
|
];
|
||||||
|
|
||||||
|
function onViewChange(value: string | undefined) {
|
||||||
|
if (value === 'list') void router.push({ name: 'leads' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const boardTotal = computed(() => columns.value.reduce((sum, col) => sum + (col.total ?? 0), 0));
|
||||||
const COL_WIDTH = 280;
|
const COL_WIDTH = 280;
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -645,29 +661,27 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="lead-board-page" :style="pageStyle">
|
<div class="lead-board-page" :style="pageStyle">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="GAP">
|
<PageHeader
|
||||||
<div>
|
title="مسیر لیدها"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
subtitle="لیدها را بین مراحل بکشید تا وضعیتشان عوض شود"
|
||||||
مسیر لیدها
|
:icon="UserAddOutlined"
|
||||||
</a-typography-title>
|
:count="loading && !columns.length ? undefined : boardTotal"
|
||||||
</div>
|
:primary-label="canManage ? 'افزودن ستون' : undefined"
|
||||||
<a-space :size="GAP">
|
:primary-disabled="loading || moving"
|
||||||
<RouterLink :to="{ name: 'leads' }" custom v-slot="{ navigate }">
|
:view-options="viewOptions"
|
||||||
<a-button @click="navigate">
|
view="board"
|
||||||
<template #icon><UnorderedListOutlined /></template>
|
:style="{ flex: '0 0 auto' }"
|
||||||
فهرست لیدها
|
@primary="openAdd"
|
||||||
|
@update:view="onViewChange"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
|
<a-tooltip title="بروزرسانی">
|
||||||
|
<a-button :disabled="loading || moving" :loading="loading" aria-label="بروزرسانی" @click="load">
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</RouterLink>
|
</a-tooltip>
|
||||||
<a-button
|
</template>
|
||||||
:disabled="loading || moving"
|
</PageHeader>
|
||||||
:loading="loading"
|
|
||||||
@click="load"
|
|
||||||
>
|
|
||||||
<template #icon><ReloadOutlined /></template>
|
|
||||||
بروزرسانی
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -568,59 +568,33 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
<template>
|
<template>
|
||||||
<a-row :gutter="[24, 24]">
|
<a-row :gutter="[24, 24]">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
|
<PageHeader
|
||||||
<a-space :size="12" align="start">
|
:title="lead?.title || 'جزئیات لید'"
|
||||||
<a-button aria-label="بازگشت" @click="goBack">
|
:subtitle="lead ? `موبایل ${lead.mobile}` : 'در حال بارگذاری…'"
|
||||||
<template #icon><ArrowLeftOutlined /></template>
|
:icon="UserAddOutlined"
|
||||||
</a-button>
|
:back-to="{ name: 'leads-board' }"
|
||||||
<div>
|
:primary-label="lead && !lead.convertedPersonId ? 'تبدیل به مشتری' : undefined"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
:primary-icon="UserAddOutlined"
|
||||||
{{ lead?.title || 'جزئیات لید' }}
|
:primary-disabled="busy"
|
||||||
</a-typography-title>
|
:menu-items="leadMenuItems"
|
||||||
<a-typography-text type="secondary">
|
@primary="convertLead"
|
||||||
{{ lead ? `موبایل ${lead.mobile}` : 'در حال بارگذاری…' }}
|
@menu="onLeadMenu"
|
||||||
</a-typography-text>
|
>
|
||||||
</div>
|
<template v-if="lead" #actions>
|
||||||
</a-space>
|
<a-button v-if="!editing" :disabled="busy || !lead.mobile" @click="smsOpen = true">
|
||||||
<a-space v-if="lead" :size="8" wrap>
|
|
||||||
<a-button
|
|
||||||
v-if="!editing"
|
|
||||||
:disabled="busy || !lead.mobile"
|
|
||||||
@click="smsOpen = true"
|
|
||||||
>
|
|
||||||
<template #icon><MessageOutlined /></template>
|
<template #icon><MessageOutlined /></template>
|
||||||
پیامک
|
پیامک
|
||||||
</a-button>
|
|
||||||
<a-button v-if="!editing && canBehavior" @click="copilotOpen = !copilotOpen">
|
|
||||||
کمک برای ادامه مذاکره
|
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button v-if="!editing" :disabled="busy" @click="startEdit">
|
<a-button v-if="!editing" :disabled="busy" @click="startEdit">
|
||||||
<template #icon><EditOutlined /></template>
|
<template #icon><EditOutlined /></template>
|
||||||
ویرایش
|
ویرایش
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
v-if="!lead.convertedPersonId"
|
|
||||||
type="primary"
|
|
||||||
:disabled="busy"
|
|
||||||
@click="convertLead"
|
|
||||||
>
|
|
||||||
<template #icon><UserAddOutlined /></template>
|
|
||||||
تبدیل به مشتری
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
v-if="!lead.archivedAt"
|
|
||||||
danger
|
|
||||||
:disabled="busy"
|
|
||||||
@click="archiveLead"
|
|
||||||
>
|
|
||||||
بایگانی
|
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button v-if="narrow" @click="moreOpen = true">
|
<a-button v-if="narrow" @click="moreOpen = true">
|
||||||
<template #icon><MoreOutlined /></template>
|
<template #icon><MoreOutlined /></template>
|
||||||
بیشتر
|
بیشتر
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</template>
|
||||||
</a-flex>
|
</PageHeader>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col v-if="lead && copilotOpen && canBehavior" :span="24">
|
<a-col v-if="lead && copilotOpen && canBehavior" :span="24">
|
||||||
@@ -734,17 +708,6 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
<a-input v-model:value="editForm.trade" style="width: 100%" />
|
<a-input v-model:value="editForm.trade" style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xs="24" :sm="12" :md="8">
|
|
||||||
<a-form-item label="سابقه فعالیت">
|
|
||||||
<a-select
|
|
||||||
v-model:value="editForm.activityExperience"
|
|
||||||
allow-clear
|
|
||||||
placeholder="اختیاری"
|
|
||||||
style="width: 100%"
|
|
||||||
:options="activityExperienceOptions"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="یادداشت">
|
<a-form-item label="یادداشت">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
@@ -817,9 +780,6 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
<span dir="ltr">{{ lead.instagram || '—' }}</span>
|
<span dir="ltr">{{ lead.instagram || '—' }}</span>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="صنف">{{ lead.trade || '—' }}</a-descriptions-item>
|
<a-descriptions-item label="صنف">{{ lead.trade || '—' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="سابقه فعالیت">
|
|
||||||
{{ shownActivityExperience }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item label="منبع">
|
<a-descriptions-item label="منبع">
|
||||||
{{ lead.source || '—' }}
|
{{ lead.source || '—' }}
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
@@ -952,7 +912,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
</a-typography-text>
|
</a-typography-text>
|
||||||
</div>
|
</div>
|
||||||
<a-typography-paragraph v-if="ev.body" type="secondary">
|
<a-typography-paragraph v-if="ev.body" type="secondary">
|
||||||
<template v-if="ev.type === 'stage_changed'">دلیل: </template>{{ ev.body }}
|
{{ ev.body }}
|
||||||
</a-typography-paragraph>
|
</a-typography-paragraph>
|
||||||
</a-timeline-item>
|
</a-timeline-item>
|
||||||
</a-timeline>
|
</a-timeline>
|
||||||
@@ -1022,12 +982,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-button
|
<a-button block :disabled="busy" :loading="busy" @click="changeStage">
|
||||||
block
|
|
||||||
:disabled="busy || stageId === lead.stageId"
|
|
||||||
:loading="busy"
|
|
||||||
@click="openStageMove"
|
|
||||||
>
|
|
||||||
اعمال وضعیت
|
اعمال وضعیت
|
||||||
</a-button>
|
</a-button>
|
||||||
|
|
||||||
@@ -1173,13 +1128,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-button
|
<a-button block :disabled="busy" @click="changeStage">اعمال وضعیت</a-button>
|
||||||
block
|
|
||||||
:disabled="busy || stageId === lead.stageId"
|
|
||||||
@click="openStageMove"
|
|
||||||
>
|
|
||||||
اعمال وضعیت
|
|
||||||
</a-button>
|
|
||||||
|
|
||||||
<template v-if="canAssignOthers">
|
<template v-if="canAssignOthers">
|
||||||
<a-divider orientation="right">تخصیص کارشناس</a-divider>
|
<a-divider orientation="right">تخصیص کارشناس</a-divider>
|
||||||
@@ -1267,47 +1216,20 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
|
|||||||
</a-button>
|
</a-button>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
|
||||||
|
<SmsComposeModal
|
||||||
|
:open="smsOpen"
|
||||||
|
title="ارسال پیامک"
|
||||||
|
:endpoint="`/leads/${lead.id}/sms`"
|
||||||
|
:history-endpoint="`/leads/${lead.id}/sms-history`"
|
||||||
|
:name="lead.contactName || lead.title"
|
||||||
|
:phone="lead.mobile || lead.phone || ''"
|
||||||
|
:record-title="lead.title"
|
||||||
|
:company="lead.trade ?? ''"
|
||||||
|
@close="smsOpen = false"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-modal
|
|
||||||
v-model:open="stageMoveOpen"
|
|
||||||
title="دلیل تغییر وضعیت"
|
|
||||||
ok-text="ثبت و انتقال"
|
|
||||||
cancel-text="انصراف"
|
|
||||||
destroy-on-close
|
|
||||||
:confirm-loading="busy"
|
|
||||||
:ok-button-props="{ disabled: !stageMoveReason.trim() }"
|
|
||||||
@ok="changeStage"
|
|
||||||
@cancel="cancelStageMove"
|
|
||||||
>
|
|
||||||
<a-flex vertical :gap="12">
|
|
||||||
<a-typography-text type="secondary">
|
|
||||||
انتقال از «{{ lead?.stageName || '—' }}» به «{{ stages.find((s) => s.id === stageId)?.name || '—' }}»
|
|
||||||
</a-typography-text>
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="stageMoveReason"
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="1000"
|
|
||||||
show-count
|
|
||||||
placeholder="دلیل تغییر وضعیت را بنویسید…"
|
|
||||||
/>
|
|
||||||
<a-alert v-if="stageMoveError" type="error" show-icon :message="stageMoveError" />
|
|
||||||
</a-flex>
|
|
||||||
</a-modal>
|
|
||||||
|
|
||||||
<SmsComposeModal
|
|
||||||
v-if="lead"
|
|
||||||
:open="smsOpen"
|
|
||||||
title="ارسال پیامک"
|
|
||||||
:endpoint="`/leads/${lead.id}/sms`"
|
|
||||||
:history-endpoint="`/leads/${lead.id}/sms-history`"
|
|
||||||
:name="lead.contactName || lead.title"
|
|
||||||
:phone="lead.mobile || lead.phone || ''"
|
|
||||||
:record-title="lead.title"
|
|
||||||
:company="lead.trade ?? ''"
|
|
||||||
@close="smsOpen = false"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -558,14 +558,18 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-flex vertical :gap="4">
|
title="فرمساز"
|
||||||
<RouterLink :to="{ name: 'lead-forms' }" custom v-slot="{ href, navigate }">
|
:subtitle="form?.name || 'فیلدها، ظاهر و تنظیمات انتشار فرم'"
|
||||||
<a-typography-link :href="href" @click="navigate">بازگشت به فرمها</a-typography-link>
|
:icon="FileTextOutlined"
|
||||||
</RouterLink>
|
:back-to="{ name: 'lead-forms' }"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">فرمساز</a-typography-title>
|
primary-label="ذخیره تغییرات"
|
||||||
</a-flex>
|
:primary-icon="SaveOutlined"
|
||||||
<a-space wrap>
|
:primary-loading="saving"
|
||||||
|
:primary-disabled="saving"
|
||||||
|
@primary="save"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
<a-button :disabled="!form?.publicPath" @click="openPreview">
|
<a-button :disabled="!form?.publicPath" @click="openPreview">
|
||||||
<template #icon><EyeOutlined /></template>
|
<template #icon><EyeOutlined /></template>
|
||||||
پیشنمایش
|
پیشنمایش
|
||||||
@@ -574,12 +578,8 @@ onMounted(load);
|
|||||||
<template #icon><NotificationOutlined /></template>
|
<template #icon><NotificationOutlined /></template>
|
||||||
انتشار فرم
|
انتشار فرم
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" :loading="saving" :disabled="saving" @click="save">
|
</template>
|
||||||
<template #icon><SaveOutlined /></template>
|
</PageHeader>
|
||||||
ذخیره تغییرات
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ import {
|
|||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { FileTextOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -111,13 +113,15 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">فرمساز وب</a-typography-title>
|
title="فرمساز وب"
|
||||||
<a-button type="primary" :loading="saving" @click="createForm">
|
subtitle="فرمهای جذب لید برای وبسایت و شبکههای اجتماعی"
|
||||||
<template #icon><PlusOutlined /></template>
|
:icon="FileTextOutlined"
|
||||||
فرم جدید
|
:count="loading ? undefined : forms.length"
|
||||||
</a-button>
|
primary-label="فرم جدید"
|
||||||
</a-flex>
|
:primary-loading="saving"
|
||||||
|
@primary="createForm"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ import {
|
|||||||
EditOutlined,
|
EditOutlined,
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { FlagOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
@@ -209,12 +211,11 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<div>
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">مراحل لید</a-typography-title>
|
title="مراحل لید"
|
||||||
<a-typography-text type="secondary">
|
subtitle="تعریف وضعیتهای مسیر لیدها و برچسبهای تبدیل/از دسترفته"
|
||||||
تعریف وضعیتهای مسیر لیدها و برچسبهای تبدیل/از دسترفته
|
:icon="FlagOutlined"
|
||||||
</a-typography-text>
|
/>
|
||||||
</div>
|
|
||||||
|
|
||||||
<a-alert v-if="okMsg" type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
<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-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||||
|
|||||||
+375
-505
@@ -50,6 +50,7 @@ import {
|
|||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
|
UserAddOutlined,
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import {
|
import {
|
||||||
@@ -66,6 +67,13 @@ import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
|||||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||||
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
|
||||||
|
import { FilterChips, PageHeader } from '@/components/page';
|
||||||
|
import type {
|
||||||
|
PageHeaderActiveFilter,
|
||||||
|
PageHeaderMenuItem,
|
||||||
|
PageHeaderTab,
|
||||||
|
PageHeaderViewOption,
|
||||||
|
} from '@/components/page';
|
||||||
import {
|
import {
|
||||||
filterPhoneContacts,
|
filterPhoneContacts,
|
||||||
isContactPickerSupported,
|
isContactPickerSupported,
|
||||||
@@ -394,6 +402,25 @@ function facetValueStyle(active: boolean) {
|
|||||||
} as const;
|
} as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filterRowHover = ref<string | null>(null);
|
||||||
|
const facetItemStyle = computed(() => ({
|
||||||
|
borderBottom: `${token.value.lineWidth}px ${token.value.lineType} ${token.value.colorSplit}`,
|
||||||
|
}));
|
||||||
|
const facetBodyStyle = computed(() => ({
|
||||||
|
paddingInline: `${token.value.paddingSM}px`,
|
||||||
|
paddingBottom: `${token.value.paddingSM}px`,
|
||||||
|
}));
|
||||||
|
function facetRowStyle(key: string) {
|
||||||
|
const open = filterSection.value === key;
|
||||||
|
const hover = filterRowHover.value === key;
|
||||||
|
return {
|
||||||
|
cursor: 'pointer',
|
||||||
|
padding: `${token.value.paddingXS}px ${token.value.paddingSM}px`,
|
||||||
|
borderRadius: `${token.value.borderRadiusSM}px`,
|
||||||
|
background: open || hover ? token.value.colorFillTertiary : 'transparent',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const textFacets = computed(() => [
|
const textFacets = computed(() => [
|
||||||
{
|
{
|
||||||
key: 'assignee' as const,
|
key: 'assignee' as const,
|
||||||
@@ -576,6 +603,92 @@ const totalLeadsCount = computed(() => {
|
|||||||
return stages.value.reduce((sum, s) => sum + (s.leadCount ?? 0), 0) || total.value;
|
return stages.value.reduce((sum, s) => sum + (s.leadCount ?? 0), 0) || total.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const headerTabs = computed<PageHeaderTab[]>(() => [
|
||||||
|
{ key: 'all', label: 'همه', count: totalLeadsCount.value },
|
||||||
|
...stageCards.value.map((card) => ({
|
||||||
|
key: card.stageId,
|
||||||
|
label: card.label,
|
||||||
|
count: card.count,
|
||||||
|
})),
|
||||||
|
]);
|
||||||
|
const stageSegValue = computed(() => stageId.value || 'all');
|
||||||
|
|
||||||
|
const viewOptions: PageHeaderViewOption[] = [
|
||||||
|
{ value: 'list', label: 'لیست', icon: UnorderedListOutlined },
|
||||||
|
{ value: 'board', label: 'بورد', icon: AppstoreOutlined },
|
||||||
|
];
|
||||||
|
|
||||||
|
const headerMenuItems = computed<PageHeaderMenuItem[]>(() => [
|
||||||
|
{ key: 'export', label: 'خروجی اکسل', icon: FileExcelOutlined },
|
||||||
|
{ key: 'import', label: 'ورود از اکسل', icon: FileExcelOutlined },
|
||||||
|
{ key: 'phone', label: 'از مخاطبین گوشی', icon: PhoneOutlined },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const sortOptions: Array<{ value: SortKey; label: string }> = [
|
||||||
|
{ value: 'newest', label: 'تاریخ جدیدترین' },
|
||||||
|
{ value: 'updated', label: 'آخرین بهروزرسانی' },
|
||||||
|
{ value: 'follow_up', label: 'پیگیری بعدی' },
|
||||||
|
{ value: 'last_contact', label: 'آخرین تماس' },
|
||||||
|
];
|
||||||
|
const sortSelected = computed<SortKey[]>(() => [sort.value]);
|
||||||
|
|
||||||
|
const activeFilterChips = computed<PageHeaderActiveFilter[]>(() => {
|
||||||
|
const chips: PageHeaderActiveFilter[] = textFacets.value
|
||||||
|
.filter((facet) => facet.active)
|
||||||
|
.map((facet) => ({ key: facet.key, label: facet.label, value: facet.value }));
|
||||||
|
if (createdFromFilter.value) {
|
||||||
|
chips.push({ key: 'createdFrom', label: 'از تاریخ', value: dateFacetLabel(createdFromFilter.value) });
|
||||||
|
}
|
||||||
|
if (createdToFilter.value) {
|
||||||
|
chips.push({ key: 'createdTo', label: 'تا تاریخ', value: dateFacetLabel(createdToFilter.value) });
|
||||||
|
}
|
||||||
|
if (convertedFilter.value) chips.push({ key: 'converted', label: 'تبدیل', value: 'تبدیلشده' });
|
||||||
|
if (archivedFilter.value) chips.push({ key: 'archived', label: 'بایگانی', value: 'بایگانیشده' });
|
||||||
|
return chips;
|
||||||
|
});
|
||||||
|
|
||||||
|
const excelImportTrigger = ref<HTMLElement | null>(null);
|
||||||
|
const phoneImportTrigger = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
|
function onHeaderMenu(key: string) {
|
||||||
|
if (key === 'export') void exportExcel();
|
||||||
|
else if (key === 'import') excelImportTrigger.value?.click();
|
||||||
|
else if (key === 'phone') phoneImportTrigger.value?.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onHeaderTab(key: string | number) {
|
||||||
|
const value = String(key);
|
||||||
|
setStageFilter(value === 'all' ? '' : value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSearchInput(value: string) {
|
||||||
|
q.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onViewChange(value: string | undefined) {
|
||||||
|
if (value === 'board') void router.push({ name: 'leads-board' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSortChange(value: SortKey[]) {
|
||||||
|
const next = value[0];
|
||||||
|
if (next) setSort(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRemoveFilter(key: string) {
|
||||||
|
if (key === 'assignee') setAssigneeFilter(undefined);
|
||||||
|
else if (key === 'stage') setStageFilter('');
|
||||||
|
else if (key === 'source') setSourceFilter('');
|
||||||
|
else if (key === 'followUp') setFollowUpFilter(undefined);
|
||||||
|
else if (key === 'city') setCityFilter('');
|
||||||
|
else if (key === 'region') setRegionFilter('');
|
||||||
|
else if (key === 'trade') setTradeFilter('');
|
||||||
|
else if (key === 'activityExperience') setActivityExperienceFilter('');
|
||||||
|
else if (key === 'createdFrom') setCreatedFromFilter('');
|
||||||
|
else if (key === 'createdTo') setCreatedToFilter('');
|
||||||
|
else if (key === 'converted') setConvertedFilter(false);
|
||||||
|
else if (key === 'archived') setArchivedFilter(false);
|
||||||
|
}
|
||||||
|
|
||||||
/** گزینههای سلکت موبایل — برچسب + تعداد */
|
/** گزینههای سلکت موبایل — برچسب + تعداد */
|
||||||
const stageFilterOptions = computed(() => [
|
const stageFilterOptions = computed(() => [
|
||||||
{
|
{
|
||||||
@@ -1596,484 +1709,278 @@ onBeforeUnmount(() => {
|
|||||||
<template>
|
<template>
|
||||||
<a-row :gutter="[16, 16]" align="top" :style="{ alignContent: 'flex-start' }" @click="closePopups">
|
<a-row :gutter="[16, 16]" align="top" :style="{ alignContent: 'flex-start' }" @click="closePopups">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-if="isMobile"
|
title="لیدها"
|
||||||
vertical
|
:icon="UserAddOutlined"
|
||||||
:gap="8"
|
:count="totalLeadsCount"
|
||||||
:style="{ width: '100%' }"
|
:primary-label="isMobile ? 'جدید' : 'لید جدید'"
|
||||||
|
:menu-items="headerMenuItems"
|
||||||
|
:tabs="headerTabs"
|
||||||
|
:active-tab="stageSegValue"
|
||||||
|
searchable
|
||||||
|
search-placeholder="جستجو نام، موبایل، شهر…"
|
||||||
|
:search="q"
|
||||||
|
:view-options="viewOptions"
|
||||||
|
view="list"
|
||||||
|
:active-filters="activeFilterChips"
|
||||||
|
:result-count="activeFilterChips.length ? total : undefined"
|
||||||
|
@primary="openCreate"
|
||||||
|
@menu="onHeaderMenu"
|
||||||
|
@update:active-tab="onHeaderTab"
|
||||||
|
@update:search="onSearchInput"
|
||||||
|
@search-submit="onSearch"
|
||||||
|
@update:view="onViewChange"
|
||||||
|
@remove-filter="onRemoveFilter"
|
||||||
|
@clear-filters="clearMoreFilters"
|
||||||
>
|
>
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
<template #quick-filters>
|
||||||
<a-flex :gap="8" align="center" :style="{ width: '100%' }">
|
<div ref="filterAnchor" :style="{ position: 'relative' }" @click.stop>
|
||||||
<div :style="{ flex: '1 1 0%', minWidth: 0 }">
|
<a-button @click.stop="toggleFilterPopover">
|
||||||
<a-button block type="primary" @click.stop="openCreate">
|
<template #icon><FilterOutlined /></template>
|
||||||
<template #icon><PlusOutlined /></template>
|
فیلتر
|
||||||
جدید
|
<a-badge
|
||||||
|
v-if="mobileFilterBadgeCount"
|
||||||
|
:count="mobileFilterBadgeCount"
|
||||||
|
:number-style="{ backgroundColor: token.colorPrimary, boxShadow: 'none' }"
|
||||||
|
:style="{ marginInlineStart: '6px' }"
|
||||||
|
/>
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
<div v-if="moreFiltersOpen" data-lead-filter :style="filterPanelStyle" @click.stop>
|
||||||
<a-radio-group
|
<a-flex vertical :gap="2">
|
||||||
value="list"
|
<div v-for="facet in textFacets" :key="facet.key" :style="facetItemStyle">
|
||||||
button-style="solid"
|
<div
|
||||||
@change="(e: any) => { if (e?.target?.value === 'board') void router.push({ name: 'leads-board' }) }"
|
role="button"
|
||||||
>
|
tabindex="0"
|
||||||
<a-radio-button value="list">
|
:style="facetRowStyle(facet.key)"
|
||||||
<UnorderedListOutlined />
|
@mouseenter="filterRowHover = facet.key"
|
||||||
</a-radio-button>
|
@mouseleave="filterRowHover = null"
|
||||||
<a-radio-button value="board">
|
@click="toggleFilterSection(facet.key)"
|
||||||
<AppstoreOutlined />
|
@keydown.enter.prevent="toggleFilterSection(facet.key)"
|
||||||
</a-radio-button>
|
>
|
||||||
</a-radio-group>
|
<a-flex justify="space-between" align="center">
|
||||||
<div :style="{ flex: '0 0 auto' }">
|
<span>{{ facet.label }}</span>
|
||||||
<a-dropdown :trigger="['click']" placement="bottomLeft">
|
<a-typography-text :style="facetValueStyle(facet.active)">
|
||||||
<a-button :disabled="busy" aria-label="بیشتر">
|
{{ facet.value }}
|
||||||
<template #icon><MoreOutlined /></template>
|
</a-typography-text>
|
||||||
</a-button>
|
|
||||||
<template #overlay>
|
|
||||||
<a-menu>
|
|
||||||
<a-menu-item
|
|
||||||
key="export"
|
|
||||||
:disabled="busy || (pageBusy && busyMessage.includes('خروجی'))"
|
|
||||||
@click="exportExcel"
|
|
||||||
>
|
|
||||||
<ExportOutlined />
|
|
||||||
خروجی اکسل
|
|
||||||
</a-menu-item>
|
|
||||||
<a-menu-item key="excel" :disabled="busy">
|
|
||||||
<ExcelImportFlow
|
|
||||||
preview-path="/leads/import/preview"
|
|
||||||
import-path="/leads/import/file"
|
|
||||||
:disabled="busy"
|
|
||||||
@start="onExcelImportStart"
|
|
||||||
@done="onExcelImportDone"
|
|
||||||
@fail="onExcelImportFail"
|
|
||||||
@settled="onExcelImportSettled"
|
|
||||||
>
|
|
||||||
<template #default="{ loading: excelLoading }">
|
|
||||||
<a-flex align="center" :gap="8" :style="{ opacity: excelLoading ? 0.6 : 1 }">
|
|
||||||
<FileExcelOutlined />
|
|
||||||
ورود از اکسل
|
|
||||||
</a-flex>
|
</a-flex>
|
||||||
</template>
|
</div>
|
||||||
</ExcelImportFlow>
|
<a-flex
|
||||||
</a-menu-item>
|
v-if="filterSection === facet.key"
|
||||||
<a-menu-item key="phone" :disabled="busy">
|
vertical
|
||||||
<PhoneContactsImport
|
:gap="4"
|
||||||
target="leads"
|
:style="facetBodyStyle"
|
||||||
:disabled="busy"
|
>
|
||||||
@start="onPhoneImportStart"
|
<a-input
|
||||||
@done="onPhoneImportDone"
|
v-if="facet.searchable"
|
||||||
@fail="onPhoneImportFail"
|
v-model:value="filterQuery"
|
||||||
@settled="onPhoneImportSettled"
|
allow-clear
|
||||||
>
|
placeholder="جستجو"
|
||||||
<a-flex align="center" :gap="8">
|
/>
|
||||||
<PhoneOutlined />
|
<div :style="{ maxHeight: '11.5rem', overflow: 'auto', scrollbarWidth: 'none' }">
|
||||||
از مخاطبین گوشی
|
<a-button
|
||||||
|
v-for="option in visibleFacetOptions(facet.options).options"
|
||||||
|
:key="option.value || 'all'"
|
||||||
|
type="text"
|
||||||
|
block
|
||||||
|
:style="facetOptionStyle(facet.current === option.value)"
|
||||||
|
@click="pickFacet(facet.key, option.value)"
|
||||||
|
>
|
||||||
|
{{ option.label }}
|
||||||
|
</a-button>
|
||||||
|
<a-typography-text
|
||||||
|
v-if="visibleFacetOptions(facet.options).empty"
|
||||||
|
type="secondary"
|
||||||
|
>
|
||||||
|
موردی پیدا نشد
|
||||||
|
</a-typography-text>
|
||||||
|
</div>
|
||||||
|
<a-typography-text
|
||||||
|
v-if="visibleFacetOptions(facet.options).hidden"
|
||||||
|
type="secondary"
|
||||||
|
>
|
||||||
|
برای دیدن بقیه، نام را دقیقتر بنویسید
|
||||||
|
</a-typography-text>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
</PhoneContactsImport>
|
|
||||||
</a-menu-item>
|
|
||||||
</a-menu>
|
|
||||||
</template>
|
|
||||||
</a-dropdown>
|
|
||||||
</div>
|
|
||||||
</a-flex>
|
|
||||||
</a-flex>
|
|
||||||
<a-flex
|
|
||||||
v-else
|
|
||||||
justify="space-between"
|
|
||||||
align="center"
|
|
||||||
wrap="wrap"
|
|
||||||
:gap="token.marginSM"
|
|
||||||
>
|
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
|
||||||
<a-space :size="8" wrap>
|
|
||||||
<a-button :disabled="busy" :loading="pageBusy && busyMessage.includes('خروجی')" @click.stop="exportExcel">
|
|
||||||
<template #icon><ExportOutlined /></template>
|
|
||||||
خروجی اکسل
|
|
||||||
</a-button>
|
|
||||||
<ExcelImportFlow
|
|
||||||
preview-path="/leads/import/preview"
|
|
||||||
import-path="/leads/import/file"
|
|
||||||
:disabled="busy"
|
|
||||||
@start="onExcelImportStart"
|
|
||||||
@done="onExcelImportDone"
|
|
||||||
@fail="onExcelImportFail"
|
|
||||||
@settled="onExcelImportSettled"
|
|
||||||
>
|
|
||||||
<template #default="{ loading: excelLoading }">
|
|
||||||
<a-button :disabled="busy" :loading="excelLoading">
|
|
||||||
<template #icon><FileExcelOutlined /></template>
|
|
||||||
ورود از اکسل
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
</ExcelImportFlow>
|
|
||||||
<PhoneContactsImport
|
|
||||||
target="leads"
|
|
||||||
:disabled="busy"
|
|
||||||
@start="onPhoneImportStart"
|
|
||||||
@done="onPhoneImportDone"
|
|
||||||
@fail="onPhoneImportFail"
|
|
||||||
@settled="onPhoneImportSettled"
|
|
||||||
>
|
|
||||||
<a-button :disabled="busy">
|
|
||||||
<template #icon><PhoneOutlined /></template>
|
|
||||||
از مخاطبین گوشی
|
|
||||||
</a-button>
|
|
||||||
</PhoneContactsImport>
|
|
||||||
<a-button type="primary" @click.stop="openCreate">
|
|
||||||
<template #icon><PlusOutlined /></template>
|
|
||||||
لید جدید
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<a-col :span="24" @click.stop>
|
|
||||||
<a-flex vertical :gap="8">
|
|
||||||
<a-flex v-if="!isMobile" wrap="wrap" :gap="8" align="center">
|
|
||||||
<a-button :type="!stageId ? 'primary' : 'default'" @click="setStageFilter('')">
|
|
||||||
همه لیدها
|
|
||||||
<a-typography-text
|
|
||||||
:type="!stageId ? undefined : 'secondary'"
|
|
||||||
:style="{ color: !stageId ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
|
||||||
>
|
|
||||||
{{ formatCount(totalLeadsCount) }}
|
|
||||||
</a-typography-text>
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
v-for="card in stageCards"
|
|
||||||
:key="card.key"
|
|
||||||
:type="isStatActive(card) ? 'primary' : 'default'"
|
|
||||||
@click="selectStatCard(card)"
|
|
||||||
>
|
|
||||||
{{ card.label }}
|
|
||||||
<a-typography-text
|
|
||||||
:type="isStatActive(card) ? undefined : 'secondary'"
|
|
||||||
:style="{ color: isStatActive(card) ? 'inherit' : undefined, marginInlineStart: '6px' }"
|
|
||||||
>
|
|
||||||
{{ formatCount(card.count) }}
|
|
||||||
</a-typography-text>
|
|
||||||
</a-button>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-flex
|
|
||||||
v-if="isMobile"
|
|
||||||
wrap="nowrap"
|
|
||||||
:gap="8"
|
|
||||||
align="center"
|
|
||||||
:style="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<div :style="{ flex: '1 1 0%', minWidth: 0 }">
|
|
||||||
<a-select
|
|
||||||
:value="stageId"
|
|
||||||
style="width: 100%"
|
|
||||||
:options="stageFilterOptions"
|
|
||||||
@update:value="(v) => setStageFilter(String(v ?? ''))"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div :style="{ flex: '1 1 0%', minWidth: 0 }">
|
|
||||||
<a-select
|
|
||||||
:value="sort"
|
|
||||||
style="width: 100%"
|
|
||||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
|
||||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<!-- موبایل: جستجو + آیکن فیلتر داخل یک باکس (مثل مخاطبین) -->
|
|
||||||
<a-input
|
|
||||||
v-if="isMobile"
|
|
||||||
v-model:value="q"
|
|
||||||
allow-clear
|
|
||||||
placeholder="جستجو نام، موبایل، شهر…"
|
|
||||||
style="width: 100%"
|
|
||||||
@pressEnter="onSearch"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<SearchOutlined />
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<span
|
|
||||||
ref="filterAnchor"
|
|
||||||
:style="{
|
|
||||||
display: 'inline-flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: '4px',
|
|
||||||
color: mobileFilterBadgeCount ? token.colorPrimary : token.colorTextSecondary,
|
|
||||||
}"
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
aria-label="فیلتر"
|
|
||||||
@click.stop="toggleFilterPopover"
|
|
||||||
@keydown.enter.prevent="toggleFilterPopover"
|
|
||||||
>
|
|
||||||
<FilterOutlined />
|
|
||||||
<a-typography-text
|
|
||||||
v-if="mobileFilterBadgeCount"
|
|
||||||
:style="{ color: 'inherit', fontSize: `${token.fontSizeSM}px` }"
|
|
||||||
>
|
|
||||||
{{ toFaDigits(mobileFilterBadgeCount) }}
|
|
||||||
</a-typography-text>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</a-input>
|
|
||||||
|
|
||||||
<a-flex
|
|
||||||
v-else
|
|
||||||
justify="space-between"
|
|
||||||
align="center"
|
|
||||||
wrap="wrap"
|
|
||||||
:gap="8"
|
|
||||||
:style="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<a-flex wrap="wrap" align="center" :gap="8">
|
|
||||||
<a-input-search
|
|
||||||
v-model:value="q"
|
|
||||||
allow-clear
|
|
||||||
placeholder="جستجو نام، موبایل، شهر…"
|
|
||||||
style="width: 15rem; max-width: 100%"
|
|
||||||
@search="onSearch"
|
|
||||||
>
|
|
||||||
<template #enterButton>
|
|
||||||
<a-button type="primary">
|
|
||||||
<template #icon><SearchOutlined /></template>
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
</a-input-search>
|
|
||||||
<div ref="filterAnchor" :style="{ position: 'relative', flex: '0 0 auto' }">
|
|
||||||
<a-button
|
|
||||||
:style="mobileFilterBadgeCount
|
|
||||||
? {
|
|
||||||
borderColor: token.colorPrimary,
|
|
||||||
color: token.colorPrimary,
|
|
||||||
background: token.colorPrimaryBg,
|
|
||||||
}
|
|
||||||
: undefined"
|
|
||||||
@click.stop="toggleFilterPopover"
|
|
||||||
>
|
|
||||||
<a-flex align="center" justify="center" :gap="6">
|
|
||||||
<FilterOutlined />
|
|
||||||
<span>{{ filterBtnLabel }}</span>
|
|
||||||
<DownOutlined />
|
|
||||||
</a-flex>
|
|
||||||
</a-button>
|
|
||||||
</div>
|
|
||||||
<a-select
|
|
||||||
:value="sort"
|
|
||||||
style="width: 10rem"
|
|
||||||
:options="Object.entries(sortLabels).map(([value, label]) => ({ value, label }))"
|
|
||||||
@update:value="(v) => setSort(String(v ?? 'updated') as SortKey)"
|
|
||||||
/>
|
|
||||||
</a-flex>
|
|
||||||
<a-space :size="8">
|
|
||||||
<TableColumnsMenu table-key="leads" align="end" />
|
|
||||||
<a-radio-group
|
|
||||||
value="list"
|
|
||||||
button-style="solid"
|
|
||||||
@change="(e: any) => { if (e?.target?.value === 'board') void router.push({ name: 'leads-board' }) }"
|
|
||||||
>
|
|
||||||
<a-radio-button value="list">
|
|
||||||
<UnorderedListOutlined />
|
|
||||||
</a-radio-button>
|
|
||||||
<a-radio-button value="board">
|
|
||||||
<AppstoreOutlined />
|
|
||||||
</a-radio-button>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<Teleport to="body">
|
|
||||||
<div
|
|
||||||
v-if="moreFiltersOpen"
|
|
||||||
data-lead-filter
|
|
||||||
:style="filterPanelStyle"
|
|
||||||
@click.stop
|
|
||||||
>
|
|
||||||
<a-flex vertical :gap="10">
|
|
||||||
<div v-for="facet in textFacets" :key="facet.key">
|
|
||||||
<div
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
:style="{ cursor: 'pointer' }"
|
|
||||||
@click="toggleFilterSection(facet.key)"
|
|
||||||
@keydown.enter.prevent="toggleFilterSection(facet.key)"
|
|
||||||
>
|
|
||||||
<a-flex justify="space-between" align="center">
|
|
||||||
<span>{{ facet.label }}</span>
|
|
||||||
<a-typography-text :style="facetValueStyle(facet.active)">
|
|
||||||
{{ facet.value }}
|
|
||||||
</a-typography-text>
|
|
||||||
</a-flex>
|
|
||||||
</div>
|
|
||||||
<a-flex
|
|
||||||
v-if="filterSection === facet.key"
|
|
||||||
vertical
|
|
||||||
:gap="4"
|
|
||||||
:style="{ marginTop: '6px' }"
|
|
||||||
>
|
|
||||||
<a-input
|
|
||||||
v-if="facet.searchable"
|
|
||||||
v-model:value="filterQuery"
|
|
||||||
allow-clear
|
|
||||||
placeholder="جستجو"
|
|
||||||
/>
|
|
||||||
<div :style="{ maxHeight: '11.5rem', overflow: 'auto' }">
|
|
||||||
<a-button
|
|
||||||
v-for="option in visibleFacetOptions(facet.options).options"
|
|
||||||
:key="option.value || 'all'"
|
|
||||||
type="text"
|
|
||||||
block
|
|
||||||
:style="facetOptionStyle(facet.current === option.value)"
|
|
||||||
@click="pickFacet(facet.key, option.value)"
|
|
||||||
>
|
|
||||||
{{ option.label }}
|
|
||||||
</a-button>
|
|
||||||
<a-typography-text
|
|
||||||
v-if="visibleFacetOptions(facet.options).empty"
|
|
||||||
type="secondary"
|
|
||||||
>
|
|
||||||
موردی پیدا نشد
|
|
||||||
</a-typography-text>
|
|
||||||
</div>
|
</div>
|
||||||
<a-typography-text
|
|
||||||
v-if="visibleFacetOptions(facet.options).hidden"
|
|
||||||
type="secondary"
|
|
||||||
>
|
|
||||||
برای دیدن بقیه، نام را دقیقتر بنویسید
|
|
||||||
</a-typography-text>
|
|
||||||
</a-flex>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div :style="facetItemStyle">
|
||||||
<div
|
<div
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
:style="{ cursor: 'pointer' }"
|
:style="facetRowStyle('createdFrom')"
|
||||||
@click="toggleFilterSection('createdFrom')"
|
@mouseenter="filterRowHover = 'createdFrom'"
|
||||||
@keydown.enter.prevent="toggleFilterSection('createdFrom')"
|
@mouseleave="filterRowHover = null"
|
||||||
>
|
@click="toggleFilterSection('createdFrom')"
|
||||||
<a-flex justify="space-between" align="center">
|
@keydown.enter.prevent="toggleFilterSection('createdFrom')"
|
||||||
<span>از تاریخ ثبت</span>
|
>
|
||||||
<a-typography-text :style="facetValueStyle(Boolean(createdFromFilter))">
|
<a-flex justify="space-between" align="center">
|
||||||
{{ dateFacetLabel(createdFromFilter) }}
|
<span>از تاریخ ثبت</span>
|
||||||
</a-typography-text>
|
<a-typography-text :style="facetValueStyle(Boolean(createdFromFilter))">
|
||||||
</a-flex>
|
{{ dateFacetLabel(createdFromFilter) }}
|
||||||
</div>
|
</a-typography-text>
|
||||||
<div v-if="filterSection === 'createdFrom'" :style="{ marginTop: '6px' }">
|
</a-flex>
|
||||||
<JalaliDateInput
|
</div>
|
||||||
:model-value="createdFromFilter"
|
<div v-if="filterSection === 'createdFrom'" :style="facetBodyStyle">
|
||||||
placeholder="از تاریخ"
|
<JalaliDateInput
|
||||||
@update:model-value="(value: string) => { setCreatedFromFilter(value); filterSection = null }"
|
:model-value="createdFromFilter"
|
||||||
/>
|
placeholder="از تاریخ"
|
||||||
</div>
|
@update:model-value="(value: string) => { setCreatedFromFilter(value); filterSection = null }"
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div :style="facetItemStyle">
|
||||||
<div
|
<div
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
:style="{ cursor: 'pointer' }"
|
:style="facetRowStyle('createdTo')"
|
||||||
@click="toggleFilterSection('createdTo')"
|
@mouseenter="filterRowHover = 'createdTo'"
|
||||||
@keydown.enter.prevent="toggleFilterSection('createdTo')"
|
@mouseleave="filterRowHover = null"
|
||||||
>
|
@click="toggleFilterSection('createdTo')"
|
||||||
<a-flex justify="space-between" align="center">
|
@keydown.enter.prevent="toggleFilterSection('createdTo')"
|
||||||
<span>تا تاریخ ثبت</span>
|
>
|
||||||
<a-typography-text :style="facetValueStyle(Boolean(createdToFilter))">
|
<a-flex justify="space-between" align="center">
|
||||||
{{ dateFacetLabel(createdToFilter) }}
|
<span>تا تاریخ ثبت</span>
|
||||||
</a-typography-text>
|
<a-typography-text :style="facetValueStyle(Boolean(createdToFilter))">
|
||||||
</a-flex>
|
{{ dateFacetLabel(createdToFilter) }}
|
||||||
</div>
|
</a-typography-text>
|
||||||
<div v-if="filterSection === 'createdTo'" :style="{ marginTop: '6px' }">
|
</a-flex>
|
||||||
<JalaliDateInput
|
</div>
|
||||||
:model-value="createdToFilter"
|
<div v-if="filterSection === 'createdTo'" :style="facetBodyStyle">
|
||||||
placeholder="تا تاریخ"
|
<JalaliDateInput
|
||||||
@update:model-value="(value: string) => { setCreatedToFilter(value); filterSection = null }"
|
:model-value="createdToFilter"
|
||||||
/>
|
placeholder="تا تاریخ"
|
||||||
</div>
|
@update:model-value="(value: string) => { setCreatedToFilter(value); filterSection = null }"
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div :style="facetItemStyle">
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
tabindex="0"
|
||||||
|
:style="facetRowStyle('converted')"
|
||||||
|
@mouseenter="filterRowHover = 'converted'"
|
||||||
|
@mouseleave="filterRowHover = null"
|
||||||
|
@click="toggleFilterSection('converted')"
|
||||||
|
@keydown.enter.prevent="toggleFilterSection('converted')"
|
||||||
|
>
|
||||||
|
<a-flex justify="space-between" align="center">
|
||||||
|
<span>تبدیلشده</span>
|
||||||
|
<a-typography-text :style="facetValueStyle(convertedFilter)">
|
||||||
|
{{ convertedFilter ? 'فقط' : 'همه' }}
|
||||||
|
</a-typography-text>
|
||||||
|
</a-flex>
|
||||||
|
</div>
|
||||||
|
<a-flex v-if="filterSection === 'converted'" vertical :style="facetBodyStyle">
|
||||||
|
<a-button
|
||||||
|
type="text"
|
||||||
|
block
|
||||||
|
:style="facetOptionStyle(!convertedFilter)"
|
||||||
|
@click="pickFlag('converted', false)"
|
||||||
|
>
|
||||||
|
همه
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="text"
|
||||||
|
block
|
||||||
|
:style="facetOptionStyle(convertedFilter)"
|
||||||
|
@click="pickFlag('converted', true)"
|
||||||
|
>
|
||||||
|
فقط تبدیلشدهها
|
||||||
|
</a-button>
|
||||||
|
</a-flex>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div :style="facetItemStyle">
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
tabindex="0"
|
||||||
|
:style="facetRowStyle('archived')"
|
||||||
|
@mouseenter="filterRowHover = 'archived'"
|
||||||
|
@mouseleave="filterRowHover = null"
|
||||||
|
@click="toggleFilterSection('archived')"
|
||||||
|
@keydown.enter.prevent="toggleFilterSection('archived')"
|
||||||
|
>
|
||||||
|
<a-flex justify="space-between" align="center">
|
||||||
|
<span>بایگانی</span>
|
||||||
|
<a-typography-text :style="facetValueStyle(archivedFilter)">
|
||||||
|
{{ archivedFilter ? 'فقط' : 'همه' }}
|
||||||
|
</a-typography-text>
|
||||||
|
</a-flex>
|
||||||
|
</div>
|
||||||
|
<a-flex v-if="filterSection === 'archived'" vertical :style="facetBodyStyle">
|
||||||
|
<a-button
|
||||||
|
type="text"
|
||||||
|
block
|
||||||
|
:style="facetOptionStyle(!archivedFilter)"
|
||||||
|
@click="pickFlag('archived', false)"
|
||||||
|
>
|
||||||
|
همه
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="text"
|
||||||
|
block
|
||||||
|
:style="facetOptionStyle(archivedFilter)"
|
||||||
|
@click="pickFlag('archived', true)"
|
||||||
|
>
|
||||||
|
فقط بایگانیشدهها
|
||||||
|
</a-button>
|
||||||
|
</a-flex>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
:style="{ cursor: 'pointer' }"
|
|
||||||
@click="toggleFilterSection('converted')"
|
|
||||||
@keydown.enter.prevent="toggleFilterSection('converted')"
|
|
||||||
>
|
|
||||||
<a-flex justify="space-between" align="center">
|
|
||||||
<span>تبدیلشده</span>
|
|
||||||
<a-typography-text :style="facetValueStyle(convertedFilter)">
|
|
||||||
{{ convertedFilter ? 'فقط' : 'همه' }}
|
|
||||||
</a-typography-text>
|
|
||||||
</a-flex>
|
|
||||||
</div>
|
|
||||||
<a-flex v-if="filterSection === 'converted'" vertical :style="{ marginTop: '6px' }">
|
|
||||||
<a-button
|
<a-button
|
||||||
|
v-if="mobileFilterBadgeCount"
|
||||||
type="text"
|
type="text"
|
||||||
|
danger
|
||||||
block
|
block
|
||||||
:style="facetOptionStyle(!convertedFilter)"
|
@click="clearMoreFilters"
|
||||||
@click="pickFlag('converted', false)"
|
|
||||||
>
|
>
|
||||||
همه
|
پاک کردن فیلترها
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
type="text"
|
|
||||||
block
|
|
||||||
:style="facetOptionStyle(convertedFilter)"
|
|
||||||
@click="pickFlag('converted', true)"
|
|
||||||
>
|
|
||||||
فقط تبدیلشدهها
|
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="!isMobile" #toolbar-end>
|
||||||
|
<TableColumnsMenu table-key="leads" icon-only align="end" />
|
||||||
|
</template>
|
||||||
|
<template #chips-end>
|
||||||
|
<FilterChips
|
||||||
|
label="مرتبسازی"
|
||||||
|
:options="sortOptions"
|
||||||
|
:multiple="false"
|
||||||
|
:show-all="false"
|
||||||
|
:model-value="sortSelected"
|
||||||
|
@update:model-value="onSortChange"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<div>
|
<!-- تریگرهای ورود داده؛ از منوی «⋯» هدر کلیک میشوند (مودالهایشان به body تلپورت میشوند) -->
|
||||||
<div
|
<div hidden>
|
||||||
role="button"
|
<ExcelImportFlow
|
||||||
tabindex="0"
|
preview-path="/leads/import/preview"
|
||||||
:style="{ cursor: 'pointer' }"
|
import-path="/leads/import/file"
|
||||||
@click="toggleFilterSection('archived')"
|
:disabled="busy"
|
||||||
@keydown.enter.prevent="toggleFilterSection('archived')"
|
@start="onExcelImportStart"
|
||||||
>
|
@done="onExcelImportDone"
|
||||||
<a-flex justify="space-between" align="center">
|
@fail="onExcelImportFail"
|
||||||
<span>بایگانی</span>
|
@settled="onExcelImportSettled"
|
||||||
<a-typography-text :style="facetValueStyle(archivedFilter)">
|
>
|
||||||
{{ archivedFilter ? 'فقط' : 'همه' }}
|
<span ref="excelImportTrigger"></span>
|
||||||
</a-typography-text>
|
</ExcelImportFlow>
|
||||||
</a-flex>
|
<PhoneContactsImport
|
||||||
</div>
|
target="leads"
|
||||||
<a-flex v-if="filterSection === 'archived'" vertical :style="{ marginTop: '6px' }">
|
:disabled="busy"
|
||||||
<a-button
|
@start="onPhoneImportStart"
|
||||||
type="text"
|
@done="onPhoneImportDone"
|
||||||
block
|
@fail="onPhoneImportFail"
|
||||||
:style="facetOptionStyle(!archivedFilter)"
|
@settled="onPhoneImportSettled"
|
||||||
@click="pickFlag('archived', false)"
|
>
|
||||||
>
|
<span ref="phoneImportTrigger"></span>
|
||||||
همه
|
</PhoneContactsImport>
|
||||||
</a-button>
|
</div>
|
||||||
<a-button
|
|
||||||
type="text"
|
|
||||||
block
|
|
||||||
:style="facetOptionStyle(archivedFilter)"
|
|
||||||
@click="pickFlag('archived', true)"
|
|
||||||
>
|
|
||||||
فقط بایگانیشدهها
|
|
||||||
</a-button>
|
|
||||||
</a-flex>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a-button
|
|
||||||
v-if="mobileFilterBadgeCount"
|
|
||||||
type="text"
|
|
||||||
danger
|
|
||||||
block
|
|
||||||
@click="clearMoreFilters"
|
|
||||||
>
|
|
||||||
پاک کردن فیلترها
|
|
||||||
</a-button>
|
|
||||||
</a-flex>
|
|
||||||
</div>
|
|
||||||
</Teleport>
|
|
||||||
</a-flex>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col v-if="selectedIds.length" :span="24" @click.stop>
|
<a-col v-if="selectedIds.length" :span="24" @click.stop>
|
||||||
@@ -2100,7 +2007,7 @@ onBeforeUnmount(() => {
|
|||||||
allow-clear
|
allow-clear
|
||||||
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
|
||||||
/>
|
/>
|
||||||
<a-button :disabled="!bulkStageId || busy" @click="openBulkStageReason">اعمال وضعیت</a-button>
|
<a-button :disabled="!bulkStageId || busy" @click="bulkStageSelected">اعمال وضعیت</a-button>
|
||||||
</template>
|
</template>
|
||||||
<a-button danger :disabled="busy" @click="archiveSelected">بایگانی</a-button>
|
<a-button danger :disabled="busy" @click="archiveSelected">بایگانی</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
@@ -2125,8 +2032,9 @@ onBeforeUnmount(() => {
|
|||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
|
<a-card>
|
||||||
<a-spin :spinning="loading || pageBusy" :tip="pageBusy ? busyMessage : undefined">
|
<a-spin :spinning="loading || pageBusy" :tip="pageBusy ? busyMessage : undefined">
|
||||||
<template v-if="data?.items.length">
|
<template v-if="data?.items?.length">
|
||||||
<a-row v-if="isMobile" :gutter="[12, 12]">
|
<a-row v-if="isMobile" :gutter="[12, 12]">
|
||||||
<a-col v-for="(lead, idx) in data.items" :key="`m-${lead.id}`" :span="24">
|
<a-col v-for="(lead, idx) in data.items" :key="`m-${lead.id}`" :span="24">
|
||||||
<a-card
|
<a-card
|
||||||
@@ -2238,10 +2146,7 @@ onBeforeUnmount(() => {
|
|||||||
:pagination="false"
|
:pagination="false"
|
||||||
:row-key="(r: LeadDto) => r.id"
|
:row-key="(r: LeadDto) => r.id"
|
||||||
:scroll="{ x: 1100 }"
|
:scroll="{ x: 1100 }"
|
||||||
:custom-row="(record: LeadDto) => ({
|
:custom-row="(record: LeadDto) => ({ onClick: () => goDetail(record.id) })"
|
||||||
onClick: () => goDetail(record.id),
|
|
||||||
style: { cursor: 'pointer' },
|
|
||||||
})"
|
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'select'">
|
<template v-if="column.key === 'select'">
|
||||||
@@ -2270,11 +2175,6 @@ onBeforeUnmount(() => {
|
|||||||
<a-tag v-if="(record as LeadDto).source">{{ (record as LeadDto).source }}</a-tag>
|
<a-tag v-if="(record as LeadDto).source">{{ (record as LeadDto).source }}</a-tag>
|
||||||
<a-typography-text v-else type="secondary">—</a-typography-text>
|
<a-typography-text v-else type="secondary">—</a-typography-text>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'activityExperience'">
|
|
||||||
<a-typography-text>
|
|
||||||
{{ (record as LeadDto).activityExperience || '—' }}
|
|
||||||
</a-typography-text>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="column.key === 'createdAt'">
|
<template v-else-if="column.key === 'createdAt'">
|
||||||
{{ formatJalaliNumeric(new Date((record as LeadDto).createdAt)) }}
|
{{ formatJalaliNumeric(new Date((record as LeadDto).createdAt)) }}
|
||||||
</template>
|
</template>
|
||||||
@@ -2370,6 +2270,7 @@ onBeforeUnmount(() => {
|
|||||||
</a-space>
|
</a-space>
|
||||||
</a-empty>
|
</a-empty>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-modal
|
<a-modal
|
||||||
@@ -2584,36 +2485,5 @@ onBeforeUnmount(() => {
|
|||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<a-modal
|
|
||||||
v-model:open="bulkStageReasonOpen"
|
|
||||||
title="دلیل تغییر وضعیت"
|
|
||||||
ok-text="ثبت و انتقال"
|
|
||||||
cancel-text="انصراف"
|
|
||||||
:confirm-loading="busy"
|
|
||||||
:ok-button-props="{ disabled: !bulkStageReason.trim() }"
|
|
||||||
@ok="bulkStageSelected"
|
|
||||||
@cancel="cancelBulkStageReason"
|
|
||||||
>
|
|
||||||
<a-flex vertical :gap="12">
|
|
||||||
<a-typography-text type="secondary">
|
|
||||||
انتقال {{ toFaDigits(selectedIds.length) }} لید به
|
|
||||||
«{{ stages.find((s) => s.id === bulkStageId)?.name || '—' }}»
|
|
||||||
</a-typography-text>
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="bulkStageReason"
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="1000"
|
|
||||||
show-count
|
|
||||||
placeholder="دلیل تغییر وضعیت را بنویسید…"
|
|
||||||
/>
|
|
||||||
<a-alert
|
|
||||||
v-if="bulkStageReasonError"
|
|
||||||
type="error"
|
|
||||||
show-icon
|
|
||||||
:message="bulkStageReasonError"
|
|
||||||
/>
|
|
||||||
</a-flex>
|
|
||||||
</a-modal>
|
|
||||||
</a-row>
|
</a-row>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ import {
|
|||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonCard, CrmSkeletonKpi } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard, CrmSkeletonKpi } from '@/components/skeleton';
|
||||||
import type { Component } from 'vue';
|
import type { Component } from 'vue';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
@@ -726,16 +727,18 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
title="باشگاه مشتریان"
|
||||||
<CrownOutlined :style="{ color: 'var(--ant-color-warning)' }" />
|
subtitle="امتیاز، سطح و پاداش مشتریان وفادار"
|
||||||
باشگاه مشتریان
|
:icon="CrownOutlined"
|
||||||
</a-typography-title>
|
>
|
||||||
<a-button @click="openSettings">
|
<template #actions>
|
||||||
<template #icon><SettingOutlined /></template>
|
<a-button @click="openSettings">
|
||||||
تنظیمات باشگاه
|
<template #icon><SettingOutlined /></template>
|
||||||
</a-button>
|
تنظیمات باشگاه
|
||||||
</a-flex>
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ import {
|
|||||||
UserOutlined,
|
UserOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonList, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonList, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
@@ -803,13 +804,17 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- Desktop -->
|
<!-- Desktop -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">اتوماسیون پیامکها</a-typography-title>
|
title="اتوماسیون پیامکها"
|
||||||
<a-button :disabled="loading" @click="load">
|
subtitle="برای هر رویداد در سیستم، به صورت خودکار پیامک ارسال کنید"
|
||||||
<template #icon><ReloadOutlined /></template>
|
:icon="MessageOutlined"
|
||||||
بروزرسانی
|
>
|
||||||
</a-button>
|
<template #actions>
|
||||||
</a-flex>
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ import {
|
|||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
import type { TableColumnsType } from 'ant-design-vue';
|
import type { TableColumnsType } from 'ant-design-vue';
|
||||||
import { ReloadOutlined } from '@/icons/ant-bridge';
|
import { ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ShoppingOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -269,15 +271,17 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
title="فروشگاههای مونتیفای"
|
||||||
فروشگاههای مونتیفای
|
subtitle="اتصال فروشگاهها برای همگامسازی سفارشها و مشتریان"
|
||||||
</a-typography-title>
|
:icon="ShoppingOutlined"
|
||||||
<a-button :disabled="loading" @click="load()">
|
>
|
||||||
<template #icon><ReloadOutlined /></template>
|
<template #actions>
|
||||||
بروزرسانی
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load()">
|
||||||
</a-button>
|
<template #icon><ReloadOutlined /></template>
|
||||||
</a-flex>
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||||
|
|||||||
+114
-146
@@ -11,6 +11,14 @@ import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
|||||||
import VoiceToTextButton from '@/components/VoiceToTextButton.vue';
|
import VoiceToTextButton from '@/components/VoiceToTextButton.vue';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
import { UiDropdownMenu } from '@/components/ui';
|
import { UiDropdownMenu } from '@/components/ui';
|
||||||
|
import { FilterChips, PageHeader } from '@/components/page';
|
||||||
|
import type { PageHeaderMenuItem, PageHeaderViewOption } from '@/components/page';
|
||||||
|
import {
|
||||||
|
AppstoreOutlined,
|
||||||
|
FileTextOutlined,
|
||||||
|
SettingOutlined,
|
||||||
|
UnorderedListOutlined,
|
||||||
|
} from '@/icons/ant-bridge';
|
||||||
import { appendSpokenText } from '@/lib/spoken-text';
|
import { appendSpokenText } from '@/lib/spoken-text';
|
||||||
import { canManageSettings } from '@/lib/roles';
|
import { canManageSettings } from '@/lib/roles';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
@@ -119,6 +127,46 @@ const categoryChips = computed(() => [
|
|||||||
.map((item) => ({ value: item.key, label: item.label, tone: item.tone || 'general' })),
|
.map((item) => ({ value: item.key, label: item.label, tone: item.tone || 'general' })),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/* ---------- هدر صفحه (دسکتاپ) ---------- */
|
||||||
|
const categoryOptions = computed(() =>
|
||||||
|
categoryChips.value
|
||||||
|
.filter((c) => c.value !== 'all')
|
||||||
|
.map((c) => ({ value: c.value, label: c.label })),
|
||||||
|
);
|
||||||
|
|
||||||
|
const visibilityOptions: Array<{ value: NoteVisibility; label: string }> = [
|
||||||
|
{ value: 'team', label: 'تیمی' },
|
||||||
|
{ value: 'personal', label: 'فقط من' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const sortOptions: Array<{ value: SortKey; label: string }> = [
|
||||||
|
{ value: 'updatedAt', label: 'جدیدترین' },
|
||||||
|
{ value: 'createdAt', label: 'تاریخ ایجاد' },
|
||||||
|
{ value: 'reminderAt', label: 'یادآوری' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const viewOptions: PageHeaderViewOption[] = [
|
||||||
|
{ value: 'grid', label: 'شبکه', icon: AppstoreOutlined },
|
||||||
|
{ value: 'list', label: 'لیست', icon: UnorderedListOutlined },
|
||||||
|
];
|
||||||
|
|
||||||
|
const headerMenuItems = computed<PageHeaderMenuItem[]>(() =>
|
||||||
|
canManageNoteFields.value
|
||||||
|
? [{ key: 'categories', label: 'مدیریت دستهها', icon: SettingOutlined }]
|
||||||
|
: [],
|
||||||
|
);
|
||||||
|
|
||||||
|
function onHeaderMenu(key: string) {
|
||||||
|
if (key === 'categories') categoriesOpen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSearchInput(value: string) {
|
||||||
|
const hadQuery = !!q.value;
|
||||||
|
q.value = value;
|
||||||
|
// پاک کردن با × فوراً همهٔ یادداشتها را برمیگرداند
|
||||||
|
if (!value && hadQuery) void load();
|
||||||
|
}
|
||||||
|
|
||||||
const noteTypeOptions = computed(() =>
|
const noteTypeOptions = computed(() =>
|
||||||
noteCategories.value
|
noteCategories.value
|
||||||
.filter((item) => item.isActive)
|
.filter((item) => item.isActive)
|
||||||
@@ -759,95 +807,64 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="notes-page">
|
<section class="notes-page">
|
||||||
<header class="page-head">
|
<!--
|
||||||
<div>
|
هدر یکپارچه. نوار ابزار و ردیف چیپ فقط در دسکتاپ؛
|
||||||
<h1>یادداشتها</h1>
|
موبایل نوار سریع و چیپهای اسکرولی خودش را دارد.
|
||||||
<p class="lead">فکر کنید، یادداشت کنید، هیچ چیز را فراموش نکنید.</p>
|
-->
|
||||||
</div>
|
<PageHeader
|
||||||
</header>
|
title="یادداشتها"
|
||||||
|
subtitle="فکر کنید، یادداشت کنید، هیچ چیز را فراموش نکنید."
|
||||||
|
:icon="FileTextOutlined"
|
||||||
|
:count="loading ? undefined : notes.length"
|
||||||
|
:primary-label="isMobile ? undefined : 'یادداشت جدید'"
|
||||||
|
:menu-items="headerMenuItems"
|
||||||
|
:searchable="!isMobile"
|
||||||
|
:search="q"
|
||||||
|
search-placeholder="جستجو در یادداشتها…"
|
||||||
|
:view-options="isMobile ? [] : viewOptions"
|
||||||
|
:view="viewMode"
|
||||||
|
@primary="openEditor()"
|
||||||
|
@menu="onHeaderMenu"
|
||||||
|
@update:search="onSearchInput"
|
||||||
|
@search-submit="load"
|
||||||
|
@update:view="(v?: string) => (viewMode = v === 'list' ? 'list' : 'grid')"
|
||||||
|
>
|
||||||
|
<template v-if="!isMobile" #chips>
|
||||||
|
<FilterChips
|
||||||
|
label="دسته"
|
||||||
|
:options="categoryOptions"
|
||||||
|
:multiple="false"
|
||||||
|
:model-value="typeFilter === 'all' ? [] : [typeFilter]"
|
||||||
|
@update:model-value="(v: string[]) => (typeFilter = v[0] ?? 'all')"
|
||||||
|
/>
|
||||||
|
<FilterChips
|
||||||
|
label="دسترسی"
|
||||||
|
:options="visibilityOptions"
|
||||||
|
:multiple="false"
|
||||||
|
:model-value="visibilityFilter === 'all' ? [] : [visibilityFilter]"
|
||||||
|
@update:model-value="(v: NoteVisibility[]) => (visibilityFilter = v[0] ?? 'all')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-if="!isMobile" #chips-end>
|
||||||
|
<FilterChips
|
||||||
|
label="مرتبسازی"
|
||||||
|
:options="sortOptions"
|
||||||
|
:multiple="false"
|
||||||
|
:show-all="false"
|
||||||
|
:model-value="[sortKey]"
|
||||||
|
@update:model-value="(v: SortKey[]) => v[0] && (sortKey = v[0])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<p v-if="error" class="banner-error">{{ error }}</p>
|
<p v-if="error" class="banner-error">{{ error }}</p>
|
||||||
|
|
||||||
<!-- Desktop toolbar -->
|
|
||||||
<div class="toolbar desktop-only">
|
|
||||||
<div class="chips">
|
|
||||||
<button
|
|
||||||
v-for="chip in categoryChips"
|
|
||||||
:key="chip.value"
|
|
||||||
type="button"
|
|
||||||
class="chip"
|
|
||||||
:class="[`tone-${chip.tone}`, { active: typeFilter === chip.value }]"
|
|
||||||
@click="typeFilter = chip.value"
|
|
||||||
>
|
|
||||||
<span v-if="chip.value !== 'all'" class="dot" />
|
|
||||||
{{ chip.label }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
v-if="canManageNoteFields"
|
|
||||||
type="button"
|
|
||||||
class="chip chip-manage"
|
|
||||||
@click="categoriesOpen = true"
|
|
||||||
>
|
|
||||||
دستهها
|
|
||||||
</button>
|
|
||||||
<span class="chip-sep" aria-hidden="true" />
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="chip"
|
|
||||||
:class="{ active: visibilityFilter === 'all' }"
|
|
||||||
@click="visibilityFilter = 'all'"
|
|
||||||
>
|
|
||||||
همه دسترسیها
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="chip tone-team"
|
|
||||||
:class="{ active: visibilityFilter === 'team' }"
|
|
||||||
@click="visibilityFilter = 'team'"
|
|
||||||
>
|
|
||||||
تیمی
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="chip tone-private"
|
|
||||||
:class="{ active: visibilityFilter === 'personal' }"
|
|
||||||
@click="visibilityFilter = 'personal'"
|
|
||||||
>
|
|
||||||
فقط من
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="toolbar-end">
|
|
||||||
<div class="view-toggle" role="group" aria-label="نمای لیست">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
:class="{ active: viewMode === 'grid' }"
|
|
||||||
title="شبکه"
|
|
||||||
@click="viewMode = 'grid'"
|
|
||||||
>
|
|
||||||
<UiIcon name="grid" :size="18" />
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
:class="{ active: viewMode === 'list' }"
|
|
||||||
title="لیست"
|
|
||||||
@click="viewMode = 'list'"
|
|
||||||
>
|
|
||||||
<UiIcon name="list" :size="18" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<select v-model="sortKey" class="sort-select" aria-label="مرتبسازی">
|
|
||||||
<option value="updatedAt">جدیدترین</option>
|
|
||||||
<option value="createdAt">تاریخ ایجاد</option>
|
|
||||||
<option value="reminderAt">یادآوری</option>
|
|
||||||
</select>
|
|
||||||
<button type="button" class="icon-btn" title="فیلتر" @click="q = q; load()">
|
|
||||||
<UiIcon name="filter" :size="18" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Desktop quick-add -->
|
<!-- Desktop quick-add -->
|
||||||
<div class="quick-add desktop-only" @click="openEditor()">
|
<div
|
||||||
|
class="quick-add desktop-only"
|
||||||
|
:class="{ 'is-list': viewMode === 'list' }"
|
||||||
|
@click="openEditor()"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
class="quick-input"
|
class="quick-input"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -1124,10 +1141,7 @@ onBeforeUnmount(() => {
|
|||||||
<div class="panel-backdrop" aria-hidden="true" />
|
<div class="panel-backdrop" aria-hidden="true" />
|
||||||
<aside
|
<aside
|
||||||
class="editor-panel"
|
class="editor-panel"
|
||||||
:style="{
|
:style="{ '--canvas': draftColorCss }"
|
||||||
'--canvas': draftColorCss,
|
|
||||||
background: draftColorCss,
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<header class="panel-head">
|
<header class="panel-head">
|
||||||
<h2>{{ editorTitle }}</h2>
|
<h2>{{ editorTitle }}</h2>
|
||||||
@@ -1562,23 +1576,6 @@ onBeforeUnmount(() => {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
.page-head h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.55rem;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #0f172a;
|
|
||||||
}
|
|
||||||
.lead {
|
|
||||||
margin: 0.35rem 0 0;
|
|
||||||
color: #64748b;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
}
|
|
||||||
.card-fields {
|
.card-fields {
|
||||||
margin: 0.4rem 0 0;
|
margin: 0.4rem 0 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -1602,19 +1599,6 @@ onBeforeUnmount(() => {
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 0.75rem;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 1.1rem;
|
|
||||||
}
|
|
||||||
.toolbar-end {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.45rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chips {
|
.chips {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1726,32 +1710,6 @@ onBeforeUnmount(() => {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-toggle {
|
|
||||||
display: inline-flex;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
overflow: hidden;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
.view-toggle button {
|
|
||||||
border: 0;
|
|
||||||
background: transparent;
|
|
||||||
padding: 0.35rem 0.45rem;
|
|
||||||
color: #64748b;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.view-toggle button.active {
|
|
||||||
background: var(--teal-soft);
|
|
||||||
color: var(--teal);
|
|
||||||
}
|
|
||||||
.sort-select {
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
padding: 0.35rem 0.55rem;
|
|
||||||
background: #fff;
|
|
||||||
color: #334155;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-btn {
|
.icon-btn {
|
||||||
border: 0;
|
border: 0;
|
||||||
@@ -1838,6 +1796,15 @@ onBeforeUnmount(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
|
/* نمای لیست: ستون وسطچین با عرض خوانا، نه تمامعرض */
|
||||||
|
width: 100%;
|
||||||
|
max-width: 760px;
|
||||||
|
margin-inline: auto;
|
||||||
|
}
|
||||||
|
.quick-add.is-list {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 760px;
|
||||||
|
margin-inline: auto;
|
||||||
}
|
}
|
||||||
.notes-board.is-list .note-card {
|
.notes-board.is-list .note-card {
|
||||||
aspect-ratio: auto;
|
aspect-ratio: auto;
|
||||||
@@ -2207,7 +2174,8 @@ onBeforeUnmount(() => {
|
|||||||
font-size: 0.98rem;
|
font-size: 0.98rem;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
outline: none;
|
outline: none;
|
||||||
box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
|
box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
|
||||||
|
transition: background 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.swatches {
|
.swatches {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
Button as AButton,
|
Button as AButton,
|
||||||
@@ -27,7 +26,6 @@ import {
|
|||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import type { UploadProps } from 'ant-design-vue';
|
import type { UploadProps } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
ArrowLeftOutlined,
|
|
||||||
CheckOutlined,
|
CheckOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
PhoneOutlined,
|
PhoneOutlined,
|
||||||
@@ -35,6 +33,7 @@ import {
|
|||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import type { CompanyDto, CreatePersonRequest, PersonDto, PersonGender, PersonMood } from '@mento/shared';
|
import type { CompanyDto, CreatePersonRequest, PersonDto, PersonGender, PersonMood } from '@mento/shared';
|
||||||
import {
|
import {
|
||||||
ACTIVITY_EXPERIENCE_OPTIONS,
|
ACTIVITY_EXPERIENCE_OPTIONS,
|
||||||
@@ -58,9 +57,11 @@ import CustomFieldsSection from '@/components/CustomFieldsSection.vue';
|
|||||||
import CustomerMoodFace from '@/components/CustomerMoodFace.vue';
|
import CustomerMoodFace from '@/components/CustomerMoodFace.vue';
|
||||||
import EntityTimeline from '@/components/EntityTimeline.vue';
|
import EntityTimeline from '@/components/EntityTimeline.vue';
|
||||||
import MentoMemoryPanel from '@/components/MentoMemoryPanel.vue';
|
import MentoMemoryPanel from '@/components/MentoMemoryPanel.vue';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { UserOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const ASpaceCompact = Space.Compact;
|
const ASpaceCompact = Space.Compact;
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
const AListItem = AList.Item;
|
const AListItem = AList.Item;
|
||||||
const AListItemMeta = AList.Item.Meta;
|
const AListItemMeta = AList.Item.Meta;
|
||||||
@@ -78,6 +79,7 @@ const emit = defineEmits<{ saved: [person?: PersonDto]; cancel: [] }>();
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
const id = computed(() => {
|
const id = computed(() => {
|
||||||
if (props.embedded) return props.entityId ?? '';
|
if (props.embedded) return props.entityId ?? '';
|
||||||
return typeof route.params.id === 'string' ? route.params.id : '';
|
return typeof route.params.id === 'string' ? route.params.id : '';
|
||||||
@@ -406,6 +408,7 @@ async function submit() {
|
|||||||
try {
|
try {
|
||||||
if (isNew.value) {
|
if (isNew.value) {
|
||||||
const { data } = await api.post<PersonDto>('/people', payload());
|
const { data } = await api.post<PersonDto>('/people', payload());
|
||||||
|
feedback.success('شخص ذخیره شد.');
|
||||||
if (props.embedded) {
|
if (props.embedded) {
|
||||||
emit('saved', data);
|
emit('saved', data);
|
||||||
return;
|
return;
|
||||||
@@ -413,6 +416,7 @@ async function submit() {
|
|||||||
await router.replace({ name: 'person-detail', params: { id: data.id } });
|
await router.replace({ name: 'person-detail', params: { id: data.id } });
|
||||||
} else {
|
} else {
|
||||||
await api.patch(`/people/${id.value}`, payload());
|
await api.patch(`/people/${id.value}`, payload());
|
||||||
|
feedback.success('شخص ذخیره شد.');
|
||||||
if (props.embedded) {
|
if (props.embedded) {
|
||||||
emit('saved');
|
emit('saved');
|
||||||
return;
|
return;
|
||||||
@@ -420,16 +424,7 @@ async function submit() {
|
|||||||
await router.push({ name: 'person-detail', params: { id: id.value } });
|
await router.push({ name: 'person-detail', params: { id: id.value } });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'ذخیره ناموفق بود');
|
||||||
if (!e.response) {
|
|
||||||
error.value = 'اتصال به سرور برقرار نشد.';
|
|
||||||
} else {
|
|
||||||
const msg = (e.response.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg) ? msg.join('، ') : (msg ?? 'ذخیره ناموفق بود');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error.value = 'ذخیره ناموفق بود';
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -446,9 +441,10 @@ function remove() {
|
|||||||
async onOk() {
|
async onOk() {
|
||||||
try {
|
try {
|
||||||
await api.delete(`/people/${id.value}`);
|
await api.delete(`/people/${id.value}`);
|
||||||
|
feedback.success('شخص حذف شد.');
|
||||||
await router.push({ name: 'contacts' });
|
await router.push({ name: 'contacts' });
|
||||||
} catch {
|
} catch (e) {
|
||||||
error.value = 'حذف ناموفق بود';
|
feedback.fromError(e, 'حذف ناموفق بود');
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -468,36 +464,23 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
justify="space-between"
|
:title="pageTitle"
|
||||||
align="center"
|
subtitle="مشخصات، اطلاعات تماس و فیلدهای سفارشی شخص"
|
||||||
wrap="wrap"
|
:icon="UserOutlined"
|
||||||
:gap="12"
|
primary-label="ذخیره"
|
||||||
|
:primary-icon="CheckOutlined"
|
||||||
|
:primary-loading="saving"
|
||||||
|
:menu-items="isNew ? [] : [{ key: 'delete', label: 'حذف مخاطب', icon: DeleteOutlined, danger: true, disabled: saving }]"
|
||||||
:style="{ marginBottom: '16px' }"
|
:style="{ marginBottom: '16px' }"
|
||||||
|
@primary="submit"
|
||||||
|
@menu="remove"
|
||||||
>
|
>
|
||||||
<div>
|
<template #actions>
|
||||||
<a-typography-text type="secondary">
|
<a-button @click="cancel">انصراف</a-button>
|
||||||
<RouterLink :to="{ name: 'contacts' }">مخاطبین</RouterLink>
|
</template>
|
||||||
· {{ pageTitle }}
|
</PageHeader>
|
||||||
</a-typography-text>
|
|
||||||
<a-typography-title :level="3" :style="{ margin: '4px 0 0' }">{{ pageTitle }}</a-typography-title>
|
|
||||||
</div>
|
|
||||||
<a-space :size="8" wrap>
|
|
||||||
<a-button @click="cancel">
|
|
||||||
<template #icon><ArrowLeftOutlined /></template>
|
|
||||||
انصراف
|
|
||||||
</a-button>
|
|
||||||
<a-button v-if="!isNew" danger :disabled="saving" @click="remove">
|
|
||||||
<template #icon><DeleteOutlined /></template>
|
|
||||||
حذف
|
|
||||||
</a-button>
|
|
||||||
<a-button type="primary" :loading="saving" @click="submit">
|
|
||||||
<template #icon><CheckOutlined /></template>
|
|
||||||
ذخیره
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-spin :spinning="loading">
|
<a-spin :spinning="loading">
|
||||||
<a-form v-if="!loading" layout="vertical" @finish="submit">
|
<a-form v-if="!loading" layout="vertical" @finish="submit">
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ import DiscBadge from '@/components/behavior/DiscBadge.vue';
|
|||||||
import CustomerGroupChips from '@/components/CustomerGroupChips.vue';
|
import CustomerGroupChips from '@/components/CustomerGroupChips.vue';
|
||||||
import DiscPanel from '@/components/behavior/DiscPanel.vue';
|
import DiscPanel from '@/components/behavior/DiscPanel.vue';
|
||||||
import SalesCopilotPanel from '@/components/behavior/SalesCopilotPanel.vue';
|
import SalesCopilotPanel from '@/components/behavior/SalesCopilotPanel.vue';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { UserOutlined, EditOutlined } from '@/icons/ant-bridge';
|
||||||
|
import type { PageHeaderMenuItem } from '@/components/page';
|
||||||
|
|
||||||
type TabKey = 'activities' | 'tasks' | 'deals' | 'cards' | 'assets' | 'info' | 'disc' | 'copilot';
|
type TabKey = 'activities' | 'tasks' | 'deals' | 'cards' | 'assets' | 'info' | 'disc' | 'copilot';
|
||||||
type TimelineTone = 'call' | 'quote' | 'note' | 'meeting' | 'task';
|
type TimelineTone = 'call' | 'quote' | 'note' | 'meeting' | 'task';
|
||||||
@@ -142,6 +145,24 @@ const moreItems = computed<ProfileMoreItem[]>(() => [
|
|||||||
{ key: 'delete', label: 'حذف شخص', danger: true },
|
{ key: 'delete', label: 'حذف شخص', danger: true },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/** منوی «⋯» هدر دسکتاپ؛ همان گزینههای منوی بیشتر موبایل (ویرایش دکمهٔ اصلی است) */
|
||||||
|
const headerMenuItems = computed<PageHeaderMenuItem[]>(() =>
|
||||||
|
moreItems.value
|
||||||
|
.filter((item) => item.key !== 'edit')
|
||||||
|
.map((item) => ({
|
||||||
|
key: item.key,
|
||||||
|
label: item.label,
|
||||||
|
danger: item.danger,
|
||||||
|
dividerBefore: item.key === 'delete',
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
function onHeaderMenu(key: string) {
|
||||||
|
const item = moreItems.value.find((row) => row.key === key);
|
||||||
|
if (item?.to) void router.push(item.to);
|
||||||
|
else onMoreSelect(key);
|
||||||
|
}
|
||||||
|
|
||||||
function onMoreSelect(key: string) {
|
function onMoreSelect(key: string) {
|
||||||
if (key === 'sms') smsOpen.value = true;
|
if (key === 'sms') smsOpen.value = true;
|
||||||
if (key === 'delete') void removePerson();
|
if (key === 'delete') void removePerson();
|
||||||
@@ -689,25 +710,20 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page" @click="closeMenus">
|
<section class="page" @click="closeMenus">
|
||||||
<header class="desk-head">
|
<div class="desk-head">
|
||||||
<div class="title-block">
|
<PageHeader
|
||||||
<RouterLink class="back-link" :to="{ name: 'contacts' }">
|
title="جزئیات مخاطب"
|
||||||
بازگشت به لیست مخاطبین
|
:subtitle="person ? fullName : undefined"
|
||||||
</RouterLink>
|
:icon="UserOutlined"
|
||||||
<h1>جزئیات مخاطب</h1>
|
:back-to="{ name: 'contacts' }"
|
||||||
</div>
|
primary-label="ویرایش"
|
||||||
<div class="desk-actions">
|
:primary-icon="EditOutlined"
|
||||||
<RouterLink class="btn edit" :to="{ name: 'person-edit', params: { id } }">
|
:menu-items="headerMenuItems"
|
||||||
<UiIcon name="pencil" :size="16" />
|
:style="{ flex: '1 1 auto', minWidth: 0 }"
|
||||||
ویرایش
|
@primary="router.push({ name: 'person-edit', params: { id } })"
|
||||||
</RouterLink>
|
@menu="onHeaderMenu"
|
||||||
<button class="btn danger" type="button" @click.stop="removePerson">
|
/>
|
||||||
<UiIcon name="trash" :size="16" />
|
</div>
|
||||||
حذف
|
|
||||||
</button>
|
|
||||||
<ProfileMoreMenu v-model="moreOpen" :items="moreItems" @select="onMoreSelect" />
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<header class="mob-head">
|
<header class="mob-head">
|
||||||
<RouterLink class="icon-btn" :to="{ name: 'contacts' }" aria-label="بازگشت">
|
<RouterLink class="icon-btn" :to="{ name: 'contacts' }" aria-label="بازگشت">
|
||||||
@@ -1255,49 +1271,6 @@ watch(() => route.query.tab, readTab, { immediate: true });
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-block h1 {
|
|
||||||
margin: 0.15rem 0 0;
|
|
||||||
font-size: 1.45rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-link {
|
|
||||||
color: #0f766e;
|
|
||||||
font-size: 0.82rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.35rem;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
background: #fff;
|
|
||||||
color: #334155;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
padding: 0.55rem 0.9rem;
|
|
||||||
font: inherit;
|
|
||||||
font-weight: 700;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn.edit {
|
|
||||||
color: #0f766e;
|
|
||||||
border-color: #ccfbf1;
|
|
||||||
background: #f0fdfa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn.danger {
|
|
||||||
color: #b91c1c;
|
|
||||||
border-color: #fecaca;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mob-head {
|
.mob-head {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 40px 1fr auto;
|
grid-template-columns: 40px 1fr auto;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import { formatRelativeDayLabel, toFaDigits } from '@/lib/jalali';
|
import { formatRelativeDayLabel, toFaDigits } from '@/lib/jalali';
|
||||||
import PipelineToolbar from '@/components/pipeline/PipelineToolbar.vue';
|
import PipelineToolbar from '@/components/pipeline/PipelineToolbar.vue';
|
||||||
import type { PipelineViewMode } from '@/components/pipeline/PipelineToolbar.vue';
|
import type { PipelineViewMode } from '@/components/pipeline/PipelineToolbar.vue';
|
||||||
@@ -19,6 +20,7 @@ import {
|
|||||||
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
|
||||||
import DealFormView from '@/views/DealFormView.vue';
|
import DealFormView from '@/views/DealFormView.vue';
|
||||||
import SavedFiltersBar from '@/components/SavedFiltersBar.vue';
|
import SavedFiltersBar from '@/components/SavedFiltersBar.vue';
|
||||||
|
import type { PageHeaderMenuItem } from '@/components/page';
|
||||||
import {
|
import {
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
DownloadOutlined,
|
DownloadOutlined,
|
||||||
@@ -80,6 +82,7 @@ const pageStyle = {
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const canCreatePipeline = computed(() => canManageSettings(auth.user?.role));
|
const canCreatePipeline = computed(() => canManageSettings(auth.user?.role));
|
||||||
|
|
||||||
@@ -98,8 +101,6 @@ const newName = ref('');
|
|||||||
const dealModal = ref<{ dealId?: string; stageId?: string } | null>(null);
|
const dealModal = ref<{ dealId?: string; stageId?: string } | null>(null);
|
||||||
const stageBusy = ref(false);
|
const stageBusy = ref(false);
|
||||||
const busy = ref(false);
|
const busy = ref(false);
|
||||||
const importMsg = ref('');
|
|
||||||
|
|
||||||
const draggingId = ref<string | null>(null);
|
const draggingId = ref<string | null>(null);
|
||||||
const draggingColumnId = ref<string | null>(null);
|
const draggingColumnId = ref<string | null>(null);
|
||||||
const dropStageId = ref<string | null>(null);
|
const dropStageId = ref<string | null>(null);
|
||||||
@@ -229,9 +230,10 @@ async function createPipeline() {
|
|||||||
const { data } = await api.post<PipelineDto>('/pipelines', { name });
|
const { data } = await api.post<PipelineDto>('/pipelines', { name });
|
||||||
newName.value = '';
|
newName.value = '';
|
||||||
showCreate.value = false;
|
showCreate.value = false;
|
||||||
|
feedback.success('مسیر فروش ساخته شد.');
|
||||||
await router.replace({ name: 'pipeline', query: { pipelineId: data.id } });
|
await router.replace({ name: 'pipeline', query: { pipelineId: data.id } });
|
||||||
} catch {
|
} catch (e) {
|
||||||
error.value = 'ساخت مسیر فروش ناموفق بود.';
|
feedback.fromError(e, 'ساخت مسیر فروش ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -306,9 +308,9 @@ async function applyUpdateDealStage(
|
|||||||
stageId,
|
stageId,
|
||||||
position: position ?? undefined,
|
position: position ?? undefined,
|
||||||
});
|
});
|
||||||
} catch {
|
} catch (e) {
|
||||||
stages.value = prev;
|
stages.value = prev;
|
||||||
error.value = 'جابهجایی معامله ناموفق بود.';
|
feedback.fromError(e, 'جابهجایی معامله ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
moving.value = false;
|
moving.value = false;
|
||||||
}
|
}
|
||||||
@@ -357,15 +359,6 @@ async function onDrop(stageId: string, event: DragEvent, index?: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiMessage(e: unknown, fallback: string) {
|
|
||||||
if (axios.isAxiosError(e)) {
|
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
if (typeof msg === 'string' && msg) return msg;
|
|
||||||
if (Array.isArray(msg) && msg[0]) return String(msg[0]);
|
|
||||||
}
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAddDeal(stageId: string) {
|
function onAddDeal(stageId: string) {
|
||||||
dealModal.value = { stageId };
|
dealModal.value = { stageId };
|
||||||
}
|
}
|
||||||
@@ -392,7 +385,7 @@ async function persistStageOrder(next: PipelineStage[], prev: PipelineStage[]) {
|
|||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
stages.value = prev;
|
stages.value = prev;
|
||||||
error.value = apiMessage(e, 'جابهجایی ستون ناموفق بود.');
|
feedback.fromError(e, 'جابهجایی ستون ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
stageBusy.value = false;
|
stageBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -431,9 +424,10 @@ async function onRenameStage(stageId: string, title: string) {
|
|||||||
await api.patch(`/pipelines/${boardPipelineId.value}/stages/${stageId}`, {
|
await api.patch(`/pipelines/${boardPipelineId.value}/stages/${stageId}`, {
|
||||||
name: title,
|
name: title,
|
||||||
});
|
});
|
||||||
|
feedback.success('نام ستون بهروز شد.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
stages.value = prev;
|
stages.value = prev;
|
||||||
error.value = apiMessage(e, 'تغییر نام ستون ناموفق بود.');
|
feedback.fromError(e, 'تغییر نام ستون ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
stageBusy.value = false;
|
stageBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -445,9 +439,10 @@ async function onAddStage(name: string) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.post(`/pipelines/${boardPipelineId.value}/stages`, { name });
|
await api.post(`/pipelines/${boardPipelineId.value}/stages`, { name });
|
||||||
|
feedback.success('ستون اضافه شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiMessage(e, 'افزودن ستون ناموفق بود.');
|
feedback.fromError(e, 'افزودن ستون ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
stageBusy.value = false;
|
stageBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -467,9 +462,10 @@ function onDeleteStage(stageId: string) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.delete(`/pipelines/${boardPipelineId.value}/stages/${stageId}`);
|
await api.delete(`/pipelines/${boardPipelineId.value}/stages/${stageId}`);
|
||||||
|
feedback.success('ستون حذف شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiMessage(e, 'حذف ستون ناموفق بود.');
|
feedback.fromError(e, 'حذف ستون ناموفق بود.');
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
stageBusy.value = false;
|
stageBusy.value = false;
|
||||||
@@ -543,13 +539,18 @@ function confirmDeleteDeals(ids: string[]) {
|
|||||||
clearSelect();
|
clearSelect();
|
||||||
await load();
|
await load();
|
||||||
if (failed) {
|
if (failed) {
|
||||||
error.value =
|
feedback.error(
|
||||||
failed === ids.length
|
failed === ids.length
|
||||||
? 'حذف معاملهها ناموفق بود.'
|
? 'حذف معاملهها ناموفق بود.'
|
||||||
: `${toFaDigits(failed)} مورد حذف نشد.`;
|
: `${toFaDigits(failed)} مورد حذف نشد.`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
feedback.success(
|
||||||
|
ids.length > 1 ? 'معاملهها حذف شدند.' : 'معامله حذف شد.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiMessage(e, 'حذف معامله ناموفق بود.');
|
feedback.fromError(e, 'حذف معامله ناموفق بود.');
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
dealDeleting.value = false;
|
dealDeleting.value = false;
|
||||||
@@ -589,9 +590,10 @@ async function promotePriorDeal(dealId: string) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.post(`/deals/${dealId}/promote-from-prior`);
|
await api.post(`/deals/${dealId}/promote-from-prior`);
|
||||||
|
feedback.success('معامله به کار جاری منتقل شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiMessage(e, 'انتقال معامله به کار جاری ناموفق بود.');
|
feedback.fromError(e, 'انتقال معامله به کار جاری ناموفق بود.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,7 +604,6 @@ async function exportExcel() {
|
|||||||
busy.value = true;
|
busy.value = true;
|
||||||
pageBusy.value = true;
|
pageBusy.value = true;
|
||||||
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
busyMessage.value = 'در حال تهیه خروجی اکسل…';
|
||||||
importMsg.value = '';
|
|
||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
const { data } = await api.get<Blob>('/deals/export', { responseType: 'blob' });
|
const { data } = await api.get<Blob>('/deals/export', { responseType: 'blob' });
|
||||||
@@ -612,8 +613,9 @@ async function exportExcel() {
|
|||||||
a.download = `${brand.filePrefix}-deals.xlsx`;
|
a.download = `${brand.filePrefix}-deals.xlsx`;
|
||||||
a.click();
|
a.click();
|
||||||
URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
} catch {
|
feedback.success('خروجی اکسل آماده شد.');
|
||||||
error.value = 'خروجی اکسل ناموفق بود.';
|
} catch (e) {
|
||||||
|
feedback.fromError(e, 'خروجی اکسل ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
busy.value = false;
|
busy.value = false;
|
||||||
pageBusy.value = false;
|
pageBusy.value = false;
|
||||||
@@ -623,19 +625,23 @@ async function exportExcel() {
|
|||||||
function onImportStart() {
|
function onImportStart() {
|
||||||
busy.value = true;
|
busy.value = true;
|
||||||
pageBusy.value = false;
|
pageBusy.value = false;
|
||||||
importMsg.value = '';
|
|
||||||
error.value = '';
|
error.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onImportDone(data: ImportContactsResult) {
|
async function onImportDone(data: ImportContactsResult) {
|
||||||
importMsg.value = `وارد شد: ${data.created} · تکراری رد شد: ${data.skipped}${
|
const summary = `وارد شد: ${data.created} · تکراری رد شد: ${data.skipped}${
|
||||||
data.errors.length ? ` · خطا: ${data.errors.length}` : ''
|
data.errors.length ? ` · خطا: ${data.errors.length}` : ''
|
||||||
}${data.boards?.length ? ` · مسیر فروش: ${data.boards.join('، ')}` : ''}`;
|
}${data.boards?.length ? ` · مسیر فروش: ${data.boards.join('، ')}` : ''}`;
|
||||||
if (data.errors.length) {
|
if (data.errors.length) {
|
||||||
error.value = data.errors
|
feedback.warning(summary);
|
||||||
.slice(0, 3)
|
feedback.error(
|
||||||
.map((e) => `ردیف ${e.row}: ${e.message}`)
|
data.errors
|
||||||
.join(' | ');
|
.slice(0, 3)
|
||||||
|
.map((e) => `ردیف ${e.row}: ${e.message}`)
|
||||||
|
.join(' | '),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
feedback.success(summary);
|
||||||
}
|
}
|
||||||
if (data.boardId && data.boardId !== selectedPipelineId.value) {
|
if (data.boardId && data.boardId !== selectedPipelineId.value) {
|
||||||
await router.replace({ name: 'pipeline', query: { pipelineId: data.boardId } });
|
await router.replace({ name: 'pipeline', query: { pipelineId: data.boardId } });
|
||||||
@@ -645,7 +651,7 @@ async function onImportDone(data: ImportContactsResult) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onImportFail(message: string) {
|
function onImportFail(message: string) {
|
||||||
error.value = message;
|
feedback.error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onImportSettled() {
|
function onImportSettled() {
|
||||||
@@ -708,6 +714,29 @@ onBeforeUnmount(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ updateDealStage: applyUpdateDealStage });
|
defineExpose({ updateDealStage: applyUpdateDealStage });
|
||||||
|
/* ---------- هدر صفحه ---------- */
|
||||||
|
const importTrigger = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
|
const dealCount = computed(() =>
|
||||||
|
stages.value.reduce((sum, stage) => sum + (stage.total ?? stage.deals.length), 0),
|
||||||
|
);
|
||||||
|
|
||||||
|
const headerMenuItems = computed<PageHeaderMenuItem[]>(() => [
|
||||||
|
{ key: 'export', label: 'خروجی اکسل', icon: DownloadOutlined, disabled: loading.value || busy.value },
|
||||||
|
{ key: 'import', label: 'ورود از اکسل', icon: UploadOutlined, disabled: loading.value || busy.value },
|
||||||
|
]);
|
||||||
|
|
||||||
|
function onHeaderMenu(key: string) {
|
||||||
|
if (key === 'export') void exportExcel();
|
||||||
|
// تریگر مخفی؛ کلیک کاربر روی منو activation را نگه میدارد
|
||||||
|
else if (key === 'import') importTrigger.value?.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** معامله جدید از هدر ← اولین مرحلهٔ مسیر انتخابشده */
|
||||||
|
function onNewDeal() {
|
||||||
|
onAddDeal(stages.value[0]?.id ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -715,6 +744,10 @@ defineExpose({ updateDealStage: applyUpdateDealStage });
|
|||||||
<a-flex vertical :gap="GAP" :style="{ flexShrink: 0 }">
|
<a-flex vertical :gap="GAP" :style="{ flexShrink: 0 }">
|
||||||
<PipelineToolbar
|
<PipelineToolbar
|
||||||
pipeline-name="مسیر فروش"
|
pipeline-name="مسیر فروش"
|
||||||
|
subtitle="معاملات را بین مراحل بکشید تا وضعیتشان عوض شود"
|
||||||
|
:count="loading && !stages.length ? undefined : dealCount"
|
||||||
|
primary-label="معامله جدید"
|
||||||
|
:menu-items="headerMenuItems"
|
||||||
:pipeline-options="pipelineOptions"
|
:pipeline-options="pipelineOptions"
|
||||||
v-model:selected-pipeline-id="selectedPipelineId"
|
v-model:selected-pipeline-id="selectedPipelineId"
|
||||||
v-model:view-mode="viewMode"
|
v-model:view-mode="viewMode"
|
||||||
@@ -723,31 +756,9 @@ defineExpose({ updateDealStage: applyUpdateDealStage });
|
|||||||
v-model:amount-max="amountMax"
|
v-model:amount-max="amountMax"
|
||||||
:can-create="canCreatePipeline"
|
:can-create="canCreatePipeline"
|
||||||
@create="showCreate = true"
|
@create="showCreate = true"
|
||||||
|
@primary="onNewDeal"
|
||||||
|
@menu="onHeaderMenu"
|
||||||
>
|
>
|
||||||
<template #excel>
|
|
||||||
<a-button :disabled="loading || busy" @click="exportExcel">
|
|
||||||
<template #icon><DownloadOutlined /></template>
|
|
||||||
خروجی اکسل
|
|
||||||
</a-button>
|
|
||||||
<ExcelImportFlow
|
|
||||||
preview-path="/deals/import/preview"
|
|
||||||
import-path="/deals/import"
|
|
||||||
rows-import-path="/deals/import/rows"
|
|
||||||
:client-aliases="DEAL_EXCEL_ALIASES"
|
|
||||||
:client-fields="dealExcelFields"
|
|
||||||
:client-read-options="dealClientReadOptions"
|
|
||||||
:disabled="loading || busy"
|
|
||||||
@start="onImportStart"
|
|
||||||
@done="onImportDone"
|
|
||||||
@fail="onImportFail"
|
|
||||||
@settled="onImportSettled"
|
|
||||||
>
|
|
||||||
<a-button :disabled="loading || busy">
|
|
||||||
<template #icon><UploadOutlined /></template>
|
|
||||||
ورود از اکسل
|
|
||||||
</a-button>
|
|
||||||
</ExcelImportFlow>
|
|
||||||
</template>
|
|
||||||
<template #filters>
|
<template #filters>
|
||||||
<SavedFiltersBar
|
<SavedFiltersBar
|
||||||
compact
|
compact
|
||||||
@@ -758,8 +769,26 @@ defineExpose({ updateDealStage: applyUpdateDealStage });
|
|||||||
</template>
|
</template>
|
||||||
</PipelineToolbar>
|
</PipelineToolbar>
|
||||||
|
|
||||||
|
<!-- تریگر ورود از اکسل؛ از منوی «⋯» هدر کلیک میشود (مودالش به body تلپورت میشود) -->
|
||||||
|
<div hidden>
|
||||||
|
<ExcelImportFlow
|
||||||
|
preview-path="/deals/import/preview"
|
||||||
|
import-path="/deals/import"
|
||||||
|
rows-import-path="/deals/import/rows"
|
||||||
|
:client-aliases="DEAL_EXCEL_ALIASES"
|
||||||
|
:client-fields="dealExcelFields"
|
||||||
|
:client-read-options="dealClientReadOptions"
|
||||||
|
:disabled="loading || busy"
|
||||||
|
@start="onImportStart"
|
||||||
|
@done="onImportDone"
|
||||||
|
@fail="onImportFail"
|
||||||
|
@settled="onImportSettled"
|
||||||
|
>
|
||||||
|
<span ref="importTrigger"></span>
|
||||||
|
</ExcelImportFlow>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<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-spin v-if="loading && !stages.length" tip="در حال بارگذاری مسیر فروش…" />
|
||||||
|
|
||||||
<a-alert
|
<a-alert
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ import {
|
|||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { PlusOutlined } from '@/icons/ant-bridge';
|
import { PlusOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { FundOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
type PipelineListItem = PipelineDto & {
|
type PipelineListItem = PipelineDto & {
|
||||||
dealCount?: number | null;
|
dealCount?: number | null;
|
||||||
@@ -176,7 +178,11 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">تنظیمات مسیر فروش</a-typography-title>
|
<PageHeader
|
||||||
|
title="تنظیمات مسیر فروش"
|
||||||
|
subtitle="کاریزها و مراحل معاملات"
|
||||||
|
:icon="FundOutlined"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-alert v-if="okMsg" type="success" show-icon :message="okMsg" closable @close="okMsg = ''" />
|
<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-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { currencySuffix } from '@/lib/money';
|
import { currencySuffix } from '@/lib/money';
|
||||||
import MoneyInput from '@/components/MoneyInput.vue';
|
import MoneyInput from '@/components/MoneyInput.vue';
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
Breadcrumb as ABreadcrumb,
|
|
||||||
BreadcrumbItem as ABreadcrumbItem,
|
|
||||||
Button as AButton,
|
Button as AButton,
|
||||||
Card as ACard,
|
Card as ACard,
|
||||||
Col as ACol,
|
Col as ACol,
|
||||||
@@ -34,8 +32,10 @@ import type {
|
|||||||
OrganizationDto,
|
OrganizationDto,
|
||||||
ProductDto,
|
ProductDto,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ShoppingOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const CATEGORIES = [
|
const CATEGORIES = [
|
||||||
'کارساخته',
|
'کارساخته',
|
||||||
@@ -240,30 +240,20 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
justify="space-between"
|
:title="title"
|
||||||
align="center"
|
subtitle="مشخصات، قیمت و موجودی محصول"
|
||||||
wrap="wrap"
|
:icon="ShoppingOutlined"
|
||||||
:gap="12"
|
:primary-label="submitLabel"
|
||||||
|
:primary-icon="CheckOutlined"
|
||||||
|
:primary-loading="saving"
|
||||||
|
@primary="submit"
|
||||||
>
|
>
|
||||||
<a-flex vertical :gap="4">
|
<template #actions>
|
||||||
<a-breadcrumb>
|
|
||||||
<a-breadcrumb-item>
|
|
||||||
<RouterLink :to="{ name: 'products' }">محصولات</RouterLink>
|
|
||||||
</a-breadcrumb-item>
|
|
||||||
<a-breadcrumb-item>{{ title }}</a-breadcrumb-item>
|
|
||||||
</a-breadcrumb>
|
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">{{ title }}</a-typography-title>
|
|
||||||
</a-flex>
|
|
||||||
<a-space :size="8" wrap>
|
|
||||||
<a-button type="primary" :loading="saving" @click="submit">
|
|
||||||
<template #icon><CheckOutlined /></template>
|
|
||||||
{{ submitLabel }}
|
|
||||||
</a-button>
|
|
||||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||||
</a-space>
|
</template>
|
||||||
</a-flex>
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { canAssignToOthers } from '@/lib/assign-access';
|
import { canAssignToOthers } from '@/lib/assign-access';
|
||||||
@@ -9,8 +9,6 @@ import type { OrgUserDto, ProjectCardDto } from '@mento/shared';
|
|||||||
import {
|
import {
|
||||||
Affix as AAffix,
|
Affix as AAffix,
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
Breadcrumb as ABreadcrumb,
|
|
||||||
BreadcrumbItem as ABreadcrumbItem,
|
|
||||||
Button as AButton,
|
Button as AButton,
|
||||||
Card as ACard,
|
Card as ACard,
|
||||||
Col as ACol,
|
Col as ACol,
|
||||||
@@ -23,20 +21,19 @@ import {
|
|||||||
Input as AInput,
|
Input as AInput,
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
|
||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
CheckOutlined,
|
CheckOutlined,
|
||||||
CloseOutlined,
|
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
FileTextOutlined,
|
FileTextOutlined,
|
||||||
SaveOutlined,
|
SaveOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -227,40 +224,23 @@ onMounted(async () => {
|
|||||||
</a-button>
|
</a-button>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
|
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-else
|
v-else
|
||||||
justify="space-between"
|
:title="pageTitle"
|
||||||
align="flex-start"
|
subtitle="کارت پروژه، مسئولان و زمانبندی"
|
||||||
wrap="wrap"
|
:icon="FileTextOutlined"
|
||||||
:gap="12"
|
:primary-label="saving ? 'در حال ذخیره…' : 'ذخیره'"
|
||||||
|
:primary-icon="CheckOutlined"
|
||||||
|
:primary-loading="saving"
|
||||||
|
:primary-disabled="!canSave"
|
||||||
|
:menu-items="isNew ? [] : [{ key: 'delete', label: 'حذف کارت', icon: DeleteOutlined, danger: true }]"
|
||||||
|
@primary="save"
|
||||||
|
@menu="removeCard"
|
||||||
>
|
>
|
||||||
<a-flex vertical :gap="4">
|
<template #actions>
|
||||||
<a-breadcrumb>
|
<a-button @click="cancel">انصراف</a-button>
|
||||||
<a-breadcrumb-item>
|
</template>
|
||||||
<RouterLink :to="{ name: 'projects' }">پروژهها</RouterLink>
|
</PageHeader>
|
||||||
</a-breadcrumb-item>
|
|
||||||
<a-breadcrumb-item>{{ pageTitle }}</a-breadcrumb-item>
|
|
||||||
</a-breadcrumb>
|
|
||||||
<a-flex align="center" :gap="8">
|
|
||||||
<FileTextOutlined />
|
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">{{ pageTitle }}</a-typography-title>
|
|
||||||
</a-flex>
|
|
||||||
</a-flex>
|
|
||||||
<a-space wrap>
|
|
||||||
<a-button type="primary" :loading="saving" :disabled="!canSave" @click="save">
|
|
||||||
<template #icon><CheckOutlined /></template>
|
|
||||||
{{ saving ? 'در حال ذخیره…' : 'ذخیره' }}
|
|
||||||
</a-button>
|
|
||||||
<a-button @click="cancel">
|
|
||||||
<template #icon><CloseOutlined /></template>
|
|
||||||
انصراف
|
|
||||||
</a-button>
|
|
||||||
<a-button v-if="!isNew" danger @click="removeCard">
|
|
||||||
<template #icon><DeleteOutlined /></template>
|
|
||||||
حذف
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ import {
|
|||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
import type { TableColumnsType } from 'ant-design-vue';
|
import type { TableColumnsType } from 'ant-design-vue';
|
||||||
import { CopyOutlined, PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
import { CopyOutlined, PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { LinkOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
||||||
const ACheckableTag = ATag.CheckableTag;
|
const ACheckableTag = ATag.CheckableTag;
|
||||||
|
|
||||||
const KEY_COL_LABELS = ['نام', 'پیشوند', 'آخرین استفاده', 'وضعیت'] as const;
|
const KEY_COL_LABELS = ['نام', 'پیشوند', 'آخرین استفاده', 'وضعیت'] as const;
|
||||||
@@ -229,13 +231,17 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">API و وبهوک</a-typography-title>
|
title="API و وبهوک"
|
||||||
<a-button :disabled="loading" @click="load">
|
subtitle="کلیدهای دسترسی و وبهوکها برای اتصال سرویسهای دیگر"
|
||||||
<template #icon><ReloadOutlined /></template>
|
:icon="LinkOutlined"
|
||||||
بروزرسانی
|
>
|
||||||
</a-button>
|
<template #actions>
|
||||||
</a-flex>
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||||
|
|||||||
@@ -1265,13 +1265,16 @@ const activityMax = computed(() =>
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="token.margin">
|
<a-flex vertical :gap="token.margin">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="token.marginSM">
|
<PageHeader
|
||||||
<div>
|
title="گزارشات و داشبورد"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
subtitle="داشبورد عملکرد و گزارشساز سفارشی"
|
||||||
گزارشات و داشبورد
|
:icon="BarChartOutlined"
|
||||||
</a-typography-title>
|
primary-label="خروجی اکسل / CSV"
|
||||||
</div>
|
:primary-icon="FileExcelOutlined"
|
||||||
<a-space wrap>
|
:primary-disabled="pageMode === 'dashboard' ? !data : !builderResult"
|
||||||
|
@primary="exportReport"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
<a-button @click="openSaveModal">
|
<a-button @click="openSaveModal">
|
||||||
<template #icon><SaveOutlined /></template>
|
<template #icon><SaveOutlined /></template>
|
||||||
ذخیره نما
|
ذخیره نما
|
||||||
@@ -1280,16 +1283,8 @@ const activityMax = computed(() =>
|
|||||||
<template #icon><LinkOutlined /></template>
|
<template #icon><LinkOutlined /></template>
|
||||||
کپی لینک اشتراک
|
کپی لینک اشتراک
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
</template>
|
||||||
type="primary"
|
</PageHeader>
|
||||||
:disabled="pageMode === 'dashboard' ? !data : !builderResult"
|
|
||||||
@click="exportReport"
|
|
||||||
>
|
|
||||||
<template #icon><FileExcelOutlined /></template>
|
|
||||||
خروجی اکسل / CSV
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<a-form layout="vertical">
|
<a-form layout="vertical">
|
||||||
|
|||||||
@@ -42,15 +42,15 @@ import {
|
|||||||
Row as ARow,
|
Row as ARow,
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
Space as ASpace,
|
||||||
TabPane as ATabPane,
|
|
||||||
Tabs as ATabs,
|
|
||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
Typography,
|
Typography,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { PlusOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
import { ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonList } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ScheduleOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
const AListItem = AList.Item;
|
const AListItem = AList.Item;
|
||||||
const AListItemMeta = AList.Item.Meta;
|
const AListItemMeta = AList.Item.Meta;
|
||||||
@@ -359,33 +359,24 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">رزرو و نوبتدهی</a-typography-title>
|
title="رزرو و نوبتدهی"
|
||||||
<a-space wrap :size="8">
|
subtitle="نوبتهای مشتریان و خدماتی که رزرو میشوند"
|
||||||
<a-button :disabled="loading" @click="load">
|
:icon="ScheduleOutlined"
|
||||||
|
:primary-label="tab === 'appointments' ? 'نوبت جدید' : canEditServices ? 'خدمت جدید' : undefined"
|
||||||
|
:tabs="[{ key: 'appointments', label: 'نوبتها' }, { key: 'services', label: 'خدمات' }]"
|
||||||
|
:active-tab="tab"
|
||||||
|
@primary="tab === 'appointments' ? openCreate() : openServiceCreate()"
|
||||||
|
@update:active-tab="(k) => onTabChange(k ?? 'appointments')"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
<template #icon><ReloadOutlined /></template>
|
<template #icon><ReloadOutlined /></template>
|
||||||
بروزرسانی
|
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button v-if="tab === 'appointments'" type="primary" @click="openCreate">
|
</template>
|
||||||
<template #icon><PlusOutlined /></template>
|
</PageHeader>
|
||||||
نوبت جدید
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
v-else-if="canEditServices"
|
|
||||||
type="primary"
|
|
||||||
@click="openServiceCreate"
|
|
||||||
>
|
|
||||||
<template #icon><PlusOutlined /></template>
|
|
||||||
خدمت جدید
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<a-tabs :active-key="tab" @change="onTabChange">
|
|
||||||
<a-tab-pane key="appointments" tab="نوبتها" />
|
|
||||||
<a-tab-pane key="services" tab="خدمات" />
|
|
||||||
</a-tabs>
|
|
||||||
|
|
||||||
<a-alert
|
<a-alert
|
||||||
v-if="error"
|
v-if="error"
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ import type {
|
|||||||
SalesGoalType,
|
SalesGoalType,
|
||||||
UpdateSalesGoalRequest,
|
UpdateSalesGoalRequest,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||||
|
|
||||||
@@ -519,21 +520,14 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
|
|
||||||
<a-flex
|
<PageHeader
|
||||||
v-else
|
v-else
|
||||||
justify="space-between"
|
title="هدف و پیشبینی"
|
||||||
align="center"
|
subtitle="اهداف فروش ماهانه و پیشبینی تحقق آنها"
|
||||||
wrap="wrap"
|
:icon="AimOutlined"
|
||||||
:gap="12"
|
primary-label="افزودن هدف جدید"
|
||||||
>
|
@primary="openCreate"
|
||||||
<div>
|
/>
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">هدف و پیشبینی</a-typography-title>
|
|
||||||
</div>
|
|
||||||
<a-button type="primary" @click="openCreate">
|
|
||||||
<template #icon><PlusOutlined /></template>
|
|
||||||
افزودن هدف جدید
|
|
||||||
</a-button>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { computed, onMounted, ref, watch } from 'vue';
|
|||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import type {
|
import type {
|
||||||
FilteredIdsResponse,
|
FilteredIdsResponse,
|
||||||
LeadDto,
|
LeadDto,
|
||||||
@@ -49,24 +50,26 @@ import {
|
|||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import type { TableColumnsType, TableProps } from 'ant-design-vue';
|
import type { TableColumnsType, TableProps } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
|
MessageOutlined,
|
||||||
ReloadOutlined,
|
ReloadOutlined,
|
||||||
SendOutlined,
|
SendOutlined,
|
||||||
StopOutlined,
|
StopOutlined,
|
||||||
BarChartOutlined,
|
BarChartOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonList, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonList, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
const AListItemMeta = AList.Item.Meta;
|
const AListItemMeta = AList.Item.Meta;
|
||||||
|
|
||||||
type AudienceTab = 'people' | 'leads';
|
type AudienceTab = 'people' | 'leads';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const listLoading = ref(false);
|
const listLoading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const ok = ref('');
|
|
||||||
const campaigns = ref<SmsCampaignDto[]>([]);
|
const campaigns = ref<SmsCampaignDto[]>([]);
|
||||||
const audience = ref<AudienceTab>('people');
|
const audience = ref<AudienceTab>('people');
|
||||||
const selectedIds = ref<string[]>([]);
|
const selectedIds = ref<string[]>([]);
|
||||||
@@ -285,18 +288,11 @@ async function selectAllFiltered() {
|
|||||||
cancelText: 'انصراف',
|
cancelText: 'انصراف',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
selectedIds.value = data.ids;
|
selectedIds.value = data.ids;
|
||||||
ok.value = `${toFaDigits(data.ids.length)} مخاطب انتخاب شد.`;
|
feedback.success(`${toFaDigits(data.ids.length)} مخاطب انتخاب شد.`);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'انتخاب همه ناموفق بود.');
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg)
|
|
||||||
? msg.join('، ')
|
|
||||||
: (msg ?? 'انتخاب همه ناموفق بود.');
|
|
||||||
} else {
|
|
||||||
error.value = 'انتخاب همه ناموفق بود.';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +320,6 @@ async function createCampaign() {
|
|||||||
}
|
}
|
||||||
saving.value = true;
|
saving.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
const chunks = chunkIds(selectedIds.value);
|
const chunks = chunkIds(selectedIds.value);
|
||||||
const wantQueue = queueNow.value;
|
const wantQueue = queueNow.value;
|
||||||
try {
|
try {
|
||||||
@@ -353,17 +348,14 @@ async function createCampaign() {
|
|||||||
name.value = '';
|
name.value = '';
|
||||||
body.value = '';
|
body.value = '';
|
||||||
selectedIds.value = [];
|
selectedIds.value = [];
|
||||||
ok.value = wantQueue
|
feedback.success(
|
||||||
? `کمپین با ${toFaDigits(chunks.reduce((n, c) => n + c.length, 0))} مخاطب در صف ارسال قرار گرفت.`
|
wantQueue
|
||||||
: 'کمپین بهصورت پیشنویس ذخیره شد.';
|
? `کمپین با ${toFaDigits(chunks.reduce((n, c) => n + c.length, 0))} مخاطب در صف ارسال قرار گرفت.`
|
||||||
|
: 'کمپین بهصورت پیشنویس ذخیره شد.',
|
||||||
|
);
|
||||||
await loadCampaigns();
|
await loadCampaigns();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'ساخت کمپین ناموفق بود.');
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg) ? msg.join('، ') : (msg ?? 'ساخت کمپین ناموفق بود.');
|
|
||||||
} else {
|
|
||||||
error.value = 'ساخت کمپین ناموفق بود.';
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -372,18 +364,20 @@ async function createCampaign() {
|
|||||||
async function queue(id: string) {
|
async function queue(id: string) {
|
||||||
try {
|
try {
|
||||||
await api.post(`/sms-campaigns/${id}/queue`);
|
await api.post(`/sms-campaigns/${id}/queue`);
|
||||||
|
feedback.success('کمپین در صف ارسال قرار گرفت.');
|
||||||
await loadCampaigns();
|
await loadCampaigns();
|
||||||
} catch {
|
} catch (e) {
|
||||||
error.value = 'صفبندی ناموفق بود.';
|
feedback.fromError(e, 'صفبندی ناموفق بود.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cancel(id: string) {
|
async function cancel(id: string) {
|
||||||
try {
|
try {
|
||||||
await api.post(`/sms-campaigns/${id}/cancel`);
|
await api.post(`/sms-campaigns/${id}/cancel`);
|
||||||
|
feedback.success('کمپین لغو شد.');
|
||||||
await loadCampaigns();
|
await loadCampaigns();
|
||||||
} catch {
|
} catch (e) {
|
||||||
error.value = 'لغو ناموفق بود.';
|
feedback.fromError(e, 'لغو ناموفق بود.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,16 +410,25 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">پیامک گروهی</a-typography-title>
|
title="پیامک گروهی"
|
||||||
<a-button :disabled="loading" @click="load">
|
subtitle="ارسال پیامک به اشخاص و لیدها، با فیلدهای پویا و گزارش هر کمپین"
|
||||||
<template #icon><ReloadOutlined /></template>
|
:icon="MessageOutlined"
|
||||||
بروزرسانی
|
:count="loading ? undefined : campaigns.length"
|
||||||
</a-button>
|
>
|
||||||
</a-flex>
|
<template #actions>
|
||||||
|
<a-button
|
||||||
|
:loading="loading"
|
||||||
|
aria-label="بروزرسانی"
|
||||||
|
title="بروزرسانی"
|
||||||
|
@click="load"
|
||||||
|
>
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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-card :bordered="false" title="کمپین جدید">
|
<a-card :bordered="false" title="کمپین جدید">
|
||||||
<a-form layout="vertical" @finish="createCampaign">
|
<a-form layout="vertical" @finish="createCampaign">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
|
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
Button as AButton,
|
Button as AButton,
|
||||||
@@ -23,18 +22,16 @@ import {
|
|||||||
Tag as ATag,
|
Tag as ATag,
|
||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
theme,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import type { TableColumnsType, TablePaginationConfig } from 'ant-design-vue';
|
import type { TableColumnsType, TablePaginationConfig } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
ArrowRightOutlined,
|
|
||||||
FilterOutlined,
|
FilterOutlined,
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
const { Text: ATypographyText } = Typography;
|
||||||
const AListItem = AList.Item;
|
const AListItem = AList.Item;
|
||||||
const AListItemMeta = AList.Item.Meta;
|
const AListItemMeta = AList.Item.Meta;
|
||||||
import {
|
import {
|
||||||
@@ -66,9 +63,9 @@ import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
|||||||
import SalesReportBoard from '@/components/tahesab/SalesReportBoard.vue';
|
import SalesReportBoard from '@/components/tahesab/SalesReportBoard.vue';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { canManageSettings } from '@/lib/roles';
|
import { canManageSettings } from '@/lib/roles';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { BarChartOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { token } = theme.useToken();
|
|
||||||
const { groups: customerGroups, load: loadCustomerGroups } = useCustomerGroups();
|
const { groups: customerGroups, load: loadCustomerGroups } = useCustomerGroups();
|
||||||
|
|
||||||
const connections = ref<TahesabConnectionDto[]>([]);
|
const connections = ref<TahesabConnectionDto[]>([]);
|
||||||
@@ -678,28 +675,16 @@ onUnmounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<a-row :gutter="[24, 24]">
|
<a-row :gutter="[24, 24]">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-flex
|
<PageHeader
|
||||||
justify="space-between"
|
title="گزارش فروش تهحساب"
|
||||||
align="center"
|
subtitle="فروش و ماندهها از حسابداری تهحساب"
|
||||||
wrap="wrap"
|
:icon="BarChartOutlined"
|
||||||
:gap="token.marginSM"
|
:back-to="{ name: 'reports' }"
|
||||||
>
|
primary-label="بهروزرسانی از تهحساب"
|
||||||
<div>
|
:primary-icon="SyncOutlined"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
:primary-loading="syncing"
|
||||||
گزارش فروش تهحساب
|
@primary="openSyncChoice"
|
||||||
</a-typography-title>
|
/>
|
||||||
</div>
|
|
||||||
<a-space :size="8" wrap>
|
|
||||||
<a-button @click="router.push({ name: 'reports' })">
|
|
||||||
<template #icon><ArrowRightOutlined /></template>
|
|
||||||
بازگشت
|
|
||||||
</a-button>
|
|
||||||
<a-button type="primary" :loading="syncing" @click="openSyncChoice">
|
|
||||||
<template #icon><SyncOutlined /></template>
|
|
||||||
بهروزرسانی از تهحساب
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col v-if="error" :span="24">
|
<a-col v-if="error" :span="24">
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
|||||||
import { RouterLink } from 'vue-router';
|
import { RouterLink } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { apiErrorMessage } from '@/lib/apiErrorMessage';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import type {
|
import type {
|
||||||
CreateTahesabConnectionRequest,
|
CreateTahesabConnectionRequest,
|
||||||
TahesabConnectionDto,
|
TahesabConnectionDto,
|
||||||
@@ -24,10 +26,10 @@ import {
|
|||||||
} from '@/components/ui';
|
} from '@/components/ui';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
|
||||||
|
const feedback = useFeedback();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const ok = ref('');
|
|
||||||
const items = ref<TahesabConnectionDto[]>([]);
|
const items = ref<TahesabConnectionDto[]>([]);
|
||||||
const editingId = ref<string | null>(null);
|
const editingId = ref<string | null>(null);
|
||||||
|
|
||||||
@@ -133,17 +135,16 @@ async function saveAutoSync() {
|
|||||||
}
|
}
|
||||||
autoSyncSaving.value = true;
|
autoSyncSaving.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
await api.patch(`/integrations/tahesab/connections/${sync.connectionId}`, {
|
await api.patch(`/integrations/tahesab/connections/${sync.connectionId}`, {
|
||||||
customerSyncHours: hours,
|
customerSyncHours: hours,
|
||||||
});
|
});
|
||||||
ok.value = hours.length
|
feedback.success(hours.length
|
||||||
? 'زمانبندی بروزرسانی ذخیره شد.'
|
? 'زمانبندی بروزرسانی ذخیره شد.'
|
||||||
: 'بروزرسانی خودکار خاموش شد.';
|
: 'بروزرسانی خودکار خاموش شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'ذخیره زمانبندی ناموفق بود');
|
feedback.fromError(e, 'ذخیره زمانبندی ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
autoSyncSaving.value = false;
|
autoSyncSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -161,7 +162,6 @@ async function syncCustomersNow() {
|
|||||||
importOverlay.message =
|
importOverlay.message =
|
||||||
'در حال همگامسازی همهٔ مشتریان… نام، موبایل، کد ملی، آدرس، شهر، رسته و گروه بهروز میشود.';
|
'در حال همگامسازی همهٔ مشتریان… نام، موبایل، کد ملی، آدرس، شهر، رسته و گروه بهروز میشود.';
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post<{
|
const { data } = await api.post<{
|
||||||
imported: number;
|
imported: number;
|
||||||
@@ -173,11 +173,11 @@ async function syncCustomersNow() {
|
|||||||
}>('/integrations/tahesab/sync/customers-now', {
|
}>('/integrations/tahesab/sync/customers-now', {
|
||||||
connectionId: sync.connectionId,
|
connectionId: sync.connectionId,
|
||||||
});
|
});
|
||||||
ok.value = data.summary;
|
feedback.success(data.summary);
|
||||||
if (data.error) error.value = data.error;
|
if (data.error) feedback.warning(data.error);
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'همگامسازی مشتریان ناموفق بود');
|
feedback.fromError(e, 'همگامسازی مشتریان ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
syncBusy.value = false;
|
syncBusy.value = false;
|
||||||
importOverlay.open = false;
|
importOverlay.open = false;
|
||||||
@@ -285,11 +285,7 @@ function pendingProductNames() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function apiErr(e: unknown, fallback: string) {
|
function apiErr(e: unknown, fallback: string) {
|
||||||
if (!axios.isAxiosError(e)) return fallback;
|
return apiErrorMessage(e, fallback);
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
if (Array.isArray(msg)) return msg.join('، ') || fallback;
|
|
||||||
if (typeof msg === 'string' && msg.trim()) return msg;
|
|
||||||
return fallback;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
@@ -356,7 +352,6 @@ async function load() {
|
|||||||
async function save() {
|
async function save() {
|
||||||
saving.value = true;
|
saving.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
if (editingId.value) {
|
if (editingId.value) {
|
||||||
const body: UpdateTahesabConnectionRequest = {
|
const body: UpdateTahesabConnectionRequest = {
|
||||||
@@ -372,7 +367,7 @@ async function save() {
|
|||||||
`/integrations/tahesab/connections/${editingId.value}`,
|
`/integrations/tahesab/connections/${editingId.value}`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
ok.value = 'اتصال بهروزرسانی شد.';
|
feedback.success('اتصال بهروزرسانی شد.');
|
||||||
} else {
|
} else {
|
||||||
if (!form.token.trim()) {
|
if (!form.token.trim()) {
|
||||||
error.value = 'توکن الزامی است.';
|
error.value = 'توکن الزامی است.';
|
||||||
@@ -388,17 +383,12 @@ async function save() {
|
|||||||
enabled: form.enabled,
|
enabled: form.enabled,
|
||||||
};
|
};
|
||||||
await api.post('/integrations/tahesab/connections', body);
|
await api.post('/integrations/tahesab/connections', body);
|
||||||
ok.value = 'اتصال افزوده شد.';
|
feedback.success('اتصال افزوده شد.');
|
||||||
}
|
}
|
||||||
resetForm();
|
resetForm();
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e)) {
|
feedback.fromError(e, 'ذخیره ناموفق بود');
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
error.value = Array.isArray(msg) ? msg.join('، ') : (msg ?? 'ذخیره ناموفق بود');
|
|
||||||
} else {
|
|
||||||
error.value = 'ذخیره ناموفق بود';
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -406,37 +396,36 @@ async function save() {
|
|||||||
|
|
||||||
async function testConn(id: string) {
|
async function testConn(id: string) {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post<{ ok: boolean; error?: string }>(
|
const { data } = await api.post<{ ok: boolean; error?: string }>(
|
||||||
`/integrations/tahesab/connections/${id}/test`,
|
`/integrations/tahesab/connections/${id}/test`,
|
||||||
);
|
);
|
||||||
if (data.ok) ok.value = 'اتصال سالم است.';
|
if (data.ok) feedback.success('اتصال سالم است.');
|
||||||
else {
|
else {
|
||||||
error.value = data.error ?? 'تست اتصال ناموفق بود.';
|
let msg = data.error ?? 'تست اتصال ناموفق بود.';
|
||||||
if (isTlsError(data.error)) {
|
if (isTlsError(data.error)) {
|
||||||
error.value +=
|
msg +=
|
||||||
' → دکمه «فعالسازی SSL خودامضا» را بزنید یا در ویرایش اتصال تیک آن را بگذارید.';
|
' → دکمه «فعالسازی SSL خودامضا» را بزنید یا در ویرایش اتصال تیک آن را بگذارید.';
|
||||||
}
|
}
|
||||||
|
feedback.error(msg);
|
||||||
}
|
}
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'تست ناموفق');
|
feedback.fromError(e, 'تست ناموفق');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function enableInsecureTls(id: string) {
|
async function enableInsecureTls(id: string) {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
await api.patch(`/integrations/tahesab/connections/${id}`, {
|
await api.patch(`/integrations/tahesab/connections/${id}`, {
|
||||||
allowInsecureTls: true,
|
allowInsecureTls: true,
|
||||||
});
|
});
|
||||||
ok.value = 'پذیرش گواهی خودامضا فعال شد. در حال تست…';
|
feedback.success('پذیرش گواهی خودامضا فعال شد. در حال تست…');
|
||||||
await load();
|
await load();
|
||||||
await testConn(id);
|
await testConn(id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'فعالسازی ناموفق بود');
|
feedback.fromError(e, 'فعالسازی ناموفق بود');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,13 +434,11 @@ async function removeConn(id: string) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.delete(`/integrations/tahesab/connections/${id}`);
|
await api.delete(`/integrations/tahesab/connections/${id}`);
|
||||||
ok.value = 'اتصال حذف شد.';
|
feedback.success('اتصال حذف شد.');
|
||||||
if (editingId.value === id) resetForm();
|
if (editingId.value === id) resetForm();
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = axios.isAxiosError(e)
|
feedback.fromError(e, 'حذف ناموفق');
|
||||||
? String((e.response?.data as { message?: string })?.message ?? 'حذف ناموفق')
|
|
||||||
: 'حذف ناموفق';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +480,6 @@ async function fetchAllCustomers(): Promise<SyncResult[]> {
|
|||||||
|
|
||||||
async function searchTahesab(mode: 'range' | 'filter') {
|
async function searchTahesab(mode: 'range' | 'filter') {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
if (!sync.connectionId) {
|
if (!sync.connectionId) {
|
||||||
error.value = 'ابتدا یک اتصال انتخاب کنید.';
|
error.value = 'ابتدا یک اتصال انتخاب کنید.';
|
||||||
return;
|
return;
|
||||||
@@ -545,18 +531,19 @@ async function searchTahesab(mode: 'range' | 'filter') {
|
|||||||
syncTablePage.value = 1;
|
syncTablePage.value = 1;
|
||||||
|
|
||||||
if (!syncResults.value.length) {
|
if (!syncResults.value.length) {
|
||||||
ok.value = 'نتیجهای یافت نشد.';
|
feedback.success('نتیجهای یافت نشد.');
|
||||||
} else {
|
} else {
|
||||||
const linked = syncResults.value.filter((r) => r.alreadyLinked).length;
|
const linked = syncResults.value.filter((r) => r.alreadyLinked).length;
|
||||||
const duplicate = syncResults.value.filter((r) => duplicateOwner(r)).length;
|
const duplicate = syncResults.value.filter((r) => duplicateOwner(r)).length;
|
||||||
const pending = syncResults.value.length - linked - duplicate;
|
const pending = syncResults.value.length - linked - duplicate;
|
||||||
ok.value =
|
feedback.success(
|
||||||
`${toFaDigits(syncResults.value.length)} مشتری پیدا شد` +
|
`${toFaDigits(syncResults.value.length)} مشتری پیدا شد` +
|
||||||
` · ${toFaDigits(linked)} قبلاً وارد شده · ${toFaDigits(pending)} واردنشده` +
|
` · ${toFaDigits(linked)} قبلاً وارد شده · ${toFaDigits(pending)} واردنشده` +
|
||||||
(duplicate ? ` · ${toFaDigits(duplicate)} شماره تکراری` : '');
|
(duplicate ? ` · ${toFaDigits(duplicate)} شماره تکراری` : ''),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'جستجو ناموفق');
|
feedback.fromError(e, 'جستجو ناموفق');
|
||||||
} finally {
|
} finally {
|
||||||
syncBusy.value = false;
|
syncBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -568,21 +555,20 @@ function onSyncTablePageChange(page: number) {
|
|||||||
|
|
||||||
async function importOne(moshtariCode: number) {
|
async function importOne(moshtariCode: number) {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
syncBusy.value = true;
|
syncBusy.value = true;
|
||||||
const { data } = await api.post<{ personId: string }>(
|
const { data } = await api.post<{ personId: string }>(
|
||||||
'/integrations/tahesab/sync/import',
|
'/integrations/tahesab/sync/import',
|
||||||
{ connectionId: sync.connectionId, moshtariCode },
|
{ connectionId: sync.connectionId, moshtariCode },
|
||||||
);
|
);
|
||||||
ok.value = `وارد شد — در مخاطبین با شناسه ${data.personId}`;
|
feedback.success(`وارد شد — در مخاطبین با شناسه ${data.personId}`);
|
||||||
const row = syncResults.value.find((r) => r.moshtariCode === moshtariCode);
|
const row = syncResults.value.find((r) => r.moshtariCode === moshtariCode);
|
||||||
if (row) {
|
if (row) {
|
||||||
row.alreadyLinked = true;
|
row.alreadyLinked = true;
|
||||||
row.personId = data.personId;
|
row.personId = data.personId;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'وارد کردن ناموفق');
|
feedback.fromError(e, 'وارد کردن ناموفق');
|
||||||
} finally {
|
} finally {
|
||||||
syncBusy.value = false;
|
syncBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -590,7 +576,6 @@ async function importOne(moshtariCode: number) {
|
|||||||
|
|
||||||
async function importBulk() {
|
async function importBulk() {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
if (!sync.connectionId) {
|
if (!sync.connectionId) {
|
||||||
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
||||||
return;
|
return;
|
||||||
@@ -650,10 +635,10 @@ async function importBulk() {
|
|||||||
importOverlay.progress = total ? ((i + chunk.length) / total) * 100 : 100;
|
importOverlay.progress = total ? ((i + chunk.length) / total) * 100 : 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok.value = `وارد شد: ${toFaDigits(totals.imported)} · قبلاً بود: ${toFaDigits(totals.skipped)} · ناموفق: ${toFaDigits(totals.failed)}`;
|
feedback.success(`وارد شد: ${toFaDigits(totals.imported)} · قبلاً بود: ${toFaDigits(totals.skipped)} · ناموفق: ${toFaDigits(totals.failed)}`);
|
||||||
if (firstError) error.value = `برخی موارد وارد نشدند: ${firstError}`;
|
if (firstError) feedback.warning(`برخی موارد وارد نشدند: ${firstError}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'وارد کردن دستهای ناموفق');
|
feedback.fromError(e, 'وارد کردن دستهای ناموفق');
|
||||||
} finally {
|
} finally {
|
||||||
importOverlay.open = false;
|
importOverlay.open = false;
|
||||||
importOverlay.progress = null;
|
importOverlay.progress = null;
|
||||||
@@ -664,7 +649,6 @@ async function importBulk() {
|
|||||||
/** همهٔ بازههای کد خوانده میشود و گروه تهحساب روی مشتریهای لینکشده نشانده میشود */
|
/** همهٔ بازههای کد خوانده میشود و گروه تهحساب روی مشتریهای لینکشده نشانده میشود */
|
||||||
async function syncGroups() {
|
async function syncGroups() {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
if (!sync.connectionId) {
|
if (!sync.connectionId) {
|
||||||
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
||||||
return;
|
return;
|
||||||
@@ -689,9 +673,9 @@ async function syncGroups() {
|
|||||||
emptyStreak = data.rows ? 0 : emptyStreak + 1;
|
emptyStreak = data.rows ? 0 : emptyStreak + 1;
|
||||||
page += 1;
|
page += 1;
|
||||||
}
|
}
|
||||||
ok.value = `گروهها همگام شد: ${toFaDigits(totals.linked)} مشتری لینکشده بررسی شد · گروه ${toFaDigits(totals.updated)} نفر بهروز شد.`;
|
feedback.success(`گروهها همگام شد: ${toFaDigits(totals.linked)} مشتری لینکشده بررسی شد · گروه ${toFaDigits(totals.updated)} نفر بهروز شد.`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'همگامسازی گروهها ناموفق بود');
|
feedback.fromError(e, 'همگامسازی گروهها ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
importOverlay.open = false;
|
importOverlay.open = false;
|
||||||
syncBusy.value = false;
|
syncBusy.value = false;
|
||||||
@@ -711,7 +695,6 @@ const exportIssues = ref<ExportItem[]>([]);
|
|||||||
/** شخصهای لینکنشده: اول تطبیق، بعد ساخت در تهحساب (بدون ساخت تکراری) */
|
/** شخصهای لینکنشده: اول تطبیق، بعد ساخت در تهحساب (بدون ساخت تکراری) */
|
||||||
async function exportUnlinked() {
|
async function exportUnlinked() {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
exportIssues.value = [];
|
exportIssues.value = [];
|
||||||
if (!sync.connectionId) {
|
if (!sync.connectionId) {
|
||||||
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
||||||
@@ -724,7 +707,7 @@ async function exportUnlinked() {
|
|||||||
{ params: { connectionId: sync.connectionId } },
|
{ params: { connectionId: sync.connectionId } },
|
||||||
);
|
);
|
||||||
if (!unlinked.total) {
|
if (!unlinked.total) {
|
||||||
ok.value = 'همهٔ اشخاص به تهحساب لینک هستند.';
|
feedback.success('همهٔ اشخاص به تهحساب لینک هستند.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -770,12 +753,13 @@ async function exportUnlinked() {
|
|||||||
}
|
}
|
||||||
importOverlay.progress = ((i + chunk.length) / ids.length) * 100;
|
importOverlay.progress = ((i + chunk.length) / ids.length) * 100;
|
||||||
}
|
}
|
||||||
ok.value =
|
feedback.success(
|
||||||
`ثبت در تهحساب تمام شد: لینک با مشتری موجود ${toFaDigits(totals.matched)} · ` +
|
`ثبت در تهحساب تمام شد: لینک با مشتری موجود ${toFaDigits(totals.matched)} · ` +
|
||||||
`ساختهشده ${toFaDigits(totals.created)} · چند نتیجه (نیاز به بررسی) ${toFaDigits(totals.ambiguous)} · ` +
|
`ساختهشده ${toFaDigits(totals.created)} · چند نتیجه (نیاز به بررسی) ${toFaDigits(totals.ambiguous)} · ` +
|
||||||
`ناموفق ${toFaDigits(totals.failed)}`;
|
`ناموفق ${toFaDigits(totals.failed)}`,
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'ثبت گروهی در تهحساب ناموفق بود');
|
feedback.fromError(e, 'ثبت گروهی در تهحساب ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
importOverlay.open = false;
|
importOverlay.open = false;
|
||||||
importOverlay.progress = null;
|
importOverlay.progress = null;
|
||||||
@@ -785,7 +769,6 @@ async function exportUnlinked() {
|
|||||||
|
|
||||||
async function searchProducts() {
|
async function searchProducts() {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
if (!productSync.connectionId) {
|
if (!productSync.connectionId) {
|
||||||
error.value = 'ابتدا اتصال را برای کارساخته انتخاب کنید.';
|
error.value = 'ابتدا اتصال را برای کارساخته انتخاب کنید.';
|
||||||
return;
|
return;
|
||||||
@@ -803,15 +786,16 @@ async function searchProducts() {
|
|||||||
productSyncResults.value = data.results ?? [];
|
productSyncResults.value = data.results ?? [];
|
||||||
if (data.categoryLabel) productCategoryLabel.value = data.categoryLabel;
|
if (data.categoryLabel) productCategoryLabel.value = data.categoryLabel;
|
||||||
if (!productSyncResults.value.length) {
|
if (!productSyncResults.value.length) {
|
||||||
ok.value = 'کارساختهای یافت نشد.';
|
feedback.success('کارساختهای یافت نشد.');
|
||||||
} else {
|
} else {
|
||||||
const linked = productSyncResults.value.filter((r) => r.alreadyImported).length;
|
const linked = productSyncResults.value.filter((r) => r.alreadyImported).length;
|
||||||
ok.value =
|
feedback.success(
|
||||||
`${productSyncResults.value.length} ${productCategoryLabel.value} پیدا شد` +
|
`${productSyncResults.value.length} ${productCategoryLabel.value} پیدا شد` +
|
||||||
(linked ? ` (${linked} قبلاً وارد شده)` : '');
|
(linked ? ` (${linked} قبلاً وارد شده)` : ''),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'دریافت لیست کارساخته ناموفق');
|
feedback.fromError(e, 'دریافت لیست کارساخته ناموفق');
|
||||||
} finally {
|
} finally {
|
||||||
productSyncBusy.value = false;
|
productSyncBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -819,21 +803,20 @@ async function searchProducts() {
|
|||||||
|
|
||||||
async function importProductOne(name: string) {
|
async function importProductOne(name: string) {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
productSyncBusy.value = true;
|
productSyncBusy.value = true;
|
||||||
const { data } = await api.post<{ productId: string }>(
|
const { data } = await api.post<{ productId: string }>(
|
||||||
'/integrations/tahesab/sync/products/import',
|
'/integrations/tahesab/sync/products/import',
|
||||||
{ connectionId: productSync.connectionId, name },
|
{ connectionId: productSync.connectionId, name },
|
||||||
);
|
);
|
||||||
ok.value = `وارد شد — در محصولات با شناسه ${data.productId}`;
|
feedback.success(`وارد شد — در محصولات با شناسه ${data.productId}`);
|
||||||
const row = productSyncResults.value.find((r) => r.name === name);
|
const row = productSyncResults.value.find((r) => r.name === name);
|
||||||
if (row) {
|
if (row) {
|
||||||
row.alreadyImported = true;
|
row.alreadyImported = true;
|
||||||
row.productId = data.productId;
|
row.productId = data.productId;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'وارد کردن محصول ناموفق');
|
feedback.fromError(e, 'وارد کردن محصول ناموفق');
|
||||||
} finally {
|
} finally {
|
||||||
productSyncBusy.value = false;
|
productSyncBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -841,7 +824,6 @@ async function importProductOne(name: string) {
|
|||||||
|
|
||||||
async function importProductsBulk(mode: 'pending' | 'all') {
|
async function importProductsBulk(mode: 'pending' | 'all') {
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
if (!productSync.connectionId) {
|
if (!productSync.connectionId) {
|
||||||
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
error.value = 'ابتدا اتصال را انتخاب کنید.';
|
||||||
return;
|
return;
|
||||||
@@ -875,10 +857,10 @@ async function importProductsBulk(mode: 'pending' | 'all') {
|
|||||||
skipped: number;
|
skipped: number;
|
||||||
failed: number;
|
failed: number;
|
||||||
}>('/integrations/tahesab/sync/products/import-bulk', body, { timeout: 120_000 });
|
}>('/integrations/tahesab/sync/products/import-bulk', body, { timeout: 120_000 });
|
||||||
ok.value = `وارد شد: ${data.imported} · قبلاً بود: ${data.skipped} · ناموفق: ${data.failed}`;
|
feedback.success(`وارد شد: ${data.imported} · قبلاً بود: ${data.skipped} · ناموفق: ${data.failed}`);
|
||||||
await searchProducts();
|
await searchProducts();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiErr(e, 'وارد کردن دستهای محصولات ناموفق');
|
feedback.fromError(e, 'وارد کردن دستهای محصولات ناموفق');
|
||||||
} finally {
|
} finally {
|
||||||
productSyncBusy.value = false;
|
productSyncBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -895,7 +877,6 @@ onMounted(load);
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
|
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
|
||||||
<div v-if="ok" class="crm-alert crm-alert-success">{{ ok }}</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="items.some((r) => !r.allowInsecureTls && isTlsError(r.lastError))"
|
v-if="items.some((r) => !r.allowInsecureTls && isTlsError(r.lastError))"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
|||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
import { UiDropdownMenu, UiModal, UiPagination } from '@/components/ui';
|
import { UiDropdownMenu, UiModal, UiPagination } from '@/components/ui';
|
||||||
@@ -35,6 +36,8 @@ import {
|
|||||||
import { PAGE_SIZE_OPTIONS, usePageSize } from '@/lib/pageSize';
|
import { PAGE_SIZE_OPTIONS, usePageSize } from '@/lib/pageSize';
|
||||||
import TeamsSettingsPanel from '@/components/TeamsSettingsPanel.vue';
|
import TeamsSettingsPanel from '@/components/TeamsSettingsPanel.vue';
|
||||||
import DataAccessPolicyPanel from '@/components/DataAccessPolicyPanel.vue';
|
import DataAccessPolicyPanel from '@/components/DataAccessPolicyPanel.vue';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { TeamOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
type TabKey = 'users' | 'roles' | 'access' | 'teams';
|
type TabKey = 'users' | 'roles' | 'access' | 'teams';
|
||||||
type RoleColor = 'teal' | 'violet' | 'rose' | 'sky' | 'amber' | 'slate' | 'pink';
|
type RoleColor = 'teal' | 'violet' | 'rose' | 'sky' | 'amber' | 'slate' | 'pink';
|
||||||
@@ -54,6 +57,7 @@ const ROLE_COLOR_OPTIONS: Array<{ value: RoleColor; label: string }> = [
|
|||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const feedback = useFeedback();
|
||||||
|
|
||||||
/** مجوزی که ماژولش در سوپرادمین خاموش است در نقشها نشان داده نمیشود. */
|
/** مجوزی که ماژولش در سوپرادمین خاموش است در نقشها نشان داده نمیشود. */
|
||||||
const PERMISSION_MODULES: Partial<Record<RolePermissionKey, OrgModuleKey[]>> = {
|
const PERMISSION_MODULES: Partial<Record<RolePermissionKey, OrgModuleKey[]>> = {
|
||||||
@@ -92,7 +96,6 @@ const PERMISSION_MODULES: Partial<Record<RolePermissionKey, OrgModuleKey[]>> = {
|
|||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const ok = ref('');
|
|
||||||
const users = ref<OrgUserDto[]>([]);
|
const users = ref<OrgUserDto[]>([]);
|
||||||
const roles = ref<OrgRoleDto[]>([]);
|
const roles = ref<OrgRoleDto[]>([]);
|
||||||
const org = ref<OrganizationDto | null>(null);
|
const org = ref<OrganizationDto | null>(null);
|
||||||
@@ -351,14 +354,15 @@ async function switchViewAs(targetUserId: string) {
|
|||||||
if (viewAsBusy.value) return;
|
if (viewAsBusy.value) return;
|
||||||
viewAsBusy.value = true;
|
viewAsBusy.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
await auth.viewAs(targetUserId);
|
await auth.viewAs(targetUserId);
|
||||||
ok.value = auth.user?.viewAs
|
feedback.success(
|
||||||
? `در حال مشاهده بهجای ${auth.user.fullName}`
|
auth.user?.viewAs
|
||||||
: 'به حساب خودتان برگشتید.';
|
? `در حال مشاهده بهجای ${auth.user.fullName}`
|
||||||
|
: 'به حساب خودتان برگشتید.',
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'تغییر حالت مشاهده ناموفق بود.');
|
feedback.fromError(e, 'تغییر حالت مشاهده ناموفق بود.');
|
||||||
} finally {
|
} finally {
|
||||||
viewAsBusy.value = false;
|
viewAsBusy.value = false;
|
||||||
}
|
}
|
||||||
@@ -374,14 +378,6 @@ function formatLastLogin(iso: string | null | undefined) {
|
|||||||
return formatJalaliNumeric(d);
|
return formatJalaliNumeric(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiError(e: unknown, fallback: string) {
|
|
||||||
if (axios.isAxiosError(e)) {
|
|
||||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
|
||||||
return Array.isArray(msg) ? msg.join('، ') : (msg ?? fallback);
|
|
||||||
}
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadAvatars(ids: Array<{ id: string; hasAvatar?: boolean }>) {
|
async function loadAvatars(ids: Array<{ id: string; hasAvatar?: boolean }>) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
ids
|
ids
|
||||||
@@ -442,7 +438,6 @@ async function saveOrg() {
|
|||||||
}
|
}
|
||||||
orgSaving.value = true;
|
orgSaving.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
const payload: UpdateOrganizationRequest = {
|
const payload: UpdateOrganizationRequest = {
|
||||||
name: orgName.value.trim(),
|
name: orgName.value.trim(),
|
||||||
@@ -452,9 +447,9 @@ async function saveOrg() {
|
|||||||
org.value = data;
|
org.value = data;
|
||||||
orgName.value = data.name;
|
orgName.value = data.name;
|
||||||
businessField.value = data.businessField ?? '';
|
businessField.value = data.businessField ?? '';
|
||||||
ok.value = 'مشخصات سازمان ذخیره شد.';
|
feedback.success('مشخصات سازمان ذخیره شد.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ذخیره سازمان ناموفق بود');
|
feedback.fromError(e, 'ذخیره سازمان ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
orgSaving.value = false;
|
orgSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -492,10 +487,10 @@ async function submitInvite() {
|
|||||||
};
|
};
|
||||||
await api.post('/users', payload);
|
await api.post('/users', payload);
|
||||||
inviteOpen.value = false;
|
inviteOpen.value = false;
|
||||||
ok.value = 'کاربر به این محیط اضافه شد.';
|
feedback.success('کاربر به این محیط اضافه شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'افزودن کاربر ناموفق بود');
|
feedback.fromError(e, 'افزودن کاربر ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
inviteSaving.value = false;
|
inviteSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -513,7 +508,6 @@ function openEditUser(user: OrgUserDto) {
|
|||||||
editRoleLocked.value = user.role === 'owner';
|
editRoleLocked.value = user.role === 'owner';
|
||||||
editOpen.value = true;
|
editOpen.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitEditUser() {
|
async function submitEditUser() {
|
||||||
@@ -539,10 +533,10 @@ async function submitEditUser() {
|
|||||||
await api.patch(`/users/${editUserId.value}/role`, { orgRoleId: editRoleId.value });
|
await api.patch(`/users/${editUserId.value}/role`, { orgRoleId: editRoleId.value });
|
||||||
}
|
}
|
||||||
editOpen.value = false;
|
editOpen.value = false;
|
||||||
ok.value = 'مشخصات کاربر ذخیره شد.';
|
feedback.success('مشخصات کاربر ذخیره شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ویرایش کاربر ناموفق بود');
|
feedback.fromError(e, 'ویرایش کاربر ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
editSaving.value = false;
|
editSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -553,9 +547,12 @@ async function toggleStatus(user: OrgUserDto) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.patch(`/users/${user.id}/status`, { isActive: user.isActive === false });
|
await api.patch(`/users/${user.id}/status`, { isActive: user.isActive === false });
|
||||||
|
feedback.success(
|
||||||
|
user.isActive === false ? 'کاربر فعال شد.' : 'کاربر غیرفعال شد.',
|
||||||
|
);
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'تغییر وضعیت ناموفق بود');
|
feedback.fromError(e, 'تغییر وضعیت ناموفق بود');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,16 +563,17 @@ async function toggleLoginOtpOnly(user: OrgUserDto) {
|
|||||||
menuUserId.value = null;
|
menuUserId.value = null;
|
||||||
if (user.role === 'owner') return;
|
if (user.role === 'owner') return;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
const next = !user.loginOtpOnly;
|
const next = !user.loginOtpOnly;
|
||||||
await api.patch(`/users/${user.id}/login-otp-only`, { loginOtpOnly: next });
|
await api.patch(`/users/${user.id}/login-otp-only`, { loginOtpOnly: next });
|
||||||
ok.value = next
|
feedback.success(
|
||||||
? `«${user.fullName}» فقط با کد پیامکی وارد میشود.`
|
next
|
||||||
: `ورود با رمز برای «${user.fullName}» دوباره فعال شد.`;
|
? `«${user.fullName}» فقط با کد پیامکی وارد میشود.`
|
||||||
|
: `ورود با رمز برای «${user.fullName}» دوباره فعال شد.`,
|
||||||
|
);
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'تغییر شیوهٔ ورود ناموفق بود');
|
feedback.fromError(e, 'تغییر شیوهٔ ورود ناموفق بود');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,17 +593,18 @@ async function changeLogoutTime(user: OrgUserDto, raw: string) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
logoutSaving.value = true;
|
logoutSaving.value = true;
|
||||||
try {
|
try {
|
||||||
await api.patch(`/users/${user.id}/logout-time`, { logoutTime: next || null });
|
await api.patch(`/users/${user.id}/logout-time`, { logoutTime: next || null });
|
||||||
ok.value = next
|
feedback.success(
|
||||||
? `ساعت خروج «${user.fullName}» روی ${toFaDigits(next)} تنظیم شد.`
|
next
|
||||||
: `محدودیت خروج «${user.fullName}» برداشته شد.`;
|
? `ساعت خروج «${user.fullName}» روی ${toFaDigits(next)} تنظیم شد.`
|
||||||
|
: `محدودیت خروج «${user.fullName}» برداشته شد.`,
|
||||||
|
);
|
||||||
logoutModal.value = null;
|
logoutModal.value = null;
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ذخیره ساعت خروج ناموفق بود');
|
feedback.fromError(e, 'ذخیره ساعت خروج ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
logoutSaving.value = false;
|
logoutSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -615,18 +614,19 @@ async function toggleBlockAfterLogout(user: OrgUserDto) {
|
|||||||
if (!canSetLogoutTime.value || user.role === 'owner' || !user.logoutTime) return;
|
if (!canSetLogoutTime.value || user.role === 'owner' || !user.logoutTime) return;
|
||||||
const next = !user.blockLoginAfterLogout;
|
const next = !user.blockLoginAfterLogout;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
await api.patch(`/users/${user.id}/logout-time`, {
|
await api.patch(`/users/${user.id}/logout-time`, {
|
||||||
logoutTime: user.logoutTime,
|
logoutTime: user.logoutTime,
|
||||||
blockLoginAfterLogout: next,
|
blockLoginAfterLogout: next,
|
||||||
});
|
});
|
||||||
ok.value = next
|
feedback.success(
|
||||||
? `«${user.fullName}» بعد از ساعت ${toFaDigits(user.logoutTime)} دیگر نمیتواند وارد شود.`
|
next
|
||||||
: `«${user.fullName}» بعد از ساعت خروج هم میتواند وارد شود.`;
|
? `«${user.fullName}» بعد از ساعت ${toFaDigits(user.logoutTime)} دیگر نمیتواند وارد شود.`
|
||||||
|
: `«${user.fullName}» بعد از ساعت خروج هم میتواند وارد شود.`,
|
||||||
|
);
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'تغییر محدودیت ورود ناموفق بود');
|
feedback.fromError(e, 'تغییر محدودیت ورود ناموفق بود');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,13 +635,12 @@ async function changeCommission(user: OrgUserDto, raw: string) {
|
|||||||
const next = Number(raw);
|
const next = Number(raw);
|
||||||
if (!Number.isFinite(next) || next === Number(user.commissionPercent ?? 0)) return;
|
if (!Number.isFinite(next) || next === Number(user.commissionPercent ?? 0)) return;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
await api.patch(`/users/${user.id}/commission`, { commissionPercent: next });
|
await api.patch(`/users/${user.id}/commission`, { commissionPercent: next });
|
||||||
ok.value = `پورسانت «${user.fullName}» ذخیره شد.`;
|
feedback.success(`پورسانت «${user.fullName}» ذخیره شد.`);
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ذخیره پورسانت ناموفق بود');
|
feedback.fromError(e, 'ذخیره پورسانت ناموفق بود');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,10 +775,10 @@ async function submitRoleForm() {
|
|||||||
selectedRoleId.value = data.id;
|
selectedRoleId.value = data.id;
|
||||||
}
|
}
|
||||||
roleFormOpen.value = false;
|
roleFormOpen.value = false;
|
||||||
ok.value = roleFormId.value ? 'نقش بهروز شد.' : 'نقش جدید ساخته شد.';
|
feedback.success(roleFormId.value ? 'نقش بهروز شد.' : 'نقش جدید ساخته شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ذخیره نقش ناموفق بود');
|
feedback.fromError(e, 'ذخیره نقش ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
roleFormSaving.value = false;
|
roleFormSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -794,10 +793,10 @@ async function confirmDeleteRole() {
|
|||||||
await api.delete(`/org-roles/${role.id}`);
|
await api.delete(`/org-roles/${role.id}`);
|
||||||
deleteOpen.value = false;
|
deleteOpen.value = false;
|
||||||
selectedRoleId.value = null;
|
selectedRoleId.value = null;
|
||||||
ok.value = 'نقش حذف شد.';
|
feedback.success('نقش حذف شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'حذف نقش ناموفق بود');
|
feedback.fromError(e, 'حذف نقش ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
deleteSaving.value = false;
|
deleteSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -812,8 +811,9 @@ async function toggleAccess(role: OrgRoleDto, key: RolePermissionKey) {
|
|||||||
error.value = '';
|
error.value = '';
|
||||||
try {
|
try {
|
||||||
await api.patch(`/org-roles/${role.id}`, { permissions: next });
|
await api.patch(`/org-roles/${role.id}`, { permissions: next });
|
||||||
|
feedback.success('دسترسی نقش ذخیره شد.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ذخیره دسترسی ناموفق بود');
|
feedback.fromError(e, 'ذخیره دسترسی ناموفق بود');
|
||||||
await load();
|
await load();
|
||||||
} finally {
|
} finally {
|
||||||
accessSaving.value = false;
|
accessSaving.value = false;
|
||||||
@@ -854,11 +854,11 @@ async function saveFocusDataAccess() {
|
|||||||
const dataAccessPolicy = withOpenSections(focusDataAccess.value);
|
const dataAccessPolicy = withOpenSections(focusDataAccess.value);
|
||||||
focusDataAccess.value = dataAccessPolicy;
|
focusDataAccess.value = dataAccessPolicy;
|
||||||
await api.patch(`/org-roles/${role.id}`, { dataAccessPolicy });
|
await api.patch(`/org-roles/${role.id}`, { dataAccessPolicy });
|
||||||
ok.value = `محدوده داده برای نقش «${role.name}» ذخیره شد.`;
|
feedback.success(`محدوده داده برای نقش «${role.name}» ذخیره شد.`);
|
||||||
await load();
|
await load();
|
||||||
syncFocusDataAccess();
|
syncFocusDataAccess();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = apiError(e, 'ذخیره محدوده داده ناموفق بود');
|
feedback.fromError(e, 'ذخیره محدوده داده ناموفق بود');
|
||||||
} finally {
|
} finally {
|
||||||
accessSaving.value = false;
|
accessSaving.value = false;
|
||||||
}
|
}
|
||||||
@@ -924,34 +924,21 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<header class="page-head">
|
<PageHeader
|
||||||
<div class="head-copy">
|
title="مدیریت کاربران"
|
||||||
<h1>
|
subtitle="کاربران سامانه را مدیریت کنید و نقشهای مختلف را برای آنها تعریف کنید."
|
||||||
<span class="title-ico"><UiIcon name="users" :size="22" /></span>
|
:icon="TeamOutlined"
|
||||||
مدیریت کاربران
|
:tabs="[
|
||||||
</h1>
|
{ key: 'users', label: isNarrow ? 'کاربران' : 'لیست کاربران', count: users.length || undefined },
|
||||||
<p class="lead">کاربران سامانه را مدیریت کنید و نقشهای مختلف را برای آنها تعریف کنید.</p>
|
{ key: 'roles', label: 'نقشها' },
|
||||||
</div>
|
{ key: 'teams', label: isNarrow ? 'تیمها و دسترسی' : 'تیمها و سطح دسترسی به پروندهها' },
|
||||||
</header>
|
{ key: 'access', label: isNarrow ? 'دسترسی' : 'تنظیمات دسترسی' },
|
||||||
|
]"
|
||||||
<nav class="tabs" aria-label="بخشهای مدیریت کاربران">
|
:active-tab="tab"
|
||||||
<button type="button" :class="{ on: tab === 'users' }" @click="setTab('users')">
|
@update:active-tab="(k) => setTab((k ?? 'users') as TabKey)"
|
||||||
<span class="tab-full">لیست کاربران</span>
|
/>
|
||||||
<span class="tab-short">کاربران</span>
|
|
||||||
</button>
|
|
||||||
<button type="button" :class="{ on: tab === 'roles' }" @click="setTab('roles')">نقشها</button>
|
|
||||||
<button type="button" :class="{ on: tab === 'teams' }" @click="setTab('teams')">
|
|
||||||
<span class="tab-full">تیمها و سطح دسترسی به پروندهها</span>
|
|
||||||
<span class="tab-short">تیمها و دسترسی</span>
|
|
||||||
</button>
|
|
||||||
<button type="button" :class="{ on: tab === 'access' }" @click="setTab('access')">
|
|
||||||
<span class="tab-full">تنظیمات دسترسی</span>
|
|
||||||
<span class="tab-short">دسترسی</span>
|
|
||||||
</button>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<p v-if="error" class="error">{{ error }}</p>
|
<p v-if="error" class="error">{{ error }}</p>
|
||||||
<p v-if="ok" class="ok">{{ ok }}</p>
|
|
||||||
|
|
||||||
<TeamsSettingsPanel
|
<TeamsSettingsPanel
|
||||||
v-if="tab === 'teams'"
|
v-if="tab === 'teams'"
|
||||||
@@ -1700,26 +1687,6 @@ onUnmounted(() => {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-copy {
|
|
||||||
text-align: right;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0 0 0.35rem;
|
|
||||||
font-size: clamp(1.35rem, 2.2vw, 1.7rem);
|
|
||||||
font-weight: 800;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.55rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title-ico {
|
.title-ico {
|
||||||
width: 2.15rem;
|
width: 2.15rem;
|
||||||
height: 2.15rem;
|
height: 2.15rem;
|
||||||
@@ -1756,41 +1723,6 @@ h1 {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
gap: 1.25rem;
|
|
||||||
border-bottom: 1px solid #e2e8f0;
|
|
||||||
overflow-x: auto;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
scrollbar-width: thin;
|
|
||||||
overscroll-behavior-x: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button {
|
|
||||||
appearance: none;
|
|
||||||
background: none;
|
|
||||||
border: 0;
|
|
||||||
border-bottom: 2px solid transparent;
|
|
||||||
margin-bottom: -1px;
|
|
||||||
padding: 0.55rem 0.15rem;
|
|
||||||
color: #94a3b8;
|
|
||||||
font: inherit;
|
|
||||||
font-weight: 700;
|
|
||||||
cursor: pointer;
|
|
||||||
flex: 0 0 auto;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button.on {
|
|
||||||
color: #0d9488;
|
|
||||||
border-bottom-color: #14b8a6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-short {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage {
|
.stage {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr) 220px;
|
grid-template-columns: minmax(0, 1fr) 220px;
|
||||||
@@ -2788,19 +2720,6 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.tab-full {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-short {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs {
|
|
||||||
gap: 1rem;
|
|
||||||
padding-bottom: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage {
|
.stage {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
grid-template-areas: 'list';
|
grid-template-areas: 'list';
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import {
|
import {
|
||||||
Alert as AAlert,
|
Alert as AAlert,
|
||||||
Breadcrumb as ABreadcrumb,
|
|
||||||
BreadcrumbItem as ABreadcrumbItem,
|
|
||||||
Button as AButton,
|
Button as AButton,
|
||||||
Card as ACard,
|
Card as ACard,
|
||||||
Checkbox as ACheckbox,
|
Checkbox as ACheckbox,
|
||||||
@@ -22,7 +20,6 @@ import {
|
|||||||
RadioGroup as ARadioGroup,
|
RadioGroup as ARadioGroup,
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
Select as ASelect,
|
Select as ASelect,
|
||||||
Space as ASpace,
|
|
||||||
Tag as ATag,
|
Tag as ATag,
|
||||||
Textarea as ATextarea,
|
Textarea as ATextarea,
|
||||||
Typography,
|
Typography,
|
||||||
@@ -49,8 +46,10 @@ import type {
|
|||||||
TicketPriority,
|
TicketPriority,
|
||||||
TicketStatus,
|
TicketStatus,
|
||||||
} from '@mento/shared';
|
} from '@mento/shared';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { CustomerServiceOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -347,30 +346,21 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-flex vertical :gap="4">
|
:title="pageTitle"
|
||||||
<a-breadcrumb>
|
subtitle="موضوع، اولویت و پیگیری درخواست مشتری"
|
||||||
<a-breadcrumb-item>
|
:icon="CustomerServiceOutlined"
|
||||||
<RouterLink :to="{ name: 'tickets' }">تیکتها</RouterLink>
|
:primary-label="saving ? 'در حال ذخیره…' : 'ذخیره'"
|
||||||
</a-breadcrumb-item>
|
:primary-icon="CheckOutlined"
|
||||||
<a-breadcrumb-item>{{ pageTitle }}</a-breadcrumb-item>
|
:primary-loading="saving"
|
||||||
</a-breadcrumb>
|
:menu-items="isNew ? [] : [{ key: 'delete', label: 'حذف تیکت', icon: DeleteOutlined, danger: true, disabled: saving }]"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
@primary="save"
|
||||||
{{ pageTitle }}
|
@menu="remove"
|
||||||
</a-typography-title>
|
>
|
||||||
</a-flex>
|
<template #actions>
|
||||||
<a-space :size="8" wrap>
|
|
||||||
<a-button type="primary" :loading="saving" @click="save">
|
|
||||||
<template #icon><CheckOutlined /></template>
|
|
||||||
{{ saving ? 'در حال ذخیره…' : 'ذخیره' }}
|
|
||||||
</a-button>
|
|
||||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||||
<a-button v-if="!isNew" danger :disabled="saving" @click="remove">
|
</template>
|
||||||
<template #icon><DeleteOutlined /></template>
|
</PageHeader>
|
||||||
حذف
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<CrmSkeleton :loading="loading">
|
<CrmSkeleton :loading="loading">
|
||||||
<CrmSkeletonCard :rows="8">
|
<CrmSkeletonCard :rows="8">
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ import type { TableColumnsType } from 'ant-design-vue';
|
|||||||
import { FilterOutlined, PlusOutlined, SearchOutlined } from '@/icons/ant-bridge';
|
import { FilterOutlined, PlusOutlined, SearchOutlined } from '@/icons/ant-bridge';
|
||||||
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonTable } from '@/components/skeleton';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Link: ATypographyLink } = Typography;
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { CustomerServiceOutlined } from '@/icons/ant-bridge';
|
||||||
|
const { Text: ATypographyText, Link: ATypographyLink } = Typography;
|
||||||
|
|
||||||
const TICKET_COL_LABELS = [
|
const TICKET_COL_LABELS = [
|
||||||
'موضوع',
|
'موضوع',
|
||||||
@@ -211,13 +213,13 @@ onMounted(load);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">تیکتها</a-typography-title>
|
title="تیکتها"
|
||||||
<a-button type="primary" @click="goNew">
|
subtitle="درخواستهای پشتیبانی مشتریان و وضعیت SLA"
|
||||||
<template #icon><PlusOutlined /></template>
|
:icon="CustomerServiceOutlined"
|
||||||
تیکت جدید
|
primary-label="تیکت جدید"
|
||||||
</a-button>
|
@primary="goNew"
|
||||||
</a-flex>
|
/>
|
||||||
|
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<a-form layout="vertical" @finish="onSearch">
|
<a-form layout="vertical" @finish="onSearch">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { computed, onMounted, reactive, ref } from 'vue';
|
|||||||
import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
import TableColumnsMenu from '@/components/TableColumnsMenu.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import { useFeedback } from '@/composables/useFeedback';
|
||||||
import type {
|
import type {
|
||||||
CreateWooCommerceConnectionRequest,
|
CreateWooCommerceConnectionRequest,
|
||||||
WooCommerceConnectionDto,
|
WooCommerceConnectionDto,
|
||||||
@@ -30,8 +31,10 @@ import {
|
|||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
import type { TableColumnsType } from 'ant-design-vue';
|
import type { TableColumnsType } from 'ant-design-vue';
|
||||||
import { CopyOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
import { CopyOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import { ShoppingOutlined } from '@/icons/ant-bridge';
|
||||||
|
|
||||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
const { Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||||
Typography;
|
Typography;
|
||||||
|
|
||||||
const ORDER_COL_LABELS = [
|
const ORDER_COL_LABELS = [
|
||||||
@@ -45,11 +48,11 @@ const ORDER_COL_LABELS = [
|
|||||||
registerTableColumns('woocommerce.orders', [...ORDER_COL_LABELS]);
|
registerTableColumns('woocommerce.orders', [...ORDER_COL_LABELS]);
|
||||||
const orderTableCols = useTableColumns(() => 'woocommerce.orders');
|
const orderTableCols = useTableColumns(() => 'woocommerce.orders');
|
||||||
|
|
||||||
|
const feedback = useFeedback();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
const syncing = ref(false);
|
const syncing = ref(false);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const ok = ref('');
|
|
||||||
const items = ref<WooCommerceConnectionDto[]>([]);
|
const items = ref<WooCommerceConnectionDto[]>([]);
|
||||||
const orders = ref<WooCommerceOrderLinkDto[]>([]);
|
const orders = ref<WooCommerceOrderLinkDto[]>([]);
|
||||||
const lastSync = ref<WooCommerceSyncResultDto | null>(null);
|
const lastSync = ref<WooCommerceSyncResultDto | null>(null);
|
||||||
@@ -108,7 +111,6 @@ async function create() {
|
|||||||
}
|
}
|
||||||
saving.value = true;
|
saving.value = true;
|
||||||
error.value = '';
|
error.value = '';
|
||||||
ok.value = '';
|
|
||||||
try {
|
try {
|
||||||
const payload: CreateWooCommerceConnectionRequest = {
|
const payload: CreateWooCommerceConnectionRequest = {
|
||||||
label: form.label.trim() || 'فروشگاه',
|
label: form.label.trim() || 'فروشگاه',
|
||||||
@@ -122,12 +124,10 @@ async function create() {
|
|||||||
form.consumerKey = '';
|
form.consumerKey = '';
|
||||||
form.consumerSecret = '';
|
form.consumerSecret = '';
|
||||||
form.webhookSecret = '';
|
form.webhookSecret = '';
|
||||||
ok.value = 'اتصال ذخیره شد.';
|
feedback.success('اتصال ذخیره شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = axios.isAxiosError(e)
|
feedback.fromError(e, 'ذخیره ناموفق بود.');
|
||||||
? String((e.response?.data as { message?: string })?.message ?? 'ذخیره ناموفق بود.')
|
|
||||||
: 'ذخیره ناموفق بود.';
|
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
@@ -136,12 +136,10 @@ async function create() {
|
|||||||
async function test(id: string) {
|
async function test(id: string) {
|
||||||
try {
|
try {
|
||||||
await api.post(`/integrations/woocommerce/connections/${id}/test`);
|
await api.post(`/integrations/woocommerce/connections/${id}/test`);
|
||||||
ok.value = 'اتصال به فروشگاه موفق بود.';
|
feedback.success('اتصال به فروشگاه موفق بود.');
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = axios.isAxiosError(e)
|
feedback.fromError(e, 'تست ناموفق بود.');
|
||||||
? String((e.response?.data as { message?: string })?.message ?? 'تست ناموفق بود.')
|
|
||||||
: 'تست ناموفق بود.';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,12 +151,12 @@ async function sync(id: string) {
|
|||||||
`/integrations/woocommerce/connections/${id}/sync`,
|
`/integrations/woocommerce/connections/${id}/sync`,
|
||||||
);
|
);
|
||||||
lastSync.value = data;
|
lastSync.value = data;
|
||||||
ok.value = `همگامسازی: ${toFaDigits(data.created)} جدید، ${toFaDigits(data.updated)} بهروز.`;
|
feedback.success(
|
||||||
|
`همگامسازی: ${toFaDigits(data.created)} جدید، ${toFaDigits(data.updated)} بهروز.`,
|
||||||
|
);
|
||||||
await load();
|
await load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = axios.isAxiosError(e)
|
feedback.fromError(e, 'همگامسازی ناموفق بود.');
|
||||||
? String((e.response?.data as { message?: string })?.message ?? 'همگامسازی ناموفق بود.')
|
|
||||||
: 'همگامسازی ناموفق بود.';
|
|
||||||
} finally {
|
} finally {
|
||||||
syncing.value = false;
|
syncing.value = false;
|
||||||
}
|
}
|
||||||
@@ -170,9 +168,10 @@ async function remove(id: string) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await api.delete(`/integrations/woocommerce/connections/${id}`);
|
await api.delete(`/integrations/woocommerce/connections/${id}`);
|
||||||
|
feedback.success('اتصال حذف شد.');
|
||||||
await load();
|
await load();
|
||||||
} catch {
|
} catch (e) {
|
||||||
error.value = 'حذف ناموفق بود.';
|
feedback.fromError(e, 'حذف ناموفق بود.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,9 +179,9 @@ async function copyWebhook() {
|
|||||||
if (!webhookUrl.value) return;
|
if (!webhookUrl.value) return;
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(webhookUrl.value);
|
await navigator.clipboard.writeText(webhookUrl.value);
|
||||||
ok.value = 'آدرس وبهوک کپی شد.';
|
feedback.success('آدرس وبهوک کپی شد.');
|
||||||
} catch {
|
} catch {
|
||||||
error.value = 'کپی ممکن نشد.';
|
feedback.error('کپی ممکن نشد.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,16 +192,19 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">ووکامرس</a-typography-title>
|
title="ووکامرس"
|
||||||
<a-button :disabled="loading" @click="load">
|
subtitle="اتصال فروشگاه ووکامرس و دریافت سفارشها با وبهوک"
|
||||||
<template #icon><ReloadOutlined /></template>
|
:icon="ShoppingOutlined"
|
||||||
بروزرسانی
|
>
|
||||||
</a-button>
|
<template #actions>
|
||||||
</a-flex>
|
<a-button :disabled="loading" aria-label="بروزرسانی" title="بروزرسانی" @click="load">
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<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 = ''" />
|
|
||||||
|
|
||||||
<CrmSkeleton :loading="loading">
|
<CrmSkeleton :loading="loading">
|
||||||
<CrmSkeletonCard :rows="8">
|
<CrmSkeletonCard :rows="8">
|
||||||
|
|||||||
@@ -2,7 +2,19 @@
|
|||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import type { GamificationReportDto } from '@mento/shared';
|
import type { GamificationReportDto } from '@mento/shared';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import { Alert as AAlert, Flex as AFlex } from 'ant-design-vue';
|
||||||
|
import {
|
||||||
|
BarChartOutlined,
|
||||||
|
CheckOutlined,
|
||||||
|
EditOutlined,
|
||||||
|
GiftOutlined,
|
||||||
|
SettingOutlined,
|
||||||
|
SlidersOutlined,
|
||||||
|
StarOutlined,
|
||||||
|
TrophyOutlined,
|
||||||
|
} from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import type { PageHeaderTab } from '@/components/page';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import AdminRules from '@/components/gamification/admin/AdminRules.vue';
|
import AdminRules from '@/components/gamification/admin/AdminRules.vue';
|
||||||
@@ -12,21 +24,20 @@ import AdminAchievements from '@/components/gamification/admin/AdminAchievements
|
|||||||
import AdminAdjust from '@/components/gamification/admin/AdminAdjust.vue';
|
import AdminAdjust from '@/components/gamification/admin/AdminAdjust.vue';
|
||||||
import AdminSettings from '@/components/gamification/admin/AdminSettings.vue';
|
import AdminSettings from '@/components/gamification/admin/AdminSettings.vue';
|
||||||
import AdminReports from '@/components/gamification/admin/AdminReports.vue';
|
import AdminReports from '@/components/gamification/admin/AdminReports.vue';
|
||||||
import { toFaDigits } from '@/lib/jalali';
|
|
||||||
|
|
||||||
type Tab = 'rules' | 'redemptions' | 'rewards' | 'badges' | 'adjust' | 'settings' | 'reports';
|
type Tab = 'rules' | 'redemptions' | 'rewards' | 'badges' | 'adjust' | 'settings' | 'reports';
|
||||||
const TABS: Array<{
|
const TABS: Array<{
|
||||||
value: Tab;
|
value: Tab;
|
||||||
label: string;
|
label: string;
|
||||||
icon: 'sliders' | 'check' | 'gift' | 'medal' | 'edit' | 'settings' | 'chart';
|
icon: PageHeaderTab['icon'];
|
||||||
}> = [
|
}> = [
|
||||||
{ value: 'rules', label: 'قوانین امتیاز', icon: 'sliders' },
|
{ value: 'rules', label: 'قوانین امتیاز', icon: SlidersOutlined },
|
||||||
{ value: 'redemptions', label: 'تأییدها', icon: 'check' },
|
{ value: 'redemptions', label: 'تأییدها', icon: CheckOutlined },
|
||||||
{ value: 'rewards', label: 'فروشگاه پاداش', icon: 'gift' },
|
{ value: 'rewards', label: 'فروشگاه پاداش', icon: GiftOutlined },
|
||||||
{ value: 'badges', label: 'نشانها و بونوسها', icon: 'medal' },
|
{ value: 'badges', label: 'نشانها و بونوسها', icon: StarOutlined },
|
||||||
{ value: 'adjust', label: 'تنظیم دستی', icon: 'edit' },
|
{ value: 'adjust', label: 'تنظیم دستی', icon: EditOutlined },
|
||||||
{ value: 'reports', label: 'گزارش و ROI', icon: 'chart' },
|
{ value: 'reports', label: 'گزارش و ROI', icon: BarChartOutlined },
|
||||||
{ value: 'settings', label: 'تنظیمات', icon: 'settings' },
|
{ value: 'settings', label: 'تنظیمات', icon: SettingOutlined },
|
||||||
];
|
];
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -41,6 +52,21 @@ const tab = computed<Tab>(() => {
|
|||||||
return TABS.some((x) => x.value === t) ? (t as Tab) : 'rules';
|
return TABS.some((x) => x.value === t) ? (t as Tab) : 'rules';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const headerTabs = computed<PageHeaderTab[]>(() =>
|
||||||
|
TABS.map((t) => ({
|
||||||
|
key: t.value,
|
||||||
|
label: t.label,
|
||||||
|
icon: t.icon,
|
||||||
|
count: t.value === 'redemptions' && pendingCount.value ? pendingCount.value : undefined,
|
||||||
|
tone: t.value === 'redemptions' ? ('warning' as const) : undefined,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
function onHeaderTab(key: string | undefined) {
|
||||||
|
const next = TABS.find((t) => t.value === key)?.value ?? 'rules';
|
||||||
|
setTab(next);
|
||||||
|
}
|
||||||
|
|
||||||
function setTab(next: Tab) {
|
function setTab(next: Tab) {
|
||||||
void router.replace({ query: { ...route.query, tab: next === 'rules' ? undefined : next } });
|
void router.replace({ query: { ...route.query, tab: next === 'rules' ? undefined : next } });
|
||||||
}
|
}
|
||||||
@@ -67,31 +93,25 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="crm-page gadmin">
|
<a-flex vertical :gap="16">
|
||||||
<header class="head">
|
<PageHeader
|
||||||
<RouterLink to="/club" class="back"><UiIcon name="chevron-right" :size="16" /> باشگاه امتیازات</RouterLink>
|
title="مدیریت باشگاه امتیازات"
|
||||||
<h1>مدیریت باشگاه امتیازات</h1>
|
subtitle="قوانین امتیازدهی، پاداشها، نشانها و درخواستها را از اینجا مدیریت کنید."
|
||||||
<p>قوانین امتیازدهی، پاداشها، نشانها و درخواستها را از اینجا مدیریت کنید.</p>
|
:icon="TrophyOutlined"
|
||||||
</header>
|
back-to="/club"
|
||||||
|
:tabs="isAdmin ? headerTabs : undefined"
|
||||||
|
:active-tab="tab"
|
||||||
|
@update:active-tab="onHeaderTab"
|
||||||
|
/>
|
||||||
|
|
||||||
<p v-if="!isAdmin" class="denied">این بخش فقط برای مالک و مدیران سازمان در دسترس است.</p>
|
<a-alert
|
||||||
|
v-if="!isAdmin"
|
||||||
|
type="warning"
|
||||||
|
show-icon
|
||||||
|
message="این بخش فقط برای مالک و مدیران سازمان در دسترس است."
|
||||||
|
/>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<nav class="tabs" aria-label="بخشهای مدیریت باشگاه">
|
|
||||||
<button
|
|
||||||
v-for="t in TABS"
|
|
||||||
:key="t.value"
|
|
||||||
type="button"
|
|
||||||
class="tab"
|
|
||||||
:class="{ on: tab === t.value }"
|
|
||||||
@click="setTab(t.value)"
|
|
||||||
>
|
|
||||||
<UiIcon :name="t.icon" :size="15" />
|
|
||||||
<span>{{ t.label }}</span>
|
|
||||||
<em v-if="t.value === 'redemptions' && pendingCount">{{ toFaDigits(pendingCount) }}</em>
|
|
||||||
</button>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<AdminRules v-if="tab === 'rules'" />
|
<AdminRules v-if="tab === 'rules'" />
|
||||||
<AdminApprovals v-else-if="tab === 'redemptions'" @changed="onChanged" />
|
<AdminApprovals v-else-if="tab === 'redemptions'" @changed="onChanged" />
|
||||||
<AdminRewards v-else-if="tab === 'rewards'" />
|
<AdminRewards v-else-if="tab === 'rewards'" />
|
||||||
@@ -100,88 +120,5 @@ onMounted(() => {
|
|||||||
<AdminReports v-else-if="tab === 'reports'" />
|
<AdminReports v-else-if="tab === 'reports'" />
|
||||||
<AdminSettings v-else-if="tab === 'settings'" @changed="onChanged" />
|
<AdminSettings v-else-if="tab === 'settings'" @changed="onChanged" />
|
||||||
</template>
|
</template>
|
||||||
</section>
|
</a-flex>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.gadmin {
|
|
||||||
gap: var(--sp-4);
|
|
||||||
grid-template-columns: minmax(0, 1fr);
|
|
||||||
}
|
|
||||||
|
|
||||||
.head {
|
|
||||||
display: grid;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
color: var(--accent-deep);
|
|
||||||
font-size: var(--fs-sm);
|
|
||||||
text-decoration: none;
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: var(--fs-xl);
|
|
||||||
}
|
|
||||||
|
|
||||||
.head p {
|
|
||||||
margin: 0;
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: var(--fs-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.denied {
|
|
||||||
padding: var(--sp-4);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
background: var(--warning-soft);
|
|
||||||
color: var(--warning-deep);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs {
|
|
||||||
display: flex;
|
|
||||||
gap: 4px;
|
|
||||||
overflow-x: auto;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
border-bottom: 1px solid var(--line);
|
|
||||||
scrollbar-width: thin;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
padding: 9px 12px;
|
|
||||||
border: 0;
|
|
||||||
border-bottom: 2px solid transparent;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--muted);
|
|
||||||
font: inherit;
|
|
||||||
font-size: var(--fs-sm);
|
|
||||||
font-weight: 600;
|
|
||||||
white-space: nowrap;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab.on {
|
|
||||||
color: var(--accent-deep);
|
|
||||||
border-bottom-color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab em {
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 0.68rem;
|
|
||||||
min-width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
padding: 0 5px;
|
|
||||||
border-radius: 999px;
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
background: var(--danger);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ import {
|
|||||||
Flex as AFlex,
|
Flex as AFlex,
|
||||||
Progress as AProgress,
|
Progress as AProgress,
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
Space as ASpace,
|
|
||||||
TabPane as ATabPane,
|
|
||||||
Tabs as ATabs,
|
|
||||||
Tag as ATag,
|
Tag as ATag,
|
||||||
Typography,
|
Typography,
|
||||||
theme,
|
theme,
|
||||||
@@ -42,11 +39,12 @@ import ClubTeams from '@/components/gamification/ClubTeams.vue';
|
|||||||
import ClubRulesModal from '@/components/gamification/ClubRulesModal.vue';
|
import ClubRulesModal from '@/components/gamification/ClubRulesModal.vue';
|
||||||
import { CLUB_CTX } from '@/components/gamification/club-context';
|
import { CLUB_CTX } from '@/components/gamification/club-context';
|
||||||
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
|
import type { PageHeaderTab } from '@/components/page';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Title: ATypographyTitle,
|
Title: ATypographyTitle,
|
||||||
Text: ATypographyText,
|
Text: ATypographyText,
|
||||||
Paragraph: ATypographyParagraph,
|
|
||||||
} = Typography;
|
} = Typography;
|
||||||
|
|
||||||
const { token } = theme.useToken();
|
const { token } = theme.useToken();
|
||||||
@@ -77,10 +75,12 @@ function setTab(next: Tab) {
|
|||||||
void router.replace({ query: { ...route.query, tab: next === 'home' ? undefined : next } });
|
void router.replace({ query: { ...route.query, tab: next === 'home' ? undefined : next } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTabChange(key: string | number) {
|
function onTabChange(key: string | number | undefined) {
|
||||||
setTab(String(key) as Tab);
|
setTab(String(key ?? 'home') as Tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const headerTabs: PageHeaderTab[] = TABS.map((t) => ({ key: t.value, label: t.label, icon: t.icon }));
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
try {
|
try {
|
||||||
const res = await api.get<GamificationMeDto>('/gamification/me', { params: { period: 'month' } });
|
const res = await api.get<GamificationMeDto>('/gamification/me', { params: { period: 'month' } });
|
||||||
@@ -177,44 +177,25 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<!-- هدر صفحه باشگاه هماهنگ با طراحی پنل -->
|
<!-- هدر یکپارچه: عنوان + اکشنها + تبهای بخشهای باشگاه -->
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
<PageHeader
|
||||||
<a-flex align="center" :gap="12">
|
title="باشگاه امتیازات"
|
||||||
<a-avatar
|
subtitle="سیستم انگیزش، پیشرفت و پاداش تیمی همکاران؛ ثبت فعالیت، رقابت سالم و دریافت پاداش"
|
||||||
:size="44"
|
:icon="TrophyOutlined"
|
||||||
shape="square"
|
:primary-label="me?.isManager ? 'مدیریت باشگاه' : undefined"
|
||||||
:style="{
|
:primary-icon="SettingOutlined"
|
||||||
background: token.colorPrimaryBg,
|
:tabs="headerTabs"
|
||||||
color: token.colorPrimary,
|
:active-tab="tab"
|
||||||
borderRadius: `${token.borderRadiusLG}px`,
|
@primary="router.push('/club/admin')"
|
||||||
display: 'flex',
|
@update:active-tab="onTabChange"
|
||||||
alignItems: 'center',
|
>
|
||||||
justifyContent: 'center',
|
<template #actions>
|
||||||
}"
|
|
||||||
>
|
|
||||||
<template #icon><TrophyOutlined :style="{ fontSize: '22px' }" /></template>
|
|
||||||
</a-avatar>
|
|
||||||
<a-flex vertical :gap="2">
|
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
|
||||||
باشگاه امتیازات
|
|
||||||
</a-typography-title>
|
|
||||||
<a-typography-paragraph type="secondary" :style="{ margin: 0 }">
|
|
||||||
سیستم انگیزش، پیشرفت و پاداش تیمی همکاران؛ ثبت فعالیت، رقابت سالم و دریافت پاداش
|
|
||||||
</a-typography-paragraph>
|
|
||||||
</a-flex>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<a-space :size="8">
|
|
||||||
<a-button @click="rulesOpen = true">
|
<a-button @click="rulesOpen = true">
|
||||||
<template #icon><BulbOutlined /></template>
|
<template #icon><BulbOutlined /></template>
|
||||||
قوانین و نحوه امتیازدهی
|
قوانین و نحوه امتیازدهی
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button v-if="me?.isManager" type="primary" @click="router.push('/club/admin')">
|
</template>
|
||||||
<template #icon><SettingOutlined /></template>
|
</PageHeader>
|
||||||
مدیریت باشگاه
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-flex>
|
|
||||||
|
|
||||||
<!-- پیام خطا در صورت وجود -->
|
<!-- پیام خطا در صورت وجود -->
|
||||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||||
@@ -475,18 +456,6 @@ watch(
|
|||||||
</a-card>
|
</a-card>
|
||||||
</CrmSkeleton>
|
</CrmSkeleton>
|
||||||
|
|
||||||
<!-- تبهای ناوبری بخشهای مختلف باشگاه -->
|
|
||||||
<a-tabs :active-key="tab" @change="onTabChange">
|
|
||||||
<a-tab-pane v-for="t in TABS" :key="t.value">
|
|
||||||
<template #tab>
|
|
||||||
<a-flex align="center" :gap="8">
|
|
||||||
<component :is="t.icon" />
|
|
||||||
<span>{{ t.label }}</span>
|
|
||||||
</a-flex>
|
|
||||||
</template>
|
|
||||||
</a-tab-pane>
|
|
||||||
</a-tabs>
|
|
||||||
|
|
||||||
<!-- محتوای تب فعال -->
|
<!-- محتوای تب فعال -->
|
||||||
<ClubHome v-if="tab === 'home'" @go="setTab" />
|
<ClubHome v-if="tab === 'home'" @go="setTab" />
|
||||||
<ClubHistory v-else-if="tab === 'history'" />
|
<ClubHistory v-else-if="tab === 'history'" />
|
||||||
|
|||||||
@@ -5,31 +5,21 @@ import type { RoutineContextDto } from '@mento/shared';
|
|||||||
import RoutineTaskDrawer from '@/components/routines/RoutineTaskDrawer.vue';
|
import RoutineTaskDrawer from '@/components/routines/RoutineTaskDrawer.vue';
|
||||||
import QuickTaskModal from '@/components/routines/QuickTaskModal.vue';
|
import QuickTaskModal from '@/components/routines/QuickTaskModal.vue';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { toFaDigits } from '@/lib/jalali';
|
import { formatJalaliShort } from '@/lib/jalali';
|
||||||
import { ROUTINES_CTX, apiError } from '@/lib/routines';
|
import { ROUTINES_CTX, apiError } from '@/lib/routines';
|
||||||
import {
|
import { Alert as AAlert, Button as AButton, Flex as AFlex } from 'ant-design-vue';
|
||||||
Alert as AAlert,
|
|
||||||
Button as AButton,
|
|
||||||
Flex as AFlex,
|
|
||||||
Space as ASpace,
|
|
||||||
TabPane as ATabPane,
|
|
||||||
Tabs as ATabs,
|
|
||||||
Tag as ATag,
|
|
||||||
Typography,
|
|
||||||
} from 'ant-design-vue';
|
|
||||||
import {
|
import {
|
||||||
BellOutlined,
|
BellOutlined,
|
||||||
CalendarOutlined,
|
CalendarOutlined,
|
||||||
ControlOutlined,
|
ControlOutlined,
|
||||||
FundOutlined,
|
FundOutlined,
|
||||||
PlusOutlined,
|
|
||||||
ScheduleOutlined,
|
ScheduleOutlined,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
TeamOutlined,
|
TeamOutlined,
|
||||||
WarningOutlined,
|
WarningOutlined,
|
||||||
} from '@/icons/ant-bridge';
|
} from '@/icons/ant-bridge';
|
||||||
|
import { PageHeader } from '@/components/page';
|
||||||
const { Title: ATypographyTitle } = Typography;
|
import type { PageHeaderTab } from '@/components/page';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -120,7 +110,20 @@ const activeTab = computed(
|
|||||||
() => visibleTabs.value.find((t) => tabActive(t))?.name ?? 'routines-today',
|
() => visibleTabs.value.find((t) => tabActive(t))?.name ?? 'routines-today',
|
||||||
);
|
);
|
||||||
|
|
||||||
function onTabChange(key: string | number) {
|
/** تبهای هدر یکپارچه؛ «عقبافتاده» شمارندهٔ هشداری دارد */
|
||||||
|
const headerTabs = computed<PageHeaderTab[]>(() =>
|
||||||
|
visibleTabs.value.map((t) => ({
|
||||||
|
key: t.name,
|
||||||
|
label: t.label,
|
||||||
|
icon: t.icon,
|
||||||
|
count: t.name === 'routines-overdue' && overdueCount.value > 0 ? overdueCount.value : undefined,
|
||||||
|
tone: t.name === 'routines-overdue' ? 'warning' : 'default',
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
const todayLabel = formatJalaliShort(new Date());
|
||||||
|
|
||||||
|
function onTabChange(key: string | number | undefined) {
|
||||||
const tab = tabs.find((t) => t.name === String(key));
|
const tab = tabs.find((t) => t.name === String(key));
|
||||||
if (tab && route.name !== tab.name) {
|
if (tab && route.name !== tab.name) {
|
||||||
void router.push(tab.to);
|
void router.push(tab.to);
|
||||||
@@ -132,48 +135,31 @@ const hideHeader = computed(() => route.name === 'routine-new' || route.name ===
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-flex vertical :gap="16">
|
<a-flex vertical :gap="16">
|
||||||
<template v-if="!hideHeader">
|
<PageHeader
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
|
v-if="!hideHeader"
|
||||||
<div>
|
title="کارهای روتین"
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">کارهای روتین</a-typography-title>
|
:subtitle="todayLabel"
|
||||||
</div>
|
:icon="SyncOutlined"
|
||||||
<a-space :size="8" wrap>
|
primary-label="کار جدید"
|
||||||
<a-button
|
:tabs="headerTabs"
|
||||||
aria-label="تنظیمات یادآوری و اعلانها"
|
:active-tab="activeTab"
|
||||||
title="تنظیمات یادآوری و اعلانها"
|
@primary="quickOpen = true"
|
||||||
@click="router.push('/routines/settings')"
|
@update:active-tab="onTabChange"
|
||||||
>
|
>
|
||||||
<template #icon><BellOutlined /></template>
|
<template #actions>
|
||||||
</a-button>
|
<a-button
|
||||||
<a-button @click="router.push('/routines/manage/new')">
|
aria-label="تنظیمات یادآوری و اعلانها"
|
||||||
<template #icon><SyncOutlined /></template>
|
title="تنظیمات یادآوری و اعلانها"
|
||||||
روتین جدید
|
@click="router.push('/routines/settings')"
|
||||||
</a-button>
|
>
|
||||||
<a-button type="primary" @click="quickOpen = true">
|
<template #icon><BellOutlined /></template>
|
||||||
<template #icon><PlusOutlined /></template>
|
</a-button>
|
||||||
کار جدید
|
<a-button @click="router.push('/routines/manage/new')">
|
||||||
</a-button>
|
<template #icon><SyncOutlined /></template>
|
||||||
</a-space>
|
روتین جدید
|
||||||
</a-flex>
|
</a-button>
|
||||||
|
</template>
|
||||||
<a-tabs :active-key="activeTab" @change="onTabChange">
|
</PageHeader>
|
||||||
<a-tab-pane v-for="tab in visibleTabs" :key="tab.name">
|
|
||||||
<template #tab>
|
|
||||||
<a-space :size="6">
|
|
||||||
<component :is="tab.icon" />
|
|
||||||
<span>{{ tab.label }}</span>
|
|
||||||
<a-tag
|
|
||||||
v-if="tab.name === 'routines-overdue' && overdueCount > 0"
|
|
||||||
color="error"
|
|
||||||
:bordered="false"
|
|
||||||
>
|
|
||||||
{{ toFaDigits(overdueCount) }}
|
|
||||||
</a-tag>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</a-tab-pane>
|
|
||||||
</a-tabs>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<a-alert v-if="contextError" type="error" show-icon :message="contextError" />
|
<a-alert v-if="contextError" type="error" show-icon :message="contextError" />
|
||||||
|
|
||||||
|
|||||||
+17
-1
@@ -14,7 +14,23 @@ export default defineConfig(({ mode }) => {
|
|||||||
console.log(`[montact] UI → ${apiTarget}${usingLocalApi ? ' (API لوکال)' : ' (سرور اصلی)'}`);
|
console.log(`[montact] UI → ${apiTarget}${usingLocalApi ? ' (API لوکال)' : ' (سرور اصلی)'}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [vue(), tailwindcss()],
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
tailwindcss(),
|
||||||
|
{
|
||||||
|
name: 'survive-windows-watcher',
|
||||||
|
configureServer(server) {
|
||||||
|
// On Windows, fs.watch throws EBUSY when a file is locked (brand SVGs,
|
||||||
|
// antivirus). An unhandled watcher "error" kills Vite and the page
|
||||||
|
// stays white because nothing is left to serve a refresh.
|
||||||
|
server.watcher.on('error', (err: NodeJS.ErrnoException) => {
|
||||||
|
console.error(
|
||||||
|
`[vite] watcher ${err?.code || 'error'} ignored: ${err?.message || err}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||||
|
|||||||
Generated
+90
@@ -62,6 +62,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons-vue": "^7.0.1",
|
"@ant-design/icons-vue": "^7.0.1",
|
||||||
"@mento/shared": "*",
|
"@mento/shared": "*",
|
||||||
|
"@tanstack/vue-query": "^5.108.4",
|
||||||
"ant-design-vue": "^4.2.6",
|
"ant-design-vue": "^4.2.6",
|
||||||
"axios": "^1.8.4",
|
"axios": "^1.8.4",
|
||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
@@ -1450,6 +1451,89 @@
|
|||||||
"vite": "^5.2.0 || ^6 || ^7 || ^8"
|
"vite": "^5.2.0 || ^6 || ^7 || ^8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@tanstack/match-sorter-utils": {
|
||||||
|
"version": "9.2.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/match-sorter-utils/-/match-sorter-utils-9.2.6.tgz",
|
||||||
|
"integrity": "sha512-DIpUSOhPfQ7u/qfUi/Wgm0wBO56MyBYXGvnlI0NcauDRPqdBUlAZZjW2Dxm92m+k1UWVhKw8YJ4f47+75Aujyw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"remove-accents": "0.5.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/query-core": {
|
||||||
|
"version": "5.108.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.108.4.tgz",
|
||||||
|
"integrity": "sha512-2Ks5dlLWz4eXJrthOyG0qW3SLt3xx0RrQmAmN0rnmogiaaOYuWiAe6HAm9KE2b2v8nig+vraNz8fsfZ6fF6zFg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/vue-query": {
|
||||||
|
"version": "5.108.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/vue-query/-/vue-query-5.108.4.tgz",
|
||||||
|
"integrity": "sha512-yvvIjGz3g8vxN+CCBFS7HC6o+RtIsMtgTQFbXsxxeNjOro219CT+55peW6APpGlkxU9FZGIVy6KuNgWlL7agnQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@tanstack/match-sorter-utils": "^9.1.2",
|
||||||
|
"@tanstack/query-core": "5.108.4",
|
||||||
|
"@vue/devtools-api": "^6.6.3",
|
||||||
|
"vue-demi": "^0.14.10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@vue/composition-api": "^1.1.2",
|
||||||
|
"vue": "^2.6.0 || ^3.3.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@vue/composition-api": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/vue-query/node_modules/@vue/devtools-api": {
|
||||||
|
"version": "6.6.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz",
|
||||||
|
"integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/vue-query/node_modules/vue-demi": {
|
||||||
|
"version": "0.14.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",
|
||||||
|
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"vue-demi-fix": "bin/vue-demi-fix.js",
|
||||||
|
"vue-demi-switch": "bin/vue-demi-switch.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/antfu"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@vue/composition-api": "^1.0.0-rc.1",
|
||||||
|
"vue": "^3.0.0-0 || ^2.6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@vue/composition-api": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@tokenizer/inflate": {
|
"node_modules/@tokenizer/inflate": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -5451,6 +5535,12 @@
|
|||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
|
"node_modules/remove-accents": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz",
|
||||||
|
"integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/require-from-string": {
|
"node_modules/require-from-string": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
packages:
|
||||||
|
- apps/*
|
||||||
|
- packages/*
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import { execFileSync } from 'node:child_process';
|
|
||||||
import { writeFileSync } from 'node:fs';
|
|
||||||
|
|
||||||
function gitShow(stage, file) {
|
|
||||||
return execFileSync('git', ['show', `${stage}:${file}`], {
|
|
||||||
encoding: 'utf8',
|
|
||||||
maxBuffer: 32 * 1024 * 1024,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Extract top-level SFC blocks; nested <template> inside root template is kept intact. */
|
|
||||||
function extractSfc(src) {
|
|
||||||
const scripts = [];
|
|
||||||
const styles = [];
|
|
||||||
let template = null;
|
|
||||||
|
|
||||||
const scriptRe = /<script\b[^>]*>[\s\S]*?<\/script>/gi;
|
|
||||||
let m;
|
|
||||||
while ((m = scriptRe.exec(src))) scripts.push(m[0]);
|
|
||||||
|
|
||||||
const styleRe = /<style\b[^>]*>[\s\S]*?<\/style>/gi;
|
|
||||||
while ((m = styleRe.exec(src))) styles.push(m[0]);
|
|
||||||
|
|
||||||
const start = src.search(/<template\b/i);
|
|
||||||
if (start >= 0) {
|
|
||||||
const end = src.toLowerCase().lastIndexOf('</template>');
|
|
||||||
if (end > start) {
|
|
||||||
template = src.slice(start, end + '</template>'.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return { scripts, template, styles };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Script/logic from main (theirs=:3), template+style from local/dev (ours=:2). */
|
|
||||||
function hybrid(oursSrc, theirsSrc) {
|
|
||||||
const ours = extractSfc(oursSrc);
|
|
||||||
const theirs = extractSfc(theirsSrc);
|
|
||||||
const scripts = theirs.scripts.length ? theirs.scripts : ours.scripts;
|
|
||||||
const template = ours.template || theirs.template;
|
|
||||||
const styles = ours.styles.length ? ours.styles : theirs.styles;
|
|
||||||
return [...scripts, template, ...styles].filter(Boolean).join('\n\n') + '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
const files = process.argv.slice(2);
|
|
||||||
if (!files.length) {
|
|
||||||
console.error('Usage: node _hybrid-vue-merge.mjs <file>...');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const file of files) {
|
|
||||||
const ours = gitShow(':2', file);
|
|
||||||
const theirs = gitShow(':3', file);
|
|
||||||
const merged = hybrid(ours, theirs);
|
|
||||||
const check = extractSfc(merged);
|
|
||||||
if (!check.scripts.length || !check.template) {
|
|
||||||
console.error('invalid hybrid result for', file, {
|
|
||||||
scripts: check.scripts.length,
|
|
||||||
hasTemplate: Boolean(check.template),
|
|
||||||
});
|
|
||||||
process.exit(2);
|
|
||||||
}
|
|
||||||
writeFileSync(file, merged, 'utf8');
|
|
||||||
execFileSync('git', ['add', file]);
|
|
||||||
console.log(
|
|
||||||
'hybrid-resolved',
|
|
||||||
file,
|
|
||||||
`scripts=${check.scripts.length}`,
|
|
||||||
`styles=${check.styles.length}`,
|
|
||||||
`tplLen=${check.template.length}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user