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], + }} + />