Compare commits
104 Commits
release/20
...
release/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ef8ef5f2f | ||
|
|
f41277c081 | ||
|
|
7f15e9ef7a | ||
|
|
6d3fc783d6 | ||
|
|
0052a54915 | ||
|
|
375856bd68 | ||
|
|
cf4f6f6e55 | ||
|
|
173e9a278c | ||
|
|
35ab86c5fd | ||
|
|
932c89f8f9 | ||
|
|
ddd5ce4bf0 | ||
|
|
1d0e526466 | ||
|
|
73e2b2d65d | ||
|
|
88bc8d4d05 | ||
|
|
53cecd68f0 | ||
|
|
4bce6d996e | ||
|
|
83b51384c7 | ||
|
|
f5e20b7041 | ||
|
|
8d1988d4ad | ||
|
|
cd071500cf | ||
|
|
09a0309108 | ||
|
|
65d93b8f9b | ||
|
|
b147d4c2ed | ||
|
|
0c8c303d08 | ||
|
|
b19120af3d | ||
|
|
d83e2ace2e | ||
|
|
468227b7b9 | ||
|
|
021098fa2a | ||
|
|
49f5668e89 | ||
|
|
9b444a130b | ||
|
|
25fd90f881 | ||
|
|
aa61aa6702 | ||
|
|
a8b1537cd6 | ||
|
|
2c702da1fd | ||
|
|
cb48ea64f9 | ||
|
|
c17e1e92aa | ||
|
|
b546d90c9e | ||
|
|
3985293cee | ||
|
|
4bd3b851ef | ||
|
|
bef76491d7 | ||
|
|
4f3090c3bd | ||
|
|
f71a4b7c83 | ||
|
|
7ddd29ca27 | ||
|
|
ab607e9919 | ||
|
|
5511dd44ce | ||
|
|
d6a84b8b7f | ||
|
|
c962d848c1 | ||
|
|
febcff3383 | ||
|
|
61090aa04c | ||
|
|
e0f75fa357 | ||
|
|
9aa85b3ab5 | ||
|
|
4704fd9ce1 | ||
|
|
a0f06ffdc2 | ||
|
|
c4eed109e9 | ||
|
|
7d9eb737ec | ||
|
|
6fbf954dc2 | ||
|
|
968da48399 | ||
|
|
83906ea788 | ||
|
|
83255cd316 | ||
|
|
1966e91463 | ||
|
|
413400fa71 | ||
|
|
abf9d0b7f4 | ||
|
|
4deed41a12 | ||
|
|
4a7eb9b373 | ||
|
|
bf81c6dd06 | ||
|
|
7a89781a20 | ||
|
|
34ae2c56b7 | ||
|
|
e2941bfe84 | ||
|
|
821b044515 | ||
|
|
933e0a62fb | ||
|
|
25bc343027 | ||
|
|
77727cc4b1 | ||
|
|
002301c792 | ||
|
|
7ee544b013 | ||
|
|
3bc1785351 | ||
|
|
1f58ee7d67 | ||
|
|
5ec1e84671 | ||
|
|
d9fa00e633 | ||
|
|
53a55c2b6e | ||
|
|
5fe8a15a8c | ||
|
|
70cfbf2f5b | ||
|
|
5e6ab55159 | ||
|
|
2aa6fdfac5 | ||
|
|
8acd51c4f1 | ||
|
|
e1d5558dac | ||
|
|
061212f915 | ||
|
|
14bb735f00 | ||
|
|
9714371a36 | ||
|
|
c7c5feeabe | ||
|
|
1c2a64cf50 | ||
|
|
7d4d97ce4e | ||
|
|
1d70053459 | ||
|
|
675ccff3ce | ||
|
|
25b236072e | ||
|
|
b22318015e | ||
|
|
ddb7d8915e | ||
|
|
bca8ce0898 | ||
|
|
4fff9a5c99 | ||
|
|
e98e3049d8 | ||
|
|
456b00a605 | ||
|
|
cc078df80d | ||
|
|
80582692cf | ||
|
|
1bb0cbaebc | ||
|
|
a20a01dbd1 |
@@ -10,7 +10,7 @@ npx hasura migrate apply --endpoint https://db.imex.online/ --admin-secret 'Prod
|
||||
npx hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret 'Test-ImEXOnlineBySnaptSoftware!'
|
||||
|
||||
NGROK TEsting:
|
||||
./ngrok.exe http http://localhost:5000 -host-header="localhost:5000"
|
||||
./ngrok.exe http http://localhost:4000 -host-header="localhost:4000"
|
||||
|
||||
Finding deadfiles - run from client directory
|
||||
npx deadfile ./src/index.js --exclude build templates
|
||||
|
||||
@@ -25448,6 +25448,27 @@
|
||||
<folder_node>
|
||||
<name>dms</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>damageto</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>defaultstory</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -25469,6 +25490,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>invoicedatefuture</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>kmoutnotgreaterthankmin</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -37146,6 +37188,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>estimates_written_converted</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>estimator_detail</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -38007,6 +38070,48 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>production_by_category</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>production_by_category_one</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>production_by_csr</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -38133,6 +38238,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>production_by_technician_one</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>purchases_by_cost_center_detail</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -40135,6 +40261,53 @@
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>validation</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>clockoffmustbeafterclockon</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>clockoffwithoutclockon</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
|
||||
@@ -2,7 +2,6 @@ import { ApolloProvider } from "@apollo/client";
|
||||
import { SplitFactory, SplitSdk } from "@splitsoftware/splitio-react";
|
||||
import { ConfigProvider } from "antd";
|
||||
import enLocale from "antd/es/locale/en_US";
|
||||
import LogRocket from "logrocket";
|
||||
import moment from "moment";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -10,13 +9,8 @@ import GlobalLoadingBar from "../components/global-loading-bar/global-loading-ba
|
||||
import client from "../utils/GraphQLClient";
|
||||
import App from "./App";
|
||||
|
||||
|
||||
moment.locale("en-US");
|
||||
|
||||
|
||||
//tracker.start();
|
||||
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
|
||||
|
||||
export const factory = SplitSdk({
|
||||
core: {
|
||||
authorizationKey: process.env.REACT_APP_SPLIT_API,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Button, Result } from "antd";
|
||||
import LogRocket from "logrocket";
|
||||
import React, { lazy, Suspense, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -9,15 +11,18 @@ import ErrorBoundary from "../components/error-boundary/error-boundary.component
|
||||
//Component Imports
|
||||
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
|
||||
import DisclaimerPage from "../pages/disclaimer/disclaimer.page";
|
||||
import LandingPage from "../pages/landing/landing.page";
|
||||
import TechPageContainer from "../pages/tech/tech.page.container";
|
||||
import { setOnline } from "../redux/application/application.actions";
|
||||
import { selectOnline } from "../redux/application/application.selectors";
|
||||
import { checkUserSession } from "../redux/user/user.actions";
|
||||
import { selectCurrentUser } from "../redux/user/user.selectors";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../redux/user/user.selectors";
|
||||
import PrivateRoute from "../utils/private-route";
|
||||
import "./App.styles.scss";
|
||||
|
||||
import LandingPage from "../pages/landing/landing.page";
|
||||
const ResetPassword = lazy(() =>
|
||||
import("../pages/reset-password/reset-password.component")
|
||||
);
|
||||
@@ -32,13 +37,26 @@ const MobilePaymentContainer = lazy(() =>
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
online: selectOnline,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
checkUserSession: () => dispatch(checkUserSession()),
|
||||
setOnline: (isOnline) => dispatch(setOnline(isOnline)),
|
||||
});
|
||||
|
||||
export function App({ checkUserSession, currentUser, online, setOnline }) {
|
||||
export function App({
|
||||
bodyshop,
|
||||
checkUserSession,
|
||||
currentUser,
|
||||
online,
|
||||
setOnline,
|
||||
}) {
|
||||
const { LogRocket_Tracking } = useTreatments(
|
||||
["LogRocket_Tracking"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!navigator.onLine) {
|
||||
setOnline(false);
|
||||
@@ -59,6 +77,16 @@ export function App({ checkUserSession, currentUser, online, setOnline }) {
|
||||
window.addEventListener("online", function (e) {
|
||||
setOnline(true);
|
||||
});
|
||||
useEffect(() => {
|
||||
if (currentUser.authorized) {
|
||||
if (
|
||||
process.env.NODE_ENV === "production" &&
|
||||
LogRocket_Tracking.treatment === "on"
|
||||
) {
|
||||
LogRocket.init("gvfvfw/bodyshopapp");
|
||||
}
|
||||
}
|
||||
}, [currentUser.authorized, LogRocket_Tracking.treatment]);
|
||||
|
||||
if (currentUser.authorized === null) {
|
||||
return <LoadingSpinner message={t("general.labels.loggingin")} />;
|
||||
|
||||
@@ -91,13 +91,13 @@
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.production-completion-1 {
|
||||
animation: production-completion-1-blinker 5s linear infinite;
|
||||
.production-completion-soon {
|
||||
color: rgba(255, 140, 0, 0.8);
|
||||
font-weight: bold;
|
||||
}
|
||||
@keyframes production-completion-1-blinker {
|
||||
50% {
|
||||
background: rgba(207, 12, 12, 0.555);
|
||||
}
|
||||
.production-completion-past {
|
||||
color: rgba(255, 0, 0, 0.8);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.react-resizable {
|
||||
|
||||
@@ -245,7 +245,7 @@ function BillEnterModalContainer({
|
||||
return (
|
||||
<Modal
|
||||
title={t("bills.labels.new")}
|
||||
width={"90%"}
|
||||
width={"98%"}
|
||||
visible={billEnterModal.visible}
|
||||
okText={t("general.actions.save")}
|
||||
keyboard="false"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DeleteFilled, WarningOutlined } from "@ant-design/icons";
|
||||
import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons";
|
||||
import {
|
||||
Button,
|
||||
Form,
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
Space,
|
||||
Switch,
|
||||
Table,
|
||||
Tooltip
|
||||
} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -43,7 +44,7 @@ export function BillEnterModalLinesComponent({
|
||||
title: t("billlines.fields.jobline"),
|
||||
dataIndex: "joblineid",
|
||||
editable: true,
|
||||
|
||||
width: "20rem",
|
||||
formItemProps: (field) => {
|
||||
return {
|
||||
key: `${field.index}joblinename`,
|
||||
@@ -57,11 +58,24 @@ export function BillEnterModalLinesComponent({
|
||||
],
|
||||
};
|
||||
},
|
||||
wrapper: (props) => (
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, cur) =>
|
||||
prev.is_credit_memo !== cur.is_credit_memo
|
||||
}
|
||||
>
|
||||
{() => {
|
||||
return props.children;
|
||||
}}
|
||||
</Form.Item>
|
||||
),
|
||||
formInput: (record, index) => (
|
||||
<BillLineSearchSelect
|
||||
disabled={disabled}
|
||||
options={lineData}
|
||||
style={{ width: "100%", minWidth: "10rem" }}
|
||||
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
||||
onSelect={(value, opt) => {
|
||||
setFieldsValue({
|
||||
billlines: getFieldsValue(["billlines"]).billlines.map(
|
||||
@@ -201,23 +215,58 @@ export function BillEnterModalLinesComponent({
|
||||
};
|
||||
},
|
||||
formInput: (record, index) => (
|
||||
<CurrencyInput min={0} disabled={disabled} />
|
||||
<CurrencyInput
|
||||
min={0}
|
||||
disabled={disabled}
|
||||
controls={false}
|
||||
addonAfter={
|
||||
<Form.Item shouldUpdate noStyle>
|
||||
{() => {
|
||||
const line = getFieldsValue(["billlines"]).billlines[index];
|
||||
if (!!!line) return null;
|
||||
let lineDiscount = 1 - line.actual_cost / line.actual_price;
|
||||
if (isNaN(lineDiscount)) lineDiscount = 0;
|
||||
return (
|
||||
<Tooltip title={`${(lineDiscount * 100).toFixed(2) || 0}%`}>
|
||||
<DollarCircleFilled
|
||||
style={{
|
||||
color:
|
||||
Math.abs(lineDiscount - discount) > 0.005
|
||||
? lineDiscount > discount
|
||||
? "orange"
|
||||
: "red"
|
||||
: "green",
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
}
|
||||
/>
|
||||
),
|
||||
additional: (record, index) => (
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
const line = getFieldsValue(["billlines"]).billlines[index];
|
||||
if (!!!line) return null;
|
||||
const lineDiscount = (
|
||||
1 -
|
||||
Math.round((line.actual_cost / line.actual_price) * 100) / 100
|
||||
).toPrecision(2);
|
||||
// additional: (record, index) => (
|
||||
// <Form.Item shouldUpdate>
|
||||
// {() => {
|
||||
// const line = getFieldsValue(["billlines"]).billlines[index];
|
||||
// if (!!!line) return null;
|
||||
// const lineDiscount = (
|
||||
// 1 -
|
||||
// Math.round((line.actual_cost / line.actual_price) * 100) / 100
|
||||
// ).toPrecision(2);
|
||||
|
||||
if (lineDiscount - discount === 0) return <div />;
|
||||
return <WarningOutlined style={{ color: "red" }} />;
|
||||
}}
|
||||
</Form.Item>
|
||||
),
|
||||
// return (
|
||||
// <Tooltip title={`${(lineDiscount * 100).toFixed(0) || 0}%`}>
|
||||
// <DollarCircleFilled
|
||||
// style={{
|
||||
// color: lineDiscount - discount !== 0 ? "red" : "green",
|
||||
// }}
|
||||
// />
|
||||
// </Tooltip>
|
||||
// );
|
||||
// }}
|
||||
// </Form.Item>
|
||||
// ),
|
||||
},
|
||||
{
|
||||
title: t("billlines.fields.cost_center"),
|
||||
@@ -285,6 +334,19 @@ export function BillEnterModalLinesComponent({
|
||||
additional: (record, index) => (
|
||||
<Form.Item shouldUpdate style={{ display: "inline-block" }}>
|
||||
{() => {
|
||||
const price = getFieldValue([
|
||||
"billlines",
|
||||
record.name,
|
||||
"actual_price",
|
||||
]);
|
||||
|
||||
const adjustmentRate = getFieldValue([
|
||||
"billlines",
|
||||
record.name,
|
||||
"lbr_adjustment",
|
||||
"rate",
|
||||
]);
|
||||
|
||||
if (getFieldValue(["billlines", record.name, "deductedfromlbr"]))
|
||||
return (
|
||||
<div>
|
||||
@@ -357,6 +419,9 @@ export function BillEnterModalLinesComponent({
|
||||
>
|
||||
<InputNumber precision={2} min={0.01} />
|
||||
</Form.Item>
|
||||
{price &&
|
||||
adjustmentRate &&
|
||||
`${(price / adjustmentRate).toFixed(1)} hrs`}
|
||||
</div>
|
||||
);
|
||||
return <></>;
|
||||
@@ -488,6 +553,7 @@ const EditableCell = ({
|
||||
formInput,
|
||||
formItemProps,
|
||||
additional,
|
||||
wrapper,
|
||||
...restProps
|
||||
}) => {
|
||||
if (additional)
|
||||
@@ -505,7 +571,20 @@ const EditableCell = ({
|
||||
</Space>
|
||||
</td>
|
||||
);
|
||||
|
||||
if (wrapper)
|
||||
return (
|
||||
<wrapper>
|
||||
<td {...restProps}>
|
||||
<Form.Item
|
||||
labelCol={{ span: 0 }}
|
||||
name={dataIndex}
|
||||
{...(formItemProps && formItemProps(record))}
|
||||
>
|
||||
{(formInput && formInput(record, record.name)) || children}
|
||||
</Form.Item>
|
||||
</td>
|
||||
</wrapper>
|
||||
);
|
||||
return (
|
||||
<td {...restProps}>
|
||||
<Form.Item
|
||||
|
||||
@@ -4,7 +4,10 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
//To be used as a form element only.
|
||||
const { Option } = Select;
|
||||
const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
|
||||
const BillLineSearchSelect = (
|
||||
{ options, disabled, allowRemoved, ...restProps },
|
||||
ref
|
||||
) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
@@ -12,6 +15,7 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
showSearch
|
||||
dropdownMatchSelectWidth={false}
|
||||
// optionFilterProp="line_desc"
|
||||
filterOption={(inputValue, option) => {
|
||||
return (
|
||||
@@ -36,7 +40,7 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
|
||||
{options
|
||||
? options.map((item) => (
|
||||
<Option
|
||||
disabled={item.removed}
|
||||
disabled={allowRemoved ? false : item.removed}
|
||||
key={item.id}
|
||||
value={item.id}
|
||||
cost={item.act_price ? item.act_price : 0}
|
||||
@@ -49,9 +53,14 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
|
||||
...(item.removed ? { textDecoration: "line-through" } : {}),
|
||||
}}
|
||||
>
|
||||
{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
||||
<span>{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
||||
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
||||
}${item.act_price ? ` - $${item.act_price}` : ``}`}
|
||||
}`}</span>
|
||||
<span style={{ float: "right", paddingleft: "1rem" }}>
|
||||
{item.act_price
|
||||
? `$${item.act_price && item.act_price.toFixed(2)}`
|
||||
: ``}
|
||||
</span>
|
||||
</Option>
|
||||
))
|
||||
: null}
|
||||
|
||||
@@ -58,7 +58,8 @@ export function BillsListTableComponent({
|
||||
disabled={
|
||||
record.is_credit_memo || record.vendorid === bodyshop.inhousevendorid
|
||||
}
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
console.log(record);
|
||||
setPartsOrderContext({
|
||||
actions: {},
|
||||
context: {
|
||||
@@ -74,12 +75,13 @@ export function BillsListTableComponent({
|
||||
cost: i.actual_cost,
|
||||
quantity: i.quantity,
|
||||
joblineid: i.joblineid,
|
||||
oem_partno: i.jobline && i.jobline.oem_partno,
|
||||
};
|
||||
}),
|
||||
isReturn: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("bills.actions.return")}
|
||||
</Button>
|
||||
|
||||
@@ -5,21 +5,25 @@ import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBreadcrumbs } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import GlobalSearch from "../global-search/global-search.component";
|
||||
import "./breadcrumbs.styles.scss";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
breadcrumbs: selectBreadcrumbs,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export function BreadCrumbs({ breadcrumbs }) {
|
||||
export function BreadCrumbs({ breadcrumbs, bodyshop }) {
|
||||
return (
|
||||
<Row className="breadcrumb-container">
|
||||
<Col xs={24} sm={24} md={16}>
|
||||
<Breadcrumb separator=">">
|
||||
<Breadcrumb.Item>
|
||||
<Link to={`/manage`}>
|
||||
<HomeFilled />
|
||||
<HomeFilled />{" "}
|
||||
{(bodyshop && bodyshop.shopname && `(${bodyshop.shopname})`) ||
|
||||
""}
|
||||
</Link>
|
||||
</Breadcrumb.Item>
|
||||
{breadcrumbs.map((item) =>
|
||||
|
||||
@@ -45,13 +45,14 @@ function ChatSendMessageComponent({
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleEnter = () => {
|
||||
if (message === "" || !message) return;
|
||||
logImEXEvent("messaging_send_message");
|
||||
const selectedImages = selectedMedia.filter((i) => i.isSelected);
|
||||
if (selectedImages < 11) {
|
||||
if ((message === "" || !message) && selectedImages.length === 0) return;
|
||||
logImEXEvent("messaging_send_message");
|
||||
|
||||
if (selectedImages.length < 11) {
|
||||
sendMessage({
|
||||
to: conversation.phone_num,
|
||||
body: message,
|
||||
body: message || "",
|
||||
messagingServiceSid: bodyshop.messagingservicesid,
|
||||
conversationid: conversation.id,
|
||||
selectedMedia: selectedImages,
|
||||
@@ -92,7 +93,7 @@ function ChatSendMessageComponent({
|
||||
</span>
|
||||
<SendOutlined
|
||||
className="imex-flex-row__margin"
|
||||
disabled={message === "" || !message}
|
||||
// disabled={message === "" || !message}
|
||||
onClick={handleEnter}
|
||||
/>
|
||||
<Spin
|
||||
|
||||
@@ -2,7 +2,6 @@ import { DeleteFilled, DownOutlined } from "@ant-design/icons";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Divider,
|
||||
Dropdown,
|
||||
Form,
|
||||
@@ -15,6 +14,7 @@ import {
|
||||
Typography,
|
||||
} from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import moment from "moment";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -23,9 +23,9 @@ import { determineDmsType } from "../../pages/dms/dms.container";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
||||
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import moment from "moment";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -80,11 +80,25 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
||||
layout="vertical"
|
||||
onFinish={handleFinish}
|
||||
initialValues={{
|
||||
story: t("jobs.labels.dms.defaultstory", {
|
||||
story: `${t("jobs.labels.dms.defaultstory", {
|
||||
ro_number: job.ro_number,
|
||||
area_of_damage:
|
||||
(job.area_of_damage && job.area_of_damage.impact1) || "UNKNOWN",
|
||||
}).substr(0, 239),
|
||||
ownr_nm: `${job.ownr_fn || ""} ${job.ownr_ln || ""} ${
|
||||
job.ownr_co_nm || ""
|
||||
}`.trim(),
|
||||
ins_co_nm: job.ins_co_nm || "N/A",
|
||||
clm_po: `${job.clm_no ? `${job.clm_no} ` : ""}${
|
||||
job.po_number || ""
|
||||
}`,
|
||||
}).trim()}.${
|
||||
job.area_of_damage && job.area_of_damage.impact1
|
||||
? " " +
|
||||
t("jobs.labels.dms.damageto", {
|
||||
area_of_damage:
|
||||
(job.area_of_damage && job.area_of_damage.impact1) ||
|
||||
"UNKNOWN",
|
||||
})
|
||||
: ""
|
||||
}`.substr(0, 239),
|
||||
inservicedate: moment("2019-01-01"),
|
||||
}}
|
||||
>
|
||||
@@ -162,7 +176,7 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
||||
name="inservicedate"
|
||||
label={t("jobs.fields.dms.inservicedate")}
|
||||
>
|
||||
<DatePicker format="MM/DD/YYYY" />
|
||||
<FormDatePicker />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<Space>
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import { DatePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { forwardRef } from "react";
|
||||
import React, { useRef } from "react";
|
||||
//To be used as a form element only.
|
||||
|
||||
const dateFormat = "MM/DD/YYYY";
|
||||
|
||||
const FormDatePicker = (
|
||||
{ value, onChange, onBlur, onlyFuture, ...restProps },
|
||||
ref
|
||||
) => {
|
||||
export default function FormDatePicker({
|
||||
value,
|
||||
onChange,
|
||||
onBlur,
|
||||
onlyFuture,
|
||||
...restProps
|
||||
}) {
|
||||
const ref = useRef();
|
||||
|
||||
const handleChange = (newDate) => {
|
||||
if (value !== newDate && onChange) {
|
||||
onChange(newDate);
|
||||
@@ -19,17 +24,44 @@ const FormDatePicker = (
|
||||
if (e.key.toLowerCase() === "t") {
|
||||
if (onChange) {
|
||||
onChange(new moment());
|
||||
// if (ref.current && ref.current.blur) ref.current.blur();
|
||||
}
|
||||
} else if (e.key.toLowerCase() === "enter") {
|
||||
if (ref.current && ref.current.blur) ref.current.blur();
|
||||
}
|
||||
};
|
||||
|
||||
const handleBlur = (e) => {
|
||||
const v = e.target.value;
|
||||
if (!v) return;
|
||||
|
||||
const _a = moment(
|
||||
v,
|
||||
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
|
||||
"en",
|
||||
false
|
||||
);
|
||||
|
||||
if (_a.isValid() && value && value.isValid && value.isValid()) {
|
||||
_a.set({
|
||||
hours: value.hours(),
|
||||
minutes: value.minutes(),
|
||||
seconds: value.seconds(),
|
||||
milliseconds: value.milliseconds(),
|
||||
});
|
||||
}
|
||||
|
||||
if (_a.isValid() && onChange) onChange(_a);
|
||||
};
|
||||
|
||||
return (
|
||||
<div onKeyDown={handleKeyDown}>
|
||||
<DatePicker
|
||||
ref={ref}
|
||||
value={value ? moment(value) : null}
|
||||
onChange={handleChange}
|
||||
format={dateFormat}
|
||||
onBlur={onBlur}
|
||||
onBlur={onBlur || handleBlur}
|
||||
disabledTime
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
|
||||
@@ -38,6 +70,4 @@ const FormDatePicker = (
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default forwardRef(FormDatePicker);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export default function GlobalSearch() {
|
||||
<Link to={`/manage/jobs/${job.id}`}>
|
||||
<Space size="small" split={<Divider type="vertical" />}>
|
||||
<strong>{job.ro_number || t("general.labels.na")}</strong>
|
||||
<span>{`${job.status || ""}`}</span>
|
||||
<span>{`${job.ownr_fn || ""} ${job.ownr_ln || ""} ${
|
||||
job.ownr_co_nm || ""
|
||||
}`}</span>
|
||||
|
||||
@@ -38,6 +38,7 @@ export default function ScheduleEventContainer({ bodyshop, event, refetch }) {
|
||||
job: {
|
||||
date_scheduled: null,
|
||||
scheduled_in: null,
|
||||
scheduled_completion:null,
|
||||
status: bodyshop.md_ro_statuses.default_imported,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -105,6 +105,10 @@ export function JobChecklistForm({
|
||||
completed_at: new Date(),
|
||||
},
|
||||
|
||||
...(type === "intake" &&
|
||||
values.scheduled_delivery && {
|
||||
scheduled_delivery: values.scheduled_delivery,
|
||||
}),
|
||||
...(type === "deliver" && {
|
||||
scheduled_delivery: values.scheduled_delivery,
|
||||
actual_delivery: values.actual_delivery,
|
||||
@@ -171,7 +175,12 @@ export function JobChecklistForm({
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
console.log(job, {
|
||||
removeFromProduction: true,
|
||||
actual_completion:
|
||||
job && job.actual_completion && moment(job.actual_completion),
|
||||
actual_delivery: job && job.actual_delivery && moment(job.actual_delivery),
|
||||
});
|
||||
return (
|
||||
<Card
|
||||
title={t("checklist.labels.checklist")}
|
||||
@@ -195,21 +204,27 @@ export function JobChecklistForm({
|
||||
addToProduction: true,
|
||||
allow_text_message: job.owner && job.owner.allow_text_message,
|
||||
scheduled_completion:
|
||||
(job && job.scheduled_completion) ||
|
||||
(job.labbrs && job.larhrs
|
||||
? moment().businessAdd(
|
||||
(job.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
job.larhrs.aggregate.sum.mod_lb_hrs) /
|
||||
bodyshop.target_touchtime,
|
||||
"days"
|
||||
)
|
||||
: null),
|
||||
scheduled_delivery: job && job.scheduled_delivery,
|
||||
(job &&
|
||||
job.scheduled_completion &&
|
||||
moment(job.scheduled_completion)) ||
|
||||
(job &&
|
||||
job.labhrs &&
|
||||
job.larhrs &&
|
||||
moment().businessAdd(
|
||||
(job.labhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0 + job.larhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0) / bodyshop.target_touchtime,
|
||||
"days"
|
||||
)),
|
||||
scheduled_delivery:
|
||||
job.scheduled_delivery && moment(job.scheduled_delivery),
|
||||
}),
|
||||
...(type === "deliver" && {
|
||||
removeFromProduction: true,
|
||||
actual_completion: job && job.actual_completion,
|
||||
actual_delivery: job && job.actual_delivery,
|
||||
actual_completion:
|
||||
job && job.actual_completion && moment(job.actual_completion),
|
||||
actual_delivery:
|
||||
job && job.actual_delivery && moment(job.actual_delivery),
|
||||
}),
|
||||
...formItems
|
||||
.filter((fi) => fi.value)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Form, notification, DatePicker } from "antd";
|
||||
import { Button, Form, notification } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import moment from "moment";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
|
||||
export default function JobsAdminDatesChange({ job }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -54,7 +56,7 @@ export default function JobsAdminDatesChange({ job }) {
|
||||
label={t("jobs.fields.date_estimated")}
|
||||
name="date_estimated"
|
||||
>
|
||||
<DatePicker format="MM/DD/YYYY" />
|
||||
<FormDatePicker format="MM/DD/YYYY" />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.date_open")} name="date_open">
|
||||
<DateTimePicker />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DatePicker, Form, Statistic, Tooltip } from "antd";
|
||||
import { Form, Statistic, Tooltip } from "antd";
|
||||
import React, { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -34,7 +34,7 @@ export function JobsDetailDatesComponent({ jobRO, job, bodyshop }) {
|
||||
label={t("jobs.fields.date_estimated")}
|
||||
name="date_estimated"
|
||||
>
|
||||
<DatePicker disabled={jobRO} format="MM/DD/YYYY" />
|
||||
<FormDatePicker disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.date_open")} name="date_open">
|
||||
<DateTimePicker disabled={jobRO} />
|
||||
|
||||
@@ -36,7 +36,7 @@ export function JobsDocumentsDownloadButton({
|
||||
);
|
||||
const imagesToDownload = [
|
||||
...galleryImages.images.filter((image) => image.isSelected),
|
||||
// ...galleryImages.other.filter((image) => image.isSelected),
|
||||
...galleryImages.other.filter((image) => image.isSelected),
|
||||
];
|
||||
|
||||
function downloadProgress(progressEvent) {
|
||||
@@ -123,6 +123,7 @@ export function JobsDocumentsDownloadButton({
|
||||
a.click();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
|
||||
@@ -6,9 +6,11 @@ import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setPartnerVersion } from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
@@ -19,7 +21,7 @@ export default connect(
|
||||
mapDispatchToProps
|
||||
)(PartnerPingComponent);
|
||||
|
||||
export function PartnerPingComponent({ setPartnerVersion }) {
|
||||
export function PartnerPingComponent({ bodyshop, setPartnerVersion }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -29,16 +31,25 @@ export function PartnerPingComponent({ setPartnerVersion }) {
|
||||
//if (process.env.NODE_ENV === "development") return;
|
||||
const PartnerResponse = await axios.post("http://localhost:1337/ping/");
|
||||
const { appver, qbpath } = PartnerResponse.data;
|
||||
|
||||
if (!bodyshop) return;
|
||||
setPartnerVersion(appver);
|
||||
console.log({ appver, qbpath });
|
||||
if (!qbpath) {
|
||||
if (
|
||||
!qbpath &&
|
||||
!(
|
||||
bodyshop &&
|
||||
(bodyshop.cdk_dealerid ||
|
||||
bodyshop.pbs_serialnumber ||
|
||||
bodyshop.accountingconfig.qbo)
|
||||
)
|
||||
) {
|
||||
notification["error"]({
|
||||
title: "",
|
||||
message: t("general.messages.noacctfilepath"),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
notification["error"]({
|
||||
title: "",
|
||||
message: t("general.messages.partnernotrunning"),
|
||||
@@ -48,7 +59,7 @@ export function PartnerPingComponent({ setPartnerVersion }) {
|
||||
// Execute the created function directly
|
||||
checkPartnerStatus();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
}, [bodyshop]);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
||||
@@ -91,68 +91,76 @@ export function PartsOrderModalComponent({
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item required={false} key={field.key}>
|
||||
<LayoutFormRow grow noDivider>
|
||||
<Form.Item
|
||||
//span={8}
|
||||
label={t("parts_orders.fields.line_desc")}
|
||||
key={`${index}line_desc`}
|
||||
name={[field.name, "line_desc"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.line_remarks")}
|
||||
key={`${index}line_remarks`}
|
||||
name={[field.name, "line_remarks"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{
|
||||
// <Form.Item
|
||||
// label={t("parts_orders.fields.db_price")}
|
||||
// key={`${index}db_price`}
|
||||
// name={[field.name, "db_price"]}
|
||||
// >
|
||||
// <CurrencyInput />
|
||||
// </Form.Item>
|
||||
}
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.quantity")}
|
||||
key={`${index}quantity`}
|
||||
name={[field.name, "quantity"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.act_price")}
|
||||
key={`${index}act_price`}
|
||||
name={[field.name, "act_price"]}
|
||||
>
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
{isReturn && (
|
||||
<div style={{ display: "flex" }}>
|
||||
<LayoutFormRow grow noDivider style={{ flex: 1 }}>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.cost")}
|
||||
key={`${index}cost`}
|
||||
name={[field.name, "cost"]}
|
||||
//span={8}
|
||||
label={t("parts_orders.fields.line_desc")}
|
||||
key={`${index}line_desc`}
|
||||
name={[field.name, "line_desc"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.line_remarks")}
|
||||
key={`${index}line_remarks`}
|
||||
name={[field.name, "line_remarks"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.oem_partno")}
|
||||
key={`${index}oem_partno`}
|
||||
name={[field.name, "oem_partno"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{
|
||||
// <Form.Item
|
||||
// label={t("parts_orders.fields.db_price")}
|
||||
// key={`${index}db_price`}
|
||||
// name={[field.name, "db_price"]}
|
||||
// >
|
||||
// <CurrencyInput />
|
||||
// </Form.Item>
|
||||
}
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.quantity")}
|
||||
key={`${index}quantity`}
|
||||
name={[field.name, "quantity"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.act_price")}
|
||||
key={`${index}act_price`}
|
||||
name={[field.name, "act_price"]}
|
||||
>
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
<Space wrap align="center">
|
||||
{isReturn && (
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.cost")}
|
||||
key={`${index}cost`}
|
||||
name={[field.name, "cost"]}
|
||||
>
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
<Space wrap size="small" align="center">
|
||||
<div>
|
||||
<DeleteFilled
|
||||
style={{ margin: "1rem" }}
|
||||
@@ -167,7 +175,7 @@ export function PartsOrderModalComponent({
|
||||
total={fields.length}
|
||||
/>
|
||||
</Space>
|
||||
</LayoutFormRow>
|
||||
</div>
|
||||
</Form.Item>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -30,6 +30,8 @@ import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import PartsOrderModalComponent from "./parts-order-modal.component";
|
||||
import axios from "axios";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import _ from "lodash";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -57,6 +59,11 @@ export function PartsOrderModalContainer({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const client = useApolloClient();
|
||||
const { OEConnection_PriceChange } = useTreatments(
|
||||
["OEConnection_PriceChange"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const { visible, context, actions } = partsOrderModal;
|
||||
const {
|
||||
jobId,
|
||||
@@ -230,11 +237,22 @@ export function PartsOrderModalContainer({
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
});
|
||||
let po;
|
||||
//Massage the data based on the split. Should they be able to overwrite OEC pricing?
|
||||
if (OEConnection_PriceChange.treatment === "on") {
|
||||
//Set the flag to include the override.
|
||||
po = _.cloneDeep(partsOrder.data.parts_orders_by_pk);
|
||||
po.parts_order_lines.forEach((pol) => {
|
||||
pol.priceChange = true;
|
||||
});
|
||||
}
|
||||
|
||||
console.log(partsOrder.data.parts_orders_by_pk);
|
||||
|
||||
const oecResponse = await axios.post(
|
||||
"http://localhost:1337/oec/",
|
||||
|
||||
partsOrder.data.parts_orders_by_pk,
|
||||
po || partsOrder.data.parts_orders_by_pk,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
|
||||
|
||||
@@ -12,6 +12,7 @@ import ProductionAlert from "../production-list-columns/production-list-columns.
|
||||
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
|
||||
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
|
||||
import "./production-board-card.styles.scss";
|
||||
import moment from "moment";
|
||||
|
||||
export default function ProductionBoardCard(
|
||||
technician,
|
||||
@@ -37,6 +38,15 @@ export default function ProductionBoardCard(
|
||||
// employee_csr = bodyshop.employees.find((e) => e.id === card.employee_csr);
|
||||
// }
|
||||
|
||||
const pastDueAlert =
|
||||
!!card.scheduled_completion &&
|
||||
((moment().isSameOrAfter(moment(card.scheduled_completion), "day") &&
|
||||
"production-completion-past") ||
|
||||
(moment()
|
||||
.add(1, "day")
|
||||
.isSame(moment(card.scheduled_completion), "day") &&
|
||||
"production-completion-soon"));
|
||||
|
||||
return (
|
||||
<Card
|
||||
className="react-kanban-card imex-kanban-card"
|
||||
@@ -145,7 +155,7 @@ export default function ProductionBoardCard(
|
||||
cardSettings.scheduled_completion &&
|
||||
card.scheduled_completion && (
|
||||
<Col span={cardSettings && cardSettings.compact ? 24 : 12}>
|
||||
<Space>
|
||||
<Space className={pastDueAlert}>
|
||||
<CalendarOutlined />
|
||||
<DateTimeFormatter format="MM/DD">
|
||||
{card.scheduled_completion}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useApolloClient } from "@apollo/client";
|
||||
import Board, { moveCard } from "@asseinfo/react-kanban";
|
||||
//import "@asseinfo/react-kanban/dist/styles.css";
|
||||
import "./production-board-kanban.styles.scss";
|
||||
import { SyncOutlined } from '@ant-design/icons'
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { Grid, notification, Button, PageHeader, Space, Statistic } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -49,9 +49,16 @@ export function ProductionBoardKanbanComponent({
|
||||
|
||||
const { t } = useTranslation();
|
||||
useEffect(() => {
|
||||
setBoardLanes(
|
||||
createBoardData(bodyshop.md_ro_statuses.production_statuses, data, filter)
|
||||
const boardData = createBoardData(
|
||||
bodyshop.md_ro_statuses.production_statuses,
|
||||
data,
|
||||
filter
|
||||
);
|
||||
|
||||
boardData.columns = boardData.columns.map((d) => {
|
||||
return { ...d, title: `${d.title} (${d.cards.length})` };
|
||||
});
|
||||
setBoardLanes(boardData);
|
||||
setIsMoving(false);
|
||||
}, [
|
||||
data,
|
||||
|
||||
@@ -18,6 +18,7 @@ import ProductionListLastContacted from "./production-list-columns.lastcontacted
|
||||
import ProductionListColumnPaintPriority from "./production-list-columns.paintpriority.component";
|
||||
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||
import ProductionListColumnCategory from "./production-list-columns.status.category";
|
||||
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||
|
||||
const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
@@ -108,7 +109,7 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
state.sortedInfo.columnKey === "scheduled_completion" &&
|
||||
state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<ProductionListDate record={record} field="scheduled_completion" />
|
||||
<ProductionListDate record={record} field="scheduled_completion" pastIndicator />
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -155,7 +156,7 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
state.sortedInfo.columnKey === "scheduled_delivery" &&
|
||||
state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<ProductionListDate record={record} field="scheduled_delivery" />
|
||||
<ProductionListDate record={record} field="scheduled_delivery" pastIndicator/>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -251,6 +252,29 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
render: (text, record) => <ProductionListColumnStatus record={record} />,
|
||||
},
|
||||
{
|
||||
title: i18n.t("jobs.fields.category"),
|
||||
dataIndex: "category",
|
||||
key: "category",
|
||||
ellipsis: true,
|
||||
|
||||
filters:
|
||||
(bodyshop &&
|
||||
bodyshop.md_categories.map((s) => {
|
||||
return {
|
||||
text: s,
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.category),
|
||||
sorter: (a, b) => alphaSort(a.category, b.category),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "category" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<ProductionListColumnCategory record={record} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: i18n.t("production.labels.bodyhours"),
|
||||
dataIndex: "labhrs",
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { DatePicker, Dropdown, TimePicker, Button, Card } from "antd";
|
||||
import { Button, Card, Dropdown, TimePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const OneCalendarDay = 60 * 60 * 24 * 1000;
|
||||
const Now = new Date();
|
||||
|
||||
export default function ProductionListDate({ record, field, time }) {
|
||||
export default function ProductionListDate({
|
||||
record,
|
||||
field,
|
||||
time,
|
||||
pastIndicator,
|
||||
}) {
|
||||
const [updateAlert] = useMutation(UPDATE_JOB);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleChange = (date) => {
|
||||
logImEXEvent("product_toggle_date", { field });
|
||||
if (date.isSame(record[field] && moment(record[field]))) {
|
||||
return;
|
||||
}
|
||||
|
||||
//e.stopPropagation();
|
||||
updateAlert({
|
||||
@@ -34,6 +40,15 @@ export default function ProductionListDate({ record, field, time }) {
|
||||
});
|
||||
};
|
||||
|
||||
let className = "";
|
||||
if (pastIndicator) {
|
||||
className =
|
||||
!!record[field] &&
|
||||
((moment().isSameOrAfter(moment(record[field]), "day") &&
|
||||
"production-completion-past") ||
|
||||
(moment().add(1, "day").isSame(moment(record[field]), "day") &&
|
||||
"production-completion-soon"));
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<Dropdown
|
||||
@@ -47,7 +62,7 @@ export default function ProductionListDate({ record, field, time }) {
|
||||
style={{ padding: "1rem" }}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<DatePicker
|
||||
<FormDatePicker
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
value={(record[field] && moment(record[field])) || null}
|
||||
onChange={handleChange}
|
||||
@@ -72,17 +87,9 @@ export default function ProductionListDate({ record, field, time }) {
|
||||
style={{
|
||||
height: "19px",
|
||||
}}
|
||||
className={className}
|
||||
>
|
||||
<DateFormatter
|
||||
bordered={false}
|
||||
className={
|
||||
!!record[field] && new Date(record[field]) - Now < OneCalendarDay
|
||||
? "production-completion-1"
|
||||
: ""
|
||||
}
|
||||
>
|
||||
{record[field]}
|
||||
</DateFormatter>
|
||||
<DateFormatter bordered={false}>{record[field]}</DateFormatter>
|
||||
</div>
|
||||
</Dropdown>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Dropdown, Menu, Spin } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
insertAuditTrail: ({ jobid, operation }) =>
|
||||
dispatch(insertAuditTrail({ jobid, operation })),
|
||||
});
|
||||
export function ProductionListColumnCategory({ record, bodyshop }) {
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleSetStatus = async (e) => {
|
||||
logImEXEvent("production_change_status");
|
||||
|
||||
setLoading(true);
|
||||
const { key } = e;
|
||||
await updateJob({
|
||||
variables: {
|
||||
jobId: record.id,
|
||||
job: {
|
||||
category: key,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
overlay={
|
||||
<Menu
|
||||
style={{ maxHeight: "200px", overflowY: "auto" }}
|
||||
onClick={handleSetStatus}
|
||||
>
|
||||
{bodyshop.md_categories.map((item) => (
|
||||
<Menu.Item key={item}>{item}</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
}
|
||||
trigger={["click"]}
|
||||
>
|
||||
<div style={{ width: "100%", height: "19px", cursor: "pointer" }}>
|
||||
{record.category}
|
||||
{loading && <Spin />}
|
||||
</div>
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ProductionListColumnCategory);
|
||||
@@ -4,9 +4,25 @@ import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const ProdTemplates = TemplateList("production");
|
||||
const { production_by_technician_one, production_by_category_one } =
|
||||
TemplateList("special");
|
||||
|
||||
export default function ProductionListPrint() {
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ProductionListPrint);
|
||||
|
||||
export function ProductionListPrint({ bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
return (
|
||||
@@ -33,6 +49,52 @@ export default function ProductionListPrint() {
|
||||
{ProdTemplates[key].title}
|
||||
</Menu.Item>
|
||||
))}
|
||||
<Menu.SubMenu
|
||||
title={t("reportcenter.templates.production_by_technician_one")}
|
||||
>
|
||||
{bodyshop.employees.map((e) => (
|
||||
<Menu.Item
|
||||
key={e.id}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await GenerateDocument(
|
||||
{
|
||||
name: production_by_technician_one.key,
|
||||
variables: { id: e.id },
|
||||
},
|
||||
{},
|
||||
"p"
|
||||
);
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{e.first_name} {e.last_name}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu.SubMenu>
|
||||
<Menu.SubMenu
|
||||
title={t("reportcenter.templates.production_by_category_one")}
|
||||
>
|
||||
{bodyshop.md_categories.map((e) => (
|
||||
<Menu.Item
|
||||
key={e}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await GenerateDocument(
|
||||
{
|
||||
name: production_by_category_one.key,
|
||||
variables: { category: e },
|
||||
},
|
||||
{},
|
||||
"p"
|
||||
);
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{e}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu.SubMenu>
|
||||
</Menu>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -88,6 +88,12 @@ export function ProductionListTable({
|
||||
);
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
console.log(
|
||||
"🚀 ~ file: production-list-table.component.jsx ~ line 91 ~ pagination, filters, sorter",
|
||||
pagination,
|
||||
filters,
|
||||
sorter
|
||||
);
|
||||
setState({
|
||||
...state,
|
||||
filteredInfo: filters,
|
||||
@@ -265,6 +271,7 @@ export function ProductionListTable({
|
||||
columns={columns.map((c, index) => {
|
||||
return {
|
||||
...c,
|
||||
filteredValue: state.filteredInfo[c.key] || null,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
||||
title: headerItem(c),
|
||||
|
||||
@@ -25,15 +25,20 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) {
|
||||
const { ssbuckets } = bodyshop;
|
||||
|
||||
const data = useMemo(() => {
|
||||
return Object.keys(loadData.expectedLoad).map((key) => {
|
||||
const metadataBucket = ssbuckets.filter((b) => b.id === key)[0];
|
||||
return (
|
||||
(loadData &&
|
||||
loadData.expectedLoad &&
|
||||
Object.keys(loadData.expectedLoad).map((key) => {
|
||||
const metadataBucket = ssbuckets.filter((b) => b.id === key)[0];
|
||||
|
||||
return {
|
||||
bucket: loadData.expectedLoad[key].label,
|
||||
current: loadData.expectedLoad[key].count,
|
||||
target: metadataBucket && metadataBucket.target,
|
||||
};
|
||||
});
|
||||
return {
|
||||
bucket: loadData.expectedLoad[key].label,
|
||||
current: loadData.expectedLoad[key].count,
|
||||
target: metadataBucket && metadataBucket.target,
|
||||
};
|
||||
})) ||
|
||||
[]
|
||||
);
|
||||
}, [loadData, ssbuckets]);
|
||||
|
||||
const popContent = (
|
||||
|
||||
@@ -7,6 +7,8 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import ShopEmployeesFormComponent from "./shop-employees-form.component";
|
||||
import ShopEmployeesListComponent from "./shop-employees-list.component";
|
||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
@@ -21,11 +23,13 @@ function ShopEmployeesContainer({ bodyshop }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ShopEmployeesListComponent
|
||||
employees={data ? data.employees : []}
|
||||
loading={loading}
|
||||
/>
|
||||
<ShopEmployeesFormComponent />
|
||||
<RbacWrapper action="employees:page">
|
||||
<ShopEmployeesListComponent
|
||||
employees={data ? data.employees : []}
|
||||
loading={loading}
|
||||
/>
|
||||
<ShopEmployeesFormComponent />
|
||||
</RbacWrapper>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,9 +75,17 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
<div>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||
<>
|
||||
<DataLabel label={t("bodyshop.labels.dms.cdk_dealerid")}>
|
||||
{form.getFieldValue("cdk_dealerid")}
|
||||
</DataLabel>
|
||||
{bodyshop.cdk_dealerid && (
|
||||
<DataLabel label={t("bodyshop.labels.dms.cdk_dealerid")}>
|
||||
{form.getFieldValue("cdk_dealerid")}
|
||||
</DataLabel>
|
||||
)}
|
||||
{bodyshop.pbs_serialnumber && (
|
||||
<DataLabel label={t("bodyshop.labels.dms.pbs_serialnumber")}>
|
||||
{form.getFieldValue("pbs_serialnumber")}
|
||||
</DataLabel>
|
||||
)}
|
||||
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.default_journal")}
|
||||
@@ -158,11 +166,11 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
label={t("jobs.fields.dms.payer.control_type")}
|
||||
key={`${index}control_type`}
|
||||
name={[field.name, "control_type"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
// rules={[
|
||||
// {
|
||||
// required: true,
|
||||
// },
|
||||
// ]}
|
||||
>
|
||||
<Select showSearch>
|
||||
<Select.Option value="ro_number">
|
||||
|
||||
@@ -49,9 +49,13 @@ export function TechClockInComponent({ form, bodyshop, technician }) {
|
||||
<Select>
|
||||
{emps &&
|
||||
emps.rates.map((item) => (
|
||||
<Select.Option key={item.cost_center}>
|
||||
<Select.Option key={item.cost_center} value={item.cost_center}>
|
||||
{item.cost_center === "timetickets.labels.shift"
|
||||
? t(item.cost_center)
|
||||
: bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
? t(
|
||||
`joblines.fields.lbr_types.${item.cost_center.toUpperCase()}`
|
||||
)
|
||||
: item.cost_center}
|
||||
</Select.Option>
|
||||
))}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, notification } from "antd";
|
||||
import { Button, Card, Form, notification, Space } from "antd";
|
||||
import axios from "axios";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -9,6 +9,7 @@ import { INSERT_NEW_TIME_TICKET } from "../../graphql/timetickets.queries";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import TechClockInComponent from "./tech-job-clock-in-form.component";
|
||||
import TechJobPrintTickets from "../tech-job-print-tickets/tech-job-print-tickets.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
technician: selectTechnician,
|
||||
@@ -36,14 +37,17 @@ export function TechClockInContainer({ technician, bodyshop }) {
|
||||
clockon: theTime,
|
||||
jobid: values.jobid,
|
||||
cost_center: values.cost_center,
|
||||
ciecacode: Object.keys(
|
||||
bodyshop.md_responsibility_centers.defaults.costs
|
||||
).find((key) => {
|
||||
return (
|
||||
bodyshop.md_responsibility_centers.defaults.costs[key] ===
|
||||
values.cost_center
|
||||
);
|
||||
}),
|
||||
ciecacode:
|
||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
? values.cost_center
|
||||
: Object.keys(
|
||||
bodyshop.md_responsibility_centers.defaults.costs
|
||||
).find((key) => {
|
||||
return (
|
||||
bodyshop.md_responsibility_centers.defaults.costs[key] ===
|
||||
values.cost_center
|
||||
);
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -68,9 +72,16 @@ export function TechClockInContainer({ technician, bodyshop }) {
|
||||
<Card
|
||||
title={t("timetickets.labels.clockintojob")}
|
||||
extra={
|
||||
<Button type="primary" onClick={() => form.submit()} loading={loading}>
|
||||
{t("timetickets.actions.clockin")}
|
||||
</Button>
|
||||
<Space wrap>
|
||||
<TechJobPrintTickets />
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => form.submit()}
|
||||
loading={loading}
|
||||
>
|
||||
{t("timetickets.actions.clockin")}
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Form form={form} layout="vertical" onFinish={handleFinish}>
|
||||
|
||||
@@ -55,6 +55,20 @@ export function TechClockOffButton({
|
||||
timeticket: {
|
||||
clockoff: (await axios.post("/utils/time")).data,
|
||||
...values,
|
||||
rate: emps && emps.rates.filter(
|
||||
(r) => r.cost_center === values.cost_center
|
||||
)[0]?.rate,
|
||||
ciecacode:
|
||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
? values.cost_center
|
||||
: Object.keys(
|
||||
bodyshop.md_responsibility_centers.defaults.costs
|
||||
).find((key) => {
|
||||
return (
|
||||
bodyshop.md_responsibility_centers.defaults.costs[key] ===
|
||||
values.cost_center
|
||||
);
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -141,6 +155,10 @@ export function TechClockOffButton({
|
||||
<Select.Option key={item.cost_center}>
|
||||
{item.cost_center === "timetickets.labels.shift"
|
||||
? t(item.cost_center)
|
||||
: bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
? t(
|
||||
`joblines.fields.lbr_types.${item.cost_center.toUpperCase()}`
|
||||
)
|
||||
: item.cost_center}
|
||||
</Select.Option>
|
||||
))
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
import { Button, Card, DatePicker, Form, Popover, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import DatePIckerRanges from "../../utils/DatePickerRanges";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
technician: selectTechnician,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(TechJobPrintTickets);
|
||||
|
||||
export function TechJobPrintTickets({ technician, event }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [form] = Form.useForm();
|
||||
const [visibility, setVisibility] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (visibility && event) {
|
||||
form.setFieldsValue(event);
|
||||
}
|
||||
}, [visibility, form, event]);
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
logImEXEvent("schedule_manual_event");
|
||||
|
||||
setLoading(true);
|
||||
const start = values.dates[0];
|
||||
const end = values.dates[1];
|
||||
|
||||
try {
|
||||
await GenerateDocument(
|
||||
{
|
||||
name: TemplateList().timetickets_employee.key,
|
||||
variables: {
|
||||
...(start
|
||||
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(end
|
||||
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(start ? { starttz: moment(start).startOf("day") } : {}),
|
||||
...(end ? { endtz: moment(end).endOf("day") } : {}),
|
||||
|
||||
id: technician.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
to: technician.email,
|
||||
subject: TemplateList().timetickets_employee.subject,
|
||||
},
|
||||
"p"
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
setVisibility(false);
|
||||
form.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
const overlay = (
|
||||
<Card>
|
||||
<div>
|
||||
<Form form={form} layout="vertical" onFinish={handleFinish}>
|
||||
<Form.Item
|
||||
label={t("reportcenter.labels.dates")}
|
||||
name="dates"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
ranges={DatePIckerRanges}
|
||||
format={"MM/DD/YYYY"}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Space wrap>
|
||||
<Button type="primary" onClick={() => form.submit()}>
|
||||
{t("general.actions.print")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setVisibility(false);
|
||||
form.resetFields();
|
||||
}}
|
||||
>
|
||||
{t("general.actions.cancel")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
|
||||
const handleClick = (e) => {
|
||||
setVisibility(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Popover content={overlay} visible={visibility}>
|
||||
<Button loading={loading} onClick={handleClick}>
|
||||
{t("general.actions.print")}
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ export function TimeTicketModalComponent({
|
||||
>
|
||||
<InputNumber min={0} precision={1} />
|
||||
</Form.Item>
|
||||
{isEdit && (
|
||||
{
|
||||
<>
|
||||
<Form.Item label={t("timetickets.fields.clockon")} name="clockon">
|
||||
<FormDateTimePicker
|
||||
@@ -221,7 +221,29 @@ export function TimeTicketModalComponent({
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("timetickets.fields.clockoff")} name="clockoff">
|
||||
<Form.Item
|
||||
label={t("timetickets.fields.clockoff")}
|
||||
name="clockoff"
|
||||
rules={[
|
||||
({ getFieldValue }) => ({
|
||||
validator(rule, value) {
|
||||
const clockon = getFieldValue("clockon");
|
||||
|
||||
if (!value) return Promise.resolve();
|
||||
if (!clockon && value)
|
||||
return Promise.reject(
|
||||
t("timetickets.validation.clockoffwithoutclockon")
|
||||
);
|
||||
if (!value.isSameOrAfter(clockon))
|
||||
return Promise.reject(
|
||||
t("timetickets.validation.clockoffmustbeafterclockon")
|
||||
);
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<FormDateTimePicker
|
||||
disabled={
|
||||
!HasRbacAccess({
|
||||
@@ -233,7 +255,7 @@ export function TimeTicketModalComponent({
|
||||
/>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
}
|
||||
|
||||
<Form.Item label={t("timetickets.fields.memo")} name="memo">
|
||||
<MemoInput />
|
||||
|
||||
@@ -32,7 +32,9 @@ export default function VendorsFormComponent({
|
||||
return (
|
||||
<div>
|
||||
<PageHeader
|
||||
title={form.getFieldValue("name")}
|
||||
title={
|
||||
<Form.Item shouldUpdate>{() => form.getFieldValue("name")}</Form.Item>
|
||||
}
|
||||
extra={
|
||||
<Space>
|
||||
<Form.Item
|
||||
|
||||
@@ -262,6 +262,9 @@ export const QUERY_DELIVER_CHECKLIST = gql`
|
||||
jobs_by_pk(id: $jobId) {
|
||||
id
|
||||
ro_number
|
||||
actual_completion
|
||||
actual_delivery
|
||||
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -181,7 +181,10 @@ export const UPDATE_JOB_LINE = gql`
|
||||
|
||||
export const GET_JOB_LINES_TO_ENTER_BILL = gql`
|
||||
query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) {
|
||||
joblines(where: { jobid: { _eq: $id } }) {
|
||||
joblines(
|
||||
where: { jobid: { _eq: $id } }
|
||||
order_by: { act_price: desc_nulls_last }
|
||||
) {
|
||||
removed
|
||||
id
|
||||
line_desc
|
||||
|
||||
@@ -123,6 +123,7 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql`
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
category
|
||||
ownr_co_nm
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
@@ -193,6 +194,7 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql`
|
||||
status
|
||||
ro_number
|
||||
ownr_fn
|
||||
category
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
v_model_yr
|
||||
@@ -263,6 +265,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
||||
id
|
||||
updated_at
|
||||
status
|
||||
category
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
@@ -1875,6 +1878,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
scheduled_delivery
|
||||
actual_delivery
|
||||
scheduled_in
|
||||
date_invoiced
|
||||
actual_in
|
||||
kmin
|
||||
kmout
|
||||
|
||||
@@ -5,14 +5,14 @@ export const GLOBAL_SEARCH_QUERY = gql`
|
||||
search_jobs(args: { search: $search }) {
|
||||
id
|
||||
ro_number
|
||||
status
|
||||
|
||||
clm_total
|
||||
clm_no
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
v_color
|
||||
plate_no
|
||||
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
|
||||
@@ -56,7 +56,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
jobId: job.id,
|
||||
job: {
|
||||
status: bodyshop.md_ro_statuses.default_invoiced || "",
|
||||
date_invoiced: new Date(),
|
||||
date_invoiced: values.date_invoiced,
|
||||
actual_in: values.actual_in,
|
||||
actual_completion: values.actual_completion,
|
||||
actual_delivery: values.actual_delivery,
|
||||
@@ -119,6 +119,9 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
actual_delivery: job.actual_delivery
|
||||
? moment(job.actual_delivery)
|
||||
: job.scheduled_delivery && moment(job.scheduled_delivery),
|
||||
date_invoiced: job.date_invoiced
|
||||
? moment(job.date_invoiced)
|
||||
: moment(),
|
||||
kmin: job.kmin,
|
||||
kmout: job.kmout,
|
||||
dms_allocation: job.dms_allocation,
|
||||
@@ -219,6 +222,32 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
>
|
||||
<DateTimePicker disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("jobs.fields.date_invoiced")}
|
||||
name="date_invoiced"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (!bodyshop.cdk_dealerid) return Promise.resolve();
|
||||
if (!value || moment(value).isSameOrAfter(moment(), "day")) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return Promise.reject(
|
||||
new Error(t("jobs.labels.dms.invoicedatefuture"))
|
||||
);
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<DateTimePicker
|
||||
disabled={jobRO}
|
||||
onlyFuture={!!bodyshop.cdk_dealerid}
|
||||
/>
|
||||
</Form.Item>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||
<Form.Item
|
||||
label={t("jobs.fields.kmin")}
|
||||
|
||||
@@ -69,6 +69,7 @@ export function JobsDeliverContainer({
|
||||
checklistConfig={
|
||||
(data && data.bodyshops_by_pk.deliverchecklist) || {}
|
||||
}
|
||||
job={data ? data.jobs_by_pk : {}}
|
||||
/>
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
|
||||
@@ -270,7 +270,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
factory.client(payload.imexshopid);
|
||||
|
||||
const authRecord = payload.associations.filter(
|
||||
(a) => a.useremail === userEmail
|
||||
(a) => a.useremail.toLowerCase() === userEmail.toLowerCase()
|
||||
);
|
||||
|
||||
yield put(setAuthlevel(authRecord[0] ? authRecord[0].authlevel : 0));
|
||||
|
||||
@@ -1506,7 +1506,9 @@
|
||||
"difference": "Difference",
|
||||
"diskscan": "Scan Disk for Estimates",
|
||||
"dms": {
|
||||
"defaultstory": "Bodyshop RO {{ro_number}}. Damage to $t(jobs.fields.area_of_damage_impact.{{area_of_damage}}).",
|
||||
"damageto": "Damage to $t(jobs.fields.area_of_damage_impact.{{area_of_damage}}).",
|
||||
"defaultstory": "B/S RO: {{ro_number}}. Owner: {{ownr_nm}}. Insurance Co: {{ins_co_nm}}. Claim/PO #: {{clm_po}}",
|
||||
"invoicedatefuture": "Invoice date must be today or in the future for CDK posting.",
|
||||
"kmoutnotgreaterthankmin": "Mileage out must be greater than mileage in.",
|
||||
"logs": "Logs",
|
||||
"notallocated": "Not Allocated",
|
||||
@@ -2219,6 +2221,7 @@
|
||||
"attendance_summary": "Attendance Summary (All Employees)",
|
||||
"credits_not_received_date": "Credits not Received by Date",
|
||||
"csi": "CSI Responses",
|
||||
"estimates_written_converted": "Estimates Written/Converted",
|
||||
"estimator_detail": "Jobs by Estimator (Detail)",
|
||||
"estimator_summary": "Jobs by Estimator (Summary)",
|
||||
"export_payables": "Export Log - Payables",
|
||||
@@ -2260,12 +2263,15 @@
|
||||
"parts_not_recieved": "Parts Not Received",
|
||||
"payments_by_date": "Payments by Date",
|
||||
"payments_by_date_type": "Payments by Date and Type",
|
||||
"production_by_category": "Production by Category",
|
||||
"production_by_category_one": "Production filtered by Category",
|
||||
"production_by_csr": "Production by CSR",
|
||||
"production_by_last_name": "Production by Last Name",
|
||||
"production_by_repair_status": "Production by Status",
|
||||
"production_by_ro": "Production by RO",
|
||||
"production_by_target_date": "Production by Target Date",
|
||||
"production_by_technician": "Production by Technician",
|
||||
"production_by_technician_one": "Production filtered by Technician",
|
||||
"purchases_by_cost_center_detail": "Purchases by Cost Center (Detail)",
|
||||
"purchases_by_cost_center_summary": "Purchases by Cost Center (Summary)",
|
||||
"purchases_by_date_range_detail": "Purchases by Date - Detail",
|
||||
@@ -2400,6 +2406,10 @@
|
||||
"clockedout": "Clocked out successfully.",
|
||||
"created": "Time ticket entered successfully.",
|
||||
"deleted": "Time ticket deleted successfully."
|
||||
},
|
||||
"validation": {
|
||||
"clockoffmustbeafterclockon": "Clock off time must be the same or after clock in time.",
|
||||
"clockoffwithoutclockon": "Clock off time cannot be set without a clock in time."
|
||||
}
|
||||
},
|
||||
"titles": {
|
||||
|
||||
@@ -1506,7 +1506,9 @@
|
||||
"difference": "",
|
||||
"diskscan": "",
|
||||
"dms": {
|
||||
"damageto": "",
|
||||
"defaultstory": "",
|
||||
"invoicedatefuture": "",
|
||||
"kmoutnotgreaterthankmin": "",
|
||||
"logs": "",
|
||||
"notallocated": "",
|
||||
@@ -2219,6 +2221,7 @@
|
||||
"attendance_summary": "",
|
||||
"credits_not_received_date": "",
|
||||
"csi": "",
|
||||
"estimates_written_converted": "",
|
||||
"estimator_detail": "",
|
||||
"estimator_summary": "",
|
||||
"export_payables": "",
|
||||
@@ -2260,12 +2263,15 @@
|
||||
"parts_not_recieved": "",
|
||||
"payments_by_date": "",
|
||||
"payments_by_date_type": "",
|
||||
"production_by_category": "",
|
||||
"production_by_category_one": "",
|
||||
"production_by_csr": "",
|
||||
"production_by_last_name": "",
|
||||
"production_by_repair_status": "",
|
||||
"production_by_ro": "",
|
||||
"production_by_target_date": "",
|
||||
"production_by_technician": "",
|
||||
"production_by_technician_one": "",
|
||||
"purchases_by_cost_center_detail": "",
|
||||
"purchases_by_cost_center_summary": "",
|
||||
"purchases_by_date_range_detail": "",
|
||||
@@ -2400,6 +2406,10 @@
|
||||
"clockedout": "",
|
||||
"created": "",
|
||||
"deleted": ""
|
||||
},
|
||||
"validation": {
|
||||
"clockoffmustbeafterclockon": "",
|
||||
"clockoffwithoutclockon": ""
|
||||
}
|
||||
},
|
||||
"titles": {
|
||||
|
||||
@@ -1506,7 +1506,9 @@
|
||||
"difference": "",
|
||||
"diskscan": "",
|
||||
"dms": {
|
||||
"damageto": "",
|
||||
"defaultstory": "",
|
||||
"invoicedatefuture": "",
|
||||
"kmoutnotgreaterthankmin": "",
|
||||
"logs": "",
|
||||
"notallocated": "",
|
||||
@@ -2219,6 +2221,7 @@
|
||||
"attendance_summary": "",
|
||||
"credits_not_received_date": "",
|
||||
"csi": "",
|
||||
"estimates_written_converted": "",
|
||||
"estimator_detail": "",
|
||||
"estimator_summary": "",
|
||||
"export_payables": "",
|
||||
@@ -2260,12 +2263,15 @@
|
||||
"parts_not_recieved": "",
|
||||
"payments_by_date": "",
|
||||
"payments_by_date_type": "",
|
||||
"production_by_category": "",
|
||||
"production_by_category_one": "",
|
||||
"production_by_csr": "",
|
||||
"production_by_last_name": "",
|
||||
"production_by_repair_status": "",
|
||||
"production_by_ro": "",
|
||||
"production_by_target_date": "",
|
||||
"production_by_technician": "",
|
||||
"production_by_technician_one": "",
|
||||
"purchases_by_cost_center_detail": "",
|
||||
"purchases_by_cost_center_summary": "",
|
||||
"purchases_by_date_range_detail": "",
|
||||
@@ -2400,6 +2406,10 @@
|
||||
"clockedout": "",
|
||||
"created": "",
|
||||
"deleted": ""
|
||||
},
|
||||
"validation": {
|
||||
"clockoffmustbeafterclockon": "",
|
||||
"clockoffwithoutclockon": ""
|
||||
}
|
||||
},
|
||||
"titles": {
|
||||
|
||||
@@ -1466,6 +1466,24 @@ export const TemplateList = (type, context) => {
|
||||
},
|
||||
group: "customers",
|
||||
},
|
||||
estimates_written_converted: {
|
||||
title: i18n.t("reportcenter.templates.estimates_written_converted"),
|
||||
description: "",
|
||||
subject: i18n.t(
|
||||
"reportcenter.templates.estimates_written_converted"
|
||||
),
|
||||
key: "estimates_written_converted",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
rangeFilter: {
|
||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||
field:
|
||||
i18n.t("jobs.fields.date_open") +
|
||||
"/" +
|
||||
i18n.t("jobs.fields.date_invoiced"), // Also date invoice.
|
||||
},
|
||||
group: "sales",
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(!type || type === "courtesycarcontract"
|
||||
@@ -1590,6 +1608,14 @@ export const TemplateList = (type, context) => {
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
},
|
||||
production_by_category: {
|
||||
title: i18n.t("reportcenter.templates.production_by_category"),
|
||||
description: "",
|
||||
subject: i18n.t("reportcenter.templates.production_by_category"),
|
||||
key: "production_by_category",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
},
|
||||
production_by_technician: {
|
||||
title: i18n.t("reportcenter.templates.production_by_technician"),
|
||||
description: "",
|
||||
@@ -1609,6 +1635,28 @@ export const TemplateList = (type, context) => {
|
||||
key: "ca_bc_etf_table",
|
||||
disabled: false,
|
||||
},
|
||||
production_by_technician_one: {
|
||||
title: i18n.t(
|
||||
"reportcenter.templates.production_by_technician_one"
|
||||
),
|
||||
description: "",
|
||||
subject: i18n.t(
|
||||
"reportcenter.templates.production_by_technician_one"
|
||||
),
|
||||
key: "production_by_technician_one",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
},
|
||||
production_by_category_one: {
|
||||
title: i18n.t("reportcenter.templates.production_by_category_one"),
|
||||
description: "",
|
||||
subject: i18n.t(
|
||||
"reportcenter.templates.production_by_category_one"
|
||||
),
|
||||
key: "production_by_category_one",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
@@ -815,6 +815,7 @@
|
||||
- email
|
||||
- enforce_class
|
||||
- enforce_referral
|
||||
- entegral_id
|
||||
- features
|
||||
- federal_tax_id
|
||||
- id
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "appointments_bodyshopid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "appointments_bodyshopid" on
|
||||
"public"."appointments" using btree ("bodyshopid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "appointments_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "appointments_jobid" on
|
||||
"public"."appointments" using btree ("jobid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "appointments_start";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "appointments_start" on
|
||||
"public"."appointments" using btree ("start");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "appointments_end";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "appointments_end" on
|
||||
"public"."appointments" using btree ("end");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "associations_bodyshopid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "associations_bodyshopid" on
|
||||
"public"."associations" using btree ("shopid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "associations_useremail";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "associations_useremail" on
|
||||
"public"."associations" using btree ("useremail");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "invoicelines_billid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "invoicelines_billid" on
|
||||
"public"."billlines" using btree ("billid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "invoicelines_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "invoicelines_jobid" on
|
||||
"public"."billlines" using btree ("joblineid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "bills_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "bills_jobid" on
|
||||
"public"."bills" using btree ("jobid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "conversations_shopid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "conversations_shopid" on
|
||||
"public"."conversations" using btree ("bodyshopid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "documents_shopid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "documents_shopid" on
|
||||
"public"."documents" using btree ("bodyshopid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "documents_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "documents_jobid" on
|
||||
"public"."documents" using btree ("jobid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "documents_billid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "documents_billid" on
|
||||
"public"."documents" using btree ("billid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "jobline_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "jobline_jobid" on
|
||||
"public"."joblines" using btree ("jobid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "jobs_updatedat";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "jobs_updatedat" on
|
||||
"public"."jobs" using btree ("updated_at");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "jobs_bodyshopid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "jobs_bodyshopid" on
|
||||
"public"."jobs" using btree ("shopid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "messages_conversationid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "messages_conversationid" on
|
||||
"public"."messages" using btree ("conversationid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "timetickets_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "timetickets_jobid" on
|
||||
"public"."timetickets" using btree ("jobid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "parts_orders_jobid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "parts_orders_jobid" on
|
||||
"public"."parts_orders" using btree ("jobid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "parts_order_lines_poid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "parts_order_lines_poid" on
|
||||
"public"."parts_order_lines" using btree ("orderid");
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "parts_order_lines_joblineid";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "parts_order_lines_joblineid" on
|
||||
"public"."parts_order_lines" using btree ("job_line_id");
|
||||
@@ -68,6 +68,10 @@ app.get("/test", async function (req, res) {
|
||||
"git rev-parse --short HEAD"
|
||||
);
|
||||
logger.log("test-api-status", "DEBUG", "api", { commit });
|
||||
sendEmail.sendServerEmail({
|
||||
subject: `API Check - ${process.env.NODE_ENV}`,
|
||||
text: `Server API check has come in. `,
|
||||
});
|
||||
res.status(200).send(`OK - ${commit}`);
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ axios.interceptors.request.use((x) => {
|
||||
} | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`;
|
||||
console.log(printable);
|
||||
|
||||
CdkBase.createLogEvent(socket, "TRACE", `Raw Request: ${printable}`);
|
||||
CdkBase.createJsonEvent(socket, "TRACE", `Raw Request: ${printable}`, x.data);
|
||||
|
||||
return x;
|
||||
});
|
||||
@@ -42,7 +42,12 @@ axios.interceptors.response.use((x) => {
|
||||
x.data
|
||||
)}`;
|
||||
console.log(printable);
|
||||
CdkBase.createLogEvent(socket, "TRACE", `Raw Response: ${printable}`);
|
||||
CdkBase.createJsonEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`Raw Response: ${printable}`,
|
||||
x.data
|
||||
);
|
||||
|
||||
return x;
|
||||
});
|
||||
@@ -60,7 +65,11 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
|
||||
const JobData = await QueryJobData(socket, jobid);
|
||||
socket.JobData = JobData;
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`Querying the DMS for the Vehicle Record.`
|
||||
);
|
||||
//Query for the Vehicle record to get the associated customer.
|
||||
socket.DmsVeh = await QueryVehicleFromDms(socket);
|
||||
//Todo: Need to validate the lines and methods below.
|
||||
@@ -116,7 +125,11 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
|
||||
);
|
||||
await UpsertVehicleData(socket, ownerRef.ReferenceId);
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`Inserting accounting posting data..`
|
||||
);
|
||||
await InsertAccountPostingData(socket);
|
||||
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
|
||||
|
||||
@@ -9,6 +9,7 @@ exports.default = function ({
|
||||
qbo = false,
|
||||
items,
|
||||
taxCodes,
|
||||
classes,
|
||||
}) {
|
||||
const InvoiceLineAdd = [];
|
||||
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
||||
@@ -38,7 +39,9 @@ exports.default = function ({
|
||||
|
||||
if (
|
||||
(jobline.prt_dsmk_p && jobline.prt_dsmk_p !== 0) ||
|
||||
((jobline.db_ref === "900511" || jobline.db_ref === "900510") &&
|
||||
((jobline.db_ref === "900511" ||
|
||||
jobline.db_ref === "900510" ||
|
||||
jobline.db_ref === "900500") &&
|
||||
jobline.prt_dsmk_m &&
|
||||
jobline.prt_dsmk_m !== 0)
|
||||
) {
|
||||
@@ -93,6 +96,9 @@ exports.default = function ({
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: DineroAmount,
|
||||
SalesItemLineDetail: {
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
@@ -159,6 +165,9 @@ exports.default = function ({
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: DineroAmount,
|
||||
SalesItemLineDetail: {
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
@@ -225,6 +234,9 @@ exports.default = function ({
|
||||
ItemRef: {
|
||||
value: items[mapaAccount.accountitem],
|
||||
},
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
@@ -288,6 +300,9 @@ exports.default = function ({
|
||||
ItemRef: {
|
||||
value: items[mashAccount.accountitem],
|
||||
},
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
@@ -365,6 +380,9 @@ exports.default = function ({
|
||||
amount: Math.round((jobs_by_pk.towing_payable || 0) * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesItemLineDetail: {
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
@@ -413,6 +431,9 @@ exports.default = function ({
|
||||
amount: Math.round((jobs_by_pk.storage_payable || 0) * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesItemLineDetail: {
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
@@ -464,6 +485,9 @@ exports.default = function ({
|
||||
amount: Math.round((jobs_by_pk.adjustment_bottom_line || 0) * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesItemLineDetail: {
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
@@ -552,6 +576,9 @@ exports.default = function ({
|
||||
DineroQbFormat
|
||||
),
|
||||
SalesItemLineDetail: {
|
||||
...(jobs_by_pk.class
|
||||
? { ClassRef: { value: classes[jobs_by_pk.class] } }
|
||||
: {}),
|
||||
ItemRef: {
|
||||
value: items["PVRT"],
|
||||
},
|
||||
|
||||
@@ -181,11 +181,9 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
|
||||
TxnDate: moment(bill.date).format("YYYY-MM-DD"),
|
||||
//DueDate: bill.due_date && moment(bill.due_date).format("YYYY-MM-DD"),
|
||||
DocNumber: bill.invoice_number,
|
||||
...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}),
|
||||
//...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}),
|
||||
|
||||
PrivateNote: `RO ${bill.job.ro_number || ""} OWNER ${
|
||||
bill.job.ownr_fn || ""
|
||||
} ${bill.job.ownr_ln || ""} ${bill.job.ownr_co_nm || ""}`,
|
||||
PrivateNote: `RO ${bill.job.ro_number || ""}`,
|
||||
Line: bill.billlines.map((il) =>
|
||||
generateBillLine(
|
||||
il,
|
||||
@@ -249,12 +247,11 @@ const generateBillLine = (
|
||||
) => {
|
||||
const account = costCenters.find((c) => c.name === billLine.cost_center);
|
||||
|
||||
console.log(account.accountname, accounts[account.accountname]);
|
||||
return {
|
||||
DetailType: "AccountBasedExpenseLineDetail",
|
||||
|
||||
AccountBasedExpenseLineDetail: {
|
||||
...(jobClass ? { ClassRef: { Id: classes[jobClass] } } : {}),
|
||||
...(jobClass ? { ClassRef: { value: classes[jobClass] } } : {}),
|
||||
TaxCodeRef: {
|
||||
value:
|
||||
taxCodes[findTaxCode(billLine.applicable_taxes, ioSalesTaxCodes)],
|
||||
@@ -324,7 +321,7 @@ async function QueryMetaData(oauthClient, qbo_realmId, req) {
|
||||
classes.json.QueryResponse &&
|
||||
classes.json.QueryResponse.Class &&
|
||||
classes.json.QueryResponse.Class.forEach((t) => {
|
||||
accountMapping[t.Name] = t.Id;
|
||||
classMapping[t.Name] = t.Id;
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -356,7 +356,11 @@ async function InsertJob(oauthClient, qbo_realmId, req, job, parentTierRef) {
|
||||
exports.InsertJob = InsertJob;
|
||||
async function QueryMetaData(oauthClient, qbo_realmId, req) {
|
||||
const items = await oauthClient.makeApiCall({
|
||||
url: urlBuilder(qbo_realmId, "query", `select * From Item`),
|
||||
url: urlBuilder(
|
||||
qbo_realmId,
|
||||
"query",
|
||||
`select * From Item where active=true maxresults 1000`
|
||||
),
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -402,7 +406,7 @@ async function QueryMetaData(oauthClient, qbo_realmId, req) {
|
||||
classes.json.QueryResponse &&
|
||||
classes.json.QueryResponse.Class &&
|
||||
classes.json.QueryResponse.Class.forEach((t) => {
|
||||
itemMapping[t.Name] = t.Id;
|
||||
classMapping[t.Name] = t.Id;
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -431,13 +435,21 @@ async function InsertInvoice(
|
||||
qbo: true,
|
||||
items,
|
||||
taxCodes,
|
||||
classes,
|
||||
});
|
||||
|
||||
const invoiceObj = {
|
||||
Line: InvoiceLineAdd,
|
||||
TxnDate: moment(job.date_invoiced).format("YYYY-MM-DD"),
|
||||
DocNumber: job.ro_number,
|
||||
...(job.class ? { ClassRef: { Id: classes[job.class] } } : {}),
|
||||
...(job.class ? { ClassRef: { value: classes[job.class] } } : {}),
|
||||
CustomerMemo: {
|
||||
value: `${job.clm_no ? `Claim No: ${job.clm_no}` : ``}${
|
||||
job.po_number ? `PO No: ${job.po_number}` : ``
|
||||
} Vehicle:${job.v_model_yr || ""} ${job.v_make_desc || ""} ${
|
||||
job.v_model_desc || ""
|
||||
} ${job.v_vin || ""} ${job.plate_no || ""} `.trim(),
|
||||
},
|
||||
CustomerRef: {
|
||||
value: parentTierRef.Id,
|
||||
},
|
||||
@@ -447,6 +459,15 @@ async function InsertInvoice(
|
||||
...(bodyshop.accountingconfig.emaillater && job.ownr_ea
|
||||
? { EmailStatus: "NeedToSend" }
|
||||
: {}),
|
||||
BillAddr: {
|
||||
Line3: `${job.ownr_city || ""}, ${job.ownr_st || ""} ${
|
||||
job.ownr_zip || ""
|
||||
}`.trim(),
|
||||
Line2: job.ownr_addr1 || "",
|
||||
Line1: `${job.ownr_fn || ""} ${job.ownr_ln || ""} ${
|
||||
job.ownr_co_nm || ""
|
||||
}`,
|
||||
},
|
||||
};
|
||||
|
||||
logger.log("qbo-receivable-objectlog", "DEBUG", req.user.email, job.id, {
|
||||
|
||||
@@ -76,9 +76,7 @@ const generateBill = (bill) => {
|
||||
DueDate:
|
||||
bill.due_date && moment(bill.due_date).format("YYYY-MM-DD"),
|
||||
RefNumber: bill.invoice_number,
|
||||
Memo: `RO ${bill.job.ro_number || ""} OWNER ${
|
||||
bill.job.ownr_fn || ""
|
||||
} ${bill.job.ownr_ln || ""} ${bill.job.ownr_co_nm || ""}`,
|
||||
Memo: `RO ${bill.job.ro_number || ""}`,
|
||||
ExpenseLineAdd: bill.billlines.map((il) =>
|
||||
generateBillLine(
|
||||
il,
|
||||
|
||||
@@ -72,7 +72,9 @@ exports.default = async function (socket, jobid) {
|
||||
|
||||
if (
|
||||
(val.prt_dsmk_p && val.prt_dsmk_p !== 0) ||
|
||||
((val.db_ref === "900511" || val.db_ref === "900510") &&
|
||||
((val.db_ref === "900511" ||
|
||||
val.db_ref === "900510" ||
|
||||
val.db_ref === "900500") &&
|
||||
val.prt_dsmk_m &&
|
||||
val.prt_dsmk_m !== 0)
|
||||
) {
|
||||
|
||||
@@ -2,6 +2,7 @@ const path = require("path");
|
||||
const queries = require("../graphql-client/queries");
|
||||
const Dinero = require("dinero.js");
|
||||
const moment = require("moment");
|
||||
const fs = require("fs");
|
||||
|
||||
const _ = require("lodash");
|
||||
const logger = require("../utils/logger");
|
||||
@@ -28,7 +29,6 @@ exports.default = async (req, res) => {
|
||||
logger.log("arms-start", "DEBUG", "api", null, null);
|
||||
const { bodyshops } = await client.request(queries.GET_ENTEGRAL_SHOPS);
|
||||
|
||||
const allxmlsToUpload = [];
|
||||
const allErrors = [];
|
||||
try {
|
||||
for (const bodyshop of bodyshops) {
|
||||
@@ -40,10 +40,12 @@ exports.default = async (req, res) => {
|
||||
const { jobs } = await client.request(queries.ENTEGRAL_EXPORT, {
|
||||
bodyshopid: bodyshop.id,
|
||||
});
|
||||
const ret = jobs.map((job) => {
|
||||
const jobsToPush = [];
|
||||
|
||||
jobs.forEach((job) => {
|
||||
const transId = uuid(); // Can this actually be the job id?
|
||||
|
||||
return {
|
||||
let obj = {
|
||||
RqUID: transId,
|
||||
DocumentInfo: {
|
||||
BMSVer: "4.0.0",
|
||||
@@ -55,16 +57,18 @@ exports.default = async (req, res) => {
|
||||
TransmitDateTime: moment().format(momentFormat), // Omitted from ARMS docs
|
||||
},
|
||||
EventInfo: {
|
||||
AssignmentEvent: {
|
||||
CreateDateTime:
|
||||
job.asgn_date && moment(job.asgn_date).format(momentFormat),
|
||||
},
|
||||
EstimateEvent: {
|
||||
UploadDateTime: moment().format(momentFormat),
|
||||
},
|
||||
// AssignmentEvent: {
|
||||
// CreateDateTime:
|
||||
// job.asgn_date && moment(job.asgn_date).format(momentFormat),
|
||||
// },
|
||||
// EstimateEvent: {
|
||||
// UploadDateTime: moment().format(momentFormat),
|
||||
// },
|
||||
RepairEvent: {
|
||||
CreatedDateTime:
|
||||
job.date_open && moment(job.date_open).format(momentFormat),
|
||||
CreatedDateTime: (job.date_open
|
||||
? moment(job.date_open)
|
||||
: moment()
|
||||
).format(momentFormat),
|
||||
ArrivalDateTime:
|
||||
job.actual_in && moment(job.actual_in).format(momentFormat),
|
||||
ArrivalOdometerReading: job.kmin,
|
||||
@@ -92,35 +96,35 @@ exports.default = async (req, res) => {
|
||||
IDQualifierCode: "US",
|
||||
IDNum: 44, // ** Not sure where to get this entegral ID from?
|
||||
},
|
||||
Communications: [
|
||||
{
|
||||
CommQualifier: "WA",
|
||||
Address: {
|
||||
Address1: job.ins_addr1,
|
||||
Address2: job.ins_addr2,
|
||||
City: job.ins_city,
|
||||
StateProvince: job.ins_st,
|
||||
PostalCode: job.ins_zip,
|
||||
CountryCode: job.ins_ctry,
|
||||
},
|
||||
},
|
||||
{
|
||||
CommQualifier: "WP",
|
||||
CommPhone: job.ins_ph1,
|
||||
},
|
||||
{
|
||||
CommQualifier: "WF",
|
||||
CommPhone: job.ins_ph2,
|
||||
},
|
||||
],
|
||||
},
|
||||
ContactInfo: {
|
||||
ContactJobTitle: "Adjuster",
|
||||
ContactName: {
|
||||
FirstName: job.est_ct_fn,
|
||||
LastName: job.est_ct_ln,
|
||||
},
|
||||
// Communications: [
|
||||
// {
|
||||
// CommQualifier: "WA",
|
||||
// Address: {
|
||||
// Address1: job.ins_addr1,
|
||||
// Address2: job.ins_addr2,
|
||||
// City: job.ins_city,
|
||||
// StateProvince: job.ins_st,
|
||||
// PostalCode: job.ins_zip,
|
||||
// CountryCode: job.ins_ctry,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// CommQualifier: "WP",
|
||||
// CommPhone: job.ins_ph1,
|
||||
// },
|
||||
// {
|
||||
// CommQualifier: "WF",
|
||||
// CommPhone: job.ins_ph2,
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
// ContactInfo: {
|
||||
// ContactJobTitle: "Adjuster",
|
||||
// ContactName: {
|
||||
// FirstName: job.est_ct_fn,
|
||||
// LastName: job.est_ct_ln,
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
// InsuranceAgent: {
|
||||
@@ -141,16 +145,16 @@ exports.default = async (req, res) => {
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
Insured: {
|
||||
Party: {
|
||||
PersonInfo: {
|
||||
PersonName: {
|
||||
FirstName: job.insd_fn,
|
||||
LastName: job.insd_ln,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
// Insured: {
|
||||
// Party: {
|
||||
// PersonInfo: {
|
||||
// PersonName: {
|
||||
// FirstName: job.insd_fn,
|
||||
// LastName: job.insd_ln,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
Owner: {
|
||||
Party: {
|
||||
PersonInfo: {
|
||||
@@ -158,68 +162,70 @@ exports.default = async (req, res) => {
|
||||
FirstName: job.ownr_fn,
|
||||
LastName: job.ownr_ln,
|
||||
},
|
||||
Communications: [
|
||||
{
|
||||
CommQualifier: "HA",
|
||||
Address: {
|
||||
Address1: job.ownr_addr1,
|
||||
// Communications: [
|
||||
// {
|
||||
// CommQualifier: "HA",
|
||||
// Address: {
|
||||
// Address1: job.ownr_addr1,
|
||||
|
||||
City: job.ownr_city,
|
||||
StateProvince: job.ownr_st,
|
||||
PostalCode: job.ownr_zip,
|
||||
CountryCode: job.ownr_ctry,
|
||||
},
|
||||
},
|
||||
{
|
||||
CommQualifier: "HP",
|
||||
CommPhone: job.ownr_ph1,
|
||||
},
|
||||
{
|
||||
CommQualifier: "WP",
|
||||
CommPhone: job.ownr_ph2,
|
||||
},
|
||||
{
|
||||
CommQualifier: "CP",
|
||||
CommPhone: job.ownr_ph1,
|
||||
},
|
||||
{
|
||||
CommQualifier: "EM",
|
||||
CommEmail: job.ownr_ea,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Claimant: {
|
||||
Party: {
|
||||
PersonInfo: {
|
||||
PersonName: {
|
||||
FirstName: job.clm_ct_fn,
|
||||
LastName: job.clm_ct_ln,
|
||||
},
|
||||
},
|
||||
},
|
||||
OwnerInd: true,
|
||||
},
|
||||
Estimator: {
|
||||
Party: {
|
||||
PersonInfo: {
|
||||
PersonName: {
|
||||
FirstName: job.est_ct_fn,
|
||||
LastName: job.est_ct_ln,
|
||||
},
|
||||
// IDInfo: {
|
||||
// IDQualifierCode: "US",
|
||||
// IDNum: 2941,
|
||||
// },
|
||||
// City: job.ownr_city,
|
||||
// StateProvince: job.ownr_st,
|
||||
// PostalCode: job.ownr_zip,
|
||||
// CountryCode: job.ownr_ctry,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// CommQualifier: "HP",
|
||||
// CommPhone: job.ownr_ph1,
|
||||
// },
|
||||
// {
|
||||
// CommQualifier: "WP",
|
||||
// CommPhone: job.ownr_ph2,
|
||||
// },
|
||||
// {
|
||||
// CommQualifier: "CP",
|
||||
// CommPhone: job.ownr_ph1,
|
||||
// },
|
||||
// {
|
||||
// CommQualifier: "EM",
|
||||
// CommEmail: job.ownr_ea,
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
},
|
||||
},
|
||||
// Claimant: {
|
||||
// Party: {
|
||||
// PersonInfo: {
|
||||
// PersonName: {
|
||||
// FirstName: job.clm_ct_fn,
|
||||
// LastName: job.clm_ct_ln,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// OwnerInd: true,
|
||||
// },
|
||||
// Estimator: {
|
||||
// Party: {
|
||||
// PersonInfo: {
|
||||
// PersonName: {
|
||||
// FirstName: job.est_ct_fn,
|
||||
// LastName: job.est_ct_ln,
|
||||
// },
|
||||
// // IDInfo: {
|
||||
// // IDQualifierCode: "US",
|
||||
// // IDNum: 2941,
|
||||
// // },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
RepairFacility: {
|
||||
//This section not in documentation.
|
||||
Party: {
|
||||
OrgInfo: {
|
||||
CompanyName: bodyshop.shopname,
|
||||
CompanyName:
|
||||
process.env.NODE_ENV === "production"
|
||||
? bodyshop.shopname
|
||||
: "IMEX Test Shop",
|
||||
IDInfo: {
|
||||
IDQualifierCode: "US",
|
||||
IDNum: bodyshop.entegral_id,
|
||||
@@ -233,7 +239,7 @@ exports.default = async (req, res) => {
|
||||
// VendorCode: "C",
|
||||
// EstimateDocumentID: "1223HJ76",
|
||||
},
|
||||
//RepairOrderType: "DRP",
|
||||
RepairOrderType: "DirectRepairProgram", //Need to get from Entegral
|
||||
//ReferralSourceType: "Yellow Pages",
|
||||
VehicleInfo: {
|
||||
VINInfo: {
|
||||
@@ -241,9 +247,9 @@ exports.default = async (req, res) => {
|
||||
VINNum: job.v_vin,
|
||||
},
|
||||
},
|
||||
License: {
|
||||
LicensePlateNum: job.plate_no,
|
||||
},
|
||||
// License: {
|
||||
// LicensePlateNum: job.plate_no,
|
||||
// },
|
||||
VehicleDesc: {
|
||||
//ProductionDate: "2009-10",
|
||||
ModelYear:
|
||||
@@ -255,23 +261,23 @@ exports.default = async (req, res) => {
|
||||
MakeDesc: job.v_make_desc,
|
||||
ModelName: job.v_model_desc,
|
||||
},
|
||||
Paint: {
|
||||
Exterior: {
|
||||
Color: {
|
||||
ColorName: job.v_color,
|
||||
// OEMColorCode: "1M3",
|
||||
},
|
||||
},
|
||||
},
|
||||
// Paint: {
|
||||
// Exterior: {
|
||||
// Color: {
|
||||
// ColorName: job.v_color,
|
||||
// // OEMColorCode: "1M3",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Body: {
|
||||
// BodyStyle: "2 Door Convertible",
|
||||
// Trim: {
|
||||
// TrimCode: "1B3",
|
||||
// },
|
||||
// },
|
||||
Condition: {
|
||||
DrivableInd: job.driveable ? "Y" : "N",
|
||||
},
|
||||
// Condition: {
|
||||
// DrivableInd: job.driveable ? "Y" : "N",
|
||||
// },
|
||||
},
|
||||
ClaimInfo: {
|
||||
ClaimNum: job.clm_no,
|
||||
@@ -296,7 +302,7 @@ exports.default = async (req, res) => {
|
||||
},
|
||||
},
|
||||
ProfileInfo: {
|
||||
//ProfileName: "Shop Standard Rates",
|
||||
ProfileName: "ImEX",
|
||||
RateInfo: [
|
||||
{
|
||||
RateType: "PA",
|
||||
@@ -306,7 +312,7 @@ exports.default = async (req, res) => {
|
||||
TaxableInd: true,
|
||||
TaxTierInfo: {
|
||||
TierNum: 1,
|
||||
Percentage: 0, //TODO Find the best place to take the tax rates for parts.
|
||||
Percentage: job.parts_tax_rates.PAN.prt_tax_rt * 100, //TODO Find the best place to take the tax rates for parts.
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -318,7 +324,7 @@ exports.default = async (req, res) => {
|
||||
TaxableInd: true,
|
||||
TaxTierInfo: {
|
||||
TierNum: 1,
|
||||
Percentage: 0, //TODO Find the best place to take the tax rates for labor.
|
||||
Percentage: job.parts_tax_rates.PAN.prt_tax_rt * 100, //TODO Find the best place to take the tax rates for labor.
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -495,56 +501,56 @@ exports.default = async (req, res) => {
|
||||
TotalType: "PAA",
|
||||
TotalTypeDesc: "Aftermarket Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.paa &&
|
||||
job.job_totals.parts.parts.list.paa.total
|
||||
job.job_totals.parts.parts.list.PAA &&
|
||||
job.job_totals.parts.parts.list.PAA.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAC",
|
||||
TotalTypeDesc: "Re-Chromed Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pac &&
|
||||
job.job_totals.parts.parts.list.pac.total
|
||||
job.job_totals.parts.parts.list.PAC &&
|
||||
job.job_totals.parts.parts.list.PAC.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAG",
|
||||
TotalTypeDesc: "Glass Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pag &&
|
||||
job.job_totals.parts.parts.list.pag.total
|
||||
job.job_totals.parts.parts.list.PAG &&
|
||||
job.job_totals.parts.parts.list.PAG.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAL",
|
||||
TotalTypeDesc: "LKQ/Used Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pal &&
|
||||
job.job_totals.parts.parts.list.pal.total
|
||||
job.job_totals.parts.parts.list.PAL &&
|
||||
job.job_totals.parts.parts.list.PAL.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAM",
|
||||
TotalTypeDesc: "Remanufactured Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pam &&
|
||||
job.job_totals.parts.parts.list.pam.total
|
||||
job.job_totals.parts.parts.list.PAM &&
|
||||
job.job_totals.parts.parts.list.PAM.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAN",
|
||||
TotalTypeDesc: "New Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pan &&
|
||||
job.job_totals.parts.parts.list.pan.total
|
||||
job.job_totals.parts.parts.list.PAN &&
|
||||
job.job_totals.parts.parts.list.PAN.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAR",
|
||||
TotalTypeDesc: "Recored Parts",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.par &&
|
||||
job.job_totals.parts.parts.list.par.total
|
||||
job.job_totals.parts.parts.list.PAR &&
|
||||
job.job_totals.parts.parts.list.PAR.total
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
],
|
||||
@@ -616,6 +622,14 @@ exports.default = async (req, res) => {
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "SM",
|
||||
TotalTypeDesc: "Supplement Total",
|
||||
TotalAmt: job.cieca_ttl
|
||||
? job.cieca_ttl.data.supp_amt
|
||||
: Dinero().toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "F7",
|
||||
@@ -632,12 +646,14 @@ exports.default = async (req, res) => {
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
// {
|
||||
// TotalType: "TOT",
|
||||
// TotalSubType: "SM",
|
||||
// TotalTypeDesc: "Supplement Total",
|
||||
// TotalAmt: 0,
|
||||
// },
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "D8",
|
||||
TotalTypeDesc: "Bottom Line Discount",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.additional.adjustments
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "D2",
|
||||
@@ -658,15 +674,13 @@ exports.default = async (req, res) => {
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "AA",
|
||||
TotalTypeDesc: "Appearance Allowance",
|
||||
TotalAmt: 0,
|
||||
TotalAmt: Dinero().toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "D8",
|
||||
TotalTypeDesc: "Bottom Line Discount",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.additional.adjustments
|
||||
).toFormat("0.00"),
|
||||
TotalSubType: "DEPOSIT",
|
||||
TotalTypeDesc: "Deposit",
|
||||
TotalAmt: Dinero().toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
@@ -676,12 +690,6 @@ exports.default = async (req, res) => {
|
||||
.subtract(Dinero(job.job_totals.totals.custPayable.total))
|
||||
.toFormat("0.00"),
|
||||
},
|
||||
// {
|
||||
// TotalType: "TOT",
|
||||
// TotalSubType: "DEPOSIT",
|
||||
// TotalTypeDesc: "Deposit",
|
||||
// TotalAmt: 0,
|
||||
// },
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "CUST",
|
||||
@@ -691,7 +699,7 @@ exports.default = async (req, res) => {
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
],
|
||||
RepairTotalsType: 1,
|
||||
// RepairTotalsType: 1,
|
||||
},
|
||||
// RepairLabor: {
|
||||
// LaborAllocations: {
|
||||
@@ -741,7 +749,7 @@ exports.default = async (req, res) => {
|
||||
// },
|
||||
ProductionStatus: {
|
||||
ProductionStage: {
|
||||
ProductionStageCode: GetProductionStageCode(job),
|
||||
ProductionStageCode: GetProductionStageCode(job, bodyshop),
|
||||
ProductionStageDateTime: moment().format(momentFormat),
|
||||
// ProductionStageStatusComment:
|
||||
// "Going to be painted this afternoon",
|
||||
@@ -777,6 +785,9 @@ exports.default = async (req, res) => {
|
||||
// },
|
||||
// },
|
||||
};
|
||||
|
||||
deleteNullKeys(obj);
|
||||
jobsToPush.push(obj);
|
||||
});
|
||||
|
||||
if (erroredJobs.length > 0) {
|
||||
@@ -784,13 +795,12 @@ exports.default = async (req, res) => {
|
||||
count: erroredJobs.length,
|
||||
jobs: JSON.stringify(erroredJobs.map((j) => j.job.ro_number)),
|
||||
});
|
||||
allErrors = [...allErrors, ...erroredJobs];
|
||||
}
|
||||
|
||||
logger.log("arms-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
||||
shopname: bodyshop.shopname,
|
||||
});
|
||||
const abc = ret[1];
|
||||
deleteNullKeys(abc);
|
||||
|
||||
try {
|
||||
const entegralSoapClient = await soap.createClientAsync(
|
||||
@@ -798,7 +808,7 @@ exports.default = async (req, res) => {
|
||||
{
|
||||
ignoredNamespaces: true,
|
||||
wsdl_options: {
|
||||
useEmptyTag: true,
|
||||
// useEmptyTag: true,
|
||||
},
|
||||
wsdl_headers: {
|
||||
Authorization: `Basic ${new Buffer.from(
|
||||
@@ -816,14 +826,20 @@ exports.default = async (req, res) => {
|
||||
);
|
||||
|
||||
const entegralResponse =
|
||||
await entegralSoapClient.RepairOrderFolderAddRqAsync(abc);
|
||||
await entegralSoapClient.RepairOrderFolderAddRqAsync(
|
||||
jobsToPush,
|
||||
function (err, result, rawResponse, soapHeader, rawRequest) {
|
||||
fs.writeFileSync(`./logs/arms-request.xml`, rawRequest);
|
||||
fs.writeFileSync(`./logs/arms-response.xml`, rawResponse);
|
||||
|
||||
res.json(err || result);
|
||||
}
|
||||
);
|
||||
|
||||
const [result, rawResponse, , rawRequest] = entegralResponse;
|
||||
console.log("🚀 ~ file: arms.js ~ line 806 ~ result", result);
|
||||
res.json({ result, obj: abc });
|
||||
} catch (error) {
|
||||
fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml);
|
||||
console.log(error);
|
||||
res.json(error);
|
||||
}
|
||||
} catch (error) {
|
||||
//Error at the shop level.
|
||||
@@ -846,15 +862,18 @@ exports.default = async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
// res.sendStatus(200);
|
||||
res.sendStatus(200);
|
||||
} catch (error) {
|
||||
res.status(200).json(error);
|
||||
}
|
||||
};
|
||||
|
||||
function GetSupplementNumber(joblines) {
|
||||
return 0;
|
||||
return _.max(joblines.map((jl) => jl.line_ind));
|
||||
const max = _.max(
|
||||
joblines.map((jl) => parseInt((jl.line_ind || "0").replace(/[^\d.-]/g, "")))
|
||||
);
|
||||
|
||||
return max || 0;
|
||||
}
|
||||
|
||||
function GetDocumentstatus(job, bodyshop) {
|
||||
@@ -873,7 +892,9 @@ function GetDocumentstatus(job, bodyshop) {
|
||||
function GetRepairStatusCode(job) {
|
||||
return "25";
|
||||
}
|
||||
function GetProductionStageCode(job) {
|
||||
function GetProductionStageCode(job, bodyshop) {
|
||||
if (bodyshop.md_ro_statuses.post_production_statuses.includes(job.status))
|
||||
return "8D";
|
||||
return "33";
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user