From 8bf389153592bf9959b7c6abd86e948a81b48076 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 10 May 2021 16:36:08 -0700 Subject: [PATCH] IO-1065 Add available jobs alert for closed jobs. --- bodyshop_translations.babel | 21 ++++ .../jobs-available-table.component.jsx | 97 +++++++++++++------ client/src/graphql/available-jobs.queries.js | 1 + client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 6 files changed, 94 insertions(+), 28 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index d658f5e37..fe2aab811 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -20222,6 +20222,27 @@ + + alreadyclosed + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + appointmentconfirmation false diff --git a/client/src/components/jobs-available-table/jobs-available-table.component.jsx b/client/src/components/jobs-available-table/jobs-available-table.component.jsx index 05291603a..e4eef2445 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.component.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.component.jsx @@ -5,7 +5,16 @@ import { SyncOutlined, } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { Button, Card, Input, notification, Space, Table } from "antd"; +import { + Alert, + Button, + Card, + Input, + notification, + Space, + Table, + Tag, +} from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; @@ -16,7 +25,23 @@ import { import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { TimeAgoFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; -export default function JobsAvailableComponent({ + +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect( + mapStateToProps, + mapDispatchToProps +)(JobsAvailableComponent); + +export function JobsAvailableComponent({ + bodyshop, loading, data, refetch, @@ -58,11 +83,11 @@ export default function JobsAvailableComponent({ render: (text, record) => record.job ? ( - {(record.job && record.job_ro_number) || t("general.labels.na")} + {(record.job && record.job.ro_number) || t("general.labels.na")} ) : (
- {(record.job && record.job_ro_number) || t("general.labels.na")} + {(record.job && record.job.ro_number) || t("general.labels.na")}
), }, @@ -132,31 +157,47 @@ export default function JobsAvailableComponent({ { title: t("general.labels.actions"), key: "actions", - render: (text, record) => ( - - - - - - ), + }} + > + + + {!isClosed && ( + <> + + + + )} + {isClosed && ( + + )} + + ); + }, }, ]; diff --git a/client/src/graphql/available-jobs.queries.js b/client/src/graphql/available-jobs.queries.js index e03f62f22..a6396e4e6 100644 --- a/client/src/graphql/available-jobs.queries.js +++ b/client/src/graphql/available-jobs.queries.js @@ -19,6 +19,7 @@ export const QUERY_AVAILABLE_JOBS = gql` job { id ro_number + status } } } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index e6f174aac..371c52990 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1214,6 +1214,7 @@ "adjustmentrate": "Adjustment Rate", "adjustments": "Adjustments", "allocations": "Allocations", + "alreadyclosed": "This job has already been closed.", "appointmentconfirmation": "Send confirmation to customer?", "associationwarning": "Any changes to associations will require updating the data from the new parent record to the job.", "audit": "Audit Trail", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 425d4265d..682501867 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1214,6 +1214,7 @@ "adjustmentrate": "", "adjustments": "", "allocations": "", + "alreadyclosed": "", "appointmentconfirmation": "¿Enviar confirmación al cliente?", "associationwarning": "", "audit": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 31dd7f96b..a9c15d48c 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1214,6 +1214,7 @@ "adjustmentrate": "", "adjustments": "", "allocations": "", + "alreadyclosed": "", "appointmentconfirmation": "Envoyer une confirmation au client?", "associationwarning": "", "audit": "",