From b9ee0cca4f4f99b441c58090c40601ec30294b5a Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 22 Feb 2021 14:34:46 -0800 Subject: [PATCH] Added ins co to 3rd party payer & expanded md_ins_co IO-546 --- bodyshop_translations.babel | 152 +++++++++++++++--- .../job-3rd-party-modal.component.jsx | 40 ++++- .../jobs-convert-button.component.jsx | 4 +- .../shop-info/shop-info.component.jsx | 132 +++++++++++++-- client/src/translations/en_us/common.json | 9 +- client/src/translations/es/common.json | 9 +- client/src/translations/fr/common.json | 9 +- 7 files changed, 314 insertions(+), 41 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 6a9106248..57e336529 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -3323,27 +3323,137 @@ - - md_ins_cos - false - - - - - - en-US - false - - - es-MX - false - - - fr-CA - false - - - + + md_ins_co + + + city + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + name + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + state + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + street1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + street2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + zip + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + md_payment_types false diff --git a/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx b/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx index 4c94cad48..e86c98733 100644 --- a/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx +++ b/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx @@ -1,14 +1,25 @@ import { useQuery } from "@apollo/react-hooks"; -import { Button, Form, Input, InputNumber, Modal, Radio } from "antd"; +import { Button, Form, Input, InputNumber, Modal, Radio, Select } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; import { SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR } from "../../graphql/vendors.queries"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; -export default function Jobd3RdPartyModal({ jobId }) { +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect(mapStateToProps, mapDispatchToProps)(Jobd3RdPartyModal); + +export function Jobd3RdPartyModal({ bodyshop, jobId }) { const [isModalVisible, setIsModalVisible] = useState(false); const { t } = useTranslation(); const [form] = Form.useForm(); @@ -42,6 +53,18 @@ export default function Jobd3RdPartyModal({ jobId }) { ); }; + const handleInsSelect = (value, option) => { + form.setFieldsValue({ + addr1: option.obj.name, + addr2: option.obj.street1, + addr3: option.obj.street2, + city: option.obj.city, + state: option.obj.state, + zip: option.obj.zip, + vendorid: null, + }); + }; + const handleVendorSelect = (vendorid, opt) => { const vendor = VendorAutoCompleteData.vendors.filter( (v) => v.id === vendorid @@ -54,6 +77,7 @@ export default function Jobd3RdPartyModal({ jobId }) { city: vendor.city, state: vendor.state, zip: vendor.zip, + ins_co_id: null, }); } }; @@ -76,6 +100,18 @@ export default function Jobd3RdPartyModal({ jobId }) { onSelect={handleVendorSelect} /> + + + diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx index 8511c292d..3ebd9797e 100644 --- a/client/src/components/shop-info/shop-info.component.jsx +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -569,6 +569,124 @@ export default function ShopInfoComponent({ form, saveLoading }) { ); }} + + + {(fields, { add, remove, move }) => { + return ( +
+ {fields.map((field, index) => ( + +
+ + + + + + + + + + + + + + + + + + + { + remove(field.name); + }} + /> + +
+
+ ))} + + + +
+ ); + }} +
+ - +