Compare commits
35 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a16df36dd | ||
|
|
7ba3ed2b89 | ||
|
|
2cc0b7d741 | ||
|
|
97693fbcff | ||
|
|
5e94b1a71e | ||
|
|
970275e62a | ||
|
|
aa076da255 | ||
|
|
3dd154de79 | ||
|
|
72a2366abe | ||
|
|
36f517e8e1 | ||
|
|
981fb57d36 | ||
|
|
a059c2b5a8 | ||
|
|
207bb39672 | ||
|
|
16e34e4ed9 | ||
|
|
cd04f2b2b2 | ||
|
|
26e164b4d1 | ||
|
|
ae6b2fe4f5 | ||
|
|
4ca686126a | ||
|
|
c254a8abfe | ||
|
|
f864e40a90 | ||
|
|
6cb4fd6b93 | ||
|
|
70ca6edcb2 | ||
|
|
9dcc861740 | ||
|
|
fecb7fb24b | ||
|
|
c5b94db8af | ||
|
|
6690c9c692 | ||
|
|
506edcb3c6 | ||
|
|
c45e53e38b | ||
|
|
d8d8a4701e | ||
|
|
970c4ee9e1 | ||
|
|
c2386f43ef | ||
|
|
0fd3e75862 | ||
|
|
fcd3234fd9 | ||
|
|
2afa810e6c | ||
|
|
ff33b924b2 |
@@ -1,7 +1,7 @@
|
|||||||
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
|
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
|
||||||
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
|
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
|
||||||
VITE_APP_GA_CODE=231099835
|
VITE_APP_GA_CODE=231099835
|
||||||
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
|
||||||
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
|
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
|
||||||
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
|
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
|
||||||
VITE_APP_CLOUDINARY_API_KEY=957865933348715
|
VITE_APP_CLOUDINARY_API_KEY=957865933348715
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import { connect } from "react-redux";
|
|||||||
import { Route, Routes } from "react-router-dom";
|
import { Route, Routes } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import DocumentEditorContainer from "../components/document-editor/document-editor.container";
|
import DocumentEditorContainer from "../components/document-editor/document-editor.container";
|
||||||
import ErrorBoundary from "../components/error-boundary/error-boundary.component";
|
import ErrorBoundary from "../components/error-boundary/error-boundary.component"; // Component Imports
|
||||||
|
|
||||||
//Component Imports
|
|
||||||
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
|
||||||
import DisclaimerPage from "../pages/disclaimer/disclaimer.page";
|
import DisclaimerPage from "../pages/disclaimer/disclaimer.page";
|
||||||
import LandingPage from "../pages/landing/landing.page";
|
import LandingPage from "../pages/landing/landing.page";
|
||||||
@@ -23,20 +21,21 @@ import "./App.styles.scss";
|
|||||||
import handleBeta from "../utils/betaHandler";
|
import handleBeta from "../utils/betaHandler";
|
||||||
import Eula from "../components/eula/eula.component";
|
import Eula from "../components/eula/eula.component";
|
||||||
import InstanceRenderMgr from "../utils/instanceRenderMgr";
|
import InstanceRenderMgr from "../utils/instanceRenderMgr";
|
||||||
import { ProductFruits } from "react-product-fruits";
|
import ProductFruitsWrapper from "./ProductFruitsWrapper.jsx";
|
||||||
|
|
||||||
const ResetPassword = lazy(() => import("../pages/reset-password/reset-password.component"));
|
const ResetPassword = lazy(() => import("../pages/reset-password/reset-password.component"));
|
||||||
const ManagePage = lazy(() => import("../pages/manage/manage.page.container"));
|
const ManagePage = lazy(() => import("../pages/manage/manage.page.container"));
|
||||||
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
|
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
|
||||||
|
|
||||||
const CsiPage = lazy(() => import("../pages/csi/csi.container.page"));
|
const CsiPage = lazy(() => import("../pages/csi/csi.container.page"));
|
||||||
const MobilePaymentContainer = lazy(() => import("../pages/mobile-payment/mobile-payment.container"));
|
const MobilePaymentContainer = lazy(() => import("../pages/mobile-payment/mobile-payment.container"));
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
online: selectOnline,
|
online: selectOnline,
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
currentEula: selectCurrentEula
|
currentEula: selectCurrentEula
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
checkUserSession: () => dispatch(checkUserSession()),
|
checkUserSession: () => dispatch(checkUserSession()),
|
||||||
setOnline: (isOnline) => dispatch(setOnline(isOnline))
|
setOnline: (isOnline) => dispatch(setOnline(isOnline))
|
||||||
@@ -60,11 +59,11 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
|||||||
|
|
||||||
// Associate event listeners, memoize to prevent multiple listeners being added
|
// Associate event listeners, memoize to prevent multiple listeners being added
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const offlineListener = (e) => {
|
const offlineListener = () => {
|
||||||
setOnline(false);
|
setOnline(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onlineListener = (e) => {
|
const onlineListener = () => {
|
||||||
setOnline(true);
|
setOnline(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -111,24 +110,20 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
|||||||
|
|
||||||
handleBeta();
|
handleBeta();
|
||||||
|
|
||||||
if (!online)
|
if (!online) {
|
||||||
return (
|
return (
|
||||||
<Result
|
<Result
|
||||||
status="warning"
|
status="warning"
|
||||||
title={t("general.labels.nointernet")}
|
title={t("general.labels.nointernet")}
|
||||||
subTitle={t("general.labels.nointernet_sub")}
|
subTitle={t("general.labels.nointernet_sub")}
|
||||||
extra={
|
extra={
|
||||||
<Button
|
<Button type="primary" onClick={() => window.location.reload()}>
|
||||||
type="primary"
|
|
||||||
onClick={() => {
|
|
||||||
window.location.reload();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("general.actions.refresh")}
|
{t("general.actions.refresh")}
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (currentEula && !currentUser.eulaIsAccepted) {
|
if (currentEula && !currentUser.eulaIsAccepted) {
|
||||||
return <Eula />;
|
return <Eula />;
|
||||||
@@ -147,18 +142,13 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ProductFruits
|
<ProductFruitsWrapper
|
||||||
|
currentUser={currentUser}
|
||||||
workspaceCode={InstanceRenderMgr({
|
workspaceCode={InstanceRenderMgr({
|
||||||
imex: null,
|
imex: null,
|
||||||
rome: "9BkbEseqNqxw8jUH",
|
rome: "9BkbEseqNqxw8jUH",
|
||||||
promanager: "aoJoEifvezYI0Z0P"
|
promanager: "aoJoEifvezYI0Z0P"
|
||||||
})}
|
})}
|
||||||
debug
|
|
||||||
language="en"
|
|
||||||
user={{
|
|
||||||
email: currentUser.email,
|
|
||||||
username: currentUser.email
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Routes>
|
<Routes>
|
||||||
|
|||||||
32
client/src/App/ProductFruitsWrapper.jsx
Normal file
32
client/src/App/ProductFruitsWrapper.jsx
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { ProductFruits } from "react-product-fruits";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
const ProductFruitsWrapper = React.memo(({ currentUser, workspaceCode }) => {
|
||||||
|
return (
|
||||||
|
workspaceCode &&
|
||||||
|
currentUser?.authorized === true &&
|
||||||
|
currentUser?.email && (
|
||||||
|
<ProductFruits
|
||||||
|
lifeCycle="unmount"
|
||||||
|
workspaceCode={workspaceCode}
|
||||||
|
debug
|
||||||
|
language="en"
|
||||||
|
user={{
|
||||||
|
email: currentUser.email,
|
||||||
|
username: currentUser.email
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ProductFruitsWrapper;
|
||||||
|
|
||||||
|
ProductFruitsWrapper.propTypes = {
|
||||||
|
currentUser: PropTypes.shape({
|
||||||
|
authorized: PropTypes.bool,
|
||||||
|
email: PropTypes.string
|
||||||
|
}).isRequired,
|
||||||
|
workspaceCode: PropTypes.string.isRequired
|
||||||
|
};
|
||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
Typography
|
Typography
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
import dayjs from "../../utils/day";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -22,6 +21,7 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { determineDmsType } from "../../pages/dms/dms.container";
|
import { determineDmsType } from "../../pages/dms/dms.container";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import i18n from "../../translations/i18n";
|
import i18n from "../../translations/i18n";
|
||||||
|
import dayjs from "../../utils/day";
|
||||||
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
||||||
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
|
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
@@ -89,7 +89,7 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
|||||||
job.area_of_damage && job.area_of_damage.impact1
|
job.area_of_damage && job.area_of_damage.impact1
|
||||||
? " " +
|
? " " +
|
||||||
t("jobs.labels.dms.damageto", {
|
t("jobs.labels.dms.damageto", {
|
||||||
area_of_damage: (job.area_of_damage && job.area_of_damage.impact1) || "UNKNOWN"
|
area_of_damage: (job.area_of_damage && job.area_of_damage.impact1.padStart(2, "0")) || "UNKNOWN"
|
||||||
})
|
})
|
||||||
: ""
|
: ""
|
||||||
}`.slice(0, 239),
|
}`.slice(0, 239),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
|
||||||
import { LockOutlined } from "@ant-design/icons";
|
import { LockOutlined } from "@ant-design/icons";
|
||||||
import { Badge, Card, Col, Collapse, Form, Input, Row, Space, Tooltip } from "antd";
|
import { Badge, Card, Col, Collapse, Form, Input, Row, Space, Tooltip } from "antd";
|
||||||
|
import React, { useCallback, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -12,9 +12,9 @@ import JobCloseRoGuardBills from "./job-close-ro-guard.bills";
|
|||||||
import JobCloseRoGuardPpd from "./job-close-ro-guard.ppd";
|
import JobCloseRoGuardPpd from "./job-close-ro-guard.ppd";
|
||||||
import JobCloseRoGuardProfit from "./job-close-ro-guard.profit";
|
import JobCloseRoGuardProfit from "./job-close-ro-guard.profit";
|
||||||
import "./job-close-ro-guard.styles.scss";
|
import "./job-close-ro-guard.styles.scss";
|
||||||
import JobCloseRoGuardSublet from "./job-close-ro-guard.sublet";
|
// import JobCloseRoGuardSublet from "./job-close-ro-guard.sublet";
|
||||||
import JobCloseRoGuardTtLifecycle from "./job-close-ro-guard.tt-lifecycle";
|
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
|
import JobCloseRoGuardTtLifecycle from "./job-close-ro-guard.tt-lifecycle";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CardTemplate from "./job-detail-cards.template.component";
|
|
||||||
import Car from "../job-damage-visual/job-damage-visual.component";
|
import Car from "../job-damage-visual/job-damage-visual.component";
|
||||||
|
import CardTemplate from "./job-detail-cards.template.component";
|
||||||
|
|
||||||
export default function JobDetailCardsDamageComponent({ loading, data }) {
|
export default function JobDetailCardsDamageComponent({ loading, data }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { area_of_damage } = data;
|
const { area_of_damage } = data;
|
||||||
return (
|
return (
|
||||||
<CardTemplate loading={loading} title={t("jobs.labels.cards.damage")}>
|
<CardTemplate loading={loading} title={t("jobs.labels.cards.damage")}>
|
||||||
{area_of_damage ? <Car dmg1={area_of_damage.impact1} dmg2={area_of_damage.impact2} /> : t("jobs.errors.nodamage")}
|
{area_of_damage ? (
|
||||||
|
<Car
|
||||||
|
dmg1={area_of_damage.impact1 && area_of_damage.impact1.padStart(2, "0")}
|
||||||
|
dmg2={area_of_damage.impact2 && area_of_damage.impact2.padStart(2, "0")}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
t("jobs.errors.nodamage")
|
||||||
|
)}
|
||||||
</CardTemplate>
|
</CardTemplate>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,16 @@ export function JobDetailCardsPartsComponent({ loading, data, jobRO }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { joblines_status } = data;
|
const { joblines_status } = data;
|
||||||
|
|
||||||
|
const filteredJobLines = data.joblines.filter(
|
||||||
|
(j) =>
|
||||||
|
j.part_type !== null &&
|
||||||
|
j.part_type !== "PAE" &&
|
||||||
|
j.part_type !== "PAS" &&
|
||||||
|
j.part_type !== "PASL" &&
|
||||||
|
j.part_qty !== 0 &&
|
||||||
|
j.act_price !== 0
|
||||||
|
);
|
||||||
|
//TODO: Correct jobline_statuses view by including the part_qty !== 0 and act_price !== 0
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("joblines.fields.line_desc"),
|
title: t("joblines.fields.line_desc"),
|
||||||
@@ -95,7 +105,7 @@ export function JobDetailCardsPartsComponent({ loading, data, jobRO }) {
|
|||||||
<div>
|
<div>
|
||||||
<CardTemplate loading={loading} title={t("jobs.labels.cards.parts")}>
|
<CardTemplate loading={loading} title={t("jobs.labels.cards.parts")}>
|
||||||
<PartsStatusPie joblines_status={joblines_status} />
|
<PartsStatusPie joblines_status={joblines_status} />
|
||||||
<Table key="id" columns={columns} dataSource={data ? data.joblines : []} />
|
<Table key="id" columns={columns} dataSource={filteredJobLines ? filteredJobLines : []} />
|
||||||
</CardTemplate>
|
</CardTemplate>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -189,7 +189,10 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col {...lossColDamage}>
|
<Col {...lossColDamage}>
|
||||||
{job.area_of_damage ? (
|
{job.area_of_damage ? (
|
||||||
<Car dmg1={job.area_of_damage.impact1} dmg2={job.area_of_damage.impact2} />
|
<Car
|
||||||
|
dmg1={job.area_of_damage.impact1 && job.area_of_damage.impact1.padStart(2, "0")}
|
||||||
|
dmg2={job.area_of_damage.impact2 && job.area_of_damage.impact2.padStart(2, "0")}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
t("jobs.errors.nodamage")
|
t("jobs.errors.nodamage")
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export default function ShopEmployeesListComponent({ loading, employees }) {
|
|||||||
value: false
|
value: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
onFilter: (value, record) => value === record.flate_rate,
|
onFilter: (value, record) => value === record.flat_rate,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
record.flat_rate ? t("employees.labels.flat_rate") : t("employees.labels.straight_time")
|
record.flat_rate ? t("employees.labels.flat_rate") : t("employees.labels.straight_time")
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { DeleteFilled } from "@ant-design/icons";
|
import { DeleteFilled } from "@ant-design/icons";
|
||||||
import { Button, Form, Input, InputNumber, Select, Space, Switch, Typography } from "antd";
|
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
import { Button, Form, Input, InputNumber, Select, Space, Switch } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import styled from "styled-components";
|
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
|
||||||
import DataLabel from "../data-label/data-label.component";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
import styled from "styled-components";
|
||||||
import ShopInfoResponsibilitycentersTaxesComponent from "./shop-info.responsibilitycenters.taxes.component";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
|
import DataLabel from "../data-label/data-label.component";
|
||||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||||
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
import ShopInfoResponsibilitycentersTaxesComponent from "./shop-info.responsibilitycenters.taxes.component";
|
||||||
|
|
||||||
const SelectorDiv = styled.div`
|
const SelectorDiv = styled.div`
|
||||||
.ant-form-item .ant-select {
|
.ant-form-item .ant-select {
|
||||||
@@ -214,7 +214,6 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
</Select.Option>
|
</Select.Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Space align="center">
|
<Space align="center">
|
||||||
<DeleteFilled
|
<DeleteFilled
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -274,7 +273,6 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<DeleteFilled
|
<DeleteFilled
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
remove(field.name);
|
remove(field.name);
|
||||||
@@ -386,7 +384,6 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
>
|
>
|
||||||
<Input onBlur={handleBlur} />
|
<Input onBlur={handleBlur} />
|
||||||
</Form.Item> */}
|
</Form.Item> */}
|
||||||
|
|
||||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||||
@@ -451,7 +448,6 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
}}
|
}}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow header={t("bodyshop.labels.responsibilitycenters.profits")} id="profits">
|
<LayoutFormRow header={t("bodyshop.labels.responsibilitycenters.profits")} id="profits">
|
||||||
<Form.List name={["md_responsibility_centers", "profits"]}>
|
<Form.List name={["md_responsibility_centers", "profits"]}>
|
||||||
{(fields, { add, remove, move }) => {
|
{(fields, { add, remove, move }) => {
|
||||||
@@ -579,10 +575,10 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
}}
|
}}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<SelectorDiv>
|
<SelectorDiv>
|
||||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||||
<>
|
<>
|
||||||
|
<LayoutFormRow id="mappingname" header={t("bodyshop.labels.dms.dms_allocations")}>
|
||||||
<Form.List name={["md_responsibility_centers", "dms_defaults"]}>
|
<Form.List name={["md_responsibility_centers", "dms_defaults"]}>
|
||||||
{(fields, { add, remove, move }) => {
|
{(fields, { add, remove, move }) => {
|
||||||
return (
|
return (
|
||||||
@@ -590,7 +586,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
<Form.Item key={field.key}>
|
<Form.Item key={field.key}>
|
||||||
<div>
|
<div>
|
||||||
<LayoutFormRow id="mappingname">
|
<LayoutFormRow id="mappingname" noDivider={index > 0 ? false : true}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.dms.mappingname")}
|
label={t("bodyshop.fields.dms.mappingname")}
|
||||||
key={`${index}name`}
|
key={`${index}name`}
|
||||||
@@ -616,7 +612,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow header={t("bodyshop.labels.defaultcostsmapping")} id="defaultcostsmapping">
|
<LayoutFormRow header={t("bodyshop.labels.dms.costsmapping")} id="costsmapping">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenters.ats")}
|
label={t("bodyshop.fields.responsibilitycenters.ats")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -1401,7 +1397,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow header={t("bodyshop.labels.defaultprofitsmapping")}>
|
<LayoutFormRow header={t("bodyshop.labels.dms.profitsmapping")} id="profitsmapping">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenters.ats")}
|
label={t("bodyshop.fields.responsibilitycenters.ats")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -2204,6 +2200,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
|
</LayoutFormRow>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -3720,7 +3717,6 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
</SelectorDiv>
|
</SelectorDiv>
|
||||||
|
|
||||||
<LayoutFormRow header={t("bodyshop.labels.responsibilitycenters.tax_accounts")} id="tax_accounts">
|
<LayoutFormRow header={t("bodyshop.labels.responsibilitycenters.tax_accounts")} id="tax_accounts">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenters.federal_tax")}
|
label={t("bodyshop.fields.responsibilitycenters.federal_tax")}
|
||||||
@@ -4354,14 +4350,14 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
)}
|
)}
|
||||||
<Typography.Title level={4}>{t("bodyshop.labels.responsibilitycenters.sales_tax_codes")}</Typography.Title>
|
<LayoutFormRow id="mappingname" header={t("bodyshop.labels.responsibilitycenters.sales_tax_codes")}>
|
||||||
<Form.List name={["md_responsibility_centers", "sales_tax_codes"]}>
|
<Form.List name={["md_responsibility_centers", "sales_tax_codes"]}>
|
||||||
{(fields, { add, remove }) => {
|
{(fields, { add, remove }) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
<Form.Item key={field.key}>
|
<Form.Item key={field.key}>
|
||||||
<LayoutFormRow id="sales_tax_codes">
|
<LayoutFormRow id="sales_tax_codes" noDivider={index > 0 ? false : true}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenters.sales_tax_codes.description")}
|
label={t("bodyshop.fields.responsibilitycenters.sales_tax_codes.description")}
|
||||||
key={`${index}description`}
|
key={`${index}description`}
|
||||||
@@ -4435,6 +4431,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
|
</LayoutFormRow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ export const QUERY_JOB_CARD_DETAILS = gql`
|
|||||||
}
|
}
|
||||||
|
|
||||||
joblines(
|
joblines(
|
||||||
where: { removed: { _eq: false }, part_type: { _is_null: false, _nin: ["PAE", "PAS", "PASL"] } }
|
where: { removed: { _eq: false } }
|
||||||
order_by: { line_no: asc }
|
order_by: { line_no: asc }
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
@@ -1149,6 +1149,7 @@ export const UPDATE_JOB = gql`
|
|||||||
suspended
|
suspended
|
||||||
queued_for_parts
|
queued_for_parts
|
||||||
scheduled_completion
|
scheduled_completion
|
||||||
|
scheduled_delivery
|
||||||
actual_in
|
actual_in
|
||||||
date_repairstarted
|
date_repairstarted
|
||||||
date_void
|
date_void
|
||||||
|
|||||||
@@ -647,7 +647,10 @@
|
|||||||
"payers": "Payers"
|
"payers": "Payers"
|
||||||
},
|
},
|
||||||
"cdk_dealerid": "CDK Dealer ID",
|
"cdk_dealerid": "CDK Dealer ID",
|
||||||
|
"costsmapping": "Costs Mapping",
|
||||||
|
"dms_allocations": "DMS Allocations",
|
||||||
"pbs_serialnumber": "PBS Serial Number",
|
"pbs_serialnumber": "PBS Serial Number",
|
||||||
|
"profitsmapping": "Profits Mapping",
|
||||||
"title": "DMS"
|
"title": "DMS"
|
||||||
},
|
},
|
||||||
"emaillater": "Email Later",
|
"emaillater": "Email Later",
|
||||||
@@ -2917,7 +2920,8 @@
|
|||||||
"parts_not_recieved_vendor": "Parts Not Received by Vendor",
|
"parts_not_recieved_vendor": "Parts Not Received by Vendor",
|
||||||
"parts_received_not_scheduled": "Parts Received for Jobs Not Scheduled",
|
"parts_received_not_scheduled": "Parts Received for Jobs Not Scheduled",
|
||||||
"payments_by_date": "Payments by Date",
|
"payments_by_date": "Payments by Date",
|
||||||
"payments_by_date_type": "Payments by Date and Type",
|
"payments_by_date_payment": "Payments by Date and Payment Type",
|
||||||
|
"payments_by_date_type": "Payments by Date and Customer Type",
|
||||||
"production_by_category": "Production by Category",
|
"production_by_category": "Production by Category",
|
||||||
"production_by_category_one": "Production filtered by Category",
|
"production_by_category_one": "Production filtered by Category",
|
||||||
"production_by_csr": "Production by CSR",
|
"production_by_csr": "Production by CSR",
|
||||||
|
|||||||
@@ -647,7 +647,10 @@
|
|||||||
"payers": ""
|
"payers": ""
|
||||||
},
|
},
|
||||||
"cdk_dealerid": "",
|
"cdk_dealerid": "",
|
||||||
|
"costsmapping": "",
|
||||||
|
"dms_allocations": "",
|
||||||
"pbs_serialnumber": "",
|
"pbs_serialnumber": "",
|
||||||
|
"profitsmapping": "",
|
||||||
"title": ""
|
"title": ""
|
||||||
},
|
},
|
||||||
"emaillater": "",
|
"emaillater": "",
|
||||||
@@ -2917,6 +2920,7 @@
|
|||||||
"parts_not_recieved_vendor": "",
|
"parts_not_recieved_vendor": "",
|
||||||
"parts_received_not_scheduled": "",
|
"parts_received_not_scheduled": "",
|
||||||
"payments_by_date": "",
|
"payments_by_date": "",
|
||||||
|
"payments_by_date_payment": "",
|
||||||
"payments_by_date_type": "",
|
"payments_by_date_type": "",
|
||||||
"production_by_category": "",
|
"production_by_category": "",
|
||||||
"production_by_category_one": "",
|
"production_by_category_one": "",
|
||||||
|
|||||||
@@ -647,7 +647,10 @@
|
|||||||
"payers": ""
|
"payers": ""
|
||||||
},
|
},
|
||||||
"cdk_dealerid": "",
|
"cdk_dealerid": "",
|
||||||
|
"costsmapping": "",
|
||||||
|
"dms_allocations": "",
|
||||||
"pbs_serialnumber": "",
|
"pbs_serialnumber": "",
|
||||||
|
"profitsmapping": "",
|
||||||
"title": ""
|
"title": ""
|
||||||
},
|
},
|
||||||
"emaillater": "",
|
"emaillater": "",
|
||||||
@@ -2917,6 +2920,7 @@
|
|||||||
"parts_not_recieved_vendor": "",
|
"parts_not_recieved_vendor": "",
|
||||||
"parts_received_not_scheduled": "",
|
"parts_received_not_scheduled": "",
|
||||||
"payments_by_date": "",
|
"payments_by_date": "",
|
||||||
|
"payments_by_date_payment": "",
|
||||||
"payments_by_date_type": "",
|
"payments_by_date_type": "",
|
||||||
"production_by_category": "",
|
"production_by_category": "",
|
||||||
"production_by_category_one": "",
|
"production_by_category_one": "",
|
||||||
|
|||||||
@@ -1194,6 +1194,17 @@ export const TemplateList = (type, context) => {
|
|||||||
},
|
},
|
||||||
group: "customers"
|
group: "customers"
|
||||||
},
|
},
|
||||||
|
payments_by_date_payment: {
|
||||||
|
title: i18n.t("reportcenter.templates.payments_by_date_payment"),
|
||||||
|
subject: i18n.t("reportcenter.templates.payments_by_date_payment"),
|
||||||
|
key: "payments_by_date_payment",
|
||||||
|
disabled: false,
|
||||||
|
rangeFilter: {
|
||||||
|
object: i18n.t("reportcenter.labels.objects.payments"),
|
||||||
|
field: i18n.t("payments.fields.date")
|
||||||
|
},
|
||||||
|
group: "customers"
|
||||||
|
},
|
||||||
schedule: {
|
schedule: {
|
||||||
title: i18n.t("reportcenter.templates.schedule"),
|
title: i18n.t("reportcenter.templates.schedule"),
|
||||||
subject: i18n.t("reportcenter.templates.schedule"),
|
subject: i18n.t("reportcenter.templates.schedule"),
|
||||||
|
|||||||
10
hasura/migrations/1720712957502_run_sql_migration/down.sql
Normal file
10
hasura/migrations/1720712957502_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE VIEW "public"."joblines_status" AS
|
||||||
|
-- SELECT j.jobid,
|
||||||
|
-- j.status,
|
||||||
|
-- count(1) AS count,
|
||||||
|
-- j.part_type
|
||||||
|
-- FROM joblines j
|
||||||
|
-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> 0) AND (j.act_price <> 0) AND (j.removed IS FALSE))
|
||||||
|
-- GROUP BY j.jobid, j.status, j.part_type;
|
||||||
8
hasura/migrations/1720712957502_run_sql_migration/up.sql
Normal file
8
hasura/migrations/1720712957502_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CREATE OR REPLACE VIEW "public"."joblines_status" AS
|
||||||
|
SELECT j.jobid,
|
||||||
|
j.status,
|
||||||
|
count(1) AS count,
|
||||||
|
j.part_type
|
||||||
|
FROM joblines j
|
||||||
|
WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> 0) AND (j.act_price <> 0) AND (j.removed IS FALSE))
|
||||||
|
GROUP BY j.jobid, j.status, j.part_type;
|
||||||
10
hasura/migrations/1720713022389_run_sql_migration/down.sql
Normal file
10
hasura/migrations/1720713022389_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE VIEW "public"."joblines_status" AS
|
||||||
|
-- SELECT j.jobid,
|
||||||
|
-- j.status,
|
||||||
|
-- count(1) AS count,
|
||||||
|
-- j.part_type
|
||||||
|
-- FROM joblines j
|
||||||
|
-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> (0)::numeric) AND (j.act_price <> (0)::numeric) AND (j.removed IS FALSE))
|
||||||
|
-- GROUP BY j.jobid, j.status, j.part_type;
|
||||||
8
hasura/migrations/1720713022389_run_sql_migration/up.sql
Normal file
8
hasura/migrations/1720713022389_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CREATE OR REPLACE VIEW "public"."joblines_status" AS
|
||||||
|
SELECT j.jobid,
|
||||||
|
j.status,
|
||||||
|
count(1) AS count,
|
||||||
|
j.part_type
|
||||||
|
FROM joblines j
|
||||||
|
WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> (0)::numeric) AND (j.act_price <> (0)::numeric) AND (j.removed IS FALSE))
|
||||||
|
GROUP BY j.jobid, j.status, j.part_type;
|
||||||
@@ -632,7 +632,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//QB USA with GST
|
//QB USA with GST and PST
|
||||||
//This was required for the No. 1 Collision Group.
|
//This was required for the No. 1 Collision Group.
|
||||||
if (
|
if (
|
||||||
bodyshop.accountingconfig &&
|
bodyshop.accountingconfig &&
|
||||||
@@ -651,6 +651,17 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
|||||||
Qty: 1
|
Qty: 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
InvoiceLineAdd.push({
|
||||||
|
DetailType: "SalesItemLineDetail",
|
||||||
|
Amount: Dinero(jobs_by_pk.job_totals.totals.state_tax).toFormat(DineroQbFormat),
|
||||||
|
SalesItemLineDetail: {
|
||||||
|
...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } : {}),
|
||||||
|
ItemRef: {
|
||||||
|
value: items[bodyshop.md_responsibility_centers.taxes.state.accountitem]
|
||||||
|
},
|
||||||
|
Qty: 1
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Handle insurance profile adjustments
|
//Handle insurance profile adjustments
|
||||||
|
|||||||
@@ -16,10 +16,37 @@ const { DiscountNotAlreadyCounted } = InstanceManager({
|
|||||||
promanager: "USE_ROME"
|
promanager: "USE_ROME"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.defaultRoute = async function (req, res) {
|
||||||
|
try {
|
||||||
|
CdkBase.createLogEvent(req, "DEBUG", `Received request to calculate allocations for ${req.body.jobid}`);
|
||||||
|
const jobData = await QueryJobData(req, req.BearerToken, req.body.jobid);
|
||||||
|
return res.status(200).json({ data: calculateAllocations(req, jobData) });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
CdkBase.createLogEvent(req, "ERROR", `Error encountered in CdkCalculateAllocations. ${error}`);
|
||||||
|
res.status(500).json({ error: `Error encountered in CdkCalculateAllocations. ${error}` });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.default = async function (socket, jobid) {
|
exports.default = async function (socket, jobid) {
|
||||||
try {
|
try {
|
||||||
CdkBase.createLogEvent(socket, "DEBUG", `Received request to calculate allocations for ${jobid}`);
|
const jobData = await QueryJobData(socket, "Bearer " + socket.handshake.auth.token, jobid);
|
||||||
const job = await QueryJobData(socket, jobid);
|
return calculateAllocations(socket, jobData);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkCalculateAllocations. ${error}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function QueryJobData(connectionData, token, jobid) {
|
||||||
|
CdkBase.createLogEvent(connectionData, "DEBUG", `Querying job data for id ${jobid}`);
|
||||||
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
|
const result = await client.setHeaders({ Authorization: token }).request(queries.GET_CDK_ALLOCATIONS, { id: jobid });
|
||||||
|
CdkBase.createLogEvent(connectionData, "TRACE", `Job data query result ${JSON.stringify(result, null, 2)}`);
|
||||||
|
return result.jobs_by_pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateAllocations(connectionData, job) {
|
||||||
const { bodyshop } = job;
|
const { bodyshop } = job;
|
||||||
|
|
||||||
const taxAllocations = InstanceManager({
|
const taxAllocations = InstanceManager({
|
||||||
@@ -145,7 +172,7 @@ exports.default = async function (socket, jobid) {
|
|||||||
(d) => d.name === job.dms_allocation
|
(d) => d.name === job.dms_allocation
|
||||||
);
|
);
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
connectionData,
|
||||||
"DEBUG",
|
"DEBUG",
|
||||||
`Using DMS Allocation ${selectedDmsAllocationConfig && selectedDmsAllocationConfig.name} for cost export.`
|
`Using DMS Allocation ${selectedDmsAllocationConfig && selectedDmsAllocationConfig.name} for cost export.`
|
||||||
);
|
);
|
||||||
@@ -225,10 +252,10 @@ exports.default = async function (socket, jobid) {
|
|||||||
// console.log("NO MASH ACCOUNT FOUND!!");
|
// console.log("NO MASH ACCOUNT FOUND!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(
|
// console.log(
|
||||||
Number.isInteger(bodyshop?.cdk_configuration?.sendmaterialscosting),
|
// Number.isInteger(bodyshop?.cdk_configuration?.sendmaterialscosting),
|
||||||
typeof Number.isInteger(bodyshop?.cdk_configuration?.sendmaterialscosting)
|
// typeof Number.isInteger(bodyshop?.cdk_configuration?.sendmaterialscosting)
|
||||||
);
|
// );
|
||||||
if (!!bodyshop?.cdk_configuration?.sendmaterialscosting) {
|
if (!!bodyshop?.cdk_configuration?.sendmaterialscosting) {
|
||||||
//Manually send the percentage of the costing.
|
//Manually send the percentage of the costing.
|
||||||
|
|
||||||
@@ -236,34 +263,22 @@ exports.default = async function (socket, jobid) {
|
|||||||
const mapaAccountName = selectedDmsAllocationConfig.costs.MAPA;
|
const mapaAccountName = selectedDmsAllocationConfig.costs.MAPA;
|
||||||
const mapaAccount = bodyshop.md_responsibility_centers.costs.find((c) => c.name === mapaAccountName);
|
const mapaAccount = bodyshop.md_responsibility_centers.costs.find((c) => c.name === mapaAccountName);
|
||||||
if (mapaAccount) {
|
if (mapaAccount) {
|
||||||
if (!costCenterHash[mapaAccountName])
|
if (!costCenterHash[mapaAccountName]) costCenterHash[mapaAccountName] = Dinero();
|
||||||
costCenterHash[mapaAccountName] = Dinero();
|
|
||||||
if (job.bodyshop.use_paint_scale_data === true) {
|
if (job.bodyshop.use_paint_scale_data === true) {
|
||||||
if (job.mixdata.length > 0) {
|
if (job.mixdata.length > 0) {
|
||||||
costCenterHash[mapaAccountName] = costCenterHash[
|
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
||||||
mapaAccountName
|
|
||||||
].add(
|
|
||||||
Dinero({
|
Dinero({
|
||||||
amount: Math.round(
|
amount: Math.round(((job.mixdata[0] && job.mixdata[0].totalliquidcost) || 0) * 100)
|
||||||
((job.mixdata[0] && job.mixdata[0].totalliquidcost) || 0) *
|
|
||||||
100
|
|
||||||
),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
costCenterHash[mapaAccountName] = costCenterHash[
|
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
||||||
mapaAccountName
|
Dinero(job.job_totals.rates.mapa.total).percentage(bodyshop?.cdk_configuration?.sendmaterialscosting)
|
||||||
].add(
|
|
||||||
Dinero(job.job_totals.rates.mapa.total).percentage(
|
|
||||||
bodyshop?.cdk_configuration?.sendmaterialscosting
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
||||||
Dinero(job.job_totals.rates.mapa.total).percentage(
|
Dinero(job.job_totals.rates.mapa.total).percentage(bodyshop?.cdk_configuration?.sendmaterialscosting)
|
||||||
bodyshop?.cdk_configuration?.sendmaterialscosting
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -289,9 +304,7 @@ exports.default = async function (socket, jobid) {
|
|||||||
// (c) => c.name === mashAccountName
|
// (c) => c.name === mashAccountName
|
||||||
// );
|
// );
|
||||||
|
|
||||||
taxAllocations.state.sale = taxAllocations.state.sale.add(
|
taxAllocations.state.sale = taxAllocations.state.sale.add(Dinero({ amount: Math.round((ca_bc_pvrt || 0) * 100) }));
|
||||||
Dinero({ amount: Math.round((ca_bc_pvrt || 0) * 100) })
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (job.towing_payable && job.towing_payable !== 0) {
|
if (job.towing_payable && job.towing_payable !== 0) {
|
||||||
@@ -361,7 +374,7 @@ exports.default = async function (socket, jobid) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
connectionData,
|
||||||
"ERROR",
|
"ERROR",
|
||||||
`Error encountered in CdkCalculateAllocations. Unable to find adjustment account. ${error}`
|
`Error encountered in CdkCalculateAllocations. Unable to find adjustment account. ${error}`
|
||||||
);
|
);
|
||||||
@@ -401,18 +414,4 @@ exports.default = async function (socket, jobid) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkCalculateAllocations. ${error}`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
async function QueryJobData(socket, jobid) {
|
|
||||||
CdkBase.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
|
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
|
||||||
const result = await client
|
|
||||||
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
|
||||||
.request(queries.GET_CDK_ALLOCATIONS, { id: jobid });
|
|
||||||
CdkBase.createLogEvent(socket, "TRACE", `Job data query result ${JSON.stringify(result, null, 2)}`);
|
|
||||||
return result.jobs_by_pk;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
},
|
},
|
||||||
InsuranceCompany: job.ins_co_nm || "",
|
InsuranceCompany: job.ins_co_nm || "",
|
||||||
Claim: job.clm_no || "",
|
Claim: job.clm_no || "",
|
||||||
|
DMSAllocation: job.dms_allocation || "",
|
||||||
Contacts: {
|
Contacts: {
|
||||||
CSR: job.employee_csr_rel
|
CSR: job.employee_csr_rel
|
||||||
? `${
|
? `${
|
||||||
@@ -643,7 +644,8 @@ const CreateJobLines = (joblines) => {
|
|||||||
part_qty: jobline.part_qty,
|
part_qty: jobline.part_qty,
|
||||||
part_price: jobline.act_price,
|
part_price: jobline.act_price,
|
||||||
labor_type: jobline.mod_lbr_ty,
|
labor_type: jobline.mod_lbr_ty,
|
||||||
labor_hours: jobline.mod_lb_hrs
|
labor_hours: jobline.mod_lb_hrs,
|
||||||
|
labor_sale: jobline.lbr_amt
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return repairLines;
|
return repairLines;
|
||||||
@@ -660,7 +662,10 @@ const CreateTimeTickets = (timetickets) => {
|
|||||||
.trim(),
|
.trim(),
|
||||||
productive_hrs: ticket.productivehrs,
|
productive_hrs: ticket.productivehrs,
|
||||||
actual_hrs: ticket.actualhrs,
|
actual_hrs: ticket.actualhrs,
|
||||||
cost_center: ticket.cost_center
|
cost_center: ticket.cost_center,
|
||||||
|
flat_rate: ticket.flat_rate,
|
||||||
|
rate: ticket.rate,
|
||||||
|
ticket_cost: ticket.flat_rate ? ticket.rate * ticket.productive_hrs : ticket.rate * ticket.actual_hrs
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return timeTickets;
|
return timeTickets;
|
||||||
|
|||||||
@@ -1139,6 +1139,7 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
|||||||
date_open
|
date_open
|
||||||
date_repairstarted
|
date_repairstarted
|
||||||
date_void
|
date_void
|
||||||
|
dms_allocation
|
||||||
employee_body_rel {
|
employee_body_rel {
|
||||||
first_name
|
first_name
|
||||||
last_name
|
last_name
|
||||||
@@ -1184,6 +1185,7 @@ exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uu
|
|||||||
}
|
}
|
||||||
db_price
|
db_price
|
||||||
id
|
id
|
||||||
|
lbr_amt
|
||||||
lbr_op
|
lbr_op
|
||||||
line_desc
|
line_desc
|
||||||
line_ind
|
line_ind
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const cdkGetMake = require("../cdk/cdk-get-makes");
|
const cdkGetMake = require("../cdk/cdk-get-makes");
|
||||||
|
const cdkCalculateAllocations = require("../cdk/cdk-calculate-allocations");
|
||||||
const validateFirebaseIdTokenMiddleware = require("../middleware/validateFirebaseIdTokenMiddleware");
|
const validateFirebaseIdTokenMiddleware = require("../middleware/validateFirebaseIdTokenMiddleware");
|
||||||
const withUserGraphQLClientMiddleware = require("../middleware/withUserGraphQLClientMiddleware");
|
const withUserGraphQLClientMiddleware = require("../middleware/withUserGraphQLClientMiddleware");
|
||||||
|
|
||||||
router.use(validateFirebaseIdTokenMiddleware);
|
router.use(validateFirebaseIdTokenMiddleware);
|
||||||
|
|
||||||
router.post("/getvehicles", withUserGraphQLClientMiddleware, cdkGetMake.default);
|
router.post("/getvehicles", withUserGraphQLClientMiddleware, cdkGetMake.default);
|
||||||
|
router.post("/calculate-allocations", withUserGraphQLClientMiddleware, cdkCalculateAllocations.defaultRoute);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user