From 8240ea9a64defa522680ef2aab990fe3554d1eb5 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 25 May 2026 11:24:55 -0400 Subject: [PATCH] feature/IO-3714-Esignature-Lock - Add Lock to Esignatures --- .../esignature-custom-document.component.jsx | 19 ++++++++++++++++--- .../lock-wrapper/lock-wrapper.component.jsx | 8 +++++--- .../print-center-jobs.component.jsx | 15 +++++++++++---- client/src/translations/en_us/common.json | 3 +++ client/src/translations/es/common.json | 3 +++ client/src/translations/fr/common.json | 3 +++ 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/client/src/components/esignature-custom-document/esignature-custom-document.component.jsx b/client/src/components/esignature-custom-document/esignature-custom-document.component.jsx index 59d5cab67..6dd279a62 100644 --- a/client/src/components/esignature-custom-document/esignature-custom-document.component.jsx +++ b/client/src/components/esignature-custom-document/esignature-custom-document.component.jsx @@ -24,16 +24,28 @@ const mapDispatchToProps = (dispatch) => ({ ) }); -export function EsignatureCustomDocument({ bodyshop, jobId, setEsignatureContext }) { +export function EsignatureCustomDocument({ + bodyshop, + disabled = false, + jobId, + setEsignatureContext, + showUnavailable = false +}) { const [loading, setLoading] = useState(false); const notification = useNotification(); const { t } = useTranslation(); + const esignatureEnabled = hasDocumensoApiKey(bodyshop); + const isDisabled = disabled || !esignatureEnabled; - if (!hasDocumensoApiKey(bodyshop)) { + if (!esignatureEnabled && !showUnavailable) { return null; } const uploadCustomDocument = async ({ file, onError, onSuccess }) => { + if (isDisabled) { + return; + } + const formData = new FormData(); formData.append("document", file); formData.append("jobid", jobId); @@ -78,11 +90,12 @@ export function EsignatureCustomDocument({ bodyshop, jobId, setEsignatureContext return Upload.LIST_IGNORE; }} customRequest={uploadCustomDocument} + disabled={isDisabled} maxCount={1} showUploadList={false} multiple={false} > - diff --git a/client/src/components/lock-wrapper/lock-wrapper.component.jsx b/client/src/components/lock-wrapper/lock-wrapper.component.jsx index 2d65e3c86..0b8ff191c 100644 --- a/client/src/components/lock-wrapper/lock-wrapper.component.jsx +++ b/client/src/components/lock-wrapper/lock-wrapper.component.jsx @@ -14,7 +14,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); -const LockWrapper = ({ featureName, bodyshop, children, disabled = true, bypass }) => { +const LockWrapper = ({ featureName, bodyshop, children, disabled = true, bypass, locked }) => { let renderedChildren = children; //Mark the child prop as disabled. @@ -36,11 +36,13 @@ const LockWrapper = ({ featureName, bodyshop, children, disabled = true, bypass return {children}; } - return HasFeatureAccess({ featureName: featureName, bodyshop }) ? ( + const hasAccess = typeof locked === "boolean" ? !locked : HasFeatureAccess({ featureName: featureName, bodyshop }); + + return hasAccess ? ( children ) : ( - {!HasFeatureAccess({ featureName: featureName, bodyshop }) && } + {renderedChildren} ); diff --git a/client/src/components/print-center-jobs/print-center-jobs.component.jsx b/client/src/components/print-center-jobs/print-center-jobs.component.jsx index 5e68f56b1..6dc5a1352 100644 --- a/client/src/components/print-center-jobs/print-center-jobs.component.jsx +++ b/client/src/components/print-center-jobs/print-center-jobs.component.jsx @@ -1,5 +1,5 @@ import { useTreatmentsWithConfig } from "@splitsoftware/splitio-react"; -import { Card, Col, Input, Row, Space, Typography } from "antd"; +import { Card, Col, Input, Row, Space, Tooltip, Typography } from "antd"; import _ from "lodash"; import { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -10,6 +10,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import { TemplateList } from "../../utils/TemplateConstants"; import Jobd3RdPartyModal from "../job-3rd-party-modal/job-3rd-party-modal.component"; import EsignatureCustomDocument from "../esignature-custom-document/esignature-custom-document.component"; +import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component"; import PrintCenterItem from "../print-center-item/print-center-item.component"; import PrintCenterJobsLabels from "../print-center-jobs-labels/print-center-jobs-labels.component"; import PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component"; @@ -50,7 +51,7 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop, technicia .filter( (temp) => (!temp.regions || - (temp.regions && temp.regions[bodyshop.region_config]) || + temp.regions?.[bodyshop.region_config] || (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) && (!temp.dms || temp.dms === false) ) @@ -62,7 +63,7 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop, technicia .filter( (temp) => !temp.regions || - (temp.regions && temp.regions[bodyshop.region_config]) || + temp.regions?.[bodyshop.region_config] || (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true) ) .filter((temp) => !isReynoldsMode || !temp.excludedDmsModes?.includes(dmsMode)) @@ -100,7 +101,13 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop, technicia extra={ - {esignatureEnabled && } + + + + + + + setSearch(e.target.value)} value={search} enterButton /> diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index d2088122c..73e04d198 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1366,6 +1366,9 @@ "pdf_only": "Only PDF documents can be uploaded for e-signature.", "upload_title": "Unable to prepare document for e-signature" }, + "tooltips": { + "contact_sales": "E-signatures are not enabled for this shop. Contact sales to add this feature." + }, "fields": { "completed": "Completed?", "completed_at": "Completed At", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 781b1dfae..40685612f 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1366,6 +1366,9 @@ "pdf_only": "Only PDF documents can be uploaded for e-signature.", "upload_title": "Unable to prepare document for e-signature" }, + "tooltips": { + "contact_sales": "Las firmas electronicas no estan habilitadas para este taller. Contacte a ventas para agregar esta funcion." + }, "fields": { "completed": "", "completed_at": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1f3333f56..ce5d80016 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1366,6 +1366,9 @@ "pdf_only": "Only PDF documents can be uploaded for e-signature.", "upload_title": "Unable to prepare document for e-signature" }, + "tooltips": { + "contact_sales": "Les signatures electroniques ne sont pas activees pour cet atelier. Contactez les ventes pour ajouter cette fonctionnalite." + }, "fields": { "completed": "", "completed_at": "",