@@ -16,6 +16,6 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"no-console": "off"
|
"no-console": "off"
|
||||||
},
|
},
|
||||||
"settings": {},
|
"settings": {}
|
||||||
"plugins": ["cypress"]
|
//"plugins": ["cypress"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project be_version="2.7.1" version="1.2">
|
<babeledit_project version="1.2" be_version="2.7.1">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
@@ -6921,6 +6921,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>federal_tax_itc</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>
|
<concept_node>
|
||||||
<name>gst_override</name>
|
<name>gst_override</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -16859,6 +16880,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>status</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>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
<name>sub_status</name>
|
<name>sub_status</name>
|
||||||
<children>
|
<children>
|
||||||
@@ -22330,6 +22372,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>amount</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>
|
<concept_node>
|
||||||
<name>center</name>
|
<name>center</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -22519,6 +22582,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>lines</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>
|
<concept_node>
|
||||||
<name>name1</name>
|
<name>name1</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -27388,6 +27472,27 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>dms</name>
|
<name>dms</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>apexported</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>
|
<concept_node>
|
||||||
<name>damageto</name>
|
<name>damageto</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -47238,6 +47343,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>dmsid</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>
|
<concept_node>
|
||||||
<name>due_date</name>
|
<name>due_date</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -7,17 +7,18 @@
|
|||||||
"@apollo/client": "^3.6.9",
|
"@apollo/client": "^3.6.9",
|
||||||
"@asseinfo/react-kanban": "^2.2.0",
|
"@asseinfo/react-kanban": "^2.2.0",
|
||||||
"@craco/craco": "^6.4.5",
|
"@craco/craco": "^6.4.5",
|
||||||
"@fingerprintjs/fingerprintjs": "^3.3.3",
|
"@fingerprintjs/fingerprintjs": "^3.3.6",
|
||||||
"@jsreport/browser-client": "^3.1.0",
|
"@jsreport/browser-client": "^3.1.0",
|
||||||
"@sentry/react": "^7.7.0",
|
"@sentry/react": "^7.17.3",
|
||||||
"@sentry/tracing": "^7.7.0",
|
"@sentry/tracing": "^7.17.3",
|
||||||
"@splitsoftware/splitio-react": "^1.6.0",
|
"@splitsoftware/splitio-react": "^1.8.0",
|
||||||
"@stripe/react-stripe-js": "^1.9.0",
|
"@stripe/react-stripe-js": "^1.14.1",
|
||||||
"@stripe/stripe-js": "^1.32.0",
|
"@stripe/stripe-js": "^1.42.1",
|
||||||
"@tanem/react-nprogress": "^5.0.8",
|
"@tanem/react-nprogress": "^5.0.16",
|
||||||
"antd": "^4.22.3",
|
"antd": "^4.23.6",
|
||||||
"apollo-link-logger": "^2.0.0",
|
"apollo-link-logger": "^2.0.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
|
"breaking-react-grid-gallery": "npm:react-grid-gallery@1.0.0",
|
||||||
"craco-less": "^1.20.0",
|
"craco-less": "^1.20.0",
|
||||||
"dinero.js": "^1.9.1",
|
"dinero.js": "^1.9.1",
|
||||||
"dotenv": "^16.0.1",
|
"dotenv": "^16.0.1",
|
||||||
@@ -28,15 +29,15 @@
|
|||||||
"graphql": "^16.5.0",
|
"graphql": "^16.5.0",
|
||||||
"i18next": "^21.8.14",
|
"i18next": "^21.8.14",
|
||||||
"i18next-browser-languagedetector": "^6.1.4",
|
"i18next-browser-languagedetector": "^6.1.4",
|
||||||
"jsoneditor": "^9.9.0",
|
"jsoneditor": "^9.9.2",
|
||||||
"jsreport-browser-client-dist": "^1.3.0",
|
"jsreport-browser-client-dist": "^1.3.0",
|
||||||
"libphonenumber-js": "^1.10.9",
|
"libphonenumber-js": "^1.10.14",
|
||||||
"logrocket": "^3.0.1",
|
"logrocket": "^3.0.1",
|
||||||
"markerjs2": "^2.22.0",
|
"markerjs2": "^2.28.0",
|
||||||
"moment-business-days": "^1.2.0",
|
"moment-business-days": "^1.2.0",
|
||||||
"moment-timezone": "^0.5.34",
|
"moment-timezone": "^0.5.38",
|
||||||
"normalize-url": "^7.0.3",
|
"normalize-url": "^7.2.0",
|
||||||
"phone": "^3.1.23",
|
"phone": "^3.1.29",
|
||||||
"preval.macro": "^5.0.0",
|
"preval.macro": "^5.0.0",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"query-string": "^7.1.1",
|
"query-string": "^7.1.1",
|
||||||
@@ -51,7 +52,8 @@
|
|||||||
"react-grid-gallery": "^0.5.5",
|
"react-grid-gallery": "^0.5.5",
|
||||||
"react-grid-layout": "^1.3.4",
|
"react-grid-layout": "^1.3.4",
|
||||||
"react-i18next": "^11.18.1",
|
"react-i18next": "^11.18.1",
|
||||||
"react-icons": "^4.4.0",
|
"react-icons": "^4.6.0",
|
||||||
|
"react-image-lightbox": "^5.1.4",
|
||||||
"react-number-format": "^4.9.3",
|
"react-number-format": "^4.9.3",
|
||||||
"react-redux": "^7.2.8",
|
"react-redux": "^7.2.8",
|
||||||
"react-resizable": "^3.0.4",
|
"react-resizable": "^3.0.4",
|
||||||
@@ -60,29 +62,29 @@
|
|||||||
"react-sticky": "^6.0.3",
|
"react-sticky": "^6.0.3",
|
||||||
"react-sublime-video": "^0.2.5",
|
"react-sublime-video": "^0.2.5",
|
||||||
"react-virtualized": "^9.22.3",
|
"react-virtualized": "^9.22.3",
|
||||||
"recharts": "^2.1.12",
|
"recharts": "^2.1.16",
|
||||||
"redux": "^4.2.0",
|
"redux": "^4.2.0",
|
||||||
"redux-persist": "^6.0.0",
|
"redux-persist": "^6.0.0",
|
||||||
"redux-saga": "^1.1.3",
|
"redux-saga": "^1.2.1",
|
||||||
"redux-state-sync": "^3.1.4",
|
"redux-state-sync": "^3.1.4",
|
||||||
"reselect": "^4.1.6",
|
"reselect": "^4.1.6",
|
||||||
"sass": "^1.54.0",
|
"sass": "^1.55.0",
|
||||||
"socket.io-client": "^4.5.1",
|
"socket.io-client": "^4.5.3",
|
||||||
"styled-components": "^5.3.5",
|
"styled-components": "^5.3.6",
|
||||||
"subscriptions-transport-ws": "^0.11.0",
|
"subscriptions-transport-ws": "^0.11.0",
|
||||||
"web-vitals": "^2.1.4",
|
"web-vitals": "^2.1.4",
|
||||||
"workbox-background-sync": "^6.5.3",
|
"workbox-background-sync": "^6.5.4",
|
||||||
"workbox-broadcast-update": "^6.5.3",
|
"workbox-broadcast-update": "^6.5.4",
|
||||||
"workbox-cacheable-response": "^6.5.3",
|
"workbox-cacheable-response": "^6.5.4",
|
||||||
"workbox-core": "^6.5.3",
|
"workbox-core": "^6.5.4",
|
||||||
"workbox-expiration": "^6.5.3",
|
"workbox-expiration": "^6.5.4",
|
||||||
"workbox-google-analytics": "^6.5.3",
|
"workbox-google-analytics": "^6.5.4",
|
||||||
"workbox-navigation-preload": "^6.5.3",
|
"workbox-navigation-preload": "^6.5.4",
|
||||||
"workbox-precaching": "^6.5.3",
|
"workbox-precaching": "^6.5.4",
|
||||||
"workbox-range-requests": "^6.5.3",
|
"workbox-range-requests": "^6.5.4",
|
||||||
"workbox-routing": "^6.5.3",
|
"workbox-routing": "^6.5.4",
|
||||||
"workbox-strategies": "^6.5.3",
|
"workbox-strategies": "^6.5.4",
|
||||||
"workbox-streams": "^6.5.3",
|
"workbox-streams": "^6.5.4",
|
||||||
"yauzl": "^2.10.0"
|
"yauzl": "^2.10.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -119,12 +121,12 @@
|
|||||||
"react-error-overlay": "6.0.9"
|
"react-error-overlay": "6.0.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sentry/webpack-plugin": "^1.19.0",
|
"@sentry/webpack-plugin": "^1.20.0",
|
||||||
"@testing-library/cypress": "^8.0.3",
|
"@testing-library/cypress": "^8.0.3",
|
||||||
"cypress": "^10.3.1",
|
"cypress": "^10.11.0",
|
||||||
"eslint-plugin-cypress": "^2.12.1",
|
"eslint-plugin-cypress": "^2.12.1",
|
||||||
"react-error-overlay": "6.0.11",
|
"react-error-overlay": "6.0.11",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"source-map-explorer": "^2.5.2"
|
"source-map-explorer": "^2.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useClient } from "@splitsoftware/splitio-react";
|
||||||
import { Button, Result } from "antd";
|
import { Button, Result } from "antd";
|
||||||
import LogRocket from "logrocket";
|
import LogRocket from "logrocket";
|
||||||
import React, { lazy, Suspense, useEffect } from "react";
|
import React, { lazy, Suspense, useEffect } from "react";
|
||||||
@@ -51,11 +51,7 @@ export function App({
|
|||||||
online,
|
online,
|
||||||
setOnline,
|
setOnline,
|
||||||
}) {
|
}) {
|
||||||
const { LogRocket_Tracking } = useTreatments(
|
const client = useClient();
|
||||||
["LogRocket_Tracking"],
|
|
||||||
{},
|
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
@@ -78,15 +74,15 @@ export function App({
|
|||||||
setOnline(true);
|
setOnline(true);
|
||||||
});
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (currentUser.authorized) {
|
if (currentUser.authorized && bodyshop) {
|
||||||
if (
|
client.setAttribute("imexshopid", bodyshop.imexshopid);
|
||||||
process.env.NODE_ENV === "production" &&
|
|
||||||
LogRocket_Tracking.treatment === "on"
|
if (client.getTreatment("LogRocket_Tracking") === "on") {
|
||||||
) {
|
console.log("LR Start");
|
||||||
LogRocket.init("gvfvfw/bodyshopapp");
|
LogRocket.init("gvfvfw/bodyshopapp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [currentUser.authorized, LogRocket_Tracking.treatment]);
|
}, [bodyshop, client, currentUser.authorized]);
|
||||||
|
|
||||||
if (currentUser.authorized === null) {
|
if (currentUser.authorized === null) {
|
||||||
return <LoadingSpinner message={t("general.labels.loggingin")} />;
|
return <LoadingSpinner message={t("general.labels.loggingin")} />;
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
|
import { Button, Card, Form, Input, Table } from "antd";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(DmsAllocationsSummaryAp);
|
||||||
|
|
||||||
|
export function DmsAllocationsSummaryAp({ socket, bodyshop, billids, title }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
socket.on("ap-export-success", (billid) => {
|
||||||
|
setAllocationsSummary((allocationsSummary) =>
|
||||||
|
allocationsSummary.map((a) => {
|
||||||
|
if (a.billid !== billid) return a;
|
||||||
|
return { ...a, status: "Successful" };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
socket.on("ap-export-failure", ({ billid, error }) => {
|
||||||
|
allocationsSummary.map((a) => {
|
||||||
|
if (a.billid !== billid) return a;
|
||||||
|
return { ...a, status: error };
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (socket.disconnected) socket.connect();
|
||||||
|
return () => {
|
||||||
|
socket.removeListener("ap-export-success");
|
||||||
|
socket.removeListener("ap-export-failure");
|
||||||
|
//socket.disconnect();
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (socket.connected) {
|
||||||
|
socket.emit("pbs-calculate-allocations-ap", billids, (ack) => {
|
||||||
|
setAllocationsSummary(ack);
|
||||||
|
|
||||||
|
socket.allocationsSummary = ack;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [socket, socket.connected, billids]);
|
||||||
|
console.log(allocationsSummary);
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("general.labels.status"),
|
||||||
|
dataIndex: "status",
|
||||||
|
key: "status",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.ro_number"),
|
||||||
|
dataIndex: ["Posting", "Reference"],
|
||||||
|
key: "reference",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.lines"),
|
||||||
|
dataIndex: "Lines",
|
||||||
|
key: "Lines",
|
||||||
|
render: (text, record) => (
|
||||||
|
<table style={{ tableLayout: "auto", width: "100%" }}>
|
||||||
|
<tr>
|
||||||
|
<th>{t("bills.fields.invoice_number")}</th>
|
||||||
|
<th>{t("bodyshop.fields.dms.dms_acctnumber")}</th>
|
||||||
|
<th>{t("jobs.fields.dms.amount")}</th>
|
||||||
|
</tr>
|
||||||
|
{record.Posting.Lines.map((l, idx) => (
|
||||||
|
<tr key={idx}>
|
||||||
|
<td>{l.InvoiceNumber}</td>
|
||||||
|
<td>{l.Account}</td>
|
||||||
|
<td>{l.Amount}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</table>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleFinish = async (values) => {
|
||||||
|
socket.emit(`pbs-export-ap`, {
|
||||||
|
billids,
|
||||||
|
txEnvelope: values,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={title}
|
||||||
|
extra={
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
socket.emit("pbs-calculate-allocations-ap", billids, (ack) =>
|
||||||
|
setAllocationsSummary(ack)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SyncOutlined />
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Table
|
||||||
|
pagination={{ position: "top", defaultPageSize: 50 }}
|
||||||
|
columns={columns}
|
||||||
|
rowKey={(record) => `${record.InvoiceNumber}${record.Account}`}
|
||||||
|
dataSource={allocationsSummary}
|
||||||
|
locale={{ emptyText: t("dms.labels.refreshallocations") }}
|
||||||
|
/>
|
||||||
|
<Form layout="vertical" onFinish={handleFinish}>
|
||||||
|
<Form.Item
|
||||||
|
name="journal"
|
||||||
|
label={t("jobs.fields.dms.journal")}
|
||||||
|
initialValue={
|
||||||
|
bodyshop.cdk_configuration &&
|
||||||
|
bodyshop.cdk_configuration.default_journal
|
||||||
|
}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Button disabled={!socket.allocationsSummary} htmlType="submit">
|
||||||
|
{t("jobs.actions.dms.post")}
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -175,11 +175,13 @@ export function EmailOverlayContainer({
|
|||||||
<Modal
|
<Modal
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
visible={modalVisible}
|
visible={modalVisible}
|
||||||
|
maskClosable={false}
|
||||||
width={"80%"}
|
width={"80%"}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
toggleEmailOverlayVisible();
|
toggleEmailOverlayVisible();
|
||||||
}}
|
}}
|
||||||
|
//closeIcon={() => null}
|
||||||
okText={t("general.actions.send")}
|
okText={t("general.actions.send")}
|
||||||
okButtonProps={{
|
okButtonProps={{
|
||||||
loading: sending,
|
loading: sending,
|
||||||
|
|||||||
@@ -89,6 +89,11 @@ function Header({
|
|||||||
{},
|
{},
|
||||||
bodyshop && bodyshop.imexshopid
|
bodyshop && bodyshop.imexshopid
|
||||||
);
|
);
|
||||||
|
const { DmsAp } = useTreatments(
|
||||||
|
["DmsAp"],
|
||||||
|
{},
|
||||||
|
bodyshop && bodyshop.imexshopid
|
||||||
|
);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -264,10 +269,11 @@ function Header({
|
|||||||
{t("menus.header.accounting-receivables")}
|
{t("menus.header.accounting-receivables")}
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
{!(
|
{(!(
|
||||||
(bodyshop && bodyshop.cdk_dealerid) ||
|
(bodyshop && bodyshop.cdk_dealerid) ||
|
||||||
(bodyshop && bodyshop.pbs_serialnumber)
|
(bodyshop && bodyshop.pbs_serialnumber)
|
||||||
) && (
|
) ||
|
||||||
|
DmsAp.treatment === "on") && (
|
||||||
<Menu.Item key="payables">
|
<Menu.Item key="payables">
|
||||||
<Link to="/manage/accounting/payables">
|
<Link to="/manage/accounting/payables">
|
||||||
{t("menus.header.accounting-payables")}
|
{t("menus.header.accounting-payables")}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { SyncOutlined, FileExcelFilled } from "@ant-design/icons";
|
import { SyncOutlined, FileExcelFilled } from "@ant-design/icons";
|
||||||
import { Alert, Button, Card, Space } from "antd";
|
import { Alert, Button, Card, Space } from "antd";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
import Gallery from "react-grid-gallery";
|
|
||||||
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";
|
||||||
@@ -18,6 +17,9 @@ import JobsDocumentsLocalDeleteButton from "./jobs-documents-local-gallery.delet
|
|||||||
import JobsLocalGalleryDownloadButton from "./jobs-documents-local-gallery.download";
|
import JobsLocalGalleryDownloadButton from "./jobs-documents-local-gallery.download";
|
||||||
import JobsDocumentsLocalGalleryReassign from "./jobs-documents-local-gallery.reassign.component";
|
import JobsDocumentsLocalGalleryReassign from "./jobs-documents-local-gallery.reassign.component";
|
||||||
import JobsDocumentsLocalGallerySelectAllComponent from "./jobs-documents-local-gallery.selectall.component";
|
import JobsDocumentsLocalGallerySelectAllComponent from "./jobs-documents-local-gallery.selectall.component";
|
||||||
|
import { Gallery } from "breaking-react-grid-gallery";
|
||||||
|
import Lightbox from "react-image-lightbox";
|
||||||
|
import "react-image-lightbox/style.css";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -48,6 +50,8 @@ export function JobsDocumentsLocalGallery({
|
|||||||
invoice_number,
|
invoice_number,
|
||||||
vendorid,
|
vendorid,
|
||||||
}) {
|
}) {
|
||||||
|
const [index, setIndex] = useState(-1);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (job) {
|
if (job) {
|
||||||
@@ -58,9 +62,10 @@ export function JobsDocumentsLocalGallery({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [job, invoice_number, getJobMedia, getBillMedia]);
|
}, [job, invoice_number, getJobMedia, getBillMedia]);
|
||||||
let optimized;
|
//let optimized;
|
||||||
const jobMedia =
|
|
||||||
allMedia && allMedia[job.id]
|
const jobMedia = useMemo(() => {
|
||||||
|
return allMedia && allMedia[job.id]
|
||||||
? allMedia[job.id].reduce(
|
? allMedia[job.id].reduce(
|
||||||
(acc, val) => {
|
(acc, val) => {
|
||||||
if (
|
if (
|
||||||
@@ -70,9 +75,14 @@ export function JobsDocumentsLocalGallery({
|
|||||||
) {
|
) {
|
||||||
acc.images.push({
|
acc.images.push({
|
||||||
...val,
|
...val,
|
||||||
|
src: val.thumbnail, //Accomodate react grid gallery changes
|
||||||
|
height: val.thumbnailHeight,
|
||||||
|
width: val.thumbnailWidth,
|
||||||
|
original: val.src,
|
||||||
...(val.optimized && { src: val.optimized, fullsize: val.src }),
|
...(val.optimized && { src: val.optimized, fullsize: val.src }),
|
||||||
});
|
});
|
||||||
if (val.optimized) optimized = true;
|
if (val.optimized) {
|
||||||
|
} //optimized = true;
|
||||||
} else {
|
} else {
|
||||||
acc.other.push({
|
acc.other.push({
|
||||||
...val,
|
...val,
|
||||||
@@ -84,7 +94,22 @@ export function JobsDocumentsLocalGallery({
|
|||||||
{ images: [], other: [] }
|
{ images: [], other: [] }
|
||||||
)
|
)
|
||||||
: { images: [], other: [] };
|
: { images: [], other: [] };
|
||||||
|
}, [allMedia, job.id]);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: jobs-documents-local-gallery.container.jsx ~ line 67 ~ jobMedia",
|
||||||
|
jobMedia
|
||||||
|
);
|
||||||
|
|
||||||
|
const currentImage = jobMedia.images[index];
|
||||||
|
const nextIndex = (index + 1) % jobMedia.images.length;
|
||||||
|
const nextImage = jobMedia.images[nextIndex] || currentImage;
|
||||||
|
const prevIndex =
|
||||||
|
(index + jobMedia.images.length - 1) % jobMedia.images.length;
|
||||||
|
const prevImage = jobMedia.images[prevIndex] || currentImage;
|
||||||
|
const handleClose = () => setIndex(-1);
|
||||||
|
const handleMovePrev = () => setIndex(prevIndex);
|
||||||
|
const handleMoveNext = () => setIndex(nextIndex);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
@@ -118,7 +143,7 @@ export function JobsDocumentsLocalGallery({
|
|||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
<Card title={t("jobs.labels.documents-images")}>
|
<Card title={t("jobs.labels.documents-images")}>
|
||||||
<Gallery
|
{/* <Gallery
|
||||||
images={jobMedia.images}
|
images={jobMedia.images}
|
||||||
backdropClosesModal={true}
|
backdropClosesModal={true}
|
||||||
onSelectImage={(index, image) => {
|
onSelectImage={(index, image) => {
|
||||||
@@ -144,7 +169,27 @@ export function JobsDocumentsLocalGallery({
|
|||||||
"toolbar=0,location=0,menubar=0"
|
"toolbar=0,location=0,menubar=0"
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
/> */}
|
||||||
|
<Gallery
|
||||||
|
images={jobMedia.images}
|
||||||
|
onClick={(index) => setIndex(index)}
|
||||||
|
enableImageSelection={false}
|
||||||
/>
|
/>
|
||||||
|
{!!currentImage && (
|
||||||
|
/* @ts-ignore */
|
||||||
|
<Lightbox
|
||||||
|
mainSrc={currentImage.original}
|
||||||
|
imageTitle={currentImage.caption}
|
||||||
|
mainSrcThumbnail={currentImage.src}
|
||||||
|
nextSrc={nextImage.original}
|
||||||
|
nextSrcThumbnail={nextImage.src}
|
||||||
|
prevSrc={prevImage.original}
|
||||||
|
prevSrcThumbnail={prevImage.src}
|
||||||
|
onCloseRequest={handleClose}
|
||||||
|
onMovePrevRequest={handleMovePrev}
|
||||||
|
onMoveNextRequest={handleMoveNext}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
<Card title={t("jobs.labels.documents-other")}>
|
<Card title={t("jobs.labels.documents-other")}>
|
||||||
<Gallery
|
<Gallery
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -176,6 +177,13 @@ export function PayableExportAll({
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (bodyshop.pbs_serialnumber)
|
||||||
|
return (
|
||||||
|
<Link to={{ state: { billids }, pathname: `/manage/dmsap` }}>
|
||||||
|
<Button>{t("jobs.actions.export")}</Button>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
|
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
|
||||||
{t("jobs.actions.exportselected")}
|
{t("jobs.actions.exportselected")}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -179,6 +180,13 @@ export function PayableExportButton({
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (bodyshop.pbs_serialnumber)
|
||||||
|
return (
|
||||||
|
<Link to={{ state: { billids: [billId] }, pathname: `/manage/dmsap` }}>
|
||||||
|
<Button>{t("jobs.actions.export")}</Button>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
|
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
|
||||||
{t("jobs.actions.export")}
|
{t("jobs.actions.export")}
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
{},
|
{},
|
||||||
bodyshop && bodyshop.imexshopid
|
bodyshop && bodyshop.imexshopid
|
||||||
);
|
);
|
||||||
|
const { DmsAp } = useTreatments(
|
||||||
|
["DmsAp"],
|
||||||
|
{},
|
||||||
|
bodyshop && bodyshop.imexshopid
|
||||||
|
);
|
||||||
const [costOptions, setCostOptions] = useState(
|
const [costOptions, setCostOptions] = useState(
|
||||||
[
|
[
|
||||||
...((form.getFieldValue(["md_responsibility_centers", "costs"]) &&
|
...((form.getFieldValue(["md_responsibility_centers", "costs"]) &&
|
||||||
@@ -4159,6 +4163,121 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
<InputNumber precision={2} />
|
<InputNumber precision={2} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
{DmsAp.treatment === "on" && (
|
||||||
|
<LayoutFormRow>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenters.federal_tax_itc")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_responsibility_centers", "taxes", "federal_itc", "name"]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
{/* <Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_accountnumber")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"federal_itc",
|
||||||
|
"accountnumber",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item> */}
|
||||||
|
{/* <Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_accountname")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"federal_itc",
|
||||||
|
"accountname",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item> */}
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_accountdesc")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"federal_itc",
|
||||||
|
"accountdesc",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_accountitem")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"federal_itc",
|
||||||
|
"accountitem",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"federal_itc",
|
||||||
|
"dms_acctnumber",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_rate")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_responsibility_centers", "taxes", "federal_itc", "rate"]}
|
||||||
|
>
|
||||||
|
<InputNumber precision={2} />
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
|
)}
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenters.state_tax")}
|
label={t("bodyshop.fields.responsibilitycenters.state_tax")}
|
||||||
@@ -4417,68 +4536,71 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
<Input />
|
<Input />
|
||||||
</Form.Item> */}
|
</Form.Item> */}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
{/* <LayoutFormRow>
|
|
||||||
<Form.Item
|
{DmsAp.treatment === "on" && (
|
||||||
label={t("bodyshop.fields.responsibilitycenters.ap")}
|
<LayoutFormRow header={t("bodyshop.fields.responsibilitycenters.ap")}>
|
||||||
rules={[
|
{/* <Form.Item
|
||||||
{
|
label={t("bodyshop.fields.responsibilitycenters.ap")}
|
||||||
required: true,
|
rules={[
|
||||||
//message: t("general.validation.required"),
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
//message: t("general.validation.required"),
|
||||||
name={["md_responsibility_centers", "ap", "name"]}
|
},
|
||||||
>
|
]}
|
||||||
<Input />
|
name={["md_responsibility_centers", "ap", "name"]}
|
||||||
</Form.Item>
|
>
|
||||||
<Form.Item
|
<Input />
|
||||||
label={t("bodyshop.fields.responsibilitycenter_accountnumber")}
|
</Form.Item> */}
|
||||||
rules={[
|
{/* <Form.Item
|
||||||
{
|
label={t("bodyshop.fields.responsibilitycenter_accountnumber")}
|
||||||
required: true,
|
rules={[
|
||||||
//message: t("general.validation.required"),
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
//message: t("general.validation.required"),
|
||||||
name={["md_responsibility_centers", "ap", "accountnumber"]}
|
},
|
||||||
>
|
]}
|
||||||
<Input />
|
name={["md_responsibility_centers", "ap", "accountnumber"]}
|
||||||
</Form.Item>
|
>
|
||||||
<Form.Item
|
<Input />
|
||||||
label={t("bodyshop.fields.responsibilitycenter_accountname")}
|
</Form.Item> */}
|
||||||
rules={[
|
<Form.Item
|
||||||
{
|
label={t("bodyshop.fields.responsibilitycenter_accountname")}
|
||||||
required: true,
|
rules={[
|
||||||
//message: t("general.validation.required"),
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
//message: t("general.validation.required"),
|
||||||
name={["md_responsibility_centers", "ap", "accountname"]}
|
},
|
||||||
>
|
]}
|
||||||
<Input />
|
name={["md_responsibility_centers", "ap", "accountname"]}
|
||||||
</Form.Item>
|
>
|
||||||
<Form.Item
|
<Input />
|
||||||
label={t("bodyshop.fields.responsibilitycenter_accountdesc")}
|
</Form.Item>
|
||||||
rules={[
|
<Form.Item
|
||||||
{
|
label={t("bodyshop.fields.responsibilitycenter_accountdesc")}
|
||||||
required: true,
|
rules={[
|
||||||
//message: t("general.validation.required"),
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
//message: t("general.validation.required"),
|
||||||
name={["md_responsibility_centers", "ap", "accountdesc"]}
|
},
|
||||||
>
|
]}
|
||||||
<Input />
|
name={["md_responsibility_centers", "ap", "accountdesc"]}
|
||||||
</Form.Item>
|
>
|
||||||
<Form.Item
|
<Input />
|
||||||
label={t("bodyshop.fields.responsibilitycenter_accountitem")}
|
</Form.Item>
|
||||||
rules={[
|
<Form.Item
|
||||||
{
|
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||||
required: true,
|
rules={[
|
||||||
//message: t("general.validation.required"),
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
//message: t("general.validation.required"),
|
||||||
name={["md_responsibility_centers", "ap", "accountitem"]}
|
},
|
||||||
>
|
]}
|
||||||
<Input />
|
name={["md_responsibility_centers", "ap", "dms_acctnumber"]}
|
||||||
</Form.Item>
|
>
|
||||||
</LayoutFormRow> */}
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
|
)}
|
||||||
<LayoutFormRow header={<div>Refund</div>}>
|
<LayoutFormRow header={<div>Refund</div>}>
|
||||||
{/* <Form.Item
|
{/* <Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenters.refund")}
|
label={t("bodyshop.fields.responsibilitycenters.refund")}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { DeleteFilled } from "@ant-design/icons";
|
import { DeleteFilled } from "@ant-design/icons";
|
||||||
import { useApolloClient } from "@apollo/client";
|
import { useApolloClient } from "@apollo/client";
|
||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
@@ -20,7 +21,23 @@ import PhoneFormItem, {
|
|||||||
} from "../form-items-formatted/phone-form-item.component";
|
} from "../form-items-formatted/phone-form-item.component";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
import VendorsPhonebookAdd from "../vendors-phonebook-add/vendors-phonebook-add.component";
|
import VendorsPhonebookAdd from "../vendors-phonebook-add/vendors-phonebook-add.component";
|
||||||
export default function VendorsFormComponent({
|
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(VendorsFormComponent);
|
||||||
|
|
||||||
|
export function VendorsFormComponent({
|
||||||
|
bodyshop,
|
||||||
form,
|
form,
|
||||||
formLoading,
|
formLoading,
|
||||||
handleDelete,
|
handleDelete,
|
||||||
@@ -29,6 +46,12 @@ export default function VendorsFormComponent({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
|
const { DmsAp } = useTreatments(
|
||||||
|
["DmsAp"],
|
||||||
|
{},
|
||||||
|
bodyshop && bodyshop.imexshopid
|
||||||
|
);
|
||||||
|
|
||||||
const { getFieldValue } = form;
|
const { getFieldValue } = form;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -184,6 +207,12 @@ export default function VendorsFormComponent({
|
|||||||
// </Form.Item>
|
// </Form.Item>
|
||||||
}
|
}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
|
{DmsAp.treatment === "on" && (
|
||||||
|
<Form.Item label={t("vendors.fields.dmsid")} name="dmsid">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
<Divider align="left">{t("vendors.labels.preferredmakes")}</Divider>
|
<Divider align="left">{t("vendors.labels.preferredmakes")}</Divider>
|
||||||
<Form.List name="favorite">
|
<Form.List name="favorite">
|
||||||
{(fields, { add, remove }) => {
|
{(fields, { add, remove }) => {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export const QUERY_VENDOR_BY_ID = gql`
|
|||||||
street1
|
street1
|
||||||
active
|
active
|
||||||
phone
|
phone
|
||||||
|
dmsid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
163
client/src/pages/dms-payables/dms-payables.container.jsx
Normal file
163
client/src/pages/dms-payables/dms-payables.container.jsx
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
import { Button, Card, Col, notification, Row, Select, Space } from "antd";
|
||||||
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { useHistory, useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import SocketIO from "socket.io-client";
|
||||||
|
import DmsAllocationsSummaryApComponent from "../../components/dms-allocations-summary-ap/dms-allocations-summary-ap.component";
|
||||||
|
import DmsLogEvents from "../../components/dms-log-events/dms-log-events.component";
|
||||||
|
import { auth } from "../../firebase/firebase.utils";
|
||||||
|
import {
|
||||||
|
setBreadcrumbs,
|
||||||
|
setSelectedHeader,
|
||||||
|
} from "../../redux/application/application.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||||
|
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer);
|
||||||
|
|
||||||
|
export const socket = SocketIO(
|
||||||
|
process.env.NODE_ENV === "production"
|
||||||
|
? process.env.REACT_APP_AXIOS_BASE_API_URL
|
||||||
|
: window.location.origin,
|
||||||
|
{
|
||||||
|
path: "/ws",
|
||||||
|
withCredentials: true,
|
||||||
|
auth: async (callback) => {
|
||||||
|
const token = auth.currentUser && (await auth.currentUser.getIdToken());
|
||||||
|
callback({ token });
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [logLevel, setLogLevel] = useState("DEBUG");
|
||||||
|
const history = useHistory();
|
||||||
|
const [logs, setLogs] = useState([]);
|
||||||
|
|
||||||
|
const { state } = useLocation();
|
||||||
|
|
||||||
|
const logsRef = useRef(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = t("titles.dms");
|
||||||
|
setSelectedHeader("dms");
|
||||||
|
setBreadcrumbs([
|
||||||
|
{
|
||||||
|
link: "/manage/accounting/payables",
|
||||||
|
label: t("titles.bc.accounting-payables"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: "/manage/dms",
|
||||||
|
label: t("titles.bc.dms"),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
socket.on("connect", () => socket.emit("set-log-level", logLevel));
|
||||||
|
socket.on("reconnect", () => {
|
||||||
|
setLogs((logs) => {
|
||||||
|
return [
|
||||||
|
...logs,
|
||||||
|
{
|
||||||
|
timestamp: new Date(),
|
||||||
|
level: "WARNING",
|
||||||
|
message: "Reconnected to CDK Export Service",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on("log-event", (payload) => {
|
||||||
|
setLogs((logs) => {
|
||||||
|
return [...logs, payload];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on("ap-export-complete", (payload) => {
|
||||||
|
notification.open({
|
||||||
|
type: "success",
|
||||||
|
message: t("jobs.labels.dms.apexported"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (socket.disconnected) socket.connect();
|
||||||
|
return () => {
|
||||||
|
socket.removeAllListeners();
|
||||||
|
socket.disconnect();
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!state?.billids) {
|
||||||
|
history.push(`/manage/accounting/payables`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col md={24} lg={12}>
|
||||||
|
<DmsAllocationsSummaryApComponent
|
||||||
|
socket={socket}
|
||||||
|
billids={state?.billids}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<Col md={24} lg={12}>
|
||||||
|
<div ref={logsRef}>
|
||||||
|
<Card
|
||||||
|
title={t("jobs.labels.dms.logs")}
|
||||||
|
extra={
|
||||||
|
<Space wrap>
|
||||||
|
<Select
|
||||||
|
placeholder="Log Level"
|
||||||
|
value={logLevel}
|
||||||
|
onChange={(value) => {
|
||||||
|
setLogLevel(value);
|
||||||
|
socket.emit("set-log-level", value);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Select.Option key="TRACE">TRACE</Select.Option>
|
||||||
|
<Select.Option key="DEBUG">DEBUG</Select.Option>
|
||||||
|
<Select.Option key="INFO">INFO</Select.Option>
|
||||||
|
<Select.Option key="WARNING">WARNING</Select.Option>
|
||||||
|
<Select.Option key="ERROR">ERROR</Select.Option>
|
||||||
|
</Select>
|
||||||
|
<Button onClick={() => setLogs([])}>Clear Logs</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
setLogs([]);
|
||||||
|
|
||||||
|
socket.disconnect();
|
||||||
|
socket.connect();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Reconnect
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<DmsLogEvents socket={socket} logs={logs} />
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const determineDmsType = (bodyshop) => {
|
||||||
|
if (bodyshop.cdk_dealerid) return "cdk";
|
||||||
|
else {
|
||||||
|
return "pbs";
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -164,6 +164,9 @@ const EmailTest = lazy(() =>
|
|||||||
);
|
);
|
||||||
const Dashboard = lazy(() => import("../dashboard/dashboard.container"));
|
const Dashboard = lazy(() => import("../dashboard/dashboard.container"));
|
||||||
const Dms = lazy(() => import("../dms/dms.container"));
|
const Dms = lazy(() => import("../dms/dms.container"));
|
||||||
|
const DmsPayables = lazy(() =>
|
||||||
|
import("../dms-payables/dms-payables.container")
|
||||||
|
);
|
||||||
|
|
||||||
const { Content, Footer } = Layout;
|
const { Content, Footer } = Layout;
|
||||||
|
|
||||||
@@ -391,6 +394,7 @@ export function Manage({ match, conflict, bodyshop }) {
|
|||||||
<Route exact path={`${match.path}/emailtest`} component={EmailTest} />
|
<Route exact path={`${match.path}/emailtest`} component={EmailTest} />
|
||||||
<Route exact path={`${match.path}/dashboard`} component={Dashboard} />
|
<Route exact path={`${match.path}/dashboard`} component={Dashboard} />
|
||||||
<Route exact path={`${match.path}/dms`} component={Dms} />
|
<Route exact path={`${match.path}/dms`} component={Dms} />
|
||||||
|
<Route exact path={`${match.path}/dmsap`} component={DmsPayables} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -437,6 +437,7 @@
|
|||||||
"ar": "Accounts Receivable",
|
"ar": "Accounts Receivable",
|
||||||
"ats": "ATS",
|
"ats": "ATS",
|
||||||
"federal_tax": "Federal Tax",
|
"federal_tax": "Federal Tax",
|
||||||
|
"federal_tax_itc": "Federal Tax Credit",
|
||||||
"gst_override": "GST Override Account #",
|
"gst_override": "GST Override Account #",
|
||||||
"la1": "LA1",
|
"la1": "LA1",
|
||||||
"la2": "LA2",
|
"la2": "LA2",
|
||||||
@@ -1038,6 +1039,7 @@
|
|||||||
"sendby": "Send By",
|
"sendby": "Send By",
|
||||||
"signin": "Sign In",
|
"signin": "Sign In",
|
||||||
"sms": "SMS",
|
"sms": "SMS",
|
||||||
|
"status": "Status",
|
||||||
"sub_status": {
|
"sub_status": {
|
||||||
"expired": "The subscription for this shop has expired. Please contact technical support to reactivate the subscription. "
|
"expired": "The subscription for this shop has expired. Please contact technical support to reactivate the subscription. "
|
||||||
},
|
},
|
||||||
@@ -1354,6 +1356,7 @@
|
|||||||
"depreciation_taxes": "Depreciation/Taxes",
|
"depreciation_taxes": "Depreciation/Taxes",
|
||||||
"dms": {
|
"dms": {
|
||||||
"address": "Customer Address",
|
"address": "Customer Address",
|
||||||
|
"amount": "Amount",
|
||||||
"center": "Center",
|
"center": "Center",
|
||||||
"cost": "Cost",
|
"cost": "Cost",
|
||||||
"cost_dms_acctnumber": "Cost DMS Acct #",
|
"cost_dms_acctnumber": "Cost DMS Acct #",
|
||||||
@@ -1363,6 +1366,7 @@
|
|||||||
"id": "DMS ID",
|
"id": "DMS ID",
|
||||||
"inservicedate": "In Service Date",
|
"inservicedate": "In Service Date",
|
||||||
"journal": "Journal #",
|
"journal": "Journal #",
|
||||||
|
"lines": "Posting Lines",
|
||||||
"name1": "Customer Name",
|
"name1": "Customer Name",
|
||||||
"payer": {
|
"payer": {
|
||||||
"amount": "Amount",
|
"amount": "Amount",
|
||||||
@@ -1616,6 +1620,7 @@
|
|||||||
"difference": "Difference",
|
"difference": "Difference",
|
||||||
"diskscan": "Scan Disk for Estimates",
|
"diskscan": "Scan Disk for Estimates",
|
||||||
"dms": {
|
"dms": {
|
||||||
|
"apexported": "AP export completed. See logs for details.",
|
||||||
"damageto": "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}}",
|
"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.",
|
"invoicedatefuture": "Invoice date must be today or in the future for CDK posting.",
|
||||||
@@ -2800,6 +2805,7 @@
|
|||||||
"country": "Country",
|
"country": "Country",
|
||||||
"discount": "Discount % (as decimal)",
|
"discount": "Discount % (as decimal)",
|
||||||
"display_name": "Display Name",
|
"display_name": "Display Name",
|
||||||
|
"dmsid": "DMS ID",
|
||||||
"due_date": "Payment Due Date (# of days)",
|
"due_date": "Payment Due Date (# of days)",
|
||||||
"email": "Contact Email",
|
"email": "Contact Email",
|
||||||
"favorite": "Favorite?",
|
"favorite": "Favorite?",
|
||||||
|
|||||||
@@ -437,6 +437,7 @@
|
|||||||
"ar": "",
|
"ar": "",
|
||||||
"ats": "",
|
"ats": "",
|
||||||
"federal_tax": "",
|
"federal_tax": "",
|
||||||
|
"federal_tax_itc": "",
|
||||||
"gst_override": "",
|
"gst_override": "",
|
||||||
"la1": "",
|
"la1": "",
|
||||||
"la2": "",
|
"la2": "",
|
||||||
@@ -1038,6 +1039,7 @@
|
|||||||
"sendby": "",
|
"sendby": "",
|
||||||
"signin": "",
|
"signin": "",
|
||||||
"sms": "",
|
"sms": "",
|
||||||
|
"status": "",
|
||||||
"sub_status": {
|
"sub_status": {
|
||||||
"expired": ""
|
"expired": ""
|
||||||
},
|
},
|
||||||
@@ -1354,6 +1356,7 @@
|
|||||||
"depreciation_taxes": "Depreciación / Impuestos",
|
"depreciation_taxes": "Depreciación / Impuestos",
|
||||||
"dms": {
|
"dms": {
|
||||||
"address": "",
|
"address": "",
|
||||||
|
"amount": "",
|
||||||
"center": "",
|
"center": "",
|
||||||
"cost": "",
|
"cost": "",
|
||||||
"cost_dms_acctnumber": "",
|
"cost_dms_acctnumber": "",
|
||||||
@@ -1363,6 +1366,7 @@
|
|||||||
"id": "",
|
"id": "",
|
||||||
"inservicedate": "",
|
"inservicedate": "",
|
||||||
"journal": "",
|
"journal": "",
|
||||||
|
"lines": "",
|
||||||
"name1": "",
|
"name1": "",
|
||||||
"payer": {
|
"payer": {
|
||||||
"amount": "",
|
"amount": "",
|
||||||
@@ -1616,6 +1620,7 @@
|
|||||||
"difference": "",
|
"difference": "",
|
||||||
"diskscan": "",
|
"diskscan": "",
|
||||||
"dms": {
|
"dms": {
|
||||||
|
"apexported": "",
|
||||||
"damageto": "",
|
"damageto": "",
|
||||||
"defaultstory": "",
|
"defaultstory": "",
|
||||||
"invoicedatefuture": "",
|
"invoicedatefuture": "",
|
||||||
@@ -2800,6 +2805,7 @@
|
|||||||
"country": "País",
|
"country": "País",
|
||||||
"discount": "% De descuento",
|
"discount": "% De descuento",
|
||||||
"display_name": "Nombre para mostrar",
|
"display_name": "Nombre para mostrar",
|
||||||
|
"dmsid": "",
|
||||||
"due_date": "Fecha de vencimiento del pago",
|
"due_date": "Fecha de vencimiento del pago",
|
||||||
"email": "Email de contacto",
|
"email": "Email de contacto",
|
||||||
"favorite": "¿Favorito?",
|
"favorite": "¿Favorito?",
|
||||||
|
|||||||
@@ -437,6 +437,7 @@
|
|||||||
"ar": "",
|
"ar": "",
|
||||||
"ats": "",
|
"ats": "",
|
||||||
"federal_tax": "",
|
"federal_tax": "",
|
||||||
|
"federal_tax_itc": "",
|
||||||
"gst_override": "",
|
"gst_override": "",
|
||||||
"la1": "",
|
"la1": "",
|
||||||
"la2": "",
|
"la2": "",
|
||||||
@@ -1038,6 +1039,7 @@
|
|||||||
"sendby": "",
|
"sendby": "",
|
||||||
"signin": "",
|
"signin": "",
|
||||||
"sms": "",
|
"sms": "",
|
||||||
|
"status": "",
|
||||||
"sub_status": {
|
"sub_status": {
|
||||||
"expired": ""
|
"expired": ""
|
||||||
},
|
},
|
||||||
@@ -1354,6 +1356,7 @@
|
|||||||
"depreciation_taxes": "Amortissement / taxes",
|
"depreciation_taxes": "Amortissement / taxes",
|
||||||
"dms": {
|
"dms": {
|
||||||
"address": "",
|
"address": "",
|
||||||
|
"amount": "",
|
||||||
"center": "",
|
"center": "",
|
||||||
"cost": "",
|
"cost": "",
|
||||||
"cost_dms_acctnumber": "",
|
"cost_dms_acctnumber": "",
|
||||||
@@ -1363,6 +1366,7 @@
|
|||||||
"id": "",
|
"id": "",
|
||||||
"inservicedate": "",
|
"inservicedate": "",
|
||||||
"journal": "",
|
"journal": "",
|
||||||
|
"lines": "",
|
||||||
"name1": "",
|
"name1": "",
|
||||||
"payer": {
|
"payer": {
|
||||||
"amount": "",
|
"amount": "",
|
||||||
@@ -1616,6 +1620,7 @@
|
|||||||
"difference": "",
|
"difference": "",
|
||||||
"diskscan": "",
|
"diskscan": "",
|
||||||
"dms": {
|
"dms": {
|
||||||
|
"apexported": "",
|
||||||
"damageto": "",
|
"damageto": "",
|
||||||
"defaultstory": "",
|
"defaultstory": "",
|
||||||
"invoicedatefuture": "",
|
"invoicedatefuture": "",
|
||||||
@@ -2800,6 +2805,7 @@
|
|||||||
"country": "Pays",
|
"country": "Pays",
|
||||||
"discount": "Remise %",
|
"discount": "Remise %",
|
||||||
"display_name": "Afficher un nom",
|
"display_name": "Afficher un nom",
|
||||||
|
"dmsid": "",
|
||||||
"due_date": "Date limite de paiement",
|
"due_date": "Date limite de paiement",
|
||||||
"email": "Email du contact",
|
"email": "Email du contact",
|
||||||
"favorite": "Préféré?",
|
"favorite": "Préféré?",
|
||||||
|
|||||||
3076
client/yarn.lock
3076
client/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -5396,6 +5396,7 @@
|
|||||||
- country
|
- country
|
||||||
- created_at
|
- created_at
|
||||||
- discount
|
- discount
|
||||||
|
- dmsid
|
||||||
- due_date
|
- due_date
|
||||||
- email
|
- email
|
||||||
- favorite
|
- favorite
|
||||||
@@ -5418,6 +5419,7 @@
|
|||||||
- country
|
- country
|
||||||
- created_at
|
- created_at
|
||||||
- discount
|
- discount
|
||||||
|
- dmsid
|
||||||
- due_date
|
- due_date
|
||||||
- email
|
- email
|
||||||
- favorite
|
- favorite
|
||||||
@@ -5450,6 +5452,7 @@
|
|||||||
- country
|
- country
|
||||||
- created_at
|
- created_at
|
||||||
- discount
|
- discount
|
||||||
|
- dmsid
|
||||||
- due_date
|
- due_date
|
||||||
- email
|
- email
|
||||||
- favorite
|
- favorite
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."vendors" add column "dmsid" text
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."vendors" add column "dmsid" text
|
||||||
|
null;
|
||||||
@@ -64,11 +64,7 @@ app.use(
|
|||||||
//Email Based Paths.
|
//Email Based Paths.
|
||||||
var sendEmail = require("./server/email/sendemail.js");
|
var sendEmail = require("./server/email/sendemail.js");
|
||||||
app.post("/sendemail", fb.validateFirebaseIdToken, sendEmail.sendEmail);
|
app.post("/sendemail", fb.validateFirebaseIdToken, sendEmail.sendEmail);
|
||||||
app.post(
|
app.post("/emailbounce", bodyParser.text(), sendEmail.emailBounce);
|
||||||
"/emailbounce",
|
|
||||||
bodyParser.text(),
|
|
||||||
sendEmail.emailBounce
|
|
||||||
);
|
|
||||||
|
|
||||||
//Test route to ensure Express is responding.
|
//Test route to ensure Express is responding.
|
||||||
app.get("/test", async function (req, res) {
|
app.get("/test", async function (req, res) {
|
||||||
|
|||||||
285
server/accounting/pbs/pbs-ap-allocations.js
Normal file
285
server/accounting/pbs/pbs-ap-allocations.js
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
const path = require("path");
|
||||||
|
require("dotenv").config({
|
||||||
|
path: path.resolve(
|
||||||
|
process.cwd(),
|
||||||
|
`.env.${process.env.NODE_ENV || "development"}`
|
||||||
|
),
|
||||||
|
});
|
||||||
|
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||||
|
|
||||||
|
const queries = require("../../graphql-client/queries");
|
||||||
|
const CdkBase = require("../../web-sockets/web-socket");
|
||||||
|
const moment = require("moment");
|
||||||
|
const Dinero = require("dinero.js");
|
||||||
|
const AxiosLib = require("axios").default;
|
||||||
|
const axios = AxiosLib.create();
|
||||||
|
const { PBS_ENDPOINTS, PBS_CREDENTIALS } = require("./pbs-constants");
|
||||||
|
const { CheckForErrors } = require("./pbs-job-export");
|
||||||
|
const uuid = require("uuid").v4;
|
||||||
|
axios.interceptors.request.use((x) => {
|
||||||
|
const socket = x.socket;
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
...x.headers.common,
|
||||||
|
...x.headers[x.method],
|
||||||
|
...x.headers,
|
||||||
|
};
|
||||||
|
const printable = `${new Date()} | Request: ${x.method.toUpperCase()} | ${
|
||||||
|
x.url
|
||||||
|
} | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`;
|
||||||
|
console.log(printable);
|
||||||
|
|
||||||
|
CdkBase.createJsonEvent(socket, "TRACE", `Raw Request: ${printable}`, x.data);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
});
|
||||||
|
|
||||||
|
axios.interceptors.response.use((x) => {
|
||||||
|
const socket = x.config.socket;
|
||||||
|
|
||||||
|
const printable = `${new Date()} | Response: ${x.status} | ${JSON.stringify(
|
||||||
|
x.data
|
||||||
|
)}`;
|
||||||
|
console.log(printable);
|
||||||
|
CdkBase.createJsonEvent(
|
||||||
|
socket,
|
||||||
|
"TRACE",
|
||||||
|
`Raw Response: ${printable}`,
|
||||||
|
x.data
|
||||||
|
);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
});
|
||||||
|
|
||||||
|
async function PbsCalculateAllocationsAp(socket, billids) {
|
||||||
|
try {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"DEBUG",
|
||||||
|
`Received request to calculate allocations for ${billids}`
|
||||||
|
);
|
||||||
|
const { bills, bodyshops } = await QueryBillData(socket, billids);
|
||||||
|
const bodyshop = bodyshops[0];
|
||||||
|
socket.bodyshop = bodyshop;
|
||||||
|
socket.bills = bills;
|
||||||
|
|
||||||
|
//Each bill will enter it's own top level transaction.
|
||||||
|
|
||||||
|
const transactionlist = [];
|
||||||
|
if (bills.length === 0) {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"ERROR",
|
||||||
|
`No bills found for export. Ensure they have not already been exported and try again.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
bills.forEach((bill) => {
|
||||||
|
//Keep the allocations at the bill level.
|
||||||
|
|
||||||
|
const transactionObject = {
|
||||||
|
SerialNumber: socket.bodyshop.pbs_serialnumber,
|
||||||
|
billid: bill.id,
|
||||||
|
Posting: {
|
||||||
|
Reference: bill.invoice_number,
|
||||||
|
JournalCode: socket.txEnvelope ? socket.txEnvelope.journal : null,
|
||||||
|
TransactionDate: moment().tz(socket.bodyshop.timezone).toISOString(), //"0001-01-01T00:00:00.0000000Z",
|
||||||
|
//Description: "Bulk AP posting.",
|
||||||
|
//AdditionalInfo: "String",
|
||||||
|
Source: "ImEX Online",
|
||||||
|
Lines: [], //socket.apAllocations,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const billHash = {
|
||||||
|
[bodyshop.md_responsibility_centers.taxes.federal_itc.name]: {
|
||||||
|
Account:
|
||||||
|
bodyshop.md_responsibility_centers.taxes.federal_itc.dms_acctnumber,
|
||||||
|
ControlNumber: bill.vendor.dmsid,
|
||||||
|
Amount: Dinero(),
|
||||||
|
// Comment: "String",
|
||||||
|
AdditionalInfo: bill.vendor.name,
|
||||||
|
InvoiceNumber: bill.invoice_number,
|
||||||
|
InvoiceDate: moment(bill.date).tz(bodyshop.timezone).toISOString(),
|
||||||
|
},
|
||||||
|
[bodyshop.md_responsibility_centers.taxes.state.name]: {
|
||||||
|
Account:
|
||||||
|
bodyshop.md_responsibility_centers.taxes.state.dms_acctnumber,
|
||||||
|
ControlNumber: bill.vendor.dmsid,
|
||||||
|
Amount: Dinero(),
|
||||||
|
// Comment: "String",
|
||||||
|
AdditionalInfo: bill.vendor.name,
|
||||||
|
InvoiceNumber: bill.invoice_number,
|
||||||
|
InvoiceDate: moment(bill.date).tz(bodyshop.timezone).toISOString(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
bill.billlines.forEach((bl) => {
|
||||||
|
let lineDinero = Dinero({
|
||||||
|
amount: Math.round((bl.actual_cost || 0) * 100),
|
||||||
|
})
|
||||||
|
.multiply(bl.quantity)
|
||||||
|
.multiply(bill.is_credit_memo ? -1 : 1);
|
||||||
|
const cc = getCostAccount(bl, bodyshop.md_responsibility_centers);
|
||||||
|
|
||||||
|
if (!billHash[cc.name]) {
|
||||||
|
billHash[cc.name] = {
|
||||||
|
Account: cc.dms_acctnumber,
|
||||||
|
ControlNumber: bill.vendor.dmsid,
|
||||||
|
Amount: Dinero(),
|
||||||
|
// Comment: "String",
|
||||||
|
AdditionalInfo: bill.vendor.name,
|
||||||
|
InvoiceNumber: bill.invoice_number,
|
||||||
|
InvoiceDate: moment(bill.date).tz(bodyshop.timezone).toISOString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add the line amount.
|
||||||
|
billHash[cc.name] = {
|
||||||
|
...billHash[cc.name],
|
||||||
|
Amount: billHash[cc.name].Amount.add(lineDinero),
|
||||||
|
};
|
||||||
|
|
||||||
|
//Does the line have taxes?
|
||||||
|
if (bl.applicable_taxes.federal) {
|
||||||
|
billHash[bodyshop.md_responsibility_centers.taxes.federal_itc.name] =
|
||||||
|
{
|
||||||
|
...billHash[
|
||||||
|
bodyshop.md_responsibility_centers.taxes.federal_itc.name
|
||||||
|
],
|
||||||
|
Amount: billHash[
|
||||||
|
bodyshop.md_responsibility_centers.taxes.federal_itc.name
|
||||||
|
].Amount.add(lineDinero.percentage(bill.federal_tax_rate || 0)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (bl.applicable_taxes.state) {
|
||||||
|
billHash[bodyshop.md_responsibility_centers.taxes.state.name] = {
|
||||||
|
...billHash[bodyshop.md_responsibility_centers.taxes.state.name],
|
||||||
|
Amount: billHash[
|
||||||
|
bodyshop.md_responsibility_centers.taxes.state.name
|
||||||
|
].Amount.add(lineDinero.percentage(bill.state_tax_rate || 0)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//End tax check
|
||||||
|
});
|
||||||
|
|
||||||
|
let APAmount = Dinero();
|
||||||
|
Object.keys(billHash).map((key) => {
|
||||||
|
if (billHash[key].Amount.getAmount() > 0) {
|
||||||
|
transactionObject.Posting.Lines.push({
|
||||||
|
...billHash[key],
|
||||||
|
Amount: billHash[key].Amount.toFormat("0.00"),
|
||||||
|
});
|
||||||
|
APAmount = APAmount.add(billHash[key].Amount); //Calculate the total expense for the bill iteratively to create the corresponding credit to AP.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
transactionObject.Posting.Lines.push({
|
||||||
|
Account: bodyshop.md_responsibility_centers.ap.dms_acctnumber,
|
||||||
|
ControlNumber: bill.vendor.dmsid,
|
||||||
|
Amount: APAmount.multiply(-1).toFormat("0.00"),
|
||||||
|
// Comment: "String",
|
||||||
|
AdditionalInfo: bill.vendor.name,
|
||||||
|
InvoiceNumber: bill.invoice_number,
|
||||||
|
InvoiceDate: moment(bill.date).tz(bodyshop.timezone).toISOString(),
|
||||||
|
});
|
||||||
|
|
||||||
|
transactionlist.push(transactionObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
return transactionlist;
|
||||||
|
} catch (error) {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"ERROR",
|
||||||
|
`Error encountered in PbsCalculateAllocationsAp. ${error}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.PbsCalculateAllocationsAp = PbsCalculateAllocationsAp;
|
||||||
|
|
||||||
|
async function QueryBillData(socket, billids) {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"DEBUG",
|
||||||
|
`Querying bill data for id(s) ${billids}`
|
||||||
|
);
|
||||||
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
|
const result = await client
|
||||||
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
|
.request(queries.GET_PBS_AP_ALLOCATIONS, { billids: billids });
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"TRACE",
|
||||||
|
`Bill data query result ${JSON.stringify(result, null, 2)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//@returns the account object.
|
||||||
|
function getCostAccount(billline, respcenters) {
|
||||||
|
if (!billline.cost_center) return null;
|
||||||
|
|
||||||
|
const acctName = respcenters.defaults.costs[billline.cost_center];
|
||||||
|
|
||||||
|
return respcenters.costs.find((c) => c.name === acctName);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.PbsExportAp = async function (socket, { billids, txEnvelope }) {
|
||||||
|
CdkBase.createLogEvent(socket, "DEBUG", `Exporting selected AP.`);
|
||||||
|
|
||||||
|
//apAllocations has the same shap as the lines key for the accounting posting to PBS.
|
||||||
|
socket.apAllocations = await PbsCalculateAllocationsAp(socket, billids);
|
||||||
|
socket.txEnvelope = txEnvelope;
|
||||||
|
for (const allocation of socket.apAllocations) {
|
||||||
|
const { billid, ...restAllocation } = allocation;
|
||||||
|
const { data: AccountPostingChange } = await axios.post(
|
||||||
|
PBS_ENDPOINTS.AccountingPostingChange,
|
||||||
|
restAllocation,
|
||||||
|
{ auth: PBS_CREDENTIALS, socket }
|
||||||
|
);
|
||||||
|
|
||||||
|
CheckForErrors(socket, AccountPostingChange);
|
||||||
|
|
||||||
|
if (AccountPostingChange.WasSuccessful) {
|
||||||
|
CdkBase.createLogEvent(socket, "DEBUG", `Marking bill as exported.`);
|
||||||
|
await MarkApExported(socket, [billid]);
|
||||||
|
|
||||||
|
socket.emit("ap-export-success", billid);
|
||||||
|
} else {
|
||||||
|
CdkBase.createLogEvent(socket, "ERROR", `Export was not succesful.`);
|
||||||
|
socket.emit("ap-export-failure", {
|
||||||
|
billid,
|
||||||
|
error: AccountPostingChange.Message,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.emit("ap-export-complete");
|
||||||
|
};
|
||||||
|
|
||||||
|
async function MarkApExported(socket, billids) {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"DEBUG",
|
||||||
|
`Marking bills as exported for id ${billids}`
|
||||||
|
);
|
||||||
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
|
const result = await client
|
||||||
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
|
.request(queries.MARK_BILLS_EXPORTED, {
|
||||||
|
billids,
|
||||||
|
bill: {
|
||||||
|
exported: true,
|
||||||
|
exported_at: new Date(),
|
||||||
|
},
|
||||||
|
logs: socket.bills.map((bill) => ({
|
||||||
|
bodyshopid: socket.bodyshop.id,
|
||||||
|
billid: bill.id,
|
||||||
|
successful: true,
|
||||||
|
useremail: socket.user.email,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -182,6 +182,8 @@ async function CheckForErrors(socket, response) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.CheckForErrors = CheckForErrors;
|
||||||
|
|
||||||
async function QueryJobData(socket, jobid) {
|
async function QueryJobData(socket, jobid) {
|
||||||
CdkBase.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
|
CdkBase.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
|
|||||||
@@ -1506,6 +1506,23 @@ mutation MARK_JOB_EXPORTED($jobId: uuid!, $job: jobs_set_input!, $log: exportlog
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports.MARK_BILLS_EXPORTED = `
|
||||||
|
mutation UPDATE_BILLS($billids: [uuid!]!, $bill: bills_set_input!, $logs: [exportlog_insert_input!]!) {
|
||||||
|
update_bills(where: {id: {_in: $billids}}, _set: $bill) {
|
||||||
|
returning {
|
||||||
|
id
|
||||||
|
exported
|
||||||
|
exported_at
|
||||||
|
}
|
||||||
|
}
|
||||||
|
insert_exportlog(objects: $logs) {
|
||||||
|
returning{
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
exports.INSERT_EXPORT_LOG = `
|
exports.INSERT_EXPORT_LOG = `
|
||||||
mutation INSERT_EXPORT_LOG($log: exportlog_insert_input!) {
|
mutation INSERT_EXPORT_LOG($log: exportlog_insert_input!) {
|
||||||
insert_exportlog_one(object: $log) {
|
insert_exportlog_one(object: $log) {
|
||||||
@@ -1633,3 +1650,46 @@ mutation ($sesid: String!, $status: String, $context: jsonb) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
|
exports.GET_PBS_AP_ALLOCATIONS = `
|
||||||
|
query GET_PBS_AP_ALLOCATIONS($billids: [uuid!]) {
|
||||||
|
bodyshops(where: {associations: {active: {_eq: true}}}) {
|
||||||
|
md_responsibility_centers
|
||||||
|
timezone
|
||||||
|
pbs_serialnumber
|
||||||
|
id
|
||||||
|
}
|
||||||
|
bills(where: {id: {_in: $billids}, exported:{_eq: false}}) {
|
||||||
|
id
|
||||||
|
date
|
||||||
|
isinhouse
|
||||||
|
invoice_number
|
||||||
|
federal_tax_rate
|
||||||
|
is_credit_memo
|
||||||
|
jobid
|
||||||
|
job {
|
||||||
|
id
|
||||||
|
ro_number
|
||||||
|
}
|
||||||
|
local_tax_rate
|
||||||
|
state_tax_rate
|
||||||
|
total
|
||||||
|
vendorid
|
||||||
|
vendor {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
dmsid
|
||||||
|
}
|
||||||
|
billlines {
|
||||||
|
id
|
||||||
|
actual_cost
|
||||||
|
actual_price
|
||||||
|
applicable_taxes
|
||||||
|
cost_center
|
||||||
|
deductedfromlbr
|
||||||
|
lbr_adjustment
|
||||||
|
quantity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ const {
|
|||||||
PbsSelectedCustomer,
|
PbsSelectedCustomer,
|
||||||
} = require("../accounting/pbs/pbs-job-export");
|
} = require("../accounting/pbs/pbs-job-export");
|
||||||
|
|
||||||
|
const {
|
||||||
|
PbsCalculateAllocationsAp,
|
||||||
|
PbsExportAp,
|
||||||
|
} = require("../accounting/pbs/pbs-ap-allocations");
|
||||||
|
|
||||||
io.use(function (socket, next) {
|
io.use(function (socket, next) {
|
||||||
try {
|
try {
|
||||||
if (socket.handshake.auth.token) {
|
if (socket.handshake.auth.token) {
|
||||||
@@ -101,7 +106,7 @@ io.on("connection", (socket) => {
|
|||||||
});
|
});
|
||||||
//END CDK
|
//END CDK
|
||||||
|
|
||||||
//PBS
|
//PBS AR
|
||||||
socket.on("pbs-calculate-allocations", async (jobid, callback) => {
|
socket.on("pbs-calculate-allocations", async (jobid, callback) => {
|
||||||
const allocations = await CdkCalculateAllocations(socket, jobid);
|
const allocations = await CdkCalculateAllocations(socket, jobid);
|
||||||
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
|
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
|
||||||
@@ -125,7 +130,27 @@ io.on("connection", (socket) => {
|
|||||||
socket.selectedCustomerId = selectedCustomerId;
|
socket.selectedCustomerId = selectedCustomerId;
|
||||||
PbsSelectedCustomer(socket, selectedCustomerId);
|
PbsSelectedCustomer(socket, selectedCustomerId);
|
||||||
});
|
});
|
||||||
//End PBS
|
//End PBS AR
|
||||||
|
|
||||||
|
//PBS AP
|
||||||
|
socket.on("pbs-calculate-allocations-ap", async (billids, callback) => {
|
||||||
|
const allocations = await PbsCalculateAllocationsAp(socket, billids);
|
||||||
|
createLogEvent(socket, "DEBUG", `AP Allocations calculated.`);
|
||||||
|
createLogEvent(
|
||||||
|
socket,
|
||||||
|
"TRACE",
|
||||||
|
`Allocations calculated. ${JSON.stringify(allocations, null, 2)}`
|
||||||
|
);
|
||||||
|
socket.apAllocations = allocations;
|
||||||
|
callback(allocations);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on("pbs-export-ap", ({ billids, txEnvelope }) => {
|
||||||
|
socket.txEnvelope = txEnvelope;
|
||||||
|
PbsExportAp(socket, { billids, txEnvelope });
|
||||||
|
});
|
||||||
|
|
||||||
|
//END PBS AP
|
||||||
|
|
||||||
socket.on("disconnect", () => {
|
socket.on("disconnect", () => {
|
||||||
createLogEvent(socket, "DEBUG", `User disconnected.`);
|
createLogEvent(socket, "DEBUG", `User disconnected.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user