diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index be57f200d..fbcd25a81 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1,4 +1,4 @@ - + - + tags - window.$crisp = []; - window.CRISP_WEBSITE_ID = "36724f62-2eb0-4b29-9cdd-9905fb99913e"; - var d = document; - var s = d.createElement("script"); - s.src = "https://client.crisp.chat/l.js"; - s.async = 1; - d.getElementsByTagName("head")[0].appendChild(s); + // useEffect(() => { + // // Include the Crisp code here, without the tags + // window.$crisp = []; + // window.CRISP_WEBSITE_ID = "36724f62-2eb0-4b29-9cdd-9905fb99913e"; + // var d = document; + // var s = d.createElement("script"); + // s.src = "https://client.crisp.chat/l.js"; + // s.async = 1; + // d.getElementsByTagName("head")[0].appendChild(s); - return () => { - d.getElementsByTagName("head")[0].removeChild(s); - }; - }, []); + // return () => { + // d.getElementsByTagName("head")[0].removeChild(s); + // }; + // }, []); return ( 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 9dda9d70d..8ed0f3724 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 @@ -47,7 +47,9 @@ export function BillMarkForReexportButton({ bodyshop, authLevel, bill }) { }); if (!result.errors) { - notification["success"]({ message: t("bills.successes.save") }); + notification["success"]({ + message: t("bills.successes.reexport"), + }); } else { notification["error"]({ message: t("bills.errors.saving", { diff --git a/client/src/components/chat-archive-button/chat-archive-button.component.jsx b/client/src/components/chat-archive-button/chat-archive-button.component.jsx index dcda38860..fdcff6b90 100644 --- a/client/src/components/chat-archive-button/chat-archive-button.component.jsx +++ b/client/src/components/chat-archive-button/chat-archive-button.component.jsx @@ -5,10 +5,6 @@ import { useTranslation } from "react-i18next"; import { TOGGLE_CONVERSATION_ARCHIVE } from "../../graphql/conversations.queries"; export default function ChatArchiveButton({ conversation }) { - console.log( - "🚀 ~ file: chat-archive-button.component.jsx ~ line 6 ~ conversation", - conversation - ); const [loading, setLoading] = useState(false); const { t } = useTranslation(); const [updateConversation] = useMutation(TOGGLE_CONVERSATION_ARCHIVE); 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 012bee464..6c2a215d1 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 @@ -63,7 +63,9 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) { - + value && value.toFixed(2)} + /> > ", this.props); const { t } = this.props; const { error, info } = this.state; if (this.state.hasErrored === true) { diff --git a/client/src/components/feature-wrapper/feature-wrapper.component.jsx b/client/src/components/feature-wrapper/feature-wrapper.component.jsx new file mode 100644 index 000000000..af609ac1f --- /dev/null +++ b/client/src/components/feature-wrapper/feature-wrapper.component.jsx @@ -0,0 +1,50 @@ +import moment from "moment"; +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 AlertComponent from "../alert/alert.component"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); + +function FeatureWrapper({ + bodyshop, + featureName, + noauth, + children, + ...restProps +}) { + const { t } = useTranslation(); + + if (HasFeatureAccess({ featureName, bodyshop })) return children; + + return ( + noauth || ( + + ) + ); +} + +export function HasFeatureAccess({ featureName, bodyshop }) { + return ( + bodyshop.features.allAccess || + moment(bodyshop.features[featureName]).isAfter(moment()) + ); +} + +export default connect(mapStateToProps, null)(FeatureWrapper); + +/* +dashboard +production-board +scoreboard +csi +tech-console +mobile-imaging +*/ diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index e0a44da56..9b52c3460 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -202,8 +202,8 @@ function Header({ context: null, }); }} + icon={} > - {t("menus.header.enterpayment")} diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 346741d47..8ac3bdd02 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -16,6 +16,7 @@ import { Table, Tag, } from "antd"; +import axios from "axios"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -291,8 +292,8 @@ export function JobLinesComponent({ @@ -395,7 +400,7 @@ export function JobLinesComponent({ setState({ ...state, filteredInfo: { - part_type: ["PAN,PAL,PAA,PAP,PAS,PASL"], + part_type: ["PAN,PAC,PAR,PAL,PAA,PAM,PAP,PAS,PASL"], }, }); }} diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx index 3e2ac88ef..89b9c406e 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx @@ -12,7 +12,7 @@ import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectJobLineEditModal } from "../../redux/modals/modals.selectors"; import UndefinedToNull from "../../utils/undefinedtonull"; import JobLinesUpdsertModal from "./job-lines-upsert-modal.component"; - +import Axios from "axios"; const mapStateToProps = createStructuredSelector({ jobLineEditModal: selectJobLineEditModal, }); @@ -29,10 +29,10 @@ function JobLinesUpsertModalContainer({ const [updateJobLine] = useMutation(UPDATE_JOB_LINE); const [loading, setLoading] = useState(false); - const handleFinish = (values) => { + const handleFinish = async (values) => { setLoading(true); if (!jobLineEditModal.context.id) { - insertJobLine({ + const r = await insertJobLine({ variables: { lineInput: [ { @@ -44,42 +44,44 @@ function JobLinesUpsertModalContainer({ }, ], }, - }) - .then((r) => { - if (jobLineEditModal.actions.refetch) - jobLineEditModal.actions.refetch(); - //Need to recalcuate totals. - toggleModalVisible(); - notification["success"]({ - message: t("joblines.successes.created"), - }); - }) - .catch((error) => { - notification["error"]({ - message: t("joblines.errors.creating", { - message: error.message, - }), - }); + }); + if (!r.errors) { + await Axios.post("/job/totalsssu", { + id: jobLineEditModal.context.jobid, }); + if (jobLineEditModal.actions.refetch) + jobLineEditModal.actions.refetch(); + //Need to recalcuate totals. + toggleModalVisible(); + notification["success"]({ + message: t("joblines.successes.created"), + }); + } else { + notification["error"]({ + message: t("joblines.errors.creating", { + message: JSON.stringify(r.errors.message), + }), + }); + } } else { - updateJobLine({ + const r = await updateJobLine({ variables: { lineId: jobLineEditModal.context.id, line: values, }, - }) - .then((r) => { - notification["success"]({ - message: t("joblines.successes.updated"), - }); - }) - .catch((error) => { - notification["success"]({ - message: t("joblines.errors.updating", { - message: error.message, - }), - }); + }); + if (!r.errors) { + notification["success"]({ + message: t("joblines.successes.updated"), }); + } else { + notification["success"]({ + message: t("joblines.errors.updating", { + message: JSON.stringify(r.errors.message), + }), + }); + } + if (jobLineEditModal.actions.submit) { jobLineEditModal.actions.submit(); } else { 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 04ab0b27d..42c0be5db 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 @@ -80,7 +80,7 @@ const JobSearchSelect = ( {theOptions ? theOptions.map((o) => (