merge: bring latest origin/main into dev (main wins conflicts)
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
InputNumber as AInputNumber,
|
||||
Modal,
|
||||
Modal as AModal,
|
||||
Row as ARow,
|
||||
Segmented as ASegmented,
|
||||
@@ -44,9 +45,11 @@ import { toFaDigits } from '@/lib/jalali';
|
||||
import { currencySuffix, formatMoney } from '@/lib/money';
|
||||
import CustomFieldsSection from '@/components/CustomFieldsSection.vue';
|
||||
import EntityTimeline from '@/components/EntityTimeline.vue';
|
||||
import RelatedActivitiesPanel from '@/components/activities/RelatedActivitiesPanel.vue';
|
||||
import RelatedTasksPanel from '@/components/routines/RelatedTasksPanel.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import StagePathStrip from '@/components/StagePathStrip.vue';
|
||||
import UserMultiSelect from '@/components/UserMultiSelect.vue';
|
||||
import PersonFormView from '@/views/PersonFormView.vue';
|
||||
import type {
|
||||
@@ -104,6 +107,7 @@ const pageTitle = computed(() => (isNew.value ? 'ایجاد معامله جدی
|
||||
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const stageMoving = ref(false);
|
||||
const error = ref('');
|
||||
const showOthers = ref(true);
|
||||
const othersKeys = ref<string[]>(['others']);
|
||||
@@ -197,6 +201,43 @@ const pipelineSelectOptions = computed(() =>
|
||||
const stageSelectOptions = computed(() =>
|
||||
stages.value.map((s) => ({ value: s.id, label: s.name })),
|
||||
);
|
||||
const stagePathItems = computed(() => stages.value.map((s) => ({ id: s.id, name: s.name })));
|
||||
|
||||
function onStageSelect(nextId: string) {
|
||||
if (!nextId || nextId === stageId.value || stageMoving.value || saving.value) return;
|
||||
const target = stages.value.find((stage) => stage.id === nextId);
|
||||
if (!target) return;
|
||||
const prev = stageId.value;
|
||||
Modal.confirm({
|
||||
title: 'جابهجایی مرحله',
|
||||
content: `به مرحله «${target.name}» منتقل میشود. انجام شود؟`,
|
||||
okText: 'انجام بده',
|
||||
cancelText: 'انجام نده',
|
||||
centered: true,
|
||||
async onOk() {
|
||||
stageId.value = nextId;
|
||||
if (isNew.value || !id.value) return;
|
||||
stageMoving.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
await api.patch(`/deals/${id.value}/move`, { stageId: nextId });
|
||||
} catch (e) {
|
||||
stageId.value = prev;
|
||||
if (axios.isAxiosError(e)) {
|
||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
||||
error.value = Array.isArray(msg)
|
||||
? msg.join('، ')
|
||||
: (msg ?? 'جابهجایی مرحله ناموفق بود.');
|
||||
} else {
|
||||
error.value = 'جابهجایی مرحله ناموفق بود.';
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
stageMoving.value = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const productSelectOptions = computed(() =>
|
||||
products.value.map((p) => ({ value: p.id, label: p.name })),
|
||||
);
|
||||
@@ -666,6 +707,20 @@ onMounted(load);
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<div
|
||||
v-if="stagePathItems.length"
|
||||
:style="{ marginBottom: '16px' }"
|
||||
>
|
||||
<StagePathStrip
|
||||
:stages="stagePathItems"
|
||||
:value="stageId"
|
||||
:loading="stageMoving"
|
||||
:disabled="saving || loading"
|
||||
aria-label="مراحل مسیر فروش"
|
||||
@select="onStageSelect"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" :style="{ marginBottom: '16px' }" />
|
||||
|
||||
<a-form layout="vertical" @finish="submit">
|
||||
@@ -961,6 +1016,14 @@ onMounted(load);
|
||||
</a-form-item>
|
||||
</a-card>
|
||||
|
||||
<RelatedActivitiesPanel
|
||||
v-if="!isNew && id"
|
||||
:style="{ marginTop: '16px' }"
|
||||
:deal-id="id"
|
||||
:person-id="personId || null"
|
||||
:company-id="companyId || null"
|
||||
:deal-title="title"
|
||||
/>
|
||||
<RelatedTasksPanel
|
||||
v-if="!isNew && id"
|
||||
:style="{ marginTop: '16px' }"
|
||||
|
||||
Reference in New Issue
Block a user