Update product update page
This commit is contained in:
parent
2d9385554b
commit
cdfac6de6b
2 changed files with 17 additions and 11 deletions
|
@ -159,7 +159,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
|
|
||||||
const categories = getChoices(categoryChoiceList);
|
const categories = getChoices(categoryChoiceList);
|
||||||
const collections = getChoices(collectionChoiceList);
|
const collections = getChoices(collectionChoiceList);
|
||||||
const currency = maybe(() => product.basePrice.currency);
|
const currency = maybe(() => product.variants[0].price.currency);
|
||||||
const hasVariants = maybe(() => product.productType.hasVariants, false);
|
const hasVariants = maybe(() => product.productType.hasVariants, false);
|
||||||
|
|
||||||
const handleSubmit = (data: ProductUpdatePageFormData) => {
|
const handleSubmit = (data: ProductUpdatePageFormData) => {
|
||||||
|
@ -246,19 +246,25 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<CardSpacer />
|
<CardSpacer />
|
||||||
<ProductPricing
|
{!!product?.productType && !hasVariants && (
|
||||||
currency={currency}
|
<>
|
||||||
data={data}
|
<ProductPricing
|
||||||
disabled={disabled}
|
currency={currency}
|
||||||
errors={errors}
|
data={data}
|
||||||
onChange={change}
|
disabled={disabled}
|
||||||
/>
|
errors={errors}
|
||||||
<CardSpacer />
|
onChange={change}
|
||||||
|
/>
|
||||||
|
<CardSpacer />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{hasVariants ? (
|
{hasVariants ? (
|
||||||
<ProductVariants
|
<ProductVariants
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
variants={variants}
|
variants={variants}
|
||||||
fallbackPrice={product ? product.basePrice : undefined}
|
fallbackPrice={
|
||||||
|
product ? product.variants[0].price : undefined
|
||||||
|
}
|
||||||
onRowClick={onVariantShow}
|
onRowClick={onVariantShow}
|
||||||
onVariantAdd={onVariantAdd}
|
onVariantAdd={onVariantAdd}
|
||||||
onVariantsAdd={onVariantsAdd}
|
onVariantsAdd={onVariantsAdd}
|
||||||
|
|
|
@ -188,7 +188,7 @@ export function getProductUpdatePageFormData(
|
||||||
variants: ProductDetails_product_variants[]
|
variants: ProductDetails_product_variants[]
|
||||||
): ProductUpdatePageFormData {
|
): ProductUpdatePageFormData {
|
||||||
return {
|
return {
|
||||||
basePrice: maybe(() => product.basePrice.amount, 0),
|
basePrice: maybe(() => product.variants[0].price.amount, 0),
|
||||||
category: maybe(() => product.category.id, ""),
|
category: maybe(() => product.category.id, ""),
|
||||||
chargeTaxes: maybe(() => product.chargeTaxes, false),
|
chargeTaxes: maybe(() => product.chargeTaxes, false),
|
||||||
collections: maybe(
|
collections: maybe(
|
||||||
|
|
Loading…
Reference in a new issue