2021-06-22 08:00:00 +00:00
|
|
|
import {
|
|
|
|
getSelectedAttributeValues,
|
|
|
|
mergeChoicesWithValues
|
|
|
|
} from "@saleor/attributes/utils/data";
|
Multichannel (#833)
* add multichannel to configuration view
* create multichannels list view
* create multichannels list view
* add ChannelsCreate view
* update channels in configuration
* add stories
* update default messages
* fix ChannelForm props
* update channels list styles
* update snapshots
* update channel form currency input
* update Channels fragments
* extract messages
* remove tabs from channelsList
* channel details, channel delete modal (#598)
* create Channel details view
* create ChannelDeleteDialog
* add channels delete dialog to channels list
* update messages and types
* fixes after review
* channels availability (#609)
* create Channel details view
* update messages and types
* create ChannelsAvailability component
* create more product channels components
* create channels stories, update fixtures, types
* update product views with channels data
* update schema and snapshots
* update defaultMessages
* update ProductUpdate view
* create ChannelsAvailabilityDropdown component
* add product channels to local storage
* update globalTypes
* Update to new schema and resolve issues
* Update messages
* create deleteChannel mutation
* add channels availability component to product create view
* refactor ProductCreate and ProductUpdate views
* CollectionProducts view cleanup
* add disabled prop to ActionDialog
* use updateChannels mutation in ProductCreate view
* ProductCreate - update submit function
* fixes after review
* update snapshots and messages
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
* channels shipping components (#655)
* create PricingCard, OrderValue and OrderWeight components
* create ShippingZoneRatesPage and DeleteShippingRateDialog
* update ChannelsAvailability component
* updates after review
* channels shipping views (#662)
* update ChannelsAvailability component
* updates after review
* create PriceRate views, update types
* create weight rates views
* update shipping views, stories, messages
* update snapshots
* update snapshots
* update useChannels hook
* orders channels components (#698)
* create OrderChannelSectionCard component
* update OrderDetailsPage
* update DraftOrderChannelCard
* update snapshots
* update fixtures
* small change after review, update snapshots
* product pricing (#702)
* update product types
* update Pricing in simple product view
* use productVariantCreate mutation in simple product view
* update snapshots and messages
* handle create variant (#715)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update snapshots and messages
* fix update and create product handlers
* update pricing types
* channels modal - new styles, search input (#717)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* fix search input label styles
* update toggleAllChannels function
* update variant creator (#724)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* add channelLisitngs to variant creator
* update variant creator price styles
* update product variant creator reducer tests
* update createVariants tests
* update error handling in product variant creator
* add Skip pricing for now option
* use PriceField instead of TextField in ProductVariantCreatorSummary
* create price validation function
* fix errors handling in ProductVariantPrice component
* fixes after review
* Product List - remove publish/unpublish buttons (#727)
* ProductList - remove publish and unpublish buttons
* update messages
* update snapshots, messages
* revert changes in ChannelsAvailabilityDropdown
* products/shipping/discount list settings (#739)
* create ChannelSettingsDialog component
* update snapshots
* ProductList - open settings modal when there is no selected channel
* add settings modal to vouchers list
* add settings dialog to sales list
* add setting modal to shipping list
* update shipping
* update snapshots, messages
* useChannelsSettings - remove selectedChannelSlug
* fix channels update handler in product and shipping view
* messages update in ChannelSettingsDialog
* handle product/discount list when there is no channels
* update onSettingsOpen prop
* collection availability dropdown (#743)
* add availability dropdown to collection products list
* update channelListingProduct fragment name
* update voucher view/components with channels (#746)
* update voucher view/components with channels
* update VoucherSummary, remove defaultCurrency from voucher components
* update snapshots
* move getChannelsVariables func to discounts handlers
* update voucher messages
* sale view/components with channels (#750)
* update sale views with channels
* small fixes in discounts
* order views with channels (#752)
* update draft orders with channels
* add channel activate/deactivate mutations
* remove sort by total in orders list
* add error notification on channel activate/deactivate
* product variants channel select (#755)
* add channels selector to ProductVariants component
* remove selectedChannel from ProductUpdate, update messages and snapshots
* update product fragments
* update translations (#762)
* update translations
* fix translation types
* update messages
* update Availability component (#766)
* update ChannelsAvailability component
* update product fixtures
* update collection and channel fixtures
* ChannelsAvailability - handle errors
* update product handlers
* update ChannelsAvailability styles
* update ProductVariant
* update snapshots
* fix missing things in multichannel (#785)
* add availability dropdown to discount products list
* fix error handling in shipping components
* update product views and components
* update messages
* update category view/components
* update CategoryProducts styles
* remove defaultCurrency from shipping components
* create ChannelsSelect component
* update channels error handling after review
* another fixes after review
* Add channels to collection views/components (#791)
** update collection components and views
* update create collection view
* update error handling in collection
* remove filter bar from collection list
* update products fragments
* small fix in collection create view
* use collectionFragment in useCatalogSearch
* update defaultMessages and snapshots
* update homepage view/drop defaultCurrency (#801)
* update homepage view
* drop defaultCurrency prop
* fix onChannelChange function in home view
* remove visibility from product list filters
* update export products with channels (#803)
* update ProductExportDialog with channels
* add new channel error code
* remover VISIBLE from product export dialog Financial information
* fix input size in ProductVariantCreatorSummary (#804)
* channels currency code select (#806)
* create select with currency codes
* fix ChannelDeleteDialog
* update defaultMessages, remove unneeded ChannelDetails handlers
* fixes after rebase
* replace channelListing with channelListings
* [multichannel] Update schema]
* Fix product create test
Co-authored-by: AlicjaSzu <alicja.szukuc@gmail.com>
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
2020-11-17 16:10:42 +00:00
|
|
|
import { ChannelData } from "@saleor/channels/utils";
|
2020-12-16 10:53:28 +00:00
|
|
|
import {
|
|
|
|
AttributeInput,
|
|
|
|
VariantAttributeScope
|
|
|
|
} from "@saleor/components/Attributes";
|
2020-08-28 12:45:11 +00:00
|
|
|
import { MetadataFormData } from "@saleor/components/Metadata/types";
|
2019-08-09 10:17:04 +00:00
|
|
|
import { SingleAutocompleteChoiceType } from "@saleor/components/SingleAutocompleteSelectField";
|
2020-07-07 10:14:12 +00:00
|
|
|
import { ProductVariant } from "@saleor/fragments/types/ProductVariant";
|
2020-12-16 10:53:28 +00:00
|
|
|
import { SelectedVariantAttributeFragment } from "@saleor/fragments/types/SelectedVariantAttributeFragment";
|
|
|
|
import { VariantAttributeFragment } from "@saleor/fragments/types/VariantAttributeFragment";
|
2021-01-12 11:13:02 +00:00
|
|
|
import { FormsetAtomicData } from "@saleor/hooks/useFormset";
|
2019-08-09 10:17:04 +00:00
|
|
|
import { maybe } from "@saleor/misc";
|
|
|
|
import {
|
|
|
|
ProductDetails_product,
|
|
|
|
ProductDetails_product_collections,
|
|
|
|
ProductDetails_product_variants
|
|
|
|
} from "@saleor/products/types/ProductDetails";
|
2020-05-04 15:29:06 +00:00
|
|
|
import { StockInput } from "@saleor/types/globalTypes";
|
2021-05-28 09:59:25 +00:00
|
|
|
import { mapEdgesToItems, mapMetadataItemToInput } from "@saleor/utils/maps";
|
2021-10-01 12:41:31 +00:00
|
|
|
import moment from "moment";
|
2020-05-14 09:30:32 +00:00
|
|
|
|
|
|
|
import { ProductStockInput } from "../components/ProductStocks";
|
2021-04-08 16:14:15 +00:00
|
|
|
import { ProductType_productType_productAttributes } from "../types/ProductType";
|
2019-10-17 15:29:13 +00:00
|
|
|
import { ProductVariantCreateData_product } from "../types/ProductVariantCreateData";
|
Add channel shipping zones (#1015)
* Add naked input option to SingleAutocompleteSelectField and update it's stories
* Add new icons - chevron up, down & trash
* Add deletable item component and stories
* Add card add items footer component to be used in warehouses and product stocks assign
* Update schema and types
* Add shipping zones card components
* Update channel details page form to also include shipping zones
* Update makeTopLevelSearch hook files directory and add getSearchFetchMoreProps function to avoid extracting it manually every time
* Update channels types & fragments
* Move getDefaultNotifierSuccessErrorData function to useNotifier utils, update dir etc., also make order discount provider use it from the new dir
* Add shippinh zone to channel update and create and add shipping zone search
* Update messages
* Fix types
* Fix lint, types etc
* Small refactor from review and quick fix styles of shipping zones card
* Refactor a bit and update snapshots
* Refactor a bit and update snapshots
* Addd / refactor channels availability components
* Add useChannelsWithProductVariants hook with utils and types
* Add / refactor more channels availability components
* Move avatar from table cell avatar to separate component for it to be usable outside of tables
* Add channels with variants logic to product create and update pages & views
* Refactor components to use updated channels availability components
* Remove unnecessary comments
* Update storybook
* Update types
* Update messages
* Fix prices for variants / simple product not uodating properly
* Post merge cleanup, update schema, types, etc.
* Change shipping zone details warehouses card into settings card and add ability to assign channels to shipping zone
* Update types
* Update snapshots
* Fix selecting / deselecting all channels in channels with variants modal
* Fixes after review, some types changes etc.
* Update snapshots
* Small types fixes
* Make price rates views use parent shipping method channels instead of all
* Make price rates views use parent shipping method channels instead of all
* Update types
* Fix bugs
* Fixes after review
* Fix channels availability data submission
* Fix lint
* Fix variant pricing card showing not related channels
* Fixes after review
* Fix types
* Hide unaviable variants in add products to draft order dialog
* Fix channels with variants availability modal showing confirm button as enabled when it shouldn't
* Fix types
* Update semi checked icon to match old designs
* Update types
* Update channels icon in channels with variants availability
* Fix product cypress test after product channels mutation changed
* Fix trash and chevron down colors in dark mode
* Fix shipping zones card footer not updating query after click away
* Fix types in schema, add condition not to display shipping zones select in channel details if all zones have already been selected
* Fix products adding in order draft dialog
* Fix simple productupdate
* Update snapshots after merge with master
* Update messages
* Fix product api request for cypress
* Add missing test id
* Fix selecting if product is simple -> form being submitted with empty data sometimes
* Update snapshots, messages and add fix for invalid date at product update
* Remove unnecessary imports
* Fix failing test in saleor 2552 (#1061)
* fix
* fix
* fix
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
Co-authored-by: Karolina <rakoczy.karolina@gmail.com>
2021-04-14 13:44:25 +00:00
|
|
|
import { ChannelsWithVariantsData } from "../views/ProductUpdate/types";
|
2019-08-09 10:17:04 +00:00
|
|
|
|
|
|
|
export interface Collection {
|
|
|
|
id: string;
|
|
|
|
label: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Node {
|
|
|
|
id: string;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProductType {
|
|
|
|
hasVariants: boolean;
|
|
|
|
id: string;
|
|
|
|
name: string;
|
2021-04-08 16:14:15 +00:00
|
|
|
productAttributes: ProductType_productType_productAttributes[];
|
2019-08-09 10:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getAttributeInputFromProduct(
|
|
|
|
product: ProductDetails_product
|
2020-12-16 10:53:28 +00:00
|
|
|
): AttributeInput[] {
|
2021-07-29 12:15:14 +00:00
|
|
|
return (
|
|
|
|
product?.attributes?.map(attribute => ({
|
|
|
|
data: {
|
|
|
|
entityType: attribute.attribute.entityType,
|
|
|
|
inputType: attribute.attribute.inputType,
|
|
|
|
isRequired: attribute.attribute.valueRequired,
|
|
|
|
selectedValues: attribute.values,
|
|
|
|
values: mergeChoicesWithValues(attribute),
|
|
|
|
unit: attribute.attribute.unit
|
|
|
|
},
|
|
|
|
id: attribute.attribute.id,
|
|
|
|
label: attribute.attribute.name,
|
|
|
|
value: getSelectedAttributeValues(attribute)
|
|
|
|
})) ?? []
|
2019-08-09 10:17:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getAttributeInputFromProductType(
|
|
|
|
productType: ProductType
|
2020-12-16 10:53:28 +00:00
|
|
|
): AttributeInput[] {
|
2019-08-09 10:17:04 +00:00
|
|
|
return productType.productAttributes.map(attribute => ({
|
|
|
|
data: {
|
2021-01-20 16:37:36 +00:00
|
|
|
entityType: attribute.entityType,
|
2019-08-09 10:17:04 +00:00
|
|
|
inputType: attribute.inputType,
|
|
|
|
isRequired: attribute.valueRequired,
|
2021-07-07 14:09:35 +00:00
|
|
|
values: mapEdgesToItems(attribute.choices) || [],
|
2021-04-29 08:58:03 +00:00
|
|
|
unit: attribute.unit
|
2019-08-09 10:17:04 +00:00
|
|
|
},
|
|
|
|
id: attribute.id,
|
|
|
|
label: attribute.name,
|
|
|
|
value: []
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2020-12-16 10:53:28 +00:00
|
|
|
export function getAttributeInputFromAttributes(
|
|
|
|
variantAttributes: VariantAttributeFragment[],
|
|
|
|
variantAttributeScope: VariantAttributeScope
|
|
|
|
): AttributeInput[] {
|
|
|
|
return variantAttributes?.map(attribute => ({
|
|
|
|
data: {
|
2021-01-20 16:37:36 +00:00
|
|
|
entityType: attribute.entityType,
|
2020-12-16 10:53:28 +00:00
|
|
|
inputType: attribute.inputType,
|
|
|
|
isRequired: attribute.valueRequired,
|
2021-07-07 14:09:35 +00:00
|
|
|
values: mapEdgesToItems(attribute.choices) || [],
|
2021-04-29 08:58:03 +00:00
|
|
|
unit: attribute.unit,
|
2020-12-16 10:53:28 +00:00
|
|
|
variantAttributeScope
|
|
|
|
},
|
|
|
|
id: attribute.id,
|
|
|
|
label: attribute.name,
|
2021-04-23 12:27:31 +00:00
|
|
|
value: []
|
2020-12-16 10:53:28 +00:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getAttributeInputFromSelectedAttributes(
|
|
|
|
variantAttributes: SelectedVariantAttributeFragment[],
|
|
|
|
variantAttributeScope: VariantAttributeScope
|
|
|
|
): AttributeInput[] {
|
2021-01-13 12:11:01 +00:00
|
|
|
return variantAttributes?.map(attribute => ({
|
|
|
|
data: {
|
2021-01-20 16:37:36 +00:00
|
|
|
entityType: attribute.attribute.entityType,
|
2021-01-13 12:11:01 +00:00
|
|
|
inputType: attribute.attribute.inputType,
|
|
|
|
isRequired: attribute.attribute.valueRequired,
|
|
|
|
selectedValues: attribute.values,
|
2021-06-22 08:00:00 +00:00
|
|
|
values: mergeChoicesWithValues(attribute),
|
2021-04-29 08:58:03 +00:00
|
|
|
unit: attribute.attribute.unit,
|
2021-01-13 12:11:01 +00:00
|
|
|
variantAttributeScope
|
|
|
|
},
|
|
|
|
id: attribute.attribute.id,
|
|
|
|
label: attribute.attribute.name,
|
|
|
|
value: getSelectedAttributeValues(attribute)
|
|
|
|
}));
|
2020-12-16 10:53:28 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 10:17:04 +00:00
|
|
|
export function getAttributeInputFromVariant(
|
2019-10-18 11:19:43 +00:00
|
|
|
variant: ProductVariant
|
2020-12-16 10:53:28 +00:00
|
|
|
): AttributeInput[] {
|
|
|
|
const selectionAttributeInput = getAttributeInputFromSelectedAttributes(
|
|
|
|
variant?.selectionAttributes,
|
|
|
|
VariantAttributeScope.VARIANT_SELECTION
|
|
|
|
);
|
|
|
|
const nonSelectionAttributeInput = getAttributeInputFromSelectedAttributes(
|
|
|
|
variant?.nonSelectionAttributes,
|
|
|
|
VariantAttributeScope.NOT_VARIANT_SELECTION
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
selectionAttributeInput?.concat(nonSelectionAttributeInput ?? []) ?? []
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getVariantAttributeInputFromProduct(
|
|
|
|
product: ProductVariantCreateData_product
|
|
|
|
): AttributeInput[] {
|
|
|
|
const selectionAttributeInput = getAttributeInputFromAttributes(
|
|
|
|
product?.productType?.selectionVariantAttributes,
|
|
|
|
VariantAttributeScope.VARIANT_SELECTION
|
|
|
|
);
|
|
|
|
|
|
|
|
const nonSelectionAttributeInput = getAttributeInputFromAttributes(
|
|
|
|
product?.productType?.nonSelectionVariantAttributes,
|
|
|
|
VariantAttributeScope.NOT_VARIANT_SELECTION
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
selectionAttributeInput?.concat(nonSelectionAttributeInput ?? []) ?? []
|
2019-08-09 10:17:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-27 10:40:34 +00:00
|
|
|
export function getStockInputFromVariant(
|
|
|
|
variant: ProductVariant
|
|
|
|
): ProductStockInput[] {
|
|
|
|
return (
|
|
|
|
variant?.stocks.map(stock => ({
|
2020-12-15 09:50:29 +00:00
|
|
|
data: {
|
|
|
|
quantityAllocated: stock.quantityAllocated
|
|
|
|
},
|
2020-03-27 10:40:34 +00:00
|
|
|
id: stock.warehouse.id,
|
|
|
|
label: stock.warehouse.name,
|
|
|
|
value: stock.quantity.toString()
|
|
|
|
})) || []
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-19 17:15:22 +00:00
|
|
|
export function getStockInputFromProduct(
|
|
|
|
product: ProductDetails_product
|
|
|
|
): ProductStockInput[] {
|
2020-03-31 17:46:07 +00:00
|
|
|
return product?.variants[0]?.stocks.map(stock => ({
|
2020-12-15 09:50:29 +00:00
|
|
|
data: {
|
|
|
|
quantityAllocated: stock?.quantityAllocated
|
|
|
|
},
|
2020-03-19 17:15:22 +00:00
|
|
|
id: stock.warehouse.id,
|
|
|
|
label: stock.warehouse.name,
|
|
|
|
value: stock.quantity.toString()
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2019-08-09 10:17:04 +00:00
|
|
|
export function getCollectionInput(
|
|
|
|
productCollections: ProductDetails_product_collections[]
|
|
|
|
): Collection[] {
|
|
|
|
return maybe(
|
|
|
|
() =>
|
|
|
|
productCollections.map(collection => ({
|
|
|
|
id: collection.id,
|
|
|
|
label: collection.name
|
|
|
|
})),
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getChoices(nodes: Node[]): SingleAutocompleteChoiceType[] {
|
|
|
|
return maybe(
|
|
|
|
() =>
|
|
|
|
nodes.map(node => ({
|
|
|
|
label: node.name,
|
|
|
|
value: node.id
|
|
|
|
})),
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:45:11 +00:00
|
|
|
export interface ProductUpdatePageFormData extends MetadataFormData {
|
2019-08-09 10:17:04 +00:00
|
|
|
category: string | null;
|
2020-09-23 08:29:13 +00:00
|
|
|
changeTaxCode: boolean;
|
Add channel shipping zones (#1015)
* Add naked input option to SingleAutocompleteSelectField and update it's stories
* Add new icons - chevron up, down & trash
* Add deletable item component and stories
* Add card add items footer component to be used in warehouses and product stocks assign
* Update schema and types
* Add shipping zones card components
* Update channel details page form to also include shipping zones
* Update makeTopLevelSearch hook files directory and add getSearchFetchMoreProps function to avoid extracting it manually every time
* Update channels types & fragments
* Move getDefaultNotifierSuccessErrorData function to useNotifier utils, update dir etc., also make order discount provider use it from the new dir
* Add shippinh zone to channel update and create and add shipping zone search
* Update messages
* Fix types
* Fix lint, types etc
* Small refactor from review and quick fix styles of shipping zones card
* Refactor a bit and update snapshots
* Refactor a bit and update snapshots
* Addd / refactor channels availability components
* Add useChannelsWithProductVariants hook with utils and types
* Add / refactor more channels availability components
* Move avatar from table cell avatar to separate component for it to be usable outside of tables
* Add channels with variants logic to product create and update pages & views
* Refactor components to use updated channels availability components
* Remove unnecessary comments
* Update storybook
* Update types
* Update messages
* Fix prices for variants / simple product not uodating properly
* Post merge cleanup, update schema, types, etc.
* Change shipping zone details warehouses card into settings card and add ability to assign channels to shipping zone
* Update types
* Update snapshots
* Fix selecting / deselecting all channels in channels with variants modal
* Fixes after review, some types changes etc.
* Update snapshots
* Small types fixes
* Make price rates views use parent shipping method channels instead of all
* Make price rates views use parent shipping method channels instead of all
* Update types
* Fix bugs
* Fixes after review
* Fix channels availability data submission
* Fix lint
* Fix variant pricing card showing not related channels
* Fixes after review
* Fix types
* Hide unaviable variants in add products to draft order dialog
* Fix channels with variants availability modal showing confirm button as enabled when it shouldn't
* Fix types
* Update semi checked icon to match old designs
* Update types
* Update channels icon in channels with variants availability
* Fix product cypress test after product channels mutation changed
* Fix trash and chevron down colors in dark mode
* Fix shipping zones card footer not updating query after click away
* Fix types in schema, add condition not to display shipping zones select in channel details if all zones have already been selected
* Fix products adding in order draft dialog
* Fix simple productupdate
* Update snapshots after merge with master
* Update messages
* Fix product api request for cypress
* Add missing test id
* Fix selecting if product is simple -> form being submitted with empty data sometimes
* Update snapshots, messages and add fix for invalid date at product update
* Remove unnecessary imports
* Fix failing test in saleor 2552 (#1061)
* fix
* fix
* fix
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
Co-authored-by: Karolina <rakoczy.karolina@gmail.com>
2021-04-14 13:44:25 +00:00
|
|
|
channelsWithVariants: ChannelsWithVariantsData;
|
Multichannel (#833)
* add multichannel to configuration view
* create multichannels list view
* create multichannels list view
* add ChannelsCreate view
* update channels in configuration
* add stories
* update default messages
* fix ChannelForm props
* update channels list styles
* update snapshots
* update channel form currency input
* update Channels fragments
* extract messages
* remove tabs from channelsList
* channel details, channel delete modal (#598)
* create Channel details view
* create ChannelDeleteDialog
* add channels delete dialog to channels list
* update messages and types
* fixes after review
* channels availability (#609)
* create Channel details view
* update messages and types
* create ChannelsAvailability component
* create more product channels components
* create channels stories, update fixtures, types
* update product views with channels data
* update schema and snapshots
* update defaultMessages
* update ProductUpdate view
* create ChannelsAvailabilityDropdown component
* add product channels to local storage
* update globalTypes
* Update to new schema and resolve issues
* Update messages
* create deleteChannel mutation
* add channels availability component to product create view
* refactor ProductCreate and ProductUpdate views
* CollectionProducts view cleanup
* add disabled prop to ActionDialog
* use updateChannels mutation in ProductCreate view
* ProductCreate - update submit function
* fixes after review
* update snapshots and messages
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
* channels shipping components (#655)
* create PricingCard, OrderValue and OrderWeight components
* create ShippingZoneRatesPage and DeleteShippingRateDialog
* update ChannelsAvailability component
* updates after review
* channels shipping views (#662)
* update ChannelsAvailability component
* updates after review
* create PriceRate views, update types
* create weight rates views
* update shipping views, stories, messages
* update snapshots
* update snapshots
* update useChannels hook
* orders channels components (#698)
* create OrderChannelSectionCard component
* update OrderDetailsPage
* update DraftOrderChannelCard
* update snapshots
* update fixtures
* small change after review, update snapshots
* product pricing (#702)
* update product types
* update Pricing in simple product view
* use productVariantCreate mutation in simple product view
* update snapshots and messages
* handle create variant (#715)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update snapshots and messages
* fix update and create product handlers
* update pricing types
* channels modal - new styles, search input (#717)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* fix search input label styles
* update toggleAllChannels function
* update variant creator (#724)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* add channelLisitngs to variant creator
* update variant creator price styles
* update product variant creator reducer tests
* update createVariants tests
* update error handling in product variant creator
* add Skip pricing for now option
* use PriceField instead of TextField in ProductVariantCreatorSummary
* create price validation function
* fix errors handling in ProductVariantPrice component
* fixes after review
* Product List - remove publish/unpublish buttons (#727)
* ProductList - remove publish and unpublish buttons
* update messages
* update snapshots, messages
* revert changes in ChannelsAvailabilityDropdown
* products/shipping/discount list settings (#739)
* create ChannelSettingsDialog component
* update snapshots
* ProductList - open settings modal when there is no selected channel
* add settings modal to vouchers list
* add settings dialog to sales list
* add setting modal to shipping list
* update shipping
* update snapshots, messages
* useChannelsSettings - remove selectedChannelSlug
* fix channels update handler in product and shipping view
* messages update in ChannelSettingsDialog
* handle product/discount list when there is no channels
* update onSettingsOpen prop
* collection availability dropdown (#743)
* add availability dropdown to collection products list
* update channelListingProduct fragment name
* update voucher view/components with channels (#746)
* update voucher view/components with channels
* update VoucherSummary, remove defaultCurrency from voucher components
* update snapshots
* move getChannelsVariables func to discounts handlers
* update voucher messages
* sale view/components with channels (#750)
* update sale views with channels
* small fixes in discounts
* order views with channels (#752)
* update draft orders with channels
* add channel activate/deactivate mutations
* remove sort by total in orders list
* add error notification on channel activate/deactivate
* product variants channel select (#755)
* add channels selector to ProductVariants component
* remove selectedChannel from ProductUpdate, update messages and snapshots
* update product fragments
* update translations (#762)
* update translations
* fix translation types
* update messages
* update Availability component (#766)
* update ChannelsAvailability component
* update product fixtures
* update collection and channel fixtures
* ChannelsAvailability - handle errors
* update product handlers
* update ChannelsAvailability styles
* update ProductVariant
* update snapshots
* fix missing things in multichannel (#785)
* add availability dropdown to discount products list
* fix error handling in shipping components
* update product views and components
* update messages
* update category view/components
* update CategoryProducts styles
* remove defaultCurrency from shipping components
* create ChannelsSelect component
* update channels error handling after review
* another fixes after review
* Add channels to collection views/components (#791)
** update collection components and views
* update create collection view
* update error handling in collection
* remove filter bar from collection list
* update products fragments
* small fix in collection create view
* use collectionFragment in useCatalogSearch
* update defaultMessages and snapshots
* update homepage view/drop defaultCurrency (#801)
* update homepage view
* drop defaultCurrency prop
* fix onChannelChange function in home view
* remove visibility from product list filters
* update export products with channels (#803)
* update ProductExportDialog with channels
* add new channel error code
* remover VISIBLE from product export dialog Financial information
* fix input size in ProductVariantCreatorSummary (#804)
* channels currency code select (#806)
* create select with currency codes
* fix ChannelDeleteDialog
* update defaultMessages, remove unneeded ChannelDetails handlers
* fixes after rebase
* replace channelListing with channelListings
* [multichannel] Update schema]
* Fix product create test
Co-authored-by: AlicjaSzu <alicja.szukuc@gmail.com>
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
2020-11-17 16:10:42 +00:00
|
|
|
channelListings: ChannelData[];
|
Add channel shipping zones (#1015)
* Add naked input option to SingleAutocompleteSelectField and update it's stories
* Add new icons - chevron up, down & trash
* Add deletable item component and stories
* Add card add items footer component to be used in warehouses and product stocks assign
* Update schema and types
* Add shipping zones card components
* Update channel details page form to also include shipping zones
* Update makeTopLevelSearch hook files directory and add getSearchFetchMoreProps function to avoid extracting it manually every time
* Update channels types & fragments
* Move getDefaultNotifierSuccessErrorData function to useNotifier utils, update dir etc., also make order discount provider use it from the new dir
* Add shippinh zone to channel update and create and add shipping zone search
* Update messages
* Fix types
* Fix lint, types etc
* Small refactor from review and quick fix styles of shipping zones card
* Refactor a bit and update snapshots
* Refactor a bit and update snapshots
* Addd / refactor channels availability components
* Add useChannelsWithProductVariants hook with utils and types
* Add / refactor more channels availability components
* Move avatar from table cell avatar to separate component for it to be usable outside of tables
* Add channels with variants logic to product create and update pages & views
* Refactor components to use updated channels availability components
* Remove unnecessary comments
* Update storybook
* Update types
* Update messages
* Fix prices for variants / simple product not uodating properly
* Post merge cleanup, update schema, types, etc.
* Change shipping zone details warehouses card into settings card and add ability to assign channels to shipping zone
* Update types
* Update snapshots
* Fix selecting / deselecting all channels in channels with variants modal
* Fixes after review, some types changes etc.
* Update snapshots
* Small types fixes
* Make price rates views use parent shipping method channels instead of all
* Make price rates views use parent shipping method channels instead of all
* Update types
* Fix bugs
* Fixes after review
* Fix channels availability data submission
* Fix lint
* Fix variant pricing card showing not related channels
* Fixes after review
* Fix types
* Hide unaviable variants in add products to draft order dialog
* Fix channels with variants availability modal showing confirm button as enabled when it shouldn't
* Fix types
* Update semi checked icon to match old designs
* Update types
* Update channels icon in channels with variants availability
* Fix product cypress test after product channels mutation changed
* Fix trash and chevron down colors in dark mode
* Fix shipping zones card footer not updating query after click away
* Fix types in schema, add condition not to display shipping zones select in channel details if all zones have already been selected
* Fix products adding in order draft dialog
* Fix simple productupdate
* Update snapshots after merge with master
* Update messages
* Fix product api request for cypress
* Add missing test id
* Fix selecting if product is simple -> form being submitted with empty data sometimes
* Update snapshots, messages and add fix for invalid date at product update
* Remove unnecessary imports
* Fix failing test in saleor 2552 (#1061)
* fix
* fix
* fix
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
Co-authored-by: Karolina <rakoczy.karolina@gmail.com>
2021-04-14 13:44:25 +00:00
|
|
|
channelsData: ChannelData[];
|
2019-08-09 10:17:04 +00:00
|
|
|
chargeTaxes: boolean;
|
2020-09-23 08:29:13 +00:00
|
|
|
collections: string[];
|
2020-09-03 10:25:16 +00:00
|
|
|
isAvailable: boolean;
|
2019-08-09 10:17:04 +00:00
|
|
|
name: string;
|
2020-09-18 14:40:48 +00:00
|
|
|
slug: string;
|
2020-11-19 17:07:42 +00:00
|
|
|
rating: number;
|
2019-08-09 10:17:04 +00:00
|
|
|
seoDescription: string;
|
|
|
|
seoTitle: string;
|
|
|
|
sku: string;
|
2020-09-23 08:29:13 +00:00
|
|
|
taxCode: string;
|
2020-03-19 17:15:22 +00:00
|
|
|
trackInventory: boolean;
|
2020-09-23 08:29:13 +00:00
|
|
|
weight: string;
|
2021-10-01 12:41:31 +00:00
|
|
|
isPreorder: boolean;
|
|
|
|
globalThreshold: number;
|
|
|
|
globalSoldUnits: number;
|
|
|
|
hasPreorderEndDate: boolean;
|
|
|
|
preorderEndDateTime?: string;
|
2019-08-09 10:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getProductUpdatePageFormData(
|
|
|
|
product: ProductDetails_product,
|
Multichannel (#833)
* add multichannel to configuration view
* create multichannels list view
* create multichannels list view
* add ChannelsCreate view
* update channels in configuration
* add stories
* update default messages
* fix ChannelForm props
* update channels list styles
* update snapshots
* update channel form currency input
* update Channels fragments
* extract messages
* remove tabs from channelsList
* channel details, channel delete modal (#598)
* create Channel details view
* create ChannelDeleteDialog
* add channels delete dialog to channels list
* update messages and types
* fixes after review
* channels availability (#609)
* create Channel details view
* update messages and types
* create ChannelsAvailability component
* create more product channels components
* create channels stories, update fixtures, types
* update product views with channels data
* update schema and snapshots
* update defaultMessages
* update ProductUpdate view
* create ChannelsAvailabilityDropdown component
* add product channels to local storage
* update globalTypes
* Update to new schema and resolve issues
* Update messages
* create deleteChannel mutation
* add channels availability component to product create view
* refactor ProductCreate and ProductUpdate views
* CollectionProducts view cleanup
* add disabled prop to ActionDialog
* use updateChannels mutation in ProductCreate view
* ProductCreate - update submit function
* fixes after review
* update snapshots and messages
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
* channels shipping components (#655)
* create PricingCard, OrderValue and OrderWeight components
* create ShippingZoneRatesPage and DeleteShippingRateDialog
* update ChannelsAvailability component
* updates after review
* channels shipping views (#662)
* update ChannelsAvailability component
* updates after review
* create PriceRate views, update types
* create weight rates views
* update shipping views, stories, messages
* update snapshots
* update snapshots
* update useChannels hook
* orders channels components (#698)
* create OrderChannelSectionCard component
* update OrderDetailsPage
* update DraftOrderChannelCard
* update snapshots
* update fixtures
* small change after review, update snapshots
* product pricing (#702)
* update product types
* update Pricing in simple product view
* use productVariantCreate mutation in simple product view
* update snapshots and messages
* handle create variant (#715)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update snapshots and messages
* fix update and create product handlers
* update pricing types
* channels modal - new styles, search input (#717)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* fix search input label styles
* update toggleAllChannels function
* update variant creator (#724)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* add channelLisitngs to variant creator
* update variant creator price styles
* update product variant creator reducer tests
* update createVariants tests
* update error handling in product variant creator
* add Skip pricing for now option
* use PriceField instead of TextField in ProductVariantCreatorSummary
* create price validation function
* fix errors handling in ProductVariantPrice component
* fixes after review
* Product List - remove publish/unpublish buttons (#727)
* ProductList - remove publish and unpublish buttons
* update messages
* update snapshots, messages
* revert changes in ChannelsAvailabilityDropdown
* products/shipping/discount list settings (#739)
* create ChannelSettingsDialog component
* update snapshots
* ProductList - open settings modal when there is no selected channel
* add settings modal to vouchers list
* add settings dialog to sales list
* add setting modal to shipping list
* update shipping
* update snapshots, messages
* useChannelsSettings - remove selectedChannelSlug
* fix channels update handler in product and shipping view
* messages update in ChannelSettingsDialog
* handle product/discount list when there is no channels
* update onSettingsOpen prop
* collection availability dropdown (#743)
* add availability dropdown to collection products list
* update channelListingProduct fragment name
* update voucher view/components with channels (#746)
* update voucher view/components with channels
* update VoucherSummary, remove defaultCurrency from voucher components
* update snapshots
* move getChannelsVariables func to discounts handlers
* update voucher messages
* sale view/components with channels (#750)
* update sale views with channels
* small fixes in discounts
* order views with channels (#752)
* update draft orders with channels
* add channel activate/deactivate mutations
* remove sort by total in orders list
* add error notification on channel activate/deactivate
* product variants channel select (#755)
* add channels selector to ProductVariants component
* remove selectedChannel from ProductUpdate, update messages and snapshots
* update product fragments
* update translations (#762)
* update translations
* fix translation types
* update messages
* update Availability component (#766)
* update ChannelsAvailability component
* update product fixtures
* update collection and channel fixtures
* ChannelsAvailability - handle errors
* update product handlers
* update ChannelsAvailability styles
* update ProductVariant
* update snapshots
* fix missing things in multichannel (#785)
* add availability dropdown to discount products list
* fix error handling in shipping components
* update product views and components
* update messages
* update category view/components
* update CategoryProducts styles
* remove defaultCurrency from shipping components
* create ChannelsSelect component
* update channels error handling after review
* another fixes after review
* Add channels to collection views/components (#791)
** update collection components and views
* update create collection view
* update error handling in collection
* remove filter bar from collection list
* update products fragments
* small fix in collection create view
* use collectionFragment in useCatalogSearch
* update defaultMessages and snapshots
* update homepage view/drop defaultCurrency (#801)
* update homepage view
* drop defaultCurrency prop
* fix onChannelChange function in home view
* remove visibility from product list filters
* update export products with channels (#803)
* update ProductExportDialog with channels
* add new channel error code
* remover VISIBLE from product export dialog Financial information
* fix input size in ProductVariantCreatorSummary (#804)
* channels currency code select (#806)
* create select with currency codes
* fix ChannelDeleteDialog
* update defaultMessages, remove unneeded ChannelDetails handlers
* fixes after rebase
* replace channelListing with channelListings
* [multichannel] Update schema]
* Fix product create test
Co-authored-by: AlicjaSzu <alicja.szukuc@gmail.com>
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
2020-11-17 16:10:42 +00:00
|
|
|
variants: ProductDetails_product_variants[],
|
Add channel shipping zones (#1015)
* Add naked input option to SingleAutocompleteSelectField and update it's stories
* Add new icons - chevron up, down & trash
* Add deletable item component and stories
* Add card add items footer component to be used in warehouses and product stocks assign
* Update schema and types
* Add shipping zones card components
* Update channel details page form to also include shipping zones
* Update makeTopLevelSearch hook files directory and add getSearchFetchMoreProps function to avoid extracting it manually every time
* Update channels types & fragments
* Move getDefaultNotifierSuccessErrorData function to useNotifier utils, update dir etc., also make order discount provider use it from the new dir
* Add shippinh zone to channel update and create and add shipping zone search
* Update messages
* Fix types
* Fix lint, types etc
* Small refactor from review and quick fix styles of shipping zones card
* Refactor a bit and update snapshots
* Refactor a bit and update snapshots
* Addd / refactor channels availability components
* Add useChannelsWithProductVariants hook with utils and types
* Add / refactor more channels availability components
* Move avatar from table cell avatar to separate component for it to be usable outside of tables
* Add channels with variants logic to product create and update pages & views
* Refactor components to use updated channels availability components
* Remove unnecessary comments
* Update storybook
* Update types
* Update messages
* Fix prices for variants / simple product not uodating properly
* Post merge cleanup, update schema, types, etc.
* Change shipping zone details warehouses card into settings card and add ability to assign channels to shipping zone
* Update types
* Update snapshots
* Fix selecting / deselecting all channels in channels with variants modal
* Fixes after review, some types changes etc.
* Update snapshots
* Small types fixes
* Make price rates views use parent shipping method channels instead of all
* Make price rates views use parent shipping method channels instead of all
* Update types
* Fix bugs
* Fixes after review
* Fix channels availability data submission
* Fix lint
* Fix variant pricing card showing not related channels
* Fixes after review
* Fix types
* Hide unaviable variants in add products to draft order dialog
* Fix channels with variants availability modal showing confirm button as enabled when it shouldn't
* Fix types
* Update semi checked icon to match old designs
* Update types
* Update channels icon in channels with variants availability
* Fix product cypress test after product channels mutation changed
* Fix trash and chevron down colors in dark mode
* Fix shipping zones card footer not updating query after click away
* Fix types in schema, add condition not to display shipping zones select in channel details if all zones have already been selected
* Fix products adding in order draft dialog
* Fix simple productupdate
* Update snapshots after merge with master
* Update messages
* Fix product api request for cypress
* Add missing test id
* Fix selecting if product is simple -> form being submitted with empty data sometimes
* Update snapshots, messages and add fix for invalid date at product update
* Remove unnecessary imports
* Fix failing test in saleor 2552 (#1061)
* fix
* fix
* fix
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
Co-authored-by: Karolina <rakoczy.karolina@gmail.com>
2021-04-14 13:44:25 +00:00
|
|
|
currentChannels: ChannelData[],
|
|
|
|
channelsData: ChannelData[],
|
|
|
|
channelsWithVariants: ChannelsWithVariantsData
|
2019-08-09 10:17:04 +00:00
|
|
|
): ProductUpdatePageFormData {
|
2021-10-01 12:41:31 +00:00
|
|
|
const variant = product?.variants[0];
|
2019-08-09 10:17:04 +00:00
|
|
|
return {
|
Add channel shipping zones (#1015)
* Add naked input option to SingleAutocompleteSelectField and update it's stories
* Add new icons - chevron up, down & trash
* Add deletable item component and stories
* Add card add items footer component to be used in warehouses and product stocks assign
* Update schema and types
* Add shipping zones card components
* Update channel details page form to also include shipping zones
* Update makeTopLevelSearch hook files directory and add getSearchFetchMoreProps function to avoid extracting it manually every time
* Update channels types & fragments
* Move getDefaultNotifierSuccessErrorData function to useNotifier utils, update dir etc., also make order discount provider use it from the new dir
* Add shippinh zone to channel update and create and add shipping zone search
* Update messages
* Fix types
* Fix lint, types etc
* Small refactor from review and quick fix styles of shipping zones card
* Refactor a bit and update snapshots
* Refactor a bit and update snapshots
* Addd / refactor channels availability components
* Add useChannelsWithProductVariants hook with utils and types
* Add / refactor more channels availability components
* Move avatar from table cell avatar to separate component for it to be usable outside of tables
* Add channels with variants logic to product create and update pages & views
* Refactor components to use updated channels availability components
* Remove unnecessary comments
* Update storybook
* Update types
* Update messages
* Fix prices for variants / simple product not uodating properly
* Post merge cleanup, update schema, types, etc.
* Change shipping zone details warehouses card into settings card and add ability to assign channels to shipping zone
* Update types
* Update snapshots
* Fix selecting / deselecting all channels in channels with variants modal
* Fixes after review, some types changes etc.
* Update snapshots
* Small types fixes
* Make price rates views use parent shipping method channels instead of all
* Make price rates views use parent shipping method channels instead of all
* Update types
* Fix bugs
* Fixes after review
* Fix channels availability data submission
* Fix lint
* Fix variant pricing card showing not related channels
* Fixes after review
* Fix types
* Hide unaviable variants in add products to draft order dialog
* Fix channels with variants availability modal showing confirm button as enabled when it shouldn't
* Fix types
* Update semi checked icon to match old designs
* Update types
* Update channels icon in channels with variants availability
* Fix product cypress test after product channels mutation changed
* Fix trash and chevron down colors in dark mode
* Fix shipping zones card footer not updating query after click away
* Fix types in schema, add condition not to display shipping zones select in channel details if all zones have already been selected
* Fix products adding in order draft dialog
* Fix simple productupdate
* Update snapshots after merge with master
* Update messages
* Fix product api request for cypress
* Add missing test id
* Fix selecting if product is simple -> form being submitted with empty data sometimes
* Update snapshots, messages and add fix for invalid date at product update
* Remove unnecessary imports
* Fix failing test in saleor 2552 (#1061)
* fix
* fix
* fix
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
Co-authored-by: Karolina <rakoczy.karolina@gmail.com>
2021-04-14 13:44:25 +00:00
|
|
|
channelsWithVariants,
|
|
|
|
channelsData,
|
2019-08-09 10:17:04 +00:00
|
|
|
category: maybe(() => product.category.id, ""),
|
2020-09-24 10:55:02 +00:00
|
|
|
changeTaxCode: !!product?.taxType.taxCode,
|
2019-08-09 10:17:04 +00:00
|
|
|
chargeTaxes: maybe(() => product.chargeTaxes, false),
|
|
|
|
collections: maybe(
|
|
|
|
() => product.collections.map(collection => collection.id),
|
|
|
|
[]
|
|
|
|
),
|
2021-10-01 12:41:31 +00:00
|
|
|
channelListings: currentChannels.map(listing => ({ ...listing })),
|
2020-09-03 10:25:16 +00:00
|
|
|
isAvailable: !!product?.isAvailable,
|
2020-08-28 12:45:11 +00:00
|
|
|
metadata: product?.metadata?.map(mapMetadataItemToInput),
|
2019-08-09 10:17:04 +00:00
|
|
|
name: maybe(() => product.name, ""),
|
2020-08-28 12:45:11 +00:00
|
|
|
privateMetadata: product?.privateMetadata?.map(mapMetadataItemToInput),
|
2020-11-19 17:07:42 +00:00
|
|
|
rating: maybe(() => product.rating, null),
|
2019-08-09 10:17:04 +00:00
|
|
|
seoDescription: maybe(() => product.seoDescription, ""),
|
|
|
|
seoTitle: maybe(() => product.seoTitle, ""),
|
2019-11-14 14:40:02 +00:00
|
|
|
sku: maybe(
|
|
|
|
() =>
|
|
|
|
product.productType.hasVariants
|
|
|
|
? undefined
|
|
|
|
: variants && variants[0]
|
|
|
|
? variants[0].sku
|
|
|
|
: undefined,
|
|
|
|
""
|
2019-08-09 10:17:04 +00:00
|
|
|
),
|
2020-09-18 14:40:48 +00:00
|
|
|
slug: product?.slug || "",
|
2020-09-23 08:29:13 +00:00
|
|
|
taxCode: product?.taxType.taxCode,
|
2021-10-01 12:41:31 +00:00
|
|
|
trackInventory: !!variant?.trackInventory,
|
|
|
|
weight: product?.weight?.value.toString() || "",
|
|
|
|
isPreorder: !!variant?.preorder || false,
|
|
|
|
globalThreshold: variant?.preorder?.globalThreshold || 0,
|
|
|
|
globalSoldUnits: variant?.preorder?.globalSoldUnits || 0,
|
|
|
|
hasPreorderEndDate: !!variant?.preorder?.endDate,
|
|
|
|
preorderEndDateTime: variant?.preorder?.endDate
|
2019-08-09 10:17:04 +00:00
|
|
|
};
|
|
|
|
}
|
2020-05-04 15:29:06 +00:00
|
|
|
|
|
|
|
export function mapFormsetStockToStockInput(
|
|
|
|
stock: FormsetAtomicData<null, string>
|
|
|
|
): StockInput {
|
|
|
|
return {
|
2020-10-13 11:29:42 +00:00
|
|
|
quantity: parseInt(stock.value, 10) || 0,
|
2020-05-04 15:29:06 +00:00
|
|
|
warehouse: stock.id
|
|
|
|
};
|
|
|
|
}
|
2021-10-01 12:41:31 +00:00
|
|
|
|
|
|
|
export const getPreorderEndDateFormData = (endDate?: string) =>
|
|
|
|
endDate ? moment(endDate).format("YYYY-MM-DD") : "";
|
|
|
|
|
|
|
|
export const getPreorderEndHourFormData = (endDate?: string) =>
|
|
|
|
endDate ? moment(endDate).format("HH:mm") : "";
|