From 3ee003000d42658809f6dbea62cd23c23ee91472 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 28 Sep 2020 14:00:35 -0700 Subject: [PATCH] WIP Read Only for Jobs BOD-409 --- bodyshop_translations.babel | 63 ++++++++++++++++ .../bills-list-table.component.jsx | 24 ++++-- .../job-calculate-totals.component.jsx | 12 +-- .../job-detail-lines/job-lines.component.jsx | 24 +++++- .../job-employee-assignments.component.jsx | 35 ++++++--- .../job-line-location-popup.component.jsx | 4 +- .../job-line-note-popup.component.jsx | 4 +- .../job-totals-table.component.jsx | 8 +- .../jobs-change-status.component.jsx | 7 +- .../jobs-convert-button.component.jsx | 8 +- .../jobs-detail-general.component.jsx | 71 +++++++++--------- .../jobs-detail-header-actions.component.jsx | 27 +++++-- .../jobs-detail-header.component.jsx | 10 +-- ...s-detail-rates-change-button.component.jsx | 4 +- .../jobs-detail-rates.component.jsx | 74 ++++++++++--------- .../jobs-detail-totals.component.jsx | 4 + ...-order-line-backorder-button.component.jsx | 8 +- .../parts-order-list-table.component.jsx | 7 +- .../jobs-detail.page.component.jsx | 4 +- client/src/translations/en_us/common.json | 3 + client/src/translations/es/common.json | 3 + client/src/translations/fr/common.json | 3 + 22 files changed, 278 insertions(+), 129 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 015ec230c..5d64fdcc6 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -13439,6 +13439,27 @@ + + federal_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + ins_addr1 false @@ -14053,6 +14074,27 @@ + + local_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + loss_date false @@ -15376,6 +15418,27 @@ + + state_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + status false diff --git a/client/src/components/bills-list-table/bills-list-table.component.jsx b/client/src/components/bills-list-table/bills-list-table.component.jsx index 66566e4e3..9ae40d6e3 100644 --- a/client/src/components/bills-list-table/bills-list-table.component.jsx +++ b/client/src/components/bills-list-table/bills-list-table.component.jsx @@ -11,6 +11,12 @@ import { alphaSort } from "../../utils/sorters"; import queryString from "query-string"; import { useLocation } from "react-router-dom"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; +const mapStateToProps = createStructuredSelector({ + jobRO: selectJobReadOnly, +}); + const mapDispatchToProps = (dispatch) => ({ setPartsOrderContext: (context) => dispatch(setModalContext({ context: context, modal: "partsOrder" })), @@ -21,6 +27,7 @@ const mapDispatchToProps = (dispatch) => ({ }); export function BillsListTableComponent({ + jobRO, job, billsQuery, handleOnRowClick, @@ -94,11 +101,15 @@ export function BillsListTableComponent({ key: "actions", render: (text, record) => (
- - - + {jobRO ? ( + + ) : ( + + + + )}
), }, @@ -227,7 +238,7 @@ export function BillsListTableComponent({ ); } -export default connect(mapStateToProps, null)(JobCalculateTotals); diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 0c62fbad8..76482e71f 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -15,6 +15,13 @@ import JobLineNotePopup from "../job-line-note-popup/job-line-note-popup.compone // import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container"; import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; +const mapStateToProps = createStructuredSelector({ + //currentUser: selectCurrentUser + jobRO: selectJobReadOnly, +}); + const mapDispatchToProps = (dispatch) => ({ setJobLineEditContext: (context) => dispatch(setModalContext({ context: context, modal: "jobLineEdit" })), @@ -23,6 +30,7 @@ const mapDispatchToProps = (dispatch) => ({ }); export function JobLinesComponent({ + jobRO, setPartsOrderContext, loading, refetch, @@ -179,13 +187,17 @@ export function JobLinesComponent({ title: t("joblines.fields.notes"), dataIndex: "notes", key: "notes", - render: (text, record) => , + render: (text, record) => ( + + ), }, { title: t("joblines.fields.location"), dataIndex: "location", key: "location", - render: (text, record) => , + render: (text, record) => ( + + ), }, { title: t("joblines.fields.status"), @@ -244,6 +256,7 @@ export function JobLinesComponent({ render: (text, record) => (
); } -export default connect(null, mapDispatchToProps)(JobLinesComponent); +export default connect(mapStateToProps, mapDispatchToProps)(JobLinesComponent); diff --git a/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx b/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx index 0cffe85a8..a0b1888d5 100644 --- a/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx +++ b/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx @@ -6,8 +6,10 @@ import { Select, Button, Popover } from "antd"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, + jobRO: selectJobReadOnly, }); const mapDispatchToProps = (dispatch) => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) @@ -15,6 +17,7 @@ const mapDispatchToProps = (dispatch) => ({ export function JobEmployeeAssignments({ bodyshop, + jobRO, body, refinish, prep, @@ -52,7 +55,7 @@ export function JobEmployeeAssignments({