Date: Tue, 16 Mar 2021 12:27:07 -0700
Subject: [PATCH 4/9] IO-768 Update Backorder Parts ETA
---
.../parts-order-backorder-eta.component.jsx | 91 +++++++++++++++++++
.../parts-order-list-table.component.jsx | 11 ++-
client/src/graphql/parts-orders.queries.js | 18 ++++
3 files changed, 119 insertions(+), 1 deletion(-)
create mode 100644 client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx
diff --git a/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx b/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx
new file mode 100644
index 000000000..5df9127e9
--- /dev/null
+++ b/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx
@@ -0,0 +1,91 @@
+import { useMutation } from "@apollo/client";
+import { Button, Form, notification, Popover, Spin } from "antd";
+import React, { useState } from "react";
+import { useTranslation } from "react-i18next";
+import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
+import { logImEXEvent } from "../../firebase/firebase.utils";
+import { MUTATION_UPDATE_BO_ETA } from "../../graphql/parts-orders.queries";
+import { selectBodyshop } from "../../redux/user/user.selectors";
+import { DateFormatter } from "../../utils/DateFormatter";
+import FormDatePicker from "../form-date-picker/form-date-picker.component";
+import { CalendarFilled } from "@ant-design/icons";
+const mapStateToProps = createStructuredSelector({
+ bodyshop: selectBodyshop,
+});
+
+export function PartsOrderBackorderEta({
+ backordered_eta,
+ partsOrderStatus,
+ partsLineId,
+ jobLineId,
+ disabled,
+ bodyshop,
+}) {
+ const [visibility, setVisibility] = useState(false);
+ const [loading, setLoading] = useState(false);
+ const [updateBoDate] = useMutation(MUTATION_UPDATE_BO_ETA);
+ const { t } = useTranslation();
+ const [form] = Form.useForm();
+
+ const isAlreadyBackordered =
+ bodyshop.md_order_statuses.default_bo === partsOrderStatus;
+
+ const handleFinish = async (values) => {
+ setLoading(true);
+ logImEXEvent("job_parts_backorder_update_eta");
+
+ const result = await updateBoDate({
+ variables: {
+ partsLineId,
+ partsOrder: { backordered_eta: values.eta },
+ },
+ });
+
+ if (!!result.errors) {
+ notification["error"]({
+ message: t("parts_orders.errors.backordering", {
+ message: JSON.stringify(result.errors),
+ }),
+ });
+ }
+
+ setVisibility(false);
+ setLoading(false);
+ };
+
+ const handlePopover = (e) => {
+ setVisibility(true);
+ };
+
+ const popContent = (
+
+
+
+
+
+
+
+
+ );
+
+ return (
+
+ {backordered_eta}
+ {isAlreadyBackordered && (
+
+ )}
+ {loading && }
+
+ );
+}
+
+export default connect(mapStateToProps, null)(PartsOrderBackorderEta);
diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx
index 3cc442633..78552bb98 100644
--- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx
+++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx
@@ -14,6 +14,7 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import { TemplateList } from "../../utils/TemplateConstants";
+import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component";
import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
import PrintWrapper from "../print-wrapper/print-wrapper.component";
@@ -245,7 +246,15 @@ export function PartsOrderListTableComponent({
title: t("parts_orders.fields.backordered_eta"),
dataIndex: "backordered_eta",
key: "backordered_eta",
- render: (text, record) => {text},
+ render: (text, record) => (
+
+ ),
},
{
title: t("general.labels.actions"),
diff --git a/client/src/graphql/parts-orders.queries.js b/client/src/graphql/parts-orders.queries.js
index 65de1f573..3559b4bc7 100644
--- a/client/src/graphql/parts-orders.queries.js
+++ b/client/src/graphql/parts-orders.queries.js
@@ -10,6 +10,24 @@ export const INSERT_NEW_PARTS_ORDERS = gql`
}
`;
+export const MUTATION_UPDATE_BO_ETA = gql`
+ mutation MUTATION_UPDATE_BO_ETA(
+ $partsLineId: uuid!
+ $partsOrder: parts_order_lines_set_input
+ ) {
+ update_parts_order_lines(
+ where: { id: { _eq: $partsLineId } }
+ _set: $partsOrder
+ ) {
+ returning {
+ status
+ backordered_eta
+ id
+ }
+ }
+ }
+`;
+
export const MUTATION_BACKORDER_PART_LINE = gql`
mutation MUTATION_BACKORDER_PART_LINE(
$jobLineId: uuid!
From bf389e4dcbcaf24a1284d6b2705d3e904b41b844 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 16 Mar 2021 13:15:26 -0700
Subject: [PATCH 5/9] IO-771 Reassign documents between jobs.
---
.../jobs-document-gallery.reassign.component.jsx | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx
index 6d6a2f4a1..c2b7ff948 100644
--- a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx
+++ b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx
@@ -54,11 +54,20 @@ export default function JobsDocumentsGalleryReassign({ galleryImages }) {
const res = await axios.post("/media/rename", {
documents: selectedImages.map((i) => {
- return { id: i.id, from: i.key, to: i.key.replace("null", jobid) };
+ //Need to check if the current key folder is null, or another job.
+ const currentKeys = i.key.split("/");
+ currentKeys[1] = jobid;
+ currentKeys.join("/");
+ return { id: i.id, from: i.key, to: currentKeys.join("/") };
}),
});
- console.log(res.data);
+ res.data
+ .filter((d) => d.error)
+ .forEach((d) => {
+ notification["error"]({ message: t("documents.errors.updating") });
+ console.error("Error updating job document", d);
+ });
const proms = [];
From 441fdf1c624a38eb925d5ae682bf16cc1d7197a2 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 16 Mar 2021 13:32:11 -0700
Subject: [PATCH 6/9] IO-772 RBAC for RBAC Controls
---
client/src/components/rbac-wrapper/rbac-defaults.js | 2 +-
.../rbac-wrapper/rbac-wrapper.component.jsx | 12 ++++++++++--
.../shop-info/shop-info.rbac.component.jsx | 5 +++--
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/client/src/components/rbac-wrapper/rbac-defaults.js b/client/src/components/rbac-wrapper/rbac-defaults.js
index 7efcb53bd..0da32826f 100644
--- a/client/src/components/rbac-wrapper/rbac-defaults.js
+++ b/client/src/components/rbac-wrapper/rbac-defaults.js
@@ -48,7 +48,7 @@ const ret = {
"shiftclock:view": 2,
"shop:vendors": 2,
- "shop:rbac": 5,
+ "shop:rbac": 1,
"shop:templates": 4,
"temporarydocs:view": 2,
diff --git a/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx b/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx
index 81b5093c4..d9fb24870 100644
--- a/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx
+++ b/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx
@@ -28,10 +28,18 @@ function RbacWrapper({
...restProps
}) {
const { t } = useTranslation();
+
+ console.log(
+ "********object :>> ",
+ action,
+ rbacDefaults[action],
+ bodyshop.md_rbac[action]
+ );
if (
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
- (bodyshop.md_rbac && bodyshop.md_rbac[action] <= authLevel) ||
- (!!!bodyshop.md_rbac && rbacDefaults[action] <= authLevel)
+ ((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <=
+ authLevel ||
+ (!bodyshop.md_rbac && rbacDefaults[action] <= authLevel)
)
return {React.cloneElement(children, restProps)}
;
diff --git a/client/src/components/shop-info/shop-info.rbac.component.jsx b/client/src/components/shop-info/shop-info.rbac.component.jsx
index d47634888..daa189843 100644
--- a/client/src/components/shop-info/shop-info.rbac.component.jsx
+++ b/client/src/components/shop-info/shop-info.rbac.component.jsx
@@ -2,11 +2,12 @@ import { Form, InputNumber } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
+import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
export default function ShopInfoRbacComponent({ form }) {
const { t } = useTranslation();
return (
-
+
-
+
);
}
From c659e25142812dcfe97c082239271633c70c12d1 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 16 Mar 2021 14:04:55 -0700
Subject: [PATCH 7/9] IO-769 Label change for CC.
---
client/src/translations/en_us/common.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index b2898eb9d..17dca9d16 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -559,8 +559,8 @@
"plate": "Plate Number",
"purchasedate": "Purchase Date",
"registrationexpires": "Registration Expires On",
- "serviceenddate": "Service End Date",
- "servicestartdate": "Service Start Date",
+ "serviceenddate": "Usage End Date",
+ "servicestartdate": "Usage Start Date",
"status": "Status",
"vin": "VIN",
"year": "Year"
From bda4db3ed5352c3eac344dfbd3a1eab540ea9a07 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 16 Mar 2021 14:29:05 -0700
Subject: [PATCH 8/9] IO-779 Added shop sub status and blockers.
---
bodyshop_translations.babel | 26 ++
.../jira-support-widget.component.jsx | 2 +-
.../rbac-wrapper/rbac-wrapper.component.jsx | 6 -
.../shop-sub-status.component.jsx | 33 ++
client/src/graphql/bodyshop.queries.js | 2 +
.../pages/manage/manage.page.component.jsx | 420 ++++++++----------
.../pages/manage/manage.page.container.jsx | 11 +-
client/src/translations/en_us/common.json | 3 +
client/src/translations/es/common.json | 3 +
client/src/translations/fr/common.json | 3 +
.../down.yaml | 5 +
.../up.yaml | 6 +
.../down.yaml | 78 ++++
.../up.yaml | 79 ++++
hasura/migrations/metadata.yaml | 1 +
15 files changed, 435 insertions(+), 243 deletions(-)
create mode 100644 client/src/components/shop-sub-status/shop-sub-status.component.jsx
create mode 100644 hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/down.yaml
create mode 100644 hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/up.yaml
create mode 100644 hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/down.yaml
create mode 100644 hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/up.yaml
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index b2195fade..3d67ca6d0 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -11882,6 +11882,32 @@