feat(web): continue Ant settings migration and tighten page chrome
Migrate remaining settings screens to Ant Design Vue, densify teams/roles UI, drop page-header subtitles project-wide, and polish notes cards plus contacts row actions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,8 +9,31 @@ import type {
|
||||
} from '@mento/shared';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { UiButton, UiField, UiSelect } from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
Descriptions as ADescriptions,
|
||||
DescriptionsItem as ADescriptionsItem,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Steps as ASteps,
|
||||
Step as AStep,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
AimOutlined,
|
||||
CheckCircleOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } = Typography;
|
||||
|
||||
type Step = 'target' | 'map' | 'review';
|
||||
|
||||
@@ -31,10 +54,23 @@ const stageMap = ref<Record<string, string>>({});
|
||||
const busy = ref(false);
|
||||
const error = ref('');
|
||||
|
||||
const stepIndex = computed(() => {
|
||||
if (step.value === 'target') return 0;
|
||||
if (step.value === 'map') return 1;
|
||||
return 2;
|
||||
});
|
||||
|
||||
const selectedTarget = computed(
|
||||
() => preview.value?.targets.find((target) => target.id === targetId.value) ?? null,
|
||||
);
|
||||
|
||||
const targetOptions = computed(() =>
|
||||
(preview.value?.targets ?? []).map((target) => ({
|
||||
value: target.id,
|
||||
label: target.name,
|
||||
})),
|
||||
);
|
||||
|
||||
const canContinueTarget = computed(() => Boolean(targetId.value && selectedTarget.value));
|
||||
const canContinueMap = computed(() => {
|
||||
const current = preview.value;
|
||||
@@ -71,6 +107,13 @@ function compatibleTargets(src: PipelineMergePreviewStageDto) {
|
||||
});
|
||||
}
|
||||
|
||||
function compatibleOptions(src: PipelineMergePreviewStageDto) {
|
||||
return compatibleTargets(src).map((stage) => ({
|
||||
value: stage.id,
|
||||
label: stage.name,
|
||||
}));
|
||||
}
|
||||
|
||||
function statusLabel(stage: Pick<PipelineMergePreviewStageDto, 'isWon' | 'isLost'>) {
|
||||
if (stage.isWon) return 'برد';
|
||||
if (stage.isLost) return 'باخت';
|
||||
@@ -171,298 +214,181 @@ watch(targetId, () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="merge-wizard">
|
||||
<ol class="steps" aria-label="مراحل ادغام کاریز">
|
||||
<li :class="{ active: step === 'target', done: step !== 'target' }">۱. مقصد</li>
|
||||
<li :class="{ active: step === 'map', done: step === 'review' }">۲. نگاشت</li>
|
||||
<li :class="{ active: step === 'review' }">۳. بازبینی</li>
|
||||
</ol>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-steps :current="stepIndex">
|
||||
<a-step title="مقصد" />
|
||||
<a-step title="نگاشت" />
|
||||
<a-step title="بازبینی" />
|
||||
</a-steps>
|
||||
|
||||
<p v-if="busy && !preview" class="muted">در حال آمادهسازی پیشنمایش…</p>
|
||||
<a-spin :spinning="busy && !preview">
|
||||
<template v-if="preview">
|
||||
<a-flex v-if="step === 'target'" vertical :gap="16">
|
||||
<a-flex :gap="8" align="flex-start">
|
||||
<AppstoreOutlined />
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">
|
||||
کاریز مقصد را انتخاب کنید
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
معاملات و فرمهای سرنخ از «{{ preview.source.name }}» به کاریز مقصد منتقل میشوند.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
|
||||
<template v-else-if="preview">
|
||||
<section v-if="step === 'target'" class="step-panel">
|
||||
<div class="intro">
|
||||
<UiIcon name="layers" :size="20" />
|
||||
<div>
|
||||
<h3>کاریز مقصد را انتخاب کنید</h3>
|
||||
<p>
|
||||
معاملات و فرمهای سرنخ از «{{ preview.source.name }}» به کاریز مقصد منتقل میشوند.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="کاریز مقصد" required>
|
||||
<a-select
|
||||
v-model:value="targetId"
|
||||
:options="targetOptions"
|
||||
placeholder="انتخاب کنید"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<UiField label="کاریز مقصد" required>
|
||||
<UiSelect v-model="targetId" required>
|
||||
<option value="" disabled>انتخاب کنید</option>
|
||||
<option v-for="target in preview.targets" :key="target.id" :value="target.id">
|
||||
{{ target.name }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</UiField>
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-card :bordered="true">
|
||||
<a-typography-text strong>{{ toFaDigits(preview.dealCount) }}</a-typography-text>
|
||||
<br />
|
||||
<a-typography-text type="secondary">معامله منتقل میشود</a-typography-text>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-card :bordered="true">
|
||||
<a-typography-text strong>{{ toFaDigits(preview.leadForms.length) }}</a-typography-text>
|
||||
<br />
|
||||
<a-typography-text type="secondary">فرم سرنخ به مقصد وصل میشود</a-typography-text>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col v-if="preview.source.isDefault" :xs="24" :md="8">
|
||||
<a-alert
|
||||
type="warning"
|
||||
show-icon
|
||||
message="هشدار"
|
||||
description="کاریز مبدا پیشفرض است و بعد از ادغام حذف میشود."
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<div class="summary-grid">
|
||||
<article>
|
||||
<strong>{{ toFaDigits(preview.dealCount) }}</strong>
|
||||
<span>معامله منتقل میشود</span>
|
||||
</article>
|
||||
<article>
|
||||
<strong>{{ toFaDigits(preview.leadForms.length) }}</strong>
|
||||
<span>فرم سرنخ به مقصد وصل میشود</span>
|
||||
</article>
|
||||
<article v-if="preview.source.isDefault" class="warn">
|
||||
<strong>هشدار</strong>
|
||||
<span>کاریز مبدا پیشفرض است و بعد از ادغام حذف میشود.</span>
|
||||
</article>
|
||||
</div>
|
||||
<a-alert
|
||||
v-if="selectedTarget?.isDefault"
|
||||
type="info"
|
||||
show-icon
|
||||
message="مقصد انتخابشده کاریز پیشفرض است."
|
||||
/>
|
||||
</a-flex>
|
||||
|
||||
<p v-if="selectedTarget?.isDefault" class="note">مقصد انتخابشده کاریز پیشفرض است.</p>
|
||||
</section>
|
||||
<a-flex v-else-if="step === 'map'" vertical :gap="16">
|
||||
<a-flex :gap="8" align="flex-start">
|
||||
<AimOutlined />
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">
|
||||
مرحلههای مبدا را نگاشت کنید
|
||||
</a-typography-title>
|
||||
<a-typography-text type="secondary">
|
||||
هر مرحله فقط به مرحلهای با وضعیت سازگار در مقصد وصل میشود.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
|
||||
<section v-else-if="step === 'map'" class="step-panel">
|
||||
<div class="intro">
|
||||
<UiIcon name="target" :size="20" />
|
||||
<div>
|
||||
<h3>مرحلههای مبدا را نگاشت کنید</h3>
|
||||
<p>هر مرحله فقط به مرحلهای با وضعیت سازگار در مقصد وصل میشود.</p>
|
||||
</div>
|
||||
</div>
|
||||
<a-form layout="vertical">
|
||||
<a-row
|
||||
v-for="sourceStage in preview.stages"
|
||||
:key="sourceStage.id"
|
||||
:gutter="[16, 0]"
|
||||
align="middle"
|
||||
>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item :style="{ marginBottom: '12px' }">
|
||||
<a-typography-text strong>{{ sourceStage.name }}</a-typography-text>
|
||||
<br />
|
||||
<a-typography-text type="secondary">
|
||||
{{ statusLabel(sourceStage) }} · {{ toFaDigits(sourceStage.dealCount) }} معامله
|
||||
</a-typography-text>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="مرحله مقصد"
|
||||
required
|
||||
:validate-status="stageMap[sourceStage.id] ? undefined : 'error'"
|
||||
:style="{ marginBottom: '12px' }"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="stageMap[sourceStage.id]"
|
||||
:options="compatibleOptions(sourceStage)"
|
||||
placeholder="مرحله مقصد"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-flex>
|
||||
|
||||
<div class="map-list">
|
||||
<article v-for="sourceStage in preview.stages" :key="sourceStage.id" class="map-row">
|
||||
<div class="stage-info">
|
||||
<strong>{{ sourceStage.name }}</strong>
|
||||
<span>
|
||||
{{ statusLabel(sourceStage) }} · {{ toFaDigits(sourceStage.dealCount) }} معامله
|
||||
</span>
|
||||
</div>
|
||||
<UiSelect v-model="stageMap[sourceStage.id]" :error="!stageMap[sourceStage.id]">
|
||||
<option value="" disabled>مرحله مقصد</option>
|
||||
<option
|
||||
v-for="targetStage in compatibleTargets(sourceStage)"
|
||||
:key="targetStage.id"
|
||||
:value="targetStage.id"
|
||||
>
|
||||
{{ targetStage.name }}
|
||||
</option>
|
||||
</UiSelect>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<a-flex v-else vertical :gap="16">
|
||||
<a-flex :gap="8" align="flex-start">
|
||||
<CheckCircleOutlined />
|
||||
<a-flex vertical :gap="4">
|
||||
<a-typography-title :level="5" :style="{ margin: 0 }">بازبینی نهایی</a-typography-title>
|
||||
<a-typography-paragraph type="secondary" :style="{ margin: 0 }">
|
||||
«{{ toFaDigits(preview.dealCount) }}» معامله منتقل میشود.
|
||||
{{ toFaDigits(preview.leadForms.length) }} فرم سرنخ به مقصد وصل میشود.
|
||||
کاریز «{{ preview.source.name }}» حذف میشود.
|
||||
</a-typography-paragraph>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
|
||||
<section v-else class="step-panel">
|
||||
<div class="intro">
|
||||
<UiIcon name="check" :size="20" />
|
||||
<div>
|
||||
<h3>بازبینی نهایی</h3>
|
||||
<p>
|
||||
«{{ toFaDigits(preview.dealCount) }}» معامله منتقل میشود.
|
||||
{{ toFaDigits(preview.leadForms.length) }} فرم سرنخ به مقصد وصل میشود.
|
||||
کاریز «{{ preview.source.name }}» حذف میشود.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<a-descriptions :column="1" size="small" bordered>
|
||||
<a-descriptions-item label="مبدا">{{ preview.source.name }}</a-descriptions-item>
|
||||
<a-descriptions-item label="مقصد">{{ selectedTarget?.name }}</a-descriptions-item>
|
||||
<a-descriptions-item label="روش فرمها">
|
||||
همه فرمهای سرنخ به مقصد وصل میشوند.
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<dl class="review-list">
|
||||
<div>
|
||||
<dt>مبدا</dt>
|
||||
<dd>{{ preview.source.name }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>مقصد</dt>
|
||||
<dd>{{ selectedTarget?.name }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>روش فرمها</dt>
|
||||
<dd>همه فرمهای سرنخ به مقصد وصل میشوند.</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
</template>
|
||||
<a-typography-text v-else-if="!busy && !error" type="secondary">
|
||||
<template v-if="sourceId">در حال بارگذاری پیشنمایش ادغام…</template>
|
||||
<template v-else>برای شروع ادغام، از فهرست کاریزها دکمهٔ «ادغام» را بزنید.</template>
|
||||
</a-typography-text>
|
||||
</a-spin>
|
||||
|
||||
<p v-else-if="!busy && !error" class="muted">
|
||||
<template v-if="sourceId">در حال بارگذاری پیشنمایش ادغام…</template>
|
||||
<template v-else>برای شروع ادغام، از فهرست کاریزها دکمهٔ «ادغام» را بزنید.</template>
|
||||
</p>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
|
||||
<div class="actions">
|
||||
<UiButton variant="ghost" :disabled="busy" @click="emit('close')">بستن</UiButton>
|
||||
<UiButton v-if="step === 'map'" variant="ghost" :disabled="busy" @click="step = 'target'">
|
||||
قبلی
|
||||
</UiButton>
|
||||
<UiButton v-else-if="step === 'review'" variant="ghost" :disabled="busy" @click="step = 'map'">
|
||||
قبلی
|
||||
</UiButton>
|
||||
<UiButton v-if="step === 'target'" :disabled="!preview || !canContinueTarget" @click="nextFromTarget">
|
||||
<a-space wrap>
|
||||
<a-button :disabled="busy" @click="emit('close')">بستن</a-button>
|
||||
<a-button v-if="step === 'map'" :disabled="busy" @click="step = 'target'">قبلی</a-button>
|
||||
<a-button v-else-if="step === 'review'" :disabled="busy" @click="step = 'map'">قبلی</a-button>
|
||||
<a-button
|
||||
v-if="step === 'target'"
|
||||
type="primary"
|
||||
:disabled="!preview || !canContinueTarget"
|
||||
@click="nextFromTarget"
|
||||
>
|
||||
ادامه
|
||||
</UiButton>
|
||||
<UiButton v-else-if="step === 'map'" :disabled="!canContinueMap" @click="nextFromMap">
|
||||
</a-button>
|
||||
<a-button
|
||||
v-else-if="step === 'map'"
|
||||
type="primary"
|
||||
:disabled="!canContinueMap"
|
||||
@click="nextFromMap"
|
||||
>
|
||||
بازبینی
|
||||
</UiButton>
|
||||
<UiButton v-else variant="danger" :loading="busy" :disabled="!canContinueMap" @click="submitMerge">
|
||||
</a-button>
|
||||
<a-button
|
||||
v-else
|
||||
type="primary"
|
||||
danger
|
||||
:loading="busy"
|
||||
:disabled="!canContinueMap"
|
||||
@click="submitMerge"
|
||||
>
|
||||
ادغام و حذف مبدا
|
||||
</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.merge-wizard {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.steps {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.steps li {
|
||||
padding: 0.3rem 0.65rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.steps li.active {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.steps li.done {
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.step-panel {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.intro {
|
||||
display: flex;
|
||||
gap: 0.65rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.intro h3,
|
||||
.intro p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.intro h3 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.intro p {
|
||||
margin-top: 0.25rem;
|
||||
color: var(--muted);
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.summary-grid {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
}
|
||||
|
||||
.summary-grid article {
|
||||
display: grid;
|
||||
gap: 0.2rem;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface-subtle);
|
||||
}
|
||||
|
||||
.summary-grid strong {
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.summary-grid span,
|
||||
.muted,
|
||||
.note {
|
||||
color: var(--muted);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.summary-grid .warn {
|
||||
border-color: var(--danger);
|
||||
background: var(--danger-soft);
|
||||
}
|
||||
|
||||
.map-list {
|
||||
display: grid;
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.map-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(12rem, 18rem);
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.stage-info {
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.stage-info span {
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.review-list {
|
||||
display: grid;
|
||||
gap: 0.65rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.review-list div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
padding-bottom: 0.55rem;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.review-list dt,
|
||||
.review-list dd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.review-list dt {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
padding-top: 0.75rem;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #b91c1c;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.map-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user