diff --git a/.circleci/config.yml b/.circleci/config.yml index 265807436..07882fa41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,8 +66,9 @@ jobs: - aws-s3/sync: from: build - to: "s3://rome-online-production/" + to: "s3://imex-online-production/" - jira/notify + rome-api-deploy: docker: - image: "cimg/base:stable" @@ -128,7 +129,7 @@ jobs: - aws-s3/sync: from: build - to: "s3://imex-online-production/" + to: "s3://rome-online-production/" - jira/notify test-hasura-migrate: diff --git a/client/.env.production b/client/.env.production index 7a58e4591..81d504796 100644 --- a/client/.env.production +++ b/client/.env.production @@ -1,12 +1,12 @@ -REACT_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql -REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT=https://db.test.bodyshop.app/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.test.bodyshop.app/v1/graphql REACT_APP_GA_CODE=231103507 -REACT_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"} +REACT_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"} REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop REACT_APP_CLOUDINARY_API_KEY=473322739956866 REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 -REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BMgZT1NZztW2DsJl8Mg2L04hgY9FzAg6b8fbzgNAfww2VDzH3VE63Ot9EaP_U7KWS2JT-7HPHaw0T_Tw_5vkZc8' +REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BP1B7ZTYpn-KMt6nOxlld6aS8Skt3Q7ZLEqP0hAvGHxG4UojPYiXZ6kPlzZkUC5jH-EcWXomTLtmadAIxurfcHo' REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/ REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online diff --git a/client/.env.test b/client/.env.test index c6403dee6..6768939ff 100644 --- a/client/.env.test +++ b/client/.env.test @@ -8,7 +8,7 @@ REACT_APP_CLOUDINARY_API_KEY=473322739956866 REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BN2GcDPjipR5MTEosO5dT4CfQ3cmrdBIsI4juoOQrRijn_5aRiHlwj1mlq0W145mOusx6xynEKl_tvYJhpCc9lo' REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g -REACT_APP_AXIOS_BASE_API_URL=https://api.test.imex.online/ -REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online +REACT_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/ +REACT_APP_REPORTS_SERVER_URL=https://reports.romeonline.io REACT_APP_IS_TEST=true REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc \ No newline at end of file diff --git a/client/src/components/job-totals-table/job-totals-table.component.jsx b/client/src/components/job-totals-table/job-totals-table.component.jsx index ecfd6bccc..49536ce22 100644 --- a/client/src/components/job-totals-table/job-totals-table.component.jsx +++ b/client/src/components/job-totals-table/job-totals-table.component.jsx @@ -67,7 +67,8 @@ export function JobsTotalsTableComponent({ jobRO, currentUser, job }) { - {currentUser.email.includes("@imex.") && ( + {(currentUser.email.includes("@imex.") || + currentUser.email.includes("@rome.")) && ( diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 1d864300f..6f894644e 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -497,7 +497,7 @@ async function CheckTaxRates(estData, bodyshop) { //IO-1387 If a sublet line is NOT R&R, use the labor tax. If it is, use the sublet tax rate. //Currently limited to SK shops only. - //if (bodyshop.region_config === "CA_SK") { + if (bodyshop.region_config === "CA_SK") { estData.joblines.data.forEach((jl, index) => { if ( (jl.part_type === "PASL" || jl.part_type === "PAS") && @@ -512,7 +512,7 @@ async function CheckTaxRates(estData, bodyshop) { estData.joblines.data[index].tax_part = true; } }); - //} + } } async function ResolveCCCLineIssues(estData, bodyshop) { @@ -523,7 +523,7 @@ async function ResolveCCCLineIssues(estData, bodyshop) { if (line.misc_amt && line.misc_amt !== 0) { line.act_price = line.misc_amt; line.part_type = "PAS"; - line.tax_part = line.misc_tax; + line.tax_part = !!line.misc_tax; } }); diff --git a/job-totals-testing-util.js b/job-totals-testing-util.js index bbf13d99f..7217fe418 100644 --- a/job-totals-testing-util.js +++ b/job-totals-testing-util.js @@ -20,7 +20,7 @@ require("dotenv").config({ async function RunTheTest() { const bodyshopids = ["6c63a820-542c-497e-8c82-0cc38fb2bbca"]; - const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImQwNWI0MDljNmYyMm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fM76tAuKPniurMNV5VwJZX7RhsjFelmoUFFTVOj6JVL-Sw-vs65A`; const { jobs } = await client.request( gql` query GET_JOBS($bodyshopids: [uuid!]!) { diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 7f16ff1f3..74eead012 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -687,13 +687,15 @@ function CalculateTaxesTotals(job, otherTotals) { val.prt_dsmk_m && val.prt_dsmk_m !== 0 && DiscountNotAlreadyCounted(val, job.joblines) - ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) - : Dinero({ - amount: Math.round(val.act_price * 100), - }) - .multiply(val.part_qty || 0) - .percentage(Math.abs(val.prt_dsmk_p || 0)) - .multiply(val.prt_dsmk_p > 0 ? 1 : -1) + ? val.prt_dsmk_m + ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) + : Dinero({ + amount: Math.round(val.act_price * 100), + }) + .multiply(val.part_qty || 0) + .percentage(Math.abs(val.prt_dsmk_p || 0)) + .multiply(val.prt_dsmk_p > 0 ? 1 : -1) + : Dinero() ) .percentage( ((job.parts_tax_rates && @@ -711,8 +713,9 @@ function CalculateTaxesTotals(job, otherTotals) { ) ); } + console.log(statePartsTax.toFormat(), val.line_desc); }); - + console.log("State Parts Tax", statePartsTax.toFormat()); let ret = { subtotal: subtotal, federal_tax: subtotal @@ -738,22 +741,22 @@ function CalculateTaxesTotals(job, otherTotals) { .add( otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100) ) - .add(additionalItemsTax), - // .add( - // otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. - // ? otherTotals.rates.mapa.total.percentage( - // (job.tax_paint_mat_rt || 0) * 100 - // ) - // : Dinero() - // ) - // .add( - // otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. - // ? otherTotals.rates.mash.total.percentage( - // (job.tax_paint_mat_rt || 0) * 100 - // ) - // : Dinero() - // ), - // .add(otherTotals.additional.pvrt), + .add(additionalItemsTax) + .add( + otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. + ? otherTotals.rates.mapa.total.percentage( + (job.tax_paint_mat_rt || 0) * 100 + ) + : Dinero() + ) + .add( + otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. + ? otherTotals.rates.mash.total.percentage( + (job.tax_paint_mat_rt || 0) * 100 + ) + : Dinero() + ), + local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100), }; ret.total_repairs = ret.subtotal @@ -796,6 +799,7 @@ function DiscountNotAlreadyCounted(jobline, joblines) { (jobline.prt_dsmk_m / (jobline.act_price - jobline.prt_dsmk_m)) * 100 ) === Math.abs(jobline.prt_dsmk_p) ) { + console.log(jobline.line_desc, "Already had the discount counted."); return false; }