diff --git a/src/api/shayegan.ts b/src/api/shayegan.ts new file mode 100644 index 0000000..c6cb737 --- /dev/null +++ b/src/api/shayegan.ts @@ -0,0 +1,17 @@ +import request from '@/utils/http' + +export function shayeganHealth() { + return request.get({ url: '/admin/shayegan/health' }) +} + +export function shayeganTable(data: Record) { + return request.post({ url: '/admin/shayegan/table', data }) +} + +export function shayeganShow(id: number | string) { + return request.get({ url: `/admin/shayegan/${id}` }) +} + +export function shayeganRetry(id: number | string, force = false) { + return request.post({ url: `/admin/shayegan/${id}/retry`, data: { force } }) +} diff --git a/src/pages/menuPages/accounting/components/shayeganTable.vue b/src/pages/menuPages/accounting/components/shayeganTable.vue new file mode 100644 index 0000000..ae5bd3e --- /dev/null +++ b/src/pages/menuPages/accounting/components/shayeganTable.vue @@ -0,0 +1,145 @@ + + + diff --git a/src/pages/menuPages/accounting/index.vue b/src/pages/menuPages/accounting/index.vue index f5fa612..d3a6a79 100644 --- a/src/pages/menuPages/accounting/index.vue +++ b/src/pages/menuPages/accounting/index.vue @@ -17,6 +17,7 @@ + @@ -28,6 +29,7 @@ + (false) const submitError = ref('') -const activeTab = ref<'reports' | 'tahesab' | 'customer-sync' | 'tahesab-wallet-sync' | 'zarin' | 'zarin-customer-sync' | 'zarin-wallet-sync' | 'pargar' | 'pargar-customer-sync' | 'pargar-wallet-sync'>('reports') +const activeTab = ref<'reports' | 'tahesab' | 'customer-sync' | 'tahesab-wallet-sync' | 'zarin' | 'zarin-customer-sync' | 'zarin-wallet-sync' | 'pargar' | 'pargar-customer-sync' | 'pargar-wallet-sync' | 'shayegan'>('reports') const tahesabEnabled = tahesabEnabledSetting const zarinEnabled = zarinEnabledSetting const pargarEnabled = pargarEnabledSetting +const shayeganEnabled = shayeganEnabledSetting //define store const store = useStaticApiListsStore() diff --git a/src/pages/menuPages/configuration/settingGroups.ts b/src/pages/menuPages/configuration/settingGroups.ts index 7716c97..2be0b35 100644 --- a/src/pages/menuPages/configuration/settingGroups.ts +++ b/src/pages/menuPages/configuration/settingGroups.ts @@ -265,6 +265,12 @@ export const SYSTEM_SETTING_GROUPS: SettingGroupDef[] = [ icon: 'vuesax-linear:document-text', match: (k) => k.startsWith('pargar_') || k === 'send_to_pargar' }, + { + id: 'accounting_shayegan', + title: 'حسابداری شایگان', + icon: 'vuesax-linear:receipt-item', + match: (k) => k.startsWith('shayegan_') + }, { id: 'price_channel', title: 'ارسال قیمت به کانال', diff --git a/src/utils/config.ts b/src/utils/config.ts index ee88dff..dbbf2c4 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,7 +1,7 @@ import { ref } from 'vue' import { setCachedMainMetal } from '@/utils/metalLabels' -export type AccountingProvider = 'none' | 'pargar' | 'tahesab' | 'zarin' +export type AccountingProvider = 'none' | 'pargar' | 'tahesab' | 'zarin' | 'shayegan' export function getConfigApp(key: string) { const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user : {} @@ -47,6 +47,9 @@ export const zarinEnabledSetting = ref(false) /** reactive — نمایش UI پرگار در حسابداری و ... */ export const pargarEnabledSetting = ref(false) +/** reactive — نمایش UI شایگان در حسابداری و ... */ +export const shayeganEnabledSetting = ref(false) + /** reactive — دکمه پیامک تکی در لیست مشتریان */ export const customerDirectSmsEnabledSetting = ref(false) @@ -100,6 +103,7 @@ export const accountingProviderSetting = ref('none') let tahesabEnabledFromSettings: boolean | null = null let zarinEnabledFromSettings: boolean | null = null let pargarEnabledFromSettings: boolean | null = null +let shayeganEnabledFromSettings: boolean | null = null let customerDirectSmsFromSettings: boolean | null = null let accountingProviderFromSettings: AccountingProvider | null = null @@ -113,25 +117,15 @@ function isSwitchOn(value: string | number | boolean | undefined | null): boolea function normalizeAccountingProvider(value: string | undefined | null): AccountingProvider { const v = (value ?? '').trim().toLowerCase() - if (v === 'pargar' || v === 'tahesab' || v === 'zarin') return v + if (v === 'pargar' || v === 'tahesab' || v === 'zarin' || v === 'shayegan') return v return 'none' } +/** بورس مس: UI حسابداری همیشه شایگان — settings/legacy نادیده گرفته می‌شود. */ function resolveAccountingProviderFromRows( - list: Array<{ key?: string; value?: string | null }> + _list: Array<{ key?: string; value?: string | null }> ): AccountingProvider { - const row = list.find((item) => item.key === 'accounting_provider') - if (row?.value !== undefined && row?.value !== null && String(row.value).trim() !== '') { - return normalizeAccountingProvider(row.value) - } - - const pargarLegacy = list.find((item) => item.key === 'send_to_pargar') - if (pargarLegacy && isSwitchOn(pargarLegacy.value)) return 'pargar' - - const tahesabLegacy = list.find((item) => item.key === 'send_to_tahesab') - if (tahesabLegacy && isSwitchOn(tahesabLegacy.value)) return 'tahesab' - - return 'none' + return 'shayegan' } export function applyAccountingProviderFromRows( @@ -143,6 +137,7 @@ export function applyAccountingProviderFromRows( setTahesabEnabledFromSettings(provider === 'tahesab') setZarinEnabledFromSettings(provider === 'zarin') setPargarEnabledFromSettings(provider === 'pargar') + setShayeganEnabledFromSettings(provider === 'shayegan') } export function setStoreModeFromSettings(value: boolean): void { @@ -172,6 +167,11 @@ export function setPargarEnabledFromSettings(value: boolean): void { pargarEnabledSetting.value = value } +export function setShayeganEnabledFromSettings(value: boolean): void { + shayeganEnabledFromSettings = value + shayeganEnabledSetting.value = value +} + export function setCustomerDirectSmsEnabledFromSettings(value: boolean): void { customerDirectSmsFromSettings = value customerDirectSmsEnabledSetting.value = value @@ -491,6 +491,10 @@ export function isPargarEnabled(): boolean { return pargarEnabledFromSettings === true } +export function isShayeganEnabled(): boolean { + return shayeganEnabledFromSettings === true +} + export function getAccountingProvider(): AccountingProvider { return accountingProviderFromSettings ?? 'none' }