Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add taxes to create page
Krzysztof Bialoglowiczad464291fe6e
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsxindex d59b23daf3..95a3fe90d2 100644--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx@@ -9,7 +9,7 @@ import Grid from "@saleor/components/Grid";import PageHeader from "@saleor/components/PageHeader";import SaveButtonBar from "@saleor/components/SaveButtonBar";import i18n from "../../../i18n";-import { TaxRateType, WeightUnitsEnum } from "../../../types/globalTypes";+import { WeightUnitsEnum } from "../../../types/globalTypes";import ProductTypeDetails from "../ProductTypeDetails/ProductTypeDetails";import ProductTypeShipping from "../ProductTypeShipping/ProductTypeShipping";import ProductTypeTaxes from "../ProductTypeTaxes/ProductTypeTaxes";@@ -18,7 +18,10 @@ export interface ProductTypeForm {chargeTaxes: boolean;name: string;isShippingRequired: boolean;- taxRate: TaxRateType;+ taxType: {+ label: string;+ value: string;+ };weight: number;}@@ -31,6 +34,10 @@ export interface ProductTypeCreatePageProps {disabled: boolean;pageTitle: string;saveButtonBarState: ConfirmButtonTransitionState;+ taxTypes: Array<{+ description: string;+ taxCode: string;+ }>;onBack: () => void;onSubmit: (data: ProductTypeForm) => void;}@@ -43,6 +50,7 @@ const ProductTypeCreatePage: React.StatelessComponent<errors,pageTitle,saveButtonBarState,+ taxTypes,onBack,onSubmit}: ProductTypeCreatePageProps) => {@@ -50,7 +58,10 @@ const ProductTypeCreatePage: React.StatelessComponent<chargeTaxes: true,isShippingRequired: false,name: "",- taxRate: TaxRateType.STANDARD,+ taxType: {+ label: "",+ value: ""+ },weight: 0};return (@@ -83,6 +94,7 @@ const ProductTypeCreatePage: React.StatelessComponent<<ProductTypeTaxesdisabled={disabled}data={data}+ taxTypes={taxTypes}onChange={change}/></div>diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsxindex 51bc8cab01..31b542f9d9 100644--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx@@ -38,7 +38,7 @@ export const ProductTypeCreate: React.StatelessComponent = () => {hasVariants: false,isShippingRequired: formData.isShippingRequired,name: formData.name,- taxRate: formData.chargeTaxes ? formData.taxRate : null,+ taxCode: formData.taxType.value,weight: formData.weight}}@@ -60,6 +60,13 @@ export const ProductTypeCreate: React.StatelessComponent = () => {context: "page title"})}saveButtonBarState={loadingCreate ? "loading" : "default"}+ taxTypes={maybe(() => data.taxTypes, [+ {+ __typename: "TaxType",+ description: "",+ taxCode: ""+ }+ ])}onBack={() => navigate(productTypeListUrl())}onSubmit={handleCreate}/>diff --git a/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsxindex 6920a9b466..6112379ffb 100644--- a/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx@@ -15,7 +15,8 @@ const props: Omit<ProductTypeCreatePageProps, "classes"> = {onBack: () => undefined,onSubmit: () => undefined,pageTitle: "Create product type",- saveButtonBarState: "default"+ saveButtonBarState: "default",+ taxTypes: []};storiesOf("Views / Product types / Create product type", module)