From de33bcd72b2b1b6160a94391856a5add36dc939e Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 7 Sep 2021 09:12:31 -0700
Subject: [PATCH 1/4] IO-1342 Revert IO-554 and add validation on jobline
upsert.
---
.../job-lines-upsert-modal.component.jsx | 92 +++++++++----------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx
index 520154f08..05b909d8c 100644
--- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx
+++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx
@@ -115,18 +115,18 @@ export default function JobLinesUpsertModalComponent({
({
- // validator(rule, value) {
- // if (!!getFieldValue("mod_lbr_ty") === !!value) {
- // return Promise.resolve();
- // }
- // return Promise.reject(
- // t("joblines.validations.hrsrequirediflbrtyp")
- // );
- // },
- // }),
- // ]}
+ rules={[
+ ({ getFieldValue }) => ({
+ validator(rule, value) {
+ if (!!getFieldValue("mod_lbr_ty") === !!value) {
+ return Promise.resolve();
+ }
+ return Promise.reject(
+ t("joblines.validations.hrsrequirediflbrtyp")
+ );
+ },
+ }),
+ ]}
>
@@ -169,18 +169,18 @@ export default function JobLinesUpsertModalComponent({
({
- // validator(rule, value) {
- // if (!!getFieldValue("part_type") === !!value) {
- // return Promise.resolve();
- // }
- // return Promise.reject(
- // t("joblines.validations.requiredifparttype")
- // );
- // },
- // }),
- // ]}
+ rules={[
+ ({ getFieldValue }) => ({
+ validator(rule, value) {
+ if (!!getFieldValue("part_type") === !!value) {
+ return Promise.resolve();
+ }
+ return Promise.reject(
+ t("joblines.validations.requiredifparttype")
+ );
+ },
+ }),
+ ]}
>
@@ -190,28 +190,28 @@ export default function JobLinesUpsertModalComponent({
({
- // validator(rule, value) {
- // if (!value || getFieldValue("part_type") !== "PAE") {
- // return Promise.resolve();
- // }
- // return Promise.reject(
- // t("joblines.validations.zeropriceexistingpart")
- // );
- // },
- // }),
- // ({ getFieldValue }) => ({
- // validator(rule, value) {
- // if (!!getFieldValue("part_type") === !!value) {
- // return Promise.resolve();
- // }
- // return Promise.reject(
- // t("joblines.validations.requiredifparttype")
- // );
- // },
- // }),
- // ]}
+ rules={[
+ ({ getFieldValue }) => ({
+ validator(rule, value) {
+ if (!value || getFieldValue("part_type") !== "PAE") {
+ return Promise.resolve();
+ }
+ return Promise.reject(
+ t("joblines.validations.zeropriceexistingpart")
+ );
+ },
+ }),
+ ({ getFieldValue }) => ({
+ validator(rule, value) {
+ if (!!getFieldValue("part_type") === !!value) {
+ return Promise.resolve();
+ }
+ return Promise.reject(
+ t("joblines.validations.requiredifparttype")
+ );
+ },
+ }),
+ ]}
>
From 59e57aa274f5fa13d0f78467f2cd94b943412405 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 7 Sep 2021 09:12:35 -0700
Subject: [PATCH 2/4] Package updates.
---
client/package.json | 14 +++++-----
client/yarn.lock | 66 ++++++++++++++++++++++++++-------------------
package.json | 2 +-
yarn.lock | 8 +++---
4 files changed, 51 insertions(+), 39 deletions(-)
diff --git a/client/package.json b/client/package.json
index 3e76fd995..8cdb60e5b 100644
--- a/client/package.json
+++ b/client/package.json
@@ -8,8 +8,8 @@
"@craco/craco": "^6.2.0",
"@fingerprintjs/fingerprintjs": "^3.3.0",
"@lourenci/react-kanban": "^2.1.0",
- "@openreplay/tracker": "^3.2.5",
- "@openreplay/tracker-assist": "^3.0.4",
+ "@openreplay/tracker": "^3.3.1",
+ "@openreplay/tracker-assist": "^3.1.1",
"@openreplay/tracker-graphql": "^3.0.0",
"@openreplay/tracker-redux": "^3.0.0",
"@sentry/react": "^6.11.0",
@@ -19,7 +19,7 @@
"@tanem/react-nprogress": "^3.0.79",
"antd": "^4.16.13",
"apollo-link-logger": "^2.0.0",
- "axios": "^0.21.1",
+ "axios": "^0.21.4",
"craco-less": "^1.20.0",
"dinero.js": "^1.9.0",
"dotenv": "^10.0.0",
@@ -27,12 +27,12 @@
"env-cmd": "^10.1.0",
"exifr": "^7.1.3",
"firebase": "^9.0.0",
- "graphql": "^15.5.2",
+ "graphql": "^15.5.3",
"i18next": "^20.4.0",
"i18next-browser-languagedetector": "^6.1.2",
"jsoneditor": "^9.5.4",
"jsreport-browser-client-dist": "^1.3.0",
- "libphonenumber-js": "^1.9.25",
+ "libphonenumber-js": "^1.9.26",
"logrocket": "^2.0.0",
"markerjs2": "^2.11.2",
"moment-business-days": "^1.2.0",
@@ -53,9 +53,9 @@
"react-i18next": "^11.11.4",
"react-icons": "^4.2.0",
"react-number-format": "^4.7.3",
- "react-redux": "^7.2.4",
+ "react-redux": "^7.2.5",
"react-resizable": "^3.0.4",
- "react-router-dom": "^5.2.1",
+ "react-router-dom": "^5.3.0",
"react-scripts": "^4.0.3",
"react-sublime-video": "^0.2.5",
"react-virtualized": "^9.22.3",
diff --git a/client/yarn.lock b/client/yarn.lock
index d82cec091..135f64c1a 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -2003,10 +2003,10 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"
-"@openreplay/tracker-assist@^3.0.4":
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/@openreplay/tracker-assist/-/tracker-assist-3.1.0.tgz#3432c8d94c26955d73fe456e6ab957f3cb24419f"
- integrity sha512-CkAbrSukwVCfGFjFlGNMDmv7DxUdIbvC9bnFxFUegTnrcZEXge7SPH7ZYpqKGZr1Elr82MvsCZzpQTSsFnJMrw==
+"@openreplay/tracker-assist@^3.1.1":
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/@openreplay/tracker-assist/-/tracker-assist-3.1.1.tgz#32bbadbeb17928b368baf6956d8ee27e380ec77f"
+ integrity sha512-jOei1oEio88NqyPgsE2keRIB0lYhbBxKsJdEn0mhnacZ0dvGcoThHg4pdvq9qQnX+VZciJWbskXL0A56dvfuVg==
dependencies:
npm-dragndrop "^1.2.0"
peerjs "^1.3.2"
@@ -2021,10 +2021,10 @@
resolved "https://registry.yarnpkg.com/@openreplay/tracker-redux/-/tracker-redux-3.0.0.tgz#7d71c8d2b58b08229e6af2c677d53980cee0b9ef"
integrity sha512-ctybOquoDj8QNj82pETftgXjEoAzwEoKSxIhwstJaUv5xUkBVv0rDIjMBgCSys8cB/vbRkI/QhvksDaFr9hY0g==
-"@openreplay/tracker@^3.2.5":
- version "3.3.0"
- resolved "https://registry.yarnpkg.com/@openreplay/tracker/-/tracker-3.3.0.tgz#e786dda078a4a353b41f1d1a4ee902964db60d5b"
- integrity sha512-g9sOG01VaiRLw4TcUbux8j3moa7gsGs8rjZPEVJ5SJqxjje9R7tpUD5UId9ne7QdHSoiHfrWFk3TNRLpXyvImg==
+"@openreplay/tracker@^3.3.1":
+ version "3.3.1"
+ resolved "https://registry.yarnpkg.com/@openreplay/tracker/-/tracker-3.3.1.tgz#a95afb6c95d52ff8a81f97f0eafb03c4b1464d9b"
+ integrity sha512-6R2l7t75jeNJnFhbh46pOfKLRqiroRDMs9xiShpq8AFuY7/zfIIgWobbNTu17XYC3h4r95HcTQ4eSr/vyA/baQ==
dependencies:
"@medv/finder" "^2.0.0"
error-stack-parser "^2.0.6"
@@ -3478,12 +3478,12 @@ axe-core@^4.0.2:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.3.3.tgz#b55cd8e8ddf659fe89b064680e1c6a4dceab0325"
integrity sha512-/lqqLAmuIPi79WYfRpy2i8z+x+vxU3zX2uAm0gs1q52qTuKwolOj1P8XbufpXcsydrpKx2yGn2wzAnxCMV86QA==
-axios@^0.21.1:
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
- integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
+axios@^0.21.4:
+ version "0.21.4"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
+ integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
dependencies:
- follow-redirects "^1.10.0"
+ follow-redirects "^1.14.0"
axobject-query@^2.2.0:
version "2.2.0"
@@ -6430,7 +6430,7 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"
-follow-redirects@^1.0.0, follow-redirects@^1.10.0:
+follow-redirects@^1.0.0, follow-redirects@^1.14.0:
version "1.14.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.3.tgz#6ada78118d8d24caee595595accdc0ac6abd022e"
integrity sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==
@@ -6724,10 +6724,10 @@ graphql-tag@^2.12.3:
dependencies:
tslib "^2.1.0"
-graphql@^15.5.2:
- version "15.5.2"
- resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.2.tgz#efa19f8f2bf1a48eb7d5c85bf17e144ba8bb0480"
- integrity sha512-dZjLPWNQqYv0dqV2RNbiFed0LtSp6yd4jchsDGnuhDKa9OQHJYCfovaOEvY91w9gqbYO7Se9LKDTl3xxYva/3w==
+graphql@^15.5.3:
+ version "15.5.3"
+ resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.3.tgz#c72349017d5c9f5446a897fe6908b3186db1da00"
+ integrity sha512-sM+jXaO5KinTui6lbK/7b7H/Knj9BpjGxZ+Ki35v7YbUJxxdBCUqNM0h3CRVU1ZF9t5lNiBzvBCSYPvIwxPOQA==
growly@^1.3.0:
version "1.3.0"
@@ -8487,10 +8487,10 @@ levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"
-libphonenumber-js@^1.9.25:
- version "1.9.25"
- resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.9.25.tgz#e54b570f03d36ce059a88ab01ec49b9037ec1c97"
- integrity sha512-LsSjcmXXGujESsrOsF2rrLdmuABj3OluCzPJKVNslJ2qc7xF5KdKXN8y0OcxHVurqosVf1/r4itrVrKSrlbVHA==
+libphonenumber-js@^1.9.26:
+ version "1.9.26"
+ resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.9.26.tgz#888aca88a4019d0b108e45db8e0509d55785ae45"
+ integrity sha512-j0brmDsZLSKJCrcli1HjzHYP29VOf5P/Yz+xxe7WmKTe+0XVnKa0J+UEAaT96D21w1mfLPhlm0ZXBQ13EVF+XQ==
lie@~3.3.0:
version "3.3.0"
@@ -11461,7 +11461,7 @@ react-prop-toggle@^1.0.2:
resolved "https://registry.yarnpkg.com/react-prop-toggle/-/react-prop-toggle-1.0.2.tgz#8b0b7e74653606b1427cfcf6c4eaa9198330568e"
integrity sha512-JmerjAXs7qJ959+d0Ygt7Cb2+4fG+n3I2VXO6JO0AcAY1vkRN/JpZKAN67CMXY889xEJcfylmMPhzvf6nWO68Q==
-react-redux@^7.2.0, react-redux@^7.2.4:
+react-redux@^7.2.0:
version "7.2.4"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.4.tgz#1ebb474032b72d806de2e0519cd07761e222e225"
integrity sha512-hOQ5eOSkEJEXdpIKbnRyl04LhaWabkDPV+Ix97wqQX3T3d2NQ8DUblNXXtNMavc7DpswyQM6xfaN4HQDKNY2JA==
@@ -11473,6 +11473,18 @@ react-redux@^7.2.0, react-redux@^7.2.4:
prop-types "^15.7.2"
react-is "^16.13.1"
+react-redux@^7.2.5:
+ version "7.2.5"
+ resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.5.tgz#213c1b05aa1187d9c940ddfc0b29450957f6a3b8"
+ integrity sha512-Dt29bNyBsbQaysp6s/dN0gUodcq+dVKKER8Qv82UrpeygwYeX1raTtil7O/fftw/rFqzaf6gJhDZRkkZnn6bjg==
+ dependencies:
+ "@babel/runtime" "^7.12.1"
+ "@types/react-redux" "^7.1.16"
+ hoist-non-react-statics "^3.3.2"
+ loose-envify "^1.4.0"
+ prop-types "^15.7.2"
+ react-is "^16.13.1"
+
react-refresh@^0.8.3:
version "0.8.3"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"
@@ -11496,10 +11508,10 @@ react-resize-detector@^6.6.3:
lodash.throttle "^4.1.1"
resize-observer-polyfill "^1.5.1"
-react-router-dom@^5.2.1:
- version "5.2.1"
- resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.1.tgz#34af8b551a4ce17487d3f80e651b91651978dff6"
- integrity sha512-xhFFkBGVcIVPbWM2KEYzED+nuHQPmulVa7sqIs3ESxzYd1pYg8N8rxPnQ4T2o1zu/2QeDUWcaqST131SO1LR3w==
+react-router-dom@^5.3.0:
+ version "5.3.0"
+ resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.0.tgz#da1bfb535a0e89a712a93b97dd76f47ad1f32363"
+ integrity sha512-ObVBLjUZsphUUMVycibxgMdh5jJ1e3o+KpAZBVeHcNQZ4W+uUGGWsokurzlF4YOldQYRQL4y6yFRWM4m3svmuQ==
dependencies:
"@babel/runtime" "^7.12.13"
history "^4.9.0"
diff --git a/package.json b/package.json
index 72e366619..a3cc8e644 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"dotenv": "10.0.0",
"express": "^4.16.4",
"firebase-admin": "^9.11.1",
- "graphql": "^15.5.2",
+ "graphql": "^15.5.3",
"graphql-request": "^3.4.0",
"graylog2": "^0.2.1",
"inline-css": "^3.0.0",
diff --git a/yarn.lock b/yarn.lock
index bc81cad4d..47706165c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1947,10 +1947,10 @@ graphql-request@^3.4.0:
extract-files "^9.0.0"
form-data "^3.0.0"
-graphql@^15.5.2:
- version "15.5.2"
- resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.2.tgz#efa19f8f2bf1a48eb7d5c85bf17e144ba8bb0480"
- integrity sha512-dZjLPWNQqYv0dqV2RNbiFed0LtSp6yd4jchsDGnuhDKa9OQHJYCfovaOEvY91w9gqbYO7Se9LKDTl3xxYva/3w==
+graphql@^15.5.3:
+ version "15.5.3"
+ resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.3.tgz#c72349017d5c9f5446a897fe6908b3186db1da00"
+ integrity sha512-sM+jXaO5KinTui6lbK/7b7H/Knj9BpjGxZ+Ki35v7YbUJxxdBCUqNM0h3CRVU1ZF9t5lNiBzvBCSYPvIwxPOQA==
graylog2@^0.2.1:
version "0.2.1"
From 259458eec3d67b884e3a09dfc67ca7d83db4a82a Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 7 Sep 2021 09:53:55 -0700
Subject: [PATCH 3/4] IO-1343 Updated tax rate check on import.
---
.../jobs-available-table.container.jsx | 130 +++++++++++++-----
1 file changed, 97 insertions(+), 33 deletions(-)
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 134946530..d77d5c1d3 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
@@ -98,23 +98,7 @@ export function JobsAvailableContainer({
return;
}
//IO-539 Check for Parts Rate on PAL for SGI use case.
-
- if (
- estData.est_data.parts_tax_rates &&
- estData.est_data.parts_tax_rates.PAL &&
- (estData.est_data.parts_tax_rates.PAL.prt_tax_rt === null ||
- estData.est_data.parts_tax_rates.PAL.prt_tax_rt === 0)
- ) {
- console.log("checking");
- const res = await confirmDialog(
- `ImEX Online has detected that there is a missing tax rate for used parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}%.`
- );
- if (res) {
- estData.est_data.parts_tax_rates.PAL.prt_tax_rt =
- bodyshop.bill_tax_rates.state_tax_rate / 100;
- estData.est_data.parts_tax_rates.PAL.prt_tax_in = true;
- }
- }
+ await CheckTaxRates(estData, bodyshop);
const newTotals = (
await Axios.post("/job/totals", {
@@ -215,22 +199,7 @@ export function JobsAvailableContainer({
});
} else {
//IO-539 Check for Parts Rate on PAL for SGI use case.
- if (
- estData.est_data.parts_tax_rates &&
- estData.est_data.parts_tax_rates.PAL &&
- (estData.est_data.parts_tax_rates.PAL.prt_tax_rt === null ||
- estData.est_data.parts_tax_rates.PAL.prt_tax_rt === 0)
- ) {
- console.log("checking");
- const res = await confirmDialog(
- `ImEX Online has detected that there is a missing tax rate for used parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}%.`
- );
- if (res) {
- estData.est_data.parts_tax_rates.PAL.prt_tax_rt =
- bodyshop.bill_tax_rates.state_tax_rate / 100;
- estData.est_data.parts_tax_rates.PAL.prt_tax_in = true;
- }
- }
+ await CheckTaxRates(estData, bodyshop);
//create upsert job
let supp = replaceEmpty({ ...estData.est_data });
@@ -432,3 +401,98 @@ function confirmDialog(msg) {
return confirmed ? resolve(true) : resolve(false);
});
}
+
+async function CheckTaxRates(estData, bodyshop) {
+ //LKQ Check
+ if (
+ !estData.est_data.parts_tax_rates?.PAL ||
+ estData.est_data.parts_tax_rates?.PAL?.prt_tax_rt === null ||
+ estData.est_data.parts_tax_rates?.PAL?.prt_tax_rt === 0
+ ) {
+ const res = await confirmDialog(
+ `ImEX Online has detected that there is a missing tax rate for LKQ parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
+ );
+ if (res) {
+ if (!estData.est_data.parts_tax_rates.PAL) {
+ estData.est_data.parts_tax_rates.PAL = {
+ prt_discp: 0,
+ prt_mktyp: true,
+ prt_mkupp: 0,
+ prt_type: "PAL",
+ };
+ }
+ estData.est_data.parts_tax_rates.PAL.prt_tax_rt =
+ bodyshop.bill_tax_rates.state_tax_rate / 100;
+ estData.est_data.parts_tax_rates.PAL.prt_tax_in = true;
+ }
+ }
+ //PAC Check
+ if (
+ !estData.est_data.parts_tax_rates?.PAC ||
+ estData.est_data.parts_tax_rates?.PAC?.prt_tax_rt === null ||
+ estData.est_data.parts_tax_rates?.PAC?.prt_tax_rt === 0
+ ) {
+ const res = await confirmDialog(
+ `ImEX Online has detected that there is a missing tax rate for rechromed parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
+ );
+ if (res) {
+ if (!estData.est_data.parts_tax_rates.PAC) {
+ estData.est_data.parts_tax_rates.PAC = {
+ prt_discp: 0,
+ prt_mktyp: true,
+ prt_mkupp: 0,
+ prt_type: "PAC",
+ };
+ }
+ estData.est_data.parts_tax_rates.PAC.prt_tax_rt =
+ bodyshop.bill_tax_rates.state_tax_rate / 100;
+ estData.est_data.parts_tax_rates.PAC.prt_tax_in = true;
+ }
+ }
+ //PAM Check
+ if (
+ !estData.est_data.parts_tax_rates?.PAM ||
+ estData.est_data.parts_tax_rates?.PAM?.prt_tax_rt === null ||
+ estData.est_data.parts_tax_rates?.PAM?.prt_tax_rt === 0
+ ) {
+ const res = await confirmDialog(
+ `ImEX Online has detected that there is a missing tax rate for remanufactured parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
+ );
+ if (res) {
+ if (!estData.est_data.parts_tax_rates.PAM) {
+ estData.est_data.parts_tax_rates.PAM = {
+ prt_discp: 0,
+ prt_mktyp: true,
+ prt_mkupp: 0,
+ prt_type: "PAM",
+ };
+ }
+ estData.est_data.parts_tax_rates.PAM.prt_tax_rt =
+ bodyshop.bill_tax_rates.state_tax_rate / 100;
+ estData.est_data.parts_tax_rates.PAM.prt_tax_in = true;
+ }
+ }
+
+ if (
+ !estData.est_data.parts_tax_rates?.PAR ||
+ estData.est_data.parts_tax_rates?.PAR?.prt_tax_rt === null ||
+ estData.est_data.parts_tax_rates?.PAR?.prt_tax_rt === 0
+ ) {
+ const res = await confirmDialog(
+ `ImEX Online has detected that there is a missing tax rate for recored parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
+ );
+ if (res) {
+ if (!estData.est_data.parts_tax_rates.PAR) {
+ estData.est_data.parts_tax_rates.PAR = {
+ prt_discp: 0,
+ prt_mktyp: true,
+ prt_mkupp: 0,
+ prt_type: "PAR",
+ };
+ }
+ estData.est_data.parts_tax_rates.PAR.prt_tax_rt =
+ bodyshop.bill_tax_rates.state_tax_rate / 100;
+ estData.est_data.parts_tax_rates.PAR.prt_tax_in = true;
+ }
+ }
+}
From 8e5005daa0c5f066d782d0b5e2e266cac6f4efce Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 7 Sep 2021 16:27:34 -0700
Subject: [PATCH 4/4] IO-1345 IO-43 Related Job linking
---
bodyshop_translations.babel | 21 ++++
.../jobs-detail-header.component.jsx | 6 +
.../jobs-related-ros.component.jsx | 112 ++++++++++++++++++
client/src/graphql/jobs.queries.js | 45 +++++++
client/src/translations/en_us/common.json | 3 +-
client/src/translations/es/common.json | 1 +
client/src/translations/fr/common.json | 1 +
.../down.yaml | 5 +
.../up.yaml | 31 +++++
.../down.yaml | 24 ++++
.../up.yaml | 40 +++++++
.../down.yaml | 7 ++
.../up.yaml | 7 ++
.../down.yaml | 7 ++
.../up.yaml | 7 ++
.../down.yaml | 7 ++
.../up.yaml | 7 ++
.../down.yaml | 7 ++
.../up.yaml | 7 ++
.../down.yaml | 6 +
.../up.yaml | 36 ++++++
.../down.yaml | 6 +
.../up.yaml | 37 ++++++
.../down.yaml | 6 +
.../up.yaml | 35 ++++++
.../down.yaml | 6 +
.../up.yaml | 28 +++++
27 files changed, 504 insertions(+), 1 deletion(-)
create mode 100644 client/src/components/jobs-related-ros/jobs-related-ros.component.jsx
create mode 100644 hasura/migrations/1631052192511_create_table_public_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631052192511_create_table_public_relatedjobs/up.yaml
create mode 100644 hasura/migrations/1631052229711_track_all_relationships/down.yaml
create mode 100644 hasura/migrations/1631052229711_track_all_relationships/up.yaml
create mode 100644 hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/up.yaml
create mode 100644 hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/up.yaml
create mode 100644 hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/down.yaml
create mode 100644 hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/up.yaml
create mode 100644 hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/down.yaml
create mode 100644 hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/up.yaml
create mode 100644 hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/up.yaml
create mode 100644 hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/up.yaml
create mode 100644 hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/up.yaml
create mode 100644 hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/down.yaml
create mode 100644 hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/up.yaml
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index 3e26652fd..4bb07a045 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -24800,6 +24800,27 @@
+
+ relatedros
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
returntotals
false
diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
index 8beebc60d..8f59adfb1 100644
--- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
+++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
@@ -15,6 +15,7 @@ import JobAltTransportChange from "../job-at-change/job-at-change.component";
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
import "./jobs-detail-header.styles.scss";
+import JobsRelatedRos from "../jobs-related-ros/jobs-related-ros.component";
const mapStateToProps = createStructuredSelector({
jobRO: selectJobReadOnly,
@@ -80,6 +81,11 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
/
{job.owner_owing}
+ {job.converted && (
+
+
+
+ )}
{job.alt_transport}
diff --git a/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx b/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx
new file mode 100644
index 000000000..a94d1a650
--- /dev/null
+++ b/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx
@@ -0,0 +1,112 @@
+import React, { useState } from "react";
+import { useQuery, useMutation } from "@apollo/client";
+import { Tag, Space, Button, Popover, Card, Form } from "antd";
+import {
+ DELETE_RELATED_RO,
+ INSERT_RELATED_ROS,
+ QUERY_RELATED_ROS,
+} from "../../graphql/jobs.queries";
+import LoadingSpinner from "../loading-spinner/loading-spinner.component";
+import AlertComponent from "../alert/alert.component";
+import { PlusCircleOutlined } from "@ant-design/icons";
+import JobSearchSelectComponent from "../job-search-select/job-search-select.component";
+import { useTranslation } from "react-i18next";
+import { Link } from "react-router-dom";
+
+export default function JobsRelatedRos({ jobid }) {
+ const [roSearchVisible, setRoSearchVisible] = useState(false);
+ const [saveLoading, setSaveLoading] = useState(false);
+ const [insertRelationship] = useMutation(INSERT_RELATED_ROS);
+ const [deleteRelationship] = useMutation(DELETE_RELATED_RO);
+ const { loading, error, data } = useQuery(QUERY_RELATED_ROS, {
+ variables: { jobid },
+ skip: !jobid,
+ });
+ const { t } = useTranslation();
+ if (loading) return ;
+ if (error) return ;
+
+ const relatedJobs = data.relatedjobs.map((r) => {
+ if (r.parentjob === jobid) {
+ return { relationshipid: r.id, ...r.childjob_rel };
+ }
+ return { relationshipid: r.id, ...r.parentjob_rel };
+ });
+
+ const handleAddRo = async ({ relatedjobid }) => {
+ setSaveLoading(true);
+
+ await insertRelationship({
+ variables: { relationship: { parentjob: jobid, childjob: relatedjobid } },
+ update(cache, { data }) {
+ cache.modify({
+ fields: {
+ relatedjobs(rj, { readField }) {
+ return [rj, data.insert_relatedjobs_one];
+ },
+ },
+ });
+ },
+ });
+ setSaveLoading(false);
+ setRoSearchVisible(false);
+ };
+ const handleDelete = async (id) => {
+ setSaveLoading(true);
+
+ await deleteRelationship({
+ variables: {
+ relationshipid: id,
+ },
+
+ update(cache, { data }) {
+ cache.modify({
+ fields: {
+ relatedjobs(rj, { readField }) {
+ return rj.filter((r) => r.id !== id);
+ },
+ },
+ });
+ },
+ });
+ setSaveLoading(false);
+ setRoSearchVisible(false);
+ };
+
+ const popContent = (
+
+
+
+
+
+
+
+
+
+
+ );
+
+ return (
+
+ {relatedJobs.map((r) => (
+ handleDelete(r.relationshipid)}>
+ {r.ro_number}
+
+ ))}
+
+
+
+
+ );
+}
diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js
index 068218506..4f957d051 100644
--- a/client/src/graphql/jobs.queries.js
+++ b/client/src/graphql/jobs.queries.js
@@ -1893,3 +1893,48 @@ export const QUERY_JOB_EXPORT_DMS = gql`
}
}
`;
+export const QUERY_RELATED_ROS = gql`
+ query QUERY_RELATED_ROS($jobid: uuid!) {
+ relatedjobs(
+ where: {
+ _or: [{ childjob: { _eq: $jobid } }, { parentjob: { _eq: $jobid } }]
+ }
+ ) {
+ parentjob
+ id
+ parentjob_rel {
+ id
+ ro_number
+ }
+ childjob
+ childjob_rel {
+ id
+ ro_number
+ }
+ }
+ }
+`;
+export const INSERT_RELATED_ROS = gql`
+ mutation INSERT_RELATED_ROS($relationship: relatedjobs_insert_input!) {
+ insert_relatedjobs_one(object: $relationship) {
+ parentjob
+ id
+ parentjob_rel {
+ id
+ ro_number
+ }
+ childjob
+ childjob_rel {
+ id
+ ro_number
+ }
+ }
+ }
+`;
+export const DELETE_RELATED_RO = gql`
+ mutation DELETE_RELATED_RO($relationshipid: uuid!) {
+ delete_relatedjobs_by_pk(id: $relationshipid) {
+ id
+ }
+ }
+`;
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index e774da4d5..532a1baa5 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -1033,7 +1033,7 @@
"PAP": "OEM Partial",
"PAR": "Recored",
"PAS": "Sublet",
- "PASL": "Sublet"
+ "PASL": "Sublet (L)"
},
"profitcenter_labor": "Profit Center: Labor",
"profitcenter_part": "Profit Center: Part",
@@ -1469,6 +1469,7 @@
"removedpartsstrikethrough": "Strike through lines represent parts that have been removed from the estimate. They are included for completeness of reconciliation."
},
"reconciliationheader": "Parts & Sublet Reconciliation",
+ "relatedros": "Related ROs",
"returntotals": "Return Totals",
"rosaletotal": "RO Parts Total",
"sale_labor": "Sales - Labor",
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 6022fc6ef..1dd2932ba 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -1469,6 +1469,7 @@
"removedpartsstrikethrough": ""
},
"reconciliationheader": "",
+ "relatedros": "",
"returntotals": "",
"rosaletotal": "",
"sale_labor": "",
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index 207262cc3..e1f87f3a3 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -1469,6 +1469,7 @@
"removedpartsstrikethrough": ""
},
"reconciliationheader": "",
+ "relatedros": "",
"returntotals": "",
"rosaletotal": "",
"sale_labor": "",
diff --git a/hasura/migrations/1631052192511_create_table_public_relatedjobs/down.yaml b/hasura/migrations/1631052192511_create_table_public_relatedjobs/down.yaml
new file mode 100644
index 000000000..dee738ebd
--- /dev/null
+++ b/hasura/migrations/1631052192511_create_table_public_relatedjobs/down.yaml
@@ -0,0 +1,5 @@
+- type: run_sql
+ args:
+ cascade: false
+ read_only: false
+ sql: DROP TABLE "public"."relatedjobs";
diff --git a/hasura/migrations/1631052192511_create_table_public_relatedjobs/up.yaml b/hasura/migrations/1631052192511_create_table_public_relatedjobs/up.yaml
new file mode 100644
index 000000000..9cbeaefc2
--- /dev/null
+++ b/hasura/migrations/1631052192511_create_table_public_relatedjobs/up.yaml
@@ -0,0 +1,31 @@
+- type: run_sql
+ args:
+ cascade: false
+ read_only: false
+ sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
+- type: run_sql
+ args:
+ cascade: false
+ read_only: false
+ sql: |-
+ CREATE TABLE "public"."relatedjobs"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "parentjob" uuid NOT NULL, "childjob" UUID NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("parentjob") REFERENCES "public"."jobs"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("childjob") REFERENCES "public"."jobs"("id") ON UPDATE cascade ON DELETE cascade, UNIQUE ("id"));
+ CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
+ RETURNS TRIGGER AS $$
+ DECLARE
+ _new record;
+ BEGIN
+ _new := NEW;
+ _new."updated_at" = NOW();
+ RETURN _new;
+ END;
+ $$ LANGUAGE plpgsql;
+ CREATE TRIGGER "set_public_relatedjobs_updated_at"
+ BEFORE UPDATE ON "public"."relatedjobs"
+ FOR EACH ROW
+ EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
+ COMMENT ON TRIGGER "set_public_relatedjobs_updated_at" ON "public"."relatedjobs"
+ IS 'trigger to set value of column "updated_at" to current timestamp on row update';
+- type: add_existing_table_or_view
+ args:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052229711_track_all_relationships/down.yaml b/hasura/migrations/1631052229711_track_all_relationships/down.yaml
new file mode 100644
index 000000000..fcfd5df33
--- /dev/null
+++ b/hasura/migrations/1631052229711_track_all_relationships/down.yaml
@@ -0,0 +1,24 @@
+- type: drop_relationship
+ args:
+ relationship: relatedjobs
+ table:
+ name: jobs
+ schema: public
+- type: drop_relationship
+ args:
+ relationship: relatedjobsByChildjob
+ table:
+ name: jobs
+ schema: public
+- type: drop_relationship
+ args:
+ relationship: job
+ table:
+ name: relatedjobs
+ schema: public
+- type: drop_relationship
+ args:
+ relationship: jobByChildjob
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052229711_track_all_relationships/up.yaml b/hasura/migrations/1631052229711_track_all_relationships/up.yaml
new file mode 100644
index 000000000..5a0f68607
--- /dev/null
+++ b/hasura/migrations/1631052229711_track_all_relationships/up.yaml
@@ -0,0 +1,40 @@
+- type: create_array_relationship
+ args:
+ name: relatedjobs
+ table:
+ name: jobs
+ schema: public
+ using:
+ foreign_key_constraint_on:
+ column: parentjob
+ table:
+ name: relatedjobs
+ schema: public
+- type: create_array_relationship
+ args:
+ name: relatedjobsByChildjob
+ table:
+ name: jobs
+ schema: public
+ using:
+ foreign_key_constraint_on:
+ column: childjob
+ table:
+ name: relatedjobs
+ schema: public
+- type: create_object_relationship
+ args:
+ name: job
+ table:
+ name: relatedjobs
+ schema: public
+ using:
+ foreign_key_constraint_on: parentjob
+- type: create_object_relationship
+ args:
+ name: jobByChildjob
+ table:
+ name: relatedjobs
+ schema: public
+ using:
+ foreign_key_constraint_on: childjob
diff --git a/hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/down.yaml b/hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/down.yaml
new file mode 100644
index 000000000..7c8d8f3df
--- /dev/null
+++ b/hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/down.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: parentjob_rel
+ new_name: job
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/up.yaml b/hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/up.yaml
new file mode 100644
index 000000000..5dfd63d0f
--- /dev/null
+++ b/hasura/migrations/1631052264437_rename_relationship_job_to_parentjob_rel_schema_public_table_relatedjobs/up.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: job
+ new_name: parentjob_rel
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/down.yaml b/hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/down.yaml
new file mode 100644
index 000000000..481e2317b
--- /dev/null
+++ b/hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/down.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: childjob_rel
+ new_name: jobByChildjob
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/up.yaml b/hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/up.yaml
new file mode 100644
index 000000000..66ef2fbee
--- /dev/null
+++ b/hasura/migrations/1631052277534_rename_relationship_jobByChildjob_to_childjob_rel_schema_public_table_relatedjobs/up.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: jobByChildjob
+ new_name: childjob_rel
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/down.yaml b/hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/down.yaml
new file mode 100644
index 000000000..da4b9a3e4
--- /dev/null
+++ b/hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/down.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: relatedjobs_parent
+ new_name: relatedjobs
+ table:
+ name: jobs
+ schema: public
diff --git a/hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/up.yaml b/hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/up.yaml
new file mode 100644
index 000000000..1ada027a9
--- /dev/null
+++ b/hasura/migrations/1631052341674_rename_relationship_relatedjobs_to_relatedjobs_parent_schema_public_table_jobs/up.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: relatedjobs
+ new_name: relatedjobs_parent
+ table:
+ name: jobs
+ schema: public
diff --git a/hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/down.yaml b/hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/down.yaml
new file mode 100644
index 000000000..02793be54
--- /dev/null
+++ b/hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/down.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: relatedjobs_child
+ new_name: relatedjobsByChildjob
+ table:
+ name: jobs
+ schema: public
diff --git a/hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/up.yaml b/hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/up.yaml
new file mode 100644
index 000000000..e1dca0def
--- /dev/null
+++ b/hasura/migrations/1631052355761_rename_relationship_relatedjobsByChildjob_to_relatedjobs_child_schema_public_table_jobs/up.yaml
@@ -0,0 +1,7 @@
+- type: rename_relationship
+ args:
+ name: relatedjobsByChildjob
+ new_name: relatedjobs_child
+ table:
+ name: jobs
+ schema: public
diff --git a/hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/down.yaml b/hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/down.yaml
new file mode 100644
index 000000000..4a387cccd
--- /dev/null
+++ b/hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/down.yaml
@@ -0,0 +1,6 @@
+- type: drop_insert_permission
+ args:
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/up.yaml b/hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/up.yaml
new file mode 100644
index 000000000..729bb888f
--- /dev/null
+++ b/hasura/migrations/1631052776515_update_permission_user_public_table_relatedjobs/up.yaml
@@ -0,0 +1,36 @@
+- type: create_insert_permission
+ args:
+ permission:
+ allow_upsert: true
+ backend_only: false
+ check:
+ _or:
+ - parentjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ - childjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ columns:
+ - id
+ - created_at
+ - updated_at
+ - parentjob
+ - childjob
+ set: {}
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/down.yaml b/hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/down.yaml
new file mode 100644
index 000000000..6a1d610c7
--- /dev/null
+++ b/hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/down.yaml
@@ -0,0 +1,6 @@
+- type: drop_select_permission
+ args:
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/up.yaml b/hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/up.yaml
new file mode 100644
index 000000000..12d5836f6
--- /dev/null
+++ b/hasura/migrations/1631052784531_update_permission_user_public_table_relatedjobs/up.yaml
@@ -0,0 +1,37 @@
+- type: create_select_permission
+ args:
+ permission:
+ allow_aggregations: false
+ backend_only: false
+ columns:
+ - created_at
+ - updated_at
+ - childjob
+ - id
+ - parentjob
+ computed_fields: []
+ filter:
+ _or:
+ - parentjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ - childjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ limit: null
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/down.yaml b/hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/down.yaml
new file mode 100644
index 000000000..1ac6dee97
--- /dev/null
+++ b/hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/down.yaml
@@ -0,0 +1,6 @@
+- type: drop_update_permission
+ args:
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/up.yaml b/hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/up.yaml
new file mode 100644
index 000000000..b638311d2
--- /dev/null
+++ b/hasura/migrations/1631052794082_update_permission_user_public_table_relatedjobs/up.yaml
@@ -0,0 +1,35 @@
+- type: create_update_permission
+ args:
+ permission:
+ backend_only: false
+ columns:
+ - created_at
+ - updated_at
+ - childjob
+ - id
+ - parentjob
+ filter:
+ _or:
+ - parentjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ - childjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ set: {}
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/down.yaml b/hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/down.yaml
new file mode 100644
index 000000000..a65b9a796
--- /dev/null
+++ b/hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/down.yaml
@@ -0,0 +1,6 @@
+- type: drop_delete_permission
+ args:
+ role: user
+ table:
+ name: relatedjobs
+ schema: public
diff --git a/hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/up.yaml b/hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/up.yaml
new file mode 100644
index 000000000..9d49b8d7c
--- /dev/null
+++ b/hasura/migrations/1631056626995_update_permission_user_public_table_relatedjobs/up.yaml
@@ -0,0 +1,28 @@
+- type: create_delete_permission
+ args:
+ permission:
+ backend_only: false
+ filter:
+ _or:
+ - parentjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ - childjob_rel:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
+ role: user
+ table:
+ name: relatedjobs
+ schema: public