fix(admin): active-only colleague account code and karat placement
Show montzar colleague account field only for the connected accounting provider (also on customer sync pages), untruncate hesab-ketab menu labels, and move product karat under weight/unit. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
<PargarWalletBulkSync />
|
<PargarWalletBulkSync />
|
||||||
|
|
||||||
|
<ColleagueAccountingAccounts provider-only="pargar" />
|
||||||
|
|
||||||
<!-- ─── بنر آمار ─── -->
|
<!-- ─── بنر آمار ─── -->
|
||||||
<div class="cs-banner">
|
<div class="cs-banner">
|
||||||
<div class="cs-banner__title">همگامسازی مشتریان</div>
|
<div class="cs-banner__title">همگامسازی مشتریان</div>
|
||||||
@@ -326,6 +328,7 @@ import {
|
|||||||
} from '@/api/pargar'
|
} from '@/api/pargar'
|
||||||
import { useCustomerImportStore } from '@/store/customerImportStore'
|
import { useCustomerImportStore } from '@/store/customerImportStore'
|
||||||
import PargarWalletBulkSync from './PargarWalletBulkSync.vue'
|
import PargarWalletBulkSync from './PargarWalletBulkSync.vue'
|
||||||
|
import ColleagueAccountingAccounts from '@/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue'
|
||||||
|
|
||||||
const importStore = useCustomerImportStore()
|
const importStore = useCustomerImportStore()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="cs-wrap">
|
<div class="cs-wrap">
|
||||||
|
|
||||||
|
<ColleagueAccountingAccounts provider-only="tahesab" />
|
||||||
|
|
||||||
<!-- ─── بنر آمار ─── -->
|
<!-- ─── بنر آمار ─── -->
|
||||||
<div class="cs-banner">
|
<div class="cs-banner">
|
||||||
<div class="cs-banner__title">همگامسازی مشتریان</div>
|
<div class="cs-banner__title">همگامسازی مشتریان</div>
|
||||||
@@ -323,6 +325,7 @@ import {
|
|||||||
type SyncPanelResult,
|
type SyncPanelResult,
|
||||||
} from '@/api/tahesab'
|
} from '@/api/tahesab'
|
||||||
import { useCustomerImportStore } from '@/store/customerImportStore'
|
import { useCustomerImportStore } from '@/store/customerImportStore'
|
||||||
|
import ColleagueAccountingAccounts from '@/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue'
|
||||||
|
|
||||||
const importStore = useCustomerImportStore()
|
const importStore = useCustomerImportStore()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="cs-wrap">
|
<div class="cs-wrap">
|
||||||
|
|
||||||
|
<ColleagueAccountingAccounts provider-only="zarin" />
|
||||||
|
|
||||||
<!-- ─── بنر آمار ─── -->
|
<!-- ─── بنر آمار ─── -->
|
||||||
<div class="cs-banner">
|
<div class="cs-banner">
|
||||||
<div class="cs-banner__title">همگامسازی مشتریان</div>
|
<div class="cs-banner__title">همگامسازی مشتریان</div>
|
||||||
@@ -349,6 +351,7 @@ import {
|
|||||||
type SyncPanelResult,
|
type SyncPanelResult,
|
||||||
} from '@/api/zarin'
|
} from '@/api/zarin'
|
||||||
import { useCustomerImportStore } from '@/store/customerImportStore'
|
import { useCustomerImportStore } from '@/store/customerImportStore'
|
||||||
|
import ColleagueAccountingAccounts from '@/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue'
|
||||||
|
|
||||||
const importStore = useCustomerImportStore()
|
const importStore = useCustomerImportStore()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="colleague-accounts">
|
<section v-if="visible" class="colleague-accounts">
|
||||||
<header class="colleague-accounts__head">
|
<header class="colleague-accounts__head">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="colleague-accounts__title">کد حسابداری معامله با همکار</h3>
|
<h3 class="colleague-accounts__title">کد حسابداری معامله با همکار</h3>
|
||||||
@@ -8,29 +8,25 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<BaseButton type="primary" :loading="saving" @click="save">
|
<BaseButton type="primary" :loading="saving" @click="save">
|
||||||
ذخیره کدها
|
ذخیره کد
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="colleague-accounts__grid">
|
<label
|
||||||
<label
|
v-if="activeField"
|
||||||
v-for="field in fields"
|
class="colleague-accounts__field colleague-accounts__field--active"
|
||||||
:key="field.key"
|
>
|
||||||
class="colleague-accounts__field"
|
<span class="colleague-accounts__label">
|
||||||
:class="{ 'colleague-accounts__field--active': field.active }"
|
{{ activeField.label }}
|
||||||
>
|
<span class="colleague-accounts__badge">فعال</span>
|
||||||
<span class="colleague-accounts__label">
|
</span>
|
||||||
{{ field.label }}
|
<a-input
|
||||||
<span v-if="field.active" class="colleague-accounts__badge">فعال</span>
|
v-model:value="values[activeField.key]"
|
||||||
</span>
|
:placeholder="activeField.placeholder"
|
||||||
<a-input
|
allow-clear
|
||||||
v-model:value="values[field.key]"
|
class="colleague-accounts__input"
|
||||||
:placeholder="field.placeholder"
|
/>
|
||||||
allow-clear
|
</label>
|
||||||
class="colleague-accounts__input"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -42,15 +38,56 @@ import type { Const } from '@/model/configuration'
|
|||||||
import {
|
import {
|
||||||
accountingProviderSetting,
|
accountingProviderSetting,
|
||||||
initWalletSettingsFromApi,
|
initWalletSettingsFromApi,
|
||||||
|
priceProviderSetting,
|
||||||
type AccountingProvider,
|
type AccountingProvider,
|
||||||
} from '@/utils/config'
|
} from '@/utils/config'
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/**
|
||||||
|
* اگر ست شود فقط وقتی provider فعال همین باشد نشان بده
|
||||||
|
* (مثلاً روی صفحهٔ همگامسازی تهحساب: provider-only="tahesab")
|
||||||
|
*/
|
||||||
|
providerOnly?: AccountingProvider | null
|
||||||
|
/** پیشفرض: فقط وقتی منبع قیمت Montzar است */
|
||||||
|
requireMontzar?: boolean
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
providerOnly: null,
|
||||||
|
requireMontzar: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
const KEYS = {
|
const KEYS = {
|
||||||
zarin: 'montzar_account_zarin',
|
zarin: 'montzar_account_zarin',
|
||||||
tahesab: 'montzar_account_tahesab',
|
tahesab: 'montzar_account_tahesab',
|
||||||
pargar: 'montzar_account_pargar',
|
pargar: 'montzar_account_pargar',
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
|
const META: Record<
|
||||||
|
Exclude<AccountingProvider, 'none'>,
|
||||||
|
{ key: string; label: string; placeholder: string; titleFa: string }
|
||||||
|
> = {
|
||||||
|
zarin: {
|
||||||
|
key: KEYS.zarin,
|
||||||
|
label: 'کد حساب زرین',
|
||||||
|
placeholder: 'کد حساب همکار در زرین',
|
||||||
|
titleFa: 'کد حساب همکار در زرین',
|
||||||
|
},
|
||||||
|
tahesab: {
|
||||||
|
key: KEYS.tahesab,
|
||||||
|
label: 'کد حساب تهحساب',
|
||||||
|
placeholder: 'کد حساب همکار در تهحساب',
|
||||||
|
titleFa: 'کد حساب همکار در تهحساب',
|
||||||
|
},
|
||||||
|
pargar: {
|
||||||
|
key: KEYS.pargar,
|
||||||
|
label: 'کد حساب پرگار',
|
||||||
|
placeholder: 'کد حساب همکار در پرگار',
|
||||||
|
titleFa: 'کد حساب همکار در پرگار',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
const values = reactive<Record<string, string>>({
|
const values = reactive<Record<string, string>>({
|
||||||
[KEYS.zarin]: '',
|
[KEYS.zarin]: '',
|
||||||
[KEYS.tahesab]: '',
|
[KEYS.tahesab]: '',
|
||||||
@@ -64,30 +101,26 @@ const rowIds = reactive<Record<string, number | null>>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
const loaded = ref(false)
|
|
||||||
|
|
||||||
const fields = computed(() => {
|
const activeProvider = computed(() => accountingProviderSetting.value as AccountingProvider)
|
||||||
const provider = accountingProviderSetting.value as AccountingProvider
|
|
||||||
return [
|
const activeField = computed(() => {
|
||||||
{
|
const provider = activeProvider.value
|
||||||
key: KEYS.zarin,
|
if (provider === 'none') return null
|
||||||
label: 'کد حساب زرین',
|
return META[provider] ?? null
|
||||||
placeholder: 'کد حساب همکار در زرین',
|
})
|
||||||
active: provider === 'zarin',
|
|
||||||
},
|
const visible = computed(() => {
|
||||||
{
|
if (props.requireMontzar && priceProviderSetting.value !== 'montzar') {
|
||||||
key: KEYS.tahesab,
|
return false
|
||||||
label: 'کد حساب تهحساب',
|
}
|
||||||
placeholder: 'کد حساب همکار در تهحساب',
|
if (!activeField.value) {
|
||||||
active: provider === 'tahesab',
|
return false
|
||||||
},
|
}
|
||||||
{
|
if (props.providerOnly && activeProvider.value !== props.providerOnly) {
|
||||||
key: KEYS.pargar,
|
return false
|
||||||
label: 'کد حساب پرگار',
|
}
|
||||||
placeholder: 'کد حساب همکار در پرگار',
|
return true
|
||||||
active: provider === 'pargar',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
@@ -99,31 +132,29 @@ async function load() {
|
|||||||
values[key] = row?.value != null ? String(row.value) : ''
|
values[key] = row?.value != null ? String(row.value) : ''
|
||||||
rowIds[key] = row?.id != null ? Number(row.id) : null
|
rowIds[key] = row?.id != null ? Number(row.id) : null
|
||||||
}
|
}
|
||||||
loaded.value = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
|
const field = activeField.value
|
||||||
|
if (!field) {
|
||||||
|
message.warning('سیستم حسابداری فعالی انتخاب نشده است')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
saving.value = true
|
saving.value = true
|
||||||
try {
|
try {
|
||||||
for (const key of Object.values(KEYS)) {
|
await setConfiguration({
|
||||||
await setConfiguration({
|
id: rowIds[field.key] ?? undefined,
|
||||||
id: rowIds[key] ?? undefined,
|
key: field.key,
|
||||||
key,
|
value: (values[field.key] ?? '').trim(),
|
||||||
value: (values[key] ?? '').trim(),
|
title_fa: field.titleFa,
|
||||||
title_fa:
|
is_active: true,
|
||||||
key === KEYS.zarin
|
can_edit: true,
|
||||||
? 'کد حساب همکار در زرین'
|
type: 'text',
|
||||||
: key === KEYS.tahesab
|
description:
|
||||||
? 'کد حساب همکار در تهحساب'
|
'کد حساب طرف حساب همکار؛ سند خرید/فروش پوشششده روی Montzar روی این حساب ثبت میشود.',
|
||||||
: 'کد حساب همکار در پرگار',
|
} satisfies Const)
|
||||||
is_active: true,
|
message.success('کد حساب همکار ذخیره شد')
|
||||||
can_edit: true,
|
|
||||||
type: 'text',
|
|
||||||
description:
|
|
||||||
'کد حساب طرف حساب همکار؛ سند خرید/فروش پوشششده روی Montzar روی این حساب ثبت میشود.',
|
|
||||||
} satisfies Const)
|
|
||||||
}
|
|
||||||
message.success('کدهای حساب همکار ذخیره شد')
|
|
||||||
await load()
|
await load()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -171,30 +202,17 @@ onMounted(() => {
|
|||||||
color: var(--admin-text-secondary, rgba(255, 255, 255, 0.65));
|
color: var(--admin-text-secondary, rgba(255, 255, 255, 0.65));
|
||||||
}
|
}
|
||||||
|
|
||||||
.colleague-accounts__grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
gap: 0.875rem;
|
|
||||||
|
|
||||||
@media (min-width: 900px) {
|
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.colleague-accounts__field {
|
.colleague-accounts__field {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
max-width: 28rem;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
border: 1px solid var(--admin-border, rgba(255, 255, 255, 0.1));
|
border: 1px solid color-mix(in srgb, #d4af37 55%, transparent);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: color-mix(in srgb, var(--admin-bg-muted, #1a1a1f) 80%, transparent);
|
background: color-mix(in srgb, var(--admin-bg-muted, #1a1a1f) 80%, transparent);
|
||||||
|
box-shadow: inset 0 0 0 1px color-mix(in srgb, #d4af37 18%, transparent);
|
||||||
&--active {
|
|
||||||
border-color: color-mix(in srgb, #d4af37 55%, transparent);
|
|
||||||
box-shadow: inset 0 0 0 1px color-mix(in srgb, #d4af37 18%, transparent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.colleague-accounts__label {
|
.colleague-accounts__label {
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="hesab-ketab">
|
||||||
<BasicMainCard>
|
<BasicMainCard>
|
||||||
<div class="flex h-full min-h-0 flex-col md:flex-row">
|
<div class="flex h-full min-h-0 flex-col md:flex-row">
|
||||||
<BasicMenu width="11rem" :menu="menu" mode="horizontal" class="overflow-auto md:hidden" />
|
|
||||||
<BasicMenu
|
<BasicMenu
|
||||||
width="13rem"
|
width="100%"
|
||||||
:menu="menu"
|
:menu="menu"
|
||||||
class="hidden min-w-[13.5rem] overflow-auto md:inline"
|
mode="horizontal"
|
||||||
|
class="hesab-ketab__menu hesab-ketab__menu--mobile overflow-auto md:hidden"
|
||||||
|
/>
|
||||||
|
<BasicMenu
|
||||||
|
width="17rem"
|
||||||
|
:menu="menu"
|
||||||
|
class="hesab-ketab__menu hesab-ketab__menu--side hidden min-w-[17rem] overflow-auto md:inline"
|
||||||
/>
|
/>
|
||||||
<RouterView
|
<RouterView
|
||||||
:key="route.name"
|
:key="route.name"
|
||||||
@@ -50,4 +55,22 @@ const menu = computed(() => {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style scoped lang="less">
|
||||||
|
.hesab-ketab__menu {
|
||||||
|
:deep(.ant-menu-item),
|
||||||
|
:deep(.ant-menu-submenu-title) {
|
||||||
|
height: auto !important;
|
||||||
|
min-height: 2.5rem;
|
||||||
|
line-height: 1.35 !important;
|
||||||
|
white-space: normal !important;
|
||||||
|
padding-block: 0.55rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-menu-title-content) {
|
||||||
|
white-space: normal !important;
|
||||||
|
overflow: visible !important;
|
||||||
|
text-overflow: clip !important;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -351,16 +351,6 @@
|
|||||||
show-count
|
show-count
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item name="karat" class="!mb-0 max-w-xs">
|
|
||||||
<template #label>
|
|
||||||
<DashboardLabelWithHelp label="عیار" :help="productKaratHelp" size="sm" />
|
|
||||||
</template>
|
|
||||||
<BasicInput
|
|
||||||
v-model:value="form.karat"
|
|
||||||
placeholder="مثلاً ۲۴ (اختیاری)"
|
|
||||||
:maxlength="32"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- وزن و واحد -->
|
<!-- وزن و واحد -->
|
||||||
@@ -419,6 +409,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<BasicSelect v-model:value="form.unit" :items="unitItems" valueName="value" keyName="value" />
|
<BasicSelect v-model:value="form.unit" :items="unitItems" valueName="value" keyName="value" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item name="karat" class="!mb-0">
|
||||||
|
<template #label>
|
||||||
|
<DashboardLabelWithHelp label="عیار" :help="productKaratHelp" size="sm" />
|
||||||
|
</template>
|
||||||
|
<BasicInput
|
||||||
|
v-model:value="form.karat"
|
||||||
|
placeholder="مثلاً ۲۴ (اختیاری)"
|
||||||
|
:maxlength="32"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
v-if="showDirectPriceField"
|
v-if="showDirectPriceField"
|
||||||
name="direct_price"
|
name="direct_price"
|
||||||
|
|||||||
Reference in New Issue
Block a user