Merge branch 'feature/cdk-cert' into feature/qbo
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
import { Button, Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { Button, Table, Typography } from "antd";
|
||||
import React, { useState, useEffect } from "react";
|
||||
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";
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
@@ -20,6 +24,15 @@ export default connect(
|
||||
export function DmsAllocationsSummary({ socket, bodyshop, jobId }) {
|
||||
const { t } = useTranslation();
|
||||
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (socket.connected) {
|
||||
socket.emit("cdk-calculate-allocations", jobId, (ack) =>
|
||||
setAllocationsSummary(ack)
|
||||
);
|
||||
}
|
||||
}, [socket, socket.connected, jobId]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.dms.center"),
|
||||
@@ -71,13 +84,45 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId }) {
|
||||
);
|
||||
}}
|
||||
>
|
||||
Get
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
)}
|
||||
pagination={{ position: "top", defaultPageSize: 50 }}
|
||||
columns={columns}
|
||||
rowKey="center"
|
||||
dataSource={allocationsSummary}
|
||||
summary={() => {
|
||||
const totals = allocationsSummary.reduce(
|
||||
(acc, val) => {
|
||||
return {
|
||||
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||
};
|
||||
},
|
||||
{
|
||||
totalSale: Dinero(),
|
||||
totalCost: Dinero(),
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<Table.Summary.Row>
|
||||
<Table.Summary.Cell>
|
||||
<Typography.Title level={4}>
|
||||
{t("general.labels.totals")}
|
||||
</Typography.Title>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals.totalSale.toFormat()}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals.totalCost.toFormat()}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell></Table.Summary.Cell>
|
||||
<Table.Summary.Cell></Table.Summary.Cell>
|
||||
</Table.Summary.Row>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useLazyQuery } from "@apollo/client";
|
||||
import { SEARCH_DMS_VEHICLES } from "../../graphql/dms.queries";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -12,83 +15,75 @@ const mapStateToProps = createStructuredSelector({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakes);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkVehicles);
|
||||
|
||||
export function DmsCdkMakes({ bodyshop, form, socket }) {
|
||||
const [makesList, setMakesList] = useState([]);
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
export function DmsCdkVehicles({ bodyshop, form, socket, job }) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [selectedModel, setSelectedModel] = useState(null);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [callSearch, { loading, error, data }] =
|
||||
useLazyQuery(SEARCH_DMS_VEHICLES);
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.dms.makeFullName"),
|
||||
dataIndex: "makeFullName",
|
||||
key: "makeFullName",
|
||||
title: t("jobs.fields.dms.make"),
|
||||
dataIndex: "make",
|
||||
key: "make",
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.modelFullName"),
|
||||
dataIndex: "modelFullName",
|
||||
key: "modelFullName",
|
||||
title: t("jobs.fields.dms.model"),
|
||||
dataIndex: "model",
|
||||
key: "model",
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.makeCode"),
|
||||
dataIndex: "makeCode",
|
||||
key: "makeCode",
|
||||
title: t("jobs.fields.dms.makecode"),
|
||||
dataIndex: "makecode",
|
||||
key: "makecode",
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.modelCode"),
|
||||
dataIndex: "modelCode",
|
||||
key: "modelCode",
|
||||
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;
|
||||
|
||||
console.log(
|
||||
"🚀 ~ file: dms-cdk-makes.component.jsx ~ line 95 ~ selectedModel",
|
||||
selectedModel
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
<Modal width={"90%"} visible={visible} onCancel={() => setVisible(false)}>
|
||||
<Modal
|
||||
width={"90%"}
|
||||
visible={visible}
|
||||
onCancel={() => setVisible(false)}
|
||||
onOk={() => {
|
||||
form.setFieldsValue({
|
||||
dms_make: selectedModel.makecode,
|
||||
dms_model: selectedModel.modelcode,
|
||||
});
|
||||
setVisible(false);
|
||||
}}
|
||||
>
|
||||
{error && <AlertComponent error={error.message} />}
|
||||
<Table
|
||||
title={() => (
|
||||
<Input.Search
|
||||
onSearch={(val) => setSearchText(val)}
|
||||
onSearch={(val) => callSearch({ variables: { search: val } })}
|
||||
placeholder={t("general.labels.search")}
|
||||
/>
|
||||
)}
|
||||
columns={columns}
|
||||
loading={loading}
|
||||
id="id"
|
||||
dataSource={filteredMakes}
|
||||
rowKey="id"
|
||||
dataSource={data ? data.search_dms_vehicles : []}
|
||||
onRow={(record) => {
|
||||
return {
|
||||
onClick: setSelectedModel(record),
|
||||
onClick: () => setSelectedModel(record),
|
||||
};
|
||||
}}
|
||||
rowSelection={{
|
||||
onSelect: (record, selected, ...props) => {
|
||||
console.log(
|
||||
"🚀 ~ file: dms-cdk-makes.component.jsx ~ line 85 ~ record, selected, ...props",
|
||||
record,
|
||||
selected,
|
||||
...props
|
||||
);
|
||||
|
||||
onSelect: (record) => {
|
||||
setSelectedModel(record);
|
||||
},
|
||||
|
||||
@@ -100,15 +95,14 @@ export function DmsCdkMakes({ bodyshop, form, socket }) {
|
||||
<Button
|
||||
onClick={() => {
|
||||
setVisible(true);
|
||||
setLoading(true);
|
||||
socket.emit("cdk-get-makes", bodyshop.cdk_dealerid, (makes) => {
|
||||
console.log("Called back", makes);
|
||||
setMakesList(makes);
|
||||
setLoading(false);
|
||||
callSearch({
|
||||
variables: {
|
||||
search: job && job.v_model_desc && job.v_model_desc.substr(0, 3),
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
Get Makes
|
||||
{t("jobs.actions.dms.getmakes")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Button } from "antd";
|
||||
import axios from "axios";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakesRefetch);
|
||||
|
||||
export function DmsCdkMakesRefetch({ bodyshop, form, socket }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const handleRefetch = async () => {
|
||||
setLoading(true);
|
||||
const response = await axios.post("/cdk/getvehicles", {
|
||||
cdk_dealerid: bodyshop.cdk_dealerid,
|
||||
bodyshopid: bodyshop.id,
|
||||
});
|
||||
console.log(response);
|
||||
setLoading(false);
|
||||
};
|
||||
return (
|
||||
<Button loading={loading} onClick={handleRefetch}>
|
||||
Refetch Models
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,24 @@
|
||||
import { Button, Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { socket } from "../../pages/dms/dms.container";
|
||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
export default function DmsCustomerSelector() {
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(DmsCustomerSelector);
|
||||
|
||||
export function DmsCustomerSelector({ bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const [customerList, setcustomerList] = useState([]);
|
||||
const [visible, setVisible] = useState(false);
|
||||
@@ -15,11 +29,24 @@ export default function DmsCustomerSelector() {
|
||||
setcustomerList(customerList);
|
||||
});
|
||||
|
||||
const onOk = () => {
|
||||
const onUseSelected = () => {
|
||||
setVisible(false);
|
||||
socket.emit("cdk-selected-customer", selectedCustomer);
|
||||
};
|
||||
|
||||
const onUseGeneric = () => {
|
||||
setVisible(false);
|
||||
socket.emit(
|
||||
"cdk-selected-customer",
|
||||
bodyshop.cdk_configuration.generic_customer_number
|
||||
);
|
||||
};
|
||||
|
||||
const onCreateNew = () => {
|
||||
setVisible(false);
|
||||
socket.emit("cdk-selected-customer", null);
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("dms.fields.name1"),
|
||||
@@ -27,28 +54,13 @@ export default function DmsCustomerSelector() {
|
||||
key: "name1",
|
||||
sorter: (a, b) => alphaSort(a.name1?.fullName, b.name1?.fullName),
|
||||
},
|
||||
{
|
||||
title: t("dms.fields.name2"),
|
||||
dataIndex: ["name2", "fullName"],
|
||||
key: "name2",
|
||||
sorter: (a, b) => alphaSort(a.name2?.fullName, b.name2?.fullName),
|
||||
},
|
||||
{
|
||||
title: t("dms.fields.phone"),
|
||||
dataIndex: ["contactInfo", "mainTelephoneNumber", "value"],
|
||||
key: "phone",
|
||||
render: (record, value) => (
|
||||
<PhoneFormatter>
|
||||
{record.contactInfo?.mainTelephoneNumber?.value}
|
||||
</PhoneFormatter>
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
title: t("dms.fields.address"),
|
||||
//dataIndex: ["name2", "fullName"],
|
||||
key: "address",
|
||||
render: (record, value) =>
|
||||
`${record.address?.addressLine[0]}, ${record.address?.city} ${record.address?.stateOrProvince} ${record.address?.postalCode}`,
|
||||
`${record?.address?.addressLine[0]}, ${record.address?.city} ${record.address?.stateOrProvince} ${record.address?.postalCode}`,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -57,7 +69,23 @@ export default function DmsCustomerSelector() {
|
||||
<Table
|
||||
title={() => (
|
||||
<div>
|
||||
<Button onClick={onOk}>Select</Button>
|
||||
<Button onClick={onUseSelected} disabled={!selectedCustomer}>
|
||||
{t("jobs.actions.dms.useselected")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={onUseGeneric}
|
||||
disabled={
|
||||
!(
|
||||
bodyshop.cdk_configuration &&
|
||||
bodyshop.cdk_configuration.generic_customer_number
|
||||
)
|
||||
}
|
||||
>
|
||||
{t("jobs.actions.dms.usegeneric")}
|
||||
</Button>
|
||||
<Button onClick={onCreateNew}>
|
||||
{t("jobs.actions.dms.createnewcustomer")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
pagination={{ position: "top" }}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { Button, Form, Input } from "antd";
|
||||
import {
|
||||
Button,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Select,
|
||||
Space,
|
||||
Statistic,
|
||||
} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -8,7 +16,9 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
import Dinero from "dinero.js";
|
||||
import { determineDmsType } from "../../pages/dms/dms.container";
|
||||
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
@@ -17,11 +27,38 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
|
||||
|
||||
export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
export function DmsPostForm({ bodyshop, socket, job }) {
|
||||
const [form] = Form.useForm();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handlePayerSelect = (value, index) => {
|
||||
form.setFieldsValue({
|
||||
payers: form.getFieldValue("payers").map((payer, mapIndex) => {
|
||||
if (index !== mapIndex) return payer;
|
||||
const cdkPayer =
|
||||
bodyshop.cdk_configuration.payers &&
|
||||
bodyshop.cdk_configuration.payers.find((i) => i.name === value);
|
||||
|
||||
if (!cdkPayer) return payer;
|
||||
|
||||
return {
|
||||
...cdkPayer,
|
||||
dms_acctnumber: cdkPayer.dms_acctnumber,
|
||||
controlnumber: job && job[cdkPayer.control_type],
|
||||
};
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
const handleFinish = (values) => {
|
||||
socket.emit(`${determineDmsType(bodyshop)}-export-job`, {
|
||||
jobid: job.id,
|
||||
txEnvelope: values,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} layout="vertical">
|
||||
<Form form={form} layout="vertical" onFinish={handleFinish}>
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
name="journal"
|
||||
@@ -40,15 +77,41 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="dms_make"
|
||||
label={t("jobs.fields.dms.dms_make")}
|
||||
name="story"
|
||||
label={t("jobs.fields.dms.story")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Input.TextArea />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="kmin"
|
||||
label={t("jobs.fields.kmin")}
|
||||
initialValue={job && job.kmin}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber disabled />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="kmout"
|
||||
label={t("jobs.fields.kmout")}
|
||||
initialValue={job && job.kmout}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber disabled />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="dms_make"
|
||||
@@ -59,9 +122,21 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Input disabled />
|
||||
</Form.Item>
|
||||
<DmsCdkMakes form={form} socket={socket} />
|
||||
<Form.Item
|
||||
name="dms_model"
|
||||
label={t("jobs.fields.dms.dms_model")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input disabled />
|
||||
</Form.Item>
|
||||
<DmsCdkMakes form={form} socket={socket} job={job} />
|
||||
<DmsCdkMakesRefetch />
|
||||
</LayoutFormRow>
|
||||
|
||||
<Form.List name={["payers"]}>
|
||||
@@ -81,20 +156,30 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Select
|
||||
onSelect={(value) => handlePayerSelect(value, index)}
|
||||
>
|
||||
{bodyshop.cdk_configuration &&
|
||||
bodyshop.cdk_configuration.payers &&
|
||||
bodyshop.cdk_configuration.payers.map((payer) => (
|
||||
<Select.Option key={payer.name}>
|
||||
{payer.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("jobs.fields.dms.payer.account")}
|
||||
key={`${index}account`}
|
||||
name={[field.name, "account"]}
|
||||
label={t("jobs.fields.dms.payer.dms_acctnumber")}
|
||||
key={`${index}dms_acctnumber`}
|
||||
name={[field.name, "dms_acctnumber"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Input disabled />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
@@ -107,8 +192,9 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<CurrencyInput />
|
||||
<CurrencyInput min={0} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("jobs.fields.dms.payer.controlnumber")}
|
||||
key={`${index}controlnumber`}
|
||||
@@ -122,6 +208,27 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
const payers = form.getFieldValue("payers");
|
||||
|
||||
const row = payers && payers[index];
|
||||
|
||||
const cdkPayer =
|
||||
bodyshop.cdk_configuration.payers &&
|
||||
bodyshop.cdk_configuration.payers.find(
|
||||
(i) => i && row && i.name === row.name
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{cdkPayer &&
|
||||
t(`jobs.fields.${cdkPayer.control_type}`)}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
@@ -133,18 +240,69 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
disabled={!(fields.length < 3)}
|
||||
onClick={() => {
|
||||
add();
|
||||
if (fields.length < 3) add();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{t("general.actions.add")}
|
||||
{t("dms.actions.addpayer")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
//Perform Calculation to determine discrepancy.
|
||||
let totalAllocated = Dinero();
|
||||
|
||||
const payers = form.getFieldValue("payers");
|
||||
payers &&
|
||||
payers.forEach((payer) => {
|
||||
totalAllocated = totalAllocated.add(
|
||||
Dinero({ amount: Math.round((payer?.amount || 0) * 100) })
|
||||
);
|
||||
});
|
||||
const discrep = Dinero(job.job_totals.totals.total_repairs).subtract(
|
||||
totalAllocated
|
||||
);
|
||||
return (
|
||||
<Space>
|
||||
<Statistic
|
||||
title={t("jobs.labels.dms.totalallocated")}
|
||||
value={totalAllocated.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("jobs.fields.subtotal")}
|
||||
value={Dinero(job.job_totals.totals.total_repairs).toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("jobs.labels.dms.notallocated")}
|
||||
valueStyle={{
|
||||
color: discrep.getAmount() === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrep.toFormat()}
|
||||
/>
|
||||
<Button //disabled={discrep.getAmount() !== 0} //TODO: REMOVE THIS COMMENT.
|
||||
htmlType="submit"
|
||||
>
|
||||
{t("jobs.actions.dms.post")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
socket.emit(`${determineDmsType(bodyshop)}-export-job`, {
|
||||
jobid: job.id,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Bypass
|
||||
</Button>
|
||||
</Space>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user