From 9d4f98d3ee5213656ed87b7ce9fea544fd8de1fd Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 2 Jun 2021 09:07:29 -0700
Subject: [PATCH] IO-1167 Resolve sorting on payments table.
---
.../accounting-payments-table.component.jsx | 2 +-
.../job-payments/job-payments.component.jsx | 18 +++++++++---------
client/src/graphql/jobs.queries.js | 1 +
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
index f2a72dd92..94ca9e50b 100644
--- a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
+++ b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
@@ -54,7 +54,7 @@ export default function AccountingPayablesTableComponent({
ellipsis: true,
sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln),
sortOrder:
- state.sortedInfo.columnKey === "ownr_ln" && state.sortedInfo.order,
+ state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
render: (text, record) => {
return record.job.owner ? (
diff --git a/client/src/components/job-payments/job-payments.component.jsx b/client/src/components/job-payments/job-payments.component.jsx
index eae8bc76e..fd2558492 100644
--- a/client/src/components/job-payments/job-payments.component.jsx
+++ b/client/src/components/job-payments/job-payments.component.jsx
@@ -8,8 +8,8 @@ import { selectJobReadOnly } from "../../redux/application/application.selectors
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
-import { DateTimeFormatter } from "../../utils/DateFormatter";
-import { alphaSort } from "../../utils/sorters";
+import { DateFormatter } from "../../utils/DateFormatter";
+import { alphaSort, dateSort } from "../../utils/sorters";
import { TemplateList } from "../../utils/TemplateConstants";
import DataLabel from "../data-label/data-label.component";
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
@@ -40,14 +40,14 @@ export function JobPayments({
});
const columns = [
{
- title: t("payments.fields.created_at"),
- dataIndex: "created_at",
- key: "created_at",
+ title: t("payments.fields.date"),
+ dataIndex: "date",
+ key: "date",
+ sorter: (a, b) => dateSort(a.date, b.date),
+
sortOrder:
- state.sortedInfo.columnKey === "created_at" && state.sortedInfo.order,
- render: (text, record) => (
- {record.created_at}
- ),
+ state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
+ render: (text, record) => {record.date},
},
{
title: t("payments.fields.payer"),
diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js
index 0ae54a202..62ba766cb 100644
--- a/client/src/graphql/jobs.queries.js
+++ b/client/src/graphql/jobs.queries.js
@@ -565,6 +565,7 @@ export const GET_JOB_BY_PK = gql`
stripeid
transactionid
memo
+ date
}
cccontracts {
id