Merge pull request #377 from mirumee/fix/variant-stock
Fix variant stock input
This commit is contained in:
commit
3fbaaf0783
6 changed files with 8 additions and 7 deletions
|
@ -25,6 +25,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
|||
- Unify dialog handling - #296 by @dominik-zeglen
|
||||
- Stop using deprecated fields - #357 by @dominik-zeglen
|
||||
- Throw error when API_URI is not set - #375 by @dominik-zeglen
|
||||
- Fix variant stock input - #377 by @dominik-zeglen
|
||||
|
||||
## 2.0.0
|
||||
|
||||
|
|
|
@ -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