fix pargar bugs
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<MobileDetailRow label="نوع" :value="row.type || '-'" />
|
||||
<MobileDetailRow label="مقدار" :value="row.amount ?? '-'" />
|
||||
<MobileDetailRow label="شرح" full-width :value="row.desc || '-'" />
|
||||
<MobileDetailRow label="وضعیت" :value="pargarStatusLabel(row.sync_status, row.pargar_ref)" />
|
||||
<MobileDetailRow label="وضعیت" :value="pargarStatusLabel(row.sync_status, row.pargar_ref, row.desc)" />
|
||||
<MobileDetailRow label="کد پرگار" :value="row.pargar_ref || '-'" />
|
||||
<MobileDetailRow label="زمان" :value="row.created_at ? toJalali(row.created_at) : '-'" />
|
||||
<MobileDetailRow v-if="row.res" label="پاسخ API" full-width :value="row.res" />
|
||||
|
||||
@@ -35,7 +35,7 @@ const createdAtLabel = computed(() =>
|
||||
props.item.created_at ? toJalali(props.item.created_at) : '-'
|
||||
)
|
||||
const statusText = computed(() =>
|
||||
pargarStatusLabel(props.item.sync_status, props.item.pargar_ref)
|
||||
pargarStatusLabel(props.item.sync_status, props.item.pargar_ref, props.item.desc)
|
||||
)
|
||||
const statusClass = computed(() => {
|
||||
const text = statusText.value
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<!-- دکمه ۲: ثبت مشتری در پرگار (فقط اگر سند هنوز ثبت نشده و مشتری کد ندارد) -->
|
||||
<a-tooltip
|
||||
v-if="!record.pargar_ref && !record.customer?.pargar_account_id"
|
||||
v-if="canRetryPargar(record) && !record.customer?.pargar_account_id"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openRegister(record)"
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<!-- دکمه ۳: ارسال به پرگار (فقط اگر هنوز در پرگار ثبت نشده) -->
|
||||
<a-tooltip
|
||||
v-if="!record.pargar_ref"
|
||||
v-if="canRetryPargar(record)"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openSend(record)"
|
||||
@@ -91,7 +91,7 @@ import { isMobile } from '@core/utils/is'
|
||||
import BasicModal from '@/components/BasicModal.vue'
|
||||
import PargarRetryModal from '@/components/PargarRetryModal.vue'
|
||||
import PargarMobileCardList from '@/pages/menuPages/accounting/components/PargarMobileCardList.vue'
|
||||
import { pargarStatusLabel } from '@/pages/menuPages/accounting/utils/pargarStatus'
|
||||
import { canRetryPargar, pargarStatusLabel } from '@/pages/menuPages/accounting/utils/pargarStatus'
|
||||
import { toJalali } from '@core/utils/useDataTime'
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
@@ -120,7 +120,7 @@ const columns = [
|
||||
key: 'sync_status',
|
||||
type: 'Text',
|
||||
filterable: false,
|
||||
customRender: (r: any) => pargarStatusLabel(r.record.sync_status, r.record.pargar_ref)
|
||||
customRender: (r: any) => pargarStatusLabel(r.record.sync_status, r.record.pargar_ref, r.record.desc)
|
||||
},
|
||||
{
|
||||
title: 'زمان',
|
||||
@@ -155,7 +155,7 @@ const infoItems = computed(() => {
|
||||
{ label: 'مقدار', value: row.amount },
|
||||
{ label: 'شرح', value: row.desc },
|
||||
{ label: 'زمان ثبت', value: row.created_at ? toJalali(row.created_at) : '-' },
|
||||
{ label: 'وضعیت', value: pargarStatusLabel(row.sync_status, row.pargar_ref) },
|
||||
{ label: 'وضعیت', value: pargarStatusLabel(row.sync_status, row.pargar_ref, row.desc) },
|
||||
{ label: 'کد پرگار', value: row.pargar_ref || 'ثبت نشده' }
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export function pargarStatusLabel(status?: string, pargarId?: string | null): string {
|
||||
export function pargarStatusLabel(status?: string, pargarId?: string | null, desc?: string | null): string {
|
||||
if (desc && desc.includes('اختلاف مانده')) return 'اختلاف مانده'
|
||||
if (pargarId && String(pargarId).startsWith('skip:')) return 'بدون سند'
|
||||
if (pargarId) return 'موفق'
|
||||
if (status === 'failed') return 'ناموفق'
|
||||
if (status === 'success') return 'موفق'
|
||||
@@ -6,7 +8,13 @@ export function pargarStatusLabel(status?: string, pargarId?: string | null): st
|
||||
return 'ارسال نشده'
|
||||
}
|
||||
|
||||
export function canRetryPargar(record: { pargar_ref?: string | null; sync_status?: string }): boolean {
|
||||
export function canRetryPargar(record: {
|
||||
pargar_ref?: string | null
|
||||
sync_status?: string
|
||||
type?: string
|
||||
}): boolean {
|
||||
if (record.type === 'mande') return false
|
||||
if (record.pargar_ref && String(record.pargar_ref).startsWith('skip:')) return false
|
||||
return !record.pargar_ref || record.sync_status === 'failed'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user