fix
This commit is contained in:
parent
374aab6603
commit
2bc7d88227
3 changed files with 10 additions and 21 deletions
|
@ -28,7 +28,7 @@ const useStyles = makeStyles(
|
||||||
marginLeft: theme.spacing(2)
|
marginLeft: theme.spacing(2)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
{ name: "closeableInputWrapper" }
|
{ name: "DateVisibilitySelector" }
|
||||||
);
|
);
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
@ -189,12 +189,12 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
|
|
||||||
const getAvailabilityData = ({
|
const getAvailabilityData = ({
|
||||||
availableForPurchase,
|
availableForPurchase,
|
||||||
|
isAvailableForPurchase,
|
||||||
isPublished,
|
isPublished,
|
||||||
publicationDate
|
publicationDate
|
||||||
}: ProductUpdatePageFormData) => ({
|
}: ProductUpdatePageFormData) => ({
|
||||||
isAvailableForPurchase: !!availableForPurchase,
|
isAvailableForPurchase: isAvailableForPurchase || !!availableForPurchase,
|
||||||
isPublished: isPublished || !!publicationDate,
|
isPublished: isPublished || !!publicationDate
|
||||||
startDate: availableForPurchase || null
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const getStocksData = () => {
|
const getStocksData = () => {
|
||||||
|
|
|
@ -77,23 +77,12 @@ interface ProductAvailabilityArgs {
|
||||||
productId: string;
|
productId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getProductAvailabilityVariables({
|
export const getProductAvailabilityVariables = ({
|
||||||
isAvailableForPurchase,
|
isAvailableForPurchase,
|
||||||
availableForPurchase,
|
availableForPurchase,
|
||||||
productId
|
productId
|
||||||
}: ProductAvailabilityArgs) {
|
}: ProductAvailabilityArgs) => ({
|
||||||
const isAvailable =
|
isAvailable: isAvailableForPurchase,
|
||||||
availableForPurchase && !isAvailableForPurchase
|
|
||||||
? true
|
|
||||||
: isAvailableForPurchase;
|
|
||||||
|
|
||||||
return {
|
|
||||||
isAvailable,
|
|
||||||
productId,
|
productId,
|
||||||
startDate: isAvailableForPurchase
|
startDate: availableForPurchase
|
||||||
? null
|
});
|
||||||
: availableForPurchase !== ""
|
|
||||||
? availableForPurchase
|
|
||||||
: null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue