From c45741257fd45c2f9f4300ad0db91d48d3fecb87 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 5 May 2023 12:16:39 -0700 Subject: [PATCH 1/3] Add export trigger for os_bills event. --- hasura/metadata/tables.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 01b43ad14..747c7c3ce 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -690,6 +690,7 @@ - vendorid - id - date + - exported retry_conf: interval_sec: 10 num_retries: 3 From de250b152aa26c8c178c88e1d85152b3916294d5 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 5 May 2023 12:20:25 -0700 Subject: [PATCH 2/3] Change all open search events to trigger on all fields. --- hasura/metadata/tables.yaml | 70 +++++++++++-------------------------- 1 file changed, 20 insertions(+), 50 deletions(-) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 747c7c3ce..b49797a78 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -682,20 +682,15 @@ insert: columns: '*' update: - columns: - - jobid - - invoice_number - - due_date - - exported_at - - vendorid - - id - - date - - exported + columns: '*' retry_conf: interval_sec: 10 num_retries: 3 timeout_sec: 60 webhook_from_env: HASURA_API_URL + headers: + - name: event-secret + value_from_env: EVENT_SECRET request_transform: method: POST query_params: {} @@ -4093,27 +4088,15 @@ insert: columns: '*' update: - columns: - - v_color - - ownerid - - ownr_fn - - v_model_desc - - ownr_ln - - id - - v_make_desc - - ownr_st - - clm_no - - voided - - status - - ownr_co_nm - - v_model_yr - - v_vin - - converted + columns: '*' retry_conf: interval_sec: 10 num_retries: 3 timeout_sec: 60 webhook_from_env: HASURA_API_URL + headers: + - name: event-secret + value_from_env: EVENT_SECRET request_transform: method: POST query_params: {} @@ -4553,17 +4536,15 @@ insert: columns: '*' update: - columns: - - shopid - - ownr_fn - - id - - ownr_co_nm - - ownr_ln + columns: '*' retry_conf: interval_sec: 10 num_retries: 3 timeout_sec: 60 webhook_from_env: HASURA_API_URL + headers: + - name: event-secret + value_from_env: EVENT_SECRET request_transform: method: POST query_params: {} @@ -5002,22 +4983,15 @@ insert: columns: '*' update: - columns: - - paymentnum - - exportedat - - type - - amount - - date - - transactionid - - memo - - payer - - id - - jobid + columns: '*' retry_conf: interval_sec: 10 num_retries: 3 timeout_sec: 60 webhook_from_env: HASURA_API_URL + headers: + - name: event-secret + value_from_env: EVENT_SECRET request_transform: method: POST query_params: {} @@ -5947,19 +5921,15 @@ insert: columns: '*' update: - columns: - - v_model_yr - - plate_no - - id - - v_vin - - v_model_desc - - plate_st - - shopid + columns: '*' retry_conf: interval_sec: 10 num_retries: 3 timeout_sec: 60 webhook_from_env: HASURA_API_URL + headers: + - name: event-secret + value_from_env: EVENT_SECRET request_transform: method: POST query_params: {} From a3557bbc86a78d08516f6d3d5bda463beb1896e6 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 5 May 2023 13:10:07 -0700 Subject: [PATCH 3/3] IO-2261 Add Delete function, Correct Payment edit, add Totals to Bills handler --- .../bill-delete-button.component.jsx | 4 ++- .../payment-list-paginated.component.jsx | 17 ++++++++-- client/src/graphql/payments.queries.js | 34 +++++++++++++++++++ .../src/pages/bills/bills.page.component.jsx | 10 +++++- os-loader.js | 1 + server/opensearch/os-handler.js | 2 ++ 6 files changed, 64 insertions(+), 4 deletions(-) diff --git a/client/src/components/bill-delete-button/bill-delete-button.component.jsx b/client/src/components/bill-delete-button/bill-delete-button.component.jsx index b6cb19992..5d2d154f6 100644 --- a/client/src/components/bill-delete-button/bill-delete-button.component.jsx +++ b/client/src/components/bill-delete-button/bill-delete-button.component.jsx @@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next"; import { DELETE_BILL } from "../../graphql/bills.queries"; import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component"; -export default function BillDeleteButton({ bill }) { +export default function BillDeleteButton({ bill, callback }) { const [loading, setLoading] = useState(false); const { t } = useTranslation(); const [deleteBill] = useMutation(DELETE_BILL); @@ -36,6 +36,8 @@ export default function BillDeleteButton({ bill }) { if (!!!result.errors) { notification["success"]({ message: t("bills.successes.deleted") }); + + if (callback && typeof callback === "function") callback(bill.id); } else { //Check if it's an fkey violation. const error = JSON.stringify(result.errors); diff --git a/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx b/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx index 718d056e8..d1d806b29 100644 --- a/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx +++ b/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx @@ -1,4 +1,5 @@ import { EditFilled, SyncOutlined } from "@ant-design/icons"; +import { useApolloClient } from "@apollo/client"; import { Button, Card, Input, Space, Table, Typography } from "antd"; import axios from "axios"; import queryString from "query-string"; @@ -7,6 +8,7 @@ import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link, useHistory, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; +import { QUERY_PAYMENT_BY_ID } from "../../graphql/payments.queries"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; @@ -43,6 +45,7 @@ export function PaymentsListPaginated({ const [openSearchResults, setOpenSearchResults] = useState([]); const [searchLoading, setSearchLoading] = useState(false); const { page, sortcolumn, sortorder } = search; + const client = useApolloClient(); const history = useHistory(); const [state, setState] = useState({ sortedInfo: {}, @@ -154,10 +157,20 @@ export function PaymentsListPaginated({ } - + { + //Filter out the state and set it again. + setOpenSearchResults((currentResults) => + currentResults.filter((bill) => bill.id !== deletedBillid) + ); + }} + /> {record.isinhouse && (