|
1
|
import { DataGridCellProps } from "../../../../../components/data-grid/types" |
|
2
|
import { getCustomShippingOptionPriceFieldName } from "../../utils/get-custom-shipping-option-price-field-info" |
|
3
|
import { useShippingOptionPrice } from "../shipping-option-price-provider" |
|
4
|
import { TieredPriceCell } from "../../../../../components/table/table-cells/common/tiered-price-cell/tiered-price-cell" |
|
5
|
|
|
6
|
interface ShippingOptionPriceCellProps<TData, TValue = any> |
|
7
|
extends DataGridCellProps<TData, TValue> { |
|
8
|
code: string |
|
9
|
header: string |
|
10
|
type: "currency" | "region" |
|
11
|
} |
|
12
|
|
|
13
|
export const ShippingOptionPriceCell = <TData, TValue = any>({ |
|
14
|
context, |
|
15
|
code, |
|
16
|
header, |
|
17
|
type, |
|
18
|
}: ShippingOptionPriceCellProps<TData, TValue>) => { |
|
19
|
const { onOpenConditionalPricesModal } = useShippingOptionPrice() |
|
20
|
|
|
21
|
return ( |
|
22
|
<TieredPriceCell |
|
23
|
context={context} |
|
24
|
code={code} |
|
25
|
getTieredFieldName={(field) => |
|
26
|
getCustomShippingOptionPriceFieldName(field, type) |
|
27
|
} |
|
28
|
onOpenModal={(field, currency) => |
|
29
|
onOpenConditionalPricesModal({ |
|
30
|
type, |
|
31
|
field, |
|
32
|
currency, |
|
33
|
name: header, |
|
34
|
}) |
|
35
|
} |
|
36
|
/> |
|
37
|
) |
|
38
|
} |