migration

This commit is contained in:
s.esmaeili
2026-10-07 20:20:27 +03:30
parent 92831ed33e
commit 8c5d971d1f
17 changed files with 286 additions and 57 deletions
@@ -127,7 +127,12 @@
class="cursor-pointer w-5 ml-1"
:class="stepIconClass(getStepOneIcon(record))"
/>
<div>{{ getStepOneText(record) }}</div>
<div>
<div>{{ getStepOneText(record) }}</div>
<div v-if="record.verificationStep === 'REJECTED'" class="text-danger text-xs">
رد شده{{ record.verification_rejection_reason ? `: ${record.verification_rejection_reason}` : '' }}
</div>
</div>
</div>
</a-popconfirm>
</a-menu-item>
@@ -213,6 +218,26 @@
</template>
</XTable>
<!-- Reject = REJECTED with an optional reason (owner ruling 2026-10-07). -->
<a-modal
:open="rejectDialog.open"
title="رد مدارک مشتری"
ok-text="ثبت رد"
cancel-text="انصراف"
:ok-button-props="{ danger: true }"
:confirm-loading="rejectDialog.saving"
@ok="submitReject"
@cancel="rejectDialog.open = false"
>
<p>دلیل رد (اختیاری) — در پرونده‌ی مشتری ثبت می‌شود.</p>
<a-textarea
v-model:value="rejectDialog.reason"
:rows="3"
:maxlength="500"
placeholder="مثلاً: تصویر کارت ملی خوانا نیست"
/>
</a-modal>
<BulkCustomer
v-if="showAddButton"
:key="editingId ?? 'new'"
@@ -365,12 +390,38 @@ async function postVerify(payload: Record<string, unknown>, errorMsg: string) {
const acceptStepOne = (id: string) =>
postVerify({ customer_id: id, sts_verify_step_one: 2 }, 'خطا در تغییر وضعیت اولیه مشتری');
const rejectStepOne = (id: string) =>
postVerify({ customer_id: id, sts_verify_step_one: 3 }, 'خطا در تغییر وضعیت اولیه مشتری');
const rejectStepOne = (id: string) => openReject(id, 'sts_verify_step_one');
const acceptStepTwo = (id: string) =>
postVerify({ customer_id: id, sts_verify_step_two: 2 }, 'خطا در تغییر وضعیت سفارش مشتری');
const rejectStepTwo = (id: string) =>
postVerify({ customer_id: id, sts_verify_step_two: 3 }, 'خطا در تغییر وضعیت سفارش مشتری');
const rejectStepTwo = (id: string) => openReject(id, 'sts_verify_step_two');
/**
* A reject asks for an optional reason first; the customer is then stored as
* REJECTED with it (admin-customers.service.ts verify()).
*/
type VerifyStep = 'sts_verify_step_one' | 'sts_verify_step_two';
const rejectDialog = ref<{ open: boolean; saving: boolean; id: string; step: VerifyStep; reason: string }>({
open: false,
saving: false,
id: '',
step: 'sts_verify_step_one',
reason: '',
});
function openReject(id: string, step: VerifyStep) {
rejectDialog.value = { open: true, saving: false, id, step, reason: '' };
}
async function submitReject() {
const d = rejectDialog.value;
d.saving = true;
await postVerify(
{ customer_id: d.id, [d.step]: 3, reason: d.reason.trim() || null },
d.step === 'sts_verify_step_one' ? 'خطا در تغییر وضعیت اولیه مشتری' : 'خطا در تغییر وضعیت سفارش مشتری',
);
d.saving = false;
d.open = false;
}
/** legacy inline ternary on @confirm, preserved including the NonVerified quirk */
function onConfirmStepOne(record: Record<string, any>) {