WIP Read Only for Jobs BOD-409

This commit is contained in:
Patrick Fic
2020-09-28 14:00:35 -07:00
parent a7051c0f86
commit 3ee003000d
22 changed files with 278 additions and 129 deletions

View File

@@ -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) => <JobLineNotePopup jobline={record} />,
render: (text, record) => (
<JobLineNotePopup disabled={jobRO} jobline={record} />
),
},
{
title: t("joblines.fields.location"),
dataIndex: "location",
key: "location",
render: (text, record) => <JobLineLocationPopup jobline={record} />,
render: (text, record) => (
<JobLineLocationPopup jobline={record} disabled={jobRO} />
),
},
{
title: t("joblines.fields.status"),
@@ -244,6 +256,7 @@ export function JobLinesComponent({
render: (text, record) => (
<div>
<Button
disabled={jobRO}
onClick={() => {
setJobLineEditContext({
actions: { refetch: refetch },
@@ -309,7 +322,9 @@ export function JobLinesComponent({
</Button>
<Button
disabled={
!job.converted || (selectedLines.length > 0 ? false : true)
!job.converted ||
(selectedLines.length > 0 ? false : true) ||
jobRO
}
onClick={() => {
setPartsOrderContext({
@@ -345,6 +360,7 @@ export function JobLinesComponent({
// />
}
<Button
disabled={jobRO}
onClick={() => {
setJobLineEditContext({
actions: { refetch: refetch },
@@ -398,4 +414,4 @@ export function JobLinesComponent({
</div>
);
}
export default connect(null, mapDispatchToProps)(JobLinesComponent);
export default connect(mapStateToProps, mapDispatchToProps)(JobLinesComponent);