From 7d9fd06b6d3de6ebed7dc238165c573f3228598c Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 13 Aug 2021 15:08:44 -0700
Subject: [PATCH] IO-233 CDK Get Makes & Taxes calculation.
---
.../dms-allocations-summary.component.jsx | 3 +
.../dms-cdk-makes/dms-cdk-makes.component.jsx | 96 ++++++++++++++++---
...p-info.responsibilitycenters.component.jsx | 57 +++++++++++
client/src/redux/dms/dms.actions.js | 6 --
client/src/redux/dms/dms.reducer.js | 20 ----
client/src/redux/dms/dms.sagas.js | 14 ---
client/src/redux/dms/dms.selectors.js | 8 --
client/src/redux/dms/dms.types.js | 4 -
server/cdk/cdk-calculate-allocations.js | 85 ++++++++++++----
server/cdk/cdk-get-makes.js | 36 ++++---
server/cdk/cdk-job-export.js | 6 +-
server/cdk/cdk-wsdl.js | 1 +
server/graphql-client/queries.js | 1 +
server/web-sockets/web-socket.js | 12 ++-
14 files changed, 240 insertions(+), 109 deletions(-)
delete mode 100644 client/src/redux/dms/dms.actions.js
delete mode 100644 client/src/redux/dms/dms.reducer.js
delete mode 100644 client/src/redux/dms/dms.sagas.js
delete mode 100644 client/src/redux/dms/dms.selectors.js
delete mode 100644 client/src/redux/dms/dms.types.js
diff --git a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx
index 65b9434b6..79ba67527 100644
--- a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx
+++ b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
+import Dinero from "dinero.js";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -29,11 +30,13 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId }) {
title: t("jobs.fields.dms.sale"),
dataIndex: "sale",
key: "sale",
+ render: (text, record) => Dinero(record.sale).toFormat(),
},
{
title: t("jobs.fields.dms.cost"),
dataIndex: "cost",
key: "cost",
+ render: (text, record) => Dinero(record.cost).toFormat(),
},
{
title: t("jobs.fields.dms.sale_dms_acctnumber"),
diff --git a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx
index 27be85602..c972178b1 100644
--- a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx
+++ b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx
@@ -1,8 +1,10 @@
import React, { useState } from "react";
-import { Modal, Button, Table } from "antd";
+import { Modal, Button, Table, Input } from "antd";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
+import { useTranslation } from "react-i18next";
+
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -14,26 +16,96 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakes);
export function DmsCdkMakes({ bodyshop, form, socket }) {
const [makesList, setMakesList] = useState([]);
+ const [searchText, setSearchText] = useState("");
const [loading, setLoading] = useState(false);
const [visible, setVisible] = useState(false);
+ const [selectedModel, setSelectedModel] = useState(null);
+ const { t } = useTranslation();
+ const columns = [
+ {
+ title: t("jobs.fields.dms.makeFullName"),
+ dataIndex: "makeFullName",
+ key: "makeFullName",
+ },
+ {
+ title: t("jobs.fields.dms.modelFullName"),
+ dataIndex: "modelFullName",
+ key: "modelFullName",
+ },
+ {
+ title: t("jobs.fields.dms.makeCode"),
+ dataIndex: "makeCode",
+ key: "makeCode",
+ },
+ {
+ title: t("jobs.fields.dms.modelCode"),
+ dataIndex: "modelCode",
+ key: "modelCode",
+ },
+ ];
+
+ const filteredMakes =
+ searchText !== "" && searchText
+ ? makesList.filter(
+ (make) =>
+ searchText
+ .split(" ")
+ .some((v) =>
+ make.makeFullName.toLowerCase().includes(v.toLowerCase())
+ ) ||
+ searchText
+ .split(" ")
+ .some((v) =>
+ make.modelFullName.toLowerCase().includes(v.toLowerCase())
+ )
+ )
+ : makesList;
+
return (
-
setVisible(false)}>
- {JSON.stringify(makesList, null, 2)}
-
+ setVisible(false)}>
+ (
+ setSearchText(val)}
+ placeholder={t("general.labels.search")}
+ />
+ )}
+ columns={columns}
+ loading={loading}
+ id="id"
+ dataSource={filteredMakes}
+ onRow={(record) => {
+ return {
+ onClick: setSelectedModel(record),
+ };
+ }}
+ rowSelection={{
+ onSelect: (record, selected, ...props) => {
+ console.log(
+ "🚀 ~ file: dms-cdk-makes.component.jsx ~ line 85 ~ record, selected, ...props",
+ record,
+ selected,
+ ...props
+ );
+
+ setSelectedModel(record);
+ },
+
+ type: "radio",
+ selectedRowKeys: [selectedModel && selectedModel.id],
+ }}
+ />