diff --git a/client/.env.development.promanager b/client/.env.development.promanager index 15fa08bce..70b8b0fdd 100644 --- a/client/.env.development.promanager +++ b/client/.env.development.promanager @@ -1,7 +1,7 @@ VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql VITE_APP_GA_CODE=231099835 -VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"} +VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test VITE_APP_CLOUDINARY_API_KEY=957865933348715 diff --git a/client/.env.production.promanager b/client/.env.production.promanager index efaa09f44..3f604c429 100644 --- a/client/.env.production.promanager +++ b/client/.env.production.promanager @@ -2,7 +2,7 @@ GENERATE_SOURCEMAP=true VITE_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql VITE_APP_GA_CODE=231103507 -VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU","authDomain":"imex-prod.firebaseapp.com","databaseURL":"https://imex-prod.firebaseio.com","projectId":"imex-prod","storageBucket":"imex-prod.appspot.com","messagingSenderId":"253497221485","appId":"1:253497221485:web:3c81c483b94db84b227a64","measurementId":"G-NTWBKG2L0M"} +VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop VITE_APP_CLOUDINARY_API_KEY=473322739956866 diff --git a/client/.env.test.promanager b/client/.env.test.promanager index b2a711d88..e61676138 100644 --- a/client/.env.test.promanager +++ b/client/.env.test.promanager @@ -1,7 +1,7 @@ VITE_APP_GRAPHQL_ENDPOINT=https://db.test.bodyshop.app/v1/graphql VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.test.bodyshop.app/v1/graphql VITE_APP_GA_CODE=231099835 -VITE_APP_FIREBASE_CONFIG={ "apiKey":"AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c", "authDomain":"imex-test.firebaseapp.com", "projectId":"imex-test", "storageBucket":"imex-test.appspot.com", "messagingSenderId":"991923618608", "appId":"1:991923618608:web:633437569cdad78299bef5", "measurementId":"G-TW0XLZEH18"} +VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop VITE_APP_CLOUDINARY_API_KEY=473322739956866 diff --git a/client/src/App/themeProvider.js b/client/src/App/themeProvider.js index 7333de28b..13c2d250a 100644 --- a/client/src/App/themeProvider.js +++ b/client/src/App/themeProvider.js @@ -11,24 +11,28 @@ let isDarkMode = false; * @type {{components: {Menu: {itemDividerBorderColor: string}}}} */ const defaultTheme = { - components: { - Table: { - rowHoverBg: '#e7f3ff', - rowSelectedBg: '#e6f7ff', - headerSortHoverBg: 'transparent', - }, - Menu: { - darkItemHoverBg: '#1677ff', - itemHoverBg: '#1677ff', - horizontalItemHoverBg: '#1677ff', - } + components: { + Table: { + rowHoverBg: '#e7f3ff', + rowSelectedBg: '#e6f7ff', + headerSortHoverBg: 'transparent', }, - token: { - colorPrimary: InstanceRenderMgr({ - imex: "#1677ff", - rome:"#326ade"}) , - colorInfo: "#326ade" - } + Menu: { + darkItemHoverBg: '#1890ff', + itemHoverBg: '#1890ff', + horizontalItemHoverBg: '#1890ff', + }, + }, + token: { + colorPrimary: InstanceRenderMgr({ //TODO:AIO Add in ProMan colors. + imex: '#1890ff', + rome: '#326ade', + }), + colorInfo: InstanceRenderMgr({ + imex: '#1890ff', + rome: '#326ade', + }), + }, }; /** diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index d032c6082..2ab7f92e9 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -112,7 +112,7 @@ function Header({ promanager: HasFeatureAccess({ featureName: 'bills', bodyshop }), }) ) { - accountingChildren.push([ + accountingChildren.push( { key: 'bills', icon: , @@ -128,8 +128,8 @@ function Header({ context: {}, }); }, - }, - ]); + } + ); } if (Simple_Inventory.treatment === 'on') { @@ -378,7 +378,7 @@ function Header({ ...(InstanceRenderManager({ imex: true, rome: true, - promanager: false// HasFeatureAccess({ featureName: 'courtesycars', bodyshop }), + promanager: false, // HasFeatureAccess({ featureName: 'courtesycars', bodyshop }), }) ? [ { @@ -587,9 +587,9 @@ function Header({ label: ( 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 c09ae21c1..e3d9b51fa 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 @@ -37,7 +37,7 @@ export function OwnerNameDisplayFunction(ownerObject, forceFirstLast = false) { const rdxStore = store.getState(); - if (rdxStore.user.bodyshop.last_name_first && !forceFirstLast) + if (rdxStore.user?.bodyshop?.last_name_first && !forceFirstLast) return `${ownerObject?.ownr_ln || ""}, ${ownerObject?.ownr_fn || ""} ${ ownerObject?.ownr_co_nm || "" }`.trim(); diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx index aa6793a47..b28741a8f 100644 --- a/client/src/components/shop-info/shop-info.component.jsx +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -29,9 +29,9 @@ export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoComponent); export function ShopInfoComponent({bodyshop, form, saveLoading}) { - const {treatments: {CriticalPartsScanning, EnhancedPayroll}} = useSplitTreatments({ + const {treatments: {CriticalPartsScanning, Enhanced_Payroll}} = useSplitTreatments({ attributes: {}, - names: ["CriticalPartsScanning","EnhancedPayroll"], + names: ["CriticalPartsScanning","Enhanced_Payroll"], splitKey: bodyshop.imexshopid, }); @@ -95,14 +95,13 @@ export function ShopInfoComponent({bodyshop, form, saveLoading}) { }, ] : []), - ...EnhancedPayroll.treatment === "on" ? [ + ...Enhanced_Payroll.treatment === "on" ? [ { key: 'task-presets', label: t("bodyshop.labels.task-presets"), children: }]: [] ]; - return (
- {InstanceRenderManager({imex:t("titles.imexonline"), + {InstanceRenderManager({imex:t("titles.imexonline"), { InstanceRenderManager({imex: t("titles.imexonline"), rome: t("titles.romeonline"), promanager:t("titles.promanager")}) } diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx index a110f2f39..77d322496 100644 --- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx +++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx @@ -360,6 +360,8 @@ export function TimeTicketList({ dataSource={timetickets} onChange={handleTableChange} summary={() => { + if(Enhanced_Payroll.treatment === "on") return null; + if(Enhanced_Payroll.treatment === "off") return ( diff --git a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx index 17d9355f6..6c00e2de2 100644 --- a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx +++ b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx @@ -143,14 +143,13 @@ const JobRelatedTicketsTable = ({ }, Dinero()); return { - id: `${item.jobKey}${costCenter}`, - costCenter, - item, - actHrs: actHrs.toFixed(1), - prodHrs: prodHrs.toFixed(1), - clockHrs, - ...InstanceRenderManager({rome: {pay}}) - + id: `${item.jobKey}${costCenter}`, + costCenter, + item, + actHrs: actHrs.toFixed(1), + prodHrs: prodHrs.toFixed(1), + clockHrs, + ...InstanceRenderManager({ imex: {}, rome: { pay } }), }; }); }) @@ -210,7 +209,7 @@ const JobRelatedTicketsTable = ({ state.sortedInfo.columnKey === "clockHrs" && state.sortedInfo.order, render: (text, record) => record.clockHrs.toFixed(2), }, - ...InstanceRenderManager({rome:{ + ...InstanceRenderManager({ imex: [], rome:[{ title: "Pay", dataIndex: "Pay", key: "Pay", @@ -218,7 +217,7 @@ const JobRelatedTicketsTable = ({ sortOrder: state.sortedInfo.columnKey === "clockHrs" && state.sortedInfo.order, render: (text, record) => record.pay.toFormat("$0.00"), - }}) + }]}) , { title: t("general.labels.actions"), diff --git a/client/src/pages/contract-create/contract-create.page.container.jsx b/client/src/pages/contract-create/contract-create.page.container.jsx index 6d874aa72..6b33e8fd0 100644 --- a/client/src/pages/contract-create/contract-create.page.container.jsx +++ b/client/src/pages/contract-create/contract-create.page.container.jsx @@ -12,6 +12,7 @@ import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/applic import {selectBodyshop} from "../../redux/user/user.selectors"; import ContractCreatePageComponent from "./contract-create.page.component"; import InstanceRenderManager from '../../utils/instanceRenderMgr'; +import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -122,6 +123,7 @@ export function ContractCreatePageContainer({ }, [t, setBreadcrumbs, setSelectedHeader]); return ( +
+
); } diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 788274a1e..6355a0cec 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -107,31 +107,31 @@ export function JobsDetailPage({ // The union and spread is required to keep values coming in from the estimating system that aren't displayed. parts_tax_rates: _.union( Object.keys(job.parts_tax_rates), - Object.keys(values.parts_tax_rates) + Object.keys(values.parts_tax_rates || {}) ).reduce((acc, val) => { acc[val] = { ...job.parts_tax_rates[val], - ...values.parts_tax_rates[val], + ...values.parts_tax_rates?.[val], //TODO:AIO Verify that these still save for Rome Online with this null coalescing. }; return acc; }, {}), materials: _.union( Object.keys(job.materials), - Object.keys(values.materials) + Object.keys(values.materials|| {}) ).reduce((acc, val) => { acc[val] = { ...job.materials[val], - ...values.materials[val], + ...values.materials?.[val], }; return acc; }, {}), cieca_pfl: _.union( Object.keys(job.cieca_pfl), - Object.keys(values.cieca_pfl) + Object.keys(values.cieca_pfl|| {}) ).reduce((acc, val) => { acc[val] = { ...job.cieca_pfl[val], - ...values.cieca_pfl[val], + ...values.cieca_pfl?.[val], }; return acc; }, {}), diff --git a/client/src/serviceWorkerRegistration.js b/client/src/serviceWorkerRegistration.js index 677976050..5486e3baf 100644 --- a/client/src/serviceWorkerRegistration.js +++ b/client/src/serviceWorkerRegistration.js @@ -11,7 +11,7 @@ // opt-in, read https://cra.link/PWA const isLocalhost = Boolean( - window.location.hostname === 'localhost' || + window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.0/8 are considered localhost for IPv4. @@ -21,117 +21,117 @@ const isLocalhost = Boolean( export function register(config) { if (import.meta.env.PROD && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); + const publicUrl = new URL('process.env.PUBLIC_URL', window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } +//TODO:AIO Resolve this for all 3 host names. + window.addEventListener('load', () => { + const swUrl = `service-worker.js`; - window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config); - if (isLocalhost) { - // This is running on localhost. Let's check if a service worker still exists or not. - checkValidServiceWorker(swUrl, config); - - // Add some additional logging to localhost, pointing developers to the - // service worker/PWA documentation. - navigator.serviceWorker.ready.then(() => { - console.log( - 'This web app is being served cache-first by a service ' + - 'worker. To learn more, visit https://cra.link/PWA' - ); - }); - } else { - // Is not localhost. Just register service worker - registerValidSW(swUrl, config); - } + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(() => { + console.log( + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://cra.link/PWA' + ); }); - } + } else { + // Is not localhost. Just register service worker + registerValidSW(swUrl, config); + } + }); + } } function registerValidSW(swUrl, config) { - navigator.serviceWorker - .register(swUrl) - .then((registration) => { - registration.onupdatefound = () => { - const installingWorker = registration.installing; - if (installingWorker == null) { - return; - } - installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { - if (navigator.serviceWorker.controller) { - // At this point, the updated precached content has been fetched, - // but the previous service worker will still serve the older - // content until all client tabs are closed. - console.log( - 'New content is available and will be used when all ' + - 'tabs for this page are closed. See https://cra.link/PWA.' - ); + navigator.serviceWorker + .register(swUrl) + .then((registration) => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the updated precached content has been fetched, + // but the previous service worker will still serve the older + // content until all client tabs are closed. + console.log( + 'New content is available and will be used when all ' + + 'tabs for this page are closed. See https://cra.link/PWA.' + ); - // Execute callback - if (config && config.onUpdate) { - config.onUpdate(registration); - } - } else { - // At this point, everything has been precached. - // It's the perfect time to display a - // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); + // Execute callback + if (config && config.onUpdate) { + config.onUpdate(registration); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); - // Execute callback - if (config && config.onSuccess) { - config.onSuccess(registration); - } - } - } - }; - }; - }) - .catch((error) => { - console.error('Error during service worker registration:', error); - }); + // Execute callback + if (config && config.onSuccess) { + config.onSuccess(registration); + } + } + } + }; + }; + }) + .catch((error) => { + console.error('Error during service worker registration:', error); + }); } function checkValidServiceWorker(swUrl, config) { - // Check if the service worker can be found. If it can't reload the page. - fetch(swUrl, { - headers: {'Service-Worker': 'script'}, - }) - .then((response) => { - // Ensure service worker exists, and that we really are getting a JS file. - const contentType = response.headers.get('content-type'); - if ( - response.status === 404 || - (contentType != null && contentType.indexOf('javascript') === -1) - ) { - // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then((registration) => { - registration.unregister().then(() => { - window.location.reload(); - }); - }); - } else { - // Service worker found. Proceed as normal. - registerValidSW(swUrl, config); - } - }) - .catch(() => { - console.log('No internet connection found. App is running in offline mode.'); + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl, { + headers: { 'Service-Worker': 'script' }, + }) + .then((response) => { + // Ensure service worker exists, and that we really are getting a JS file. + const contentType = response.headers.get('content-type'); + if ( + response.status === 404 || + (contentType != null && contentType.indexOf('javascript') === -1) + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then((registration) => { + registration.unregister().then(() => { + window.location.reload(); + }); }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config); + } + }) + .catch(() => { + console.log('No internet connection found. App is running in offline mode.'); + }); } export function unregister() { - if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready - .then((registration) => { - registration.unregister(); - }) - .catch((error) => { - console.error(error.message); - }); - } + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready + .then((registration) => { + registration.unregister(); + }) + .catch((error) => { + console.error(error.message); + }); + } }