From 9ae3843b3b7386637115f515fff111431f306798 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 30 Mar 2020 17:27:33 -0700 Subject: [PATCH] BOD-17 Creation of new contract page --- bodyshop_translations.babel | 472 ++++++++++++++++++ client/package.json | 1 + .../contract-form/contract-form.component.jsx | 287 +++++++++++ .../contract-create.page.component.jsx | 10 + .../contract-create.page.container.jsx | 38 ++ .../courtesy-car-create.page.component.jsx | 4 +- .../pages/manage/manage.page.component.jsx | 5 +- client/src/translations/en_us/common.json | 26 + client/src/translations/es/common.json | 26 + client/src/translations/fr/common.json | 26 + client/yarn.lock | 7 + 11 files changed, 899 insertions(+), 3 deletions(-) create mode 100644 client/src/components/contract-form/contract-form.component.jsx create mode 100644 client/src/pages/contract-create/contract-create.page.component.jsx create mode 100644 client/src/pages/contract-create/contract-create.page.container.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 305ebea9c..68b506d67 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1975,6 +1975,457 @@ + + contracts + + + fields + + + actualreturn + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + cc_cardholder + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + cc_expiry + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + cc_num + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_addr1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_addr2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_city + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_dlexpiry + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_dlnumber + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_dlst + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_dob + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_fn + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_ln + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_ph1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_state + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + driver_zip + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + kmend + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + kmstart + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + scheduledreturn + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + start + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + status + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + courtesycars @@ -9530,6 +9981,27 @@ + + contracts-create + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + courtesycars-create false diff --git a/client/package.json b/client/package.json index 291097304..817621cd2 100644 --- a/client/package.json +++ b/client/package.json @@ -8,6 +8,7 @@ "@ckeditor/ckeditor5-react": "^2.1.0", "@nivo/pie": "^0.61.1", "@tanem/react-nprogress": "^3.0.19", + "aamva": "^1.2.0", "antd": "^4.0.4", "apollo-boost": "^0.4.4", "apollo-link-context": "^1.0.19", diff --git a/client/src/components/contract-form/contract-form.component.jsx b/client/src/components/contract-form/contract-form.component.jsx new file mode 100644 index 000000000..7f8fdb73f --- /dev/null +++ b/client/src/components/contract-form/contract-form.component.jsx @@ -0,0 +1,287 @@ +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { Form, Input, DatePicker, InputNumber, Button } from "antd"; +import aamva from "aamva"; + +export default function ContractFormComponent() { + const [state, setState] = useState(""); + const { t } = useTranslation(); + return ( +
+ setState(e.target.value)} /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ); +} diff --git a/client/src/pages/contract-create/contract-create.page.component.jsx b/client/src/pages/contract-create/contract-create.page.component.jsx new file mode 100644 index 000000000..750ac7793 --- /dev/null +++ b/client/src/pages/contract-create/contract-create.page.component.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import ContractFormComponent from "../../components/contract-form/contract-form.component"; + +export default function ContractCreatePageComponent() { + return ( +
+ +
+ ); +} diff --git a/client/src/pages/contract-create/contract-create.page.container.jsx b/client/src/pages/contract-create/contract-create.page.container.jsx new file mode 100644 index 000000000..2947e7f59 --- /dev/null +++ b/client/src/pages/contract-create/contract-create.page.container.jsx @@ -0,0 +1,38 @@ +import React, { useEffect } from "react"; + +import ContractCreatePageComponent from "./contract-create.page.component"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import { Form, notification } from "antd"; +import { useTranslation } from "react-i18next"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop +}); + +export function ContractCreatePageContainer({ bodyshop }) { + const [form] = Form.useForm(); + const { t } = useTranslation(); + + const handleFinish = values => { + // insertCourtesyCar({ + // variables: { courtesycar: { ...values, bodyshopid: bodyshop.id } } + // }) + // .then(response => { + notification["success"]({ message: t("courtesycars.successes.saved") }); + // }) + // .catch(error => console.log("error", error)); + }; + + useEffect(() => { + document.title = t("titles.contracts-create"); + }, [t]); + + return ( +
+ + + ); +} +export default connect(mapStateToProps, null)(ContractCreatePageContainer); diff --git a/client/src/pages/courtesy-car-create/courtesy-car-create.page.component.jsx b/client/src/pages/courtesy-car-create/courtesy-car-create.page.component.jsx index a9c15e7d3..4f5b8b75a 100644 --- a/client/src/pages/courtesy-car-create/courtesy-car-create.page.component.jsx +++ b/client/src/pages/courtesy-car-create/courtesy-car-create.page.component.jsx @@ -1,6 +1,6 @@ import React from "react"; -import CourtesyCarCreateFormComponent from "../../components/courtesy-car-form/courtesy-car-form.component" +import CourtesyCarFormComponent from "../../components/courtesy-car-form/courtesy-car-form.component" export default function CourtesyCarCreateComponent() { - return ; + return ; } diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 842e03150..0175ea813 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -55,6 +55,9 @@ const CourtesyCarDetailContainer = lazy(() => const CourtesyCarsPage = lazy(() => import("../courtesy-cars/courtesy-cars.page.container") ); +const ContractCreatePage = lazy(() => + import("../contract-create/contract-create.page.container") +); const { Header, Content, Footer } = Layout; @@ -117,7 +120,7 @@ export default function Manage({ match }) {
new cc contract
} + component={ContractCreatePage} />