diff --git a/.dockerignore b/.dockerignore index 17605d357..98f226b22 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,7 +11,6 @@ node_modules # Files to exclude .ebignore .editorconfig -.eslintrc.json .gitignore .prettierrc.js Dockerfile @@ -19,6 +18,6 @@ README.MD bodyshop_translations.babel docker-compose.yml ecosystem.config.js - +eslint.config.mjs # Optional: Exclude logs and temporary files *.log diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index d2162827c..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "env": { - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "rules": { - "no-console": "off" - }, - "settings": {} -} diff --git a/_reference/ragmate/local-rag-compose.yml b/_reference/ragmate/local-rag-compose.yml new file mode 100644 index 000000000..37a4af622 --- /dev/null +++ b/_reference/ragmate/local-rag-compose.yml @@ -0,0 +1,10 @@ +services: + ragmate: + image: ghcr.io/ragmate/ragmate:latest + ports: + - "11434:11434" + env_file: + - .ragmate.env + volumes: + - .:/project + - ./docker_data/ragmate:/apps/cache diff --git a/client/.eslintrc b/client/.eslintrc deleted file mode 100644 index 25e7bdb80..000000000 --- a/client/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": [ - "react-app" - ], - "rules": { - "no-useless-rename": "off" - } -} diff --git a/client/eslint.config.js b/client/eslint.config.js index 0ced5d379..3063ce3d8 100644 --- a/client/eslint.config.js +++ b/client/eslint.config.js @@ -2,9 +2,9 @@ import globals from "globals"; import pluginJs from "@eslint/js"; import pluginReact from "eslint-plugin-react"; -/** @type {import('eslint').Linter.Config[]} */ - +/** @type {import("eslint").Linter.Config[]} */ export default [ + { ignores: ["node_modules/**", "dist/**", "build/**", "dev-dist/**"] }, { files: ["**/*.{js,mjs,cjs,jsx}"] }, @@ -12,9 +12,13 @@ export default [ pluginJs.configs.recommended, { ...pluginReact.configs.flat.recommended, + settings: { + react: { version: "detect" } + }, rules: { ...pluginReact.configs.flat.recommended.rules, - "react/prop-types": 0 + "react/prop-types": 0, + "react/no-children-prop": 0 // Disable react/no-children-prop rule } }, pluginReact.configs.flat["jsx-runtime"] diff --git a/client/package.json b/client/package.json index 4175749a2..4c1953199 100644 --- a/client/package.json +++ b/client/package.json @@ -8,58 +8,58 @@ "private": true, "proxy": "http://localhost:4000", "dependencies": { - "@ant-design/pro-layout": "^7.22.4", - "@apollo/client": "^3.13.6", + "@ant-design/pro-layout": "^7.22.6", + "@apollo/client": "^3.13.9", "@emotion/is-prop-valid": "^1.3.1", "@fingerprintjs/fingerprintjs": "^4.6.1", - "@firebase/analytics": "^0.10.16", - "@firebase/app": "^0.13.1", - "@firebase/auth": "^1.10.6", - "@firebase/firestore": "^4.7.17", - "@firebase/messaging": "^0.12.21", + "@firebase/analytics": "^0.10.17", + "@firebase/app": "^0.14.1", + "@firebase/auth": "^1.10.8", + "@firebase/firestore": "^4.8.0", + "@firebase/messaging": "^0.12.22", "@jsreport/browser-client": "^3.1.0", "@reduxjs/toolkit": "^2.8.2", - "@sentry/cli": "^2.47.1", - "@sentry/react": "^9.38.0", - "@sentry/vite-plugin": "^3.5.0", + "@sentry/cli": "^2.52.0", + "@sentry/react": "^9.43.0", + "@sentry/vite-plugin": "^4.1.1", "@splitsoftware/splitio-react": "^2.3.1", "@tanem/react-nprogress": "^5.0.53", - "antd": "^5.25.4", + "antd": "^5.27.1", "apollo-link-logger": "^2.0.1", - "apollo-link-sentry": "^4.3.0", + "apollo-link-sentry": "^4.4.0", "autosize": "^6.0.1", - "axios": "^1.8.4", + "axios": "^1.11.0", "classnames": "^2.5.1", "css-box-model": "^1.2.1", "dayjs": "^1.11.13", "dayjs-business-days2": "^1.3.0", "dinero.js": "^1.9.1", - "dotenv": "^16.4.7", + "dotenv": "^17.2.1", "env-cmd": "^10.1.0", "exifr": "^7.1.3", "graphql": "^16.11.0", - "i18next": "^24.2.3", - "i18next-browser-languagedetector": "^8.1.0", + "i18next": "^25.3.6", + "i18next-browser-languagedetector": "^8.2.0", "immutability-helper": "^3.1.1", - "libphonenumber-js": "^1.12.10", + "libphonenumber-js": "^1.12.12", "logrocket": "^9.0.2", - "markerjs2": "^2.32.4", + "markerjs2": "^2.32.6", "memoize-one": "^6.0.0", "normalize-url": "^8.0.2", "object-hash": "^3.0.0", - "phone": "^3.1.59", + "phone": "^3.1.67", "prop-types": "^15.8.1", - "query-string": "^9.2.0", + "query-string": "^9.2.2", "raf-schd": "^4.0.3", "react": "^18.3.1", - "react-big-calendar": "^1.19.2", + "react-big-calendar": "^1.19.4", "react-color": "^2.19.3", "react-cookie": "^8.0.1", "react-dom": "^18.3.1", "react-drag-listview": "^2.0.0", "react-grid-gallery": "^1.0.1", "react-grid-layout": "1.3.4", - "react-i18next": "^15.5.2", + "react-i18next": "^15.6.1", "react-icons": "^5.5.0", "react-image-lightbox": "^5.1.4", "react-markdown": "^10.1.0", @@ -70,7 +70,7 @@ "react-resizable": "^3.0.5", "react-router-dom": "^6.30.0", "react-sticky": "^6.0.3", - "react-virtuoso": "^4.12.8", + "react-virtuoso": "^4.14.0", "recharts": "^2.15.2", "redux": "^5.0.1", "redux-actions": "^3.0.3", @@ -78,9 +78,9 @@ "redux-saga": "^1.3.0", "redux-state-sync": "^3.1.4", "reselect": "^5.1.1", - "sass": "^1.89.1", + "sass": "^1.90.0", "socket.io-client": "^4.8.1", - "styled-components": "^6.1.18", + "styled-components": "^6.1.19", "subscriptions-transport-ws": "^0.11.0", "use-memo-one": "^1.1.3", "vite-plugin-ejs": "^1.7.0", @@ -107,7 +107,9 @@ "test:e2e:rome": "playwright test --config playwright.rome.config.js", "test:e2e:imex:headed": "playwright test --config playwright.config.js --headed", "test:e2e:rome:headed": "playwright test --config playwright.rome.config.js --headed", - "test:e2e:report": "playwright show-report" + "test:e2e:report": "playwright show-report", + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "browserslist": { "production": [ @@ -131,37 +133,36 @@ "@ant-design/icons": "^6.0.0", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@babel/preset-react": "^7.27.1", - "@dotenvx/dotenvx": "^1.47.5", + "@dotenvx/dotenvx": "^1.49.0", "@emotion/babel-plugin": "^11.13.5", "@emotion/react": "^11.14.0", - "@eslint/js": "^9.31.0", - "@playwright/test": "^1.54.1", - "@sentry/webpack-plugin": "^3.5.0", - "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.6.3", + "@eslint/js": "^9.33.0", + "@playwright/test": "^1.54.2", + "@sentry/webpack-plugin": "^4.1.1", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.7.0", "@testing-library/react": "^16.3.0", - "@vitejs/plugin-react": "^4.5.1", - "browserslist": "^4.25.0", + "@vitejs/plugin-react": "^4.6.0", + "browserslist": "^4.25.3", "browserslist-to-esbuild": "^2.1.1", - "chalk": "^5.4.1", - "eslint": "^8.57.1", - "eslint-config-react-app": "^7.0.1", + "chalk": "^5.6.0", + "eslint": "^9.33.0", "eslint-plugin-react": "^7.37.5", "globals": "^15.15.0", "jsdom": "^26.0.0", - "memfs": "^4.17.2", + "memfs": "^4.36.3", "os-browserify": "^0.3.0", - "playwright": "^1.54.1", + "playwright": "^1.54.2", "react-error-overlay": "^6.1.0", "redux-logger": "^3.0.6", "source-map-explorer": "^2.5.3", - "vite": "^6.3.5", - "vite-plugin-babel": "^1.3.1", + "vite": "^7.1.3", + "vite-plugin-babel": "^1.3.2", "vite-plugin-eslint": "^1.8.1", - "vite-plugin-node-polyfills": "^0.23.0", - "vite-plugin-pwa": "^1.0.0", + "vite-plugin-node-polyfills": "^0.24.0", + "vite-plugin-pwa": "^1.0.2", "vite-plugin-style-import": "^2.0.0", - "vitest": "^3.2.3", + "vitest": "^3.2.4", "workbox-window": "^7.3.0" } } diff --git a/client/playwright.config.js b/client/playwright.config.js index 1ffc0d207..cb4629c4e 100644 --- a/client/playwright.config.js +++ b/client/playwright.config.js @@ -20,6 +20,7 @@ export default defineConfig({ command: "npm run start:imex", ignoreHTTPSErrors: true, url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready + // eslint-disable-next-line no-undef reuseExistingServer: !process.env.CI // Reuse server locally, not in CI } }); diff --git a/client/playwright.rome.config.js b/client/playwright.rome.config.js index 8378df05c..6d4f86062 100644 --- a/client/playwright.rome.config.js +++ b/client/playwright.rome.config.js @@ -20,6 +20,7 @@ export default defineConfig({ command: "npm run start:rome", ignoreHTTPSErrors: true, url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready + // eslint-disable-next-line no-undef reuseExistingServer: !process.env.CI // Reuse server locally, not in CI } }); diff --git a/client/public/firebase-messaging-sw.js b/client/public/firebase-messaging-sw.js index 1eb03072a..67fdd7c90 100644 --- a/client/public/firebase-messaging-sw.js +++ b/client/public/firebase-messaging-sw.js @@ -1,5 +1,7 @@ // Scripts for firebase and firebase messaging +// eslint-disable-next-line no-undef importScripts("https://www.gstatic.com/firebasejs/10.14.1/firebase-app-compat.js"); +// eslint-disable-next-line no-undef importScripts("https://www.gstatic.com/firebasejs/10.14.1/firebase-messaging-compat.js"); // Initialize the Firebase app in the service worker by passing the generated config @@ -42,13 +44,16 @@ switch (this.location.hostname) { }; } +// eslint-disable-next-line no-undef firebase.initializeApp(firebaseConfig); // Retrieve firebase messaging +// eslint-disable-next-line no-undef const messaging = firebase.messaging(); messaging.onBackgroundMessage(function (payload) { // Customize notification here console.log("[firebase-messaging-sw.js] Received background message ", payload); + // eslint-disable-next-line no-undef self.registration.showNotification(notificationTitle, notificationOptions); }); diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index 42212ca66..8c8275a0d 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -67,7 +67,6 @@ function AppContainer({ currentUser, setDarkMode }) { } else { setDarkMode(false); } - // eslint-disable-next-line }, [currentUser?.uid]); // Persist darkMode to localStorage when it or user changes diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 3cda7fe8e..2d9c03557 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -7,13 +7,14 @@ import { connect } from "react-redux"; import { Route, Routes, useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import DocumentEditorContainer from "../components/document-editor/document-editor.container"; -import ErrorBoundary from "../components/error-boundary/error-boundary.component"; // Component Imports +import ErrorBoundary from "../components/error-boundary/error-boundary.component"; import LoadingSpinner from "../components/loading-spinner/loading-spinner.component"; import DisclaimerPage from "../pages/disclaimer/disclaimer.page"; import LandingPage from "../pages/landing/landing.page"; import TechPageContainer from "../pages/tech/tech.page.container"; -import { setOnline } from "../redux/application/application.actions"; -import { selectOnline } from "../redux/application/application.selectors"; +import SimplifiedPartsPageContainer from "../pages/simplified-parts/simplified-parts.page.container.jsx"; +import { setIsPartsEntry, setOnline } from "../redux/application/application.actions"; +import { selectIsPartsEntry, selectOnline } from "../redux/application/application.selectors"; import { checkUserSession } from "../redux/user/user.actions"; import { selectBodyshop, selectCurrentEula, selectCurrentUser } from "../redux/user/user.selectors"; import PrivateRoute from "../components/PrivateRoute"; @@ -28,21 +29,31 @@ const ResetPassword = lazy(() => import("../pages/reset-password/reset-password. const ManagePage = lazy(() => import("../pages/manage/manage.page.container")); const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page")); const CsiPage = lazy(() => import("../pages/csi/csi.container.page")); -const MobilePaymentContainer = lazy(() => import("../pages/mobile-payment/mobile-payment.container")); const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, online: selectOnline, bodyshop: selectBodyshop, - currentEula: selectCurrentEula + currentEula: selectCurrentEula, + isPartsEntry: selectIsPartsEntry }); const mapDispatchToProps = (dispatch) => ({ checkUserSession: () => dispatch(checkUserSession()), - setOnline: (isOnline) => dispatch(setOnline(isOnline)) + setOnline: (isOnline) => dispatch(setOnline(isOnline)), + setIsPartsEntry: (isParts) => dispatch(setIsPartsEntry(isParts)) }); -export function App({ bodyshop, checkUserSession, currentUser, online, setOnline, currentEula }) { +export function App({ + bodyshop, + checkUserSession, + currentUser, + online, + setOnline, + setIsPartsEntry, + currentEula, + isPartsEntry +}) { const client = useSplitClient().client; const [listenersAdded, setListenersAdded] = useState(false); const { t } = useTranslation(); @@ -52,10 +63,15 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline if (!navigator.onLine) { setOnline(false); } - checkUserSession(); }, [checkUserSession, setOnline]); + useEffect(() => { + const pathname = window.location.pathname; + const isParts = pathname === "/parts" || pathname.startsWith("/parts/"); + setIsPartsEntry(isParts); + }, [setIsPartsEntry]); + //const b = Grid.useBreakpoint(); // console.log("Breakpoints:", b); @@ -144,6 +160,7 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline currentUser={currentUser} bodyshop={bodyshop} workspaceCode={bodyshop?.tours_enabled ? "9BkbEseqNqxw8jUH" : ""} + isPartsEntry={isPartsEntry} /> @@ -188,14 +205,6 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline } /> - - - - } - /> } /> + + + + + + } + > + } /> + }> } /> diff --git a/client/src/App/App.styles.scss b/client/src/App/App.styles.scss index 11012d468..616f88383 100644 --- a/client/src/App/App.styles.scss +++ b/client/src/App/App.styles.scss @@ -402,6 +402,10 @@ } } +.content-container { + padding: 1rem; +} + // Override react-big-calendar styles for dark mode only [data-theme="dark"] { .car-svg { diff --git a/client/src/App/ProductFruitsWrapper.jsx b/client/src/App/ProductFruitsWrapper.jsx index 70372198d..30770087d 100644 --- a/client/src/App/ProductFruitsWrapper.jsx +++ b/client/src/App/ProductFruitsWrapper.jsx @@ -1,9 +1,9 @@ -import React from "react"; +import { memo } from "react"; import PropTypes from "prop-types"; import { ProductFruits } from "react-product-fruits"; import dayjs from "dayjs"; -const ProductFruitsWrapper = React.memo(({ currentUser, bodyshop, workspaceCode }) => { +const ProductFruitsWrapper = memo(({ currentUser, bodyshop, workspaceCode, isPartsEntry }) => { const featureProps = bodyshop?.features ? Object.entries(bodyshop.features).reduce((acc, [key, value]) => { acc[key] = value === true || (typeof value === "string" && dayjs(value).isAfter(dayjs())); @@ -12,6 +12,7 @@ const ProductFruitsWrapper = React.memo(({ currentUser, bodyshop, workspaceCode : {}; return ( + !isPartsEntry && workspaceCode && currentUser?.authorized === true && currentUser?.email && ( @@ -30,6 +31,8 @@ const ProductFruitsWrapper = React.memo(({ currentUser, bodyshop, workspaceCode ); }); +ProductFruitsWrapper.displayName = "ProductFruitsWrapper"; + export default ProductFruitsWrapper; ProductFruitsWrapper.propTypes = { diff --git a/client/src/components/PrivateRoute.jsx b/client/src/components/PrivateRoute.jsx index 9286ae2d6..eb175534b 100644 --- a/client/src/components/PrivateRoute.jsx +++ b/client/src/components/PrivateRoute.jsx @@ -1,7 +1,7 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; -function PrivateRoute({ component: Component, isAuthorized, ...rest }) { +function PrivateRoute({ isAuthorized }) { const location = useLocation(); const navigate = useNavigate(); diff --git a/client/src/components/_test/test.page.jsx b/client/src/components/_test/test.page.jsx index 10af3b10b..87ef90e95 100644 --- a/client/src/components/_test/test.page.jsx +++ b/client/src/components/_test/test.page.jsx @@ -1,5 +1,4 @@ import { Button } from "antd"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setModalContext } from "../../redux/modals/modals.actions"; diff --git a/client/src/components/alert/alert.component.jsx b/client/src/components/alert/alert.component.jsx index f02edd614..439822f68 100644 --- a/client/src/components/alert/alert.component.jsx +++ b/client/src/components/alert/alert.component.jsx @@ -1,5 +1,4 @@ import { Alert } from "antd"; -import React from "react"; export default function AlertComponent(props) { return ; diff --git a/client/src/components/allocations-assignment/allocations-assignment.component.jsx b/client/src/components/allocations-assignment/allocations-assignment.component.jsx index 929d9eb75..0009f1e4e 100644 --- a/client/src/components/allocations-assignment/allocations-assignment.component.jsx +++ b/client/src/components/allocations-assignment/allocations-assignment.component.jsx @@ -1,5 +1,4 @@ import { Button, InputNumber, Popover, Select } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; diff --git a/client/src/components/allocations-assignment/allocations-assignment.container.jsx b/client/src/components/allocations-assignment/allocations-assignment.container.jsx index 60a0f68dc..262a70226 100644 --- a/client/src/components/allocations-assignment/allocations-assignment.container.jsx +++ b/client/src/components/allocations-assignment/allocations-assignment.container.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import AllocationsAssignmentComponent from "./allocations-assignment.component"; import { useMutation } from "@apollo/client"; import { INSERT_ALLOCATION } from "../../graphql/allocations.queries"; @@ -18,7 +18,7 @@ export default function AllocationsAssignmentContainer({ jobLineId, hours, refet const handleAssignment = () => { insertAllocation({ variables: { alloc: { ...assignment } } }) - .then((r) => { + .then(() => { notification["success"]({ message: t("allocations.successes.save") }); diff --git a/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.component.jsx b/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.component.jsx index 301887fb7..9cad453cc 100644 --- a/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.component.jsx +++ b/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.component.jsx @@ -1,5 +1,4 @@ import { Button, Popover, Select } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; diff --git a/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.container.jsx b/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.container.jsx index fa298b7e8..a82058644 100644 --- a/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.container.jsx +++ b/client/src/components/allocations-bulk-assignment/allocations-bulk-assignment.container.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import AllocationsBulkAssignment from "./allocations-bulk-assignment.component"; import { useMutation } from "@apollo/client"; import { INSERT_ALLOCATION } from "../../graphql/allocations.queries"; @@ -24,7 +24,7 @@ export default function AllocationsBulkAssignmentContainer({ jobLines, refetch } return acc; }, []); - insertAllocation({ variables: { alloc: allocs } }).then((r) => { + insertAllocation({ variables: { alloc: allocs } }).then(() => { notification["success"]({ message: t("employees.successes.save") }); diff --git a/client/src/components/allocations-employee-label/allocations-employee-label.component.jsx b/client/src/components/allocations-employee-label/allocations-employee-label.component.jsx index 0adc01964..5df90f752 100644 --- a/client/src/components/allocations-employee-label/allocations-employee-label.component.jsx +++ b/client/src/components/allocations-employee-label/allocations-employee-label.component.jsx @@ -1,5 +1,4 @@ import Icon from "@ant-design/icons"; -import React from "react"; import { MdRemoveCircleOutline } from "react-icons/md"; export default function AllocationsLabelComponent({ allocation, handleClick }) { diff --git a/client/src/components/allocations-employee-label/allocations-employee-label.container.jsx b/client/src/components/allocations-employee-label/allocations-employee-label.container.jsx index af93f1798..0599d268d 100644 --- a/client/src/components/allocations-employee-label/allocations-employee-label.container.jsx +++ b/client/src/components/allocations-employee-label/allocations-employee-label.container.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { useMutation } from "@apollo/client"; import { DELETE_ALLOCATION } from "../../graphql/allocations.queries"; import AllocationsLabelComponent from "./allocations-employee-label.component"; @@ -13,13 +12,13 @@ export default function AllocationsLabelContainer({ allocation, refetch }) { const handleClick = (e) => { e.preventDefault(); deleteAllocation({ variables: { id: allocation.id } }) - .then((r) => { + .then(() => { notification["success"]({ message: t("allocations.successes.deleted") }); if (refetch) refetch(); }) - .catch((error) => { + .catch(() => { notification["error"]({ message: t("allocations.errors.deleting") }); }); }; diff --git a/client/src/components/audit-trail-list/audit-trail-list.component.jsx b/client/src/components/audit-trail-list/audit-trail-list.component.jsx index 9722005d6..493bcb1e6 100644 --- a/client/src/components/audit-trail-list/audit-trail-list.component.jsx +++ b/client/src/components/audit-trail-list/audit-trail-list.component.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import { Table } from "antd"; import { alphaSort } from "../../utils/sorters"; import { DateTimeFormatter } from "../../utils/DateFormatter"; diff --git a/client/src/components/audit-trail-list/audit-trail-list.container.jsx b/client/src/components/audit-trail-list/audit-trail-list.container.jsx index 6361bc240..eb60fd512 100644 --- a/client/src/components/audit-trail-list/audit-trail-list.container.jsx +++ b/client/src/components/audit-trail-list/audit-trail-list.container.jsx @@ -1,4 +1,3 @@ -import React from "react"; import AuditTrailListComponent from "./audit-trail-list.component"; import { useQuery } from "@apollo/client"; import { QUERY_AUDIT_TRAIL } from "../../graphql/audit_trail.queries"; diff --git a/client/src/components/audit-trail-list/email-audit-trail-list.component.jsx b/client/src/components/audit-trail-list/email-audit-trail-list.component.jsx index 5f462d500..e63af3af1 100644 --- a/client/src/components/audit-trail-list/email-audit-trail-list.component.jsx +++ b/client/src/components/audit-trail-list/email-audit-trail-list.component.jsx @@ -1,5 +1,5 @@ import { Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; diff --git a/client/src/components/audit-trail-values/audit-trail-values.component.jsx b/client/src/components/audit-trail-values/audit-trail-values.component.jsx index b3c531927..8da394c20 100644 --- a/client/src/components/audit-trail-values/audit-trail-values.component.jsx +++ b/client/src/components/audit-trail-values/audit-trail-values.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { List } from "antd"; import Icon from "@ant-design/icons"; import { FaArrowRight } from "react-icons/fa"; diff --git a/client/src/components/barcode-popup/barcode-popup.component.jsx b/client/src/components/barcode-popup/barcode-popup.component.jsx index c6dbb4ee3..8dac738e2 100644 --- a/client/src/components/barcode-popup/barcode-popup.component.jsx +++ b/client/src/components/barcode-popup/barcode-popup.component.jsx @@ -1,5 +1,4 @@ import { Popover, Tag } from "antd"; -import React from "react"; import Barcode from "react-barcode"; import { useTranslation } from "react-i18next"; diff --git a/client/src/components/bill-cm-returns-table/bill-cm-returns-table.component.jsx b/client/src/components/bill-cm-returns-table/bill-cm-returns-table.component.jsx index 5eb8bb4fc..8a2263bda 100644 --- a/client/src/components/bill-cm-returns-table/bill-cm-returns-table.component.jsx +++ b/client/src/components/bill-cm-returns-table/bill-cm-returns-table.component.jsx @@ -1,5 +1,5 @@ import { Checkbox, Form, Skeleton, Typography } from "antd"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import ReadOnlyFormItemComponent from "../form-items-formatted/read-only-form-item.component"; import "./bill-cm-returns-table.styles.scss"; @@ -33,7 +33,7 @@ export default function BillCmdReturnsTableComponent({ form, returnLoading, retu return ( - {(fields, { add, remove, move }) => { + {(fields) => { return ( <> {t("bills.labels.creditsnotreceived")} diff --git a/client/src/components/bill-delete-button/bill-delete-button.component.jsx b/client/src/components/bill-delete-button/bill-delete-button.component.jsx index 5ab24d60f..c3403e935 100644 --- a/client/src/components/bill-delete-button/bill-delete-button.component.jsx +++ b/client/src/components/bill-delete-button/bill-delete-button.component.jsx @@ -1,7 +1,7 @@ import { DeleteFilled } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; import { Button, Popconfirm } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { DELETE_BILL } from "../../graphql/bills.queries"; import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component"; @@ -43,7 +43,7 @@ export function BillDeleteButton({ bill, jobid, callback, insertAuditTrail }) { } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("bills.successes.deleted") }); insertAuditTrail({ jobid: jobid, diff --git a/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx b/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx index e37985222..e7dc13b1e 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx @@ -2,7 +2,7 @@ import { PageHeader } from "@ant-design/pro-layout"; import { useMutation, useQuery } from "@apollo/client"; import { Button, Divider, Form, Popconfirm, Space } from "antd"; import queryString from "query-string"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { useLocation } from "react-router-dom"; @@ -10,7 +10,6 @@ import { createStructuredSelector } from "reselect"; import { DELETE_BILL_LINE, INSERT_NEW_BILL_LINES, UPDATE_BILL_LINE } from "../../graphql/bill-lines.queries"; import { QUERY_BILL_BY_PK, UPDATE_BILL } from "../../graphql/bills.queries"; import { insertAuditTrail } from "../../redux/application/application.actions"; -import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import AuditTrailMapping from "../../utils/AuditTrailMappings"; import dayjs from "../../utils/day"; @@ -28,13 +27,12 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); const mapDispatchToProps = (dispatch) => ({ - setPartsOrderContext: (context) => dispatch(setModalContext({ context: context, modal: "partsOrder" })), insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type })) }); export default connect(mapStateToProps, mapDispatchToProps)(BillDetailEditcontainer); -export function BillDetailEditcontainer({ setPartsOrderContext, insertAuditTrail, bodyshop }) { +export function BillDetailEditcontainer({ insertAuditTrail, bodyshop }) { const search = queryString.parse(useLocation().search); const { t } = useTranslation(); @@ -48,7 +46,7 @@ export function BillDetailEditcontainer({ setPartsOrderContext, insertAuditTrail const { loading, error, data, refetch } = useQuery(QUERY_BILL_BY_PK, { variables: { billid: search.billid }, - skip: !!!search.billid, + skip: !search.billid, fetchPolicy: "network-only", nextFetchPolicy: "network-only" }); @@ -71,7 +69,7 @@ export function BillDetailEditcontainer({ setPartsOrderContext, insertAuditTrail setUpdateLoading(true); //let adjustmentsToInsert = {}; - const { billlines, upload, ...bill } = values; + const { billlines, ...bill } = values; const updates = []; updates.push( update_bill({ @@ -98,6 +96,7 @@ export function BillDetailEditcontainer({ setPartsOrderContext, insertAuditTrail }); billlines.forEach((billline) => { + // eslint-disable-next-line no-unused-vars const { deductedfromlbr, inventories, jobline, original_actual_price, create_ppc, ...il } = billline; delete il.__typename; @@ -152,8 +151,8 @@ export function BillDetailEditcontainer({ setPartsOrderContext, insertAuditTrail if (error) return ; if (!search.billid) return <>; //
{t("bills.labels.noneselected")}
; - const exported = data && data.bills_by_pk && data.bills_by_pk.exported; - const isinhouse = data && data.bills_by_pk && data.bills_by_pk.isinhouse; + const exported = data?.bills_by_pk && data.bills_by_pk.exported; + const isinhouse = data?.bills_by_pk && data.bills_by_pk.isinhouse; return ( <> @@ -183,8 +182,8 @@ export function BillDetailEditcontainer({ setPartsOrderContext, insertAuditTrail {t("general.actions.save")} - - + + } /> @@ -220,11 +219,11 @@ const transformData = (data) => { billlines: data.bills_by_pk.billlines.map((i) => { return { ...i, - joblineid: !!i.joblineid ? i.joblineid : "noline", + joblineid: i.joblineid ? i.joblineid : "noline", applicable_taxes: { - federal: (i.applicable_taxes && i.applicable_taxes.federal) || false, - state: (i.applicable_taxes && i.applicable_taxes.state) || false, - local: (i.applicable_taxes && i.applicable_taxes.local) || false + federal: i.applicable_taxes?.federal || false, + state: i.applicable_taxes?.state || false, + local: i.applicable_taxes?.local || false } }; }), diff --git a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx index 3694780d0..775f4d32b 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx @@ -1,18 +1,15 @@ import { Button, Checkbox, Form, Modal } from "antd"; import queryString from "query-string"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { useLocation, useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; -import { insertAuditTrail } from "../../redux/application/application.actions"; import { setModalContext } from "../../redux/modals/modals.actions"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import ReadOnlyFormItemComponent from "../form-items-formatted/read-only-form-item.component"; -const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop -}); +const mapStateToProps = createStructuredSelector({}); + const mapDispatchToProps = (dispatch) => ({ setPartsOrderContext: (context) => dispatch( @@ -20,20 +17,12 @@ const mapDispatchToProps = (dispatch) => ({ context: context, modal: "partsOrder" }) - ), - insertAuditTrail: ({ jobid, operation, type }) => - dispatch( - insertAuditTrail({ - jobid, - operation, - type - }) ) }); export default connect(mapStateToProps, mapDispatchToProps)(BillDetailEditReturn); -export function BillDetailEditReturn({ setPartsOrderContext, insertAuditTrail, bodyshop, data, disabled }) { +export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) { const search = queryString.parse(useLocation().search); const history = useNavigate(); const { t } = useTranslation(); @@ -86,9 +75,9 @@ export function BillDetailEditReturn({ setPartsOrderContext, insertAuditTrail, b title={t("bills.actions.return")} onOk={() => form.submit()} > -
+ - {(fields, { add, remove, move }) => { + {(fields) => { return ( diff --git a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx index f2b4e9ddf..8a24df0b1 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx @@ -1,6 +1,5 @@ import { Drawer, Grid } from "antd"; import queryString from "query-string"; -import React from "react"; import { useLocation, useNavigate } from "react-router-dom"; import BillDetailEditComponent from "./bill-detail-edit-component"; diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index 27dc0a1b0..f18f1123a 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -85,6 +85,8 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, } setLoading(true); + + // eslint-disable-next-line no-unused-vars const { upload, location, outstanding_returns, inventory, federal_tax_exempt, ...remainingValues } = values; let adjustmentsToInsert = {}; @@ -102,9 +104,13 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, const { deductedfromlbr, lbr_adjustment, + // eslint-disable-next-line no-unused-vars location: lineLocation, + // eslint-disable-next-line no-unused-vars part_type, + // eslint-disable-next-line no-unused-vars create_ppc, + // eslint-disable-next-line no-unused-vars original_actual_price, ...restI } = i; diff --git a/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx b/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx index 2cb93f328..4ef00afb1 100644 --- a/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx +++ b/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx @@ -1,11 +1,11 @@ import { Form, Input, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { alphaSort } from "../../utils/sorters"; import BillFormItemsExtendedFormItem from "./bill-form-lines.extended.formitem.component"; -export default function BillFormLinesExtended({ lineData, discount, form, responsibilityCenters, disabled }) { +export default function BillFormLinesExtended({ lineData, discount, form, responsibilityCenters }) { const [search, setSearch] = useState(""); const { t } = useTranslation(); const columns = [ diff --git a/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx b/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx index 50dd3ab10..ac136cdce 100644 --- a/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx +++ b/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { MinusCircleFilled, PlusCircleFilled, WarningOutlined } from "@ant-design/icons"; import { Button, Form, Input, InputNumber, Select, Space, Switch } from "antd"; import { useTranslation } from "react-i18next"; @@ -12,7 +11,7 @@ import CiecaSelect from "../../utils/Ciecaselect"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(BillFormItemsExtendedFormItem); @@ -22,7 +21,6 @@ export function BillFormItemsExtendedFormItem({ bodyshop, form, record, - index, disabled, responsibilityCenters, discount @@ -78,7 +76,7 @@ export function BillFormItemsExtendedFormItem({ ...billlineskeys, [record.id]: { ...billlineskeys[billlineskeys], - actual_cost: !!billlineskeys[billlineskeys].actual_cost + actual_cost: billlineskeys[billlineskeys].actual_cost ? billlineskeys[billlineskeys].actual_cost : Math.round((parseFloat(e.target.value) * (1 - discount) + Number.EPSILON) * 100) / 100 } @@ -93,7 +91,7 @@ export function BillFormItemsExtendedFormItem({ {() => { const line = value; - if (!!!line) return null; + if (!line) return null; const lineDiscount = (1 - Math.round((line.actual_cost / line.actual_price) * 100) / 100).toPrecision(2); if (lineDiscount - discount === 0) return
; diff --git a/client/src/components/bill-form/bill-form.component.jsx b/client/src/components/bill-form/bill-form.component.jsx index 143747f61..c0f209205 100644 --- a/client/src/components/bill-form/bill-form.component.jsx +++ b/client/src/components/bill-form/bill-form.component.jsx @@ -2,7 +2,7 @@ import Icon, { UploadOutlined } from "@ant-design/icons"; import { useApolloClient } from "@apollo/client"; import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Alert, Divider, Form, Input, Select, Space, Statistic, Switch, Upload } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { MdOpenInNew } from "react-icons/md"; import { connect } from "react-redux"; @@ -26,7 +26,7 @@ import DateTimePicker from "../form-date-time-picker/form-date-time-picker.compo const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); export function BillFormComponent({ bodyshop, @@ -254,7 +254,7 @@ export function BillFormComponent({ required: true //message: t("general.validation.required"), }, - ({ getFieldValue }) => ({ + () => ({ validator(rule, value) { if (ClosingPeriod.treatment === "on" && bodyshop.accountingconfig.ClosingPeriod) { if ( @@ -374,8 +374,10 @@ export function BillFormComponent({ let totals; if (!!values.total && !!values.billlines && values.billlines.length > 0) totals = CalculateBillTotal(values); - if (!!totals) + if (totals) return ( + // TODO: Align is not correct + // eslint-disable-next-line react/no-unknown-property
@@ -458,7 +460,7 @@ export function BillFormComponent({ if (Array.isArray(e)) { return e; } - return e && e.fileList; + return e?.fileList; }} > false} listType="picture"> diff --git a/client/src/components/bill-form/bill-form.container.jsx b/client/src/components/bill-form/bill-form.container.jsx index 93af78498..6ba9bd39f 100644 --- a/client/src/components/bill-form/bill-form.container.jsx +++ b/client/src/components/bill-form/bill-form.container.jsx @@ -1,6 +1,5 @@ import { useLazyQuery, useQuery } from "@apollo/client"; import { useSplitTreatments } from "@splitsoftware/splitio-react"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { QUERY_OUTSTANDING_INVENTORY } from "../../graphql/inventory.queries"; diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index 896c529eb..994169302 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -1,7 +1,6 @@ import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons"; import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Button, Checkbox, Form, Input, InputNumber, Select, Space, Switch, Table, Tooltip } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -16,7 +15,7 @@ const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -27,8 +26,7 @@ export function BillEnterModalLinesComponent({ discount, form, responsibilityCenters, - billEdit, - billid + billEdit }) { const { t } = useTranslation(); const { setFieldsValue, getFieldsValue, getFieldValue } = form; @@ -126,7 +124,7 @@ export function BillEnterModalLinesComponent({ ] }; }, - formInput: (record, index) => + formInput: () => }, { title: t("billlines.fields.quantity"), @@ -158,7 +156,7 @@ export function BillEnterModalLinesComponent({ ] }; }, - formInput: (record, index) => + formInput: () => }, { title: t("billlines.fields.actual_price"), @@ -188,7 +186,7 @@ export function BillEnterModalLinesComponent({ if (idx === index) { return { ...item, - actual_cost: !!item.actual_cost + actual_cost: item.actual_cost ? item.actual_cost : Math.round((parseFloat(e.target.value) * (1 - discount) + Number.EPSILON) * 100) / 100 }; @@ -258,7 +256,7 @@ export function BillEnterModalLinesComponent({ {() => { const line = getFieldsValue(["billlines"]).billlines[index]; - if (!!!line) return null; + if (!line) return null; let lineDiscount = 1 - line.actual_cost / line.actual_price; if (isNaN(lineDiscount)) lineDiscount = 0; return ( @@ -322,7 +320,7 @@ export function BillEnterModalLinesComponent({ ] }; }, - formInput: (record, index) => ( + formInput: () => ( {bodyshop.md_parts_locations.map((loc, idx) => ( @@ -366,7 +364,7 @@ export function BillEnterModalLinesComponent({ name: [field.name, "deductedfromlbr"] }; }, - formInput: (record, index) => , + formInput: () => , additional: (record, index) => ( {() => { @@ -478,7 +476,7 @@ export function BillEnterModalLinesComponent({ name: [field.name, "applicable_taxes", "federal"] }; }, - formInput: (record, index) => + formInput: () => } ] }), @@ -495,7 +493,7 @@ export function BillEnterModalLinesComponent({ name: [field.name, "applicable_taxes", "state"] }; }, - formInput: (record, index) => + formInput: () => }, ...InstanceRenderManager({ @@ -513,7 +511,7 @@ export function BillEnterModalLinesComponent({ name: [field.name, "applicable_taxes", "local"] }; }, - formInput: (record, index) => + formInput: () => } ] }), @@ -575,7 +573,7 @@ export function BillEnterModalLinesComponent({ } ]} > - {(fields, { add, remove, move }) => { + {(fields, { add, remove }) => { return ( <>
{ +const EditableCell = ({ dataIndex, record, children, formInput, formItemProps, additional, wrapper, ...restProps }) => { const propsFinal = formItemProps && formItemProps(record); if (propsFinal && "key" in propsFinal) { delete propsFinal.key; diff --git a/client/src/components/bill-form/bill-form.totals.utility.js b/client/src/components/bill-form/bill-form.totals.utility.js index cec5c9152..08ef9ba9e 100644 --- a/client/src/components/bill-form/bill-form.totals.utility.js +++ b/client/src/components/bill-form/bill-form.totals.utility.js @@ -9,10 +9,10 @@ export const CalculateBillTotal = (invoice) => { let stateTax = Dinero({ amount: 0 }); let localTax = Dinero({ amount: 0 }); - if (!!!billlines) return null; + if (!billlines) return null; billlines.forEach((i) => { - if (!!i) { + if (i) { const itemTotal = Dinero({ amount: Math.round((i.actual_cost || 0) * 100) }).multiply(i.quantity || 1); diff --git a/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx b/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx index 7cbdd27b9..bda477748 100644 --- a/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx +++ b/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx @@ -1,5 +1,5 @@ import { Checkbox, Form, Skeleton, Typography } from "antd"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import ReadOnlyFormItemComponent from "../form-items-formatted/read-only-form-item.component"; import "./bill-inventory-table.styles.scss"; @@ -13,7 +13,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, billEnterModal: selectBillEnterModal }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(BillInventoryTable); @@ -22,7 +22,7 @@ export function BillInventoryTable({ billEnterModal, bodyshop, form, billEdit, i const { t } = useTranslation(); useEffect(() => { - if (inventoryData && inventoryData.inventory) { + if (inventoryData?.inventory) { form.setFieldsValue({ inventory: billEnterModal.context.consumeinventoryid ? inventoryData.inventory.map((i) => { @@ -47,7 +47,7 @@ export function BillInventoryTable({ billEnterModal, bodyshop, form, billEdit, i return ( - {(fields, { add, remove, move }) => { + {(fields) => { return ( <> {t("inventory.labels.inventory")} diff --git a/client/src/components/bill-mark-exported-button/bill-mark-exported-button.component.jsx b/client/src/components/bill-mark-exported-button/bill-mark-exported-button.component.jsx index a3954a626..2acb47766 100644 --- a/client/src/components/bill-mark-exported-button/bill-mark-exported-button.component.jsx +++ b/client/src/components/bill-mark-exported-button/bill-mark-exported-button.component.jsx @@ -1,6 +1,6 @@ import { gql, useMutation } from "@apollo/client"; import { Button } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -15,7 +15,7 @@ const mapStateToProps = createStructuredSelector({ authLevel: selectAuthLevel, currentUser: selectCurrentUser }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); diff --git a/client/src/components/bill-print-button/bill-print-button.component.jsx b/client/src/components/bill-print-button/bill-print-button.component.jsx index 70449db3e..121579e40 100644 --- a/client/src/components/bill-print-button/bill-print-button.component.jsx +++ b/client/src/components/bill-print-button/bill-print-button.component.jsx @@ -1,5 +1,5 @@ import { Button, Space } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; @@ -26,7 +26,7 @@ export default function BillPrintButton({ billid }) { null, notification ); - } catch (e) { + } catch { console.warn("Warning: Error generating a document."); } setLoading(false); diff --git a/client/src/components/bill-reexport-button/bill-reexport-button.component.jsx b/client/src/components/bill-reexport-button/bill-reexport-button.component.jsx index 03c5e47e7..5db76ca62 100644 --- a/client/src/components/bill-reexport-button/bill-reexport-button.component.jsx +++ b/client/src/components/bill-reexport-button/bill-reexport-button.component.jsx @@ -1,6 +1,6 @@ import { gql, useMutation } from "@apollo/client"; import { Button } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -13,7 +13,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, authLevel: selectAuthLevel }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); diff --git a/client/src/components/billline-add-inventory/billline-add-inventory.component.jsx b/client/src/components/billline-add-inventory/billline-add-inventory.component.jsx index 81321bcbc..583da81b7 100644 --- a/client/src/components/billline-add-inventory/billline-add-inventory.component.jsx +++ b/client/src/components/billline-add-inventory/billline-add-inventory.component.jsx @@ -3,7 +3,7 @@ import { useMutation } from "@apollo/client"; import { Button, Tooltip } from "antd"; import { t } from "i18next"; import dayjs from "./../../utils/day"; -import React, { useState } from "react"; +import { useState } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { INSERT_INVENTORY_AND_CREDIT } from "../../graphql/inventory.queries"; @@ -17,7 +17,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, currentUser: selectCurrentUser }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(BilllineAddInventory); diff --git a/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx b/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx index 433f18960..09c157ef0 100644 --- a/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx +++ b/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries"; import { useQuery } from "@apollo/client"; import queryString from "query-string"; @@ -100,9 +100,9 @@ export default function BillsVendorsList() { selectedRowKeys: [search.vendorid], type: "radio" }} - onRow={(record, rowIndex) => { + onRow={(record) => { return { - onClick: (event) => { + onClick: () => { handleOnRowClick(record); } // click row }; diff --git a/client/src/components/breadcrumbs/breadcrumbs.component.jsx b/client/src/components/breadcrumbs/breadcrumbs.component.jsx index 93a9d0192..eac85832c 100644 --- a/client/src/components/breadcrumbs/breadcrumbs.component.jsx +++ b/client/src/components/breadcrumbs/breadcrumbs.component.jsx @@ -1,10 +1,9 @@ import { HomeFilled } from "@ant-design/icons"; import { Breadcrumb, Col, Row } from "antd"; -import React from "react"; +import { selectBreadcrumbs, selectIsPartsEntry } from "../../redux/application/application.selectors"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; -import { selectBreadcrumbs } from "../../redux/application/application.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; import GlobalSearch from "../global-search/global-search.component"; import GlobalSearchOs from "../global-search/global-search-os.component"; @@ -13,10 +12,11 @@ import { useSplitTreatments } from "@splitsoftware/splitio-react"; const mapStateToProps = createStructuredSelector({ breadcrumbs: selectBreadcrumbs, - bodyshop: selectBodyshop + bodyshop: selectBodyshop, + isPartsEntry: selectIsPartsEntry }); -export function BreadCrumbs({ breadcrumbs, bodyshop }) { +export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) { const { treatments: { OpenSearch } } = useSplitTreatments({ @@ -34,7 +34,7 @@ export function BreadCrumbs({ breadcrumbs, bodyshop }) { { key: "home", title: ( - + {(bodyshop && bodyshop.shopname && `(${bodyshop.shopname})`) || ""} ) diff --git a/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx b/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx index 563beac83..0cb61e85e 100644 --- a/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx +++ b/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx @@ -1,5 +1,5 @@ import { Button, Form, Modal } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -32,12 +32,13 @@ export function ContractsFindModalContainer({ caBcEtfTableModal, toggleModalVisi logImEXEvent("ca_bc_etf_table_parse"); setLoading(true); const claimNumbers = []; - values.table.split("\n").forEach((row, idx, arr) => { + values.table.split("\n").forEach((row) => { const { 1: claim, 2: shortclaim, 4: amount } = row.split("\t"); if (!claim || !shortclaim) return; const trimmedShortClaim = shortclaim.trim(); // const trimmedClaim = claim.trim(); if (amount.slice(-1) === "-") { + // NO OP } claimNumbers.push({ diff --git a/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table.modal.component.jsx b/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table.modal.component.jsx index e9224ae6b..517ed9db2 100644 --- a/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table.modal.component.jsx +++ b/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table.modal.component.jsx @@ -1,17 +1,13 @@ import { Form, Input, Radio } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectBodyshop } from "../../redux/user/user.selectors"; -const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop -}); +const mapStateToProps = createStructuredSelector({}); export default connect(mapStateToProps, null)(PartsReceiveModalComponent); -export function PartsReceiveModalComponent({ bodyshop, form }) { +export function PartsReceiveModalComponent() { const { t } = useTranslation(); return ( diff --git a/client/src/components/ca-bc-pvrt-calculator/ca-bc-pvrt-calculator.component.jsx b/client/src/components/ca-bc-pvrt-calculator/ca-bc-pvrt-calculator.component.jsx index c48875f4c..ee99c1c8b 100644 --- a/client/src/components/ca-bc-pvrt-calculator/ca-bc-pvrt-calculator.component.jsx +++ b/client/src/components/ca-bc-pvrt-calculator/ca-bc-pvrt-calculator.component.jsx @@ -1,6 +1,6 @@ import { CalculatorFilled } from "@ant-design/icons"; import { Button, Form, InputNumber, Popover, Space } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { logImEXEvent } from "../../firebase/firebase.utils"; diff --git a/client/src/components/card-payment-modal/card-payment-modal.component.jsx b/client/src/components/card-payment-modal/card-payment-modal.component.jsx index 7e82168a0..b69644789 100644 --- a/client/src/components/card-payment-modal/card-payment-modal.component.jsx +++ b/client/src/components/card-payment-modal/card-payment-modal.component.jsx @@ -2,7 +2,7 @@ import { CopyFilled, DeleteFilled } from "@ant-design/icons"; import { useLazyQuery, useMutation } from "@apollo/client"; import { Button, Card, Col, Form, Input, message, Row, Space, Spin, Statistic } from "antd"; import axios from "axios"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -133,7 +133,6 @@ const CardPaymentModalComponent = ({ }); if (window.intellipay) { - // eslint-disable-next-line no-eval eval(response.data); pollForIntelliPay(() => { SetIntellipayCallbackFunctions(); @@ -149,7 +148,7 @@ const CardPaymentModalComponent = ({ window.intellipay.initialize(); }); } - } catch (error) { + } catch { notification.open({ type: "error", message: t("job_payments.notifications.error.openingip") @@ -187,7 +186,7 @@ const CardPaymentModalComponent = ({ message.success(t("general.actions.copied")); } setLoading(false); - } catch (error) { + } catch { notification.open({ type: "error", message: t("job_payments.notifications.error.openingip") @@ -359,7 +358,7 @@ function pollForIntelliPay(callbackFunction) { const startTime = Date.now(); function checkFixAmount() { - if (window.intellipay && window.intellipay.fixAmount !== undefined) { + if (window.intellipay?.fixAmount) { callbackFunction(); return; } diff --git a/client/src/components/card-payment-modal/card-payment-modal.container.jsx b/client/src/components/card-payment-modal/card-payment-modal.container.jsx index 83210f06f..4aebc4e20 100644 --- a/client/src/components/card-payment-modal/card-payment-modal.container.jsx +++ b/client/src/components/card-payment-modal/card-payment-modal.container.jsx @@ -1,23 +1,20 @@ import { Button, Modal } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectCardPayment } from "../../redux/modals/modals.selectors"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import CardPaymentModalComponent from "./card-payment-modal.component"; const mapStateToProps = createStructuredSelector({ - cardPaymentModal: selectCardPayment, - bodyshop: selectBodyshop + cardPaymentModal: selectCardPayment }); const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")) }); -function CardPaymentModalContainer({ cardPaymentModal, toggleModalVisible, bodyshop }) { +function CardPaymentModalContainer({ cardPaymentModal, toggleModalVisible }) { const { open } = cardPaymentModal; const { t } = useTranslation(); diff --git a/client/src/components/chat-affix/registerMessagingSocketHandlers.js b/client/src/components/chat-affix/registerMessagingSocketHandlers.js index 88e0ac9df..14d7d4a0e 100644 --- a/client/src/components/chat-affix/registerMessagingSocketHandlers.js +++ b/client/src/components/chat-affix/registerMessagingSocketHandlers.js @@ -57,7 +57,7 @@ export const registerMessagingHandlers = ({ socket, client }) => { existingConversation: true }); } - } catch (error) { + } catch { logLocal("handleNewMessageSummary - Cache miss", { conversationId }); } } @@ -328,8 +328,7 @@ export const registerMessagingHandlers = ({ socket, client }) => { } break; - case "tag-added": - // Ensure `job_conversations` is properly formatted + case "tag-added": { // Ensure `job_conversations` is properly formatted const formattedJobConversations = job_conversations.map((jc) => ({ __typename: "job_conversations", jobid: jc.jobid || jc.job?.id, @@ -375,6 +374,7 @@ export const registerMessagingHandlers = ({ socket, client }) => { }); break; + } case "tag-removed": try { @@ -462,7 +462,7 @@ export const registerMessagingHandlers = ({ socket, client }) => { logLocal("handlePhoneNumberOptedOut - Error", { error: error.message }); } }; - + // New handler for phone number opt-in const handlePhoneNumberOptedIn = async (data) => { const { bodyshopid, phone_number } = data; diff --git a/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx b/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx index 72f8be33c..c971c118a 100644 --- a/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx +++ b/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx @@ -67,7 +67,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation, item.job_conversations.length > 0 ? item.job_conversations.map((j, idx) => {j.job.ro_number}) : null; - const names = <>{_.uniq(item.job_conversations.map((j, idx) => OwnerNameDisplayFunction(j.job)))}; + const names = <>{_.uniq(item.job_conversations.map((j) => OwnerNameDisplayFunction(j.job)))}; const cardTitle = ( <> {item.label && {item.label}} diff --git a/client/src/components/chat-conversation-title-tags/chat-conversation-title-tags.component.jsx b/client/src/components/chat-conversation-title-tags/chat-conversation-title-tags.component.jsx index 32ca5cad0..2aeb16573 100644 --- a/client/src/components/chat-conversation-title-tags/chat-conversation-title-tags.component.jsx +++ b/client/src/components/chat-conversation-title-tags/chat-conversation-title-tags.component.jsx @@ -21,7 +21,7 @@ export function ChatConversationTitleTags({ jobConversations, bodyshop }) { const handleRemoveTag = async (jobId) => { const convId = jobConversations[0].conversationid; - if (!!convId) { + if (convId) { await removeJobConversation({ variables: { conversationId: convId, diff --git a/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx b/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx index 933617cde..86b8cca60 100644 --- a/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx +++ b/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx @@ -1,5 +1,4 @@ import { Space } from "antd"; -import React from "react"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import ChatArchiveButton from "../chat-archive-button/chat-archive-button.component"; import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component"; @@ -16,10 +15,10 @@ const mapDispatchToProps = () => ({}); export function ChatConversationTitle({ conversation }) { return ( - {conversation && conversation.phone_num} + {conversation?.phone_num} - + diff --git a/client/src/components/chat-conversation/chat-conversation.component.jsx b/client/src/components/chat-conversation/chat-conversation.component.jsx index 3334b5cbd..f5812e34f 100644 --- a/client/src/components/chat-conversation/chat-conversation.component.jsx +++ b/client/src/components/chat-conversation/chat-conversation.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import AlertComponent from "../alert/alert.component"; import ChatConversationTitle from "../chat-conversation-title/chat-conversation-title.component"; import ChatMessageListComponent from "../chat-messages-list/chat-message-list.component"; diff --git a/client/src/components/chat-label/chat-label.component.jsx b/client/src/components/chat-label/chat-label.component.jsx index 1152acf29..5fc4274d6 100644 --- a/client/src/components/chat-label/chat-label.component.jsx +++ b/client/src/components/chat-label/chat-label.component.jsx @@ -14,7 +14,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); export function ChatLabel({ conversation, bodyshop }) { const [loading, setLoading] = useState(false); diff --git a/client/src/components/chat-media-selector/chat-media-selector.component.jsx b/client/src/components/chat-media-selector/chat-media-selector.component.jsx index 75de2879a..85ea7aa93 100644 --- a/client/src/components/chat-media-selector/chat-media-selector.component.jsx +++ b/client/src/components/chat-media-selector/chat-media-selector.component.jsx @@ -19,7 +19,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); export default connect(mapStateToProps, mapDispatchToProps)(ChatMediaSelector); diff --git a/client/src/components/chat-messages-list/chat-message-list.component.jsx b/client/src/components/chat-messages-list/chat-message-list.component.jsx index 3f2bba2f0..18658ea4a 100644 --- a/client/src/components/chat-messages-list/chat-message-list.component.jsx +++ b/client/src/components/chat-messages-list/chat-message-list.component.jsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { Virtuoso } from "react-virtuoso"; import { renderMessage } from "./renderMessage"; import "./chat-message-list.styles.scss"; @@ -76,7 +76,7 @@ export default function ChatMessageListComponent({ messages }) { acc + (message.image_path?.length || 0), 0) ? messages.length : 0} + overscan={messages.reduce((acc, message) => acc + (message.image_path?.length || 0), 0) ? messages.length : 0} itemContent={(index) => renderMessage(messages, index)} followOutput={(isAtBottom) => handleScrollStateChange(isAtBottom)} initialTopMostItemIndex={messages.length - 1} diff --git a/client/src/components/chat-presets/chat-presets.component.jsx b/client/src/components/chat-presets/chat-presets.component.jsx index 63b79c373..be3a15e00 100644 --- a/client/src/components/chat-presets/chat-presets.component.jsx +++ b/client/src/components/chat-presets/chat-presets.component.jsx @@ -1,6 +1,5 @@ import { PlusCircleOutlined } from "@ant-design/icons"; import { Dropdown } from "antd"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setMessage } from "../../redux/messaging/messaging.actions"; diff --git a/client/src/components/chat-print-button/chat-print-button.component.jsx b/client/src/components/chat-print-button/chat-print-button.component.jsx index eb6491b33..b2c514226 100644 --- a/client/src/components/chat-print-button/chat-print-button.component.jsx +++ b/client/src/components/chat-print-button/chat-print-button.component.jsx @@ -1,6 +1,6 @@ import { MailOutlined, PrinterOutlined } from "@ant-design/icons"; import { Space, Spin } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setEmailOptions } from "../../redux/email/email.actions"; @@ -31,7 +31,7 @@ export function ChatPrintButton({ conversation }) { type, conversation.id, notification - ).catch((e) => { + ).catch(() => { console.warn("Something went wrong generating a document."); }); setLoading(false); diff --git a/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx b/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx index f40c5c85e..3b4fb5c3d 100644 --- a/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx +++ b/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx @@ -1,6 +1,5 @@ import { CloseCircleOutlined, LoadingOutlined } from "@ant-design/icons"; import { Empty, Select, Space } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; diff --git a/client/src/components/config-form-components/checkbox/checkbox.component.jsx b/client/src/components/config-form-components/checkbox/checkbox.component.jsx index 7c5a6c4be..3cae823de 100644 --- a/client/src/components/config-form-components/checkbox/checkbox.component.jsx +++ b/client/src/components/config-form-components/checkbox/checkbox.component.jsx @@ -1,5 +1,4 @@ import { Checkbox, Form } from "antd"; -import React from "react"; export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) { const { name, label, required } = formItem; diff --git a/client/src/components/config-form-components/config-form-components.component.jsx b/client/src/components/config-form-components/config-form-components.component.jsx index abcd6a6b5..57873b3a8 100644 --- a/client/src/components/config-form-components/config-form-components.component.jsx +++ b/client/src/components/config-form-components/config-form-components.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import FormTypes from "./config-form-types"; export default function ConfirmFormComponents({ componentList, readOnly }) { @@ -7,7 +6,7 @@ export default function ConfirmFormComponents({ componentList, readOnly }) { {componentList.map((f, idx) => { const Comp = FormTypes[f.type]; - if (!!Comp) { + if (Comp) { return ; } else { return
Error
; diff --git a/client/src/components/config-form-components/rate/rate.component.jsx b/client/src/components/config-form-components/rate/rate.component.jsx index 9f7e0189f..6dd09a93a 100644 --- a/client/src/components/config-form-components/rate/rate.component.jsx +++ b/client/src/components/config-form-components/rate/rate.component.jsx @@ -1,5 +1,4 @@ import { Form, Rate } from "antd"; -import React from "react"; export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) { const { name, label, required } = formItem; diff --git a/client/src/components/config-form-components/slider/slider.component.jsx b/client/src/components/config-form-components/slider/slider.component.jsx index 1fde2bfa4..aff44968e 100644 --- a/client/src/components/config-form-components/slider/slider.component.jsx +++ b/client/src/components/config-form-components/slider/slider.component.jsx @@ -1,5 +1,4 @@ import { Form, Slider } from "antd"; -import React from "react"; export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) { const { name, label, required, min, max } = formItem; diff --git a/client/src/components/config-form-components/text/text.component.jsx b/client/src/components/config-form-components/text/text.component.jsx index 73394e0c0..cfaea3933 100644 --- a/client/src/components/config-form-components/text/text.component.jsx +++ b/client/src/components/config-form-components/text/text.component.jsx @@ -1,5 +1,4 @@ import { Form, Input } from "antd"; -import React from "react"; export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) { const { name, label, required } = formItem; diff --git a/client/src/components/config-form-components/textarea/textarea.component.jsx b/client/src/components/config-form-components/textarea/textarea.component.jsx index c9bb19781..b22e5fd96 100644 --- a/client/src/components/config-form-components/textarea/textarea.component.jsx +++ b/client/src/components/config-form-components/textarea/textarea.component.jsx @@ -1,5 +1,4 @@ import { Form, Input } from "antd"; -import React from "react"; export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) { const { name, label, required, rows } = formItem; diff --git a/client/src/components/conflict/conflict.component.jsx b/client/src/components/conflict/conflict.component.jsx index a14209f8b..5ca772d4a 100644 --- a/client/src/components/conflict/conflict.component.jsx +++ b/client/src/components/conflict/conflict.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { Button, Result } from "antd"; import { useTranslation } from "react-i18next"; import InstanceRenderManager from "../../utils/instanceRenderMgr"; diff --git a/client/src/components/contract-cars/contract-cars.component.jsx b/client/src/components/contract-cars/contract-cars.component.jsx index 830dd5531..ad606af1f 100644 --- a/client/src/components/contract-cars/contract-cars.component.jsx +++ b/client/src/components/contract-cars/contract-cars.component.jsx @@ -1,5 +1,5 @@ import { Card, Input, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { alphaSort } from "../../utils/sorters"; @@ -114,9 +114,9 @@ export default function ContractsCarsComponent({ loading, data, selectedCarId, h type: "radio", selectedRowKeys: [selectedCarId] }} - onRow={(record, rowIndex) => { + onRow={(record) => { return { - onClick: (event) => { + onClick: () => { handleSelect(record); } }; diff --git a/client/src/components/contract-cars/contract-cars.container.jsx b/client/src/components/contract-cars/contract-cars.container.jsx index 24364313d..21d91c058 100644 --- a/client/src/components/contract-cars/contract-cars.container.jsx +++ b/client/src/components/contract-cars/contract-cars.container.jsx @@ -1,6 +1,5 @@ import { useQuery } from "@apollo/client"; import dayjs from "../../utils/day"; -import React from "react"; import { QUERY_AVAILABLE_CC } from "../../graphql/courtesy-car.queries"; import AlertComponent from "../alert/alert.component"; import ContractCarsComponent from "./contract-cars.component"; diff --git a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx index e4655c23b..36d7b977a 100644 --- a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx +++ b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx @@ -2,7 +2,7 @@ import { useMutation } from "@apollo/client"; import { Button, Form, InputNumber, Popover, Radio, Select, Space } from "antd"; import axios from "axios"; import dayjs from "../../utils/day"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { useNavigate } from "react-router-dom"; @@ -16,7 +16,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, currentUser: selectCurrentUser }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -270,7 +270,7 @@ export function ContractConvertToRo({ bodyshop, currentUser, contract, disabled // awaitRefetchQueries: true, }); - if (!!result.errors) { + if (result.errors) { notification["error"]({ message: t("jobs.errors.inserting", { message: JSON.stringify(result.errors) diff --git a/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx b/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx index 75aaa3c9f..75e190056 100644 --- a/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx +++ b/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx @@ -1,5 +1,4 @@ import { Card } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import DataLabel from "../data-label/data-label.component"; diff --git a/client/src/components/contract-form/contract-form-job-prefill.component.jsx b/client/src/components/contract-form/contract-form-job-prefill.component.jsx index 6d63f5b8a..68977a3d1 100644 --- a/client/src/components/contract-form/contract-form-job-prefill.component.jsx +++ b/client/src/components/contract-form/contract-form-job-prefill.component.jsx @@ -1,6 +1,6 @@ import { useLazyQuery } from "@apollo/client"; import { Button } from "antd"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { GET_JOB_FOR_CC_CONTRACT } from "../../graphql/jobs.queries"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; diff --git a/client/src/components/contract-form/contract-form.component.jsx b/client/src/components/contract-form/contract-form.component.jsx index b71d7f92f..2c868804d 100644 --- a/client/src/components/contract-form/contract-form.component.jsx +++ b/client/src/components/contract-form/contract-form.component.jsx @@ -1,6 +1,5 @@ import { WarningFilled } from "@ant-design/icons"; import { Form, Input, InputNumber, Space } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { DateFormatter } from "../../utils/DateFormatter"; import dayjs from "../../utils/day"; diff --git a/client/src/components/contract-job-block/contract-job-block.component.jsx b/client/src/components/contract-job-block/contract-job-block.component.jsx index 526860b6b..b85fb0745 100644 --- a/client/src/components/contract-job-block/contract-job-block.component.jsx +++ b/client/src/components/contract-job-block/contract-job-block.component.jsx @@ -1,5 +1,4 @@ import { Card } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import DataLabel from "../data-label/data-label.component"; diff --git a/client/src/components/contract-jobs/contract-jobs.component.jsx b/client/src/components/contract-jobs/contract-jobs.component.jsx index ea71c2538..f35e5ff99 100644 --- a/client/src/components/contract-jobs/contract-jobs.component.jsx +++ b/client/src/components/contract-jobs/contract-jobs.component.jsx @@ -1,5 +1,5 @@ import { Card, Input, Table } from "antd"; -import React, { useMemo, useState } from "react"; +import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { alphaSort } from "../../utils/sorters"; import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; @@ -142,9 +142,9 @@ export default function ContractsJobsComponent({ loading, data, selectedJob, han type: "radio", selectedRowKeys: [selectedJob] }} - onRow={(record, rowIndex) => { + onRow={(record) => { return { - onClick: (event) => { + onClick: () => { handleSelect(record); } }; diff --git a/client/src/components/contract-jobs/contract-jobs.container.jsx b/client/src/components/contract-jobs/contract-jobs.container.jsx index 1db612a03..08caa3b9d 100644 --- a/client/src/components/contract-jobs/contract-jobs.container.jsx +++ b/client/src/components/contract-jobs/contract-jobs.container.jsx @@ -1,5 +1,4 @@ import { useQuery } from "@apollo/client"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries"; diff --git a/client/src/components/contract-license-decode-button/contract-license-decode-button.component.jsx b/client/src/components/contract-license-decode-button/contract-license-decode-button.component.jsx index f6bbf7e02..86825f157 100644 --- a/client/src/components/contract-license-decode-button/contract-license-decode-button.component.jsx +++ b/client/src/components/contract-license-decode-button/contract-license-decode-button.component.jsx @@ -1,6 +1,6 @@ import { Button, Input, Modal, Typography } from "antd"; import dayjs from "../../utils/day"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import aamva from "../../utils/aamva"; import DataLabel from "../data-label/data-label.component"; @@ -54,7 +54,7 @@ export default function ContractLicenseDecodeButton({ form }) { open={modalVisible} okText={t("contracts.actions.senddltoform")} onOk={handleInsertForm} - okButtonProps={{ disabled: !!!decodedBarcode }} + okButtonProps={{ disabled: !decodedBarcode }} onCancel={handleCancel} >
@@ -62,7 +62,7 @@ export default function ContractLicenseDecodeButton({ form }) { { + onChange={() => { if (!loading) setLoading(true); }} onPressEnter={handleDecode} diff --git a/client/src/components/contracts-find-modal/contracts-find-modal.component.jsx b/client/src/components/contracts-find-modal/contracts-find-modal.component.jsx index 52a216e7d..088363b8e 100644 --- a/client/src/components/contracts-find-modal/contracts-find-modal.component.jsx +++ b/client/src/components/contracts-find-modal/contracts-find-modal.component.jsx @@ -1,18 +1,14 @@ import { Form, Input } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import FormDateTimePicker from "../form-date-time-picker/form-date-time-picker.component"; -const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop -}); +const mapStateToProps = createStructuredSelector({}); export default connect(mapStateToProps, null)(PartsReceiveModalComponent); -export function PartsReceiveModalComponent({ bodyshop, form }) { +export function PartsReceiveModalComponent() { const { t } = useTranslation(); return ( diff --git a/client/src/components/contracts-find-modal/contracts-find-modal.container.jsx b/client/src/components/contracts-find-modal/contracts-find-modal.container.jsx index 57200f471..c7678e18f 100644 --- a/client/src/components/contracts-find-modal/contracts-find-modal.container.jsx +++ b/client/src/components/contracts-find-modal/contracts-find-modal.container.jsx @@ -1,6 +1,6 @@ import { useLazyQuery } from "@apollo/client"; import { Button, Form, Modal, Table } from "antd"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; @@ -9,13 +9,11 @@ import { logImEXEvent } from "../../firebase/firebase.utils"; import { FIND_CONTRACT } from "../../graphql/cccontracts.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectContractFinder } from "../../redux/modals/modals.selectors"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import ContractsFindModalComponent from "./contracts-find-modal.component"; import AlertComponent from "../alert/alert.component"; const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop, contractFinderModal: selectContractFinder }); @@ -23,12 +21,7 @@ const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("contractFinder")) }); -export function ContractsFindModalContainer({ - contractFinderModal, - toggleModalVisible, - - bodyshop -}) { +export function ContractsFindModalContainer({ contractFinderModal, toggleModalVisible }) { const { t } = useTranslation(); const { open } = contractFinderModal; @@ -133,7 +126,7 @@ export function ContractsFindModalContainer({ } ]} rowKey="id" - dataSource={data && data.cccontracts} + dataSource={data?.cccontracts} /> diff --git a/client/src/components/contracts-list/contracts-list.component.jsx b/client/src/components/contracts-list/contracts-list.component.jsx index a42afe90a..4d9493492 100644 --- a/client/src/components/contracts-list/contracts-list.component.jsx +++ b/client/src/components/contracts-list/contracts-list.component.jsx @@ -1,7 +1,7 @@ import { SyncOutlined } from "@ant-design/icons"; import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link, useLocation, useNavigate } from "react-router-dom"; import { setModalContext } from "../../redux/modals/modals.actions"; @@ -175,7 +175,7 @@ export function ContractsList({ bodyshop, loading, contracts, refetch, total, se pagination={{ position: "top", pageSize: pageLimit, - current: parseInt(page || 1), + current: parseInt(page || 1, 10), total: total }} columns={columns} diff --git a/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx b/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx index 922636804..ee8cbc820 100644 --- a/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx +++ b/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx @@ -1,6 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; import { Dropdown } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -13,8 +12,8 @@ const mapStateToProps = createStructuredSelector({ export function ContractsRatesChangeButton({ disabled, form, bodyshop }) { const { t } = useTranslation(); - const handleClick = ({ item, key, keyPath }) => { - const { label, ...rate } = item.props.value; + const handleClick = ({ item }) => { + const { ...rate } = item.props.value; form.setFieldsValue(rate); }; diff --git a/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx b/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx index 34c6e3bfc..b8f959e43 100644 --- a/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx +++ b/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx @@ -1,6 +1,5 @@ import { Card, Table } from "antd"; import queryString from "query-string"; -import React from "react"; import { useTranslation } from "react-i18next"; import { Link, useLocation, useNavigate } from "react-router-dom"; import { DateFormatter } from "../../utils/DateFormatter"; diff --git a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx index cc3fcd310..cbbba8e85 100644 --- a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx +++ b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx @@ -3,7 +3,6 @@ import { useApolloClient } from "@apollo/client"; import { Button, Form, Input, InputNumber, Space } from "antd"; import { PageHeader } from "@ant-design/pro-layout"; import dayjs from "../../utils/day"; -import React from "react"; import { useTranslation } from "react-i18next"; import { CHECK_CC_FLEET_NUMBER } from "../../graphql/courtesy-car.queries"; import { DateFormatter } from "../../utils/DateFormatter"; @@ -128,7 +127,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading, newC required: true //message: t("general.validation.required"), }, - ({ getFieldValue }) => ({ + () => ({ async validator(rule, value) { if (value) { const response = await client.query({ diff --git a/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx b/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx index 553798328..c6ff8212d 100644 --- a/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx +++ b/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx @@ -1,5 +1,5 @@ import { Select } from "antd"; -import React, { forwardRef, useEffect, useState } from "react"; +import { forwardRef, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; const { Option } = Select; diff --git a/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.component.jsx b/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.component.jsx index 3a7ec4c6b..abc6f9703 100644 --- a/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.component.jsx +++ b/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.component.jsx @@ -1,5 +1,4 @@ import { Form, InputNumber } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component"; import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx"; diff --git a/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.container.jsx b/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.container.jsx index 210f7887a..98a8cbbf1 100644 --- a/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.container.jsx +++ b/client/src/components/courtesy-car-return-modal/courtesy-car-return-modal.container.jsx @@ -1,11 +1,10 @@ import { Form, Modal } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectCourtesyCarReturn } from "../../redux/modals/modals.selectors"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import CourtesyCarReturnModalComponent from "./courtesy-car-return-modal.component"; import dayjs from "../../utils/day"; import { RETURN_CONTRACT } from "../../graphql/cccontracts.queries"; @@ -13,15 +12,14 @@ import { useMutation } from "@apollo/client"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; const mapStateToProps = createStructuredSelector({ - courtesyCarReturnModal: selectCourtesyCarReturn, - bodyshop: selectBodyshop + courtesyCarReturnModal: selectCourtesyCarReturn }); const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("courtesyCarReturn")) }); -export function CCReturnModalContainer({ courtesyCarReturnModal, toggleModalVisible, bodyshop }) { +export function CCReturnModalContainer({ courtesyCarReturnModal, toggleModalVisible }) { const [loading, setLoading] = useState(false); const { open, context, actions } = courtesyCarReturnModal; const { t } = useTranslation(); @@ -48,7 +46,7 @@ export function CCReturnModalContainer({ courtesyCarReturnModal, toggleModalVisi } } }) - .then((r) => { + .then(() => { if (actions.refetch) actions.refetch(); toggleModalVisible(); }) diff --git a/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx b/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx index 84c346ce6..11dd09296 100644 --- a/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx +++ b/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx @@ -1,4 +1,4 @@ -import React, { forwardRef, useEffect, useState } from "react"; +import { forwardRef, useEffect, useState } from "react"; import { Select } from "antd"; import { useTranslation } from "react-i18next"; diff --git a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx index eaf0efb45..aa64506da 100644 --- a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx +++ b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx @@ -1,7 +1,7 @@ import { SyncOutlined, WarningFilled } from "@ant-design/icons"; import { Button, Card, Dropdown, Input, Space, Table, Tooltip } from "antd"; import dayjs from "../../utils/day"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { DateTimeFormatter } from "../../utils/DateFormatter"; diff --git a/client/src/components/csi-response-form/csi-response-form.container.jsx b/client/src/components/csi-response-form/csi-response-form.container.jsx index 137a25faf..43d4b796b 100644 --- a/client/src/components/csi-response-form/csi-response-form.container.jsx +++ b/client/src/components/csi-response-form/csi-response-form.container.jsx @@ -1,7 +1,7 @@ import { useQuery } from "@apollo/client"; import { Card, Form, Result } from "antd"; import queryString from "query-string"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useLocation } from "react-router-dom"; import { QUERY_CSI_RESPONSE_BY_PK } from "../../graphql/csi.queries"; @@ -19,7 +19,7 @@ export default function CsiResponseFormContainer() { variables: { id: responseid }, - skip: !!!responseid, + skip: !responseid, fetchPolicy: "network-only", nextFetchPolicy: "network-only" }); @@ -28,7 +28,7 @@ export default function CsiResponseFormContainer() { form.resetFields(); }, [data, form]); - if (!!!responseid) + if (!responseid) return ( diff --git a/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx b/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx index d7b49df56..530ab86e1 100644 --- a/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx +++ b/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx @@ -1,7 +1,7 @@ import { SyncOutlined } from "@ant-design/icons"; import { Button, Card, Table } from "antd"; import queryString from "query-string"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link, useLocation, useNavigate } from "react-router-dom"; import { DateFormatter } from "../../utils/DateFormatter"; diff --git a/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx b/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx index 62370079b..5d3d154fb 100644 --- a/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx +++ b/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx @@ -1,7 +1,6 @@ import { Card } from "antd"; import _ from "lodash"; import dayjs from "../../../utils/day"; -import React from "react"; import { useTranslation } from "react-i18next"; import { Bar, CartesianGrid, ComposedChart, Legend, Line, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; import * as Utils from "../../scoreboard-targets-table/scoreboard-targets-table.util"; @@ -19,7 +18,7 @@ export default function DashboardMonthlyEmployeeEfficiency({ data, ...cardProps const chartData = listOfDays.reduce((acc, val) => { //Sum up the current day. let dailyHrs; - if (!!ticketsByDate[val]) { + if (ticketsByDate[val]) { dailyHrs = ticketsByDate[val].reduce( (dayAcc, dayVal) => { return { diff --git a/client/src/components/dashboard-components/monthly-job-costing/monthly-job-costing.component.jsx b/client/src/components/dashboard-components/monthly-job-costing/monthly-job-costing.component.jsx index 3924ccb37..ca491fe8c 100644 --- a/client/src/components/dashboard-components/monthly-job-costing/monthly-job-costing.component.jsx +++ b/client/src/components/dashboard-components/monthly-job-costing/monthly-job-costing.component.jsx @@ -1,6 +1,6 @@ import { Card, Input, Space, Table, Typography } from "antd"; import axios from "axios"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { alphaSort } from "../../../utils/sorters"; import LoadingSkeleton from "../../loading-skeleton/loading-skeleton.component"; @@ -19,7 +19,7 @@ export default function DashboardMonthlyJobCosting({ data, ...cardProps }) { useEffect(() => { async function getCostingData() { - if (data && data.monthly_sales) { + if (data?.monthly_sales) { setLoading(true); const response = await axios.post("/job/costingmulti", { jobids: data.monthly_sales.map((x) => x.id) @@ -79,7 +79,7 @@ export default function DashboardMonthlyJobCosting({ data, ...cardProps }) { ]; const filteredData = searchText === "" - ? (costingData && costingData.allCostCenterData) || [] + ? costingData?.allCostCenterData || [] : costingData.allCostCenterData.filter((d) => (d.cost_center || "").toString().toLowerCase().includes(searchText.toLowerCase()) ); @@ -117,15 +117,13 @@ export default function DashboardMonthlyJobCosting({ data, ...cardProps }) { {t("general.labels.totals")} - {Dinero( - costingData && costingData.allSummaryData && costingData.allSummaryData.totalSales - ).toFormat()} + {Dinero(costingData?.allSummaryData && costingData.allSummaryData.totalSales).toFormat()} - {Dinero(costingData && costingData.allSummaryData && costingData.allSummaryData.totalCost).toFormat()} + {Dinero(costingData?.allSummaryData && costingData.allSummaryData.totalCost).toFormat()} - {Dinero(costingData && costingData.allSummaryData && costingData.allSummaryData.gpdollars).toFormat()} + {Dinero(costingData?.allSummaryData && costingData.allSummaryData.gpdollars).toFormat()} diff --git a/client/src/components/dashboard-components/monthly-labor-sales/monthly-labor-sales.component.jsx b/client/src/components/dashboard-components/monthly-labor-sales/monthly-labor-sales.component.jsx index ca719b891..4ce1e2cef 100644 --- a/client/src/components/dashboard-components/monthly-labor-sales/monthly-labor-sales.component.jsx +++ b/client/src/components/dashboard-components/monthly-labor-sales/monthly-labor-sales.component.jsx @@ -1,6 +1,6 @@ import { Card } from "antd"; import Dinero from "dinero.js"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Cell, Pie, PieChart, ResponsiveContainer, Sector } from "recharts"; import DashboardRefreshRequired from "../refresh-required.component"; diff --git a/client/src/components/dashboard-components/monthly-parts-sales/monthly-parts-sales.component.jsx b/client/src/components/dashboard-components/monthly-parts-sales/monthly-parts-sales.component.jsx index a82134ae5..23ffa8a86 100644 --- a/client/src/components/dashboard-components/monthly-parts-sales/monthly-parts-sales.component.jsx +++ b/client/src/components/dashboard-components/monthly-parts-sales/monthly-parts-sales.component.jsx @@ -1,6 +1,6 @@ import { Card } from "antd"; import Dinero from "dinero.js"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Cell, Pie, PieChart, ResponsiveContainer, Sector } from "recharts"; import DashboardRefreshRequired from "../refresh-required.component"; diff --git a/client/src/components/dashboard-components/monthly-revenue-graph/monthly-revenue-graph.component.jsx b/client/src/components/dashboard-components/monthly-revenue-graph/monthly-revenue-graph.component.jsx index 4f9f5ac4c..c91e6b098 100644 --- a/client/src/components/dashboard-components/monthly-revenue-graph/monthly-revenue-graph.component.jsx +++ b/client/src/components/dashboard-components/monthly-revenue-graph/monthly-revenue-graph.component.jsx @@ -1,6 +1,5 @@ import { Card } from "antd"; import dayjs from "../../../utils/day"; -import React from "react"; import { useTranslation } from "react-i18next"; import _ from "lodash"; import { Area, Bar, CartesianGrid, ComposedChart, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; @@ -20,7 +19,7 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) { const chartData = listOfDays.reduce((acc, val) => { //Sum up the current day. let dailySales; - if (!!jobsByDate[val]) { + if (jobsByDate[val]) { dailySales = jobsByDate[val].reduce((dayAcc, dayVal) => { return dayAcc.add(Dinero((dayVal.job_totals && dayVal.job_totals.totals.subtotal) || 0)); }, Dinero()); @@ -46,7 +45,7 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) { - value && value.toFixed(2)} /> + value && value.toFixed(2)} /> ({}); +const mapDispatchToProps = () => ({}); export default connect(mapStateToProps, mapDispatchToProps)(DashboardTotalProductionHours); export function DashboardTotalProductionHours({ bodyshop, data, ...cardProps }) { diff --git a/client/src/components/dashboard-grid/createDashboardQuery.js b/client/src/components/dashboard-grid/createDashboardQuery.js index a37f4aa4a..1b0ce0a3f 100644 --- a/client/src/components/dashboard-grid/createDashboardQuery.js +++ b/client/src/components/dashboard-grid/createDashboardQuery.js @@ -6,7 +6,7 @@ const createDashboardQuery = (state) => { const componentBasedAdditions = state && Array.isArray(state.layout) && - state.layout.map((item, index) => componentList[item.i].gqlFragment || "").join(""); + state.layout.map((item) => componentList[item.i].gqlFragment || "").join(""); return gql` query QUERY_DASHBOARD_DETAILS { ${componentBasedAdditions || ""} monthly_sales: jobs(where: {_and: [ diff --git a/client/src/components/dashboard-grid/dashboard-grid.component.jsx b/client/src/components/dashboard-grid/dashboard-grid.component.jsx index 082e404ac..546481e2e 100644 --- a/client/src/components/dashboard-grid/dashboard-grid.component.jsx +++ b/client/src/components/dashboard-grid/dashboard-grid.component.jsx @@ -1,5 +1,5 @@ import Icon, { SyncOutlined } from "@ant-design/icons"; -import { isEmpty, cloneDeep } from "lodash"; +import { cloneDeep, isEmpty } from "lodash"; import { useMutation, useQuery } from "@apollo/client"; import { Button, Dropdown, Space } from "antd"; import { PageHeader } from "@ant-design/pro-layout"; @@ -28,7 +28,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -134,7 +134,7 @@ export function DashboardGridComponent({ currentUser, bodyshop }) { layouts={state.layouts} onLayoutChange={handleLayoutChange} > - {state.items.map((item, index) => { + {state.items.map((item) => { const TheComponent = componentList[item.i].component; return (
diff --git a/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx b/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx index b4fc66577..40d9fb3f4 100644 --- a/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx +++ b/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx @@ -1,6 +1,6 @@ import { SyncOutlined } from "@ant-design/icons"; import { Button, Card, Form, Input, Table } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -12,7 +12,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -44,7 +44,6 @@ export function DmsAllocationsSummaryAp({ socket, bodyshop, billids, title }) { socket.removeListener("ap-export-failure"); //socket.disconnect(); }; - // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { diff --git a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx index 3551cc6e3..966cadf13 100644 --- a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx +++ b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx @@ -1,5 +1,5 @@ import { Alert, Button, Card, Table, Typography } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -13,7 +13,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -54,19 +54,19 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) { title: t("jobs.fields.dms.sale_dms_acctnumber"), dataIndex: "sale_dms_acctnumber", key: "sale_dms_acctnumber", - render: (text, record) => record.profitCenter && record.profitCenter.dms_acctnumber + render: (text, record) => record.profitCenter?.dms_acctnumber }, { title: t("jobs.fields.dms.cost_dms_acctnumber"), dataIndex: "cost_dms_acctnumber", key: "cost_dms_acctnumber", - render: (text, record) => record.costCenter && record.costCenter.dms_acctnumber + render: (text, record) => record.costCenter?.dms_acctnumber }, { title: t("jobs.fields.dms.dms_wip_acctnumber"), dataIndex: "dms_wip_acctnumber", key: "dms_wip_acctnumber", - render: (text, record) => record.costCenter && record.costCenter.dms_wip_acctnumber + render: (text, record) => record.costCenter?.dms_wip_acctnumber } ]; diff --git a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx index 4fbd71299..f64cd2216 100644 --- a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx +++ b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx @@ -1,23 +1,19 @@ import { useLazyQuery } from "@apollo/client"; import { Button, Input, Modal, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { SEARCH_DMS_VEHICLES } from "../../graphql/dms.queries"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import AlertComponent from "../alert/alert.component"; -const mapStateToProps = createStructuredSelector({ - //currentUser: selectCurrentUser - bodyshop: selectBodyshop -}); -const mapDispatchToProps = (dispatch) => ({ - //setUserLanguage: language => dispatch(setUserLanguage(language)) -}); +const mapStateToProps = createStructuredSelector({}); + +const mapDispatchToProps = () => ({}); + export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkVehicles); -export function DmsCdkVehicles({ bodyshop, form, job }) { +export function DmsCdkVehicles({ form, job }) { const [open, setOpen] = useState(false); const [selectedModel, setSelectedModel] = useState(null); const { t } = useTranslation(); @@ -83,7 +79,7 @@ export function DmsCdkVehicles({ bodyshop, form, job }) { }, type: "radio", - selectedRowKeys: [selectedModel && selectedModel.id] + selectedRowKeys: [selectedModel?.id] }} /> @@ -92,7 +88,7 @@ export function DmsCdkVehicles({ bodyshop, form, job }) { setOpen(true); callSearch({ variables: { - search: job && job.v_model_desc && job.v_model_desc.substr(0, 3) + search: job?.v_model_desc && job.v_model_desc.substr(0, 3) } }); }} diff --git a/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx b/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx index ad505f9c3..6d2908b65 100644 --- a/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx +++ b/client/src/components/dms-cdk-makes/dms-cdk-makes.refetch.component.jsx @@ -1,20 +1,21 @@ import { Button } from "antd"; import axios from "axios"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; + const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakesRefetch); -export function DmsCdkMakesRefetch({ currentUser, bodyshop, form, socket }) { +export function DmsCdkMakesRefetch({ currentUser, bodyshop }) { const [loading, setLoading] = useState(false); const { t } = useTranslation(); diff --git a/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx b/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx index 773400df1..62a7a3aec 100644 --- a/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx +++ b/client/src/components/dms-customer-selector/dms-customer-selector.component.jsx @@ -1,6 +1,6 @@ import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Button, Checkbox, Col, Table } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -12,7 +12,7 @@ import { alphaSort } from "../../utils/sorters"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(DmsCustomerSelector); @@ -152,19 +152,17 @@ export function DmsCustomerSelector({ bodyshop, jobid }) { title: t("jobs.fields.dms.name1"), dataIndex: ["name1", "fullName"], key: "name1", - sorter: (a, b) => alphaSort(a.name1 && a.name1.fullName, b.name1 && b.name1.fullName) + sorter: (a, b) => alphaSort(a.name1?.fullName, b.name1?.fullName) }, { title: t("jobs.fields.dms.address"), //dataIndex: ["name2", "fullName"], key: "address", - render: (record, value) => - `${ - record.address && record.address.addressLine && record.address.addressLine[0] - }, ${record.address && record.address.city} ${ - record.address && record.address.stateOrProvince - } ${record.address && record.address.postalCode}` + render: (record) => + `${record.address?.addressLine && record.address.addressLine[0]}, ${record.address?.city} ${ + record.address?.stateOrProvince + } ${record.address?.postalCode}` } ]; @@ -184,7 +182,7 @@ export function DmsCustomerSelector({ bodyshop, jobid }) { { title: t("jobs.fields.dms.address"), key: "address", - render: (record, value) => `${record.Address}, ${record.City} ${record.State} ${record.ZipCode}` + render: (record) => `${record.Address}, ${record.City} ${record.State} ${record.ZipCode}` } ]; @@ -197,10 +195,7 @@ export function DmsCustomerSelector({ bodyshop, jobid }) { - diff --git a/client/src/components/dms-log-events/dms-log-events.component.jsx b/client/src/components/dms-log-events/dms-log-events.component.jsx index b73e5dbe7..5219ddd88 100644 --- a/client/src/components/dms-log-events/dms-log-events.component.jsx +++ b/client/src/components/dms-log-events/dms-log-events.component.jsx @@ -1,14 +1,10 @@ import { Divider, Space, Tag, Timeline } from "antd"; import dayjs from "../../utils/day"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setBreadcrumbs, setSelectedHeader } from "../../redux/application/application.actions"; -import { selectBodyshop } from "../../redux/user/user.selectors"; -const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop -}); +const mapStateToProps = createStructuredSelector({}); const mapDispatchToProps = (dispatch) => ({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), @@ -17,7 +13,7 @@ const mapDispatchToProps = (dispatch) => ({ export default connect(mapStateToProps, mapDispatchToProps)(DmsLogEvents); -export function DmsLogEvents({ socket, logs, bodyshop }) { +export function DmsLogEvents({ logs }) { return ( ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -60,7 +60,9 @@ export function DocumentEditorComponent({ currentUser, bodyshop, document }) { markerArea.current = new markerjs2.MarkerArea(imgRef.current); // attach an event handler to assign annotated image back to our image element - markerArea.current.addEventListener("close", (closeEvent) => {}); + markerArea.current.addEventListener("close", () => { + // NO OP + }); markerArea.current.addEventListener("render", (event) => { const dataUrl = event.dataUrl; @@ -76,7 +78,6 @@ export function DocumentEditorComponent({ currentUser, bodyshop, document }) { //markerArea.current.settings.displayMode = "inline"; markerArea.current.show(); } - // eslint-disable-next-line react-hooks/exhaustive-deps }, [triggerUpload]); async function b64toBlob(url) { diff --git a/client/src/components/document-editor/document-editor.container.jsx b/client/src/components/document-editor/document-editor.container.jsx index b5868e076..d19fb9ce3 100644 --- a/client/src/components/document-editor/document-editor.container.jsx +++ b/client/src/components/document-editor/document-editor.container.jsx @@ -1,7 +1,7 @@ import { useQuery } from "@apollo/client"; import { Result } from "antd"; import queryString from "query-string"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { useLocation } from "react-router-dom"; diff --git a/client/src/components/documents-local-upload/documents-local-upload.component.jsx b/client/src/components/documents-local-upload/documents-local-upload.component.jsx index bd59c9cf4..e16195dc1 100644 --- a/client/src/components/documents-local-upload/documents-local-upload.component.jsx +++ b/client/src/components/documents-local-upload/documents-local-upload.component.jsx @@ -1,10 +1,10 @@ import { UploadOutlined } from "@ant-design/icons"; import { Upload } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import { handleUpload } from "./documents-local-upload.utility"; import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component"; import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component"; @@ -12,13 +12,11 @@ import { useTranslation } from "react-i18next"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; const mapStateToProps = createStructuredSelector({ - currentUser: selectCurrentUser, bodyshop: selectBodyshop }); export function DocumentsLocalUploadComponent({ children, - currentUser, bodyshop, job, vendorid, diff --git a/client/src/components/documents-local-upload/documents-local-upload.utility.js b/client/src/components/documents-local-upload/documents-local-upload.utility.js index 69b5f41ea..d568d83b9 100644 --- a/client/src/components/documents-local-upload/documents-local-upload.utility.js +++ b/client/src/components/documents-local-upload/documents-local-upload.utility.js @@ -15,7 +15,7 @@ export const handleUpload = async ({ ev, context, notification }) => { ims_token: bodyshop.localmediatoken }, onUploadProgress: (e) => { - if (!!onProgress) onProgress({ percent: (e.loaded / e.total) * 100 }); + if (onProgress) onProgress({ percent: (e.loaded / e.total) * 100 }); } }; @@ -37,7 +37,7 @@ export const handleUpload = async ({ ev, context, notification }) => { ); if (imexMediaServerResponse.status !== 200) { - if (!!onError) { + if (onError) { onError(imexMediaServerResponse.statusText); } } else { diff --git a/client/src/components/documents-upload/documents-upload.component.jsx b/client/src/components/documents-upload/documents-upload.component.jsx index bcadffc18..4189085cc 100644 --- a/client/src/components/documents-upload/documents-upload.component.jsx +++ b/client/src/components/documents-upload/documents-upload.component.jsx @@ -1,6 +1,6 @@ import { UploadOutlined } from "@ant-design/icons"; import { Progress, Result, Space, Upload } from "antd"; -import React, { useMemo, useState } from "react"; +import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -32,7 +32,7 @@ export function DocumentsUploadComponent({ const notification = useNotification(); const pct = useMemo(() => { - return parseInt((totalSize / ((bodyshop && bodyshop.jobsizelimit) || 1)) * 100); + return parseInt((totalSize / (bodyshop?.jobsizelimit || 1)) * 100, 10); }, [bodyshop, totalSize]); if (pct > 100 && !ignoreSizeLimit) @@ -63,7 +63,7 @@ export function DocumentsUploadComponent({ beforeUpload={(file, fileList) => { if (ignoreSizeLimit) return true; const newFiles = fileList.reduce((acc, val) => acc + val.size, 0); - const shouldStopUpload = (totalSize + newFiles) / ((bodyshop && bodyshop.jobsizelimit) || 1) >= 1; + const shouldStopUpload = (totalSize + newFiles) / (bodyshop?.jobsizelimit || 1) >= 1; //Check to see if old files plus newly uploaded ones will be too much. if (shouldStopUpload) { @@ -109,7 +109,7 @@ export function DocumentsUploadComponent({ {t("documents.labels.usage", { percent: pct, used: formatBytes(totalSize), - total: formatBytes(bodyshop && bodyshop.jobsizelimit) + total: formatBytes(bodyshop?.jobsizelimit) })} diff --git a/client/src/components/documents-upload/documents-upload.utility.js b/client/src/components/documents-upload/documents-upload.utility.js index ed8cb404f..0e725ae48 100644 --- a/client/src/components/documents-upload/documents-upload.utility.js +++ b/client/src/components/documents-upload/documents-upload.utility.js @@ -57,7 +57,7 @@ export const uploadToCloudinary = async ( }); if (signedURLResponse.status !== 200) { - if (!!onError) onError(signedURLResponse.statusText); + if (onError) onError(signedURLResponse.statusText); notification["error"]({ message: i18n.t("documents.errors.getpresignurl", { message: signedURLResponse.statusText @@ -71,7 +71,7 @@ export const uploadToCloudinary = async ( var options = { headers: { "X-Requested-With": "XMLHttpRequest" }, onUploadProgress: (e) => { - if (!!onProgress) onProgress({ percent: (e.loaded / e.total) * 100 }); + if (onProgress) onProgress({ percent: (e.loaded / e.total) * 100 }); } }; @@ -95,7 +95,7 @@ export const uploadToCloudinary = async ( ); if (cloudinaryUploadResponse.status !== 200) { - if (!!onError) { + if (onError) { onError(cloudinaryUploadResponse.statusText); } @@ -106,7 +106,9 @@ export const uploadToCloudinary = async ( user: store.getState().user.email, object: cloudinaryUploadResponse }); - } catch (error) {} + } catch { + // NO OP + } notification["error"]({ message: i18n.t("documents.errors.insert", { @@ -123,7 +125,7 @@ export const uploadToCloudinary = async ( const exif = await exifr.parse(file); takenat = exif && exif.DateTimeOriginal; - } catch (error) { + } catch { console.log("Unable to parse image file for EXIF Data"); } } @@ -146,7 +148,7 @@ export const uploadToCloudinary = async ( } }); if (!documentInsert.errors) { - if (!!onSuccess) + if (onSuccess) onSuccess({ uid: documentInsert.data.insert_documents.returning[0].id, name: documentInsert.data.insert_documents.returning[0].name, @@ -162,7 +164,7 @@ export const uploadToCloudinary = async ( callback(); } } else { - if (!!onError) onError(JSON.stringify(documentInsert.errors)); + if (onError) onError(JSON.stringify(documentInsert.errors)); notification["error"]({ message: i18n.t("documents.errors.insert", { message: JSON.stringify(documentInsert.errors) diff --git a/client/src/components/email-documents/email-documents.component.jsx b/client/src/components/email-documents/email-documents.component.jsx index 7e17d5565..8882bd2da 100644 --- a/client/src/components/email-documents/email-documents.component.jsx +++ b/client/src/components/email-documents/email-documents.component.jsx @@ -1,5 +1,4 @@ import { useQuery } from "@apollo/client"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -18,7 +17,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, emailConfig: selectEmailConfig }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(EmailDocumentsComponent); @@ -30,7 +29,7 @@ export function EmailDocumentsComponent({ emailConfig, form, selectedMediaState, } = useSplitTreatments({ attributes: {}, names: ["Imgproxy"], - splitKey: bodyshop && bodyshop.imexshopid + splitKey: bodyshop?.imexshopid }); const [selectedMedia, setSelectedMedia] = selectedMediaState; diff --git a/client/src/components/email-overlay/email-overlay.container.jsx b/client/src/components/email-overlay/email-overlay.container.jsx index af50261e6..610004e14 100644 --- a/client/src/components/email-overlay/email-overlay.container.jsx +++ b/client/src/components/email-overlay/email-overlay.container.jsx @@ -1,6 +1,6 @@ import { Button, Divider, Form, Modal, Space } from "antd"; import axios from "axios"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -149,7 +149,8 @@ export function EmailOverlayContainer({ emailConfig, modalVisible, toggleEmailOv useEffect(() => { if (modalVisible) render(); - }, [modalVisible]); // eslint-disable-line react-hooks/exhaustive-deps + }, [modalVisible]); + return ( ({ - setEmailOptions: (e) => dispatch(setEmailOptions(e)) -}); +const mapDispatchToProps = () => ({}); -export function EmailTestComponent({ currentUser, setEmailOptions }) { +export function EmailTestComponent() { const [form] = Form.useForm(); const notification = useNotification(); diff --git a/client/src/components/employee-search-select/employee-search-select-email.component.jsx b/client/src/components/employee-search-select/employee-search-select-email.component.jsx index c583db68c..744533b80 100644 --- a/client/src/components/employee-search-select/employee-search-select-email.component.jsx +++ b/client/src/components/employee-search-select/employee-search-select-email.component.jsx @@ -1,5 +1,4 @@ import { Select, Space, Tag } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; const { Option } = Select; diff --git a/client/src/components/employee-search-select/employee-search-select.component.jsx b/client/src/components/employee-search-select/employee-search-select.component.jsx index 5264c886a..7a825a164 100644 --- a/client/src/components/employee-search-select/employee-search-select.component.jsx +++ b/client/src/components/employee-search-select/employee-search-select.component.jsx @@ -1,5 +1,4 @@ import { Select, Space, Tag } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; const { Option } = Select; diff --git a/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx b/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx index b59589da1..2be5ea4b2 100644 --- a/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx +++ b/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx @@ -1,12 +1,12 @@ import { useQuery } from "@apollo/client"; import { Select } from "antd"; -import React, { forwardRef } from "react"; +import { forwardRef } from "react"; import { QUERY_TEAMS } from "../../graphql/employee_teams.queries"; import AlertComponent from "../alert/alert.component"; //To be used as a form element only. -const EmployeeTeamSearchSelect = ({ ...props }, ref) => { +const EmployeeTeamSearchSelect = ({ ...props }) => { const { loading, error, data } = useQuery(QUERY_TEAMS); if (error) return ; diff --git a/client/src/components/error-boundary/error-boundary.component.jsx b/client/src/components/error-boundary/error-boundary.component.jsx index ef6020ccc..a73eaea4f 100644 --- a/client/src/components/error-boundary/error-boundary.component.jsx +++ b/client/src/components/error-boundary/error-boundary.component.jsx @@ -12,7 +12,7 @@ const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); diff --git a/client/src/components/eula/eula.component.jsx b/client/src/components/eula/eula.component.jsx index ae503b09a..d915814eb 100644 --- a/client/src/components/eula/eula.component.jsx +++ b/client/src/components/eula/eula.component.jsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { Button, Card, Checkbox, Col, Form, Input, Modal, Row } from "antd"; import Markdown from "react-markdown"; import { createStructuredSelector } from "reselect"; @@ -50,12 +50,12 @@ const Eula = ({ currentEula, currentUser, acceptEula }) => { handleChange(); }, [handleChange, hasEverScrolledToBottom, form]); - const onFinish = async ({ acceptTerms, ...formValues }) => { + const onFinish = async ({ ...formValues }) => { const eulaId = currentEula.id; const useremail = currentUser.email; try { - const { accepted_terms, ...otherFormValues } = formValues; + const { ...otherFormValues } = formValues; // Trim the values of the fields before submitting const trimmedFormValues = Object.entries(otherFormValues).reduce((acc, [key, value]) => { @@ -89,40 +89,38 @@ const Eula = ({ currentEula, currentUser, acceptEula }) => { }; return ( - <> - ( - + + + +
+ {`${InstanceRenderManager({ + imex: t("titles.imexonline"), + rome: t("titles.romeonline") + })} - ${import.meta.env.VITE_APP_GIT_SHA_DATE}`} +
+ +
+ + Disclaimer & Notices + +
+ + ); +} + +export default connect(mapStateToProps)(GlobalFooter); diff --git a/client/src/components/global-loading-bar/global-loading-bar.component.jsx b/client/src/components/global-loading-bar/global-loading-bar.component.jsx index 833cae896..7ea68ca28 100644 --- a/client/src/components/global-loading-bar/global-loading-bar.component.jsx +++ b/client/src/components/global-loading-bar/global-loading-bar.component.jsx @@ -1,5 +1,4 @@ //import { useNProgress } from "@tanem/react-nprogress"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectLoading } from "../../redux/application/application.selectors"; @@ -10,7 +9,7 @@ const mapStateToProps = createStructuredSelector({ export default connect(mapStateToProps, null)(GlobalLoadingHeader); -function GlobalLoadingHeader({ loading }) { +function GlobalLoadingHeader() { return ; // const { animationDuration, isFinished, progress } = useNProgress({ // isAnimating: loading, diff --git a/client/src/components/global-search/global-search-os.component.jsx b/client/src/components/global-search/global-search-os.component.jsx index e8e51b3ac..4def18f32 100644 --- a/client/src/components/global-search/global-search-os.component.jsx +++ b/client/src/components/global-search/global-search-os.component.jsx @@ -1,7 +1,7 @@ import { AutoComplete, Divider, Input, Space } from "antd"; import axios from "axios"; import _ from "lodash"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link, useNavigate } from "react-router-dom"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; diff --git a/client/src/components/global-search/global-search.component.jsx b/client/src/components/global-search/global-search.component.jsx index a8fbb90dd..3a9e29f77 100644 --- a/client/src/components/global-search/global-search.component.jsx +++ b/client/src/components/global-search/global-search.component.jsx @@ -1,7 +1,6 @@ import { useLazyQuery } from "@apollo/client"; import { AutoComplete, Divider, Input, Space } from "antd"; import _ from "lodash"; -import React from "react"; import { useTranslation } from "react-i18next"; import { Link, useNavigate } from "react-router-dom"; import { GLOBAL_SEARCH_QUERY } from "../../graphql/search.queries"; diff --git a/client/src/components/help-rescue/help-rescue.component.jsx b/client/src/components/help-rescue/help-rescue.component.jsx index 07f910de3..af6a66fa1 100644 --- a/client/src/components/help-rescue/help-rescue.component.jsx +++ b/client/src/components/help-rescue/help-rescue.component.jsx @@ -1,5 +1,5 @@ import { Button, Input, Space } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; export default function HelpRescue() { @@ -7,7 +7,7 @@ export default function HelpRescue() { const [code, setCode] = useState(""); const handleClick = async () => { - var bodyFormData = new FormData(); + const bodyFormData = new FormData(); bodyFormData.append("Code", code); bodyFormData.append("hostederrorhandling", 1); await fetch("https://secure.logmeinrescue.com/Customer/Code.aspx", { @@ -35,7 +35,7 @@ export default function HelpRescue() { action="https://secure.logmeinrescue.com/Customer/Code.aspx" method="post" id="logmeinsupport" - onSubmit={(...props) => { + onSubmit={() => { alert(); }} > @@ -43,8 +43,8 @@ export default function HelpRescue() {
- - + + diff --git a/client/src/components/indefinite-loading/indefinite-loading.component.jsx b/client/src/components/indefinite-loading/indefinite-loading.component.jsx index 37e87344b..b4cc04dbb 100644 --- a/client/src/components/indefinite-loading/indefinite-loading.component.jsx +++ b/client/src/components/indefinite-loading/indefinite-loading.component.jsx @@ -1,5 +1,4 @@ import { useNProgress } from "@tanem/react-nprogress"; -import React from "react"; export default function IndefiniteLoading({ loading }) { const { animationDuration, isFinished, progress } = useNProgress({ diff --git a/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx b/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx index 9972478f5..fd2921696 100644 --- a/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx +++ b/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx @@ -1,5 +1,4 @@ import { Button } from "antd"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setModalContext } from "../../redux/modals/modals.actions"; diff --git a/client/src/components/inventory-line-delete/inventory-line-delete.component.jsx b/client/src/components/inventory-line-delete/inventory-line-delete.component.jsx index 0c488ba41..60cf5e5b5 100644 --- a/client/src/components/inventory-line-delete/inventory-line-delete.component.jsx +++ b/client/src/components/inventory-line-delete/inventory-line-delete.component.jsx @@ -1,7 +1,7 @@ import { DeleteFilled } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; import { Button, Popconfirm } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { DELETE_INVENTORY_LINE } from "../../graphql/inventory.queries"; import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component"; @@ -31,7 +31,7 @@ export default function InventoryLineDelete({ inventoryline, disabled, refetch } // }, }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("inventory.successes.deleted") }); } else { //Check if it's an fkey violation. diff --git a/client/src/components/inventory-list/inventory-list.component.jsx b/client/src/components/inventory-list/inventory-list.component.jsx index de8487add..d5a3191cf 100644 --- a/client/src/components/inventory-list/inventory-list.component.jsx +++ b/client/src/components/inventory-list/inventory-list.component.jsx @@ -1,27 +1,22 @@ import { EditFilled, FileAddFilled, SyncOutlined } from "@ant-design/icons"; import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link, useLocation, useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { setModalContext } from "../../redux/modals/modals.actions"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import InventoryBillRo from "../inventory-bill-ro/inventory-bill-ro.component"; import InventoryLineDelete from "../inventory-line-delete/inventory-line-delete.component"; import { pageLimit } from "../../utils/config"; -const mapStateToProps = createStructuredSelector({ - //currentUser: selectCurrentUser - bodyshop: selectBodyshop -}); +const mapStateToProps = createStructuredSelector({}); const mapDispatchToProps = (dispatch) => ({ setInventoryUpsertContext: (context) => dispatch(setModalContext({ context: context, modal: "inventoryUpsert" })) }); -export function JobsList({ bodyshop, refetch, loading, jobs, total, setInventoryUpsertContext }) { +export function JobsList({ refetch, loading, jobs, total, setInventoryUpsertContext }) { const search = queryString.parse(useLocation().search); const { page, sortcolumn, sortorder } = search; const history = useNavigate(); diff --git a/client/src/components/inventory-list/inventory-list.container.jsx b/client/src/components/inventory-list/inventory-list.container.jsx index 6d154cd20..ba9e1ec22 100644 --- a/client/src/components/inventory-list/inventory-list.container.jsx +++ b/client/src/components/inventory-list/inventory-list.container.jsx @@ -1,25 +1,18 @@ import { useQuery } from "@apollo/client"; import queryString from "query-string"; -import React from "react"; import { connect } from "react-redux"; import { useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { QUERY_INVENTORY_PAGINATED } from "../../graphql/inventory.queries"; -import { setBreadcrumbs, setSelectedHeader } from "../../redux/application/application.actions"; import AlertComponent from "../alert/alert.component"; import InventoryListPaginated from "./inventory-list.component"; import { pageLimit } from "../../utils/config"; -const mapStateToProps = createStructuredSelector({ - //bodyshop: selectBodyshop, -}); +const mapStateToProps = createStructuredSelector({}); -const mapDispatchToProps = (dispatch) => ({ - setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), - setSelectedHeader: (key) => dispatch(setSelectedHeader(key)) -}); +const mapDispatchToProps = () => ({}); -export function InventoryList({ setBreadcrumbs, setSelectedHeader }) { +export function InventoryList() { const searchParams = queryString.parse(useLocation().search); const { page, sortcolumn, sortorder, search, showall } = searchParams; diff --git a/client/src/components/inventory-upsert-modal/inventory-upsert-modal.component.jsx b/client/src/components/inventory-upsert-modal/inventory-upsert-modal.component.jsx index e718baef6..d350e0c53 100644 --- a/client/src/components/inventory-upsert-modal/inventory-upsert-modal.component.jsx +++ b/client/src/components/inventory-upsert-modal/inventory-upsert-modal.component.jsx @@ -1,5 +1,4 @@ import { Form, Input, Space } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -9,12 +8,12 @@ import FormItemCurrency from "../form-items-formatted/currency-form-item.compone const mapStateToProps = createStructuredSelector({ inventoryUpsertModal: selectInventoryUpsert }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(NoteUpsertModalComponent); -export function NoteUpsertModalComponent({ form, inventoryUpsertModal }) { +export function NoteUpsertModalComponent({ inventoryUpsertModal }) { const { t } = useTranslation(); const { existingInventory } = inventoryUpsertModal.context; diff --git a/client/src/components/inventory-upsert-modal/inventory-upsert-modal.container.jsx b/client/src/components/inventory-upsert-modal/inventory-upsert-modal.container.jsx index ee53b3bd4..e53823db5 100644 --- a/client/src/components/inventory-upsert-modal/inventory-upsert-modal.container.jsx +++ b/client/src/components/inventory-upsert-modal/inventory-upsert-modal.container.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Form, Modal } from "antd"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -8,20 +8,19 @@ import { logImEXEvent } from "../../firebase/firebase.utils"; import { INSERT_INVENTORY_LINE, UPDATE_INVENTORY_LINE } from "../../graphql/inventory.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectInventoryUpsert } from "../../redux/modals/modals.selectors"; -import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import InventoryUpsertModal from "./inventory-upsert-modal.component"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, - currentUser: selectCurrentUser, inventoryUpsertModal: selectInventoryUpsert }); const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("inventoryUpsert")) }); -export function InventoryUpsertModalContainer({ currentUser, bodyshop, inventoryUpsertModal, toggleModalVisible }) { +export function InventoryUpsertModalContainer({ bodyshop, inventoryUpsertModal, toggleModalVisible }) { const { t } = useTranslation(); const [insertInventory] = useMutation(INSERT_INVENTORY_LINE); const [updateInventoryLine] = useMutation(UPDATE_INVENTORY_LINE); @@ -53,7 +52,7 @@ export function InventoryUpsertModalContainer({ currentUser, bodyshop, inventory inventoryId: existingInventory.id, inventoryItem: values } - }).then((r) => { + }).then(() => { notification["success"]({ message: t("inventory.successes.updated") }); diff --git a/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx b/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx index 12b6ebc71..aba3361a5 100644 --- a/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx +++ b/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx @@ -1,6 +1,6 @@ import { useQuery } from "@apollo/client"; import { Button, Form, Input, InputNumber, Modal, Radio, Select } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -17,7 +17,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, technician: selectTechnician }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(Jobd3RdPartyModal); @@ -79,7 +79,7 @@ export function Jobd3RdPartyModal({ bodyshop, jobId, job, technician }) { }); }; - const handleVendorSelect = (vendorid, opt) => { + const handleVendorSelect = (vendorid) => { const vendor = VendorAutoCompleteData.vendors.filter((v) => v.id === vendorid)[0]; if (vendor) { form.setFieldsValue({ @@ -100,10 +100,7 @@ export function Jobd3RdPartyModal({ bodyshop, jobId, job, technician }) {
- + ({ - //setUserLanguage: language => dispatch(setUserLanguage(language)) -}); +const mapDispatchToProps = () => ({}); export function JoblinePresetButton({ bodyshop, form }) { const { t } = useTranslation(); diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx index b4dbb2bd1..c1ceac539 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx @@ -1,6 +1,6 @@ import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Form, Input, InputNumber, Modal, Select, Switch } from "antd"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import InputCurrency from "../form-items-formatted/currency-form-item.component"; import JoblinesPreset from "../job-lines-preset-button/job-lines-preset-button.component"; @@ -13,7 +13,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobLinesUpsertModalComponent); @@ -36,7 +36,7 @@ export function JobLinesUpsertModalComponent({ bodyshop, open, jobLine, handleCa return ( ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobPartsQueueCount); diff --git a/client/src/components/job-payments/job-payments.component.jsx b/client/src/components/job-payments/job-payments.component.jsx index d1bb83db5..8ae8c56a4 100644 --- a/client/src/components/job-payments/job-payments.component.jsx +++ b/client/src/components/job-payments/job-payments.component.jsx @@ -1,11 +1,10 @@ import { EditFilled } from "@ant-design/icons"; import { Button, Card, Space, Table } from "antd"; import Dinero from "dinero.js"; -import React, { useMemo, useState } from "react"; +import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; @@ -19,8 +18,7 @@ import PrintWrapperComponent from "../print-wrapper/print-wrapper.component"; import { useSplitTreatments } from "@splitsoftware/splitio-react"; const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop, - jobRO: selectJobReadOnly + bodyshop: selectBodyshop }); const mapDispatchToProps = (dispatch) => ({ @@ -34,13 +32,13 @@ const mapDispatchToProps = (dispatch) => ({ ) }); -export function JobPayments({ job, jobRO, bodyshop, setPaymentContext, setCardPaymentContext, refetch }) { +export function JobPayments({ job, bodyshop, setPaymentContext, setCardPaymentContext, refetch }) { const { treatments: { ImEXPay } } = useSplitTreatments({ attributes: {}, names: ["ImEXPay"], - splitKey: bodyshop && bodyshop.imexshopid + splitKey: bodyshop?.imexshopid }); const { t } = useTranslation(); @@ -139,7 +137,7 @@ export function JobPayments({ job, jobRO, bodyshop, setPaymentContext, setCardPa }, [job.payments]); const balance = useMemo(() => { - if (job && job.job_totals && job.job_totals.totals.total_repairs) + if (job?.job_totals && job.job_totals.totals.total_repairs) return Dinero(job.job_totals.totals.total_repairs).subtract(total); return Dinero({ amount: 0 }).subtract(total); }, [job, total]); @@ -194,7 +192,7 @@ export function JobPayments({ job, jobRO, bodyshop, setPaymentContext, setCardPa rowKey="id" pagination={false} onChange={handleTableChange} - dataSource={job && job.payments} + dataSource={job?.payments} scroll={{ x: true }} @@ -202,20 +200,18 @@ export function JobPayments({ job, jobRO, bodyshop, setPaymentContext, setCardPa expandedRowRender: (record) => }} summary={() => ( - <> - - - {t("payments.labels.totalpayments")} - - - - {total.toFormat()} - - - - - - + + + {t("payments.labels.totalpayments")} + + + + {total.toFormat()} + + + + + )} />
diff --git a/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx b/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx index ed9c16579..a32d01e8e 100644 --- a/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx +++ b/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx @@ -1,5 +1,4 @@ import { Alert } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import InstanceRenderManager from "../../utils/instanceRenderMgr"; diff --git a/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx b/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx index 2815a7ad9..b779c6c69 100644 --- a/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx +++ b/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx @@ -1,5 +1,5 @@ import { Checkbox, Table, Typography } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { alphaSort } from "../../utils/sorters"; @@ -72,7 +72,7 @@ export default function JobReconciliationBillsTable({ billLineState, invoiceLine const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; - const handleOnRowClick = (selectedRecordKeys, selectedRecords) => { + const handleOnRowClick = (selectedRecordKeys) => { setSelectedLines(selectedRecordKeys); }; diff --git a/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx b/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx index 09b48e08a..3dce6b47b 100644 --- a/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx +++ b/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx @@ -1,6 +1,5 @@ import { useQuery } from "@apollo/client"; import { Modal } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -25,8 +24,8 @@ function JobReconciliationModalContainer({ reconciliationModal, toggleModalVisib const { job } = context; const { loading, error, data } = useQuery(GET_JOB_RECONCILIATION_BY_PK, { - variables: { id: job && job.id }, - skip: !(job && job.id) || !open, + variables: { id: job?.id }, + skip: !job?.id || !open, fetchPolicy: "network-only", nextFetchPolicy: "network-only" }); @@ -49,7 +48,7 @@ function JobReconciliationModalContainer({ reconciliationModal, toggleModalVisib > {loading && } {error && } - {data && } + {data && } ); } diff --git a/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx b/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx index 6ade6a77f..903ecdd5b 100644 --- a/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx +++ b/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx @@ -1,5 +1,5 @@ import { Table, Typography } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { alphaSort } from "../../utils/sorters"; @@ -89,7 +89,7 @@ export default function JobReconcilitionPartsTable({ jobLineState, jobLineData } const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; - const handleOnRowClick = (selectedRecordKeys, selectedRecords) => { + const handleOnRowClick = (selectedRecordKeys) => { setSelectedLines(selectedRecordKeys); }; diff --git a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx index e430f1546..ce29c22cf 100644 --- a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx +++ b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx @@ -1,7 +1,7 @@ import { Button, Space, Statistic } from "antd"; import Dinero from "dinero.js"; import _ from "lodash"; -import React, { useMemo, useState } from "react"; +import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { reconcileByAssocLine, reconcileByPrice } from "./job-reconciliation-totals.utility"; diff --git a/client/src/components/job-remove-from-parst-queue/job-remove-from-parts-queue.component.jsx b/client/src/components/job-remove-from-parst-queue/job-remove-from-parts-queue.component.jsx index f11731554..992fea137 100644 --- a/client/src/components/job-remove-from-parst-queue/job-remove-from-parts-queue.component.jsx +++ b/client/src/components/job-remove-from-parst-queue/job-remove-from-parts-queue.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Checkbox, Space, Spin } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; @@ -17,7 +17,7 @@ export default function JobRemoveFromPartsQueue({ checked, jobId }) { variables: { jobId: jobId, job: { queued_for_parts: e.target.checked } } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ diff --git a/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx b/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx index 88ad6e819..583b79b1a 100644 --- a/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx +++ b/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx @@ -1,7 +1,7 @@ import { CheckCircleOutlined } from "@ant-design/icons"; import { useLazyQuery, useMutation } from "@apollo/client"; import { Button, Card, Form, InputNumber, Popover, Space } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -22,7 +22,7 @@ import { useNotification } from "../../contexts/Notifications/notificationContex const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); @@ -43,7 +43,7 @@ export function ScoreboardAddButton({ bodyshop, job, disabled, ...otherBtnProps }, [visibility, job.id, callQuery]); useEffect(() => { - if (entryData && entryData.scoreboard && entryData.scoreboard[0]) { + if (entryData?.scoreboard && entryData.scoreboard[0]) { form.setFieldsValue(entryData.scoreboard[0]); } }, [entryData, form]); @@ -55,7 +55,7 @@ export function ScoreboardAddButton({ bodyshop, job, disabled, ...otherBtnProps setLoading(true); let result; - if (entryData && entryData.scoreboard && entryData.scoreboard[0]) { + if (entryData?.scoreboard && entryData.scoreboard[0]) { result = await updateScoreboardEntry({ variables: { sbId: entryData.scoreboard[0].id, @@ -68,7 +68,7 @@ export function ScoreboardAddButton({ bodyshop, job, disabled, ...otherBtnProps }); } - if (!!result.errors) { + if (result.errors) { notification["error"]({ message: t("scoreboard.errors.adding", { message: JSON.stringify(result.errors) @@ -136,7 +136,7 @@ export function ScoreboardAddButton({ bodyshop, job, disabled, ...otherBtnProps )}
- {entryData && entryData.scoreboard && entryData.scoreboard[0] && ( + {entryData?.scoreboard && entryData.scoreboard[0] && ( {t("jobs.labels.alreadyaddedtoscoreboard")} @@ -145,7 +145,7 @@ export function ScoreboardAddButton({ bodyshop, job, disabled, ...otherBtnProps ); - const handleClick = (e) => { + const handleClick = () => { setLoading(true); const v = job.joblines.reduce( (acc, val) => { diff --git a/client/src/components/job-search-select/job-search-select.component.jsx b/client/src/components/job-search-select/job-search-select.component.jsx index f704b9b93..2f241f5af 100644 --- a/client/src/components/job-search-select/job-search-select.component.jsx +++ b/client/src/components/job-search-select/job-search-select.component.jsx @@ -2,7 +2,7 @@ import { LoadingOutlined } from "@ant-design/icons"; import { useLazyQuery } from "@apollo/client"; import { Select, Space, Spin, Tag } from "antd"; import _ from "lodash"; -import React, { forwardRef, useEffect, useState } from "react"; +import { forwardRef, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE, SEARCH_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries"; import AlertComponent from "../alert/alert.component"; @@ -51,10 +51,7 @@ const JobSearchSelect = ( useEffect(() => { setTheOptions( _.uniqBy( - [ - ...(idData && idData.jobs_by_pk ? [idData.jobs_by_pk] : []), - ...(data && data.search_jobs ? data.search_jobs : []) - ], + [...(idData?.jobs_by_pk ? [idData.jobs_by_pk] : []), ...(data?.search_jobs ? data.search_jobs : [])], "id" ) ); diff --git a/client/src/components/job-send-parts-price-change/job-send-parts-price-change.component.jsx b/client/src/components/job-send-parts-price-change/job-send-parts-price-change.component.jsx index fcfb5076c..57280b614 100644 --- a/client/src/components/job-send-parts-price-change/job-send-parts-price-change.component.jsx +++ b/client/src/components/job-send-parts-price-change/job-send-parts-price-change.component.jsx @@ -1,6 +1,6 @@ import { Button } from "antd"; import axios from "axios"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; diff --git a/client/src/components/job-sync-button/job-sync-button.component.jsx b/client/src/components/job-sync-button/job-sync-button.component.jsx index e69689340..31a90a46e 100644 --- a/client/src/components/job-sync-button/job-sync-button.component.jsx +++ b/client/src/components/job-sync-button/job-sync-button.component.jsx @@ -1,5 +1,4 @@ import { Button } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { SyncOutlined } from "@ant-design/icons"; import { useNavigate } from "react-router-dom"; @@ -10,7 +9,7 @@ export default function JobSyncButton({ job }) { const handleClick = () => { history(`/manage/available?availableJobId=${job.available_jobs[0].id}&clm_no=${job.clm_no}`); }; - if (job && job.available_jobs && job.available_jobs.length > 0) + if (job?.available_jobs && job.available_jobs.length > 0) return ( - - + + + ); } diff --git a/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx b/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx index 6ed008d81..ba6d115b3 100644 --- a/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx +++ b/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Form, Popconfirm, Select } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -11,7 +11,7 @@ import { useNotification } from "../../contexts/Notifications/notificationContex const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminClass); @@ -29,7 +29,7 @@ export function JobsAdminClass({ bodyshop, job }) { variables: { jobId: job.id, job: values } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ diff --git a/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx b/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx index 4f8efc2c9..7d2f40b41 100644 --- a/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx +++ b/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx @@ -1,7 +1,7 @@ import { useMutation } from "@apollo/client"; import { Button, Form } from "antd"; import dayjs from "../../utils/day"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import AuditTrailMapping from "../../utils/AuditTrailMappings"; @@ -60,7 +60,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) { }); }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ diff --git a/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx b/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx index 826c84737..74c6cd984 100644 --- a/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx +++ b/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Space } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries"; import InstanceRenderManager from "../../utils/instanceRenderMgr"; @@ -14,13 +14,13 @@ export default function JobAdminDeleteIntake({ job }) { const [deleteIntake] = useMutation(DELETE_INTAKE_CHECKLIST); const [deleteDelivery] = useMutation(DELETE_DELIVERY_CHECKLIST); - const handleDelete = async (values) => { + const handleDelete = async () => { setLoading(true); const result = await deleteIntake({ variables: { jobId: job.id } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ @@ -32,13 +32,13 @@ export default function JobAdminDeleteIntake({ job }) { setLoading(false); }; - const handleDeleteDelivery = async (values) => { + const handleDeleteDelivery = async () => { setLoading(true); const result = await deleteDelivery({ variables: { jobId: job.id } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ @@ -56,15 +56,13 @@ export default function JobAdminDeleteIntake({ job }) { }); return InstanceRender ? ( - <> - - - - - + + + + ) : null; } diff --git a/client/src/components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component.jsx b/client/src/components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component.jsx index 13c4541d8..52087ef74 100644 --- a/client/src/components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component.jsx +++ b/client/src/components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Space } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import dayjs from "../../utils/day"; import { connect } from "react-redux"; @@ -125,18 +125,16 @@ export function JobAdminMarkReexport({ insertAuditTrail, bodyshop, currentUser, }; return ( - <> - - - - - - + + + + + ); } diff --git a/client/src/components/jobs-admin-owner-reassociate/jobs-admin-owner-reassociate.component.jsx b/client/src/components/jobs-admin-owner-reassociate/jobs-admin-owner-reassociate.component.jsx index b4869075d..813d7f45a 100644 --- a/client/src/components/jobs-admin-owner-reassociate/jobs-admin-owner-reassociate.component.jsx +++ b/client/src/components/jobs-admin-owner-reassociate/jobs-admin-owner-reassociate.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Form } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import OwnerSearchSelect from "../owner-search-select/owner-search-select.component"; @@ -19,7 +19,7 @@ export default function JobAdminOwnerReassociate({ job }) { variables: { jobId: job.id, job: { ownerid: values.ownerid } } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ diff --git a/client/src/components/jobs-admin-remove-ar/jobs-admin-remove-ar.component.jsx b/client/src/components/jobs-admin-remove-ar/jobs-admin-remove-ar.component.jsx index bdbae8a80..904972a87 100644 --- a/client/src/components/jobs-admin-remove-ar/jobs-admin-remove-ar.component.jsx +++ b/client/src/components/jobs-admin-remove-ar/jobs-admin-remove-ar.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Switch } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -49,13 +49,11 @@ export function JobsAdminRemoveAR({ insertAuditTrail, job }) { }; return ( - <> -
-
{t("jobs.labels.remove_from_ar")}:
-
- -
+
+
{t("jobs.labels.remove_from_ar")}:
+
+
- +
); } diff --git a/client/src/components/jobs-admin-unvoid/jobs-admin-unvoid.component.jsx b/client/src/components/jobs-admin-unvoid/jobs-admin-unvoid.component.jsx index 47f0c5a5f..d722c6418 100644 --- a/client/src/components/jobs-admin-unvoid/jobs-admin-unvoid.component.jsx +++ b/client/src/components/jobs-admin-unvoid/jobs-admin-unvoid.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -25,7 +25,7 @@ export function JobsAdminUnvoid({ insertAuditTrail, bodyshop, job, currentUser } const [mutationUnvoidJob] = useMutation(UNVOID_JOB); const notification = useNotification(); - const handleUpdate = async (values) => { + const handleUpdate = async () => { setLoading(true); const result = await mutationUnvoidJob({ variables: { @@ -56,10 +56,8 @@ export function JobsAdminUnvoid({ insertAuditTrail, bodyshop, job, currentUser } }; return ( - <> - - + ); } diff --git a/client/src/components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component.jsx b/client/src/components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component.jsx index 600578dbc..982ba49c0 100644 --- a/client/src/components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component.jsx +++ b/client/src/components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Form } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import VehicleSearchSelect from "../vehicle-search-select/vehicle-search-select.component"; @@ -19,7 +19,7 @@ export default function JobAdminOwnerReassociate({ job }) { variables: { jobId: job.id, job: { vehicleid: values.vehicleid } } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("jobs.successes.save") }); } else { notification["error"]({ diff --git a/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js b/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js index a29a17de4..fb1ebbe96 100644 --- a/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js +++ b/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js @@ -71,17 +71,17 @@ export const GetSupplementDelta = async (client, jobId, newLines) => { //console.log(insertQueries, updateQueries, removeQueries); if ((insertQueries + updateQueries + removeQueries).trim() === "") { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { resolve(null); }); } - return new Promise((resolve, reject) => { + return new Promise((resolve) => { resolve(gql` - mutation SUPPLEMENT_EST_LINES{ - ${insertQueries + updateQueries + removeQueries} - } - `); + mutation SUPPLEMENT_EST_LINES{ + ${insertQueries + updateQueries + removeQueries} + } + `); }); }; diff --git a/client/src/components/jobs-available-table/jobs-available-table.component.jsx b/client/src/components/jobs-available-table/jobs-available-table.component.jsx index 6aeb1cd63..72879ff07 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.component.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.component.jsx @@ -1,7 +1,7 @@ import { DeleteFilled, DownloadOutlined, PlusCircleFilled, SyncOutlined } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; import { Alert, Button, Card, Input, Space, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; @@ -16,7 +16,7 @@ import { useNotification } from "../../contexts/Notifications/notificationContex const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobsAvailableComponent); @@ -126,7 +126,7 @@ export function JobsAvailableComponent({ bodyshop, loading, data, refetch, addJo
@@ -282,7 +291,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail }) disabled ? ( <>{vehicleTitle.length > 0 ? vehicleTitle : t("vehicles.labels.novehinfo")} ) : ( - + {vehicleTitle.length > 0 ? vehicleTitle : t("vehicles.labels.novehinfo")} ) @@ -336,21 +345,23 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail }) -
- {t("jobs.labels.employeeassignments")}} - id={"job-employee-assignments"} - > -
- - - - {bodyHrs.toFixed(1)} / {refinishHrs.toFixed(1)} / {(bodyHrs + refinishHrs).toFixed(1)} - -
-
- + {!isPartsEntry && ( + + {t("jobs.labels.employeeassignments")}} + id={"job-employee-assignments"} + > +
+ + + + {bodyHrs.toFixed(1)} / {refinishHrs.toFixed(1)} / {(bodyHrs + refinishHrs).toFixed(1)} + +
+
+ + )} 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 0e8ebff57..93608d2aa 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,5 +1,4 @@ import { Col, Row } from "antd"; -import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; diff --git a/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx b/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx index 2991f45da..bc9075835 100644 --- a/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx +++ b/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx @@ -1,5 +1,4 @@ import { useQuery } from "@apollo/client"; -import React from "react"; import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries"; import AlertComponent from "../alert/alert.component"; import JobsDetailLaborComponent from "./jobs-detail-labor.component"; @@ -7,7 +6,7 @@ import JobsDetailLaborComponent from "./jobs-detail-labor.component"; export default function JobsDetailLaborContainer({ jobId, techConsole, job }) { const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, { variables: { id: jobId }, - skip: !!!jobId, + skip: !jobId, fetchPolicy: "network-only", nextFetchPolicy: "network-only" }); diff --git a/client/src/components/jobs-detail-pli/jobs-detail-pli.component.jsx b/client/src/components/jobs-detail-pli/jobs-detail-pli.component.jsx index 704ed9d10..b97328e0c 100644 --- a/client/src/components/jobs-detail-pli/jobs-detail-pli.component.jsx +++ b/client/src/components/jobs-detail-pli/jobs-detail-pli.component.jsx @@ -1,5 +1,4 @@ import { Col, Row } from "antd"; -import React from "react"; import AlertComponent from "../alert/alert.component"; import BillDetailEditcontainer from "../bill-detail-edit/bill-detail-edit.container"; import BillsListTable from "../bills-list-table/bills-list-table.component"; @@ -7,28 +6,28 @@ import JobBillsTotal from "../job-bills-total/job-bills-total.component"; import PartsDispatchTable from "../parts-dispatch-table/parts-dispatch-table.component"; import PartsOrderListTableComponent from "../parts-order-list-table/parts-order-list-table.component"; import PartsOrderModal from "../parts-order-modal/parts-order-modal.container"; +import { selectIsPartsEntry } from "../../redux/application/application.selectors"; -export default function JobsDetailPliComponent({ +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; + +const mapStateToProps = createStructuredSelector({ + isPartsEntry: selectIsPartsEntry +}); +const mapDispatchToProps = () => ({}); +export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailPliComponent); + +export function JobsDetailPliComponent({ job, billsQuery, handleBillOnRowClick, handlePartsOrderOnRowClick, - handlePartsDispatchOnRowClick + handlePartsDispatchOnRowClick, + isPartsEntry }) { - return ( -
- - {billsQuery.error ? : null} - + if (isPartsEntry) { + return ( -
- - - - - - - - - - ); + ); + } else { + return ( +
+ + {billsQuery.error ? : null} + + +
+ + + + + + + + + + + + + + ); + } } diff --git a/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx b/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx index 139a19ca4..39204e8c4 100644 --- a/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx +++ b/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx @@ -1,4 +1,3 @@ -import React from "react"; import JobsDetailPliComponent from "./jobs-detail-pli.component"; export default function JobsDetailPliContainer({ diff --git a/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx b/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx index 065a3a24b..7761922bf 100644 --- a/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx +++ b/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx @@ -1,6 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; import { Dropdown } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -13,7 +12,7 @@ const mapStateToProps = createStructuredSelector({ export function JobsDetailRatesChangeButton({ disabled, form, bodyshop }) { const { t } = useTranslation(); - const handleClick = ({ item, key, keyPath }) => { + const handleClick = ({ item }) => { const rate = item.props.value; form.setFieldsValue({ ...rate, labor_rate_desc: rate.rate_label }); }; diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx index 300f45f5a..098aec50d 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx @@ -1,5 +1,4 @@ import { Divider, Form, Input, InputNumber, Select, Space, Switch, Tooltip } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -71,7 +70,7 @@ export function JobsDetailRates({ jobRO, form, job, bodyshop }) { onChange={(checked) => { if (checked) { form.setFieldsValue({ flat_rate_ats: false }); - form.setFieldsValue({ rate_ats: form.getFieldValue('rate_ats') || bodyshop.shoprates.rate_ats }); + form.setFieldsValue({ rate_ats: form.getFieldValue("rate_ats") || bodyshop.shoprates.rate_ats }); } }} /> @@ -94,8 +93,9 @@ export function JobsDetailRates({ jobRO, form, job, bodyshop }) { onChange={(checked) => { if (checked) { form.setFieldsValue({ auto_add_ats: false }); - form.setFieldsValue({ rate_ats_flat: form.getFieldValue('rate_ats_flat') || bodyshop.shoprates.rate_ats_flat }); - + form.setFieldsValue({ + rate_ats_flat: form.getFieldValue("rate_ats_flat") || bodyshop.shoprates.rate_ats_flat + }); } }} /> @@ -104,10 +104,7 @@ export function JobsDetailRates({ jobRO, form, job, bodyshop }) { {() => { if (form.getFieldValue("flat_rate_ats")) return ( - + ); diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx index b7a2dc861..4ac724b7d 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx @@ -1,5 +1,4 @@ import { Collapse, Form, InputNumber, Switch } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -10,7 +9,7 @@ const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly }); -export function JobsDetailRatesLabor({ jobRO, expanded, required = true, form }) { +export function JobsDetailRatesLabor({ jobRO, expanded, form }) { const { t } = useTranslation(); return ( diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx index 2f7144022..b49245903 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx @@ -1,5 +1,4 @@ import { Collapse, Form, Input, InputNumber, Switch } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -10,7 +9,7 @@ const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly }); -export function JobsDetailRatesMaterials({ jobRO, expanded, required = true, form }) { +export function JobsDetailRatesMaterials({ jobRO, expanded, form }) { const { t } = useTranslation(); return ( diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx index f9788d08a..e8ba91998 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx @@ -1,16 +1,12 @@ import { Collapse, Form, Switch } from "antd"; -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 LayoutFormRow from "../layout-form-row/layout-form-row.component"; -const mapStateToProps = createStructuredSelector({ - jobRO: selectJobReadOnly -}); +const mapStateToProps = createStructuredSelector({}); -export function JobsDetailRatesOther({ jobRO, expanded, required = true, form }) { +export function JobsDetailRatesOther({ expanded }) { const { t } = useTranslation(); return ( diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx index 39ac6946a..ef83b7bfc 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx @@ -1,5 +1,4 @@ import { Collapse, Form, InputNumber, Switch } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -11,7 +10,7 @@ const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly }); -export function JobsDetailRatesParts({ jobRO, expanded, required = true, form }) { +export function JobsDetailRatesParts({ jobRO, expanded, form }) { const { t } = useTranslation(); return ( diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.profile-override.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.profile-override.component.jsx index e24d87b65..ca77ebcb1 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.profile-override.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.profile-override.component.jsx @@ -1,5 +1,4 @@ import { Button, Popconfirm } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -9,9 +8,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ - //setUserLanguage: language => dispatch(setUserLanguage(language)) -}); +const mapDispatchToProps = () => ({}); export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailRatesProfileOVerride); export function JobsDetailRatesProfileOVerride({ bodyshop, form }) { diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.taxes.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.taxes.component.jsx index 95d68b1f2..2a1b289e0 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.taxes.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.taxes.component.jsx @@ -1,5 +1,4 @@ import { Collapse, Divider, Form, Input, InputNumber, Space } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -11,7 +10,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -export function JobsDetailRatesTaxes({ jobRO, expanded, bodyshop, required = true, form }) { +export function JobsDetailRatesTaxes({ jobRO, expanded, bodyshop }) { const { t } = useTranslation(); const formItems = []; for (let tyCounter = 1; tyCounter <= 5; tyCounter++) { @@ -58,7 +57,7 @@ export function JobsDetailRatesTaxes({ jobRO, expanded, bodyshop, required = tru export default connect(mapStateToProps, null)(JobsDetailRatesTaxes); -function TaxFormItems({ typeNum, typeNumIterator, rootElements, bodyshopjobRO, jobRO, key }) { +function TaxFormItems({ typeNum, typeNumIterator, rootElements, jobRO, key }) { const { t } = useTranslation(); if (rootElements) diff --git a/client/src/components/jobs-detail-totals/jobs-detail-totals.component.jsx b/client/src/components/jobs-detail-totals/jobs-detail-totals.component.jsx index d9660584d..b6d5fdc30 100644 --- a/client/src/components/jobs-detail-totals/jobs-detail-totals.component.jsx +++ b/client/src/components/jobs-detail-totals/jobs-detail-totals.component.jsx @@ -1,5 +1,4 @@ import { Divider } from "antd"; -import React from "react"; import JobPayments from "../job-payments/job-payments.component"; import JobTotalsTable from "../job-totals-table/job-totals-table.component"; diff --git a/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx b/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx index cbc89ab38..5f4583dd6 100644 --- a/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx @@ -1,6 +1,6 @@ import { Button, Space } from "antd"; import axios from "axios"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { logImEXEvent } from "../../firebase/firebase.utils"; import cleanAxios from "../../utils/CleanAxios"; @@ -15,10 +15,11 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobsDocumentsDownloadButton); + /* ################################################################################################ Developer Note: @@ -125,13 +126,11 @@ export function JobsDocumentsDownloadButton({ bodyshop, galleryImages, identifie }; return ( - <> - - + ); } diff --git a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx index 51c889729..ee7c114ed 100644 --- a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx @@ -13,10 +13,11 @@ import JobSearchSelect from "../job-search-select/job-search-select.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobsDocumentsGalleryReassign); + /* ################################################################################################ Developer Note: diff --git a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx index 58adaccad..ab72147b4 100644 --- a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx @@ -21,7 +21,8 @@ import JobsDocumentsGallerySelectAllComponent from "./jobs-documents-gallery.sel const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); + /* ################################################################################################ Developer Note: @@ -165,7 +166,7 @@ function JobsDocumentsComponent({ { + onClick={(index) => { setModalState({ open: true, index: index }); // window.open( // item.fullsize, @@ -173,7 +174,7 @@ function JobsDocumentsComponent({ // "toolbar=0,location=0,menubar=0" // ); }} - onSelect={(index, image) => { + onSelect={(index) => { setgalleryImages({ ...galleryImages, images: galleryImages.images.map((g, idx) => @@ -212,6 +213,7 @@ function JobsDocumentsComponent({ { const newWindow = window.open( `${window.location.protocol}//${window.location.host}/edit?documentId=${ diff --git a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.container.jsx b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.container.jsx index ea4489426..22dde88ed 100644 --- a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.container.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.container.jsx @@ -1,5 +1,4 @@ import { useQuery } from "@apollo/client"; -import React from "react"; import { GET_DOCUMENTS_BY_JOB } from "../../graphql/documents.queries"; import AlertComponent from "../alert/alert.component"; import JobDocumentsImgProxy from "../jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component"; @@ -9,11 +8,14 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { useSplitTreatments } from "@splitsoftware/splitio-react"; + const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); + export default connect(mapStateToProps, mapDispatchToProps)(JobsDocumentsContainer); + /* ################################################################################################ Developer Note: @@ -35,7 +37,7 @@ export function JobsDocumentsContainer({ } = useSplitTreatments({ attributes: {}, names: ["Imgproxy"], - splitKey: bodyshop && bodyshop.imexshopid + splitKey: bodyshop?.imexshopid }); const { loading, error, data, refetch } = useQuery(GET_DOCUMENTS_BY_JOB, { @@ -51,7 +53,7 @@ export function JobsDocumentsContainer({ if (Imgproxy.treatment === "on") { return ( { + onSelect={(index) => { setgalleryImages(galleryImages.map((g, idx) => (index === idx ? { ...g, isSelected: !g.isSelected } : g))); }} /> diff --git a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.selectall.component.jsx b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.selectall.component.jsx index 157e04dca..989e5424f 100644 --- a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.selectall.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.selectall.component.jsx @@ -1,12 +1,12 @@ import { Button, Space } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; /* ################################################################################################ Developer Note: Known Technical Debt Item - Modifications to this code requires complementary changes to the Imgproxy code. This code will be removed once the imgproxy migration is completed. + Modifications to this code requires complementary changes to the Imgproxy code. This code will be removed once + the imgproxy migration is completed. ################################################################################################ */ diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.download.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.download.component.jsx index 35b4a785c..b9f8266ff 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.download.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.download.component.jsx @@ -51,7 +51,7 @@ export function JobsDocumentsImgproxyDownloadButton({ galleryImages, identifier, a.href = url; a.download = `${identifier || "documents"}.zip`; a.click(); - } catch (error) { + } catch { setLoading(false); setDownload(null); } @@ -74,7 +74,7 @@ export function JobsDocumentsImgproxyDownloadButton({ galleryImages, identifier, // Use the response data (Blob) to trigger download standardMediaDownload(response.data); - } catch (error) { + } catch { setLoading(false); setDownload(null); // handle error (optional) @@ -82,13 +82,11 @@ export function JobsDocumentsImgproxyDownloadButton({ galleryImages, identifier, }; return ( - <> - - + ); } diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.reassign.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.reassign.component.jsx index 2fcd55a9f..2b9fd681d 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.reassign.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-document-imgproxy-gallery.reassign.component.jsx @@ -10,13 +10,15 @@ import { GET_DOC_SIZE_BY_JOB } from "../../graphql/documents.queries.js"; import { selectBodyshop } from "../../redux/user/user.selectors.js"; import JobSearchSelect from "../job-search-select/job-search-select.component.jsx"; import { isFunction } from "lodash"; + const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobsDocumentsImgproxyGalleryReassign); + /* ################################################################################################ Developer Note: diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx index c7f7d46e4..803505436 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx @@ -22,7 +22,8 @@ import JobsDocumentsGallerySelectAllComponent from "./jobs-documents-imgproxy-ga const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); + /* ################################################################################################ Developer Note: @@ -120,7 +121,7 @@ function JobsDocumentsImgproxyComponent({ { + onClick={(index) => { setModalState({ open: true, index: index }); // window.open( // item.fullsize, @@ -128,7 +129,7 @@ function JobsDocumentsImgproxyComponent({ // "toolbar=0,location=0,menubar=0" // ); }} - onSelect={(index, image) => { + onSelect={(index) => { setGalleryImages({ ...galleryImages, images: galleryImages.images.map((g, idx) => diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx index a970b01b7..0458d3aac 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx @@ -22,7 +22,7 @@ function JobsDocumentImgproxyGalleryExternal({ jobId, externalMediaState }) { { + onSelect={(index) => { setgalleryImages(galleryImages.map((g, idx) => (index === idx ? { ...g, isSelected: !g.isSelected } : g))); }} /> diff --git a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.container.jsx b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.container.jsx index 8c6991d94..d3176a19a 100644 --- a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.container.jsx +++ b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.container.jsx @@ -1,6 +1,6 @@ import { FileExcelFilled, SyncOutlined } from "@ant-design/icons"; import { Alert, Button, Card, Col, Row, Space } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { Gallery } from "react-grid-gallery"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -57,35 +57,34 @@ export function JobsDocumentsLocalGallery({ } }, [job, invoice_number, getJobMedia, getBillMedia]); let optimized; - const jobMedia = - allMedia && allMedia[job.id] - ? allMedia[job.id].reduce( - (acc, val) => { - if (val.type && val.type.mime && val.type.mime.startsWith("image")) { - acc.images.push({ - ...val, - fullsize: val.src, - src: val.thumbnail, - height: val.thumbnailHeight, - width: val.thumbnailWidth, - ...(val.optimized && { src: val.optimized, fullsize: val.src }) - }); - if (val.optimized) optimized = true; - } else { - acc.other.push({ - ...val, - fullsize: val.src, - src: val.thumbnail, - height: val.thumbnailHeight, - width: val.thumbnailWidth, - tags: [{ value: val.filename, title: val.filename }] - }); - } - return acc; - }, - { images: [], other: [] } - ) - : { images: [], other: [] }; + const jobMedia = allMedia?.[job.id] + ? allMedia[job.id].reduce( + (acc, val) => { + if (val.type?.mime && val.type.mime.startsWith("image")) { + acc.images.push({ + ...val, + fullsize: val.src, + src: val.thumbnail, + height: val.thumbnailHeight, + width: val.thumbnailWidth, + ...(val.optimized && { src: val.optimized, fullsize: val.src }) + }); + if (val.optimized) optimized = true; + } else { + acc.other.push({ + ...val, + fullsize: val.src, + src: val.thumbnail, + height: val.thumbnailHeight, + width: val.thumbnailWidth, + tags: [{ value: val.filename, title: val.filename }] + }); + } + return acc; + }, + { images: [], other: [] } + ) + : { images: [], other: [] }; const hasMediaAccess = HasFeatureAccess({ bodyshop, featureName: "media" }); return (
@@ -140,7 +139,12 @@ export function JobsDocumentsLocalGallery({ }} {...(optimized && { customControls: [ - + ] })} onClick={(index) => { diff --git a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.delete.component.jsx b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.delete.component.jsx index 05624557c..c194cd57f 100644 --- a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.delete.component.jsx +++ b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.delete.component.jsx @@ -1,6 +1,6 @@ import { QuestionCircleOutlined } from "@ant-design/icons"; import { Button, Popconfirm } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { logImEXEvent } from "../../firebase/firebase.utils"; import cleanAxios from "../../utils/CleanAxios"; @@ -36,7 +36,7 @@ export function JobsDocumentsLocalDeleteButton({ bodyshop, getJobMedia, allMedia `${bodyshop.localmediaserverhttp}/jobs/delete`, { jobid: jobid, - files: ((allMedia && allMedia[jobid]) || []).filter((i) => i.isSelected).map((i) => i.filename) + files: (allMedia?.[jobid] || []).filter((i) => i.isSelected).map((i) => i.filename) }, { headers: { ims_token: bodyshop.localmediatoken } } ); diff --git a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.download.jsx b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.download.jsx index 04a95313f..c5ed07019 100644 --- a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.download.jsx +++ b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.download.jsx @@ -1,5 +1,5 @@ import { Button } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import cleanAxios from "../../utils/CleanAxios"; @@ -12,12 +12,12 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, allMedia: selectAllMedia }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobsLocalGalleryDownloadButton); -export function JobsLocalGalleryDownloadButton({ bodyshop, galleryImages, allMedia, job }) { +export function JobsLocalGalleryDownloadButton({ bodyshop, allMedia, job }) { const { t } = useTranslation(); const [download, setDownload] = useState(null); @@ -25,7 +25,7 @@ export function JobsLocalGalleryDownloadButton({ bodyshop, galleryImages, allMed setDownload((currentDownloadState) => { return { downloaded: progressEvent.loaded || 0, - speed: (progressEvent.loaded || 0) - ((currentDownloadState && currentDownloadState.downloaded) || 0) + speed: (progressEvent.loaded || 0) - (currentDownloadState?.downloaded || 0) }; }); } @@ -35,7 +35,7 @@ export function JobsLocalGalleryDownloadButton({ bodyshop, galleryImages, allMed `${bodyshop.localmediaserverhttp}/jobs/download`, { jobid: job.id, - files: ((allMedia && allMedia[job.id]) || []).filter((i) => i.isSelected).map((i) => i.filename) + files: (allMedia?.[job.id] || []).filter((i) => i.isSelected).map((i) => i.filename) }, { headers: { ims_token: bodyshop.localmediatoken }, diff --git a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.external.component.jsx b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.external.component.jsx index eeaea1e8f..47f1ebaa5 100644 --- a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.external.component.jsx +++ b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.external.component.jsx @@ -1,9 +1,9 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { Gallery } from "react-grid-gallery"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { getJobMedia, toggleMediaSelected } from "../../redux/media/media.actions"; +import { getJobMedia } from "../../redux/media/media.actions"; import { selectAllMedia } from "../../redux/media/media.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -13,14 +13,12 @@ const mapStateToProps = createStructuredSelector({ }); const mapDispatchToProps = (dispatch) => ({ - getJobMedia: (id) => dispatch(getJobMedia(id)), - - toggleMediaSelected: ({ jobid, filename }) => dispatch(toggleMediaSelected({ jobid, filename })) + getJobMedia: (id) => dispatch(getJobMedia(id)) }); export default connect(mapStateToProps, mapDispatchToProps)(JobDocumentsLocalGalleryExternal); -function JobDocumentsLocalGalleryExternal({ jobId, externalMediaState, getJobMedia, toggleMediaSelected, allMedia }) { +function JobDocumentsLocalGalleryExternal({ jobId, externalMediaState, getJobMedia, allMedia }) { const [galleryImages, setgalleryImages] = externalMediaState; const { t } = useTranslation(); @@ -31,15 +29,14 @@ function JobDocumentsLocalGalleryExternal({ jobId, externalMediaState, getJobMed }, [jobId, getJobMedia]); useEffect(() => { - let documents = - allMedia && allMedia[jobId] - ? allMedia[jobId].reduce((acc, val) => { - if (val.type && val.type.mime && val.type.mime.startsWith("image")) { - acc.push({ ...val, src: val.thumbnail, fullsize: val.src }); - } - return acc; - }, []) - : []; + let documents = allMedia?.[jobId] + ? allMedia[jobId].reduce((acc, val) => { + if (val.type?.mime && val.type.mime.startsWith("image")) { + acc.push({ ...val, src: val.thumbnail, fullsize: val.src }); + } + return acc; + }, []) + : []; console.log( "🚀 ~ file: jobs-documents-local-gallery.external.component.jsx:48 ~ useEffect ~ documents:", documents @@ -52,7 +49,7 @@ function JobDocumentsLocalGalleryExternal({ jobId, externalMediaState, getJobMed
{ + onSelect={(index) => { setgalleryImages(galleryImages.map((g, idx) => (index === idx ? { ...g, isSelected: !g.isSelected } : g))); }} /> diff --git a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.selectall.component.jsx b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.selectall.component.jsx index 6b9844436..787016c37 100644 --- a/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.selectall.component.jsx +++ b/client/src/components/jobs-documents-local-gallery/jobs-documents-local-gallery.selectall.component.jsx @@ -1,5 +1,4 @@ import { Button, Space } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; diff --git a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx index 4103f4eb1..0ac960955 100644 --- a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx +++ b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx @@ -2,7 +2,7 @@ import { useMutation } from "@apollo/client"; import { Button } from "antd"; import axios from "axios"; import _ from "lodash"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -42,7 +42,6 @@ export function JobsExportAllButton({ disabled, loadingCallback, completedCallback, - refetch, insertAuditTrail }) { const { t } = useTranslation(); @@ -55,7 +54,7 @@ export function JobsExportAllButton({ logImEXEvent("jobs_export_all"); let PartnerResponse; setLoading(true); - if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + if (bodyshop.accountingconfig?.qbo) { PartnerResponse = await axios.post(`/qbo/receivables`, { jobIds: jobIds, elgen: true @@ -125,7 +124,7 @@ export function JobsExportAllButton({ //Call is not awaited as it is not critical to finish before proceeding. }); - if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + if (!bodyshop.accountingconfig?.qbo) { //QBO Logs are handled server side. await insertExportLog({ variables: { @@ -142,7 +141,7 @@ export function JobsExportAllButton({ }); } } else { - if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + if (!bodyshop.accountingconfig?.qbo) { //QBO Logs are handled server side. await insertExportLog({ variables: { @@ -189,18 +188,14 @@ export function JobsExportAllButton({ }); } } - if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && successfulTransactions.length > 0) { + if (bodyshop.accountingconfig?.qbo && successfulTransactions.length > 0) { notification.open({ type: "success", key: "jobsuccessexport", message: t("jobs.successes.exported") }); const successfulTransactionsSet = [ - ...new Set( - successfulTransactions.map( - (st) => st[bodyshop.accountingconfig && bodyshop.accountingconfig.qbo ? "jobid" : "id"] - ) - ) + ...new Set(successfulTransactions.map((st) => st[bodyshop.accountingconfig?.qbo ? "jobid" : "id"])) ]; if (successfulTransactionsSet.length > 0) { insertAuditTrail({ diff --git a/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx b/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx index a515f682f..6d36d85f2 100644 --- a/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx +++ b/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx @@ -183,7 +183,6 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) { if (search.search && search.search.trim() !== "") { searchJobs(); } - // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function searchJobs(value) { diff --git a/client/src/components/jobs-mark-pst-exempt/jobs-mark-pst-exempt.component.jsx b/client/src/components/jobs-mark-pst-exempt/jobs-mark-pst-exempt.component.jsx index 360d7c592..32fa1b584 100644 --- a/client/src/components/jobs-mark-pst-exempt/jobs-mark-pst-exempt.component.jsx +++ b/client/src/components/jobs-mark-pst-exempt/jobs-mark-pst-exempt.component.jsx @@ -1,5 +1,4 @@ import { Button, Popconfirm } from "antd"; -import React from "react"; import { createStructuredSelector } from "reselect"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; diff --git a/client/src/components/jobs-mark-selected-exported/jobs-mark-selected-exported.jsx b/client/src/components/jobs-mark-selected-exported/jobs-mark-selected-exported.jsx index 0dcf63019..a36f8f1e5 100644 --- a/client/src/components/jobs-mark-selected-exported/jobs-mark-selected-exported.jsx +++ b/client/src/components/jobs-mark-selected-exported/jobs-mark-selected-exported.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Popconfirm } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -50,7 +50,9 @@ export function JobMarkSelectedExported({ date_exported: new Date() } }, - update(cache) {} + update() { + // NO OP + } }); await insertExportLog({ diff --git a/client/src/components/jobs-notes/jobs-notes.container.jsx b/client/src/components/jobs-notes/jobs-notes.container.jsx index fb3a50b5d..c58d905b7 100644 --- a/client/src/components/jobs-notes/jobs-notes.container.jsx +++ b/client/src/components/jobs-notes/jobs-notes.container.jsx @@ -1,6 +1,5 @@ import { useMutation, useQuery } from "@apollo/client"; -import React, { useState } from "react"; -//import SpinComponent from "../../components/loading-spinner/loading-spinner.component"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -39,7 +38,7 @@ export function JobNotesContainer({ jobId, insertAuditTrail }) { variables: { noteId: id } - }).then((r) => { + }).then(() => { refetch(); notification["success"]({ message: t("notes.successes.deleted") @@ -60,7 +59,7 @@ export function JobNotesContainer({ jobId, insertAuditTrail }) { jobId={jobId} loading={loading} data={data ? data.jobs_by_pk.notes : null} - relatedRos={data ? data.jobs_by_pk.vehicle && data.jobs_by_pk.vehicle.jobs : null} + relatedRos={data ? data.jobs_by_pk.vehicle?.jobs : null} refetch={refetch} deleteLoading={deleteLoading} handleNoteDelete={handleNoteDelete} diff --git a/client/src/components/jobs-notes/jobs.notes.component.jsx b/client/src/components/jobs-notes/jobs.notes.component.jsx index ec6e890fe..9ef671f56 100644 --- a/client/src/components/jobs-notes/jobs.notes.component.jsx +++ b/client/src/components/jobs-notes/jobs.notes.component.jsx @@ -1,6 +1,5 @@ import { AuditOutlined, DeleteFilled, EditFilled, EyeInvisibleFilled, WarningFilled } from "@ant-design/icons"; import { Button, Card, Form, Input, Space, Table } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -97,7 +96,7 @@ export function JobNotesComponent({ dataIndex: "text", key: "text", ellipsis: true, - render: (text, record) => {text} + render: (text) => {text} }, { @@ -156,7 +155,7 @@ export function JobNotesComponent({ } ]; - const handleTableChange = (pagination, filters, sorter) => { + const handleTableChange = (pagination, filters) => { setFilter(filters); }; diff --git a/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx b/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx index 6396dfaca..b88b713c2 100644 --- a/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx +++ b/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx @@ -2,7 +2,7 @@ import { BranchesOutlined, ExclamationCircleFilled, PauseCircleOutlined, SyncOut import { useQuery } from "@apollo/client"; import { Button, Card, Grid, Input, Space, Table, Tooltip } from "antd"; import queryString from "query-string"; -import React, { useMemo, useState } from "react"; +import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link, useLocation, useNavigate } from "react-router-dom"; @@ -103,9 +103,7 @@ export function JobsReadyList({ bodyshop }) { e.stopPropagation()}> {record.ro_number || t("general.labels.na")} - {record.production_vars && record.production_vars.alert ? ( - - ) : null} + {record.production_vars?.alert ? : null} {record.suspended && } {record.iouparent && ( @@ -330,9 +328,9 @@ export function JobsReadyList({ bodyshop }) { type: "radio" }} onChange={handleTableChange} - onRow={(record, rowIndex) => { + onRow={(record) => { return { - onClick: (event) => { + onClick: () => { handleOnRowClick(record); } }; diff --git a/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx b/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx index dc523dcb6..5fccd626b 100644 --- a/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx +++ b/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx @@ -1,9 +1,8 @@ import { Space, Tag } from "antd"; -import React from "react"; import { Link } from "react-router-dom"; -export default function JobsRelatedRos({ jobid, job, disabled }) { - if (!(job && job.vehicle && job.vehicle.jobs)) return null; +export default function JobsRelatedRos({ job, disabled }) { + if (!(job?.vehicle && job.vehicle.jobs)) return null; return ( {job.vehicle.jobs diff --git a/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx b/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx index a76baeb73..e87a459a0 100644 --- a/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx +++ b/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Card, Form, InputNumber, Popover, Select } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; @@ -49,7 +49,7 @@ export function LaborAllocationsAdjustmentEdit({ ...(refetchQueryNames ? { refetchQueries: refetchQueryNames } : {}) }); - if (!!result.errors) { + if (result.errors) { notification["error"]({ message: t("jobs.errors.saving", { message: JSON.stringify(result.errors) @@ -81,7 +81,7 @@ export function LaborAllocationsAdjustmentEdit({ onFinish={handleFinish} initialValues={{ mod_lbr_ty: mod_lbr_ty, - hours: adjustments && adjustments[mod_lbr_ty] + hours: adjustments?.[mod_lbr_ty] }} > record.convertedtolbr_data && record.convertedtolbr_data.mod_lbr_ty + render: (text, record) => record.convertedtolbr_data?.mod_lbr_ty }, { title: t("joblines.fields.mod_lb_hrs"), dataIndex: "conv_mod_lb_hrs", key: "conv_mod_lb_hrs", render: (text, record) => - record.convertedtolbr_data && - record.convertedtolbr_data.mod_lb_hrs && - record.convertedtolbr_data.mod_lb_hrs.toFixed(1) + record.convertedtolbr_data?.mod_lb_hrs && record.convertedtolbr_data.mod_lb_hrs.toFixed(1) } ]; @@ -270,4 +269,5 @@ export function LaborAllocationsTable({ ); } + export default connect(mapStateToProps, null)(LaborAllocationsTable); diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx index 5604c59d6..c1330ec87 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx +++ b/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx @@ -2,7 +2,7 @@ import { Alert, Button, Card, Col, Row, Space, Table, Typography } from "antd"; import { SyncOutlined } from "@ant-design/icons"; import axios from "axios"; import _ from "lodash"; -import React, { useEffect, useMemo, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -26,7 +26,6 @@ export function PayrollLaborAllocationsTable({ timetickets, bodyshop, adjustments, - technician, refetch, showWarning, warningCallback @@ -168,16 +167,14 @@ export function PayrollLaborAllocationsTable({ title: t("joblines.fields.mod_lbr_ty"), dataIndex: "conv_mod_lbr_ty", key: "conv_mod_lbr_ty", - render: (text, record) => record.convertedtolbr_data && record.convertedtolbr_data.mod_lbr_ty + render: (text, record) => record.convertedtolbr_data?.mod_lbr_ty }, { title: t("joblines.fields.mod_lb_hrs"), dataIndex: "conv_mod_lb_hrs", key: "conv_mod_lb_hrs", render: (text, record) => - record.convertedtolbr_data && - record.convertedtolbr_data.mod_lb_hrs && - record.convertedtolbr_data.mod_lb_hrs.toFixed(5) + record.convertedtolbr_data?.mod_lb_hrs && record.convertedtolbr_data.mod_lb_hrs.toFixed(5) } ]; diff --git a/client/src/components/layout-form-row/layout-form-row.component.jsx b/client/src/components/layout-form-row/layout-form-row.component.jsx index ae93a0fa5..52a99cd39 100644 --- a/client/src/components/layout-form-row/layout-form-row.component.jsx +++ b/client/src/components/layout-form-row/layout-form-row.component.jsx @@ -1,5 +1,4 @@ import { Col, Divider, Row } from "antd"; -import React from "react"; import "./layout-form-row.styles.scss"; export default function LayoutFormRow({ header, children, grow = false, noDivider = false, ...restProps }) { @@ -10,7 +9,7 @@ export default function LayoutFormRow({ header, children, grow = false, noDivide ); - if (!!!children.length) { + if (!children.length) { //We have only one element. It's going to get the whole thing. return (
diff --git a/client/src/components/loading-skeleton/loading-skeleton.component.jsx b/client/src/components/loading-skeleton/loading-skeleton.component.jsx index 6d9af741a..f23d38f6e 100644 --- a/client/src/components/loading-skeleton/loading-skeleton.component.jsx +++ b/client/src/components/loading-skeleton/loading-skeleton.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import "./loading-skeleton.styles.scss"; import { Skeleton } from "antd"; diff --git a/client/src/components/loading-spinner/loading-spinner.component.jsx b/client/src/components/loading-spinner/loading-spinner.component.jsx index e9e94bcb3..9943b0d21 100644 --- a/client/src/components/loading-spinner/loading-spinner.component.jsx +++ b/client/src/components/loading-spinner/loading-spinner.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { Spin } from "antd"; import "./loading-spinner.styles.scss"; diff --git a/client/src/components/manage-sign-in-button/manage-sign-in-button.component.jsx b/client/src/components/manage-sign-in-button/manage-sign-in-button.component.jsx index 067450179..050a6ad18 100644 --- a/client/src/components/manage-sign-in-button/manage-sign-in-button.component.jsx +++ b/client/src/components/manage-sign-in-button/manage-sign-in-button.component.jsx @@ -1,5 +1,4 @@ import { BuildFilled, LoginOutlined } from "@ant-design/icons"; -import React from "react"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; diff --git a/client/src/components/no-shop/no-shop.component.jsx b/client/src/components/no-shop/no-shop.component.jsx index 1847999e9..ce03d60da 100644 --- a/client/src/components/no-shop/no-shop.component.jsx +++ b/client/src/components/no-shop/no-shop.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { Result } from "antd"; import { useTranslation } from "react-i18next"; diff --git a/client/src/components/not-found/not-found.component.jsx b/client/src/components/not-found/not-found.component.jsx index 20adf832f..c23eba7ee 100644 --- a/client/src/components/not-found/not-found.component.jsx +++ b/client/src/components/not-found/not-found.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { Result } from "antd"; import { useTranslation } from "react-i18next"; diff --git a/client/src/components/note-upsert-modal/note-upsert-modal.component.jsx b/client/src/components/note-upsert-modal/note-upsert-modal.component.jsx index bdd6c713c..333d318b8 100644 --- a/client/src/components/note-upsert-modal/note-upsert-modal.component.jsx +++ b/client/src/components/note-upsert-modal/note-upsert-modal.component.jsx @@ -1,5 +1,4 @@ import { Checkbox, Col, Form, Input, Row, Select, Space, Switch, Tag } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -9,7 +8,7 @@ import NotesPresetButton from "../notes-preset-button/notes-preset-button.compon const mapStateToProps = createStructuredSelector({ noteUpsertModal: selectNoteUpsert }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(NoteUpsertModalComponent); @@ -77,7 +76,7 @@ export function NoteUpsertModalComponent({ form, noteUpsertModal }) {
{!existingNote && t("notes.labels.addtorelatedro")}
{!existingNote && - filteredRelatedRos.map((j, idx) => ( + filteredRelatedRos.map((j) => ( diff --git a/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx b/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx index 90911f056..6c8472667 100644 --- a/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx +++ b/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx @@ -42,7 +42,6 @@ export function NoteUpsertModalContainer({ currentUser, noteUpsertModal, toggleM const { refetch } = actions; const [form] = Form.useForm(); - useEffect(() => { //Required to prevent infinite looping. if (existingNote && open) { @@ -110,7 +109,7 @@ export function NoteUpsertModalContainer({ currentUser, noteUpsertModal, toggleM } }); } - } catch (error) { + } catch { // Cache miss is okay, query hasn't been executed yet console.log("Cache miss for GET_JOB_BY_PK"); } diff --git a/client/src/components/notes-preset-button/notes-preset-button.component.jsx b/client/src/components/notes-preset-button/notes-preset-button.component.jsx index 10827711f..957707da1 100644 --- a/client/src/components/notes-preset-button/notes-preset-button.component.jsx +++ b/client/src/components/notes-preset-button/notes-preset-button.component.jsx @@ -1,6 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; import { Dropdown } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -10,7 +9,7 @@ const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); diff --git a/client/src/components/notification-center/notification-center.component.jsx b/client/src/components/notification-center/notification-center.component.jsx index a29e675fd..b3d61293e 100644 --- a/client/src/components/notification-center/notification-center.component.jsx +++ b/client/src/components/notification-center/notification-center.component.jsx @@ -18,7 +18,6 @@ const NotificationCenterComponent = forwardRef( ( { visible, - onClose, notifications, loading, showUnreadOnly, diff --git a/client/src/components/notification-settings/notification-settings-form.component.jsx b/client/src/components/notification-settings/notification-settings-form.component.jsx index a5b2a1d6f..c728943f8 100644 --- a/client/src/components/notification-settings/notification-settings-form.component.jsx +++ b/client/src/components/notification-settings/notification-settings-form.component.jsx @@ -82,7 +82,7 @@ const NotificationSettingsForm = ({ currentUser, bodyshop }) => { } else { throw new Error("Failed to update auto-add setting"); } - } catch (err) { + } catch { setAutoAddEnabled(!checked); // Revert on error notification.error({ message: t("notifications.labels.auto-add-failure") }); } @@ -102,7 +102,7 @@ const NotificationSettingsForm = ({ currentUser, bodyshop }) => { } else { throw new Error("Failed to update notification settings"); } - } catch (err) { + } catch { notification.error({ message: t("notifications.labels.notification-settings-failure") }); } } diff --git a/client/src/components/owner-detail-form/owner-detail-form.component.jsx b/client/src/components/owner-detail-form/owner-detail-form.component.jsx index 99bacd566..608d66fb1 100644 --- a/client/src/components/owner-detail-form/owner-detail-form.component.jsx +++ b/client/src/components/owner-detail-form/owner-detail-form.component.jsx @@ -6,7 +6,7 @@ import FormItemEmail from "../form-items-formatted/email-form-item.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import { PhoneItemFormatterValidation } from "../form-items-formatted/phone-form-item.component"; -export default function OwnerDetailFormComponent({ form, loading, isPhone1OptedOut, isPhone2OptedOut }) { +export default function OwnerDetailFormComponent({ form, isPhone1OptedOut, isPhone2OptedOut }) { const { t } = useTranslation(); const { getFieldValue } = form; diff --git a/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx b/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx index 8a5e8b3ec..a4b0941ae 100644 --- a/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx +++ b/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx @@ -1,5 +1,5 @@ import { Card, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; @@ -9,18 +9,22 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { alphaSort, dateSort, statusSort } from "../../utils/sorters"; import OwnerDetailUpdateJobsComponent from "../owner-detail-update-jobs/owner-detail-update-jobs.component"; +import { selectIsPartsEntry } from "../../redux/application/application.selectors"; +import getPartsBasePath from "../../utils/getPartsBasePath.js"; const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop + bodyshop: selectBodyshop, + isPartsEntry: selectIsPartsEntry }); -function OwnerDetailJobsComponent({ bodyshop, owner }) { +function OwnerDetailJobsComponent({ bodyshop, owner, isPartsEntry }) { const { t } = useTranslation(); const [selectedJobs, setSelectedJobs] = useState([]); const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); + const basePath = getPartsBasePath(isPartsEntry); const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); @@ -33,7 +37,7 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) { key: "ro_number", ellipsis: true, render: (text, record) => ( - {record.ro_number || t("general.labels.na")} + {record.ro_number || t("general.labels.na")} ), sorter: (a, b) => alphaSort(a.ro_number, b.ro_number), sortOrder: state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order @@ -50,7 +54,7 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) { sortOrder: state.sortedInfo.columnKey === "vehicleid" && state.sortedInfo.order, render: (text, record) => record.vehicleid ? ( - + {`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${record.v_model_desc || ""}`.trim()} ) : ( @@ -80,13 +84,9 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) { title: t("jobs.fields.actual_completion"), dataIndex: "actual_completion", key: "actual_completion", - render: (text, record) => ( - {record.actual_completion} - ), + render: (text, record) => {record.actual_completion}, sorter: (a, b) => dateSort(a.actual_completion, b.actual_completion), - sortOrder: - state.sortedInfo.columnKey === "actual_completion" && - state.sortedInfo.order, + sortOrder: state.sortedInfo.columnKey === "actual_completion" && state.sortedInfo.order }, { title: t("jobs.fields.clm_total"), @@ -120,7 +120,7 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) { onSelect: (record, selected, selectedRows) => { setSelectedJobs(selectedRows ? selectedRows.map((i) => i.id) : []); }, - onSelectAll: (selected, selectedRows, changeRows) => { + onSelectAll: (selected, selectedRows) => { setSelectedJobs( selectedRows ? selectedRows diff --git a/client/src/components/owner-detail-update-jobs/owner-detail-update-jobs.component.jsx b/client/src/components/owner-detail-update-jobs/owner-detail-update-jobs.component.jsx index 6aad4613c..b021660ff 100644 --- a/client/src/components/owner-detail-update-jobs/owner-detail-update-jobs.component.jsx +++ b/client/src/components/owner-detail-update-jobs/owner-detail-update-jobs.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { Button } from "antd"; import { useTranslation } from "react-i18next"; import { useMutation } from "@apollo/client"; @@ -11,7 +10,7 @@ export default function OwnerDetailUpdateJobsComponent({ owner, selectedJobs, di const [updateJobs] = useMutation(UPDATE_JOBS); const notification = useNotification(); - const handlecClick = (e) => { + const handlecClick = () => { logImEXEvent("owner_update_jobs", { count: selectedJobs.length }); updateJobs({ @@ -34,7 +33,7 @@ export default function OwnerDetailUpdateJobsComponent({ owner, selectedJobs, di } } }) - .then((response) => { + .then(() => { notification["success"]({ message: t("jobs.successes.updated") }); }) .catch((error) => { diff --git a/client/src/components/owner-find-modal/owner-find-modal.component.jsx b/client/src/components/owner-find-modal/owner-find-modal.component.jsx index ecaf882f1..7527de91f 100644 --- a/client/src/components/owner-find-modal/owner-find-modal.component.jsx +++ b/client/src/components/owner-find-modal/owner-find-modal.component.jsx @@ -1,5 +1,4 @@ import { Checkbox, Divider, Table } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import PhoneFormatter from "../../utils/PhoneFormatter"; @@ -89,16 +88,16 @@ export default function OwnerFindModalComponent({ type: "radio", selectedRowKeys: [selectedOwner] }} - onRow={(record, rowIndex) => { + onRow={(record) => { return { - onClick: (event) => { + onClick: () => { handleOnRowClick(record); } }; }} /> - setSelectedOwner(null)}> + setSelectedOwner(null)}> {t("owners.labels.create_new")} setPartsQueueToggle(e.target.checked)}> diff --git a/client/src/components/owner-name-display/owner-name-display.component.jsx b/client/src/components/owner-name-display/owner-name-display.component.jsx index 245259491..0b211fbf5 100644 --- a/client/src/components/owner-name-display/owner-name-display.component.jsx +++ b/client/src/components/owner-name-display/owner-name-display.component.jsx @@ -6,7 +6,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(OwnerNameDisplay); diff --git a/client/src/components/owner-search-select/owner-search-select.component.jsx b/client/src/components/owner-search-select/owner-search-select.component.jsx index 282230d67..75e6451ed 100644 --- a/client/src/components/owner-search-select/owner-search-select.component.jsx +++ b/client/src/components/owner-search-select/owner-search-select.component.jsx @@ -2,7 +2,7 @@ import { LoadingOutlined } from "@ant-design/icons"; import { useLazyQuery } from "@apollo/client"; import { Empty, Select } from "antd"; import _ from "lodash"; -import React, { forwardRef, useEffect, useState } from "react"; +import { forwardRef, useEffect, useState } from "react"; import { SEARCH_OWNERS_BY_ID_FOR_AUTOCOMPLETE, SEARCH_OWNERS_FOR_AUTOCOMPLETE } from "../../graphql/owners.queries"; import AlertComponent from "../alert/alert.component"; import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; @@ -47,8 +47,8 @@ const OwnerSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { }; const theOptions = [ - ...(idData && idData.owners_by_pk ? [idData.owners_by_pk] : []), - ...(data && data.search_owners ? data.search_owners : []) + ...(idData?.owners_by_pk ? [idData.owners_by_pk] : []), + ...(data?.search_owners ? data.search_owners : []) ]; return ( diff --git a/client/src/components/owner-tag-popover/owner-tag-popover.component.jsx b/client/src/components/owner-tag-popover/owner-tag-popover.component.jsx index 0a127d747..8d086e4fa 100644 --- a/client/src/components/owner-tag-popover/owner-tag-popover.component.jsx +++ b/client/src/components/owner-tag-popover/owner-tag-popover.component.jsx @@ -1,5 +1,4 @@ import { Button, Col, Descriptions, Popover, Row, Tag } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import PhoneFormatter from "../../utils/PhoneFormatter"; diff --git a/client/src/components/owners-list/owners-list.component.jsx b/client/src/components/owners-list/owners-list.component.jsx index 73991b009..cd30f7824 100644 --- a/client/src/components/owners-list/owners-list.component.jsx +++ b/client/src/components/owners-list/owners-list.component.jsx @@ -1,7 +1,7 @@ import { SyncOutlined } from "@ant-design/icons"; import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link, useLocation, useNavigate } from "react-router-dom"; import PhoneFormatter from "../../utils/PhoneFormatter"; @@ -119,7 +119,7 @@ export default function OwnersListComponent({ loading, owners, total, refetch }) pagination={{ position: "top", pageSize: pageLimit, - current: parseInt(page || 1), + current: parseInt(page || 1, 10), total: total }} columns={columns} diff --git a/client/src/components/owners-list/owners-list.container.jsx b/client/src/components/owners-list/owners-list.container.jsx index 44d089b11..45cd0c4f0 100644 --- a/client/src/components/owners-list/owners-list.container.jsx +++ b/client/src/components/owners-list/owners-list.container.jsx @@ -1,5 +1,4 @@ import { useQuery } from "@apollo/client"; -import React from "react"; import { QUERY_ALL_OWNERS_PAGINATED } from "../../graphql/owners.queries"; import AlertComponent from "../alert/alert.component"; import OwnersListComponent from "./owners-list.component"; diff --git a/client/src/components/partner-ping/partner-ping.component.jsx b/client/src/components/partner-ping/partner-ping.component.jsx index aa0366e5c..0c80bc55c 100644 --- a/client/src/components/partner-ping/partner-ping.component.jsx +++ b/client/src/components/partner-ping/partner-ping.component.jsx @@ -1,5 +1,5 @@ import axios from "axios"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setPartnerVersion } from "../../redux/application/application.actions"; @@ -22,7 +22,6 @@ export function PartnerPingComponent({ bodyshop }) { // Execute the created function directly checkPartnerStatus(bodyshop); - // eslint-disable-next-line react-hooks/exhaustive-deps }, [bodyshop?.id]); return <>; diff --git a/client/src/components/parts-dispatch-expander/parts-dispatch-expander.component.jsx b/client/src/components/parts-dispatch-expander/parts-dispatch-expander.component.jsx index 90adb8284..091adb5ed 100644 --- a/client/src/components/parts-dispatch-expander/parts-dispatch-expander.component.jsx +++ b/client/src/components/parts-dispatch-expander/parts-dispatch-expander.component.jsx @@ -1,13 +1,12 @@ import { useMutation } from "@apollo/client"; import { Button, Card, Col, Row, Table } from "antd"; import dayjs from "../../utils/day"; -import React from "react"; import { useTranslation } from "react-i18next"; import { UPDATE_PARTS_DISPATCH_LINE } from "../../graphql/parts-dispatch.queries"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; -export default function PartsDispatchExpander({ dispatch, job }) { +export default function PartsDispatchExpander({ dispatch }) { const { t } = useTranslation(); const [updateDispatchLine] = useMutation(UPDATE_PARTS_DISPATCH_LINE); const notification = useNotification(); diff --git a/client/src/components/parts-dispatch-table/parts-dispatch-table.component.jsx b/client/src/components/parts-dispatch-table/parts-dispatch-table.component.jsx index 6e35203a9..cb478429d 100644 --- a/client/src/components/parts-dispatch-table/parts-dispatch-table.component.jsx +++ b/client/src/components/parts-dispatch-table/parts-dispatch-table.component.jsx @@ -1,10 +1,9 @@ import { MinusCircleTwoTone, PlusCircleTwoTone, SyncOutlined } from "@ant-design/icons"; import { Button, Card, Input, Space, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { TemplateList } from "../../utils/TemplateConstants"; import { alphaSort } from "../../utils/sorters"; @@ -12,13 +11,12 @@ import PartsDispatchExpander from "../parts-dispatch-expander/parts-dispatch-exp import PrintWrapperComponent from "../print-wrapper/print-wrapper.component"; const mapStateToProps = createStructuredSelector({ - jobRO: selectJobReadOnly, bodyshop: selectBodyshop }); -const mapDispatchToProps = (dispatch) => ({}); +const mapDispatchToProps = () => ({}); -export function PartDispatchTableComponent({ bodyshop, jobRO, job, billsQuery, handleOnRowClick }) { +export function PartDispatchTableComponent({ bodyshop, job, billsQuery }) { const { t } = useTranslation(); const [state, setState] = useState({ @@ -117,7 +115,7 @@ export function PartDispatchTableComponent({ bodyshop, jobRO, job, billsQuery, h }} expandable={{ expandedRowRender: (record) => , - rowExpandable: (record) => true, + rowExpandable: () => true, expandIcon: ({ expanded, onExpand, record }) => expanded ? ( diff --git a/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx b/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx index 7fd2cf2e4..1abf9e910 100644 --- a/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx +++ b/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Form, Popover, Spin } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -16,14 +16,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -export function PartsOrderBackorderEta({ - backordered_eta, - partsOrderStatus, - partsLineId, - jobLineId, - disabled, - bodyshop -}) { +export function PartsOrderBackorderEta({ backordered_eta, partsOrderStatus, partsLineId, disabled, bodyshop }) { const [visibility, setVisibility] = useState(false); const [loading, setLoading] = useState(false); const [updateBoDate] = useMutation(MUTATION_UPDATE_BO_ETA); @@ -44,7 +37,7 @@ export function PartsOrderBackorderEta({ } }); - if (!!result.errors) { + if (result.errors) { notification["error"]({ message: t("parts_orders.errors.backordering", { message: JSON.stringify(result.errors) @@ -56,7 +49,7 @@ export function PartsOrderBackorderEta({ setLoading(false); }; - const handlePopover = (e) => { + const handlePopover = () => { setVisibility(true); }; diff --git a/client/src/components/parts-order-cm-received/parts-order-cm-received.component.jsx b/client/src/components/parts-order-cm-received/parts-order-cm-received.component.jsx index af7d52142..1bf9abb64 100644 --- a/client/src/components/parts-order-cm-received/parts-order-cm-received.component.jsx +++ b/client/src/components/parts-order-cm-received/parts-order-cm-received.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Checkbox, Space, Spin } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { MUTATION_UPDATE_PO_CM_REECEIVED } from "../../graphql/parts-orders.queries"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; @@ -41,7 +41,7 @@ export default function PartsOrderCmReceived({ checked, orderLineId, partsOrderI } }); - if (!!!result.errors) { + if (!result.errors) { notification["success"]({ message: t("parts_orders.successes.line_updated") }); diff --git a/client/src/components/parts-order-delete-line/parts-order-delete-line.component.jsx b/client/src/components/parts-order-delete-line/parts-order-delete-line.component.jsx index a04270ab9..a1ae16bdf 100644 --- a/client/src/components/parts-order-delete-line/parts-order-delete-line.component.jsx +++ b/client/src/components/parts-order-delete-line/parts-order-delete-line.component.jsx @@ -1,4 +1,3 @@ -import React from "react"; import { Button, Popconfirm } from "antd"; import { DeleteFilled } from "@ant-design/icons"; import { useTranslation } from "react-i18next"; diff --git a/client/src/components/parts-order-line-backorder-button/parts-order-line-backorder-button.component.jsx b/client/src/components/parts-order-line-backorder-button/parts-order-line-backorder-button.component.jsx index e38b30ecb..4a4972e61 100644 --- a/client/src/components/parts-order-line-backorder-button/parts-order-line-backorder-button.component.jsx +++ b/client/src/components/parts-order-line-backorder-button/parts-order-line-backorder-button.component.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Button, Form, Popover } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -47,7 +47,7 @@ export function PartsOrderLineBackorderButton({ partsOrderStatus, partsLineId, j } }); - if (!!result.errors) { + if (result.errors) { notification["error"]({ message: t("parts_orders.errors.backordering", { message: JSON.stringify(result.errors) @@ -59,7 +59,7 @@ export function PartsOrderLineBackorderButton({ partsOrderStatus, partsLineId, j setLoading(false); }; - const handlePopover = (e) => { + const handlePopover = () => { if (isAlreadyBackordered) { handleFinish(); //Receive the part. diff --git a/client/src/components/parts-order-list-table/parts-order-list-table-drawer.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table-drawer.component.jsx index 3fe23ca4c..7e07f8384 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table-drawer.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table-drawer.component.jsx @@ -3,7 +3,7 @@ import { PageHeader } from "@ant-design/pro-layout"; import { useLazyQuery, useMutation } from "@apollo/client"; import { Button, Drawer, Grid, Popconfirm, Space, Table } from "antd"; import queryString from "query-string"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { FaTasks } from "react-icons/fa"; import { connect } from "react-redux"; @@ -12,7 +12,7 @@ import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { QUERY_BILL_BY_PK } from "../../graphql/bills.queries"; import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries"; -import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; @@ -31,7 +31,8 @@ import PrintWrapper from "../print-wrapper/print-wrapper.component"; const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly, - bodyshop: selectBodyshop + bodyshop: selectBodyshop, + isPartsEntry: selectIsPartsEntry }); const mapDispatchToProps = (dispatch) => ({ @@ -60,7 +61,8 @@ export function PartsOrderListTableDrawerComponent({ billsQuery, handleOnRowClick, setPartsReceiveContext, - setTaskUpsertContext + setTaskUpsertContext, + isPartsEntry }) { const selectedBreakpoint = Object.entries(Grid.useBreakpoint()) .filter((screen) => !!screen[1]) @@ -134,19 +136,21 @@ export function PartsOrderListTableDrawerComponent({ > {t("parts_orders.actions.receive")} - + {!isPartsEntry && ( + + )} - - + }); + }} + > + {t("parts_orders.actions.receivebill")} + + )} {text} + render: (text) => {text} }, { title: t("parts_orders.fields.backordered_eta"), diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index f0bc70e27..af0814429 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -1,14 +1,14 @@ import { DeleteFilled, EyeFilled, SyncOutlined } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; import { Button, Card, Checkbox, Input, Popconfirm, Space, Table } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { FaTasks } from "react-icons/fa"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries"; -import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { DateFormatter } from "../../utils/DateFormatter"; @@ -23,7 +23,8 @@ import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx"; const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly, - bodyshop: selectBodyshop + bodyshop: selectBodyshop, + isPartsEntry: selectIsPartsEntry }); const mapDispatchToProps = (dispatch) => ({ @@ -52,7 +53,8 @@ export function PartsOrderListTableComponent({ billsQuery, handleOnRowClick, setPartsReceiveContext, - setTaskUpsertContext + setTaskUpsertContext, + isPartsEntry }) { const responsibilityCenters = bodyshop.md_responsibility_centers; const Templates = TemplateList("partsorder", { job }); @@ -106,18 +108,21 @@ export function PartsOrderListTableComponent({ > {t("parts_orders.actions.receive")} - + }); + }} + > + {t("parts_orders.actions.receivebill")} + + )} ({ +const mapDispatchToProps = () => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect(mapStateToProps, mapDispatchToProps)(PartsOrderModalComponent); @@ -33,7 +32,7 @@ export function PartsOrderModalComponent({ bodyshop, vendorList, sendTypeState, }); const { t } = useTranslation(); - const handleClick = ({ item, key, keyPath }) => { + const handleClick = ({ item }) => { form.setFieldsValue({ comments: item.props.value }); }; @@ -76,7 +75,7 @@ export function PartsOrderModalComponent({ bodyshop, vendorList, sendTypeState, > - {job && job.special_coverage_policy && ( + {job?.special_coverage_policy && ( @@ -108,7 +107,7 @@ export function PartsOrderModalComponent({ bodyshop, vendorList, sendTypeState, {t("parts_orders.labels.inthisorder")} - {(fields, { add, remove, move }) => { + {(fields, { remove, move }) => { return (
{fields.map((field, index) => ( diff --git a/client/src/components/parts-order-modal/parts-order-modal.container.jsx b/client/src/components/parts-order-modal/parts-order-modal.container.jsx index ee352ff39..74c6e02dd 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.container.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.container.jsx @@ -1,16 +1,15 @@ -import { useMutation, useQuery, useApolloClient } from "@apollo/client"; +import { useApolloClient, useMutation, useQuery } from "@apollo/client"; import { Form, Modal } from "antd"; import dayjs from "../../utils/day"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { logImEXEvent, auth } from "../../firebase/firebase.utils"; +import { auth, logImEXEvent } from "../../firebase/firebase.utils"; import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries"; import { INSERT_NEW_PARTS_ORDERS, QUERY_PARTS_ORDER_OEC } from "../../graphql/parts-orders.queries"; import { QUERY_ALL_VENDORS_FOR_ORDER } from "../../graphql/vendors.queries"; import { insertAuditTrail } from "../../redux/application/application.actions"; -import { setEmailOptions } from "../../redux/email/email.actions"; import { setModalContext, toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectPartsOrder } from "../../redux/modals/modals.selectors"; import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; @@ -33,7 +32,6 @@ const mapStateToProps = createStructuredSelector({ }); const mapDispatchToProps = (dispatch) => ({ - setEmailOptions: (e) => dispatch(setEmailOptions(e)), toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")), setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" })), insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type })) @@ -44,7 +42,6 @@ export function PartsOrderModalContainer({ toggleModalVisible, currentUser, bodyshop, - setEmailOptions, setBillEnterContext, insertAuditTrail }) { @@ -103,7 +100,7 @@ export function PartsOrderModalContainer({ }, refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"] }); - if (!!insertResult.errors) { + if (insertResult.errors) { notification["error"]({ message: t("parts_orders.errors.creating"), description: JSON.stringify(insertResult.errors) @@ -143,7 +140,7 @@ export function PartsOrderModalContainer({ }); } - if (!!jobLinesResult.errors) { + if (jobLinesResult.errors) { notification["error"]({ message: t("parts_orders.errors.creating"), description: JSON.stringify(jobLinesResult.errors) @@ -192,7 +189,7 @@ export function PartsOrderModalContainer({ if (sendType === "e") { const matchingVendor = data.vendors.filter((item) => item.id === values.vendorid)[0]; - let vendorEmails = matchingVendor && matchingVendor.email && matchingVendor.email.split(RegExp("[;,]")); + let vendorEmails = matchingVendor?.email && matchingVendor.email.split(RegExp("[;,]")); GenerateDocument( { @@ -344,7 +341,7 @@ export function PartsOrderModalContainer({ ) : ( ({}); +const mapDispatchToProps = () => ({}); -export function PartsQueueJobLinesComponent({ jobRO, loading, jobLines }) { +export function PartsQueueJobLinesComponent({ loading, jobLines }) { const [state, setState] = useState({ sortedInfo: {}, filteredInfo: {} diff --git a/client/src/components/parts-queue-list/parts-queue.list.component.jsx b/client/src/components/parts-queue-list/parts-queue.list.component.jsx index 5b9082500..2d404be5e 100644 --- a/client/src/components/parts-queue-list/parts-queue.list.component.jsx +++ b/client/src/components/parts-queue-list/parts-queue.list.component.jsx @@ -3,7 +3,7 @@ import { useQuery } from "@apollo/client"; import { Button, Card, Input, Space, Table } from "antd"; import _ from "lodash"; import queryString from "query-string"; -import React, { useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link, useLocation, useNavigate } from "react-router-dom"; @@ -303,10 +303,10 @@ export function PartsQueueListComponent({ bodyshop }) { selectedRowKeys: [selected], type: "radio" }} - onRow={(record, rowIndex) => { + onRow={() => { return { - onClick: (event) => { - // handleOnRowClick(record); + onClick: () => { + // NO OP } }; }} diff --git a/client/src/components/parts-receive-modal/parts-receive-modal.component.jsx b/client/src/components/parts-receive-modal/parts-receive-modal.component.jsx index 144709832..4e6165344 100644 --- a/client/src/components/parts-receive-modal/parts-receive-modal.component.jsx +++ b/client/src/components/parts-receive-modal/parts-receive-modal.component.jsx @@ -1,6 +1,5 @@ import { DeleteFilled } from "@ant-design/icons"; import { Form, Input, InputNumber, Select, Typography } from "antd"; -import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -41,7 +40,7 @@ export function PartsReceiveModalComponent({ bodyshop, form }) { {t("parts_orders.labels.inthisorder")} - {(fields, { add, remove, move }) => { + {(fields, { remove, move }) => { return (
{fields.map((field, index) => ( diff --git a/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx b/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx index b48c912c8..7c8835a3e 100644 --- a/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx +++ b/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx @@ -1,6 +1,6 @@ import { useMutation } from "@apollo/client"; import { Form, Modal } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -8,12 +8,11 @@ import { logImEXEvent } from "../../firebase/firebase.utils"; import { RECEIVE_PARTS_LINE } from "../../graphql/jobs-lines.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectPartsReceive } from "../../redux/modals/modals.selectors"; -import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import PartsReceiveModalComponent from "./parts-receive-modal.component"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; const mapStateToProps = createStructuredSelector({ - currentUser: selectCurrentUser, bodyshop: selectBodyshop, partsReceiveModal: selectPartsReceive }); @@ -22,7 +21,7 @@ const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("partsReceive")) }); -export function PartsReceiveModalContainer({ partsReceiveModal, toggleModalVisible, currentUser, bodyshop }) { +export function PartsReceiveModalContainer({ partsReceiveModal, toggleModalVisible, bodyshop }) { const { t } = useTranslation(); const [loading, setLoading] = useState(false); const notification = useNotification(); diff --git a/client/src/components/parts-shop-info/parts-business-info.component.jsx b/client/src/components/parts-shop-info/parts-business-info.component.jsx new file mode 100644 index 000000000..62b722115 --- /dev/null +++ b/client/src/components/parts-shop-info/parts-business-info.component.jsx @@ -0,0 +1,125 @@ +import { Form, Input, InputNumber, Select } from "antd"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import PhoneFormItem, { PhoneItemFormatterValidation } from "../form-items-formatted/phone-form-item.component"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; + +const timeZonesList = Intl.supportedValuesOf("timeZone"); + +const mapStateToProps = createStructuredSelector({}); + +const mapDispatchToProps = () => ({}); + +export function PartsBusinessInfoComponent() { + const { t } = useTranslation(); + + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + PhoneItemFormatterValidation(getFieldValue, "phone")]} + > + + + + + + + + + + + + + + + + + + + + + + + + +
+ ); +} + +export default connect(mapStateToProps, mapDispatchToProps)(PartsBusinessInfoComponent); diff --git a/client/src/components/parts-shop-info/parts-email-presets.component.jsx b/client/src/components/parts-shop-info/parts-email-presets.component.jsx new file mode 100644 index 000000000..deb5bb436 --- /dev/null +++ b/client/src/components/parts-shop-info/parts-email-presets.component.jsx @@ -0,0 +1,60 @@ +import { DeleteFilled } from "@ant-design/icons"; +import { Button, Form, Input, Select, Space } from "antd"; +import { useTranslation } from "react-i18next"; +import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; + +export default function PartsEmailPresetsComponent() { + const { t } = useTranslation(); + + return ( +
+ + + {(fields, { add, remove, move }) => { + return ( +
+ {fields.map((field, index) => ( + + + + + + + + + + { + remove(field.name); + }} + /> + + + + + ))} + + + +
+ ); + }} +
+
+
+ ); +} diff --git a/client/src/components/parts-shop-info/parts-order-comments.component.jsx b/client/src/components/parts-shop-info/parts-order-comments.component.jsx new file mode 100644 index 000000000..c6d02ee5d --- /dev/null +++ b/client/src/components/parts-shop-info/parts-order-comments.component.jsx @@ -0,0 +1,74 @@ +import { DeleteFilled } from "@ant-design/icons"; +import { Button, Form, Input, Space } from "antd"; +import { useTranslation } from "react-i18next"; +import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; + +export default function PartsOrderCommentsComponent() { + const { t } = useTranslation(); + + return ( +
+ + + {(fields, { add, remove, move }) => { + return ( +
+ {fields.map((field, index) => ( + + + + + + + + + + + { + remove(field.name); + }} + /> + + + + + ))} + + + +
+ ); + }} +
+
+
+ ); +} diff --git a/client/src/components/parts-shop-info/parts-orders-comments.component.jsx b/client/src/components/parts-shop-info/parts-orders-comments.component.jsx new file mode 100644 index 000000000..fcc1e28eb --- /dev/null +++ b/client/src/components/parts-shop-info/parts-orders-comments.component.jsx @@ -0,0 +1,61 @@ +import { Button, Card, Divider, Form, Input, Space } from "antd"; +import { DeleteOutlined, PlusOutlined } from "@ant-design/icons"; +import { useTranslation } from "react-i18next"; + +const { TextArea } = Input; + +export default function PartsOrdersCommentsComponent() { + const { t } = useTranslation(); + + return ( + + + {(fields, { add, remove }) => ( + <> + {fields.map(({ key, name, ...restField }) => ( + + + + + +