From 554a8f6170ec73f1081a11c5b80bdcfd931b9e6f Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 27 Aug 2020 16:25:37 -0700 Subject: [PATCH] Resolved contracts list not showing correct entries based on dates. BOD-313. Added changes not saved indicator to shop info BOD-325 --- bodyshop_translations.babel | 42 +++++++++++++++++++ .../contracts-list.component.jsx | 2 +- .../shop-info/shop-info.container.jsx | 11 +++-- client/src/graphql/cccontracts.queries.js | 8 +++- .../contracts/contracts.page.container.jsx | 7 +++- client/src/translations/en_us/common.json | 4 +- client/src/translations/es/common.json | 4 +- client/src/translations/fr/common.json | 4 +- 8 files changed, 71 insertions(+), 11 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 9d85f2a45..62cd2bdef 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -4300,6 +4300,27 @@ + + vehicle + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + waitingforscan false @@ -6240,6 +6261,27 @@ + + user_email + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + diff --git a/client/src/components/contracts-list/contracts-list.component.jsx b/client/src/components/contracts-list/contracts-list.component.jsx index e9e9e2944..1a37b2ccb 100644 --- a/client/src/components/contracts-list/contracts-list.component.jsx +++ b/client/src/components/contracts-list/contracts-list.component.jsx @@ -55,7 +55,7 @@ export default function ContractsList({ loading, contracts, refetch, total }) { `${record.driver_fn || ""} ${record.driver_ln || ""}`, }, { - title: t("contracts.fields.vehicle"), + title: t("contracts.labels.vehicle"), dataIndex: "vehicle", key: "vehicle", //sorter: (a, b) => alphaSort(a.status, b.status), diff --git a/client/src/components/shop-info/shop-info.container.jsx b/client/src/components/shop-info/shop-info.container.jsx index 8bd6ed8d4..2d2646f30 100644 --- a/client/src/components/shop-info/shop-info.container.jsx +++ b/client/src/components/shop-info/shop-info.container.jsx @@ -7,6 +7,7 @@ import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import AlertComponent from "../alert/alert.component"; import { useTranslation } from "react-i18next"; import { logImEXEvent } from "../../firebase/firebase.utils"; +import FormsFieldChanged from "../form-fields-changed-alert/form-fields-changed-alert.component"; export default function ShopInfoContainer() { const [form] = Form.useForm(); @@ -40,15 +41,17 @@ export default function ShopInfoContainer() { if (data) form.resetFields(); }, [form, data]); - if (error) return ; + if (error) return ; if (loading) return ; return (
+ initialValues={data ? data.bodyshops[0] : null} + > + ); diff --git a/client/src/graphql/cccontracts.queries.js b/client/src/graphql/cccontracts.queries.js index bc0cc182d..cd702f430 100644 --- a/client/src/graphql/cccontracts.queries.js +++ b/client/src/graphql/cccontracts.queries.js @@ -136,7 +136,13 @@ export const QUERY_ACTIVE_CONTRACTS_PAGINATED = gql` offset: $offset limit: $limit order_by: $order - where: { actualreturn: { _lte: $end }, start: { _gte: $start } } + where: { + _or: [ + { actualreturn: { _lte: $end } } + { actualreturn: { _is_null: true } } + ] + start: { _gte: $start } + } ) { agreementnumber courtesycarid diff --git a/client/src/pages/contracts/contracts.page.container.jsx b/client/src/pages/contracts/contracts.page.container.jsx index e1eeb04a9..73810569a 100644 --- a/client/src/pages/contracts/contracts.page.container.jsx +++ b/client/src/pages/contracts/contracts.page.container.jsx @@ -18,14 +18,17 @@ const mapDispatchToProps = (dispatch) => ({ export function ContractsPageContainer({ setBreadcrumbs }) { const searchParams = queryString.parse(useLocation().search); const { page, sortcolumn, sortorder, start, end } = searchParams; + console.log("ContractsPageContainer -> searchParams", searchParams); const { loading, error, data, refetch } = useQuery( QUERY_ACTIVE_CONTRACTS_PAGINATED, { variables: { //search: search || "", - start: start ? moment(start) : null, - end: end ? moment(end) : null, + start: start + ? moment(start) + : moment().startOf("week").subtract(7, "days"), + end: end ? moment(end) : moment().endOf("week"), offset: page ? (page - 1) * 25 : 0, limit: 25, order: [ diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 625ce00c1..ad5edc128 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -262,6 +262,7 @@ }, "correctdataonform": "Please review the information above. If any of it is not correct, you can fix it later.", "noteconvertedfrom": "R.O. created from converted Courtesy Car Contract {{agreementnumber}}.", + "vehicle": "Vehicle", "waitingforscan": "Please scan driver's license barcode..." }, "status": { @@ -408,7 +409,8 @@ "flat_rate": "Flat Rate (Disabled is Straight Time)", "hire_date": "Hire Date", "last_name": "Last Name", - "termination_date": "Termination Date" + "termination_date": "Termination Date", + "user_email": "User Email" }, "labels": { "actions": "Actions" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index b21708348..23abea879 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -262,6 +262,7 @@ }, "correctdataonform": "", "noteconvertedfrom": "", + "vehicle": "", "waitingforscan": "" }, "status": { @@ -408,7 +409,8 @@ "flat_rate": "Tarifa plana (deshabilitado es tiempo recto)", "hire_date": "Fecha de contratación", "last_name": "Apellido", - "termination_date": "Fecha de conclusión" + "termination_date": "Fecha de conclusión", + "user_email": "" }, "labels": { "actions": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 2630ee048..04a031025 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -262,6 +262,7 @@ }, "correctdataonform": "", "noteconvertedfrom": "", + "vehicle": "", "waitingforscan": "" }, "status": { @@ -408,7 +409,8 @@ "flat_rate": "Taux fixe (désactivé est le temps normal)", "hire_date": "Date d'embauche", "last_name": "Nom de famille", - "termination_date": "Date de résiliation" + "termination_date": "Date de résiliation", + "user_email": "" }, "labels": { "actions": ""