Update product variant creator
This commit is contained in:
parent
0a32479327
commit
43aeff8e68
14 changed files with 89 additions and 399 deletions
|
@ -28,7 +28,7 @@ import ProductVariantPrice from "../ProductVariantPrice";
|
|||
interface ProductVariantCreatePageFormData {
|
||||
costPrice: string;
|
||||
images: string[];
|
||||
priceOverride: string;
|
||||
price: string;
|
||||
quantity: string;
|
||||
sku: string;
|
||||
trackInventory: boolean;
|
||||
|
@ -83,7 +83,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
|||
const initialForm: ProductVariantCreatePageFormData = {
|
||||
costPrice: "",
|
||||
images: maybe(() => product.images.map(image => image.id)),
|
||||
priceOverride: "",
|
||||
price: "",
|
||||
quantity: "0",
|
||||
sku: "",
|
||||
trackInventory: true
|
||||
|
@ -130,7 +130,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
|||
<CardSpacer />
|
||||
<ProductVariantPrice
|
||||
errors={errors}
|
||||
priceOverride={data.priceOverride}
|
||||
price={data.price}
|
||||
currencySymbol={currencySymbol}
|
||||
costPrice={data.costPrice}
|
||||
loading={disabled}
|
||||
|
|
|
@ -203,7 +203,7 @@ const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps>
|
|||
error => error.index === variantIndex
|
||||
);
|
||||
const variantFormErrors = getFormErrors(
|
||||
["priceOverride", "quantity", "sku"],
|
||||
["price", "quantity", "sku"],
|
||||
variantErrors
|
||||
);
|
||||
|
||||
|
@ -234,9 +234,9 @@ const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps>
|
|||
endAdornment: currencySymbol
|
||||
}}
|
||||
className={classes.input}
|
||||
error={!!variantFormErrors.priceOverride}
|
||||
error={!!variantFormErrors.price}
|
||||
helperText={getBulkProductErrorMessage(
|
||||
variantFormErrors.priceOverride,
|
||||
variantFormErrors.price,
|
||||
intl
|
||||
)}
|
||||
inputProps={{
|
||||
|
@ -244,7 +244,7 @@ const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps>
|
|||
type: "number"
|
||||
}}
|
||||
fullWidth
|
||||
value={variant.priceOverride}
|
||||
value={variant.price}
|
||||
onChange={event =>
|
||||
onVariantDataChange(
|
||||
variantIndex,
|
||||
|
|
|
@ -87,7 +87,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -129,7 +129,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -171,7 +171,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -213,7 +213,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "49.99",
|
||||
"price": "49.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -255,7 +255,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -297,7 +297,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -339,7 +339,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -381,7 +381,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -499,7 +499,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -541,7 +541,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -583,7 +583,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -625,7 +625,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -667,7 +667,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -709,7 +709,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "24.99",
|
||||
"price": "24.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -751,7 +751,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -793,7 +793,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "26.99",
|
||||
"price": "26.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -930,7 +930,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -972,7 +972,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1014,7 +1014,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1056,7 +1056,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1098,7 +1098,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1140,7 +1140,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1182,7 +1182,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1224,7 +1224,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1328,7 +1328,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1370,7 +1370,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1412,7 +1412,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1454,7 +1454,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "45.99",
|
||||
"price": "45.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1496,7 +1496,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "51.99",
|
||||
"price": "51.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1538,7 +1538,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "51.99",
|
||||
"price": "51.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1580,7 +1580,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "51.99",
|
||||
"price": "51.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1622,7 +1622,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "51.99",
|
||||
"price": "51.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1717,7 +1717,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1759,7 +1759,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1801,7 +1801,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1843,7 +1843,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1885,7 +1885,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1927,7 +1927,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -1969,7 +1969,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2011,7 +2011,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2119,7 +2119,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2149,7 +2149,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2179,7 +2179,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2209,7 +2209,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2239,7 +2239,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2269,7 +2269,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2299,7 +2299,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
@ -2329,7 +2329,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "10.99",
|
||||
"price": "10.99",
|
||||
"sku": "",
|
||||
"stocks": Array [
|
||||
Object {
|
||||
|
|
|
@ -43,7 +43,7 @@ describe("Creates variant matrix", () => {
|
|||
);
|
||||
|
||||
variants.forEach(variant => {
|
||||
expect(variant.priceOverride).toBe(price);
|
||||
expect(variant.price).toBe(price);
|
||||
variant.stocks.forEach((_, stockIndex) => {
|
||||
expect(variant.stocks[stockIndex].quantity).toBe(stock[stockIndex]);
|
||||
});
|
||||
|
@ -98,7 +98,7 @@ describe("Creates variant matrix", () => {
|
|||
).values[0] === attributeValue
|
||||
)
|
||||
.forEach(variant => {
|
||||
expect(variant.priceOverride).toBe(
|
||||
expect(variant.price).toBe(
|
||||
(price * (attributeValueIndex + 1)).toString()
|
||||
);
|
||||
});
|
||||
|
@ -141,7 +141,7 @@ describe("Creates variant matrix", () => {
|
|||
);
|
||||
|
||||
variants.forEach(variant => {
|
||||
expect(variant.priceOverride).toBe(price);
|
||||
expect(variant.price).toBe(price);
|
||||
});
|
||||
|
||||
attribute.values.forEach((attributeValue, attributeValueIndex) => {
|
||||
|
@ -210,7 +210,7 @@ describe("Creates variant matrix", () => {
|
|||
).values[0] === attributeValue
|
||||
)
|
||||
.forEach(variant => {
|
||||
expect(variant.priceOverride).toBe(
|
||||
expect(variant.price).toBe(
|
||||
(price * (attributeValueIndex + 1)).toString()
|
||||
);
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ function createVariant(
|
|||
data: ProductVariantCreateFormData,
|
||||
attributes: CreateVariantInput
|
||||
): ProductVariantBulkCreateInput {
|
||||
const priceOverride = getValueFromMode(attributes, data.price, "0");
|
||||
const price = getValueFromMode(attributes, data.price, "0");
|
||||
const stocks = getValueFromMode(
|
||||
attributes,
|
||||
data.stock,
|
||||
|
@ -58,7 +58,7 @@ function createVariant(
|
|||
id: attribute.attributeId,
|
||||
values: [attribute.attributeValueSlug]
|
||||
})),
|
||||
priceOverride,
|
||||
price,
|
||||
sku: "",
|
||||
stocks: stocks.map((quantity, stockIndex) => ({
|
||||
quantity,
|
||||
|
|
|
@ -250,9 +250,9 @@ describe("Reducer is able to", () => {
|
|||
}
|
||||
]);
|
||||
|
||||
expect(state.variants[variantIndex].priceOverride).toBe(value);
|
||||
expect(state.variants[variantIndex - 1].priceOverride).toBe(
|
||||
fourthStep.variants[variantIndex - 1].priceOverride
|
||||
expect(state.variants[variantIndex].price).toBe(value);
|
||||
expect(state.variants[variantIndex - 1].price).toBe(
|
||||
fourthStep.variants[variantIndex - 1].price
|
||||
);
|
||||
expect(state).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
@ -301,7 +301,7 @@ function changeVariantData(
|
|||
...state.variants[variantIndex]
|
||||
};
|
||||
if (field === "price") {
|
||||
variant.priceOverride = value;
|
||||
variant.price = value;
|
||||
} else if (field === "sku") {
|
||||
variant.sku = value;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import ProductVariantPrice from "../ProductVariantPrice";
|
|||
|
||||
export interface ProductVariantPageFormData {
|
||||
costPrice: string;
|
||||
priceOverride: string;
|
||||
price: string;
|
||||
sku: string;
|
||||
trackInventory: boolean;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
|||
|
||||
const initialForm: ProductVariantPageFormData = {
|
||||
costPrice: maybe(() => variant.costPrice.amount.toString(), ""),
|
||||
priceOverride: maybe(() => variant.priceOverride.amount.toString(), ""),
|
||||
price: maybe(() => variant.price.amount.toString(), ""),
|
||||
sku: maybe(() => variant.sku, ""),
|
||||
trackInventory: variant?.trackInventory
|
||||
};
|
||||
|
@ -182,10 +182,10 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
|||
<CardSpacer />
|
||||
<ProductVariantPrice
|
||||
errors={errors}
|
||||
priceOverride={data.priceOverride}
|
||||
price={data.price}
|
||||
currencySymbol={
|
||||
variant && variant.priceOverride
|
||||
? variant.priceOverride.currency
|
||||
variant && variant.price
|
||||
? variant.price.currency
|
||||
: variant && variant.costPrice
|
||||
? variant.costPrice.currency
|
||||
: ""
|
||||
|
|
|
@ -21,7 +21,7 @@ const useStyles = makeStyles(
|
|||
|
||||
interface ProductVariantPriceProps {
|
||||
currencySymbol?: string;
|
||||
priceOverride?: string;
|
||||
price?: string;
|
||||
costPrice?: string;
|
||||
errors: ProductErrorFragment[];
|
||||
loading?: boolean;
|
||||
|
@ -29,14 +29,7 @@ interface ProductVariantPriceProps {
|
|||
}
|
||||
|
||||
const ProductVariantPrice: React.FC<ProductVariantPriceProps> = props => {
|
||||
const {
|
||||
currencySymbol,
|
||||
costPrice,
|
||||
errors,
|
||||
priceOverride,
|
||||
loading,
|
||||
onChange
|
||||
} = props;
|
||||
const { currencySymbol, costPrice, errors, price, loading, onChange } = props;
|
||||
|
||||
const classes = useStyles(props);
|
||||
const intl = useIntl();
|
||||
|
@ -56,7 +49,7 @@ const ProductVariantPrice: React.FC<ProductVariantPriceProps> = props => {
|
|||
<div>
|
||||
<PriceField
|
||||
error={!!formErrors.price_override}
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Selling price override"
|
||||
})}
|
||||
|
@ -65,10 +58,10 @@ const ProductVariantPrice: React.FC<ProductVariantPriceProps> = props => {
|
|||
intl.formatMessage({
|
||||
defaultMessage: "Optional",
|
||||
description: "optional field",
|
||||
id: "productVariantPriceOptionalPriceOverrideField"
|
||||
id: "productVariantPriceOptionalPriceField"
|
||||
})
|
||||
}
|
||||
value={priceOverride}
|
||||
value={price}
|
||||
currencySymbol={currencySymbol}
|
||||
onChange={onChange}
|
||||
disabled={loading}
|
||||
|
|
|
@ -327,8 +327,8 @@ export const ProductVariants: React.FC<ProductVariantsProps> = props => {
|
|||
<Hidden smDown>
|
||||
<TableCell className={classes.colPrice} data-tc="price">
|
||||
{variant ? (
|
||||
variant.priceOverride ? (
|
||||
<Money money={variant.priceOverride} />
|
||||
variant.price ? (
|
||||
<Money money={variant.price} />
|
||||
) : fallbackPrice ? (
|
||||
<Money money={fallbackPrice} />
|
||||
) : (
|
||||
|
|
|
@ -256,7 +256,7 @@ export const product: (
|
|||
],
|
||||
margin: 2,
|
||||
name: "Cordoba Oro",
|
||||
priceOverride: {
|
||||
price: {
|
||||
__typename: "Money",
|
||||
amount: 678.78,
|
||||
currency: "USD"
|
||||
|
@ -297,7 +297,7 @@ export const product: (
|
|||
],
|
||||
margin: 7,
|
||||
name: "silver",
|
||||
priceOverride: null,
|
||||
price: null,
|
||||
sku: "69055-15190",
|
||||
stocks: [
|
||||
{
|
||||
|
@ -1121,7 +1121,7 @@ export const variant = (placeholderImage: string): ProductVariant => ({
|
|||
}
|
||||
],
|
||||
name: "Extended Hard",
|
||||
priceOverride: {
|
||||
price: {
|
||||
__typename: "Money",
|
||||
amount: 100,
|
||||
currency: "USD"
|
||||
|
|
|
@ -155,7 +155,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
|||
})),
|
||||
costPrice: decimal(data.costPrice),
|
||||
id: variantId,
|
||||
priceOverride: decimal(data.priceOverride),
|
||||
price: decimal(data.price),
|
||||
removeStocks: data.removeStocks,
|
||||
sku: data.sku,
|
||||
stocks: data.updateStocks.map(
|
||||
|
|
|
@ -75,7 +75,7 @@ export const ProductVariant: React.FC<ProductVariantCreateProps> = ({
|
|||
values: [attribute.value]
|
||||
})),
|
||||
costPrice: decimal(formData.costPrice),
|
||||
priceOverride: decimal(formData.priceOverride),
|
||||
price: decimal(formData.price),
|
||||
product: productId,
|
||||
sku: formData.sku,
|
||||
stocks: formData.stocks.map(stock => ({
|
||||
|
|
|
@ -105754,109 +105754,6 @@ Ctrl + K"
|
|||
<div
|
||||
class="CardSpacer-spacer-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiPaper-root-id MuiPaper-elevation0-id MuiCard-root-id MuiPaper-rounded-id"
|
||||
>
|
||||
<div
|
||||
class="CardTitle-root-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id CardTitle-title-id MuiTypography-h5-id"
|
||||
>
|
||||
Pricing
|
||||
</span>
|
||||
<div
|
||||
class="CardTitle-toolbar-id"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="CardTitle-children-id"
|
||||
>
|
||||
<label
|
||||
class="MuiFormControlLabel-root-id MuiFormControlLabel-disabled-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id MuiButtonBase-disabled-id"
|
||||
disabled=""
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id Checkbox-disabled-id"
|
||||
disabled=""
|
||||
name="chargeTaxes"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiFormControlLabel-label-id MuiFormControlLabel-disabled-id MuiTypography-body1-id"
|
||||
>
|
||||
Charge taxes for this item
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<hr
|
||||
class="CardTitle-hr-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiCardContent-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductPricing-root-id"
|
||||
>
|
||||
<div
|
||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||
>
|
||||
<label
|
||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id MuiFormLabel-filled-id"
|
||||
data-shrink="true"
|
||||
>
|
||||
Price
|
||||
</label>
|
||||
<div
|
||||
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id MuiInputBase-adornedEnd-id MuiOutlinedInput-adornedEnd-id"
|
||||
>
|
||||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
disabled=""
|
||||
min="0"
|
||||
name="basePrice"
|
||||
type="number"
|
||||
value="0"
|
||||
/>
|
||||
<div
|
||||
class="MuiInputAdornment-root-id PriceField-currencySymbol-id MuiInputAdornment-positionEnd-id"
|
||||
>
|
||||
<div
|
||||
class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorTextSecondary-id"
|
||||
>
|
||||
USD
|
||||
</div>
|
||||
</div>
|
||||
<fieldset
|
||||
aria-hidden="true"
|
||||
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
|
||||
style="padding-left:8px"
|
||||
>
|
||||
<legend
|
||||
class="PrivateNotchedOutline-legend-id"
|
||||
style="width:0"
|
||||
>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="CardSpacer-spacer-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiPaper-root-id MuiPaper-elevation0-id MuiCard-root-id MuiPaper-rounded-id"
|
||||
>
|
||||
|
@ -106719,106 +106616,6 @@ Ctrl + K"
|
|||
<div
|
||||
class="CardSpacer-spacer-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiPaper-root-id MuiPaper-elevation0-id MuiCard-root-id MuiPaper-rounded-id"
|
||||
>
|
||||
<div
|
||||
class="CardTitle-root-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id CardTitle-title-id MuiTypography-h5-id"
|
||||
>
|
||||
Pricing
|
||||
</span>
|
||||
<div
|
||||
class="CardTitle-toolbar-id"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="CardTitle-children-id"
|
||||
>
|
||||
<label
|
||||
class="MuiFormControlLabel-root-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
name="chargeTaxes"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiFormControlLabel-label-id MuiTypography-body1-id"
|
||||
>
|
||||
Charge taxes for this item
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<hr
|
||||
class="CardTitle-hr-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiCardContent-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductPricing-root-id"
|
||||
>
|
||||
<div
|
||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||
>
|
||||
<label
|
||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||
data-shrink="true"
|
||||
>
|
||||
Price
|
||||
</label>
|
||||
<div
|
||||
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id MuiInputBase-adornedEnd-id MuiOutlinedInput-adornedEnd-id"
|
||||
>
|
||||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
min="0"
|
||||
name="basePrice"
|
||||
type="number"
|
||||
value="0"
|
||||
/>
|
||||
<div
|
||||
class="MuiInputAdornment-root-id PriceField-currencySymbol-id MuiInputAdornment-positionEnd-id"
|
||||
>
|
||||
<div
|
||||
class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorTextSecondary-id"
|
||||
>
|
||||
USD
|
||||
</div>
|
||||
</div>
|
||||
<fieldset
|
||||
aria-hidden="true"
|
||||
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
|
||||
style="padding-left:8px"
|
||||
>
|
||||
<legend
|
||||
class="PrivateNotchedOutline-legend-id"
|
||||
style="width:0"
|
||||
>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="CardSpacer-spacer-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiPaper-root-id MuiPaper-elevation0-id MuiCard-root-id MuiPaper-rounded-id"
|
||||
>
|
||||
|
@ -107680,106 +107477,6 @@ Ctrl + K"
|
|||
<div
|
||||
class="CardSpacer-spacer-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiPaper-root-id MuiPaper-elevation0-id MuiCard-root-id MuiPaper-rounded-id"
|
||||
>
|
||||
<div
|
||||
class="CardTitle-root-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id CardTitle-title-id MuiTypography-h5-id"
|
||||
>
|
||||
Pricing
|
||||
</span>
|
||||
<div
|
||||
class="CardTitle-toolbar-id"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="CardTitle-children-id"
|
||||
>
|
||||
<label
|
||||
class="MuiFormControlLabel-root-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
name="chargeTaxes"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiFormControlLabel-label-id MuiTypography-body1-id"
|
||||
>
|
||||
Charge taxes for this item
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<hr
|
||||
class="CardTitle-hr-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiCardContent-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductPricing-root-id"
|
||||
>
|
||||
<div
|
||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||
>
|
||||
<label
|
||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||
data-shrink="true"
|
||||
>
|
||||
Price
|
||||
</label>
|
||||
<div
|
||||
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id MuiInputBase-adornedEnd-id MuiOutlinedInput-adornedEnd-id"
|
||||
>
|
||||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
min="0"
|
||||
name="basePrice"
|
||||
type="number"
|
||||
value="0"
|
||||
/>
|
||||
<div
|
||||
class="MuiInputAdornment-root-id PriceField-currencySymbol-id MuiInputAdornment-positionEnd-id"
|
||||
>
|
||||
<div
|
||||
class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorTextSecondary-id"
|
||||
>
|
||||
USD
|
||||
</div>
|
||||
</div>
|
||||
<fieldset
|
||||
aria-hidden="true"
|
||||
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
|
||||
style="padding-left:8px"
|
||||
>
|
||||
<legend
|
||||
class="PrivateNotchedOutline-legend-id"
|
||||
style="width:0"
|
||||
>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="CardSpacer-spacer-id"
|
||||
/>
|
||||
<div
|
||||
class="MuiPaper-root-id MuiPaper-elevation0-id MuiCard-root-id MuiPaper-rounded-id"
|
||||
>
|
||||
|
@ -108490,7 +108187,7 @@ exports[`Storyshots Views / Products / Create product variant add first variant
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value=""
|
||||
/>
|
||||
|
@ -109084,7 +108781,7 @@ exports[`Storyshots Views / Products / Create product variant default 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value=""
|
||||
/>
|
||||
|
@ -109601,7 +109298,7 @@ exports[`Storyshots Views / Products / Create product variant when loading data
|
|||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
disabled=""
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value=""
|
||||
/>
|
||||
|
@ -110212,7 +109909,7 @@ exports[`Storyshots Views / Products / Create product variant with errors 1`] =
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value=""
|
||||
/>
|
||||
|
@ -129831,7 +129528,7 @@ exports[`Storyshots Views / Products / Product variant details attribute errors
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value="100"
|
||||
/>
|
||||
|
@ -130723,7 +130420,7 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value="100"
|
||||
/>
|
||||
|
@ -131396,7 +131093,7 @@ exports[`Storyshots Views / Products / Product variant details when loading data
|
|||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
disabled=""
|
||||
name="priceOverride"
|
||||
name="price"
|
||||
type="number"
|
||||
value=""
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue