From 1218deeee7de37010e80f4ebe906a6055ef8d4c1 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 28 Dec 2021 10:06:01 -0800
Subject: [PATCH] IO-1600 Number of rental days on contract list.
---
bodyshop_translations.babel | 21 +++++++++++++++++++
.../contracts-list.component.jsx | 18 +++++++++++++++-
client/src/translations/en_us/common.json | 1 +
client/src/translations/es/common.json | 1 +
client/src/translations/fr/common.json | 1 +
5 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index 7b94abb2f..26a1ba3c7 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -10011,6 +10011,27 @@
+
+ length
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
localtax
false
diff --git a/client/src/components/contracts-list/contracts-list.component.jsx b/client/src/components/contracts-list/contracts-list.component.jsx
index abec9b362..063b0dbb9 100644
--- a/client/src/components/contracts-list/contracts-list.component.jsx
+++ b/client/src/components/contracts-list/contracts-list.component.jsx
@@ -11,6 +11,7 @@ import { setModalContext } from "../../redux/modals/modals.actions";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
+import moment from "moment";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
});
@@ -86,7 +87,9 @@ export function ContractsList({
} ${record.courtesycar.make} ${record.courtesycar.model}${
record.courtesycar.plate ? ` (${record.courtesycar.plate})` : ""
}${
- record.courtesycar.fleetnumber ? ` (${record.courtesycar.fleetnumber})` : ""
+ record.courtesycar.fleetnumber
+ ? ` (${record.courtesycar.fleetnumber})`
+ : ""
}`}
),
},
@@ -133,6 +136,19 @@ export function ContractsList({
{record.actualreturn}
),
},
+ {
+ title: t("contracts.fields.length"),
+ dataIndex: "length",
+ key: "length",
+
+ render: (text, record) =>
+ (record.actualreturn &&
+ record.start &&
+ `${moment(record.actualreturn)
+ .diff(moment(record.start), "days", true)
+ .toFixed(1)} days`) ||
+ "",
+ },
];
const handleTableChange = (pagination, filters, sorter) => {
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index ebc0678b2..25037e5dd 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -615,6 +615,7 @@
"fuelout": "Fuel Out",
"kmend": "Mileage End",
"kmstart": "Mileage Start",
+ "length": "Length",
"localtax": "Local Taxes",
"refuelcharge": "Refuel Charge (per liter/gallon)",
"scheduledreturn": "Scheduled Return",
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index fc29e23dd..2d10ef26e 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -615,6 +615,7 @@
"fuelout": "",
"kmend": "",
"kmstart": "",
+ "length": "",
"localtax": "",
"refuelcharge": "",
"scheduledreturn": "",
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index eed65ac94..b909b2740 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -615,6 +615,7 @@
"fuelout": "",
"kmend": "",
"kmstart": "",
+ "length": "",
"localtax": "",
"refuelcharge": "",
"scheduledreturn": "",