product modal changes
This commit is contained in:
@@ -27,6 +27,22 @@ export function isMeltedTradeGroup(groupType?: string | null) {
|
||||
return group === PRODUCT_CATEGORY_ABSHODE || group === LEGACY_GROUP_KATOD
|
||||
}
|
||||
|
||||
/** ادیتور قیمت آبشدهای — کاتد/آبشده یا معامله مقداری (trade_by_quantity) */
|
||||
export function usesMeltedPriceEditor(input?: {
|
||||
group_type?: string | null
|
||||
trade_by_quantity?: boolean | number | null
|
||||
} | null) {
|
||||
if (!input) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (isMeltedTradeGroup(input.group_type)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return input.trade_by_quantity === true || Number(input.trade_by_quantity) === 1
|
||||
}
|
||||
|
||||
export type MeltedPriceSource = 'app' | 'fixed' | 'reference'
|
||||
|
||||
export function resolveMeltedPriceSource(product?: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { last } from '@/model/price'
|
||||
import type { MethodePrices } from '@/model/product'
|
||||
import type { MeltedPriceSource } from '@/utils/productCategories'
|
||||
import { isMeltedTradeGroup } from '@/utils/productCategories'
|
||||
import { usesMeltedPriceEditor } from '@/utils/productCategories'
|
||||
|
||||
const GOLD_DOT_REFERENCE_NAME = 'گلد دات ای از آبشده - رسمی - نقد فردا'
|
||||
|
||||
@@ -105,7 +105,7 @@ export function computeProductEditorPricePreview(input: {
|
||||
appLastPrice?: (Partial<last> & { price?: number; last_historical?: number }) | null
|
||||
}): ProductEditorPricePreview {
|
||||
const offsetPercent = Number(input.form.price_offset_percent ?? 0)
|
||||
const melted = isMeltedTradeGroup(input.form.group_type)
|
||||
const melted = usesMeltedPriceEditor(input.form)
|
||||
|
||||
if (melted) {
|
||||
if (input.meltedPriceOption === 'fixed') {
|
||||
|
||||
Reference in New Issue
Block a user