From 7d6969b186837ec2480ef376ab90d5646a2dfbe3 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 09:52:02 -0800 Subject: [PATCH] Renamed some owner fields to follow CIECA standard. Work on Owner Select modal. --- bodyshop_translations.babel | 21 +++ client/package.json | 1 + client/src/App/App.container.jsx | 2 + client/src/App/App.test.js | 21 ++- .../components/alert/alert.component.test.js | 11 ++ .../jobs-available-new.component.jsx | 145 ++++++++++++------ .../jobs-available-new.container.jsx | 15 +- .../jobs-available-supplement.component.jsx | 3 +- .../jobs-available-supplement.container.jsx | 15 +- .../owner-find-modal.component.jsx | 4 + .../owner-find-modal.container.jsx | 23 +++ client/src/graphql/apollo-error-handling.js | 99 ++++++------ client/src/graphql/available-jobs.queries.js | 9 ++ client/src/graphql/jobs.queries.js | 10 ++ .../jobs-available.page.component.jsx | 18 ++- .../jobs-available.page.container.jsx | 30 +++- client/src/{setupTest.js => setupTests.js} | 3 +- client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + client/yarn.lock | 11 ++ .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 43 ++++++ .../up.yaml | 44 ++++++ .../down.yaml | 41 +++++ .../up.yaml | 42 +++++ .../down.yaml | 42 +++++ .../up.yaml | 44 ++++++ 49 files changed, 691 insertions(+), 135 deletions(-) create mode 100644 client/src/components/alert/alert.component.test.js create mode 100644 client/src/components/owner-find-modal/owner-find-modal.component.jsx create mode 100644 client/src/components/owner-find-modal/owner-find-modal.container.jsx rename client/src/{setupTest.js => setupTests.js} (67%) create mode 100644 hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/down.yaml create mode 100644 hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/up.yaml create mode 100644 hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/down.yaml create mode 100644 hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/up.yaml create mode 100644 hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/down.yaml create mode 100644 hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/up.yaml create mode 100644 hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/down.yaml create mode 100644 hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/up.yaml create mode 100644 hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/down.yaml create mode 100644 hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/up.yaml create mode 100644 hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/down.yaml create mode 100644 hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/up.yaml create mode 100644 hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/down.yaml create mode 100644 hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/up.yaml create mode 100644 hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/down.yaml create mode 100644 hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/up.yaml create mode 100644 hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/down.yaml create mode 100644 hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/up.yaml create mode 100644 hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/down.yaml create mode 100644 hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/up.yaml create mode 100644 hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/down.yaml create mode 100644 hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/up.yaml create mode 100644 hasura/migrations/1580319295873_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580319295873_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580319301454_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580319301454_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580319306963_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580319306963_update_permission_user_public_table_owners/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index e34457cbc..5ac9537b9 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -2635,6 +2635,27 @@ + + created + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + deleted false diff --git a/client/package.json b/client/package.json index 8223defa3..6485f4584 100644 --- a/client/package.json +++ b/client/package.json @@ -54,6 +54,7 @@ ] }, "devDependencies": { + "@apollo/react-testing": "^3.1.3", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.2" } diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index b9d91afa1..fa2168fce 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -126,6 +126,8 @@ class AppContainer extends Component { //Init local state. } + componentWillUnmount() {} + render() { const { client, loaded } = this.state; diff --git a/client/src/App/App.test.js b/client/src/App/App.test.js index a754b201b..945ec6f4a 100644 --- a/client/src/App/App.test.js +++ b/client/src/App/App.test.js @@ -1,9 +1,18 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App.container"; +import { MockedProvider } from "@apollo/react-testing"; +const div = document.createElement("div"); -it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); +it("renders without crashing", () => { + ReactDOM.render( + + + , + div + ); +}); + +it("unmounts without crashing", () => { ReactDOM.unmountComponentAtNode(div); }); diff --git a/client/src/components/alert/alert.component.test.js b/client/src/components/alert/alert.component.test.js new file mode 100644 index 000000000..4e850158f --- /dev/null +++ b/client/src/components/alert/alert.component.test.js @@ -0,0 +1,11 @@ +import React from "react"; +import ReactDOM from "react-dom"; +import Alert from "./alert.component"; +import { MockedProvider } from "@apollo/react-testing"; +import { shallow } from "enzyme"; + +const div = document.createElement("div"); + +it("renders without crashing", () => { + shallow(); +}); diff --git a/client/src/components/jobs-available-new/jobs-available-new.component.jsx b/client/src/components/jobs-available-new/jobs-available-new.component.jsx index 76db9474e..b34e6c5fa 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.component.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.component.jsx @@ -1,22 +1,29 @@ -import { Input, Table, Button, Icon, notification } from "antd"; +import { Input, Table, Button, Icon, notification, Modal } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { alphaSort } from "../../utils/sorters"; import { DateTimeFormatter } from "../../utils/DateFormatter"; +import OwnerFindModalContainer from "../owner-find-modal/owner-find-modal.container"; export default function JobsAvailableComponent({ loading, data, refetch, deleteJob, - deleteAllNewJobs + deleteAllNewJobs, + insertNewJob, + setJobId, + estDataLazyLoad }) { const { t } = useTranslation(); + const [loadEstData, estData] = estDataLazyLoad; const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); + const [modalVisible, setModalVisible] = useState(false); + const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; @@ -114,7 +121,10 @@ export default function JobsAvailableComponent({