From 15cdcdfbeaea39a2500f19849e40e8bd803ba09c Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 26 Apr 2022 15:25:51 -0700 Subject: [PATCH] IO-1846 add prior succesful export indicator. --- bodyshop_translations.babel | 21 ++++++++++++++++ .../accounting-payables-table.component.jsx | 9 +++---- .../accounting-payments-table.component.jsx | 9 +++---- ...accounting-receivables-table.component.jsx | 10 +++----- .../export-logs-count-display.component.jsx | 25 +++++++++++++++++++ client/src/translations/en_us/common.json | 3 ++- client/src/translations/es/common.json | 3 ++- client/src/translations/fr/common.json | 3 ++- 8 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 client/src/components/export-logs-count-display/export-logs-count-display.component.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index b656493ff..a7de63bcb 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -14493,6 +14493,27 @@ + + priorsuccesfulexport + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + diff --git a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx index 8b017991a..ed3a7b24c 100644 --- a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx +++ b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx @@ -13,6 +13,7 @@ import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -131,11 +132,9 @@ export function AccountingPayablesTableComponent({ bodyshop, loading, bills }) { dataIndex: "attempts", key: "attempts", - render: (text, record) => { - const success = record.exportlogs.filter((e) => e.successful).length; - const attempts = record.exportlogs.length; - return `${success}/${attempts}`; - }, + render: (text, record) => ( + + ), }, { title: t("general.labels.actions"), diff --git a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx index 30ac03db3..3a8c0c6b4 100644 --- a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx +++ b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx @@ -13,6 +13,7 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; +import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -130,11 +131,9 @@ export function AccountingPayablesTableComponent({ dataIndex: "attempts", key: "attempts", - render: (text, record) => { - const success = record.exportlogs.filter((e) => e.successful).length; - const attempts = record.exportlogs.length; - return `${success}/${attempts}`; - }, + render: (text, record) => ( + + ), }, { title: t("general.labels.actions"), diff --git a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx index d49edecf7..d954448d4 100644 --- a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx +++ b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx @@ -14,6 +14,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component"; import { DateFormatter } from "../../utils/DateFormatter"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; +import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -139,12 +140,9 @@ export function AccountingReceivablesTableComponent({ title: t("exportlogs.labels.attempts"), dataIndex: "attempts", key: "attempts", - - render: (text, record) => { - const success = record.exportlogs.filter((e) => e.successful).length; - const attempts = record.exportlogs.length; - return `${success}/${attempts}`; - }, + render: (text, record) => ( + + ), }, { title: t("general.labels.actions"), diff --git a/client/src/components/export-logs-count-display/export-logs-count-display.component.jsx b/client/src/components/export-logs-count-display/export-logs-count-display.component.jsx new file mode 100644 index 000000000..d0ad34dc5 --- /dev/null +++ b/client/src/components/export-logs-count-display/export-logs-count-display.component.jsx @@ -0,0 +1,25 @@ +import React from "react"; +import { WarningOutlined } from "@ant-design/icons"; +import { Space, Tooltip } from "antd"; +import { useTranslation } from "react-i18next"; + +const style = { + fontWeight: "bold", + color: "green", +}; + +export default function ExportLogsCountDisplay({ logs }) { + const success = logs.filter((e) => e.successful).length; + const attempts = logs.length; + const { t } = useTranslation(); + return ( + 0 ? style : {}}> + {`${success}/${attempts}`} + {success > 0 && ( + + + + )} + + ); +} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 046bd7ed6..c57cb7cdb 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -912,7 +912,8 @@ "createdat": "Created At" }, "labels": { - "attempts": "Export Attempts" + "attempts": "Export Attempts", + "priorsuccesfulexport": "This record has previously been exported successfully. Please make sure it has already been deleted in the target system." } }, "general": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 7626cd174..ac51a720e 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -912,7 +912,8 @@ "createdat": "" }, "labels": { - "attempts": "" + "attempts": "", + "priorsuccesfulexport": "" } }, "general": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 61eca129d..945381bdd 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -912,7 +912,8 @@ "createdat": "" }, "labels": { - "attempts": "" + "attempts": "", + "priorsuccesfulexport": "" } }, "general": {