diff --git a/client/src/components/production-list-table/production-list-table.component.jsx b/client/src/components/production-list-table/production-list-table.component.jsx index 279e26b4a..ea3d9c2a2 100644 --- a/client/src/components/production-list-table/production-list-table.component.jsx +++ b/client/src/components/production-list-table/production-list-table.component.jsx @@ -1,23 +1,23 @@ -import React, { useEffect, useMemo, useRef, useState } from "react"; -import { Button, Dropdown, Input, Space, Statistic, Table } from "antd"; +import { SyncOutlined } from "@ant-design/icons"; import { PageHeader } from "@ant-design/pro-layout"; +import { useSplitTreatments } from "@splitsoftware/splitio-react"; +import { Button, Dropdown, Input, Space, Statistic, Table } from "antd"; +import _ from "lodash"; +import React, { useEffect, useMemo, useRef, useState } from "react"; import ReactDragListView from "react-drag-listview"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectTechnician } from "../../redux/tech/tech.selectors"; import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; +import Prompt from "../../utils/prompt.js"; +import AlertComponent from "../alert/alert.component.jsx"; import ProductionListColumnsAdd from "../production-list-columns/production-list-columns.add.component"; import ProductionListColumns from "../production-list-columns/production-list-columns.data"; import ProductionListDetail from "../production-list-detail/production-list-detail.component"; +import { ProductionListConfigManager } from "./production-list-config-manager.component.jsx"; import ProductionListPrint from "./production-list-print.component"; import ResizeableTitle from "./production-list-table.resizeable.component"; -import { useSplitTreatments } from "@splitsoftware/splitio-react"; -import { SyncOutlined } from "@ant-design/icons"; -import Prompt from "../../utils/prompt.js"; -import _ from "lodash"; -import AlertComponent from "../alert/alert.component.jsx"; -import { ProductionListConfigManager } from "./production-list-config-manager.component.jsx"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -43,7 +43,7 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici const initialStateRef = useRef( (bodyshop.production_config && bodyshop.production_config.find((p) => p.name === defaultView)?.columns.tableState) || - bodyshop.production_config[0]?.columns.tableState || { + (bodyshop.production_config && bodyshop.production_config[0]?.columns.tableState) || { sortedInfo: {}, filteredInfo: { text: "" } } diff --git a/client/src/components/tech-job-print-tickets/tech-job-print-tickets.component.jsx b/client/src/components/tech-job-print-tickets/tech-job-print-tickets.component.jsx index 3802c4fb5..3f060089f 100644 --- a/client/src/components/tech-job-print-tickets/tech-job-print-tickets.component.jsx +++ b/client/src/components/tech-job-print-tickets/tech-job-print-tickets.component.jsx @@ -1,5 +1,4 @@ import { Button, Card, DatePicker, Form, Popover, Radio, Space } from "antd"; -import dayjs from "../../utils/day"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -7,10 +6,12 @@ import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { selectTechnician } from "../../redux/tech/tech.selectors"; import DatePIckerRanges from "../../utils/DatePickerRanges"; +import dayjs from "../../utils/day"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; const mapStateToProps = createStructuredSelector({ + bodyshop: selectTechnician, technician: selectTechnician }); const mapDispatchToProps = (dispatch) => ({ @@ -18,7 +19,7 @@ const mapDispatchToProps = (dispatch) => ({ }); export default connect(mapStateToProps, mapDispatchToProps)(TechJobPrintTickets); -export function TechJobPrintTickets({ technician, event, attendacePrint }) { +export function TechJobPrintTickets({ bodyshop, technician, event, attendacePrint }) { const { t } = useTranslation(); const [loading, setLoading] = useState(false); @@ -57,7 +58,8 @@ export function TechJobPrintTickets({ technician, event, attendacePrint }) { subject: attendacePrint === true ? Templates.attendance_employee.subject : Templates.timetickets_employee.subject }, - values.sendby // === "email" ? "e" : "p" + values.sendby, + bodyshop ); } catch (error) { console.log(error); 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 6385aa787..b718c95ce 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 @@ -1,6 +1,6 @@ import { EditFilled, SyncOutlined } from "@ant-design/icons"; +import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Button, Card, Checkbox, Space, Table } from "antd"; -import dayjs from "../../utils/day"; import React, { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -10,10 +10,10 @@ import { setModalContext } from "../../redux/modals/modals.actions"; import { selectAuthLevel, selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter"; import { onlyUnique } from "../../utils/arrayHelper"; +import dayjs from "../../utils/day"; import { alphaSort, dateSort } from "../../utils/sorters"; import RbacWrapper, { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component"; import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component"; -import { useSplitTreatments } from "@splitsoftware/splitio-react"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -165,7 +165,7 @@ export function TimeTicketList({ key: "memo", sorter: (a, b) => alphaSort(a.memo, b.memo), sortOrder: state.sortedInfo.columnKey === "memo" && state.sortedInfo.order, - render: (text, record) => (record.clockon || record.clockoff ? t(record.memo) : record.memo) + render: (text, record) => (record.memo.startsWith("timetickets.labels") ? t(record.memo) : record.memo) }, ...(Enhanced_Payroll.treatment === "on" ? [ @@ -206,76 +206,98 @@ export function TimeTicketList({ return null; } } - }, - + } ]), - { - title: t("timetickets.fields.created_by"), - dataIndex: "created_by", - key: "created_by", - sorter: (a, b) => alphaSort(a.created_by, b.created_by), - sortOrder: state.sortedInfo.columnKey === "created_by" && state.sortedInfo.order, - render: (text, record) => record.created_by - }, - // { - // title: "Pay", - // dataIndex: "pay", - // key: "pay", - // render: (text, record) => - // Dinero({ amount: Math.round(record.rate * 100) }) - // .multiply(record.flat_rate ? record.productivehrs : record.actualhrs) - // .toFormat("$0.00"), - // }, - { - title: t("general.labels.actions"), - dataIndex: "actions", - key: "actions", - render: (text, record) => ( - - {techConsole && ( - - - - )} - {!techConsole && ( - { - return
; - }} - > - alphaSort(a.created_by, b.created_by), + sortOrder: state.sortedInfo.columnKey === "created_by" && state.sortedInfo.order, + render: (text, record) => record.created_by + }, + // { + // title: "Pay", + // dataIndex: "pay", + // key: "pay", + // render: (text, record) => + // Dinero({ amount: Math.round(record.rate * 100) }) + // .multiply(record.flat_rate ? record.productivehrs : record.actualhrs) + // .toFormat("$0.00"), + // }, + { + title: t("general.labels.actions"), + dataIndex: "actions", + key: "actions", + render: (text, record) => ( + + {techConsole && ( + + + + )} + {!techConsole && ( + { + return
; + }} + > + - - - - )} - - ) - } + } + > + + + + )} + + ) + } ]; const handleTableChange = (pagination, filters, sorter) => { diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx index 7a86d0d56..1b286f24b 100644 --- a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx +++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx @@ -1,4 +1,5 @@ import { useLazyQuery } from "@apollo/client"; +import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Form, Input, InputNumber, Select, Switch } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; @@ -7,8 +8,10 @@ import { createStructuredSelector } from "reselect"; import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries"; import { selectAuthLevel, selectBodyshop } from "../../redux/user/user.selectors"; import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component"; -import FormDateTimePicker from "../form-date-time-picker/form-date-time-picker.component"; -import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component"; +import { + default as DateTimePicker, + default as FormDateTimePicker +} from "../form-date-time-picker/form-date-time-picker.component"; import JobSearchSelect from "../job-search-select/job-search-select.component"; import LaborAllocationsTable from "../labor-allocations-table/labor-allocations-table.component"; import { CalculateAllocationsTotals } from "../labor-allocations-table/labor-allocations-table.utility"; @@ -16,7 +19,6 @@ import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component"; import TimeTicketList from "../time-ticket-list/time-ticket-list.component"; -import { useSplitTreatments } from "@splitsoftware/splitio-react"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -69,13 +71,7 @@ export function TimeTicketModalComponent({ }; const MemoInput = ({ value, ...props }) => { - return ( - - ); + return ; }; return ( diff --git a/client/src/components/time-ticket-shift-active/time-ticket-shift-active.component.jsx b/client/src/components/time-ticket-shift-active/time-ticket-shift-active.component.jsx index dc67bae09..ba93d27b4 100644 --- a/client/src/components/time-ticket-shift-active/time-ticket-shift-active.component.jsx +++ b/client/src/components/time-ticket-shift-active/time-ticket-shift-active.component.jsx @@ -39,7 +39,7 @@ export default function TimeTicketShiftActive({ timetickets, refetch, isTechCons renderItem={(ticket) => ( { + // Only process if in production environment. + if (process.env.NODE_ENV !== "production") { + res.sendStatus(403); + return; + } + //Query for the List of Bodyshop Clients. logger.log("autohouse-start", "DEBUG", "api", null, null); const { bodyshops } = await client.request(queries.GET_AUTOHOUSE_SHOPS); diff --git a/server/data/claimscorp.js b/server/data/claimscorp.js index fb3012b7a..6ebc63f81 100644 --- a/server/data/claimscorp.js +++ b/server/data/claimscorp.js @@ -31,6 +31,12 @@ const ftpSetup = { }; exports.default = async (req, res) => { + // Only process if in production environment. + if (process.env.NODE_ENV !== "production") { + res.sendStatus(403); + return; + } + //Query for the List of Bodyshop Clients. logger.log("claimscorp-start", "DEBUG", "api", null, null); const { bodyshops } = await client.request(queries.GET_CLAIMSCORP_SHOPS); diff --git a/server/data/kaizen.js b/server/data/kaizen.js index 5a09bec24..c9794acff 100644 --- a/server/data/kaizen.js +++ b/server/data/kaizen.js @@ -31,6 +31,12 @@ const ftpSetup = { }; exports.default = async (req, res) => { + // Only process if in production environment. + if (process.env.NODE_ENV !== "production") { + res.sendStatus(403); + return; + } + //Query for the List of Bodyshop Clients. logger.log("kaizen-start", "DEBUG", "api", null, null); const kaizenShopsIDs = ["SUMMIT", "STRATHMORE", "SUNRIDGE", "SHAW"];