import CardTitle from "@dashboard/components/CardTitle"; import PreviewPill from "@dashboard/components/PreviewPill"; import RadioGroupField from "@dashboard/components/RadioGroupField"; import { AllocationStrategyEnum, StockSettingsInput } from "@dashboard/graphql"; import { Card, CardContent, Typography } from "@material-ui/core"; import HelpOutline from "@material-ui/icons/HelpOutline"; import { Tooltip } from "@saleor/macaw-ui/next"; import React from "react"; import { FormattedMessage } from "react-intl"; import { messages } from "./messages"; import { useStyles } from "./styles"; const strategyOptions = [ { title: messages.prioritizeBySortOrder, subtitle: messages.prioritizeBySortOrderDescription, type: AllocationStrategyEnum.PRIORITIZE_SORTING_ORDER, }, { title: messages.prioritizeByHighestStock, subtitle: messages.prioritizeByHighestStockDescription, type: AllocationStrategyEnum.PRIORITIZE_HIGH_STOCK, }, ]; interface ChannelAllocationStrategyProps { data?: StockSettingsInput; disabled: boolean; onChange: (event: React.ChangeEvent) => void; } const ChannelAllocationStrategy: React.FC = ({ data, disabled, onChange, }) => { const classes = useStyles(); return ( } />
} choices={strategyOptions.map(option => ({ label: (
{option.subtitle && ( )}
), value: option.type, }))} disabled={disabled} name="allocationStrategy" value={data?.allocationStrategy} onChange={onChange} />
); }; ChannelAllocationStrategy.displayName = "ChannelAllocationStrategy"; export default ChannelAllocationStrategy;