Allow product variant to be set as default (#721)
* Add drag-and-drop to allow variants reordering * Handle variants reordering * Allow product variant to be set as default * Display default variant and perform refresing after set * Move ProductVariantSetDefault to separate component * Changes to new schema Co-authored-by: Dawid Tarasiuk <tarasiukdawid@gmail.com>
This commit is contained in:
parent
4da205bb24
commit
4cecf238d6
26 changed files with 868 additions and 7 deletions
|
@ -43,6 +43,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
||||||
- Fix return to previous page on screen size change - #710 by @orzechdev
|
- Fix return to previous page on screen size change - #710 by @orzechdev
|
||||||
- Add variants reordering possibility - #716 by @orzechdev
|
- Add variants reordering possibility - #716 by @orzechdev
|
||||||
- Fix avatar change button - #719 by @orzechdev
|
- Fix avatar change button - #719 by @orzechdev
|
||||||
|
- Allow product variant to be set as default - #721 by @tomaszszymanski129
|
||||||
- Change plural form of "informations" to "information" strings across the app #722 by @mmarkusik
|
- Change plural form of "informations" to "information" strings across the app #722 by @mmarkusik
|
||||||
- Fix misaligned rich text draft controls - #725 by @orzechdev
|
- Fix misaligned rich text draft controls - #725 by @orzechdev
|
||||||
|
|
||||||
|
|
|
@ -2733,6 +2733,9 @@
|
||||||
"src_dot_home_dot_components_dot_HomeActivityCard_dot_placed": {
|
"src_dot_home_dot_components_dot_HomeActivityCard_dot_placed": {
|
||||||
"string": "Order #{orderId} was placed"
|
"string": "Order #{orderId} was placed"
|
||||||
},
|
},
|
||||||
|
"src_dot_hooks_dot_3382262667": {
|
||||||
|
"string": "Variant {name} has been set as default."
|
||||||
|
},
|
||||||
"src_dot_lastName": {
|
"src_dot_lastName": {
|
||||||
"string": "Last Name"
|
"string": "Last Name"
|
||||||
},
|
},
|
||||||
|
@ -4521,6 +4524,10 @@
|
||||||
"src_dot_products_dot_components_dot_ProductVariantPrice_dot_819659341": {
|
"src_dot_products_dot_components_dot_ProductVariantPrice_dot_819659341": {
|
||||||
"string": "Cost price"
|
"string": "Cost price"
|
||||||
},
|
},
|
||||||
|
"src_dot_products_dot_components_dot_ProductVariantSetDefault_dot_3683859003": {
|
||||||
|
"context": "set variant as default, button",
|
||||||
|
"string": "Set as default"
|
||||||
|
},
|
||||||
"src_dot_products_dot_components_dot_ProductVariants_dot_1001303107": {
|
"src_dot_products_dot_components_dot_ProductVariants_dot_1001303107": {
|
||||||
"context": "product variant inventory",
|
"context": "product variant inventory",
|
||||||
"string": "Unavailable in all locations"
|
"string": "Unavailable in all locations"
|
||||||
|
@ -4529,6 +4536,10 @@
|
||||||
"context": "product variant inventory",
|
"context": "product variant inventory",
|
||||||
"string": "Unavailable"
|
"string": "Unavailable"
|
||||||
},
|
},
|
||||||
|
"src_dot_products_dot_components_dot_ProductVariants_dot_1120495519": {
|
||||||
|
"context": "default variant label",
|
||||||
|
"string": "default"
|
||||||
|
},
|
||||||
"src_dot_products_dot_components_dot_ProductVariants_dot_1134347598": {
|
"src_dot_products_dot_components_dot_ProductVariants_dot_1134347598": {
|
||||||
"context": "product variant price",
|
"context": "product variant price",
|
||||||
"string": "Price"
|
"string": "Price"
|
||||||
|
|
|
@ -2666,6 +2666,7 @@ type Mutation {
|
||||||
productVariantStocksDelete(variantId: ID!, warehouseIds: [ID!]): ProductVariantStocksDelete
|
productVariantStocksDelete(variantId: ID!, warehouseIds: [ID!]): ProductVariantStocksDelete
|
||||||
productVariantStocksUpdate(stocks: [StockInput!]!, variantId: ID!): ProductVariantStocksUpdate
|
productVariantStocksUpdate(stocks: [StockInput!]!, variantId: ID!): ProductVariantStocksUpdate
|
||||||
productVariantUpdate(id: ID!, input: ProductVariantInput!): ProductVariantUpdate
|
productVariantUpdate(id: ID!, input: ProductVariantInput!): ProductVariantUpdate
|
||||||
|
productVariantSetDefault(productId: ID!, variantId: ID!): ProductVariantSetDefault
|
||||||
productVariantTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): ProductVariantTranslate
|
productVariantTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): ProductVariantTranslate
|
||||||
productVariantUpdateMetadata(id: ID!, input: MetaInput!): ProductVariantUpdateMeta @deprecated(reason: "Use the `updateMetadata` mutation instead. This field will be removed after 2020-07-31.")
|
productVariantUpdateMetadata(id: ID!, input: MetaInput!): ProductVariantUpdateMeta @deprecated(reason: "Use the `updateMetadata` mutation instead. This field will be removed after 2020-07-31.")
|
||||||
productVariantClearMetadata(id: ID!, input: MetaPath!): ProductVariantClearMeta @deprecated(reason: "Use the `deleteMetadata` mutation instead. This field will be removed after 2020-07-31.")
|
productVariantClearMetadata(id: ID!, input: MetaPath!): ProductVariantClearMeta @deprecated(reason: "Use the `deleteMetadata` mutation instead. This field will be removed after 2020-07-31.")
|
||||||
|
@ -3641,6 +3642,7 @@ type Product implements Node & ObjectWithMetadata {
|
||||||
weight: Weight
|
weight: Weight
|
||||||
availableForPurchase: Date
|
availableForPurchase: Date
|
||||||
visibleInListings: Boolean!
|
visibleInListings: Boolean!
|
||||||
|
defaultVariant: ProductVariant
|
||||||
privateMetadata: [MetadataItem]!
|
privateMetadata: [MetadataItem]!
|
||||||
metadata: [MetadataItem]!
|
metadata: [MetadataItem]!
|
||||||
privateMeta: [MetaStore]! @deprecated(reason: "Use the `privetaMetadata` field. This field will be removed after 2020-07-31.")
|
privateMeta: [MetaStore]! @deprecated(reason: "Use the `privetaMetadata` field. This field will be removed after 2020-07-31.")
|
||||||
|
@ -4182,6 +4184,12 @@ type ProductVariantReorder {
|
||||||
productErrors: [ProductError!]!
|
productErrors: [ProductError!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProductVariantSetDefault {
|
||||||
|
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
|
||||||
|
product: Product
|
||||||
|
productErrors: [ProductError!]!
|
||||||
|
}
|
||||||
|
|
||||||
type ProductVariantStocksCreate {
|
type ProductVariantStocksCreate {
|
||||||
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
|
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
|
||||||
productVariant: ProductVariant
|
productVariant: ProductVariant
|
||||||
|
|
|
@ -114,6 +114,9 @@ export const productFragmentDetails = gql`
|
||||||
descriptionJson
|
descriptionJson
|
||||||
seoTitle
|
seoTitle
|
||||||
seoDescription
|
seoDescription
|
||||||
|
defaultVariant {
|
||||||
|
id
|
||||||
|
}
|
||||||
category {
|
category {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
|
|
@ -105,6 +105,11 @@ export interface Product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Product_category {
|
export interface Product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -198,6 +203,7 @@ export interface Product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: Product_defaultVariant | null;
|
||||||
category: Product_category | null;
|
category: Product_category | null;
|
||||||
collections: (Product_collections | null)[] | null;
|
collections: (Product_collections | null)[] | null;
|
||||||
margin: Product_margin | null;
|
margin: Product_margin | null;
|
||||||
|
|
55
src/hooks/useOnSetDefaultVariant.ts
Normal file
55
src/hooks/useOnSetDefaultVariant.ts
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
import useNotifier from "@saleor/hooks/useNotifier";
|
||||||
|
import { useProductVariantSetDefaultMutation } from "@saleor/products/mutations";
|
||||||
|
import { getProductErrorMessage } from "@saleor/utils/errors";
|
||||||
|
import { useIntl } from "react-intl";
|
||||||
|
|
||||||
|
import { ProductDetails_product_variants } from "../products/types/ProductDetails";
|
||||||
|
import { VariantUpdate_productVariantUpdate_productVariant } from "../products/types/VariantUpdate";
|
||||||
|
|
||||||
|
function useOnSetDefaultVariant(
|
||||||
|
productId: string,
|
||||||
|
variant:
|
||||||
|
| ProductDetails_product_variants
|
||||||
|
| VariantUpdate_productVariantUpdate_productVariant
|
||||||
|
) {
|
||||||
|
const notify = useNotifier();
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
|
const [productVariantSetDefault] = useProductVariantSetDefaultMutation({
|
||||||
|
onCompleted: data => {
|
||||||
|
const errors = data.productVariantSetDefault.errors;
|
||||||
|
if (errors.length) {
|
||||||
|
errors.map(error =>
|
||||||
|
notify({
|
||||||
|
status: "error",
|
||||||
|
text: getProductErrorMessage(error, intl)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (variant) {
|
||||||
|
notify({
|
||||||
|
status: "success",
|
||||||
|
text: intl.formatMessage(
|
||||||
|
{
|
||||||
|
defaultMessage: "Variant {name} has been set as default."
|
||||||
|
},
|
||||||
|
{ name: variant.name }
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSetDefaultVariant = (selectedVariant = null) => {
|
||||||
|
productVariantSetDefault({
|
||||||
|
variables: {
|
||||||
|
productId,
|
||||||
|
variantId: variant ? variant.id : selectedVariant.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return onSetDefaultVariant;
|
||||||
|
}
|
||||||
|
export default useOnSetDefaultVariant;
|
|
@ -83,6 +83,7 @@ export interface ProductUpdatePageProps extends ListActions {
|
||||||
onSeoClick?();
|
onSeoClick?();
|
||||||
onSubmit?(data: ProductUpdatePageSubmitData);
|
onSubmit?(data: ProductUpdatePageSubmitData);
|
||||||
onVariantAdd?();
|
onVariantAdd?();
|
||||||
|
onSetDefaultVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductUpdatePageSubmitData extends ProductUpdatePageFormData {
|
export interface ProductUpdatePageSubmitData extends ProductUpdatePageFormData {
|
||||||
|
@ -120,6 +121,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
onSubmit,
|
onSubmit,
|
||||||
onVariantAdd,
|
onVariantAdd,
|
||||||
onVariantsAdd,
|
onVariantsAdd,
|
||||||
|
onSetDefaultVariant,
|
||||||
onVariantShow,
|
onVariantShow,
|
||||||
onVariantReorder,
|
onVariantReorder,
|
||||||
isChecked,
|
isChecked,
|
||||||
|
@ -296,6 +298,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
<ProductVariants
|
<ProductVariants
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
variants={variants}
|
variants={variants}
|
||||||
|
product={product}
|
||||||
fallbackPrice={
|
fallbackPrice={
|
||||||
product?.variants?.length
|
product?.variants?.length
|
||||||
? product.variants[0].price
|
? product.variants[0].price
|
||||||
|
@ -305,6 +308,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
onVariantAdd={onVariantAdd}
|
onVariantAdd={onVariantAdd}
|
||||||
onVariantsAdd={onVariantsAdd}
|
onVariantsAdd={onVariantsAdd}
|
||||||
onVariantReorder={onVariantReorder}
|
onVariantReorder={onVariantReorder}
|
||||||
|
onSetDefaultVariant={onSetDefaultVariant}
|
||||||
toolbar={toolbar}
|
toolbar={toolbar}
|
||||||
isChecked={isChecked}
|
isChecked={isChecked}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import ProductVariantImages from "../ProductVariantImages";
|
||||||
import ProductVariantImageSelectDialog from "../ProductVariantImageSelectDialog";
|
import ProductVariantImageSelectDialog from "../ProductVariantImageSelectDialog";
|
||||||
import ProductVariantNavigation from "../ProductVariantNavigation";
|
import ProductVariantNavigation from "../ProductVariantNavigation";
|
||||||
import ProductVariantPrice from "../ProductVariantPrice";
|
import ProductVariantPrice from "../ProductVariantPrice";
|
||||||
|
import ProductVariantSetDefault from "../ProductVariantSetDefault";
|
||||||
|
|
||||||
export interface ProductVariantPageFormData extends MetadataFormData {
|
export interface ProductVariantPageFormData extends MetadataFormData {
|
||||||
costPrice: string;
|
costPrice: string;
|
||||||
|
@ -68,6 +69,7 @@ interface ProductVariantPageProps {
|
||||||
onSubmit(data: ProductVariantPageSubmitData);
|
onSubmit(data: ProductVariantPageSubmitData);
|
||||||
onImageSelect(id: string);
|
onImageSelect(id: string);
|
||||||
onVariantClick(variantId: string);
|
onVariantClick(variantId: string);
|
||||||
|
onSetDefaultVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
|
@ -85,7 +87,8 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
onImageSelect,
|
onImageSelect,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
onVariantClick,
|
onVariantClick,
|
||||||
onVariantReorder
|
onVariantReorder,
|
||||||
|
onSetDefaultVariant
|
||||||
}) => {
|
}) => {
|
||||||
const attributeInput = React.useMemo(
|
const attributeInput = React.useMemo(
|
||||||
() => getAttributeInputFromVariant(variant),
|
() => getAttributeInputFromVariant(variant),
|
||||||
|
@ -165,7 +168,9 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
<AppHeader onBack={onBack}>
|
<AppHeader onBack={onBack}>
|
||||||
{maybe(() => variant.product.name)}
|
{maybe(() => variant.product.name)}
|
||||||
</AppHeader>
|
</AppHeader>
|
||||||
<PageHeader title={header} />
|
<PageHeader title={header}>
|
||||||
|
<ProductVariantSetDefault onSetDefaultVariant={onSetDefaultVariant} />
|
||||||
|
</PageHeader>
|
||||||
<Form initial={initialForm} onSubmit={handleSubmit} confirmLeave>
|
<Form initial={initialForm} onSubmit={handleSubmit} confirmLeave>
|
||||||
{({ change, data, hasChanged, submit, triggerChange }) => {
|
{({ change, data, hasChanged, submit, triggerChange }) => {
|
||||||
const handleAttributeChange: FormsetChange = (id, value) => {
|
const handleAttributeChange: FormsetChange = (id, value) => {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import CardMenu from "@saleor/components/CardMenu";
|
||||||
|
import React from "react";
|
||||||
|
import { useIntl } from "react-intl";
|
||||||
|
|
||||||
|
interface ProductVariantSetDefaultProps {
|
||||||
|
onSetDefaultVariant: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProductVariantSetDefault: React.FC<ProductVariantSetDefaultProps> = ({
|
||||||
|
onSetDefaultVariant
|
||||||
|
}) => {
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CardMenu
|
||||||
|
menuItems={[
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({
|
||||||
|
defaultMessage: "Set as default",
|
||||||
|
description: "set variant as default, button"
|
||||||
|
}),
|
||||||
|
onSelect: onSetDefaultVariant,
|
||||||
|
testId: "setDefault"
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
data-test="menu"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
ProductVariantSetDefault.displayName = "ProductVariantSetDefault";
|
||||||
|
export default ProductVariantSetDefault;
|
|
@ -0,0 +1,2 @@
|
||||||
|
export { default } from "./ProductVariantSetDefault";
|
||||||
|
export * from "./ProductVariantSetDefault";
|
|
@ -3,6 +3,7 @@ import Card from "@material-ui/core/Card";
|
||||||
import CardContent from "@material-ui/core/CardContent";
|
import CardContent from "@material-ui/core/CardContent";
|
||||||
import Hidden from "@material-ui/core/Hidden";
|
import Hidden from "@material-ui/core/Hidden";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
|
import { fade } from "@material-ui/core/styles/colorManipulator";
|
||||||
import TableCell from "@material-ui/core/TableCell";
|
import TableCell from "@material-ui/core/TableCell";
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
|
@ -24,9 +25,11 @@ import { FormattedMessage, IntlShape, useIntl } from "react-intl";
|
||||||
import { maybe, renderCollection } from "../../../misc";
|
import { maybe, renderCollection } from "../../../misc";
|
||||||
import { ListActions, ReorderAction } from "../../../types";
|
import { ListActions, ReorderAction } from "../../../types";
|
||||||
import {
|
import {
|
||||||
|
ProductDetails_product,
|
||||||
ProductDetails_product_variants,
|
ProductDetails_product_variants,
|
||||||
ProductDetails_product_variants_stocks_warehouse
|
ProductDetails_product_variants_stocks_warehouse
|
||||||
} from "../../types/ProductDetails";
|
} from "../../types/ProductDetails";
|
||||||
|
import ProductVariantSetDefault from "../ProductVariantSetDefault";
|
||||||
|
|
||||||
function getWarehouseChoices(
|
function getWarehouseChoices(
|
||||||
variants: ProductDetails_product_variants[],
|
variants: ProductDetails_product_variants[],
|
||||||
|
@ -66,8 +69,11 @@ function getWarehouseChoices(
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
theme => ({
|
theme => ({
|
||||||
[theme.breakpoints.up("lg")]: {
|
[theme.breakpoints.up("lg")]: {
|
||||||
|
colActions: {
|
||||||
|
width: 30
|
||||||
|
},
|
||||||
colInventory: {
|
colInventory: {
|
||||||
width: 300
|
width: 270
|
||||||
},
|
},
|
||||||
colName: {},
|
colName: {},
|
||||||
colPrice: {
|
colPrice: {
|
||||||
|
@ -86,10 +92,15 @@ const useStyles = makeStyles(
|
||||||
},
|
},
|
||||||
colSku: {},
|
colSku: {},
|
||||||
colStatus: {},
|
colStatus: {},
|
||||||
|
defaultVariant: {
|
||||||
|
color: fade(theme.palette.text.secondary, 0.6),
|
||||||
|
display: "block"
|
||||||
|
},
|
||||||
denseTable: {
|
denseTable: {
|
||||||
"& td, & th": {
|
"& td, & th": {
|
||||||
paddingRight: theme.spacing(3)
|
paddingRight: theme.spacing(3)
|
||||||
}
|
},
|
||||||
|
width: "auto"
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
cursor: "pointer"
|
cursor: "pointer"
|
||||||
|
@ -171,10 +182,12 @@ function getAvailabilityLabel(
|
||||||
|
|
||||||
interface ProductVariantsProps extends ListActions {
|
interface ProductVariantsProps extends ListActions {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
product: ProductDetails_product;
|
||||||
variants: ProductDetails_product_variants[];
|
variants: ProductDetails_product_variants[];
|
||||||
fallbackPrice?: ProductVariant_costPrice;
|
fallbackPrice?: ProductVariant_costPrice;
|
||||||
onVariantReorder: ReorderAction;
|
onVariantReorder: ReorderAction;
|
||||||
onRowClick: (id: string) => () => void;
|
onRowClick: (id: string) => () => void;
|
||||||
|
onSetDefaultVariant(variant: ProductDetails_product_variants);
|
||||||
onVariantAdd?();
|
onVariantAdd?();
|
||||||
onVariantsAdd?();
|
onVariantsAdd?();
|
||||||
}
|
}
|
||||||
|
@ -185,11 +198,13 @@ export const ProductVariants: React.FC<ProductVariantsProps> = props => {
|
||||||
const {
|
const {
|
||||||
disabled,
|
disabled,
|
||||||
variants,
|
variants,
|
||||||
|
product,
|
||||||
fallbackPrice,
|
fallbackPrice,
|
||||||
onRowClick,
|
onRowClick,
|
||||||
onVariantAdd,
|
onVariantAdd,
|
||||||
onVariantsAdd,
|
onVariantsAdd,
|
||||||
onVariantReorder,
|
onVariantReorder,
|
||||||
|
onSetDefaultVariant,
|
||||||
isChecked,
|
isChecked,
|
||||||
selected,
|
selected,
|
||||||
toggle,
|
toggle,
|
||||||
|
@ -295,10 +310,13 @@ export const ProductVariants: React.FC<ProductVariantsProps> = props => {
|
||||||
description="product variant inventory status"
|
description="product variant inventory status"
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell className={classes.colActions}></TableCell>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<SortableTableBody onSortEnd={onVariantReorder}>
|
<SortableTableBody onSortEnd={onVariantReorder}>
|
||||||
{renderCollection(variants, (variant, variantIndex) => {
|
{renderCollection(variants, (variant, variantIndex) => {
|
||||||
const isSelected = variant ? isChecked(variant.id) : false;
|
const isSelected = variant ? isChecked(variant.id) : false;
|
||||||
|
const isDefault =
|
||||||
|
variant && product?.defaultVariant?.id === variant?.id;
|
||||||
const numAvailable =
|
const numAvailable =
|
||||||
variant && variant.stocks
|
variant && variant.stocks
|
||||||
? variant.stocks.reduce(
|
? variant.stocks.reduce(
|
||||||
|
@ -326,6 +344,14 @@ export const ProductVariants: React.FC<ProductVariantsProps> = props => {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName} data-test="name">
|
<TableCell className={classes.colName} data-test="name">
|
||||||
{variant ? variant.name || variant.sku : <Skeleton />}
|
{variant ? variant.name || variant.sku : <Skeleton />}
|
||||||
|
{isDefault && (
|
||||||
|
<span className={classes.defaultVariant}>
|
||||||
|
{intl.formatMessage({
|
||||||
|
defaultMessage: "default",
|
||||||
|
description: "default variant label"
|
||||||
|
})}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colSku} data-test="sku">
|
<TableCell className={classes.colSku} data-test="sku">
|
||||||
{variant ? variant.sku : <Skeleton />}
|
{variant ? variant.sku : <Skeleton />}
|
||||||
|
@ -360,6 +386,15 @@ export const ProductVariants: React.FC<ProductVariantsProps> = props => {
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell
|
||||||
|
className={classes.colActions}
|
||||||
|
data-test="actions"
|
||||||
|
onClick={e => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<ProductVariantSetDefault
|
||||||
|
onSetDefaultVariant={() => onSetDefaultVariant(variant)}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
</SortableTableRow>
|
</SortableTableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -115,6 +115,7 @@ export const product: (
|
||||||
name: "Winter sale"
|
name: "Winter sale"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
defaultVariant: { __typename: "ProductVariant", id: "pv75934" },
|
||||||
descriptionJson: JSON.stringify(content),
|
descriptionJson: JSON.stringify(content),
|
||||||
id: "p10171",
|
id: "p10171",
|
||||||
images: [
|
images: [
|
||||||
|
|
|
@ -57,6 +57,10 @@ import {
|
||||||
ProductVariantReorder,
|
ProductVariantReorder,
|
||||||
ProductVariantReorderVariables
|
ProductVariantReorderVariables
|
||||||
} from "./types/ProductVariantReorder";
|
} from "./types/ProductVariantReorder";
|
||||||
|
import {
|
||||||
|
ProductVariantSetDefault,
|
||||||
|
ProductVariantSetDefaultVariables
|
||||||
|
} from "./types/ProductVariantSetDefault";
|
||||||
import {
|
import {
|
||||||
SimpleProductUpdate,
|
SimpleProductUpdate,
|
||||||
SimpleProductUpdateVariables
|
SimpleProductUpdateVariables
|
||||||
|
@ -134,6 +138,26 @@ export const useProductImagesReorder = makeMutation<
|
||||||
ProductImageReorderVariables
|
ProductImageReorderVariables
|
||||||
>(productImagesReorder);
|
>(productImagesReorder);
|
||||||
|
|
||||||
|
const productVariantSetDefault = gql`
|
||||||
|
${productErrorFragment}
|
||||||
|
${productFragmentDetails}
|
||||||
|
mutation ProductVariantSetDefault($productId: ID!, $variantId: ID!) {
|
||||||
|
productVariantSetDefault(productId: $productId, variantId: $variantId) {
|
||||||
|
errors: productErrors {
|
||||||
|
...ProductErrorFragment
|
||||||
|
}
|
||||||
|
product {
|
||||||
|
...Product
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const useProductVariantSetDefaultMutation = makeMutation<
|
||||||
|
ProductVariantSetDefault,
|
||||||
|
ProductVariantSetDefaultVariables
|
||||||
|
>(productVariantSetDefault);
|
||||||
|
|
||||||
export const productUpdateMutation = gql`
|
export const productUpdateMutation = gql`
|
||||||
${productErrorFragment}
|
${productErrorFragment}
|
||||||
${productFragmentDetails}
|
${productFragmentDetails}
|
||||||
|
|
|
@ -111,6 +111,11 @@ export interface ProductCreate_productCreate_product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductCreate_productCreate_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductCreate_productCreate_product_category {
|
export interface ProductCreate_productCreate_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -204,6 +209,7 @@ export interface ProductCreate_productCreate_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductCreate_productCreate_product_defaultVariant | null;
|
||||||
category: ProductCreate_productCreate_product_category | null;
|
category: ProductCreate_productCreate_product_category | null;
|
||||||
collections: (ProductCreate_productCreate_product_collections | null)[] | null;
|
collections: (ProductCreate_productCreate_product_collections | null)[] | null;
|
||||||
margin: ProductCreate_productCreate_product_margin | null;
|
margin: ProductCreate_productCreate_product_margin | null;
|
||||||
|
|
|
@ -105,6 +105,11 @@ export interface ProductDetails_product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductDetails_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductDetails_product_category {
|
export interface ProductDetails_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -198,6 +203,7 @@ export interface ProductDetails_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductDetails_product_defaultVariant | null;
|
||||||
category: ProductDetails_product_category | null;
|
category: ProductDetails_product_category | null;
|
||||||
collections: (ProductDetails_product_collections | null)[] | null;
|
collections: (ProductDetails_product_collections | null)[] | null;
|
||||||
margin: ProductDetails_product_margin | null;
|
margin: ProductDetails_product_margin | null;
|
||||||
|
|
|
@ -111,6 +111,11 @@ export interface ProductImageCreate_productImageCreate_product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductImageCreate_productImageCreate_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductImageCreate_productImageCreate_product_category {
|
export interface ProductImageCreate_productImageCreate_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -204,6 +209,7 @@ export interface ProductImageCreate_productImageCreate_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductImageCreate_productImageCreate_product_defaultVariant | null;
|
||||||
category: ProductImageCreate_productImageCreate_product_category | null;
|
category: ProductImageCreate_productImageCreate_product_category | null;
|
||||||
collections: (ProductImageCreate_productImageCreate_product_collections | null)[] | null;
|
collections: (ProductImageCreate_productImageCreate_product_collections | null)[] | null;
|
||||||
margin: ProductImageCreate_productImageCreate_product_margin | null;
|
margin: ProductImageCreate_productImageCreate_product_margin | null;
|
||||||
|
|
|
@ -111,6 +111,11 @@ export interface ProductImageUpdate_productImageUpdate_product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductImageUpdate_productImageUpdate_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductImageUpdate_productImageUpdate_product_category {
|
export interface ProductImageUpdate_productImageUpdate_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -204,6 +209,7 @@ export interface ProductImageUpdate_productImageUpdate_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductImageUpdate_productImageUpdate_product_defaultVariant | null;
|
||||||
category: ProductImageUpdate_productImageUpdate_product_category | null;
|
category: ProductImageUpdate_productImageUpdate_product_category | null;
|
||||||
collections: (ProductImageUpdate_productImageUpdate_product_collections | null)[] | null;
|
collections: (ProductImageUpdate_productImageUpdate_product_collections | null)[] | null;
|
||||||
margin: ProductImageUpdate_productImageUpdate_product_margin | null;
|
margin: ProductImageUpdate_productImageUpdate_product_margin | null;
|
||||||
|
|
|
@ -111,6 +111,11 @@ export interface ProductUpdate_productUpdate_product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductUpdate_productUpdate_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductUpdate_productUpdate_product_category {
|
export interface ProductUpdate_productUpdate_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -204,6 +209,7 @@ export interface ProductUpdate_productUpdate_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductUpdate_productUpdate_product_defaultVariant | null;
|
||||||
category: ProductUpdate_productUpdate_product_category | null;
|
category: ProductUpdate_productUpdate_product_category | null;
|
||||||
collections: (ProductUpdate_productUpdate_product_collections | null)[] | null;
|
collections: (ProductUpdate_productUpdate_product_collections | null)[] | null;
|
||||||
margin: ProductUpdate_productUpdate_product_margin | null;
|
margin: ProductUpdate_productUpdate_product_margin | null;
|
||||||
|
|
|
@ -111,6 +111,11 @@ export interface ProductVariantReorder_productVariantReorder_product_privateMeta
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantReorder_productVariantReorder_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductVariantReorder_productVariantReorder_product_category {
|
export interface ProductVariantReorder_productVariantReorder_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -204,6 +209,7 @@ export interface ProductVariantReorder_productVariantReorder_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductVariantReorder_productVariantReorder_product_defaultVariant | null;
|
||||||
category: ProductVariantReorder_productVariantReorder_product_category | null;
|
category: ProductVariantReorder_productVariantReorder_product_category | null;
|
||||||
collections: (ProductVariantReorder_productVariantReorder_product_collections | null)[] | null;
|
collections: (ProductVariantReorder_productVariantReorder_product_collections | null)[] | null;
|
||||||
margin: ProductVariantReorder_productVariantReorder_product_margin | null;
|
margin: ProductVariantReorder_productVariantReorder_product_margin | null;
|
||||||
|
|
242
src/products/types/ProductVariantSetDefault.ts
Normal file
242
src/products/types/ProductVariantSetDefault.ts
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { ProductErrorCode, AttributeInputTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL mutation operation: ProductVariantSetDefault
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_errors {
|
||||||
|
__typename: "ProductError";
|
||||||
|
code: ProductErrorCode;
|
||||||
|
field: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values {
|
||||||
|
__typename: "AttributeValue";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
slug: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute {
|
||||||
|
__typename: "Attribute";
|
||||||
|
id: string;
|
||||||
|
slug: string | null;
|
||||||
|
name: string | null;
|
||||||
|
inputType: AttributeInputTypeEnum | null;
|
||||||
|
valueRequired: boolean;
|
||||||
|
values: (ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values | null)[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_values {
|
||||||
|
__typename: "AttributeValue";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
slug: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes {
|
||||||
|
__typename: "SelectedAttribute";
|
||||||
|
attribute: ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute;
|
||||||
|
values: (ProductVariantSetDefault_productVariantSetDefault_product_attributes_values | null)[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes_values {
|
||||||
|
__typename: "AttributeValue";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
slug: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes {
|
||||||
|
__typename: "Attribute";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
values: (ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes_values | null)[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType {
|
||||||
|
__typename: "ProductType";
|
||||||
|
id: string;
|
||||||
|
variantAttributes: (ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes | null)[] | null;
|
||||||
|
name: string;
|
||||||
|
hasVariants: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_start_gross {
|
||||||
|
__typename: "Money";
|
||||||
|
amount: number;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_start {
|
||||||
|
__typename: "TaxedMoney";
|
||||||
|
gross: ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_start_gross;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_stop_gross {
|
||||||
|
__typename: "Money";
|
||||||
|
amount: number;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_stop {
|
||||||
|
__typename: "TaxedMoney";
|
||||||
|
gross: ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_stop_gross;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted {
|
||||||
|
__typename: "TaxedMoneyRange";
|
||||||
|
start: ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_start | null;
|
||||||
|
stop: ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted_stop | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_pricing {
|
||||||
|
__typename: "ProductPricingInfo";
|
||||||
|
priceRangeUndiscounted: ProductVariantSetDefault_productVariantSetDefault_product_pricing_priceRangeUndiscounted | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_metadata {
|
||||||
|
__typename: "MetadataItem";
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_privateMetadata {
|
||||||
|
__typename: "MetadataItem";
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_category {
|
||||||
|
__typename: "Category";
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_collections {
|
||||||
|
__typename: "Collection";
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_margin {
|
||||||
|
__typename: "Margin";
|
||||||
|
start: number | null;
|
||||||
|
stop: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_purchaseCost_start {
|
||||||
|
__typename: "Money";
|
||||||
|
amount: number;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_purchaseCost_stop {
|
||||||
|
__typename: "Money";
|
||||||
|
amount: number;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_purchaseCost {
|
||||||
|
__typename: "MoneyRange";
|
||||||
|
start: ProductVariantSetDefault_productVariantSetDefault_product_purchaseCost_start | null;
|
||||||
|
stop: ProductVariantSetDefault_productVariantSetDefault_product_purchaseCost_stop | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_images {
|
||||||
|
__typename: "ProductImage";
|
||||||
|
id: string;
|
||||||
|
alt: string;
|
||||||
|
sortOrder: number | null;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_price {
|
||||||
|
__typename: "Money";
|
||||||
|
amount: number;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks_warehouse {
|
||||||
|
__typename: "Warehouse";
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks {
|
||||||
|
__typename: "Stock";
|
||||||
|
id: string;
|
||||||
|
quantity: number;
|
||||||
|
quantityAllocated: number;
|
||||||
|
warehouse: ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks_warehouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
sku: string;
|
||||||
|
name: string;
|
||||||
|
price: ProductVariantSetDefault_productVariantSetDefault_product_variants_price | null;
|
||||||
|
margin: number | null;
|
||||||
|
stocks: (ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks | null)[] | null;
|
||||||
|
trackInventory: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: WeightUnitsEnum;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault_product {
|
||||||
|
__typename: "Product";
|
||||||
|
id: string;
|
||||||
|
attributes: ProductVariantSetDefault_productVariantSetDefault_product_attributes[];
|
||||||
|
productType: ProductVariantSetDefault_productVariantSetDefault_product_productType;
|
||||||
|
pricing: ProductVariantSetDefault_productVariantSetDefault_product_pricing | null;
|
||||||
|
metadata: (ProductVariantSetDefault_productVariantSetDefault_product_metadata | null)[];
|
||||||
|
privateMetadata: (ProductVariantSetDefault_productVariantSetDefault_product_privateMetadata | null)[];
|
||||||
|
name: string;
|
||||||
|
descriptionJson: any;
|
||||||
|
seoTitle: string | null;
|
||||||
|
seoDescription: string | null;
|
||||||
|
defaultVariant: ProductVariantSetDefault_productVariantSetDefault_product_defaultVariant | null;
|
||||||
|
category: ProductVariantSetDefault_productVariantSetDefault_product_category | null;
|
||||||
|
collections: (ProductVariantSetDefault_productVariantSetDefault_product_collections | null)[] | null;
|
||||||
|
margin: ProductVariantSetDefault_productVariantSetDefault_product_margin | null;
|
||||||
|
purchaseCost: ProductVariantSetDefault_productVariantSetDefault_product_purchaseCost | null;
|
||||||
|
isAvailableForPurchase: boolean | null;
|
||||||
|
isAvailable: boolean | null;
|
||||||
|
isPublished: boolean;
|
||||||
|
chargeTaxes: boolean;
|
||||||
|
publicationDate: any | null;
|
||||||
|
images: (ProductVariantSetDefault_productVariantSetDefault_product_images | null)[] | null;
|
||||||
|
variants: (ProductVariantSetDefault_productVariantSetDefault_product_variants | null)[] | null;
|
||||||
|
weight: ProductVariantSetDefault_productVariantSetDefault_product_weight | null;
|
||||||
|
availableForPurchase: any | null;
|
||||||
|
visibleInListings: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault_productVariantSetDefault {
|
||||||
|
__typename: "ProductVariantSetDefault";
|
||||||
|
errors: ProductVariantSetDefault_productVariantSetDefault_errors[];
|
||||||
|
product: ProductVariantSetDefault_productVariantSetDefault_product | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefault {
|
||||||
|
productVariantSetDefault: ProductVariantSetDefault_productVariantSetDefault | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantSetDefaultVariables {
|
||||||
|
productId: string;
|
||||||
|
variantId: string;
|
||||||
|
}
|
|
@ -111,6 +111,11 @@ export interface SimpleProductUpdate_productUpdate_product_privateMetadata {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productUpdate_product_defaultVariant {
|
||||||
|
__typename: "ProductVariant";
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productUpdate_product_category {
|
export interface SimpleProductUpdate_productUpdate_product_category {
|
||||||
__typename: "Category";
|
__typename: "Category";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -204,6 +209,7 @@ export interface SimpleProductUpdate_productUpdate_product {
|
||||||
descriptionJson: any;
|
descriptionJson: any;
|
||||||
seoTitle: string | null;
|
seoTitle: string | null;
|
||||||
seoDescription: string | null;
|
seoDescription: string | null;
|
||||||
|
defaultVariant: SimpleProductUpdate_productUpdate_product_defaultVariant | null;
|
||||||
category: SimpleProductUpdate_productUpdate_product_category | null;
|
category: SimpleProductUpdate_productUpdate_product_category | null;
|
||||||
collections: (SimpleProductUpdate_productUpdate_product_collections | null)[] | null;
|
collections: (SimpleProductUpdate_productUpdate_product_collections | null)[] | null;
|
||||||
margin: SimpleProductUpdate_productUpdate_product_margin | null;
|
margin: SimpleProductUpdate_productUpdate_product_margin | null;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config";
|
||||||
import useBulkActions from "@saleor/hooks/useBulkActions";
|
import useBulkActions from "@saleor/hooks/useBulkActions";
|
||||||
import useNavigator from "@saleor/hooks/useNavigator";
|
import useNavigator from "@saleor/hooks/useNavigator";
|
||||||
import useNotifier from "@saleor/hooks/useNotifier";
|
import useNotifier from "@saleor/hooks/useNotifier";
|
||||||
|
import useOnSetDefaultVariant from "@saleor/hooks/useOnSetDefaultVariant";
|
||||||
import useShop from "@saleor/hooks/useShop";
|
import useShop from "@saleor/hooks/useShop";
|
||||||
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
|
@ -272,6 +273,10 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
||||||
...maybe(() => updateProductOpts.data.productUpdate.errors, []),
|
...maybe(() => updateProductOpts.data.productUpdate.errors, []),
|
||||||
...maybe(() => updateSimpleProductOpts.data.productUpdate.errors, [])
|
...maybe(() => updateSimpleProductOpts.data.productUpdate.errors, [])
|
||||||
];
|
];
|
||||||
|
const onSetDefaultVariant = useOnSetDefaultVariant(
|
||||||
|
product ? product.id : null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -281,6 +286,7 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
||||||
collections={collections}
|
collections={collections}
|
||||||
defaultWeightUnit={shop?.defaultWeightUnit}
|
defaultWeightUnit={shop?.defaultWeightUnit}
|
||||||
disabled={disableFormSave}
|
disabled={disableFormSave}
|
||||||
|
onSetDefaultVariant={onSetDefaultVariant}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
fetchCategories={searchCategories}
|
fetchCategories={searchCategories}
|
||||||
fetchCollections={searchCollections}
|
fetchCollections={searchCollections}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import NotFoundPage from "@saleor/components/NotFoundPage";
|
||||||
import { WindowTitle } from "@saleor/components/WindowTitle";
|
import { WindowTitle } from "@saleor/components/WindowTitle";
|
||||||
import useNavigator from "@saleor/hooks/useNavigator";
|
import useNavigator from "@saleor/hooks/useNavigator";
|
||||||
import useNotifier from "@saleor/hooks/useNotifier";
|
import useNotifier from "@saleor/hooks/useNotifier";
|
||||||
|
import useOnSetDefaultVariant from "@saleor/hooks/useOnSetDefaultVariant";
|
||||||
import useShop from "@saleor/hooks/useShop";
|
import useShop from "@saleor/hooks/useShop";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
|
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
|
||||||
|
@ -127,6 +128,8 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
reorderProductVariantsOpts
|
reorderProductVariantsOpts
|
||||||
] = useProductVariantReorderMutation({});
|
] = useProductVariantReorderMutation({});
|
||||||
|
|
||||||
|
const onSetDefaultVariant = useOnSetDefaultVariant(productId, variant);
|
||||||
|
|
||||||
const handleVariantReorder = createVariantReorderHandler(
|
const handleVariantReorder = createVariantReorderHandler(
|
||||||
variant?.product,
|
variant?.product,
|
||||||
variables => reorderProductVariants({ variables })
|
variables => reorderProductVariants({ variables })
|
||||||
|
@ -199,6 +202,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
<ProductVariantPage
|
<ProductVariantPage
|
||||||
defaultWeightUnit={shop?.defaultWeightUnit}
|
defaultWeightUnit={shop?.defaultWeightUnit}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
|
onSetDefaultVariant={onSetDefaultVariant}
|
||||||
saveButtonBarState={updateVariantOpts.status}
|
saveButtonBarState={updateVariantOpts.status}
|
||||||
loading={disableFormSave}
|
loading={disableFormSave}
|
||||||
placeholderImage={placeholderImg}
|
placeholderImage={placeholderImg}
|
||||||
|
|
|
@ -144884,6 +144884,10 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
Inventory
|
Inventory
|
||||||
</th>
|
</th>
|
||||||
|
<th
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-head-id ProductVariants-colActions-id"
|
||||||
|
scope="col"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody
|
<tbody
|
||||||
|
@ -144968,6 +144972,11 @@ Ctrl + K"
|
||||||
data-test="name"
|
data-test="name"
|
||||||
>
|
>
|
||||||
Cordoba Oro
|
Cordoba Oro
|
||||||
|
<span
|
||||||
|
class="ProductVariants-defaultVariant-id"
|
||||||
|
>
|
||||||
|
default
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
||||||
|
@ -144981,6 +144990,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
3 available at 2 locations
|
3 available at 2 locations
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
||||||
|
@ -145074,6 +145115,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
11 available at 1 location
|
11 available at 1 location
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -146926,6 +146999,10 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
Inventory
|
Inventory
|
||||||
</th>
|
</th>
|
||||||
|
<th
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-head-id ProductVariants-colActions-id"
|
||||||
|
scope="col"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody
|
<tbody
|
||||||
|
@ -147010,6 +147087,11 @@ Ctrl + K"
|
||||||
data-test="name"
|
data-test="name"
|
||||||
>
|
>
|
||||||
Cordoba Oro
|
Cordoba Oro
|
||||||
|
<span
|
||||||
|
class="ProductVariants-defaultVariant-id"
|
||||||
|
>
|
||||||
|
default
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
||||||
|
@ -147023,6 +147105,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
3 available at 2 locations
|
3 available at 2 locations
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
||||||
|
@ -147116,6 +147230,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
11 available at 1 location
|
11 available at 1 location
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -154092,6 +154238,10 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
Inventory
|
Inventory
|
||||||
</th>
|
</th>
|
||||||
|
<th
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-head-id ProductVariants-colActions-id"
|
||||||
|
scope="col"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody
|
<tbody
|
||||||
|
@ -154176,6 +154326,11 @@ Ctrl + K"
|
||||||
data-test="name"
|
data-test="name"
|
||||||
>
|
>
|
||||||
Cordoba Oro
|
Cordoba Oro
|
||||||
|
<span
|
||||||
|
class="ProductVariants-defaultVariant-id"
|
||||||
|
>
|
||||||
|
default
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
||||||
|
@ -154189,6 +154344,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
3 available at 2 locations
|
3 available at 2 locations
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
||||||
|
@ -154282,6 +154469,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
11 available at 1 location
|
11 available at 1 location
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -157644,6 +157863,10 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
Inventory
|
Inventory
|
||||||
</th>
|
</th>
|
||||||
|
<th
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-head-id ProductVariants-colActions-id"
|
||||||
|
scope="col"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody
|
<tbody
|
||||||
|
@ -157728,6 +157951,11 @@ Ctrl + K"
|
||||||
data-test="name"
|
data-test="name"
|
||||||
>
|
>
|
||||||
Cordoba Oro
|
Cordoba Oro
|
||||||
|
<span
|
||||||
|
class="ProductVariants-defaultVariant-id"
|
||||||
|
>
|
||||||
|
default
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colSku-id"
|
||||||
|
@ -157741,6 +157969,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
3 available at 2 locations
|
3 available at 2 locations
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
class="MuiTableRow-root-id ProductVariants-link-id MuiTableRow-hover-id"
|
||||||
|
@ -157834,6 +158094,38 @@ Ctrl + K"
|
||||||
>
|
>
|
||||||
11 available at 1 location
|
11 available at 1 location
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root-id MuiTableCell-body-id ProductVariants-colActions-id"
|
||||||
|
data-test="actions"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -167837,7 +168129,35 @@ exports[`Storyshots Views / Products / Product variant details attribute errors
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="PageHeader-root-id"
|
class="PageHeader-root-id"
|
||||||
/>
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form>
|
<form>
|
||||||
|
@ -169271,7 +169591,35 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="PageHeader-root-id"
|
class="PageHeader-root-id"
|
||||||
/>
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form>
|
<form>
|
||||||
|
@ -170692,7 +171040,35 @@ exports[`Storyshots Views / Products / Product variant details when loading data
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="PageHeader-root-id"
|
class="PageHeader-root-id"
|
||||||
/>
|
>
|
||||||
|
<div
|
||||||
|
data-test="menu"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-label="More"
|
||||||
|
class="MuiButtonBase-root-id MuiIconButton-root-id CardMenu-iconButton-id MuiIconButton-colorPrimary-id"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiIconButton-label-id"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root-id"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form>
|
<form>
|
||||||
|
|
|
@ -32,6 +32,7 @@ const props: ProductUpdatePageProps = {
|
||||||
onDelete: () => undefined,
|
onDelete: () => undefined,
|
||||||
onImageDelete: () => undefined,
|
onImageDelete: () => undefined,
|
||||||
onImageUpload: () => undefined,
|
onImageUpload: () => undefined,
|
||||||
|
onSetDefaultVariant: () => undefined,
|
||||||
onSubmit: () => undefined,
|
onSubmit: () => undefined,
|
||||||
onVariantAdd: () => undefined,
|
onVariantAdd: () => undefined,
|
||||||
onVariantReorder: () => undefined,
|
onVariantReorder: () => undefined,
|
||||||
|
|
|
@ -21,6 +21,7 @@ storiesOf("Views / Products / Product variant details", module)
|
||||||
onAdd={() => undefined}
|
onAdd={() => undefined}
|
||||||
onBack={() => undefined}
|
onBack={() => undefined}
|
||||||
onDelete={undefined}
|
onDelete={undefined}
|
||||||
|
onSetDefaultVariant={() => undefined}
|
||||||
onImageSelect={() => undefined}
|
onImageSelect={() => undefined}
|
||||||
onSubmit={() => undefined}
|
onSubmit={() => undefined}
|
||||||
onVariantClick={() => undefined}
|
onVariantClick={() => undefined}
|
||||||
|
@ -39,6 +40,7 @@ storiesOf("Views / Products / Product variant details", module)
|
||||||
placeholderImage={placeholderImage}
|
placeholderImage={placeholderImage}
|
||||||
onAdd={() => undefined}
|
onAdd={() => undefined}
|
||||||
onDelete={undefined}
|
onDelete={undefined}
|
||||||
|
onSetDefaultVariant={() => undefined}
|
||||||
onImageSelect={() => undefined}
|
onImageSelect={() => undefined}
|
||||||
onSubmit={() => undefined}
|
onSubmit={() => undefined}
|
||||||
onVariantClick={() => undefined}
|
onVariantClick={() => undefined}
|
||||||
|
@ -55,6 +57,7 @@ storiesOf("Views / Products / Product variant details", module)
|
||||||
onAdd={() => undefined}
|
onAdd={() => undefined}
|
||||||
onBack={() => undefined}
|
onBack={() => undefined}
|
||||||
onDelete={undefined}
|
onDelete={undefined}
|
||||||
|
onSetDefaultVariant={() => undefined}
|
||||||
onImageSelect={() => undefined}
|
onImageSelect={() => undefined}
|
||||||
onSubmit={() => undefined}
|
onSubmit={() => undefined}
|
||||||
onVariantClick={() => undefined}
|
onVariantClick={() => undefined}
|
||||||
|
|
Loading…
Reference in a new issue