Fix variant stock input
This commit is contained in:
parent
b5a4542d01
commit
f2e083dfa0
5 changed files with 7 additions and 7 deletions
|
@ -28,7 +28,7 @@ interface ProductVariantCreatePageFormData {
|
|||
costPrice: string;
|
||||
images: string[];
|
||||
priceOverride: string;
|
||||
quantity: number;
|
||||
quantity: string;
|
||||
sku: string;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
|||
costPrice: "",
|
||||
images: maybe(() => product.images.map(image => image.id)),
|
||||
priceOverride: "",
|
||||
quantity: 0,
|
||||
quantity: "0",
|
||||
sku: ""
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import ProductVariantStock from "../ProductVariantStock";
|
|||
export interface ProductVariantPageFormData {
|
||||
costPrice: string;
|
||||
priceOverride: string;
|
||||
quantity: number;
|
||||
quantity: string;
|
||||
sku: string;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
|||
const initialForm: ProductVariantPageFormData = {
|
||||
costPrice: maybe(() => variant.costPrice.amount.toString(), ""),
|
||||
priceOverride: maybe(() => variant.priceOverride.amount.toString(), ""),
|
||||
quantity: maybe(() => variant.quantity, 0),
|
||||
quantity: maybe(() => variant.quantity.toString(), "0"),
|
||||
sku: maybe(() => variant.sku, "")
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ interface ProductVariantStockProps {
|
|||
sku?: string;
|
||||
};
|
||||
sku: string;
|
||||
quantity: number;
|
||||
quantity: string;
|
||||
stockAllocated?: number;
|
||||
loading?: boolean;
|
||||
onChange(event: any);
|
||||
|
|
|
@ -127,7 +127,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
|||
costPrice: decimal(data.costPrice),
|
||||
id: variantId,
|
||||
priceOverride: decimal(data.priceOverride),
|
||||
quantity: data.quantity || null,
|
||||
quantity: parseInt(data.quantity, 0),
|
||||
sku: data.sku,
|
||||
trackInventory: true // FIXME: missing in UI
|
||||
});
|
||||
|
|
|
@ -66,7 +66,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({ productId }) => {
|
|||
costPrice: decimal(formData.costPrice),
|
||||
priceOverride: decimal(formData.priceOverride),
|
||||
product: productId,
|
||||
quantity: formData.quantity || null,
|
||||
quantity: parseInt(formData.quantity, 0),
|
||||
sku: formData.sku,
|
||||
trackInventory: true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue