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({ setPaymentContext({
actions: {}, actions: {},
context: { jobId: job.id }, context: { jobid: job.id },
}); });
}} }}
> >

View File

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

View File

@@ -8,7 +8,19 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateTimeFormatter } from "../../utils/DateFormatter"; import { DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters"; 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, refetch,
loading, loading,
payments, payments,
@@ -48,12 +60,12 @@ export default function PaymentsListPaginated({
return record.job.owner ? ( return record.job.owner ? (
<Link to={"/manage/owners/" + record.job.owner.id}> <Link to={"/manage/owners/" + record.job.owner.id}>
{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${ {`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${
record.job.ownr_co_nm record.job.ownr_co_nm || ""
}`} }`}
</Link> </Link>
) : ( ) : (
<span>{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${ <span>{`${record.job.ownr_fn || ""} ${record.job.ownr_ln || ""} ${
record.job.ownr_co_nm record.job.ownr_co_nm || ""
}`}</span> }`}</span>
); );
}, },
@@ -71,6 +83,11 @@ export default function PaymentsListPaginated({
dataIndex: "memo", dataIndex: "memo",
key: "memo", key: "memo",
}, },
{
title: t("payments.fields.payer"),
dataIndex: "payer",
key: "payer",
},
{ {
title: t("payments.fields.type"), title: t("payments.fields.type"),
dataIndex: "type", dataIndex: "type",
@@ -102,6 +119,26 @@ export default function PaymentsListPaginated({
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter> <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) => { const handleTableChange = (pagination, filters, sorter) => {
@@ -150,3 +187,8 @@ export default function PaymentsListPaginated({
</div> </div>
); );
} }
export default connect(
mapStateToProps,
mapDispatchToProps
)(PaymentsListPaginated);

View File

@@ -40,6 +40,7 @@ export const QUERY_ALL_PAYMENTS_PAGINATED = gql`
stripeid stripeid
exportedat exportedat
stripeid stripeid
payer
} }
search_payments_aggregate(args: { search: $search }) { search_payments_aggregate(args: { search: $search }) {
aggregate { aggregate {
@@ -69,6 +70,14 @@ export const UPDATE_PAYMENTS = gql`
returning { returning {
id id
exportedat exportedat
transactionid
memo
type
amount
stripeid
exportedat
stripeid
payer
} }
} }
} }