همگامسازی مشتریان
@@ -349,6 +351,7 @@ import {
type SyncPanelResult,
} from '@/api/zarin'
import { useCustomerImportStore } from '@/store/customerImportStore'
+import ColleagueAccountingAccounts from '@/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue'
const importStore = useCustomerImportStore()
diff --git a/src/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue b/src/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue
index 7f7d7a8..502b322 100644
--- a/src/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue
+++ b/src/pages/menuPages/colleagueOrders/components/ColleagueAccountingAccounts.vue
@@ -1,5 +1,5 @@
-
+
-
-
-
+
@@ -42,15 +38,56 @@ import type { Const } from '@/model/configuration'
import {
accountingProviderSetting,
initWalletSettingsFromApi,
+ priceProviderSetting,
type AccountingProvider,
} from '@/utils/config'
+const props = withDefaults(
+ defineProps<{
+ /**
+ * اگر ست شود فقط وقتی provider فعال همین باشد نشان بده
+ * (مثلاً روی صفحهٔ همگامسازی تهحساب: provider-only="tahesab")
+ */
+ providerOnly?: AccountingProvider | null
+ /** پیشفرض: فقط وقتی منبع قیمت Montzar است */
+ requireMontzar?: boolean
+ }>(),
+ {
+ providerOnly: null,
+ requireMontzar: true,
+ },
+)
+
const KEYS = {
zarin: 'montzar_account_zarin',
tahesab: 'montzar_account_tahesab',
pargar: 'montzar_account_pargar',
} as const
+const META: Record<
+ Exclude
,
+ { 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>({
[KEYS.zarin]: '',
[KEYS.tahesab]: '',
@@ -64,30 +101,26 @@ const rowIds = reactive>({
})
const saving = ref(false)
-const loaded = ref(false)
-const fields = computed(() => {
- const provider = accountingProviderSetting.value as AccountingProvider
- return [
- {
- key: KEYS.zarin,
- label: 'کد حساب زرین',
- placeholder: 'کد حساب همکار در زرین',
- active: provider === 'zarin',
- },
- {
- key: KEYS.tahesab,
- label: 'کد حساب تهحساب',
- placeholder: 'کد حساب همکار در تهحساب',
- active: provider === 'tahesab',
- },
- {
- key: KEYS.pargar,
- label: 'کد حساب پرگار',
- placeholder: 'کد حساب همکار در پرگار',
- active: provider === 'pargar',
- },
- ]
+const activeProvider = computed(() => accountingProviderSetting.value as AccountingProvider)
+
+const activeField = computed(() => {
+ const provider = activeProvider.value
+ if (provider === 'none') return null
+ return META[provider] ?? null
+})
+
+const visible = computed(() => {
+ if (props.requireMontzar && priceProviderSetting.value !== 'montzar') {
+ return false
+ }
+ if (!activeField.value) {
+ return false
+ }
+ if (props.providerOnly && activeProvider.value !== props.providerOnly) {
+ return false
+ }
+ return true
})
async function load() {
@@ -99,31 +132,29 @@ async function load() {
values[key] = row?.value != null ? String(row.value) : ''
rowIds[key] = row?.id != null ? Number(row.id) : null
}
- loaded.value = true
}
async function save() {
+ const field = activeField.value
+ if (!field) {
+ message.warning('سیستم حسابداری فعالی انتخاب نشده است')
+ return
+ }
+
saving.value = true
try {
- for (const key of Object.values(KEYS)) {
- await setConfiguration({
- id: rowIds[key] ?? undefined,
- key,
- value: (values[key] ?? '').trim(),
- title_fa:
- key === KEYS.zarin
- ? 'کد حساب همکار در زرین'
- : key === KEYS.tahesab
- ? 'کد حساب همکار در تهحساب'
- : 'کد حساب همکار در پرگار',
- is_active: true,
- can_edit: true,
- type: 'text',
- description:
- 'کد حساب طرف حساب همکار؛ سند خرید/فروش پوشششده روی Montzar روی این حساب ثبت میشود.',
- } satisfies Const)
- }
- message.success('کدهای حساب همکار ذخیره شد')
+ await setConfiguration({
+ id: rowIds[field.key] ?? undefined,
+ key: field.key,
+ value: (values[field.key] ?? '').trim(),
+ title_fa: field.titleFa,
+ is_active: true,
+ can_edit: true,
+ type: 'text',
+ description:
+ 'کد حساب طرف حساب همکار؛ سند خرید/فروش پوشششده روی Montzar روی این حساب ثبت میشود.',
+ } satisfies Const)
+ message.success('کد حساب همکار ذخیره شد')
await load()
} catch (error) {
console.error(error)
@@ -171,30 +202,17 @@ onMounted(() => {
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 {
display: flex;
+ max-width: 28rem;
min-width: 0;
flex-direction: column;
gap: 0.4rem;
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;
background: color-mix(in srgb, var(--admin-bg-muted, #1a1a1f) 80%, 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);
- }
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, #d4af37 18%, transparent);
}
.colleague-accounts__label {
diff --git a/src/pages/menuPages/hesabKetab/index.vue b/src/pages/menuPages/hesabKetab/index.vue
index e45b452..1c83e4d 100644
--- a/src/pages/menuPages/hesabKetab/index.vue
+++ b/src/pages/menuPages/hesabKetab/index.vue
@@ -1,12 +1,17 @@
-
+
-
+
{
})
-
+
diff --git a/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue b/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue
index 54c89b0..052289b 100644
--- a/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue
+++ b/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue
@@ -351,16 +351,6 @@
show-count
/>
-
-
-
-
-
-
@@ -419,6 +409,16 @@
+
+
+
+
+
+