diff --git a/README.MD b/README.MD index 910584faf..d0c3915f8 100644 --- a/README.MD +++ b/README.MD @@ -10,7 +10,7 @@ npx hasura migrate apply --endpoint https://db.imex.online/ --admin-secret 'Prod npx hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret 'Test-ImEXOnlineBySnaptSoftware!' NGROK TEsting: -./ngrok.exe http http://localhost:5000 -host-header="localhost:5000" +./ngrok.exe http http://localhost:4000 -host-header="localhost:4000" Finding deadfiles - run from client directory npx deadfile ./src/index.js --exclude build templates diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 38857c3ad..e54117a86 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -25448,6 +25448,27 @@ dms + + damageto + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + defaultstory false @@ -37167,6 +37188,27 @@ + + estimates_written_converted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + estimator_detail false diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index fb1dcd800..74f6ba4df 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -2,7 +2,6 @@ import { ApolloProvider } from "@apollo/client"; import { SplitFactory, SplitSdk } from "@splitsoftware/splitio-react"; import { ConfigProvider } from "antd"; import enLocale from "antd/es/locale/en_US"; -import LogRocket from "logrocket"; import moment from "moment"; import React from "react"; import { useTranslation } from "react-i18next"; @@ -10,13 +9,8 @@ import GlobalLoadingBar from "../components/global-loading-bar/global-loading-ba import client from "../utils/GraphQLClient"; import App from "./App"; - moment.locale("en-US"); - -//tracker.start(); -if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp"); - export const factory = SplitSdk({ core: { authorizationKey: process.env.REACT_APP_SPLIT_API, diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 6a2bf774a..ccd22f414 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -1,4 +1,6 @@ +import { useTreatments } from "@splitsoftware/splitio-react"; import { Button, Result } from "antd"; +import LogRocket from "logrocket"; import React, { lazy, Suspense, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -9,15 +11,18 @@ import ErrorBoundary from "../components/error-boundary/error-boundary.component //Component Imports 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 { checkUserSession } from "../redux/user/user.actions"; -import { selectCurrentUser } from "../redux/user/user.selectors"; +import { + selectBodyshop, + selectCurrentUser, +} from "../redux/user/user.selectors"; import PrivateRoute from "../utils/private-route"; import "./App.styles.scss"; -import LandingPage from "../pages/landing/landing.page"; const ResetPassword = lazy(() => import("../pages/reset-password/reset-password.component") ); @@ -32,13 +37,26 @@ const MobilePaymentContainer = lazy(() => const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, online: selectOnline, + bodyshop: selectBodyshop, }); const mapDispatchToProps = (dispatch) => ({ checkUserSession: () => dispatch(checkUserSession()), setOnline: (isOnline) => dispatch(setOnline(isOnline)), }); -export function App({ checkUserSession, currentUser, online, setOnline }) { +export function App({ + bodyshop, + checkUserSession, + currentUser, + online, + setOnline, +}) { + const { LogRocket_Tracking } = useTreatments( + ["LogRocket_Tracking"], + {}, + bodyshop && bodyshop.imexshopid + ); + useEffect(() => { if (!navigator.onLine) { setOnline(false); @@ -59,6 +77,16 @@ export function App({ checkUserSession, currentUser, online, setOnline }) { window.addEventListener("online", function (e) { setOnline(true); }); + useEffect(() => { + if (currentUser.authorized) { + if ( + process.env.NODE_ENV === "production" && + LogRocket_Tracking.treatment === "on" + ) { + LogRocket.init("gvfvfw/bodyshopapp"); + } + } + }, [currentUser.authorized, LogRocket_Tracking.treatment]); if (currentUser.authorized === null) { return ; 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 d7adeb4fe..0ef98325a 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 @@ -245,7 +245,7 @@ function BillEnterModalContainer({ return ( { return { key: `${field.index}joblinename`, @@ -58,39 +59,52 @@ export function BillEnterModalLinesComponent({ }; }, formInput: (record, index) => ( - { - setFieldsValue({ - billlines: getFieldsValue(["billlines"]).billlines.map( - (item, idx) => { - if (idx === index) { - return { - ...item, - line_desc: opt.line_desc, - quantity: opt.part_qty || 1, - actual_price: opt.cost, - cost_center: opt.part_type - ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid - ? opt.part_type !== "PAE" - ? opt.part_type - : null - : responsibilityCenters.defaults && - (responsibilityCenters.defaults.costs[ - opt.part_type - ] || - null) - : null, - }; - } - return item; - } - ), - }); + + prev.is_credit_memo !== cur.is_credit_memo + } + > + {() => { + return ( + { + setFieldsValue({ + billlines: getFieldsValue(["billlines"]).billlines.map( + (item, idx) => { + if (idx === index) { + return { + ...item, + line_desc: opt.line_desc, + quantity: opt.part_qty || 1, + actual_price: opt.cost, + cost_center: opt.part_type + ? bodyshop.pbs_serialnumber || + bodyshop.cdk_dealerid + ? opt.part_type !== "PAE" + ? opt.part_type + : null + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[ + opt.part_type + ] || + null) + : null, + }; + } + return item; + } + ), + }); + }} + /> + ); }} - /> + ), }, { @@ -201,23 +215,58 @@ export function BillEnterModalLinesComponent({ }; }, formInput: (record, index) => ( - + + {() => { + const line = getFieldsValue(["billlines"]).billlines[index]; + if (!!!line) return null; + let lineDiscount = 1 - line.actual_cost / line.actual_price; + if (isNaN(lineDiscount)) lineDiscount = 0; + return ( + + 0.005 + ? lineDiscount > discount + ? "orange" + : "red" + : "green", + }} + /> + + ); + }} + + } + /> ), - additional: (record, index) => ( - - {() => { - const line = getFieldsValue(["billlines"]).billlines[index]; - if (!!!line) return null; - const lineDiscount = ( - 1 - - Math.round((line.actual_cost / line.actual_price) * 100) / 100 - ).toPrecision(2); + // additional: (record, index) => ( + // + // {() => { + // const line = getFieldsValue(["billlines"]).billlines[index]; + // if (!!!line) return null; + // const lineDiscount = ( + // 1 - + // Math.round((line.actual_cost / line.actual_price) * 100) / 100 + // ).toPrecision(2); - if (lineDiscount - discount === 0) return
; - return ; - }} - - ), + // return ( + // + // + // + // ); + // }} + // + // ), }, { title: t("billlines.fields.cost_center"), diff --git a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx index 910d29856..a0d19f408 100644 --- a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx +++ b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx @@ -4,14 +4,18 @@ import { useTranslation } from "react-i18next"; //To be used as a form element only. const { Option } = Select; -const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => { +const BillLineSearchSelect = ( + { options, disabled, allowRemoved, ...restProps }, + ref +) => { const { t } = useTranslation(); - + console.log(allowRemoved); return (