Initial edits for payment editing IO-531

This commit is contained in:
Patrick Fic
2021-01-11 14:01:38 -08:00
parent 32cbe95d0b
commit 03e5d38c8a
4 changed files with 56 additions and 5 deletions

View File

@@ -112,7 +112,7 @@ export function JobsDetailHeaderActions({
setPaymentContext({
actions: {},
context: { jobId: job.id },
context: { jobid: job.id },
});
}}
>

View File

@@ -178,7 +178,7 @@ function BillEnterModalContainer({
autoComplete={"off"}
form={form}
layout="vertical"
initialValues={{ jobid: context.jobId }}
initialValues={context}
>
<PaymentForm form={form} stripeStateArr={stripeStateArr} />
</Form>

View File

@@ -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 ? (
<Link to={"/manage/owners/" + record.job.owner.id}>
{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${
record.job.ownr_co_nm
record.job.ownr_co_nm || ""
}`}
</Link>
) : (
<span>{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${
record.job.ownr_co_nm
record.job.ownr_co_nm || ""
}`}</span>
);
},
@@ -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({
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
render: (text, record) => (
<div>
<Button
disabled={record.exportedat}
onClick={() => {
setPaymentContext({
actions: { refetch: refetch },
context: { record },
});
}}
>
{t("general.actions.edit")}
</Button>
</div>
),
},
];
const handleTableChange = (pagination, filters, sorter) => {
@@ -150,3 +187,8 @@ export default function PaymentsListPaginated({
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(PaymentsListPaginated);

View File

@@ -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
}
}
}