Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add country list component
dominik-zeglenb34ad97d612f
diff --git a/package-lock.json b/package-lock.jsonindex 084d00e67f..e45118048d 100644--- a/package-lock.json+++ b/package-lock.json@@ -12794,14 +12794,12 @@"balanced-match": {"version": "1.0.0","bundled": true,- "dev": true,- "optional": true+ "dev": true},"brace-expansion": {"version": "1.1.11","bundled": true,"dev": true,- "optional": true,"requires": {"balanced-match": "^1.0.0","concat-map": "0.0.1"@@ -12816,20 +12814,17 @@"code-point-at": {"version": "1.1.0","bundled": true,- "dev": true,- "optional": true+ "dev": true},"concat-map": {"version": "0.0.1","bundled": true,- "dev": true,- "optional": true+ "dev": true},"console-control-strings": {"version": "1.1.0","bundled": true,- "dev": true,- "optional": true+ "dev": true},"core-util-is": {"version": "1.0.2",@@ -12946,8 +12941,7 @@"inherits": {"version": "2.0.3","bundled": true,- "dev": true,- "optional": true+ "dev": true},"ini": {"version": "1.3.5",@@ -12959,7 +12953,6 @@"version": "1.0.0","bundled": true,"dev": true,- "optional": true,"requires": {"number-is-nan": "^1.0.0"}@@ -12974,7 +12967,6 @@"version": "3.0.4","bundled": true,"dev": true,- "optional": true,"requires": {"brace-expansion": "^1.1.7"}@@ -12982,14 +12974,12 @@"minimist": {"version": "0.0.8","bundled": true,- "dev": true,- "optional": true+ "dev": true},"minipass": {"version": "2.2.4","bundled": true,"dev": true,- "optional": true,"requires": {"safe-buffer": "^5.1.1","yallist": "^3.0.0"@@ -13008,7 +12998,6 @@"version": "0.5.1","bundled": true,"dev": true,- "optional": true,"requires": {"minimist": "0.0.8"}@@ -13089,8 +13078,7 @@"number-is-nan": {"version": "1.0.1","bundled": true,- "dev": true,- "optional": true+ "dev": true},"object-assign": {"version": "4.1.1",@@ -13102,7 +13090,6 @@"version": "1.4.0","bundled": true,"dev": true,- "optional": true,"requires": {"wrappy": "1"}@@ -13224,7 +13211,6 @@"version": "1.0.2","bundled": true,"dev": true,- "optional": true,"requires": {"code-point-at": "^1.0.0","is-fullwidth-code-point": "^1.0.0",diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.jsindex 4ff7b9c29c..e7033e8026 100644--- a/saleor/static/dashboard-next/storybook/config.js+++ b/saleor/static/dashboard-next/storybook/config.js@@ -110,7 +110,7 @@ function loadStories() {require("./stories/siteSettings/SiteSettingsPage");// Taxes- require("./stories/taxes/TaxListPage");+ require("./stories/taxes/CountryListPage");}configure(loadStories, module);diff --git a/saleor/static/dashboard-next/storybook/stories/taxes/CountryListPage.tsx b/saleor/static/dashboard-next/storybook/stories/taxes/CountryListPage.tsxnew file mode 100644index 0000000000..708e91c3c5--- /dev/null+++ b/saleor/static/dashboard-next/storybook/stories/taxes/CountryListPage.tsx@@ -0,0 +1,27 @@+import { storiesOf } from "@storybook/react";+import * as React from "react";++import { pageListProps } from "../../../fixtures";+import CountryListPage, {+ CountryListPageProps+} from "../../../taxes/components/CountryListPage";+import Decorator from "../../Decorator";+import { countries } from "./fixtures";++const props: CountryListPageProps = {+ ...pageListProps.default,+ onSubmit: () => undefined,+ shop: {+ __typename: "Shop",+ countries,+ displayGrossPrices: true,+ includeTaxesInPrices: false+ }+};++storiesOf("Views / Taxes / Country List", module)+ .addDecorator(Decorator)+ .add("default", () => <CountryListPage {...props} />)+ .add("loading", () => (+ <CountryListPage {...props} shop={undefined} disabled={true} />+ ));diff --git a/saleor/static/dashboard-next/storybook/stories/taxes/TaxListPage.tsx b/saleor/static/dashboard-next/storybook/stories/taxes/TaxListPage.tsxdeleted file mode 100644index 641d363b92..0000000000--- a/saleor/static/dashboard-next/storybook/stories/taxes/TaxListPage.tsx+++ /dev/null@@ -1,14 +0,0 @@-import { storiesOf } from "@storybook/react";-import * as React from "react";--import TaxListPage, {- TaxListPageProps-} from "../../../taxes/components/TaxListPage";-import Decorator from "../../Decorator";--const props: TaxListPageProps = {};--storiesOf("Taxes / TaxListPage", module)- .addDecorator(Decorator)- .add("default", () => <TaxListPage {...props} />)- .add("loading", () => <TaxListPage {...props} taxes={undefined} />);diff --git a/saleor/static/dashboard-next/storybook/stories/taxes/fixtures.ts b/saleor/static/dashboard-next/storybook/stories/taxes/fixtures.tsnew file mode 100644index 0000000000..37951bc0d5--- /dev/null+++ b/saleor/static/dashboard-next/storybook/stories/taxes/fixtures.ts@@ -0,0 +1,1169 @@+import { CountryList_shop_countries } from "../../../taxes/types/CountryList";++type CountryList = CountryList_shop_countries[];++export const countries: CountryList = [+ {+ __typename: "CountryDisplay",+ code: "AT",+ country: "Austria",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 20+ }+ },+ {+ __typename: "CountryDisplay",+ code: "BE",+ country: "Belgia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ },+ {+ __typename: "ReducedRate",+ rateType: "water"+ }+ ],+ standardRate: 21+ }+ },+ {+ __typename: "CountryDisplay",+ code: "BG",+ country: "Bułgaria",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ }+ ],+ standardRate: 20+ }+ },+ {+ __typename: "CountryDisplay",+ code: "CY",+ country: "Cypr",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ }+ ],+ standardRate: 19+ }+ },+ {+ __typename: "CountryDisplay",+ code: "CZ",+ country: "Czechy",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "baby foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 21+ }+ },+ {+ __typename: "CountryDisplay",+ code: "DE",+ country: "Niemcy",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ }+ ],+ standardRate: 19+ }+ },+ {+ __typename: "CountryDisplay",+ code: "DK",+ country: "Dania",+ vat: {+ __typename: "VAT",+ reducedRates: [],+ standardRate: 25+ }+ },+ {+ __typename: "CountryDisplay",+ code: "EE",+ country: "Estonia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 20+ }+ },+ {+ __typename: "CountryDisplay",+ code: "ES",+ country: "Hiszpania",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 21+ }+ },+ {+ __typename: "CountryDisplay",+ code: "FI",+ country: "Finlandia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ }+ ],+ standardRate: 24+ }+ },+ {+ __typename: "CountryDisplay",+ code: "FR",+ country: "Francja",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "accommodation"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "e-books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ }+ ],+ standardRate: 20+ }+ },+ {+ __typename: "CountryDisplay",+ code: "GB",+ country: "Wielka Brytania",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "childrens clothing"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "property renovations"+ }+ ],+ standardRate: 20+ }+ },+ {+ __typename: "CountryDisplay",+ code: "GR",+ country: "Grecja",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 24+ }+ },+ {+ __typename: "CountryDisplay",+ code: "HR",+ country: "Chorwacja",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ }+ ],+ standardRate: 25+ }+ },+ {+ __typename: "CountryDisplay",+ code: "HU",+ country: "Węgry",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 27+ }+ },+ {+ __typename: "CountryDisplay",+ code: "IE",+ country: "Irlandia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "childrens clothing"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ }+ ],+ standardRate: 23+ }+ },+ {+ __typename: "CountryDisplay",+ code: "IT",+ country: "Włochy",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "e-books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ }+ ],+ standardRate: 22+ }+ },+ {+ __typename: "CountryDisplay",+ code: "LT",+ country: "Litwa",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 21+ }+ },+ {+ __typename: "CountryDisplay",+ code: "LU",+ country: "Luksemburg",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "advertising"+ },+ {+ __typename: "ReducedRate",+ rateType: "bikes"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "domestic fuel"+ },+ {+ __typename: "ReducedRate",+ rateType: "domestic services"+ },+ {+ __typename: "ReducedRate",+ rateType: "e-books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ },+ {+ __typename: "ReducedRate",+ rateType: "wine"+ }+ ],+ standardRate: 17+ }+ },+ {+ __typename: "CountryDisplay",+ code: "LV",+ country: "Łotwa",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 21+ }+ },+ {+ __typename: "CountryDisplay",+ code: "MT",+ country: "Malta",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "e-books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 18+ }+ },+ {+ __typename: "CountryDisplay",+ code: "NL",+ country: "Holandia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "accommodation"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 21+ }+ },+ {+ __typename: "CountryDisplay",+ code: "PL",+ country: "Polska",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "restaurants"+ }+ ],+ standardRate: 23+ }+ },+ {+ __typename: "CountryDisplay",+ code: "PT",+ country: "Portugalia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "agricultural supplies"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "passenger transport"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 23+ }+ },+ {+ __typename: "CountryDisplay",+ code: "RO",+ country: "Rumunia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ },+ {+ __typename: "ReducedRate",+ rateType: "social housing"+ }+ ],+ standardRate: 19+ }+ },+ {+ __typename: "CountryDisplay",+ code: "SE",+ country: "Szwecja",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ }+ ],+ standardRate: 25+ }+ },+ {+ __typename: "CountryDisplay",+ code: "SI",+ country: "Słowenia",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to sporting events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "hotels"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "newspapers"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 22+ }+ },+ {+ __typename: "CountryDisplay",+ code: "SK",+ country: "Słowacja",+ vat: {+ __typename: "VAT",+ reducedRates: [+ {+ __typename: "ReducedRate",+ rateType: "admission to cultural events"+ },+ {+ __typename: "ReducedRate",+ rateType: "admission to entertainment events"+ },+ {+ __typename: "ReducedRate",+ rateType: "books"+ },+ {+ __typename: "ReducedRate",+ rateType: "foodstuffs"+ },+ {+ __typename: "ReducedRate",+ rateType: "medical"+ },+ {+ __typename: "ReducedRate",+ rateType: "pharmaceuticals"+ }+ ],+ standardRate: 20+ }+ }+];diff --git a/saleor/static/dashboard-next/taxes/components/CountryList/CountryList.tsx b/saleor/static/dashboard-next/taxes/components/CountryList/CountryList.tsxnew file mode 100644index 0000000000..8c9c1419cb--- /dev/null+++ b/saleor/static/dashboard-next/taxes/components/CountryList/CountryList.tsx@@ -0,0 +1,88 @@+import Card from "@material-ui/core/Card";+import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";+import Table from "@material-ui/core/Table";+import TableBody from "@material-ui/core/TableBody";+import TableCell from "@material-ui/core/TableCell";+import TableFooter from "@material-ui/core/TableFooter";+import TableHead from "@material-ui/core/TableHead";+import TableRow from "@material-ui/core/TableRow";+import * as classNames from "classnames";+import * as React from "react";++import Skeleton from "../../../components/Skeleton";+import i18n from "../../../i18n";+import { maybe, renderCollection } from "../../../misc";+import { CountryList_shop_countries } from "../../types/CountryList";++const styles = createStyles({+ tableRow: {+ cursor: "pointer"+ },+ textRight: {+ textAlign: "right"+ }+});++interface CountryListProps extends WithStyles<typeof styles> {+ countries: CountryList_shop_countries[];+ onRowClick: (code: string) => void;+}++const CountryList = withStyles(styles, { name: "CountryList" })(+ ({ classes, onRowClick, countries }: CountryListProps) => (+ <Card>+ <Table>+ <TableHead>+ <TableRow>+ <TableCell>+ {i18n.t("Country Code", { context: "object" })}+ </TableCell>+ <TableCell>+ {i18n.t("Country Name", { context: "object" })}+ </TableCell>+ <TableCell className={classes.textRight}>+ {i18n.t("No of Reduced Tax Rates", { context: "object" })}+ </TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {renderCollection(+ countries,+ country => (+ <TableRow+ className={classNames({+ [classes.tableRow]: !!country+ })}+ hover={!!country}+ onClick={!!country ? () => onRowClick(country.code) : undefined}+ key={country ? country.code : "skeleton"}+ >+ <TableCell>+ {maybe<React.ReactNode>(() => country.code, <Skeleton />)}+ </TableCell>+ <TableCell>+ {maybe<React.ReactNode>(() => country.country, <Skeleton />)}+ </TableCell>+ <TableCell className={classes.textRight}>+ {maybe<React.ReactNode>(+ () => country.vat.reducedRates.length,+ <Skeleton />+ )}+ </TableCell>+ </TableRow>+ ),+ () => (+ <TableRow>+ <TableCell colSpan={3}>+ {i18n.t("No countries found")}+ </TableCell>+ </TableRow>+ )+ )}+ </TableBody>+ </Table>+ </Card>+ )+);+CountryList.displayName = "CountryList";+export default CountryList;diff --git a/saleor/static/dashboard-next/taxes/components/CountryList/index.ts b/saleor/static/dashboard-next/taxes/components/CountryList/index.tsnew file mode 100644index 0000000000..3ad707c62a--- /dev/null+++ b/saleor/static/dashboard-next/taxes/components/CountryList/index.ts@@ -0,0 +1,2 @@+export { default } from "./CountryList";+export * from "./CountryList";diff --git a/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsx b/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsxnew file mode 100644index 0000000000..cbc954826e--- /dev/null+++ b/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsx@@ -0,0 +1,83 @@+import {+ createStyles,+ Theme,+ withStyles,+ WithStyles+} from "@material-ui/core/styles";+import * as React from "react";++import { Container } from "../../../components/Container";+import Form from "../../../components/Form";+import PageHeader from "../../../components/PageHeader";+import i18n from "../../../i18n";+import { maybe } from "../../../misc";+import { CountryList_shop } from "../../types/CountryList";+import CountryList from "../CountryList";+import TaxConfiguration from "../TaxConfiguration";++const styles = (theme: Theme) =>+ createStyles({+ root: {+ display: "grid",+ gridColumnGap: theme.spacing.unit * 2 + "px",+ gridTemplateColumns: "9fr 4fr"+ }+ });++export interface FormData {+ includeTax: boolean;+ showGross: boolean;+ chargeTaxesOnShipping: boolean;+}+export interface CountryListPageProps {+ disabled: boolean;+ shop: CountryList_shop;+ onRowClick: (code: string) => void;+ onSubmit: (data: FormData) => void;+ onTaxFetch: () => void;+}++const CountryListPage = withStyles(styles, { name: "CountryListPage" })(+ ({+ classes,+ disabled,+ shop,+ onRowClick,+ onSubmit,+ onTaxFetch+ }: CountryListPageProps & WithStyles<typeof styles>) => {+ const initialForm: FormData = {+ // chargeTaxesOnShipping: maybe(() => shop.chargeTaxesOnShipping),+ chargeTaxesOnShipping: false,+ includeTax: maybe(() => shop.includeTaxesInPrices),+ showGross: maybe(() => shop.displayGrossPrices)+ };+ return (+ <Form initial={initialForm} onSubmit={onSubmit}>+ {({ change, data, submit }) => (+ <Container width="md">+ <PageHeader title={i18n.t("Taxes", { context: "page title" })} />+ <div className={classes.root}>+ <div>+ <CountryList+ countries={maybe(() => shop.countries)}+ onRowClick={onRowClick}+ />+ </div>+ <div>+ <TaxConfiguration+ data={data}+ disabled={disabled}+ onChange={event => change(event, submit)}+ onTaxFetch={onTaxFetch}+ />+ </div>+ </div>+ </Container>+ )}+ </Form>+ );+ }+);+CountryListPage.displayName = "CountryListPage";+export default CountryListPage;diff --git a/saleor/static/dashboard-next/taxes/components/CountryListPage/index.ts b/saleor/static/dashboard-next/taxes/components/CountryListPage/index.tsnew file mode 100644index 0000000000..612d90e688--- /dev/null+++ b/saleor/static/dashboard-next/taxes/components/CountryListPage/index.ts@@ -0,0 +1,2 @@+export { default } from "./CountryListPage";+export * from "./CountryListPage";diff --git a/saleor/static/dashboard-next/taxes/components/TaxConfiguration/TaxConfiguration.tsx b/saleor/static/dashboard-next/taxes/components/TaxConfiguration/TaxConfiguration.tsxnew file mode 100644index 0000000000..aa5f76eac2--- /dev/null+++ b/saleor/static/dashboard-next/taxes/components/TaxConfiguration/TaxConfiguration.tsx@@ -0,0 +1,78 @@+import Button from "@material-ui/core/Button";+import Card from "@material-ui/core/Card";+import CardActions from "@material-ui/core/CardActions";+import CardContent from "@material-ui/core/CardContent";+import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";+import * as React from "react";++import CardTitle from "../../../components/CardTitle";+import ControlledSwitch from "../../../components/ControlledSwitch";+import FormSpacer from "../../../components/FormSpacer";+import Hr from "../../../components/Hr";+import i18n from "../../../i18n";+import { FormData } from "../CountryListPage";++interface TaxConfigurationProps {+ data: FormData;+ disabled: boolean;+ onChange: (event: React.ChangeEvent<any>) => void;+ onTaxFetch: () => void;+}++const styles = createStyles({+ content: {+ paddingBottom: 0+ }+});++export const TaxConfiguration = withStyles(styles, {+ name: "TaxConfiguration"+})(+ ({+ classes,+ data,+ disabled,+ onChange,+ onTaxFetch+ }: TaxConfigurationProps & WithStyles<typeof styles>) => (+ <Card>+ <CardTitle title={i18n.t("Configuration")} />+ <CardContent className={classes.content}>+ <ControlledSwitch+ disabled={disabled}+ name={"includeTax" as keyof FormData}+ label={i18n.t("All products prices are entered with tax included")}+ onChange={onChange}+ checked={data.includeTax}+ />+ <ControlledSwitch+ disabled={disabled}+ name={"showGross" as keyof FormData}+ label={i18n.t("Show gross prices to customers in the storefront")}+ onChange={onChange}+ checked={data.showGross}+ />+ <ControlledSwitch+ disabled={disabled}+ name={"chargeTaxesOnShipping" as keyof FormData}+ label={i18n.t("Charge taxes on shipping rates")}+ onChange={onChange}+ checked={data.chargeTaxesOnShipping}+ />+ <FormSpacer />+ </CardContent>+ <Hr />+ <CardActions>+ <Button+ disabled={disabled}+ onClick={onTaxFetch}+ variant="flat"+ color="secondary"+ >+ {i18n.t("Fetch taxes")}+ </Button>+ </CardActions>+ </Card>+ )+);+export default TaxConfiguration;diff --git a/saleor/static/dashboard-next/taxes/components/TaxConfiguration/index.ts b/saleor/static/dashboard-next/taxes/components/TaxConfiguration/index.tsnew file mode 100644index 0000000000..696db388ac--- /dev/null+++ b/saleor/static/dashboard-next/taxes/components/TaxConfiguration/index.ts@@ -0,0 +1,2 @@+export { default } from "./TaxConfiguration";+export * from "./TaxConfiguration";diff --git a/saleor/static/dashboard-next/taxes/components/TaxList/TaxList.tsx b/saleor/static/dashboard-next/taxes/components/TaxList/TaxList.tsxdeleted file mode 100644index 811aab918c..0000000000--- a/saleor/static/dashboard-next/taxes/components/TaxList/TaxList.tsx+++ /dev/null@@ -1,9 +0,0 @@-import { withStyles } from "@material-ui/core/styles";-import * as React from "react";--export interface TaxListProps {}--const decorate = withStyles(theme => ({ root: {} }));-const TaxList = decorate<TaxListProps>(({ classes }) => <div />);-TaxList.displayName = "TaxList";-export default TaxList;diff --git a/saleor/static/dashboard-next/taxes/components/TaxList/index.ts b/saleor/static/dashboard-next/taxes/components/TaxList/index.tsdeleted file mode 100644index 8ffe988457..0000000000--- a/saleor/static/dashboard-next/taxes/components/TaxList/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./TaxList";-export * from "./TaxList";diff --git a/saleor/static/dashboard-next/taxes/components/TaxListPage/TaxListPage.tsx b/saleor/static/dashboard-next/taxes/components/TaxListPage/TaxListPage.tsxdeleted file mode 100644index 12b61fc4c6..0000000000--- a/saleor/static/dashboard-next/taxes/components/TaxListPage/TaxListPage.tsx+++ /dev/null@@ -1,33 +0,0 @@-import * as React from "react";--import { ListProps } from "../../../types";-import Container from "../../../components/Container";-import PageHeader from "../../../components/PageHeader";-import i18n from "../../../i18n";--export interface TaxListPageProps extends ListProps {- taxes: any[];-}--const TaxListPage: React.StatelessComponent<TaxListPageProps> = ({- disabled,- pageInfo,- taxes,- onNextPage,- onPreviousPage,- onRowClick-}) => (- <Container width="md">- <PageHeader title={i18n.t("Staff members", { context: "page title" })} />- <TaxList- disabled={disabled}- pageInfo={pageInfo}- taxes={taxes}- onNextPage={onNextPage}- onPreviousPage={onPreviousPage}- onRowClick={onRowClick}- />- </Container>-);-TaxListPage.displayName = "TaxListPage";-export default TaxListPage;diff --git a/saleor/static/dashboard-next/taxes/components/TaxListPage/index.ts b/saleor/static/dashboard-next/taxes/components/TaxListPage/index.tsdeleted file mode 100644index 4c3e69ec45..0000000000--- a/saleor/static/dashboard-next/taxes/components/TaxListPage/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./TaxListPage";-export * from "./TaxListPage";diff --git a/saleor/static/dashboard-next/taxes/queries.ts b/saleor/static/dashboard-next/taxes/queries.tsnew file mode 100644index 0000000000..ea059b2053--- /dev/null+++ b/saleor/static/dashboard-next/taxes/queries.ts@@ -0,0 +1,23 @@+import gql from "graphql-tag";+import { TypedQuery } from "../queries";+import { CountryList } from "./types/CountryList";++const countryList = gql`+ query CountryList {+ shop {+ countries {+ country+ code+ vat {+ standardRate+ reducedRates {+ rateType+ }+ }+ }+ displayGrossPrices+ includeTaxesInPrices+ }+ }+`;+export const TypedCountryListQuery = TypedQuery<CountryList, {}>(countryList);diff --git a/saleor/static/dashboard-next/taxes/types/CountryList.ts b/saleor/static/dashboard-next/taxes/types/CountryList.tsnew file mode 100644index 0000000000..72087e9000--- /dev/null+++ b/saleor/static/dashboard-next/taxes/types/CountryList.ts@@ -0,0 +1,35 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL query operation: CountryList+// ====================================================++export interface CountryList_shop_countries_vat_reducedRates {+ __typename: "ReducedRate";+ rateType: string;+}++export interface CountryList_shop_countries_vat {+ __typename: "VAT";+ standardRate: number | null;+ reducedRates: (CountryList_shop_countries_vat_reducedRates | null)[] | null;+}++export interface CountryList_shop_countries {+ __typename: "CountryDisplay";+ country: string;+ code: string;+ vat: CountryList_shop_countries_vat | null;+}++export interface CountryList_shop {+ __typename: "Shop";+ countries: (CountryList_shop_countries | null)[];+ displayGrossPrices: boolean | null;+ includeTaxesInPrices: boolean | null;+}++export interface CountryList {+ shop: CountryList_shop | null;+}