From d422edcb0e6bd9b2367b9227d55a29bf3922f038 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 6 Feb 2020 16:33:23 -0800 Subject: [PATCH] Added status changing information --- bodyshop_translations.babel | 52 +++++++++++++++++++ client/src/App/App.js | 7 +-- .../jobs-detail-header.component.jsx | 44 ++++++++++++++-- client/src/graphql/bodyshop.queries.js | 1 + client/src/graphql/jobs.queries.js | 10 ++++ .../jobs-detail.page.component.jsx | 4 +- .../jobs-detail.page.container.jsx | 6 ++- client/src/pages/manage/manage.page.jsx | 33 ++++++++++-- client/src/redux/user/user.actions.js | 5 ++ client/src/redux/user/user.reducer.js | 6 ++- client/src/redux/user/user.selectors.js | 5 ++ client/src/redux/user/user.types.js | 3 +- client/src/translations/en_us/common.json | 6 +++ client/src/translations/es/common.json | 6 +++ client/src/translations/fr/common.json | 6 +++ 15 files changed, 176 insertions(+), 18 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 5082e9758..6bae095d9 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -420,6 +420,37 @@ + + bodyshop + + + errors + + + loading + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + documents @@ -1069,6 +1100,27 @@ + + changestatus + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + convert false diff --git a/client/src/App/App.js b/client/src/App/App.js index 5bf9734bb..a552fb31b 100644 --- a/client/src/App/App.js +++ b/client/src/App/App.js @@ -28,14 +28,15 @@ const mapDispatchToProps = dispatch => ({ export default connect( mapStateToProps, mapDispatchToProps -)(({ checkUserSession, currentUser }) => { +)(({ checkUserSession, currentUser, setBodyshop }) => { + useEffect(() => { checkUserSession(); return () => {}; }, [checkUserSession]); - if (false) - i18next.changeLanguage("en_US", (err, t) => { + if (currentUser && currentUser.language) + i18next.changeLanguage(currentUser.language, (err, t) => { if (err) return console.log("Error encountered when changing languages.", err); }); diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx index 34719d9e3..aeae31c8b 100644 --- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx +++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx @@ -1,26 +1,41 @@ import { Avatar, + Badge, Button, Checkbox, Descriptions, + Dropdown, + Icon, + Menu, notification, PageHeader, - Tag, - Badge + Tag } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import Moment from "react-moment"; +import { connect } from "react-redux"; import { Link } from "react-router-dom"; +import { createStructuredSelector } from "reselect"; import CarImage from "../../assets/car.svg"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; -export default function JobsDetailHeader({ +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop +}); + +export default connect( + mapStateToProps, + null +)(function JobsDetailHeader({ job, mutationConvertJob, refetch, handleSubmit, - scheduleModalState + scheduleModalState, + bodyshop, + updateJobStatus }) { const { t } = useTranslation(); const setscheduleModalVisible = scheduleModalState[1]; @@ -60,7 +75,26 @@ export default function JobsDetailHeader({ ); + const statusmenu = ( + { + updateJobStatus({ + variables: { jobId: job.id, status: e.key } + }).then(r => refetch()); + }} + > + {bodyshop.md_ro_statuses.statuses.map(item => ( + {item} + ))} + + ); + const menuExtra = [ + + + ,