From 73d41121239ebb1b9113bd47648c032987313c01 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 10 Mar 2020 18:13:31 -0700 Subject: [PATCH] Begin work on BOD-6 --- bodyshop_translations.babel | 257 ++++++++++++++++++ .../shop-info/shop-info.component.jsx | 60 ++++ .../shop-info/shop-info.container.jsx | 34 +++ client/src/pages/shop/shop.page.component.jsx | 3 +- client/src/translations/en_us/common.json | 14 + client/src/translations/es/common.json | 14 + client/src/translations/fr/common.json | 14 + 7 files changed, 395 insertions(+), 1 deletion(-) create mode 100644 client/src/components/shop-info/shop-info.component.jsx create mode 100644 client/src/components/shop-info/shop-info.container.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 7d2b6ffde..38d1dbc2c 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -762,6 +762,263 @@ + + fields + + + address1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + address2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + city + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + country + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + email + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + federal_tax_id + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + insurance_vendor_id + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + logo_img_path + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + shopname + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + state + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + state_tax_id + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + zip_post + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx new file mode 100644 index 000000000..1b2bf2921 --- /dev/null +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -0,0 +1,60 @@ +import React from "react"; +import { Form, Input, Button } from "antd"; +import { useTranslation } from "react-i18next"; + +export default function ShopInfoComponent() { + const { t } = useTranslation(); + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ); +} diff --git a/client/src/components/shop-info/shop-info.container.jsx b/client/src/components/shop-info/shop-info.container.jsx new file mode 100644 index 000000000..51ec79451 --- /dev/null +++ b/client/src/components/shop-info/shop-info.container.jsx @@ -0,0 +1,34 @@ +import React, { useEffect } from "react"; +import ShopInfoComponent from "./shop-info.component"; +import { Form } from "antd"; +import { useQuery } from "react-apollo"; +import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import AlertComponent from "../alert/alert.component"; + +export default function ShopInfoContainer() { + const [form] = Form.useForm(); + const handleFinish = values => { + console.log("values", values); + }; + + const { loading, error, data } = useQuery(QUERY_BODYSHOP, { + fetchPolicy: "network-only" + }); + + useEffect(() => { + if (data) form.resetFields(); + }, [form, data]); + + if (error) return ; + if (loading) return ; + return ( +
+ + + ); +} diff --git a/client/src/pages/shop/shop.page.component.jsx b/client/src/pages/shop/shop.page.component.jsx index 86e5acfe6..da3af6779 100644 --- a/client/src/pages/shop/shop.page.component.jsx +++ b/client/src/pages/shop/shop.page.component.jsx @@ -2,6 +2,7 @@ import { Tabs } from "antd"; import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import ShopEmployeesContainer from "../../components/shop-employees/shop-employees.container"; +import ShopInfoContainer from "../../components/shop-info/shop-info.container"; export default function ShopPage() { const { t } = useTranslation(); @@ -12,7 +13,7 @@ export default function ShopPage() { return ( - Shop INfo + diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 5a5217e66..317eb9b1c 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -67,6 +67,20 @@ "bodyshop": { "errors": { "loading": "Unable to load shop details. Please call technical support." + }, + "fields": { + "address1": "Address 1", + "address2": "Address 2", + "city": "City", + "country": "Country", + "email": "General Shop Email", + "federal_tax_id": "Federal Tax ID (GST/HST)", + "insurance_vendor_id": "Insurance Vendor ID", + "logo_img_path": "Shop Logo", + "shopname": "Shop Name", + "state": "State/Province", + "state_tax_id": "State Tax ID (PST, QST)", + "zip_post": "Zip/Postal Code" } }, "documents": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 724de8ac6..8b9ae2edc 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -67,6 +67,20 @@ "bodyshop": { "errors": { "loading": "No se pueden cargar los detalles de la tienda. Por favor llame al soporte técnico." + }, + "fields": { + "address1": "", + "address2": "", + "city": "", + "country": "", + "email": "", + "federal_tax_id": "", + "insurance_vendor_id": "", + "logo_img_path": "", + "shopname": "", + "state": "", + "state_tax_id": "", + "zip_post": "" } }, "documents": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index e089d22dc..3282ebcd0 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -67,6 +67,20 @@ "bodyshop": { "errors": { "loading": "Impossible de charger les détails de la boutique. Veuillez appeler le support technique." + }, + "fields": { + "address1": "", + "address2": "", + "city": "", + "country": "", + "email": "", + "federal_tax_id": "", + "insurance_vendor_id": "", + "logo_img_path": "", + "shopname": "", + "state": "", + "state_tax_id": "", + "zip_post": "" } }, "documents": {