Files
nademitex_admin/src/utils/company.ts
T
2026-10-01 20:50:23 +03:30

19 lines
642 B
TypeScript

import type { Company } from '@/types'
/** هم‌تراز با slug شرکت دریافت‌کننده پرداخت در سرور */
export const PAYMENT_RECIPIENT_COMPANY_SLUG = 'nademitex'
export function productCompanyIdForForm(
companyId: string | undefined,
companyList: Company[],
): string {
const row = companyList.find((c) => c.id === companyId)
if (!row || row.slug === PAYMENT_RECIPIENT_COMPANY_SLUG) return ''
return companyId ?? ''
}
export function resolveProductCompanyPayload(formCompanyId: string): string | undefined {
const trimmed = formCompanyId.trim()
return trimmed.length > 0 ? trimmed : undefined
}