From 9d6cc991033ce6129a50432df2d9acd9cc4d2708 Mon Sep 17 00:00:00 2001 From: mmarkusik Date: Tue, 20 Apr 2021 16:06:39 +0200 Subject: [PATCH] Merge pull request #1066 from mirumee/SALEOR-2547/update-adding-draft-order-products-per-channel (#1070) Update adding draft order products per channel --- locale/defaultMessages.json | 28 +- src/fragments/orders.ts | 1 + src/fragments/products.ts | 2 + src/fragments/types/OrderDetailsFragment.ts | 1 + src/fragments/types/ProductVariant.ts | 2 + .../OrderProductAddDialog.tsx | 2 +- src/orders/fixtures.ts | 2 + src/orders/queries.ts | 14 +- src/orders/types/FulfillOrder.ts | 1 + src/orders/types/OrderCancel.ts | 1 + src/orders/types/OrderCapture.ts | 1 + src/orders/types/OrderConfirm.ts | 1 + src/orders/types/OrderDetails.ts | 1 + src/orders/types/OrderDiscountAdd.ts | 1 + src/orders/types/OrderDiscountDelete.ts | 1 + src/orders/types/OrderDiscountUpdate.ts | 1 + src/orders/types/OrderDraftCancel.ts | 1 + src/orders/types/OrderDraftFinalize.ts | 1 + src/orders/types/OrderDraftUpdate.ts | 1 + src/orders/types/OrderFulfillmentCancel.ts | 1 + .../types/OrderFulfillmentRefundProducts.ts | 1 + .../types/OrderFulfillmentUpdateTracking.ts | 1 + src/orders/types/OrderLineDelete.ts | 1 + src/orders/types/OrderLineDiscountRemove.ts | 1 + src/orders/types/OrderLineDiscountUpdate.ts | 1 + src/orders/types/OrderLineUpdate.ts | 1 + src/orders/types/OrderLinesAdd.ts | 1 + src/orders/types/OrderMarkAsPaid.ts | 1 + src/orders/types/OrderRefund.ts | 1 + src/orders/types/OrderShippingMethodUpdate.ts | 1 + src/orders/types/OrderUpdate.ts | 1 + src/orders/types/OrderVoid.ts | 1 + src/orders/types/SearchOrderVariant.ts | 1 + .../OrderDetails/OrderDraftDetails/index.tsx | 2 +- .../OrderUnconfirmedDetails/index.tsx | 2 +- .../ProductVariantCreatePage.tsx | 18 +- .../ProductVariantCreatePage/form.tsx | 29 +- .../ProductVariantPage/ProductVariantPage.tsx | 3 + ...tailsChannelsAvailabilityCardContainer.tsx | 25 + .../index.tsx | 180 ++ .../components/ProductVariantPage/messages.ts | 26 + .../ProductVariantPrice.tsx | 40 +- src/products/fixtures.ts | 4 + .../ProductVariantChannelListingUpdate.ts | 2 + src/products/types/ProductVariantDetails.ts | 2 + src/products/types/SimpleProductUpdate.ts | 8 + src/products/types/VariantCreate.ts | 2 + src/products/types/VariantMediaAssign.ts | 2 + src/products/types/VariantMediaUnassign.ts | 2 + src/products/types/VariantUpdate.ts | 4 + src/products/views/ProductVariantCreate.tsx | 47 - .../__snapshots__/Stories.test.ts.snap | 2004 ++++------------- .../products/ProductVariantCreatePage.tsx | 5 - 53 files changed, 807 insertions(+), 1677 deletions(-) create mode 100644 src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx create mode 100644 src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx create mode 100644 src/products/components/ProductVariantPage/messages.ts diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 3c745ce77..7a6c4a9e3 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -3938,8 +3938,8 @@ "src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2850255786": { "string": "Search Products" }, - "src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_353369701": { - "string": "No products matching given query" + "src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_3284796469": { + "string": "No products available in order channel matching given query" }, "src_dot_orders_dot_components_dot_OrderProductsCardElements_dot_1134347598": { "context": "product price", @@ -5310,6 +5310,10 @@ "context": "button", "string": "Delete Variant" }, + "src_dot_products_dot_components_dot_ProductVariantCreatePage_dot_pricingCardSubtitle": { + "context": "variant pricing section subtitle", + "string": "There is no channel to define prices for. You need to first add variant to channels to define prices." + }, "src_dot_products_dot_components_dot_ProductVariantCreatePage_dot_saveVariant": { "context": "button", "string": "Save variant" @@ -5462,6 +5466,18 @@ "context": "variant name", "string": "New Variant" }, + "src_dot_products_dot_components_dot_ProductVariantPage_dot_itemSubtitleHidden": { + "context": "VariantDetailsChannelsAvailabilityCard item subtitle hidden", + "string": "Hidden" + }, + "src_dot_products_dot_components_dot_ProductVariantPage_dot_itemSubtitlePublished": { + "context": "VariantDetailsChannelsAvailabilityCard item subtitle published", + "string": "Published since {publicationDate}" + }, + "src_dot_products_dot_components_dot_ProductVariantPage_dot_noItemsAvailable": { + "context": "VariantDetailsChannelsAvailabilityCard no items available", + "string": "This variant is not available at any of the channels" + }, "src_dot_products_dot_components_dot_ProductVariantPage_dot_nonSelectionAttributes": { "context": "attributes, section header", "string": "Variant Attributes" @@ -5470,6 +5486,14 @@ "context": "attributes, section header", "string": "Variant Selection Attributes" }, + "src_dot_products_dot_components_dot_ProductVariantPage_dot_subtitle": { + "context": "VariantDetailsChannelsAvailabilityCard subtitle", + "string": "Available in {publishedInChannelsCount} out of {availableChannelsCount}" + }, + "src_dot_products_dot_components_dot_ProductVariantPage_dot_title": { + "context": "VariantDetailsChannelsAvailabilityCard title", + "string": "Availability" + }, "src_dot_products_dot_components_dot_ProductVariantPrice_dot_1099355007": { "context": "product pricing, section header", "string": "Pricing" diff --git a/src/fragments/orders.ts b/src/fragments/orders.ts index ec311b3b6..f29a72fbb 100644 --- a/src/fragments/orders.ts +++ b/src/fragments/orders.ts @@ -272,6 +272,7 @@ export const fragmentOrderDetails = gql` id name currencyCode + slug } isPaid } diff --git a/src/fragments/products.ts b/src/fragments/products.ts index e2434bdee..5fdff13da 100644 --- a/src/fragments/products.ts +++ b/src/fragments/products.ts @@ -298,6 +298,8 @@ export const fragmentVariant = gql` url } channelListings { + publicationDate + isPublished channel { id name diff --git a/src/fragments/types/OrderDetailsFragment.ts b/src/fragments/types/OrderDetailsFragment.ts index 479cf6f9e..84ab6e2d3 100644 --- a/src/fragments/types/OrderDetailsFragment.ts +++ b/src/fragments/types/OrderDetailsFragment.ts @@ -471,6 +471,7 @@ export interface OrderDetailsFragment_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDetailsFragment { diff --git a/src/fragments/types/ProductVariant.ts b/src/fragments/types/ProductVariant.ts index de5aee4b0..f04319242 100644 --- a/src/fragments/types/ProductVariant.ts +++ b/src/fragments/types/ProductVariant.ts @@ -189,6 +189,8 @@ export interface ProductVariant_product_channelListings_pricing { export interface ProductVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: ProductVariant_product_channelListings_channel; pricing: ProductVariant_product_channelListings_pricing | null; } diff --git a/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx b/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx index 9de4b629a..75f2b9188 100644 --- a/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx +++ b/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx @@ -363,7 +363,7 @@ const OrderProductAddDialog: React.FC = props => { () => ( - + ) diff --git a/src/orders/fixtures.ts b/src/orders/fixtures.ts index c377b2259..536ffee00 100644 --- a/src/orders/fixtures.ts +++ b/src/orders/fixtures.ts @@ -814,6 +814,7 @@ export const order = (placeholder: string): OrderDetails_order => ({ canFinalize: true, channel: { __typename: "Channel", + slug: "channel-default", currencyCode: "USD", id: "123454", isActive: true, @@ -1371,6 +1372,7 @@ export const draftOrder = (placeholder: string): OrderDetails_order => ({ canFinalize: true, channel: { __typename: "Channel", + slug: "channel-default", currencyCode: "USD", id: "123454", isActive: true, diff --git a/src/orders/queries.ts b/src/orders/queries.ts index a12a9cc5c..875837259 100644 --- a/src/orders/queries.ts +++ b/src/orders/queries.ts @@ -164,8 +164,18 @@ export const useOrderQuery = makeQuery( ); export const searchOrderVariant = gql` - query SearchOrderVariant($first: Int!, $query: String!, $after: String) { - search: products(first: $first, after: $after, filter: { search: $query }) { + query SearchOrderVariant( + $channel: String! + $first: Int! + $query: String! + $after: String + ) { + search: products( + first: $first + after: $after + filter: { search: $query } + channel: $channel + ) { edges { node { id diff --git a/src/orders/types/FulfillOrder.ts b/src/orders/types/FulfillOrder.ts index c2a16e3b0..87b809ca5 100644 --- a/src/orders/types/FulfillOrder.ts +++ b/src/orders/types/FulfillOrder.ts @@ -479,6 +479,7 @@ export interface FulfillOrder_orderFulfill_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface FulfillOrder_orderFulfill_order { diff --git a/src/orders/types/OrderCancel.ts b/src/orders/types/OrderCancel.ts index 8c88adaa4..6a97445c2 100644 --- a/src/orders/types/OrderCancel.ts +++ b/src/orders/types/OrderCancel.ts @@ -477,6 +477,7 @@ export interface OrderCancel_orderCancel_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderCancel_orderCancel_order { diff --git a/src/orders/types/OrderCapture.ts b/src/orders/types/OrderCapture.ts index d4736d912..9810c51d3 100644 --- a/src/orders/types/OrderCapture.ts +++ b/src/orders/types/OrderCapture.ts @@ -477,6 +477,7 @@ export interface OrderCapture_orderCapture_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderCapture_orderCapture_order { diff --git a/src/orders/types/OrderConfirm.ts b/src/orders/types/OrderConfirm.ts index a890c4bfa..552e90870 100644 --- a/src/orders/types/OrderConfirm.ts +++ b/src/orders/types/OrderConfirm.ts @@ -477,6 +477,7 @@ export interface OrderConfirm_orderConfirm_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderConfirm_orderConfirm_order { diff --git a/src/orders/types/OrderDetails.ts b/src/orders/types/OrderDetails.ts index 955a6692e..6fed0656d 100644 --- a/src/orders/types/OrderDetails.ts +++ b/src/orders/types/OrderDetails.ts @@ -471,6 +471,7 @@ export interface OrderDetails_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDetails_order { diff --git a/src/orders/types/OrderDiscountAdd.ts b/src/orders/types/OrderDiscountAdd.ts index b3b584c15..25484d190 100644 --- a/src/orders/types/OrderDiscountAdd.ts +++ b/src/orders/types/OrderDiscountAdd.ts @@ -477,6 +477,7 @@ export interface OrderDiscountAdd_orderDiscountAdd_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDiscountAdd_orderDiscountAdd_order { diff --git a/src/orders/types/OrderDiscountDelete.ts b/src/orders/types/OrderDiscountDelete.ts index 0b3441e1f..2d376fe21 100644 --- a/src/orders/types/OrderDiscountDelete.ts +++ b/src/orders/types/OrderDiscountDelete.ts @@ -477,6 +477,7 @@ export interface OrderDiscountDelete_orderDiscountDelete_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDiscountDelete_orderDiscountDelete_order { diff --git a/src/orders/types/OrderDiscountUpdate.ts b/src/orders/types/OrderDiscountUpdate.ts index 54fadd7b6..57f8ead60 100644 --- a/src/orders/types/OrderDiscountUpdate.ts +++ b/src/orders/types/OrderDiscountUpdate.ts @@ -477,6 +477,7 @@ export interface OrderDiscountUpdate_orderDiscountUpdate_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDiscountUpdate_orderDiscountUpdate_order { diff --git a/src/orders/types/OrderDraftCancel.ts b/src/orders/types/OrderDraftCancel.ts index 9c67008b0..9c1406746 100644 --- a/src/orders/types/OrderDraftCancel.ts +++ b/src/orders/types/OrderDraftCancel.ts @@ -477,6 +477,7 @@ export interface OrderDraftCancel_draftOrderDelete_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDraftCancel_draftOrderDelete_order { diff --git a/src/orders/types/OrderDraftFinalize.ts b/src/orders/types/OrderDraftFinalize.ts index d8dd2e8eb..6c5b5572f 100644 --- a/src/orders/types/OrderDraftFinalize.ts +++ b/src/orders/types/OrderDraftFinalize.ts @@ -477,6 +477,7 @@ export interface OrderDraftFinalize_draftOrderComplete_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDraftFinalize_draftOrderComplete_order { diff --git a/src/orders/types/OrderDraftUpdate.ts b/src/orders/types/OrderDraftUpdate.ts index 2e0a0ebb2..f42e63f11 100644 --- a/src/orders/types/OrderDraftUpdate.ts +++ b/src/orders/types/OrderDraftUpdate.ts @@ -477,6 +477,7 @@ export interface OrderDraftUpdate_draftOrderUpdate_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderDraftUpdate_draftOrderUpdate_order { diff --git a/src/orders/types/OrderFulfillmentCancel.ts b/src/orders/types/OrderFulfillmentCancel.ts index 3bf56c12e..cefd92a61 100644 --- a/src/orders/types/OrderFulfillmentCancel.ts +++ b/src/orders/types/OrderFulfillmentCancel.ts @@ -477,6 +477,7 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderFulfillmentCancel_orderFulfillmentCancel_order { diff --git a/src/orders/types/OrderFulfillmentRefundProducts.ts b/src/orders/types/OrderFulfillmentRefundProducts.ts index 415067102..76ce4d888 100644 --- a/src/orders/types/OrderFulfillmentRefundProducts.ts +++ b/src/orders/types/OrderFulfillmentRefundProducts.ts @@ -572,6 +572,7 @@ export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_o id: string; name: string; currencyCode: string; + slug: string; } export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order { diff --git a/src/orders/types/OrderFulfillmentUpdateTracking.ts b/src/orders/types/OrderFulfillmentUpdateTracking.ts index 8618288b3..b8d953d07 100644 --- a/src/orders/types/OrderFulfillmentUpdateTracking.ts +++ b/src/orders/types/OrderFulfillmentUpdateTracking.ts @@ -477,6 +477,7 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o id: string; name: string; currencyCode: string; + slug: string; } export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order { diff --git a/src/orders/types/OrderLineDelete.ts b/src/orders/types/OrderLineDelete.ts index 3dd1a30b1..5972f82f1 100644 --- a/src/orders/types/OrderLineDelete.ts +++ b/src/orders/types/OrderLineDelete.ts @@ -477,6 +477,7 @@ export interface OrderLineDelete_orderLineDelete_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderLineDelete_orderLineDelete_order { diff --git a/src/orders/types/OrderLineDiscountRemove.ts b/src/orders/types/OrderLineDiscountRemove.ts index 076ac5021..a6e3b6a38 100644 --- a/src/orders/types/OrderLineDiscountRemove.ts +++ b/src/orders/types/OrderLineDiscountRemove.ts @@ -477,6 +477,7 @@ export interface OrderLineDiscountRemove_orderLineDiscountRemove_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderLineDiscountRemove_orderLineDiscountRemove_order { diff --git a/src/orders/types/OrderLineDiscountUpdate.ts b/src/orders/types/OrderLineDiscountUpdate.ts index e06a7376c..dcf8b854f 100644 --- a/src/orders/types/OrderLineDiscountUpdate.ts +++ b/src/orders/types/OrderLineDiscountUpdate.ts @@ -477,6 +477,7 @@ export interface OrderLineDiscountUpdate_orderLineDiscountUpdate_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderLineDiscountUpdate_orderLineDiscountUpdate_order { diff --git a/src/orders/types/OrderLineUpdate.ts b/src/orders/types/OrderLineUpdate.ts index c9c8d9c62..3380cd129 100644 --- a/src/orders/types/OrderLineUpdate.ts +++ b/src/orders/types/OrderLineUpdate.ts @@ -477,6 +477,7 @@ export interface OrderLineUpdate_orderLineUpdate_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderLineUpdate_orderLineUpdate_order { diff --git a/src/orders/types/OrderLinesAdd.ts b/src/orders/types/OrderLinesAdd.ts index d9c8aee38..51c24092c 100644 --- a/src/orders/types/OrderLinesAdd.ts +++ b/src/orders/types/OrderLinesAdd.ts @@ -477,6 +477,7 @@ export interface OrderLinesAdd_orderLinesCreate_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderLinesAdd_orderLinesCreate_order { diff --git a/src/orders/types/OrderMarkAsPaid.ts b/src/orders/types/OrderMarkAsPaid.ts index 4627d3ee6..f112cb01f 100644 --- a/src/orders/types/OrderMarkAsPaid.ts +++ b/src/orders/types/OrderMarkAsPaid.ts @@ -477,6 +477,7 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderMarkAsPaid_orderMarkAsPaid_order { diff --git a/src/orders/types/OrderRefund.ts b/src/orders/types/OrderRefund.ts index 8b239f64b..33607eef3 100644 --- a/src/orders/types/OrderRefund.ts +++ b/src/orders/types/OrderRefund.ts @@ -477,6 +477,7 @@ export interface OrderRefund_orderRefund_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderRefund_orderRefund_order { diff --git a/src/orders/types/OrderShippingMethodUpdate.ts b/src/orders/types/OrderShippingMethodUpdate.ts index 0f54c6a38..0a1159940 100644 --- a/src/orders/types/OrderShippingMethodUpdate.ts +++ b/src/orders/types/OrderShippingMethodUpdate.ts @@ -485,6 +485,7 @@ export interface OrderShippingMethodUpdate_orderUpdateShipping_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderShippingMethodUpdate_orderUpdateShipping_order { diff --git a/src/orders/types/OrderUpdate.ts b/src/orders/types/OrderUpdate.ts index 54c7f9baa..1654899df 100644 --- a/src/orders/types/OrderUpdate.ts +++ b/src/orders/types/OrderUpdate.ts @@ -477,6 +477,7 @@ export interface OrderUpdate_orderUpdate_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderUpdate_orderUpdate_order { diff --git a/src/orders/types/OrderVoid.ts b/src/orders/types/OrderVoid.ts index fe695cbd9..c07551677 100644 --- a/src/orders/types/OrderVoid.ts +++ b/src/orders/types/OrderVoid.ts @@ -477,6 +477,7 @@ export interface OrderVoid_orderVoid_order_channel { id: string; name: string; currencyCode: string; + slug: string; } export interface OrderVoid_orderVoid_order { diff --git a/src/orders/types/SearchOrderVariant.ts b/src/orders/types/SearchOrderVariant.ts index 2cf401e04..1dd525eae 100644 --- a/src/orders/types/SearchOrderVariant.ts +++ b/src/orders/types/SearchOrderVariant.ts @@ -72,6 +72,7 @@ export interface SearchOrderVariant { } export interface SearchOrderVariantVariables { + channel: string; first: number; query: string; after?: string | null; diff --git a/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx b/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx index fcdcbed03..ba6ee033b 100644 --- a/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx +++ b/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx @@ -61,7 +61,7 @@ export const OrderDraftDetails: React.FC = ({ search: variantSearch, result: variantSearchOpts } = useOrderVariantSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: { ...DEFAULT_INITIAL_SEARCH_DATA, channel: order.channel.slug } }); const { diff --git a/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx b/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx index 3f9088d36..0b4e7767e 100644 --- a/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx +++ b/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx @@ -89,7 +89,7 @@ export const OrderUnconfirmedDetails: React.FC = ( search: variantSearch, result: variantSearchOpts } = useOrderVariantSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: { ...DEFAULT_INITIAL_SEARCH_DATA, channel: order.channel.slug } }); const warehouses = useWarehouseList({ displayLoader: true, diff --git a/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx index b8bb91f67..974238604 100644 --- a/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx +++ b/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx @@ -16,7 +16,6 @@ import Grid from "@saleor/components/Grid"; import Metadata from "@saleor/components/Metadata"; import PageHeader from "@saleor/components/PageHeader"; import SaveButtonBar from "@saleor/components/SaveButtonBar"; -import { ProductChannelListingErrorFragment } from "@saleor/fragments/types/ProductChannelListingErrorFragment"; import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts"; @@ -51,12 +50,16 @@ const messages = defineMessages({ saveVariant: { defaultMessage: "Save variant", description: "button" + }, + pricingCardSubtitle: { + defaultMessage: + "There is no channel to define prices for. You need to first add variant to channels to define prices.", + description: "variant pricing section subtitle" } }); interface ProductVariantCreatePageProps { channels: ChannelPriceData[]; - channelErrors: ProductChannelListingErrorFragment[] | undefined; disabled: boolean; errors: ProductErrorWithAttributesFragment[]; header: string; @@ -82,7 +85,6 @@ interface ProductVariantCreatePageProps { const ProductVariantCreatePage: React.FC = ({ channels, - channelErrors = [], disabled, errors, header, @@ -209,15 +211,7 @@ const ProductVariantCreatePage: React.FC = ({ /> ({ - ...channel.data, - ...channel.value - }) - )} - errors={channelErrors} - loading={disabled} - onChange={handlers.changeChannels} + disabledMessage={messages.pricingCardSubtitle} /> ; attributes: AttributeInput[]; attributesWithNewFileValue: FormsetData; stocks: ProductStockInput[]; @@ -58,10 +52,7 @@ export interface UseProductVariantCreateFormOpts { export interface ProductVariantCreateHandlers extends Record< - | "changeStock" - | "selectAttribute" - | "selectAttributeMultiple" - | "changeChannels", + "changeStock" | "selectAttribute" | "selectAttributeMultiple", FormsetChange >, Record<"selectAttributeReference", FormsetChange>, @@ -107,13 +98,11 @@ function useProductVariantCreateForm( const triggerChange = () => setChanged(true); const attributeInput = getVariantAttributeInputFromProduct(product); - const channelsInput = getChannelsInput(opts.currentChannels); const form = useForm(initial); const attributes = useFormset(attributeInput); const attributesWithNewFileValue = useFormset([]); const stocks = useFormset([]); - const channels = useFormset(channelsInput); const { makeChangeHandler: makeMetadataChangeHandler } = useMetadataChangeTrigger(); @@ -179,16 +168,6 @@ function useProductVariantCreateForm( triggerChange(); stocks.remove(id); }; - const handleChannelChange: FormsetChange = (id, value) => { - channels.change(id, value); - triggerChange(); - }; - - const disabled = channels?.data.some( - channelData => - validatePrice(channelData.value.price) || - validateCostPrice(channelData.value.costPrice) - ); const data: ProductVariantCreateData = { ...form.data, @@ -199,7 +178,6 @@ function useProductVariantCreateForm( opts.referenceProducts ), attributesWithNewFileValue: attributesWithNewFileValue.data, - channelListings: channels.data, stocks: stocks.data }; @@ -208,10 +186,9 @@ function useProductVariantCreateForm( return { change: handleChange, data, - disabled, + disabled: false, handlers: { addStock: handleStockAdd, - changeChannels: handleChannelChange, changeMetadata, changeStock: handleStockChange, deleteStock: handleStockDelete, diff --git a/src/products/components/ProductVariantPage/ProductVariantPage.tsx b/src/products/components/ProductVariantPage/ProductVariantPage.tsx index d77e9ff6e..a7b9eca65 100644 --- a/src/products/components/ProductVariantPage/ProductVariantPage.tsx +++ b/src/products/components/ProductVariantPage/ProductVariantPage.tsx @@ -41,6 +41,7 @@ import ProductVariantUpdateForm, { ProductVariantUpdateHandlers, ProductVariantUpdateSubmitData } from "./form"; +import VariantDetailsChannelsAvailabilityCard from "./VariantDetailsChannelsAvailabilityCard"; const messages = defineMessages({ nonSelectionAttributes: { @@ -217,6 +218,7 @@ const ProductVariantPage: React.FC = ({ />
+ = ({ /> ({ ...channel.data, diff --git a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx new file mode 100644 index 000000000..9e0fb7bd6 --- /dev/null +++ b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx @@ -0,0 +1,25 @@ +import { Card } from "@material-ui/core"; +import CardSpacer from "@saleor/components/CardSpacer"; +import CardTitle from "@saleor/components/CardTitle"; +import React from "react"; +import { FormattedMessage } from "react-intl"; + +import { variantDetailsChannelsAvailabilityCardMessages as messages } from "../messages"; + +interface VariantDetailsChannelsAvailabilityCardContainerProps { + children: React.ReactNode; +} + +const VariantDetailsChannelsAvailabilityCardContainer: React.FC = ({ + children +}) => ( + <> + + } /> + {children} + + + +); + +export default VariantDetailsChannelsAvailabilityCardContainer; diff --git a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx new file mode 100644 index 000000000..8d200f8fa --- /dev/null +++ b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx @@ -0,0 +1,180 @@ +import { + CardContent, + Divider, + ExpansionPanel, + ExpansionPanelSummary, + makeStyles, + Typography +} from "@material-ui/core"; +import Skeleton from "@saleor/components/Skeleton"; +import { ProductVariant } from "@saleor/fragments/types/ProductVariant"; +import useDateLocalize from "@saleor/hooks/useDateLocalize"; +import IconChevronDown from "@saleor/icons/ChevronDown"; +import React from "react"; +import { useIntl } from "react-intl"; + +import { variantDetailsChannelsAvailabilityCardMessages as messages } from "../messages"; +import CardContainer from "./VariantDetailsChannelsAvailabilityCardContainer"; + +const useExpanderStyles = makeStyles( + () => ({ + expanded: {}, + root: { + boxShadow: "none", + margin: 0, + padding: 0, + + "&:before": { + content: "none" + }, + + "&$expanded": { + margin: 0, + border: "none" + } + } + }), + { name: "VariantDetailsChannelsAvailabilityCardExpander" } +); + +const useSummaryStyles = makeStyles( + theme => ({ + expanded: {}, + root: { + width: "100%", + border: "none", + margin: 0, + padding: 0, + minHeight: 0, + paddingTop: theme.spacing(2), + paddingLeft: theme.spacing(3), + paddingRight: theme.spacing(5.5), + paddingBottom: theme.spacing(2), + + "&$expanded": { + minHeight: 0 + } + }, + content: { + margin: 0, + + "&$expanded": { + margin: 0 + } + } + }), + { name: "VariantDetailsChannelsAvailabilityCardExpanderSummary" } +); + +interface VariantDetailsChannelsAvailabilityCardProps { + variant: ProductVariant; +} + +const VariantDetailsChannelsAvailabilityCard: React.FC = ({ + variant +}) => { + const expanderClasses = useExpanderStyles({}); + const summaryClasses = useSummaryStyles({}); + const localizeDate = useDateLocalize(); + const intl = useIntl(); + + const getProductChannelListingByChannelId = (channelId: string) => + variant?.product.channelListings.find( + ({ channel }) => channel.id === channelId + ); + + const getItemSubtitle = (channelId: string) => { + const { + isPublished, + publicationDate + } = getProductChannelListingByChannelId(channelId); + + if (!isPublished) { + return intl.formatMessage(messages.itemSubtitleHidden); + } + + return intl.formatMessage(messages.itemSubtitlePublished, { + publicationDate: localizeDate(publicationDate) + }); + }; + + if (!variant) { + return ( + + + + + + ); + } + + const { channelListings } = variant; + + const isAvailableInAnyChannels = !!channelListings.length; + + const variantChannelListingsChannelsIds = channelListings.map( + ({ channel: { id } }) => id + ); + + const allAvailableChannelsListings = variant.product.channelListings.filter( + ({ channel }) => variantChannelListingsChannelsIds.includes(channel.id) + ); + + const publishedInChannelsListings = allAvailableChannelsListings.filter( + ({ isPublished }) => isPublished + ); + + if (!isAvailableInAnyChannels) { + return ( + + + + {intl.formatMessage(messages.noItemsAvailable)} + + + + ); + } + + return ( + + + } + classes={summaryClasses} + data-test-id="channels-variant-availability-summary" + > + <> + + {intl.formatMessage(messages.subtitle, { + publishedInChannelsCount: publishedInChannelsListings.length, + availableChannelsCount: allAvailableChannelsListings.length + })} + + + + + {channelListings.map(({ channel }) => ( + <> + + + + {channel.name} + + + {getItemSubtitle(channel.id)} + + + + ))} + + + ); +}; + +export default VariantDetailsChannelsAvailabilityCard; diff --git a/src/products/components/ProductVariantPage/messages.ts b/src/products/components/ProductVariantPage/messages.ts new file mode 100644 index 000000000..d5754d5c5 --- /dev/null +++ b/src/products/components/ProductVariantPage/messages.ts @@ -0,0 +1,26 @@ +import { defineMessages } from "react-intl"; + +export const variantDetailsChannelsAvailabilityCardMessages = defineMessages({ + title: { + defaultMessage: "Availability", + description: "VariantDetailsChannelsAvailabilityCard title" + }, + subtitle: { + defaultMessage: + "Available in {publishedInChannelsCount} out of {availableChannelsCount}", + description: "VariantDetailsChannelsAvailabilityCard subtitle" + }, + itemSubtitlePublished: { + defaultMessage: "Published since {publicationDate}", + description: + "VariantDetailsChannelsAvailabilityCard item subtitle published" + }, + itemSubtitleHidden: { + defaultMessage: "Hidden", + description: "VariantDetailsChannelsAvailabilityCard item subtitle hidden" + }, + noItemsAvailable: { + defaultMessage: "This variant is not available at any of the channels", + description: "VariantDetailsChannelsAvailabilityCard no items available" + } +}); diff --git a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx index ebeb16817..e04c0343b 100644 --- a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx +++ b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx @@ -21,7 +21,7 @@ import { } from "@saleor/utils/errors"; import getProductErrorMessage from "@saleor/utils/errors/product"; import React from "react"; -import { FormattedMessage, useIntl } from "react-intl"; +import { FormattedMessage, MessageDescriptor, useIntl } from "react-intl"; const useStyles = makeStyles( theme => ({ @@ -62,25 +62,53 @@ const useStyles = makeStyles( ); interface ProductVariantPriceProps { - ProductVariantChannelListings: ChannelData[]; - errors: ProductChannelListingErrorFragment[]; + ProductVariantChannelListings?: ChannelData[]; + errors?: ProductChannelListingErrorFragment[]; loading?: boolean; - onChange: (id: string, data: ChannelPriceArgs) => void; + disabled?: boolean; + onChange?: (id: string, data: ChannelPriceArgs) => void; + disabledMessage?: MessageDescriptor; } const numberOfColumns = 2; const ProductVariantPrice: React.FC = props => { const { + disabled = false, errors = [], - ProductVariantChannelListings, + ProductVariantChannelListings = [], loading, - onChange + onChange, + disabledMessage } = props; const classes = useStyles(props); const intl = useIntl(); const formErrors = getFormChannelErrors(["price", "costPrice"], errors); + if (disabled || !ProductVariantChannelListings.length) { + return ( + + + + + {intl.formatMessage( + disabledMessage || { + defaultMessage: "There is no channel to define prices for", + description: "variant pricing section subtitle", + id: "product variant pricing card disabled subtitle" + } + )} + + + + ); + } + return ( ({ channelListings: [ { __typename: "ProductChannelListing", + isPublished: false, + publicationDate: null, channel: { __typename: "Channel", currencyCode: "USD", @@ -2848,6 +2850,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ }, { __typename: "ProductChannelListing", + isPublished: true, + publicationDate: "2022-01-21", channel: { __typename: "Channel", currencyCode: "USD", diff --git a/src/products/types/ProductVariantChannelListingUpdate.ts b/src/products/types/ProductVariantChannelListingUpdate.ts index 34a8db684..1e52ad7ea 100644 --- a/src/products/types/ProductVariantChannelListingUpdate.ts +++ b/src/products/types/ProductVariantChannelListingUpdate.ts @@ -189,6 +189,8 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_channel; pricing: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_pricing | null; } diff --git a/src/products/types/ProductVariantDetails.ts b/src/products/types/ProductVariantDetails.ts index bae241e45..d2bd7b02f 100644 --- a/src/products/types/ProductVariantDetails.ts +++ b/src/products/types/ProductVariantDetails.ts @@ -189,6 +189,8 @@ export interface ProductVariantDetails_productVariant_product_channelListings_pr export interface ProductVariantDetails_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: ProductVariantDetails_productVariant_product_channelListings_channel; pricing: ProductVariantDetails_productVariant_product_channelListings_pricing | null; } diff --git a/src/products/types/SimpleProductUpdate.ts b/src/products/types/SimpleProductUpdate.ts index 36531d900..8fbfb2c4e 100644 --- a/src/products/types/SimpleProductUpdate.ts +++ b/src/products/types/SimpleProductUpdate.ts @@ -480,6 +480,8 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_product export interface SimpleProductUpdate_productVariantUpdate_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: SimpleProductUpdate_productVariantUpdate_productVariant_product_channelListings_channel; pricing: SimpleProductUpdate_productVariantUpdate_productVariant_product_channelListings_pricing | null; } @@ -767,6 +769,8 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_p export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: SimpleProductUpdate_productVariantStocksCreate_productVariant_product_channelListings_channel; pricing: SimpleProductUpdate_productVariantStocksCreate_productVariant_product_channelListings_pricing | null; } @@ -1053,6 +1057,8 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_p export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: SimpleProductUpdate_productVariantStocksDelete_productVariant_product_channelListings_channel; pricing: SimpleProductUpdate_productVariantStocksDelete_productVariant_product_channelListings_pricing | null; } @@ -1340,6 +1346,8 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_p export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: SimpleProductUpdate_productVariantStocksUpdate_productVariant_product_channelListings_channel; pricing: SimpleProductUpdate_productVariantStocksUpdate_productVariant_product_channelListings_pricing | null; } diff --git a/src/products/types/VariantCreate.ts b/src/products/types/VariantCreate.ts index 12739ce1c..78ab5c0f3 100644 --- a/src/products/types/VariantCreate.ts +++ b/src/products/types/VariantCreate.ts @@ -196,6 +196,8 @@ export interface VariantCreate_productVariantCreate_productVariant_product_chann export interface VariantCreate_productVariantCreate_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: VariantCreate_productVariantCreate_productVariant_product_channelListings_channel; pricing: VariantCreate_productVariantCreate_productVariant_product_channelListings_pricing | null; } diff --git a/src/products/types/VariantMediaAssign.ts b/src/products/types/VariantMediaAssign.ts index 0014cb858..8b56687fb 100644 --- a/src/products/types/VariantMediaAssign.ts +++ b/src/products/types/VariantMediaAssign.ts @@ -195,6 +195,8 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_product_ch export interface VariantMediaAssign_variantMediaAssign_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: VariantMediaAssign_variantMediaAssign_productVariant_product_channelListings_channel; pricing: VariantMediaAssign_variantMediaAssign_productVariant_product_channelListings_pricing | null; } diff --git a/src/products/types/VariantMediaUnassign.ts b/src/products/types/VariantMediaUnassign.ts index 0d688200a..bff7807e0 100644 --- a/src/products/types/VariantMediaUnassign.ts +++ b/src/products/types/VariantMediaUnassign.ts @@ -195,6 +195,8 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_produc export interface VariantMediaUnassign_variantMediaUnassign_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: VariantMediaUnassign_variantMediaUnassign_productVariant_product_channelListings_channel; pricing: VariantMediaUnassign_variantMediaUnassign_productVariant_product_channelListings_pricing | null; } diff --git a/src/products/types/VariantUpdate.ts b/src/products/types/VariantUpdate.ts index c53afdba6..42bc61a51 100644 --- a/src/products/types/VariantUpdate.ts +++ b/src/products/types/VariantUpdate.ts @@ -196,6 +196,8 @@ export interface VariantUpdate_productVariantUpdate_productVariant_product_chann export interface VariantUpdate_productVariantUpdate_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: VariantUpdate_productVariantUpdate_productVariant_product_channelListings_channel; pricing: VariantUpdate_productVariantUpdate_productVariant_product_channelListings_pricing | null; } @@ -483,6 +485,8 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_product export interface VariantUpdate_productVariantStocksUpdate_productVariant_product_channelListings { __typename: "ProductChannelListing"; + publicationDate: any | null; + isPublished: boolean; channel: VariantUpdate_productVariantStocksUpdate_productVariant_product_channelListings_channel; pricing: VariantUpdate_productVariantStocksUpdate_productVariant_product_channelListings_pricing | null; } diff --git a/src/products/views/ProductVariantCreate.tsx b/src/products/views/ProductVariantCreate.tsx index 25a273629..08e2d50a7 100644 --- a/src/products/views/ProductVariantCreate.tsx +++ b/src/products/views/ProductVariantCreate.tsx @@ -10,11 +10,7 @@ import { WindowTitle } from "@saleor/components/WindowTitle"; import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; import { useFileUploadMutation } from "@saleor/files/mutations"; import useNavigator from "@saleor/hooks/useNavigator"; -import useNotifier from "@saleor/hooks/useNotifier"; import useShop from "@saleor/hooks/useShop"; -import { commonMessages } from "@saleor/intl"; -import { useProductVariantChannelListingUpdate } from "@saleor/products/mutations"; -import { ProductVariantChannelListingUpdate } from "@saleor/products/types/ProductVariantChannelListingUpdate"; import usePageSearch from "@saleor/searches/usePageSearch"; import useProductSearch from "@saleor/searches/useProductSearch"; import createMetadataCreateHandler from "@saleor/utils/handlers/metadataCreateHandler"; @@ -54,7 +50,6 @@ export const ProductVariant: React.FC = ({ params }) => { const navigate = useNavigator(); - const notify = useNotifier(); const shop = useShop(); const intl = useIntl(); const warehouses = useWarehouseList({ @@ -63,20 +58,6 @@ export const ProductVariant: React.FC = ({ first: 50 } }); - const handleCreateSuccess = (data: ProductVariantChannelListingUpdate) => { - if (data.productVariantChannelListingUpdate.errors.length === 0) { - notify({ - status: "success", - text: intl.formatMessage(commonMessages.savedChanges) - }); - navigate( - productVariantEditUrl( - productId, - data.productVariantChannelListingUpdate.variant.id - ) - ); - } - }; const { data, loading: productLoading } = useProductVariantCreateQuery({ displayLoader: true, @@ -85,13 +66,6 @@ export const ProductVariant: React.FC = ({ const [uploadFile, uploadFileOpts] = useFileUploadMutation({}); - const [ - updateChannels, - updateChannelsOpts - ] = useProductVariantChannelListingUpdate({ - onCompleted: handleCreateSuccess - }); - const product = data?.product; const channels: ChannelPriceData[] = product?.channelListings.map( @@ -104,21 +78,6 @@ export const ProductVariant: React.FC = ({ }) ); - const handleSubmitChannels = ( - data: ProductVariantCreateData, - variantId: string - ) => - updateChannels({ - variables: { - id: variantId, - input: data.channelListings.map(listing => ({ - channelId: listing.id, - costPrice: listing.value.costPrice || null, - price: listing.value.price - })) - } - }); - const [variantCreate, variantCreateResult] = useVariantCreateMutation({}); const [updateMetadata] = useMetadataUpdate({}); @@ -170,9 +129,6 @@ export const ProductVariant: React.FC = ({ } }); const id = result.data?.productVariantCreate?.productVariant?.id; - if (id) { - await handleSubmitChannels(formData, id); - } return id || null; }; @@ -234,9 +190,6 @@ export const ProductVariant: React.FC = ({ />
- Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency -
-
- - - - - - - - - - - - - - - - - - - - -
- Channel Name - - Selling Price - - Cost Price -
- Channel1 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- Channel2 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
+ There is no channel to define prices for. You need to first add variant to channels to define prices.
@@ -177759,270 +177501,12 @@ exports[`Storyshots Views / Products / Create product variant default 1`] = ` class="CardTitle-hr-id" />
- Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency -
-
- - - - - - - - - - - - - - - - - - - - -
- Channel Name - - Selling Price - - Cost Price -
- Channel1 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- Channel2 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
+ There is no channel to define prices for. You need to first add variant to channels to define prices.
@@ -178982,270 +178466,12 @@ exports[`Storyshots Views / Products / Create product variant no warehouses 1`] class="CardTitle-hr-id" />
- Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency -
-
- - - - - - - - - - - - - - - - - - - - -
- Channel Name - - Selling Price - - Cost Price -
- Channel1 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- Channel2 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
+ There is no channel to define prices for. You need to first add variant to channels to define prices.
@@ -179947,274 +179173,12 @@ exports[`Storyshots Views / Products / Create product variant when loading data class="CardTitle-hr-id" />
- Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency -
-
- - - - - - - - - - - - - - - - - - - - -
- Channel Name - - Selling Price - - Cost Price -
- Channel1 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- Channel2 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
+ There is no channel to define prices for. You need to first add variant to channels to define prices.
@@ -181182,270 +180146,12 @@ exports[`Storyshots Views / Products / Create product variant with errors 1`] = class="CardTitle-hr-id" />
- Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency -
-
- - - - - - - - - - - - - - - - - - - - -
- Channel Name - - Selling Price - - Cost Price -
- Channel1 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- Channel2 - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
+ There is no channel to define prices for. You need to first add variant to channels to define prices.
@@ -215450,6 +214156,132 @@ exports[`Storyshots Views / Products / Product variant details attribute errors
+
+
+ + Availability + +
+
+
+
+
+ +
+
+
+
+
+
+
+ Test channel +
+
+ Hidden +
+
+
+
+
+ Test channel other +
+
+ Published since Jan 21, 2022 +
+
+
+
+
+
+
+
+
@@ -217244,6 +216076,132 @@ exports[`Storyshots Views / Products / Product variant details no warehouses 1`]
+
+
+ + Availability + +
+
+
+
+
+ +
+
+
+
+
+
+
+ Test channel +
+
+ Hidden +
+
+
+
+
+ Test channel other +
+
+ Published since Jan 21, 2022 +
+
+
+
+
+
+
+
+
@@ -218806,6 +217764,132 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
+
+
+ + Availability + +
+
+
+
+
+ +
+
+
+
+
+
+
+ Test channel +
+
+ Hidden +
+
+
+
+
+ Test channel other +
+
+ Published since Jan 21, 2022 +
+
+
+
+
+
+
+
+
@@ -220409,6 +219493,40 @@ exports[`Storyshots Views / Products / Product variant details when loading data
+
+
+ + Availability + +
+
+
+
+
+ + ‌ + +
+
+
@@ -220608,274 +219726,12 @@ exports[`Storyshots Views / Products / Product variant details when loading data class="CardTitle-hr-id" />
- Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency -
-
- - - - - - - - - - - - - - - - - - - - -
- Channel Name - - Selling Price - - Cost Price -
- Test channel - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- Test channel other - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
+ There is no channel to define prices for
diff --git a/src/storybook/stories/products/ProductVariantCreatePage.tsx b/src/storybook/stories/products/ProductVariantCreatePage.tsx index 518f9722e..bf00af7c8 100644 --- a/src/storybook/stories/products/ProductVariantCreatePage.tsx +++ b/src/storybook/stories/products/ProductVariantCreatePage.tsx @@ -22,7 +22,6 @@ storiesOf("Views / Products / Create product variant", module) .add("default", () => ( ( ( ( (