From 03e5d38c8ac7cd660e5c26fff2d1e40c604715a4 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Mon, 11 Jan 2021 14:01:38 -0800
Subject: [PATCH] Initial edits for payment editing IO-531
---
.../jobs-detail-header-actions.component.jsx | 2 +-
.../payment-modal/payment-modal.container.jsx | 2 +-
.../payment-list-paginated.component.jsx | 48 +++++++++++++++++--
client/src/graphql/payments.queries.js | 9 ++++
4 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
index 4f5fb01ec..ae4522639 100644
--- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
+++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
@@ -112,7 +112,7 @@ export function JobsDetailHeaderActions({
setPaymentContext({
actions: {},
- context: { jobId: job.id },
+ context: { jobid: job.id },
});
}}
>
diff --git a/client/src/components/payment-modal/payment-modal.container.jsx b/client/src/components/payment-modal/payment-modal.container.jsx
index 64f936693..1456b1230 100644
--- a/client/src/components/payment-modal/payment-modal.container.jsx
+++ b/client/src/components/payment-modal/payment-modal.container.jsx
@@ -178,7 +178,7 @@ function BillEnterModalContainer({
autoComplete={"off"}
form={form}
layout="vertical"
- initialValues={{ jobid: context.jobId }}
+ initialValues={context}
>
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 61ed0ee25..8e192e972 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
@@ -8,7 +8,19 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
-export default function PaymentsListPaginated({
+import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
+import { setModalContext } from "../../redux/modals/modals.actions";
+const mapStateToProps = createStructuredSelector({
+ //currentUser: selectCurrentUser
+});
+const mapDispatchToProps = (dispatch) => ({
+ setPaymentContext: (context) =>
+ dispatch(setModalContext({ context: context, modal: "payment" })),
+});
+
+export function PaymentsListPaginated({
+ setPaymentContext,
refetch,
loading,
payments,
@@ -48,12 +60,12 @@ export default function PaymentsListPaginated({
return record.job.owner ? (
{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${
- record.job.ownr_co_nm
+ record.job.ownr_co_nm || ""
}`}
) : (
{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${
- record.job.ownr_co_nm
+ record.job.ownr_co_nm || ""
}`}
);
},
@@ -71,6 +83,11 @@ export default function PaymentsListPaginated({
dataIndex: "memo",
key: "memo",
},
+ {
+ title: t("payments.fields.payer"),
+ dataIndex: "payer",
+ key: "payer",
+ },
{
title: t("payments.fields.type"),
dataIndex: "type",
@@ -102,6 +119,26 @@ export default function PaymentsListPaginated({
{record.exportedat}
),
},
+ {
+ title: t("general.labels.actions"),
+ dataIndex: "actions",
+ key: "actions",
+ render: (text, record) => (
+
+
+
+ ),
+ },
];
const handleTableChange = (pagination, filters, sorter) => {
@@ -150,3 +187,8 @@ export default function PaymentsListPaginated({
);
}
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(PaymentsListPaginated);
diff --git a/client/src/graphql/payments.queries.js b/client/src/graphql/payments.queries.js
index 3eef2922b..6d8d0a00d 100644
--- a/client/src/graphql/payments.queries.js
+++ b/client/src/graphql/payments.queries.js
@@ -40,6 +40,7 @@ export const QUERY_ALL_PAYMENTS_PAGINATED = gql`
stripeid
exportedat
stripeid
+ payer
}
search_payments_aggregate(args: { search: $search }) {
aggregate {
@@ -69,6 +70,14 @@ export const UPDATE_PAYMENTS = gql`
returning {
id
exportedat
+ transactionid
+ memo
+ type
+ amount
+ stripeid
+ exportedat
+ stripeid
+ payer
}
}
}