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
|
- Unify dialog handling - #296 by @dominik-zeglen
|
||||||
- Stop using deprecated fields - #357 by @dominik-zeglen
|
- Stop using deprecated fields - #357 by @dominik-zeglen
|
||||||
- Throw error when API_URI is not set - #375 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
|
## 2.0.0
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ interface ProductVariantCreatePageFormData {
|
||||||
costPrice: string;
|
costPrice: string;
|
||||||
images: string[];
|
images: string[];
|
||||||
priceOverride: string;
|
priceOverride: string;
|
||||||
quantity: number;
|
quantity: string;
|
||||||
sku: string;
|
sku: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
||||||
costPrice: "",
|
costPrice: "",
|
||||||
images: maybe(() => product.images.map(image => image.id)),
|
images: maybe(() => product.images.map(image => image.id)),
|
||||||
priceOverride: "",
|
priceOverride: "",
|
||||||
quantity: 0,
|
quantity: "0",
|
||||||
sku: ""
|
sku: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import ProductVariantStock from "../ProductVariantStock";
|
||||||
export interface ProductVariantPageFormData {
|
export interface ProductVariantPageFormData {
|
||||||
costPrice: string;
|
costPrice: string;
|
||||||
priceOverride: string;
|
priceOverride: string;
|
||||||
quantity: number;
|
quantity: string;
|
||||||
sku: string;
|
sku: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
const initialForm: ProductVariantPageFormData = {
|
const initialForm: ProductVariantPageFormData = {
|
||||||
costPrice: maybe(() => variant.costPrice.amount.toString(), ""),
|
costPrice: maybe(() => variant.costPrice.amount.toString(), ""),
|
||||||
priceOverride: maybe(() => variant.priceOverride.amount.toString(), ""),
|
priceOverride: maybe(() => variant.priceOverride.amount.toString(), ""),
|
||||||
quantity: maybe(() => variant.quantity, 0),
|
quantity: maybe(() => variant.quantity.toString(), "0"),
|
||||||
sku: maybe(() => variant.sku, "")
|
sku: maybe(() => variant.sku, "")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ interface ProductVariantStockProps {
|
||||||
sku?: string;
|
sku?: string;
|
||||||
};
|
};
|
||||||
sku: string;
|
sku: string;
|
||||||
quantity: number;
|
quantity: string;
|
||||||
stockAllocated?: number;
|
stockAllocated?: number;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
onChange(event: any);
|
onChange(event: any);
|
||||||
|
|
|
@ -127,7 +127,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
costPrice: decimal(data.costPrice),
|
costPrice: decimal(data.costPrice),
|
||||||
id: variantId,
|
id: variantId,
|
||||||
priceOverride: decimal(data.priceOverride),
|
priceOverride: decimal(data.priceOverride),
|
||||||
quantity: data.quantity || null,
|
quantity: parseInt(data.quantity, 0),
|
||||||
sku: data.sku,
|
sku: data.sku,
|
||||||
trackInventory: true // FIXME: missing in UI
|
trackInventory: true // FIXME: missing in UI
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,7 +66,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({ productId }) => {
|
||||||
costPrice: decimal(formData.costPrice),
|
costPrice: decimal(formData.costPrice),
|
||||||
priceOverride: decimal(formData.priceOverride),
|
priceOverride: decimal(formData.priceOverride),
|
||||||
product: productId,
|
product: productId,
|
||||||
quantity: formData.quantity || null,
|
quantity: parseInt(formData.quantity, 0),
|
||||||
sku: formData.sku,
|
sku: formData.sku,
|
||||||
trackInventory: true
|
trackInventory: true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue