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 9ae40d6e3..e328e6b42 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 @@ -1,18 +1,17 @@ import { SyncOutlined } from "@ant-design/icons"; -import { Button, Checkbox, Descriptions, Table, Input, Typography } from "antd"; +import { Button, Checkbox, Descriptions, Input, Table, Typography } from "antd"; +import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { DateFormatter } from "../../utils/DateFormatter"; 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, }); @@ -376,4 +375,7 @@ export function BillsListTableComponent({ ); } -export default connect(null, mapDispatchToProps)(BillsListTableComponent); +export default connect( + mapStateToProps, + mapDispatchToProps +)(BillsListTableComponent); diff --git a/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx b/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx index 826e3a6a3..90cfe5ef1 100644 --- a/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx +++ b/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx @@ -6,7 +6,7 @@ import { TimePicker } from "antd"; import moment from "moment"; //To be used as a form element only. -const DateTimePicker = ({ value, onChange, onBlur }, ref) => { +const DateTimePicker = ({ value, onChange, onBlur, ...restProps }, ref) => { // const handleChange = (newDate) => { // if (value !== newDate && onChange) { // onChange(newDate); @@ -15,9 +15,15 @@ const DateTimePicker = ({ value, onChange, onBlur }, ref) => { return (
- + - + - + @@ -27,13 +34,13 @@ export default function JobsDetailDatesComponent({ job }) { label={t("jobs.fields.date_scheduled")} name="date_scheduled" > - + - + - + @@ -41,38 +48,39 @@ export default function JobsDetailDatesComponent({ job }) { label={t("jobs.fields.scheduled_completion")} name="scheduled_completion" > - + - + - + - + - + - +
); } +export default connect(mapStateToProps, null)(JobsDetailDatesComponent); diff --git a/client/src/components/jobs-detail-labor/jobs-detail-labor.component.jsx b/client/src/components/jobs-detail-labor/jobs-detail-labor.component.jsx index 93ded43a6..170a1e1a0 100644 --- a/client/src/components/jobs-detail-labor/jobs-detail-labor.component.jsx +++ b/client/src/components/jobs-detail-labor/jobs-detail-labor.component.jsx @@ -1,10 +1,20 @@ import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; import LaborAllocationsTableComponent from "../labor-allocations-table/labor-allocations-table.component"; import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component"; import TimeTicketList from "../time-ticket-list/time-ticket-list.component"; -import { useTranslation } from "react-i18next"; -export default function JobsDetailLaborContainer({ +const mapStateToProps = createStructuredSelector({ + jobRO: selectJobReadOnly, +}); + +export default connect(mapStateToProps, null)(JobsDetailLaborContainer); + +export function JobsDetailLaborContainer({ + jobRO, jobId, joblines, timetickets, @@ -16,7 +26,11 @@ export default function JobsDetailLaborContainer({ return (
{techConsole ? null : ( - + {t("timetickets.actions.enter")} )} @@ -29,6 +43,7 @@ export default function JobsDetailLaborContainer({ timetickets={timetickets} refetch={refetch} techConsole={techConsole} + disabled={jobRO} />
); diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx index 1f9706808..44fc59545 100644 --- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx +++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx @@ -10,6 +10,7 @@ import moment from "moment"; import { onlyUnique } from "../../utils/arrayHelper"; export default function TimeTicketList({ + disabled, loading, timetickets, refetch, @@ -40,7 +41,8 @@ export default function TimeTicketList({ sortOrder: state.sortedInfo.columnKey === "vin" && state.sortedInfo.order, render: (text, record) => ( {`${record.employee.first_name} ${record.employee.last_name}`} + to={`/manage/employees/${record.employee.id}`} + >{`${record.employee.first_name} ${record.employee.last_name}`} ), }, { @@ -126,22 +128,22 @@ export default function TimeTicketList({ } }, }, - { - title: t("general.labels.actions"), - dataIndex: "actions", - key: "actions", - render: (text, record) => { - if (techConsole) return null; - return ( - - {t("general.actions.edit")} - - ); - }, - }, + !!techConsole + ? { + title: t("general.labels.actions"), + dataIndex: "actions", + key: "actions", + render: (text, record) => ( + + {t("general.actions.edit")} + + ), + } + : null, ]; const handleTableChange = (pagination, filters, sorter) => { @@ -151,10 +153,10 @@ export default function TimeTicketList({ return ( ({ ...item }))} - rowKey='id' + rowKey="id" dataSource={timetickets} onChange={handleTableChange} /> diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 2745eba46..2ffcfdd4e 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -4,7 +4,6 @@ import Icon, { DollarCircleOutlined, FileImageFilled, ToolFilled, - CheckSquareFilled, } from "@ant-design/icons"; import { Form, notification, Tabs } from "antd"; import Axios from "axios"; @@ -13,20 +12,15 @@ import moment from "moment"; import queryString from "query-string"; import React, { lazy, Suspense, useState } from "react"; import { useTranslation } from "react-i18next"; -import { - FaHardHat, - FaHistory, - FaRegStickyNote, - FaShieldAlt, -} from "react-icons/fa"; +import { FaHardHat, FaRegStickyNote, FaShieldAlt } from "react-icons/fa"; import { connect } from "react-redux"; import { useHistory, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import FormFieldsChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; -import { selectBodyshop } from "../../redux/user/user.selectors"; -import JobsDetailChecklists from "../../components/jobs-detail-checklists/jobs-detail-checklists.component"; +//import JobsDetailChecklists from "../../components/jobs-detail-checklists/jobs-detail-checklists.component"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; const JobsLinesContainer = lazy(() => import("../../components/job-detail-lines/job-lines.container") @@ -66,9 +60,9 @@ const JobLineUpsertModalContainer = lazy(() => const JobsDetailPliContainer = lazy(() => import("../../components/jobs-detail-pli/jobs-detail-pli.container") ); -const JobsDetailAuditContainer = lazy(() => - import("../../components/audit-trail-list/audit-trail-list.container") -); +// const JobsDetailAuditContainer = lazy(() => +// import("../../components/audit-trail-list/audit-trail-list.container") +// ); const JobsDetailLaborContainer = lazy(() => import("../../components/jobs-detail-labor/jobs-detail-labor.container") ); @@ -268,29 +262,30 @@ export function JobsDetailPage({ > - - - - {t("jobs.labels.audit")} - - } - key="audit" - > - - - - - {t("jobs.labels.checklists")} - - } - key="checklists" - > - - + { + // + // + // {t("jobs.labels.audit")} + // + // } + // key="audit" + // > + // + // + // + // + // {t("jobs.labels.checklists")} + // + // } + // key="checklists" + // > + // + // + }