diff --git a/client/src/components/job-costing-modal/job-costing-modal.component.jsx b/client/src/components/job-costing-modal/job-costing-modal.component.jsx
index e109524b4..a811e69ec 100644
--- a/client/src/components/job-costing-modal/job-costing-modal.component.jsx
+++ b/client/src/components/job-costing-modal/job-costing-modal.component.jsx
@@ -8,7 +8,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
import JobCostingPartsTable from "../job-costing-parts-table/job-costing-parts-table.component";
import JobCostingStatistics from "../job-costing-statistics/job-costing-statistics.component";
import JobCostingPie from "./job-costing-modal.pie.component";
-
+import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
@@ -18,6 +18,11 @@ const mapDispatchToProps = (dispatch) => ({
export function JobCostingModalComponent({ bodyshop, job }) {
const defaultProfits = bodyshop.md_responsibility_centers.defaults.profits;
+ const allProfitCenters = _.union(
+ bodyshop.md_responsibility_centers.profits.map((p) => p.name),
+ bodyshop.md_responsibility_centers.costs.map((p) => p.name)
+ );
+
// const defaultCosts = bodyshop.md_responsibility_centers.defaults.costs;
const { t } = useTranslation();
const jobLineTotalsByProfitCenter =
@@ -71,6 +76,7 @@ export function JobCostingModalComponent({ bodyshop, job }) {
.multiply(line_val.quantity)
.multiply(bill_val.is_credit_memo ? -1 : 1)
);
+
return null;
});
return bill_acc;
@@ -107,8 +113,8 @@ export function JobCostingModalComponent({ bodyshop, job }) {
gppercentFormatted: null,
};
- const costCenterData = Object.keys(defaultProfits).map((key, idx) => {
- const ccVal = defaultProfits[key];
+ const costCenterData = allProfitCenters.map((key, idx) => {
+ const ccVal = key; // defaultProfits[key];
const sale_labor =
jobLineTotalsByProfitCenter.labor[ccVal] || Dinero({ amount: 0 });
const sale_parts =
@@ -178,7 +184,11 @@ export function JobCostingModalComponent({ bodyshop, job }) {
return (
-
+
diff --git a/client/src/components/job-costing-modal/job-costing-modal.container.jsx b/client/src/components/job-costing-modal/job-costing-modal.container.jsx
index 8420f4836..3fc964397 100644
--- a/client/src/components/job-costing-modal/job-costing-modal.container.jsx
+++ b/client/src/components/job-costing-modal/job-costing-modal.container.jsx
@@ -37,7 +37,9 @@ export function JobCostingModalContainer({
toggleModalVisible()}
onCancel={() => toggleModalVisible()}
+ cancelButtonProps={{ style: { display: "none" } }}
width="90%"
destroyOnClose
>
diff --git a/client/src/components/job-costing-modal/job-costing-modal.pie.component.jsx b/client/src/components/job-costing-modal/job-costing-modal.pie.component.jsx
index 8215e5eb1..d4dbe2c30 100644
--- a/client/src/components/job-costing-modal/job-costing-modal.pie.component.jsx
+++ b/client/src/components/job-costing-modal/job-costing-modal.pie.component.jsx
@@ -44,8 +44,6 @@ export default function JobCostingPieComponent({
Calculatedata,
]);
- console.log(type, memoizedData);
-
return (
diff --git a/client/src/components/job-costing-parts-table/job-costing-parts-table.component.jsx b/client/src/components/job-costing-parts-table/job-costing-parts-table.component.jsx
index 894c427f5..11bd71dbf 100644
--- a/client/src/components/job-costing-parts-table/job-costing-parts-table.component.jsx
+++ b/client/src/components/job-costing-parts-table/job-costing-parts-table.component.jsx
@@ -1,9 +1,10 @@
-import { Table } from "antd";
+import { Input, Table, Typography } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { alphaSort } from "../../utils/sorters";
-export default function JobCostingPartsTable({ job, data }) {
+export default function JobCostingPartsTable({ job, data, summaryData }) {
+ const [searchText, setSearchText] = useState("");
const [state, setState] = useState({
sortedInfo: {},
});
@@ -59,16 +60,61 @@ export default function JobCostingPartsTable({ job, data }) {
},
];
+ const filteredData =
+ searchText === ""
+ ? data
+ : data.filter((d) =>
+ (d.cost_center || "")
+ .toString()
+ .toLowerCase()
+ .includes(searchText.toLowerCase())
+ );
+
return (
{
+ return (
+
+
+ {
+ e.preventDefault();
+ setSearchText(e.target.value);
+ }}
+ />
+
+
+ );
+ }}
scroll={{ x: "50%", y: "40rem" }}
onChange={handleTableChange}
pagination={{ position: "top", defaultPageSize: 25 }}
columns={columns}
rowKey="id"
- dataSource={data}
+ dataSource={filteredData}
+ summary={() => (
+
+
+
+ {t("general.labels.totals")}
+
+
+
+ {summaryData.totalSales.toFormat()}
+
+
+ {summaryData.totalCost.toFormat()}
+
+
+ {summaryData.gpdollars.toFormat()}
+
+
+
+ )}
/>
);
diff --git a/client/src/components/report-center-modal/report-center-modal.component.jsx b/client/src/components/report-center-modal/report-center-modal.component.jsx
index 59a6333c7..e4d5badef 100644
--- a/client/src/components/report-center-modal/report-center-modal.component.jsx
+++ b/client/src/components/report-center-modal/report-center-modal.component.jsx
@@ -37,13 +37,6 @@ export default function ReportCenterModalComponent({ context }) {
autoComplete={"off"}
layout="vertical"
form={form}
- initialValues={{
- to: [
- "allan.carr@thinkimex.com",
- "allanlcarr@outlook.com",
- "allanlcarr@icloud.com",
- ],
- }}
>
toggleModalVisible()}
+ onCancel={() => toggleModalVisible()}
cancelButtonProps={{ style: { display: "none" } }}
destroyOnClose
>