Compare commits
264 Commits
feature/cd
...
feature/cd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6aacce5a58 | ||
|
|
80dc04669c | ||
|
|
a702c87986 | ||
|
|
fd161fa9eb | ||
|
|
44a18f4ace | ||
|
|
3269c4f602 | ||
|
|
43cbf0084a | ||
|
|
28b1356f76 | ||
|
|
38456cb213 | ||
|
|
8c826eaaed | ||
|
|
f047556ab5 | ||
|
|
057b335e82 | ||
|
|
30c7da2bf9 | ||
|
|
82fb4fc74c | ||
|
|
151f122b8c | ||
|
|
b198ca5051 | ||
|
|
d9abe84949 | ||
|
|
17f4d69e30 | ||
|
|
77d3fc359d | ||
|
|
86151f3337 | ||
|
|
ae4b5bca33 | ||
|
|
eb120a264e | ||
|
|
7e3f496ea1 | ||
|
|
4d33f16f13 | ||
|
|
d7ebefe7ab | ||
|
|
8dc2197677 | ||
|
|
fe993cba73 | ||
|
|
ef6cdf07d8 | ||
|
|
cdbde6f5fa | ||
|
|
4059aa9875 | ||
|
|
22e30ae5cb | ||
|
|
78c883743f | ||
|
|
e46307e715 | ||
|
|
f3e078b481 | ||
|
|
c03f54b3eb | ||
|
|
bb0234fb7d | ||
|
|
03f25c8c0e | ||
|
|
8e5005daa0 | ||
|
|
259458eec3 | ||
|
|
59e57aa274 | ||
|
|
de33bcd72b | ||
|
|
d72472ccc3 | ||
|
|
91efd170c8 | ||
|
|
6f1ddd51fd | ||
|
|
9f48a91a29 | ||
|
|
a7e2548e14 | ||
|
|
3294faaeaa | ||
|
|
06480159e3 | ||
|
|
6ce06ed5c0 | ||
|
|
71e535388a | ||
|
|
dbd265d368 | ||
|
|
c11f182f83 | ||
|
|
5f70cfd585 | ||
|
|
6e0675f28b | ||
|
|
96f45d2c80 | ||
|
|
091e44f471 | ||
|
|
00549d6a88 | ||
|
|
d940e0ee78 | ||
|
|
39a38d46ee | ||
|
|
71435ed75a | ||
|
|
e7ec408b98 | ||
|
|
9306064420 | ||
|
|
37a16edfb4 | ||
|
|
9ad5b9547f | ||
|
|
47edb0bdf4 | ||
|
|
5db47e879c | ||
|
|
54b46dd25e | ||
|
|
4cb92c8508 | ||
|
|
cb76e2dcde | ||
|
|
901c64ed85 | ||
|
|
f6f90d68fa | ||
|
|
05e295fcac | ||
|
|
c97df6dc61 | ||
|
|
61406aafa6 | ||
|
|
03210db711 | ||
|
|
b3a34c109a | ||
|
|
81daad35d8 | ||
|
|
529eb24d76 | ||
|
|
e81bf7b561 | ||
|
|
7a35dc9b38 | ||
|
|
c72ef97b82 | ||
|
|
5284ee2ef9 | ||
|
|
724c097d52 | ||
|
|
3c3da178ba | ||
|
|
db4e5d48af | ||
|
|
a7cf081ed5 | ||
|
|
db5b11f6d3 | ||
|
|
8d3d52485f | ||
|
|
edb58ebc81 | ||
|
|
971b518e8f | ||
|
|
8d9507dce1 | ||
|
|
748f8f472d | ||
|
|
db2b4739c2 | ||
|
|
6c12e5cb03 | ||
|
|
140e57a123 | ||
|
|
3ca6791939 | ||
|
|
1c473c95a2 | ||
|
|
7e145bdec7 | ||
|
|
44c17bd7a2 | ||
|
|
c493f6e31e | ||
|
|
5213b0b315 | ||
|
|
8bfd0a1c16 | ||
|
|
0541167cc5 | ||
|
|
834966ae96 | ||
|
|
e7d813c3f3 | ||
|
|
26e47ff203 | ||
|
|
d2b2a5399d | ||
|
|
5a4d6d3e8c | ||
|
|
61a5e180f4 | ||
|
|
d5b8ea3ac5 | ||
|
|
4e87ef179b | ||
|
|
3b7c31626d | ||
|
|
a57e35354d | ||
|
|
a269fd3ad8 | ||
|
|
86bee9ad0d | ||
|
|
f8b57ca9bd | ||
|
|
5f7b780195 | ||
|
|
ba5400d04a | ||
|
|
0190e737c1 | ||
|
|
db64d9b69f | ||
|
|
0d12ab36a9 | ||
|
|
8f52efbaca | ||
|
|
d6dc5db185 | ||
|
|
58d1859640 | ||
|
|
dba648aea2 | ||
|
|
12f6206f88 | ||
|
|
7d9fd06b6d | ||
|
|
d6fbf16272 | ||
|
|
b68de683b0 | ||
|
|
2f9d025fbe | ||
|
|
9c1ffaba17 | ||
|
|
142df39cd2 | ||
|
|
ef79ccc299 | ||
|
|
6d2d96be5c | ||
|
|
8ff2a6e6c4 | ||
|
|
b793aa3394 | ||
|
|
be2cfb908a | ||
|
|
e34084b146 | ||
|
|
c1d7168260 | ||
|
|
b3a3709b72 | ||
|
|
dd59f3d026 | ||
|
|
ccb00ff391 | ||
|
|
b37970a6df | ||
|
|
2cd7fcfbd8 | ||
|
|
77819b06fe | ||
|
|
4e936b4cff | ||
|
|
b2362a85fa | ||
|
|
f45f351678 | ||
|
|
311171fa0a | ||
|
|
7e05f03f4d | ||
|
|
76826c1e80 | ||
|
|
18618efdc0 | ||
|
|
d1952dfc25 | ||
|
|
fe5f4f2727 | ||
|
|
fd7c907b8f | ||
|
|
0273255c2c | ||
|
|
e86160e530 | ||
|
|
9f7e0d611a | ||
|
|
0b523efa95 | ||
|
|
6b64499e24 | ||
|
|
e78e628bec | ||
|
|
ed8eb51c2f | ||
|
|
124d68ef68 | ||
|
|
3e802c1465 | ||
|
|
ac18e78897 | ||
|
|
e37ee39e88 | ||
|
|
fed16a4aa3 | ||
|
|
8c94dfce9e | ||
|
|
69c13dd052 | ||
|
|
a5fe54164e | ||
|
|
5ecd5a5a5c | ||
|
|
ed45347c23 | ||
|
|
3e0385479f | ||
|
|
36f833be91 | ||
|
|
8fb39f9ea4 | ||
|
|
5b84ebbc25 | ||
|
|
b0ec7867b5 | ||
|
|
4e4c59ce4d | ||
|
|
e9bf1c05ad | ||
|
|
7ac1fa5abf | ||
|
|
a489ac1d26 | ||
|
|
4d7a7442ce | ||
|
|
a19bce5a37 | ||
|
|
35782244bf | ||
|
|
7407429344 | ||
|
|
55c532f6e2 | ||
|
|
d3c8b5d731 | ||
|
|
cf09f98d7e | ||
|
|
d8e8a8e4e9 | ||
|
|
65210dea2f | ||
|
|
0c9b850872 | ||
|
|
99486830b7 | ||
|
|
74a62a46d3 | ||
|
|
d306041bcf | ||
|
|
ae8a924cd6 | ||
|
|
6ab1b9f787 | ||
|
|
46ddc440fe | ||
|
|
6bf8eacfbd | ||
|
|
b2fa4f220d | ||
|
|
2f175c304c | ||
|
|
79714e5708 | ||
|
|
7c5aa9c913 | ||
|
|
59b8bae182 | ||
|
|
35323ba624 | ||
|
|
8ca3741a52 | ||
|
|
c3c021774e | ||
|
|
6b811d635b | ||
|
|
97aecd3ddc | ||
|
|
c4fdef445e | ||
|
|
e642087360 | ||
|
|
098754125b | ||
|
|
6ce2d2723b | ||
|
|
ae4a864533 | ||
|
|
27d9322ced | ||
|
|
f5003080db | ||
|
|
79e11dda4c | ||
|
|
3b992edc21 | ||
|
|
f75f88840f | ||
|
|
3e1663bf18 | ||
|
|
9a60149d75 | ||
|
|
11cfef904b | ||
|
|
a45dcd307b | ||
|
|
54b483333f | ||
|
|
7f4a36038e | ||
|
|
990ec1a553 | ||
|
|
12307cbd56 | ||
|
|
6bd49a461e | ||
|
|
c9ed8a9360 | ||
|
|
120d6f9f5f | ||
|
|
0d30fc0e32 | ||
|
|
6f64cb71f2 | ||
|
|
7ce4264309 | ||
|
|
5385e6918b | ||
|
|
a8ad65000d | ||
|
|
7a6a834998 | ||
|
|
ae9ca0ac3b | ||
|
|
9fd23e9181 | ||
|
|
a288a1a2a4 | ||
|
|
33e2201524 | ||
|
|
34422dfef7 | ||
|
|
7999895323 | ||
|
|
c6635845f5 | ||
|
|
e770232e1d | ||
|
|
51dcf3a7c6 | ||
|
|
afd745917d | ||
|
|
aa8e12ef58 | ||
|
|
41bbda7bcf | ||
|
|
f19289362d | ||
|
|
71ef3dadc5 | ||
|
|
2d546d92b5 | ||
|
|
1360a73028 | ||
|
|
7de224831f | ||
|
|
e9cda93898 | ||
|
|
2c1f5a9f34 | ||
|
|
d88d7ebebd | ||
|
|
17dcc2efd8 | ||
|
|
991df9c48f | ||
|
|
3391d7d3f4 | ||
|
|
bccb5e353b | ||
|
|
8cbef14ea3 | ||
|
|
8e05105917 | ||
|
|
81babca775 | ||
|
|
fe8dd2a920 | ||
|
|
3176cfcc56 |
@@ -1 +1 @@
|
|||||||
client_max_body_size 15M;
|
client_max_body_size 50M;
|
||||||
17689
_reference/CDK Testing Accounts
Normal file
17689
_reference/CDK Testing Accounts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,25 @@
|
|||||||
// craco.config.js
|
// craco.config.js
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const CracoLessPlugin = require("craco-less");
|
const CracoLessPlugin = require("craco-less");
|
||||||
|
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
{
|
||||||
|
plugin: SentryWebpackPlugin,
|
||||||
|
options: {
|
||||||
|
// sentry-cli configuration
|
||||||
|
authToken:
|
||||||
|
"6b45b028a02342db97a9a2f92c0959058665443d379d4a3a876430009e744260",
|
||||||
|
org: "snapt-software",
|
||||||
|
project: "imexonline",
|
||||||
|
release: process.env.REACT_APP_GIT_SHA,
|
||||||
|
|
||||||
|
// webpack-specific configuration
|
||||||
|
include: ".",
|
||||||
|
ignore: ["node_modules", "webpack.config.js"],
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
plugin: CracoLessPlugin,
|
plugin: CracoLessPlugin,
|
||||||
options: {
|
options: {
|
||||||
@@ -53,4 +69,5 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
devtool: "source-map",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,81 +4,87 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"proxy": "http://localhost:5000",
|
"proxy": "http://localhost:5000",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.3.17",
|
"@apollo/client": "^3.4.10",
|
||||||
"@craco/craco": "^5.9.0",
|
"@craco/craco": "^6.2.0",
|
||||||
"@fingerprintjs/fingerprintjs": "^3.1.2",
|
"@fingerprintjs/fingerprintjs": "^3.3.0",
|
||||||
"@lourenci/react-kanban": "^2.1.0",
|
"@lourenci/react-kanban": "^2.1.0",
|
||||||
"@sentry/react": "^6.3.6",
|
"@openreplay/tracker": "^3.3.1",
|
||||||
"@sentry/tracing": "^6.3.6",
|
"@openreplay/tracker-assist": "^3.1.1",
|
||||||
|
"@openreplay/tracker-graphql": "^3.0.0",
|
||||||
|
"@openreplay/tracker-redux": "^3.0.0",
|
||||||
|
"@sentry/react": "^6.11.0",
|
||||||
|
"@sentry/tracing": "^6.11.0",
|
||||||
"@stripe/react-stripe-js": "^1.4.0",
|
"@stripe/react-stripe-js": "^1.4.0",
|
||||||
"@stripe/stripe-js": "^1.14.0",
|
"@stripe/stripe-js": "^1.17.1",
|
||||||
"@tanem/react-nprogress": "^3.0.65",
|
"@tanem/react-nprogress": "^3.0.79",
|
||||||
"antd": "^4.15.5",
|
"antd": "^4.16.13",
|
||||||
"apollo-link-logger": "^2.0.0",
|
"apollo-link-logger": "^2.0.0",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.4",
|
||||||
"craco-less": "^1.17.1",
|
"craco-less": "^1.20.0",
|
||||||
"dinero.js": "^1.8.1",
|
"dinero.js": "^1.9.0",
|
||||||
"dotenv": "^9.0.2",
|
"dotenv": "^10.0.0",
|
||||||
"enquire-js": "^0.2.1",
|
"enquire-js": "^0.2.1",
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"exifr": "^7.0.0",
|
"exifr": "^7.1.3",
|
||||||
"firebase": "^8.6.0",
|
"firebase": "^9.0.0",
|
||||||
"graphql": "^15.5.0",
|
"graphql": "^15.5.3",
|
||||||
"i18next": "^20.2.2",
|
"i18next": "^20.4.0",
|
||||||
"i18next-browser-languagedetector": "^6.1.1",
|
"i18next-browser-languagedetector": "^6.1.2",
|
||||||
"jsoneditor": "^9.4.1",
|
"jsoneditor": "^9.5.4",
|
||||||
"jsreport-browser-client-dist": "^1.3.0",
|
"jsreport-browser-client-dist": "^1.3.0",
|
||||||
"libphonenumber-js": "^1.9.17",
|
"libphonenumber-js": "^1.9.26",
|
||||||
"logrocket": "^1.2.0",
|
"logrocket": "^2.0.0",
|
||||||
"markerjs2": "^2.8.1",
|
"markerjs2": "^2.11.2",
|
||||||
"moment-business-days": "^1.2.0",
|
"moment-business-days": "^1.2.0",
|
||||||
"phone": "^2.4.21",
|
"phone": "^3.1.6",
|
||||||
"preval.macro": "^5.0.0",
|
"preval.macro": "^5.0.0",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"query-string": "^7.0.0",
|
"query-string": "^7.0.1",
|
||||||
"rc-queue-anim": "^1.8.5",
|
"rc-queue-anim": "^2.0.0",
|
||||||
"rc-scroll-anim": "^2.7.6",
|
"rc-scroll-anim": "^2.7.6",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-big-calendar": "^0.33.2",
|
"react-big-calendar": "^0.35.0",
|
||||||
"react-color": "^2.19.3",
|
"react-color": "^2.19.3",
|
||||||
|
"react-cookie": "^4.1.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-drag-listview": "^0.1.8",
|
"react-drag-listview": "^0.1.8",
|
||||||
"react-grid-gallery": "^0.5.5",
|
"react-grid-gallery": "^0.5.5",
|
||||||
"react-grid-layout": "^1.2.5",
|
"react-grid-layout": "^1.3.0",
|
||||||
"react-i18next": "^11.8.15",
|
"react-i18next": "^11.11.4",
|
||||||
"react-icons": "^4.2.0",
|
"react-icons": "^4.2.0",
|
||||||
"react-number-format": "^4.5.5",
|
"react-number-format": "^4.7.3",
|
||||||
"react-redux": "^7.2.4",
|
"react-redux": "^7.2.5",
|
||||||
"react-resizable": "^3.0.1",
|
"react-resizable": "^3.0.4",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.3.0",
|
||||||
"react-scripts": "^4.0.3",
|
"react-scripts": "^4.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.0.7",
|
"recharts": "^2.1.2",
|
||||||
"redux": "^4.1.0",
|
"redux": "^4.1.1",
|
||||||
"redux-persist": "^6.0.0",
|
"redux-persist": "^6.0.0",
|
||||||
"redux-saga": "^1.1.3",
|
"redux-saga": "^1.1.3",
|
||||||
"redux-state-sync": "^3.1.2",
|
"redux-state-sync": "^3.1.2",
|
||||||
"reselect": "^4.0.0",
|
"reselect": "^4.0.0",
|
||||||
"sass": "^1.32.13",
|
"sass": "^1.38.2",
|
||||||
"socket.io-client": "^4.1.2",
|
"socket.io-client": "^4.2.0",
|
||||||
"styled-components": "^5.3.0",
|
"styled-components": "^5.3.1",
|
||||||
"subscriptions-transport-ws": "^0.9.18",
|
"subscriptions-transport-ws": "^0.9.18",
|
||||||
"web-vitals": "^1.1.2",
|
"web-vitals": "^2.1.0",
|
||||||
"workbox-background-sync": "^6.1.5",
|
"workbox-background-sync": "^6.2.4",
|
||||||
"workbox-broadcast-update": "^6.1.5",
|
"workbox-broadcast-update": "^6.2.4",
|
||||||
"workbox-cacheable-response": "^6.1.5",
|
"workbox-cacheable-response": "^6.2.4",
|
||||||
"workbox-core": "^6.1.5",
|
"workbox-core": "^6.2.4",
|
||||||
"workbox-expiration": "^6.1.5",
|
"workbox-expiration": "^6.2.4",
|
||||||
"workbox-google-analytics": "^6.1.5",
|
"workbox-google-analytics": "^6.2.4",
|
||||||
"workbox-navigation-preload": "^6.1.5",
|
"workbox-navigation-preload": "^6.2.4",
|
||||||
"workbox-precaching": "^6.1.5",
|
"workbox-precaching": "^6.2.4",
|
||||||
"workbox-range-requests": "^6.1.5",
|
"workbox-range-requests": "^6.2.4",
|
||||||
"workbox-routing": "^6.1.5",
|
"workbox-routing": "^6.2.4",
|
||||||
"workbox-strategies": "^6.1.5",
|
"workbox-strategies": "^6.2.4",
|
||||||
"workbox-streams": "^6.1.5"
|
"workbox-streams": "^6.2.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "patch-package",
|
||||||
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
||||||
"start": "craco start",
|
"start": "craco start",
|
||||||
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
|
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
|
||||||
@@ -108,6 +114,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@sentry/webpack-plugin": "^1.17.1",
|
||||||
|
"patch-package": "^6.4.7",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"source-map-explorer": "^2.5.2"
|
"source-map-explorer": "^2.5.2"
|
||||||
}
|
}
|
||||||
|
|||||||
13087
client/patches/peerjs+1.3.2.patch
Normal file
13087
client/patches/peerjs+1.3.2.patch
Normal file
File diff suppressed because one or more lines are too long
@@ -8,8 +8,27 @@ import { useTranslation } from "react-i18next";
|
|||||||
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
|
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
|
||||||
import client from "../utils/GraphQLClient";
|
import client from "../utils/GraphQLClient";
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
|
import trackerGraphQL from "@openreplay/tracker-graphql";
|
||||||
|
//import trackerRedux from "@openreplay/tracker-redux";
|
||||||
|
import Tracker from "@openreplay/tracker";
|
||||||
|
//import trackerAssist from "@openreplay/tracker-assist";
|
||||||
moment.locale("en-US");
|
moment.locale("en-US");
|
||||||
|
|
||||||
|
export const tracker = new Tracker({
|
||||||
|
projectKey: "trDmOZlEXUpjGsMtHroA",
|
||||||
|
ingestPoint: "https://replay.imex.online/ingest",
|
||||||
|
...(process.env.NODE_ENV === null || process.env.NODE_ENV === "development"
|
||||||
|
? { __DISABLE_SECURE_MODE: true }
|
||||||
|
: {}),
|
||||||
|
// beaconSize: 10485760,
|
||||||
|
onStart: ({ sessionID }) => console.log("ORS SESSION ", sessionID),
|
||||||
|
});
|
||||||
|
|
||||||
|
// tracker.use(
|
||||||
|
// trackerAssist({ confirmText: "Technical support is about to assist you." })
|
||||||
|
// ); // check the list of available options below
|
||||||
|
export const recordGraphQL = tracker.use(trackerGraphQL());
|
||||||
|
tracker.start();
|
||||||
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
|
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
|
||||||
|
|
||||||
export default function AppContainer() {
|
export default function AppContainer() {
|
||||||
|
|||||||
@@ -1,25 +1,9 @@
|
|||||||
import Axios from "axios";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
||||||
export default function Test() {
|
export default function Test() {
|
||||||
const handleQbSignIn = async () => {
|
|
||||||
const result = await Axios.post("/qbo/authorize", { userId: "1234" });
|
|
||||||
console.log("handleQbSignIn -> result", result.data);
|
|
||||||
// window.open(result.data, "_blank", "toolbar=0,location=0,menubar=0");
|
|
||||||
|
|
||||||
var parameters = "location=1,width=800,height=650";
|
|
||||||
parameters +=
|
|
||||||
",left=" +
|
|
||||||
(window.screen.width - 800) / 2 +
|
|
||||||
",top=" +
|
|
||||||
(window.screen.height - 650) / 2;
|
|
||||||
|
|
||||||
// Launch Popup
|
|
||||||
window.open(result.data, "connectPopup", parameters);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<button onClick={handleQbSignIn}>Sign Into Qb.</button>
|
<QboAuthorizeComponent />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,17 @@ export default function AccountingPayablesTableComponent({ loading, bills }) {
|
|||||||
<Checkbox disabled checked={record.is_credit_memo} />
|
<Checkbox disabled checked={record.is_credit_memo} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("exportlogs.labels.attempts"),
|
||||||
|
dataIndex: "attempts",
|
||||||
|
key: "attempts",
|
||||||
|
|
||||||
|
render: (text, record) => {
|
||||||
|
const success = record.exportlogs.filter((e) => e.successful).length;
|
||||||
|
const attempts = record.exportlogs.length;
|
||||||
|
return `${success}/${attempts}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
@@ -121,6 +132,7 @@ export default function AccountingPayablesTableComponent({ loading, bills }) {
|
|||||||
billId={record.id}
|
billId={record.id}
|
||||||
disabled={transInProgress || !!record.exported}
|
disabled={transInProgress || !!record.exported}
|
||||||
loadingCallback={setTransInProgress}
|
loadingCallback={setTransInProgress}
|
||||||
|
setSelectedBills={setSelectedBills}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -108,7 +108,17 @@ export default function AccountingPayablesTableComponent({
|
|||||||
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
|
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("exportlogs.labels.attempts"),
|
||||||
|
dataIndex: "attempts",
|
||||||
|
key: "attempts",
|
||||||
|
|
||||||
|
render: (text, record) => {
|
||||||
|
const success = record.exportlogs.filter((e) => e.successful).length;
|
||||||
|
const attempts = record.exportlogs.length;
|
||||||
|
return `${success}/${attempts}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
@@ -120,6 +130,7 @@ export default function AccountingPayablesTableComponent({
|
|||||||
paymentId={record.id}
|
paymentId={record.id}
|
||||||
disabled={transInProgress || !!record.exportedat}
|
disabled={transInProgress || !!record.exportedat}
|
||||||
loadingCallback={setTransInProgress}
|
loadingCallback={setTransInProgress}
|
||||||
|
setSelectedPayments={setSelectedPayments}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,25 @@ import { alphaSort } from "../../utils/sorters";
|
|||||||
import JobExportButton from "../jobs-close-export-button/jobs-close-export-button.component";
|
import JobExportButton from "../jobs-close-export-button/jobs-close-export-button.component";
|
||||||
import JobsExportAllButton from "../jobs-export-all-button/jobs-export-all-button.component";
|
import JobsExportAllButton from "../jobs-export-all-button/jobs-export-all-button.component";
|
||||||
|
|
||||||
export default function AccountingReceivablesTableComponent({ loading, jobs }) {
|
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
|
||||||
|
)(AccountingReceivablesTableComponent);
|
||||||
|
|
||||||
|
export function AccountingReceivablesTableComponent({
|
||||||
|
bodyshop,
|
||||||
|
loading,
|
||||||
|
jobs,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [selectedJobs, setSelectedJobs] = useState([]);
|
const [selectedJobs, setSelectedJobs] = useState([]);
|
||||||
const [transInProgress, setTransInProgress] = useState(false);
|
const [transInProgress, setTransInProgress] = useState(false);
|
||||||
@@ -114,17 +132,28 @@ export default function AccountingReceivablesTableComponent({ loading, jobs }) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("exportlogs.labels.attempts"),
|
||||||
|
dataIndex: "attempts",
|
||||||
|
key: "attempts",
|
||||||
|
|
||||||
|
render: (text, record) => {
|
||||||
|
const success = record.exportlogs.filter((e) => e.successful).length;
|
||||||
|
const attempts = record.exportlogs.length;
|
||||||
|
return `${success}/${attempts}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
key: "actions",
|
key: "actions",
|
||||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<JobExportButton
|
<JobExportButton
|
||||||
jobId={record.id}
|
jobId={record.id}
|
||||||
disabled={!!record.date_exported}
|
disabled={!!record.date_exported}
|
||||||
|
setSelectedJobs={setSelectedJobs}
|
||||||
/>
|
/>
|
||||||
<Link to={`/manage/jobs/${record.id}/close`}>
|
<Link to={`/manage/jobs/${record.id}/close`}>
|
||||||
<Button>{t("jobs.labels.viewallocations")}</Button>
|
<Button>{t("jobs.labels.viewallocations")}</Button>
|
||||||
@@ -169,12 +198,14 @@ export default function AccountingReceivablesTableComponent({ loading, jobs }) {
|
|||||||
<Card
|
<Card
|
||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<JobsExportAllButton
|
{!bodyshop.cdk_dealerid && (
|
||||||
jobIds={selectedJobs}
|
<JobsExportAllButton
|
||||||
disabled={transInProgress || selectedJobs.length === 0}
|
jobIds={selectedJobs}
|
||||||
loadingCallback={setTransInProgress}
|
disabled={transInProgress || selectedJobs.length === 0}
|
||||||
completedCallback={setSelectedJobs}
|
loadingCallback={setTransInProgress}
|
||||||
/>
|
completedCallback={setSelectedJobs}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Input.Search
|
<Input.Search
|
||||||
value={state.search}
|
value={state.search}
|
||||||
onChange={handleSearch}
|
onChange={handleSearch}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import BillReeportButtonComponent from "../bill-reexport-button/bill-reexport-bu
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -33,6 +35,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPartsOrderContext: (context) =>
|
setPartsOrderContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
@@ -40,7 +44,10 @@ export default connect(
|
|||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(BillDetailEditcontainer);
|
)(BillDetailEditcontainer);
|
||||||
|
|
||||||
export function BillDetailEditcontainer({ setPartsOrderContext }) {
|
export function BillDetailEditcontainer({
|
||||||
|
setPartsOrderContext,
|
||||||
|
insertAuditTrail,
|
||||||
|
}) {
|
||||||
const search = queryString.parse(useLocation().search);
|
const search = queryString.parse(useLocation().search);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -134,6 +141,12 @@ export function BillDetailEditcontainer({ setPartsOrderContext }) {
|
|||||||
});
|
});
|
||||||
await Promise.all(updates);
|
await Promise.all(updates);
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: bill.jobid,
|
||||||
|
billid: search.billid,
|
||||||
|
operation: AuditTrailMapping.billupdated(bill.invoice_number),
|
||||||
|
});
|
||||||
|
|
||||||
await refetch();
|
await refetch();
|
||||||
form.setFieldsValue(transformData(data));
|
form.setFieldsValue(transformData(data));
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ import {
|
|||||||
QUERY_JOB_LBR_ADJUSTMENTS,
|
QUERY_JOB_LBR_ADJUSTMENTS,
|
||||||
UPDATE_JOB,
|
UPDATE_JOB,
|
||||||
} from "../../graphql/jobs.queries";
|
} from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectBillEnterModal } from "../../redux/modals/modals.selectors";
|
import { selectBillEnterModal } from "../../redux/modals/modals.selectors";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import BillFormContainer from "../bill-form/bill-form.container";
|
import BillFormContainer from "../bill-form/bill-form.container";
|
||||||
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
||||||
|
|
||||||
@@ -27,6 +29,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
function BillEnterModalContainer({
|
function BillEnterModalContainer({
|
||||||
@@ -34,6 +38,7 @@ function BillEnterModalContainer({
|
|||||||
toggleModalVisible,
|
toggleModalVisible,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
currentUser,
|
currentUser,
|
||||||
|
insertAuditTrail,
|
||||||
}) {
|
}) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -81,8 +86,9 @@ function BillEnterModalContainer({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"],
|
||||||
});
|
});
|
||||||
console.log("adjustmentsToInsert", adjustmentsToInsert);
|
|
||||||
const adjKeys = Object.keys(adjustmentsToInsert);
|
const adjKeys = Object.keys(adjustmentsToInsert);
|
||||||
if (adjKeys.length > 0) {
|
if (adjKeys.length > 0) {
|
||||||
//Query the adjustments, merge, and update them.
|
//Query the adjustments, merge, and update them.
|
||||||
@@ -115,7 +121,12 @@ function BillEnterModalContainer({
|
|||||||
message: JSON.stringify(jobUpdate.errors),
|
message: JSON.stringify(jobUpdate.errors),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: values.jobid,
|
||||||
|
operation: AuditTrailMapping.jobmodifylbradj(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!r1.errors) {
|
if (!!r1.errors) {
|
||||||
@@ -171,6 +182,12 @@ function BillEnterModalContainer({
|
|||||||
});
|
});
|
||||||
if (billEnterModal.actions.refetch) billEnterModal.actions.refetch();
|
if (billEnterModal.actions.refetch) billEnterModal.actions.refetch();
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: values.jobid,
|
||||||
|
billid: billId,
|
||||||
|
operation: AuditTrailMapping.billposted(remainingValues.invoice_number),
|
||||||
|
});
|
||||||
|
|
||||||
if (enterAgain) {
|
if (enterAgain) {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
form.setFieldsValue({ billlines: [] });
|
form.setFieldsValue({ billlines: [] });
|
||||||
|
|||||||
@@ -72,9 +72,11 @@ export function BillEnterModalLinesComponent({
|
|||||||
quantity: opt.part_qty || 1,
|
quantity: opt.part_qty || 1,
|
||||||
actual_price: opt.cost,
|
actual_price: opt.cost,
|
||||||
cost_center: opt.part_type
|
cost_center: opt.part_type
|
||||||
? responsibilityCenters.defaults.costs[
|
? responsibilityCenters.defaults &&
|
||||||
|
(responsibilityCenters.defaults.costs[
|
||||||
opt.part_type
|
opt.part_type
|
||||||
] || null
|
] ||
|
||||||
|
null)
|
||||||
: null,
|
: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
|
|
||||||
export const CalculateBillTotal = (invoice) => {
|
export const CalculateBillTotal = (invoice) => {
|
||||||
const {
|
const { total, billlines, federal_tax_rate, local_tax_rate, state_tax_rate } =
|
||||||
total,
|
invoice;
|
||||||
billlines,
|
|
||||||
federal_tax_rate,
|
|
||||||
local_tax_rate,
|
|
||||||
state_tax_rate,
|
|
||||||
} = invoice;
|
|
||||||
|
|
||||||
//TODO Determine why this recalculates so many times.
|
//TODO Determine why this recalculates so many times.
|
||||||
let subtotal = Dinero({ amount: 0 });
|
let subtotal = Dinero({ amount: 0 });
|
||||||
@@ -20,8 +15,7 @@ export const CalculateBillTotal = (invoice) => {
|
|||||||
billlines.forEach((i) => {
|
billlines.forEach((i) => {
|
||||||
if (!!i) {
|
if (!!i) {
|
||||||
const itemTotal = Dinero({
|
const itemTotal = Dinero({
|
||||||
amount:
|
amount: Math.round((i.actual_cost || 0) * 100),
|
||||||
Math.round(((i.actual_cost || 0) * 100 + Number.EPSILON) * 100) / 100,
|
|
||||||
}).multiply(i.quantity || 1);
|
}).multiply(i.quantity || 1);
|
||||||
|
|
||||||
subtotal = subtotal.add(itemTotal);
|
subtotal = subtotal.add(itemTotal);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
@@ -14,6 +15,7 @@ import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
|||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//jobRO: selectJobReadOnly,
|
//jobRO: selectJobReadOnly,
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@@ -26,6 +28,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export function BillsListTableComponent({
|
export function BillsListTableComponent({
|
||||||
|
bodyshop,
|
||||||
job,
|
job,
|
||||||
billsQuery,
|
billsQuery,
|
||||||
handleOnRowClick,
|
handleOnRowClick,
|
||||||
@@ -52,7 +55,9 @@ export function BillsListTableComponent({
|
|||||||
)}
|
)}
|
||||||
<BillDeleteButton bill={record} />
|
<BillDeleteButton bill={record} />
|
||||||
<Button
|
<Button
|
||||||
disabled={record.is_credit_memo}
|
disabled={
|
||||||
|
record.is_credit_memo || record.vendorid === bodyshop.inhousevendorid
|
||||||
|
}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setPartsOrderContext({
|
setPartsOrderContext({
|
||||||
actions: {},
|
actions: {},
|
||||||
|
|||||||
@@ -83,8 +83,10 @@ export function ContractsList({
|
|||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={`/manage/courtesycars/${record.courtesycar.id}`}>{`${
|
<Link to={`/manage/courtesycars/${record.courtesycar.id}`}>{`${
|
||||||
record.courtesycar.year
|
record.courtesycar.year
|
||||||
} ${record.courtesycar.make} ${record.courtesycar.model} ${
|
} ${record.courtesycar.make} ${record.courtesycar.model}${
|
||||||
record.courtesycar.plate ? `(${record.courtesycar.plate})` : ""
|
record.courtesycar.plate ? ` (${record.courtesycar.plate})` : ""
|
||||||
|
}${
|
||||||
|
record.courtesycar.fleetnumber ? ` (${record.courtesycar.fleetnumber})` : ""
|
||||||
}`}</Link>
|
}`}</Link>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
|
|||||||
let dailySales;
|
let dailySales;
|
||||||
if (!!jobsByDate[val]) {
|
if (!!jobsByDate[val]) {
|
||||||
dailySales = jobsByDate[val].reduce((dayAcc, dayVal) => {
|
dailySales = jobsByDate[val].reduce((dayAcc, dayVal) => {
|
||||||
return dayAcc.add(Dinero(dayVal.job_totals.totals.subtotal));
|
return dayAcc.add(
|
||||||
|
Dinero((dayVal.job_totals && dayVal.job_totals.totals.subtotal) || 0)
|
||||||
|
);
|
||||||
}, Dinero());
|
}, Dinero());
|
||||||
} else {
|
} else {
|
||||||
dailySales = Dinero();
|
dailySales = Dinero();
|
||||||
|
|||||||
@@ -13,7 +13,14 @@ export default function DashboardProjectedMonthlySales({ data, ...cardProps }) {
|
|||||||
const dollars =
|
const dollars =
|
||||||
data.projected_monthly_sales &&
|
data.projected_monthly_sales &&
|
||||||
data.projected_monthly_sales.reduce(
|
data.projected_monthly_sales.reduce(
|
||||||
(acc, val) => acc.add(Dinero(val.job_totals.totals.subtotal)),
|
(acc, val) =>
|
||||||
|
acc.add(
|
||||||
|
Dinero(
|
||||||
|
val.job_totals &&
|
||||||
|
val.job_totals.totals &&
|
||||||
|
val.job_totals.totals.subtotal
|
||||||
|
)
|
||||||
|
),
|
||||||
Dinero()
|
Dinero()
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ export default function DashboardTotalProductionDollars({
|
|||||||
const dollars =
|
const dollars =
|
||||||
data.production_jobs &&
|
data.production_jobs &&
|
||||||
data.production_jobs.reduce(
|
data.production_jobs.reduce(
|
||||||
(acc, val) => acc.add(Dinero(val.job_totals.totals.subtotal)),
|
(acc, val) =>
|
||||||
|
acc.add(Dinero(val.job_totals && val.job_totals.totals.subtotal)),
|
||||||
Dinero()
|
Dinero()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ const componentList = {
|
|||||||
h: 3,
|
h: 3,
|
||||||
},
|
},
|
||||||
MonthlyPartsSales: {
|
MonthlyPartsSales: {
|
||||||
label: i18next.t("dashboard.titles.productiondollars"),
|
label: i18next.t("dashboard.titles.monthlypartssales"),
|
||||||
component: DashboardMonthlyPartsSales,
|
component: DashboardMonthlyPartsSales,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
minW: 2,
|
minW: 2,
|
||||||
@@ -253,7 +253,7 @@ const componentList = {
|
|||||||
h: 2,
|
h: 2,
|
||||||
},
|
},
|
||||||
MonthlyLaborSales: {
|
MonthlyLaborSales: {
|
||||||
label: i18next.t("dashboard.titles.monthlypartssales"),
|
label: i18next.t("dashboard.titles.monthlylaborsales"),
|
||||||
component: DashboardMonthlyLaborSales,
|
component: DashboardMonthlyLaborSales,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
minW: 2,
|
minW: 2,
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
import { Button, Card, Table, Typography } from "antd";
|
||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(DmsAllocationsSummary);
|
||||||
|
|
||||||
|
export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (socket.connected) {
|
||||||
|
socket.emit("cdk-calculate-allocations", jobId, (ack) => {
|
||||||
|
setAllocationsSummary(ack);
|
||||||
|
socket.allocationsSummary = ack;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [socket, socket.connected, jobId]);
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.center"),
|
||||||
|
dataIndex: "center",
|
||||||
|
key: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.sale"),
|
||||||
|
dataIndex: "sale",
|
||||||
|
key: "sale",
|
||||||
|
render: (text, record) => Dinero(record.sale).toFormat(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.cost"),
|
||||||
|
dataIndex: "cost",
|
||||||
|
key: "cost",
|
||||||
|
render: (text, record) => Dinero(record.cost).toFormat(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.sale_dms_acctnumber"),
|
||||||
|
dataIndex: "sale_dms_acctnumber",
|
||||||
|
key: "sale_dms_acctnumber",
|
||||||
|
render: (text, record) =>
|
||||||
|
record.profitCenter && record.profitCenter.dms_acctnumber,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.cost_dms_acctnumber"),
|
||||||
|
dataIndex: "cost_dms_acctnumber",
|
||||||
|
key: "cost_dms_acctnumber",
|
||||||
|
render: (text, record) =>
|
||||||
|
record.costCenter && record.costCenter.dms_acctnumber,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.dms_wip_acctnumber"),
|
||||||
|
dataIndex: "dms_wip_acctnumber",
|
||||||
|
key: "dms_wip_acctnumber",
|
||||||
|
render: (text, record) =>
|
||||||
|
record.costCenter && record.costCenter.dms_wip_acctnumber,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={title}
|
||||||
|
extra={
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
socket.emit("cdk-calculate-allocations", jobId, (ack) =>
|
||||||
|
setAllocationsSummary(ack)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SyncOutlined />
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Table
|
||||||
|
pagination={{ position: "top", defaultPageSize: 50 }}
|
||||||
|
columns={columns}
|
||||||
|
rowKey="center"
|
||||||
|
dataSource={allocationsSummary}
|
||||||
|
summary={() => {
|
||||||
|
const totals = allocationsSummary.reduce(
|
||||||
|
(acc, val) => {
|
||||||
|
return {
|
||||||
|
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||||
|
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
totalSale: Dinero(),
|
||||||
|
totalCost: Dinero(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Summary.Row>
|
||||||
|
<Table.Summary.Cell>
|
||||||
|
<Typography.Title level={4}>
|
||||||
|
{t("general.labels.totals")}
|
||||||
|
</Typography.Title>
|
||||||
|
</Table.Summary.Cell>
|
||||||
|
<Table.Summary.Cell>
|
||||||
|
{totals.totalSale.toFormat()}
|
||||||
|
</Table.Summary.Cell>
|
||||||
|
<Table.Summary.Cell>
|
||||||
|
{
|
||||||
|
// totals.totalCost.toFormat()
|
||||||
|
}
|
||||||
|
</Table.Summary.Cell>
|
||||||
|
<Table.Summary.Cell></Table.Summary.Cell>
|
||||||
|
<Table.Summary.Cell></Table.Summary.Cell>
|
||||||
|
</Table.Summary.Row>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
105
client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx
Normal file
105
client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import { useLazyQuery } from "@apollo/client";
|
||||||
|
import { Button, Input, Modal, Table } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { SEARCH_DMS_VEHICLES } from "../../graphql/dms.queries";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkVehicles);
|
||||||
|
|
||||||
|
export function DmsCdkVehicles({ bodyshop, form, socket, job }) {
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
const [selectedModel, setSelectedModel] = useState(null);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const [callSearch, { loading, error, data }] =
|
||||||
|
useLazyQuery(SEARCH_DMS_VEHICLES);
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("vehicles.fields.v_make_desc"),
|
||||||
|
dataIndex: "make",
|
||||||
|
key: "make",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("vehicles.fields.v_model_desc"),
|
||||||
|
dataIndex: "model",
|
||||||
|
key: "model",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.dms_make"),
|
||||||
|
dataIndex: "makecode",
|
||||||
|
key: "makecode",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.dms_model"),
|
||||||
|
dataIndex: "modelcode",
|
||||||
|
key: "modelcode",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
width={"90%"}
|
||||||
|
visible={visible}
|
||||||
|
onCancel={() => setVisible(false)}
|
||||||
|
onOk={() => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
dms_make: selectedModel.makecode,
|
||||||
|
dms_model: selectedModel.modelcode,
|
||||||
|
});
|
||||||
|
setVisible(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{error && <AlertComponent error={error.message} />}
|
||||||
|
<Table
|
||||||
|
title={() => (
|
||||||
|
<Input.Search
|
||||||
|
onSearch={(val) => callSearch({ variables: { search: val } })}
|
||||||
|
placeholder={t("general.labels.search")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
columns={columns}
|
||||||
|
loading={loading}
|
||||||
|
rowKey="id"
|
||||||
|
dataSource={data ? data.search_dms_vehicles : []}
|
||||||
|
onRow={(record) => {
|
||||||
|
return {
|
||||||
|
onClick: () => setSelectedModel(record),
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
rowSelection={{
|
||||||
|
onSelect: (record) => {
|
||||||
|
setSelectedModel(record);
|
||||||
|
},
|
||||||
|
|
||||||
|
type: "radio",
|
||||||
|
selectedRowKeys: [selectedModel && selectedModel.id],
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
setVisible(true);
|
||||||
|
callSearch({
|
||||||
|
variables: {
|
||||||
|
search: job && job.v_model_desc && job.v_model_desc.substr(0, 3),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("jobs.actions.dms.findmakemodelcode")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Button } from "antd";
|
||||||
|
import axios from "axios";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakesRefetch);
|
||||||
|
|
||||||
|
export function DmsCdkMakesRefetch({ bodyshop, form, socket }) {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const handleRefetch = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await axios.post("/cdk/getvehicles", {
|
||||||
|
cdk_dealerid: bodyshop.cdk_dealerid,
|
||||||
|
bodyshopid: bodyshop.id,
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Button loading={loading} onClick={handleRefetch}>
|
||||||
|
{t("jobs.actions.dms.refetchmakesmodels")}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,10 +1,24 @@
|
|||||||
import { Button, Table } from "antd";
|
import { Button, Table, Col , Checkbox} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
import { socket } from "../../pages/dms/dms.container";
|
import { socket } from "../../pages/dms/dms.container";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
export default function DmsCustomerSelector() {
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(DmsCustomerSelector);
|
||||||
|
|
||||||
|
export function DmsCustomerSelector({ bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [customerList, setcustomerList] = useState([]);
|
const [customerList, setcustomerList] = useState([]);
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
@@ -15,63 +29,93 @@ export default function DmsCustomerSelector() {
|
|||||||
setcustomerList(customerList);
|
setcustomerList(customerList);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onOk = () => {
|
const onUseSelected = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
socket.emit("cdk-selected-customer", selectedCustomer);
|
socket.emit("cdk-selected-customer", selectedCustomer);
|
||||||
|
setSelectedCustomer(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onUseGeneric = () => {
|
||||||
|
setVisible(false);
|
||||||
|
socket.emit(
|
||||||
|
"cdk-selected-customer",
|
||||||
|
bodyshop.cdk_configuration.generic_customer_number
|
||||||
|
);
|
||||||
|
setSelectedCustomer(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onCreateNew = () => {
|
||||||
|
setVisible(false);
|
||||||
|
socket.emit("cdk-selected-customer", null);
|
||||||
|
setSelectedCustomer(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("dms.fields.name1"),
|
title: t("jobs.fields.dms.id"),
|
||||||
|
dataIndex: ["id", "value"],
|
||||||
|
key: "id",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.vinowner"),
|
||||||
|
dataIndex: "vinOwner",
|
||||||
|
key: "vinOwner",
|
||||||
|
render: (text, record) => <Checkbox disabled checked={record.vinOwner}/>
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.name1"),
|
||||||
dataIndex: ["name1", "fullName"],
|
dataIndex: ["name1", "fullName"],
|
||||||
key: "name1",
|
key: "name1",
|
||||||
sorter: (a, b) => alphaSort(a.name1?.fullName, b.name1?.fullName),
|
sorter: (a, b) => alphaSort(a.name1?.fullName, b.name1?.fullName),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: t("dms.fields.name2"),
|
title: t("jobs.fields.dms.address"),
|
||||||
dataIndex: ["name2", "fullName"],
|
|
||||||
key: "name2",
|
|
||||||
sorter: (a, b) => alphaSort(a.name2?.fullName, b.name2?.fullName),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("dms.fields.phone"),
|
|
||||||
dataIndex: ["contactInfo", "mainTelephoneNumber", "value"],
|
|
||||||
key: "phone",
|
|
||||||
render: (record, value) => (
|
|
||||||
<PhoneFormatter>
|
|
||||||
{record.contactInfo?.mainTelephoneNumber?.value}
|
|
||||||
</PhoneFormatter>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("dms.fields.address"),
|
|
||||||
//dataIndex: ["name2", "fullName"],
|
//dataIndex: ["name2", "fullName"],
|
||||||
key: "address",
|
key: "address",
|
||||||
render: (record, value) =>
|
render: (record, value) =>
|
||||||
`${record.address?.addressLine[0]}, ${record.address?.city} ${record.address?.stateOrProvince} ${record.address?.postalCode}`,
|
`${record?.address?.addressLine[0]}, ${record.address?.city} ${record.address?.stateOrProvince} ${record.address?.postalCode}`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!visible) return <></>;
|
if (!visible) return <></>;
|
||||||
return (
|
return (
|
||||||
<Table
|
<Col span={24}>
|
||||||
title={() => (
|
<Table
|
||||||
<div>
|
title={() => (
|
||||||
<Button onClick={onOk}>Select</Button>
|
<div>
|
||||||
</div>
|
<Button onClick={onUseSelected} disabled={!selectedCustomer}>
|
||||||
)}
|
{t("jobs.actions.dms.useselected")}
|
||||||
pagination={{ position: "top" }}
|
</Button>
|
||||||
columns={columns}
|
<Button
|
||||||
rowKey={(record) => record.id.value}
|
onClick={onUseGeneric}
|
||||||
dataSource={customerList}
|
disabled={
|
||||||
//onChange={handleTableChange}
|
!(
|
||||||
rowSelection={{
|
bodyshop.cdk_configuration &&
|
||||||
onSelect: (props) => {
|
bodyshop.cdk_configuration.generic_customer_number
|
||||||
setSelectedCustomer(props.id.value);
|
)
|
||||||
},
|
}
|
||||||
type: "radio",
|
>
|
||||||
selectedRowKeys: [selectedCustomer],
|
{t("jobs.actions.dms.usegeneric")}
|
||||||
}}
|
</Button>
|
||||||
/>
|
<Button onClick={onCreateNew}>
|
||||||
|
{t("jobs.actions.dms.createnewcustomer")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
pagination={{ position: "top" }}
|
||||||
|
columns={columns}
|
||||||
|
rowKey={(record) => record.id.value}
|
||||||
|
dataSource={customerList}
|
||||||
|
//onChange={handleTableChange}
|
||||||
|
rowSelection={{
|
||||||
|
onSelect: (props) => {
|
||||||
|
setSelectedCustomer(props.id.value);
|
||||||
|
},
|
||||||
|
type: "radio",
|
||||||
|
selectedRowKeys: [selectedCustomer],
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import { Divider, Space, Tag, Timeline } from "antd";
|
||||||
|
import moment from "moment";
|
||||||
|
import React from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
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)(DmsLogEvents);
|
||||||
|
|
||||||
|
export function DmsLogEvents({ socket, logs, bodyshop }) {
|
||||||
|
return (
|
||||||
|
<Timeline pending reverse={true}>
|
||||||
|
{logs.map((log, idx) => (
|
||||||
|
<Timeline.Item key={idx} color={LogLevelHierarchy(log.level)}>
|
||||||
|
<Space wrap align="start" style={{}}>
|
||||||
|
<Tag color={LogLevelHierarchy(log.level)}>{log.level}</Tag>
|
||||||
|
<span>{moment(log.timestamp).format("MM/DD/YYYY HH:MM:ss")}</span>
|
||||||
|
<Divider type="vertical" />
|
||||||
|
<span>{log.message}</span>
|
||||||
|
</Space>
|
||||||
|
</Timeline.Item>
|
||||||
|
))}
|
||||||
|
</Timeline>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LogLevelHierarchy(level) {
|
||||||
|
switch (level) {
|
||||||
|
case "TRACE":
|
||||||
|
return "pink";
|
||||||
|
case "DEBUG":
|
||||||
|
return "orange";
|
||||||
|
case "INFO":
|
||||||
|
return "blue";
|
||||||
|
case "WARNING":
|
||||||
|
return "yellow";
|
||||||
|
case "ERROR":
|
||||||
|
return "red";
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
340
client/src/components/dms-post-form/dms-post-form.component.jsx
Normal file
340
client/src/components/dms-post-form/dms-post-form.component.jsx
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
import { DeleteFilled } from "@ant-design/icons";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Divider,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Select,
|
||||||
|
Space,
|
||||||
|
Statistic,
|
||||||
|
Typography,
|
||||||
|
} from "antd";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { determineDmsType } from "../../pages/dms/dms.container";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
||||||
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
|
||||||
|
|
||||||
|
export function DmsPostForm({ bodyshop, socket, job }) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handlePayerSelect = (value, index) => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
payers: form.getFieldValue("payers").map((payer, mapIndex) => {
|
||||||
|
if (index !== mapIndex) return payer;
|
||||||
|
const cdkPayer =
|
||||||
|
bodyshop.cdk_configuration.payers &&
|
||||||
|
bodyshop.cdk_configuration.payers.find((i) => i.name === value);
|
||||||
|
|
||||||
|
if (!cdkPayer) return payer;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...cdkPayer,
|
||||||
|
dms_acctnumber: cdkPayer.dms_acctnumber,
|
||||||
|
controlnumber: job && job[cdkPayer.control_type],
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFinish = (values) => {
|
||||||
|
socket.emit(`${determineDmsType(bodyshop)}-export-job`, {
|
||||||
|
jobid: job.id,
|
||||||
|
txEnvelope: values,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card title={t("jobs.labels.dms.postingform")}>
|
||||||
|
<Form
|
||||||
|
form={form}
|
||||||
|
layout="vertical"
|
||||||
|
onFinish={handleFinish}
|
||||||
|
initialValues={{
|
||||||
|
story: t("jobs.labels.dms.defaultstory", {
|
||||||
|
ro_number: job.ro_number,
|
||||||
|
area_of_damage: job.area_of_damage && job.area_of_damage.impact1,
|
||||||
|
}).substr(0, 239),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LayoutFormRow grow>
|
||||||
|
<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>
|
||||||
|
<Form.Item
|
||||||
|
name="kmin"
|
||||||
|
label={t("jobs.fields.kmin")}
|
||||||
|
initialValue={job && job.kmin}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber disabled />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="kmout"
|
||||||
|
label={t("jobs.fields.kmout")}
|
||||||
|
initialValue={job && job.kmout}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber disabled />
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
|
|
||||||
|
<LayoutFormRow style={{ justifyContent: "center" }} grow>
|
||||||
|
<Form.Item
|
||||||
|
name="dms_make"
|
||||||
|
label={t("jobs.fields.dms.dms_make")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input disabled />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="dms_model"
|
||||||
|
label={t("jobs.fields.dms.dms_model")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input disabled />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<DmsCdkMakes form={form} socket={socket} job={job} />
|
||||||
|
<DmsCdkMakesRefetch />
|
||||||
|
</LayoutFormRow>
|
||||||
|
<Form.Item
|
||||||
|
name="story"
|
||||||
|
label={t("jobs.fields.dms.story")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input.TextArea maxLength={240} />
|
||||||
|
</Form.Item>
|
||||||
|
<Divider />
|
||||||
|
<Form.List name={["payers"]}>
|
||||||
|
{(fields, { add, remove }) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{fields.map((field, index) => (
|
||||||
|
<Form.Item key={field.key}>
|
||||||
|
<Space wrap>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.dms.payer.name")}
|
||||||
|
key={`${index}name`}
|
||||||
|
name={[field.name, "name"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
style={{ minWidth: "15rem" }}
|
||||||
|
onSelect={(value) => handlePayerSelect(value, index)}
|
||||||
|
>
|
||||||
|
{bodyshop.cdk_configuration &&
|
||||||
|
bodyshop.cdk_configuration.payers &&
|
||||||
|
bodyshop.cdk_configuration.payers.map((payer) => (
|
||||||
|
<Select.Option key={payer.name}>
|
||||||
|
{payer.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.dms.payer.dms_acctnumber")}
|
||||||
|
key={`${index}dms_acctnumber`}
|
||||||
|
name={[field.name, "dms_acctnumber"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input disabled />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.dms.payer.amount")}
|
||||||
|
key={`${index}amount`}
|
||||||
|
name={[field.name, "amount"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<CurrencyInput min={0} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.dms.payer.controlnumber")}
|
||||||
|
key={`${index}controlnumber`}
|
||||||
|
name={[field.name, "controlnumber"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item shouldUpdate>
|
||||||
|
{() => {
|
||||||
|
const payers = form.getFieldValue("payers");
|
||||||
|
|
||||||
|
const row = payers && payers[index];
|
||||||
|
|
||||||
|
const cdkPayer =
|
||||||
|
bodyshop.cdk_configuration.payers &&
|
||||||
|
bodyshop.cdk_configuration.payers.find(
|
||||||
|
(i) => i && row && i.name === row.name
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{cdkPayer &&
|
||||||
|
t(`jobs.fields.${cdkPayer.control_type}`)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<DeleteFilled
|
||||||
|
onClick={() => {
|
||||||
|
remove(field.name);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
))}
|
||||||
|
<Form.Item>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
disabled={!(fields.length < 3)}
|
||||||
|
onClick={() => {
|
||||||
|
if (fields.length < 3) add();
|
||||||
|
}}
|
||||||
|
style={{ width: "100%" }}
|
||||||
|
>
|
||||||
|
{t("jobs.actions.dms.addpayer")}
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.List>
|
||||||
|
<Form.Item shouldUpdate>
|
||||||
|
{() => {
|
||||||
|
//Perform Calculation to determine discrepancy.
|
||||||
|
let totalAllocated = Dinero();
|
||||||
|
|
||||||
|
const payers = form.getFieldValue("payers");
|
||||||
|
payers &&
|
||||||
|
payers.forEach((payer) => {
|
||||||
|
totalAllocated = totalAllocated.add(
|
||||||
|
Dinero({ amount: Math.round((payer?.amount || 0) * 100) })
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const totals =
|
||||||
|
socket.allocationsSummary &&
|
||||||
|
socket.allocationsSummary.reduce(
|
||||||
|
(acc, val) => {
|
||||||
|
return {
|
||||||
|
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||||
|
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
totalSale: Dinero(),
|
||||||
|
totalCost: Dinero(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const discrep = totals
|
||||||
|
? totals.totalSale.subtract(totalAllocated)
|
||||||
|
: Dinero();
|
||||||
|
return (
|
||||||
|
<Space size="large" wrap align="center">
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.subtotal")}
|
||||||
|
value={(totals ? totals.totalSale : Dinero()).toFormat()}
|
||||||
|
/>
|
||||||
|
<Typography.Title>-</Typography.Title>
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.dms.totalallocated")}
|
||||||
|
value={totalAllocated.toFormat()}
|
||||||
|
/>
|
||||||
|
<Typography.Title>=</Typography.Title>
|
||||||
|
<Statistic
|
||||||
|
title={t("jobs.labels.dms.notallocated")}
|
||||||
|
valueStyle={{
|
||||||
|
color: discrep.getAmount() === 0 ? "green" : "red",
|
||||||
|
}}
|
||||||
|
value={discrep.toFormat()}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
disabled={
|
||||||
|
!socket.allocationsSummary || discrep.getAmount() !== 0
|
||||||
|
}
|
||||||
|
htmlType="submit"
|
||||||
|
>
|
||||||
|
{t("jobs.actions.dms.post")}
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -37,6 +37,8 @@ export default function EmailOverlayComponent({ form, selectedMediaState }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Divider>{t("emails.labels.preview")}</Divider>
|
<Divider>{t("emails.labels.preview")}</Divider>
|
||||||
|
<strong>{t("emails.labels.pdfcopywillbeattached")}</strong>
|
||||||
|
|
||||||
<Form.Item shouldUpdate>
|
<Form.Item shouldUpdate>
|
||||||
{() => {
|
{() => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ export function EmailOverlayContainer({
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [sending, setSending] = useState(false);
|
const [sending, setSending] = useState(false);
|
||||||
const [rawHtml, setRawHtml] = useState("");
|
const [rawHtml, setRawHtml] = useState("");
|
||||||
|
const [pdfCopytoAttach, setPdfCopytoAttach] = useState({
|
||||||
|
filename: null,
|
||||||
|
pdf: null,
|
||||||
|
});
|
||||||
const [selectedMedia, setSelectedMedia] = useState([]);
|
const [selectedMedia, setSelectedMedia] = useState([]);
|
||||||
|
|
||||||
const defaultEmailFrom = {
|
const defaultEmailFrom = {
|
||||||
@@ -59,17 +63,17 @@ export function EmailOverlayContainer({
|
|||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
logImEXEvent("email_send_from_modal");
|
logImEXEvent("email_send_from_modal");
|
||||||
|
|
||||||
const attachments = [];
|
//const attachments = [];
|
||||||
|
|
||||||
if (values.fileList)
|
// if (values.fileList)
|
||||||
await asyncForEach(values.fileList, async (f) => {
|
// await asyncForEach(values.fileList, async (f) => {
|
||||||
const t = {
|
// const t = {
|
||||||
ContentType: f.type,
|
// ContentType: f.type,
|
||||||
Filename: f.name,
|
// Filename: f.name,
|
||||||
Base64Content: (await toBase64(f.originFileObj)).split(",")[1],
|
// Base64Content: (await toBase64(f.originFileObj)).split(",")[1],
|
||||||
};
|
// };
|
||||||
attachments.push(t);
|
// attachments.push(t);
|
||||||
});
|
// });
|
||||||
|
|
||||||
setSending(true);
|
setSending(true);
|
||||||
try {
|
try {
|
||||||
@@ -77,11 +81,28 @@ export function EmailOverlayContainer({
|
|||||||
...defaultEmailFrom,
|
...defaultEmailFrom,
|
||||||
...values,
|
...values,
|
||||||
html: rawHtml,
|
html: rawHtml,
|
||||||
attachments:
|
attachments: [
|
||||||
values.fileList &&
|
...(values.fileList
|
||||||
(await Promise.all(
|
? await Promise.all(
|
||||||
values.fileList.map(async (f) => await toBase64(f.originFileObj))
|
values.fileList.map(async (f) => {
|
||||||
)),
|
return {
|
||||||
|
filename: f.name,
|
||||||
|
path: await toBase64(f.originFileObj),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
)
|
||||||
|
: []),
|
||||||
|
...(pdfCopytoAttach.pdf
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
path: pdfCopytoAttach.pdf,
|
||||||
|
filename:
|
||||||
|
pdfCopytoAttach.filename &&
|
||||||
|
`${pdfCopytoAttach.filename}.pdf`,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
],
|
||||||
media: selectedMedia.filter((m) => m.isSelected).map((m) => m.src),
|
media: selectedMedia.filter((m) => m.isSelected).map((m) => m.src),
|
||||||
//attachments,
|
//attachments,
|
||||||
});
|
});
|
||||||
@@ -99,13 +120,22 @@ export function EmailOverlayContainer({
|
|||||||
const render = async () => {
|
const render = async () => {
|
||||||
logImEXEvent("email_render_template", { template: emailConfig.template });
|
logImEXEvent("email_render_template", { template: emailConfig.template });
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
let html = await RenderTemplate(emailConfig.template, bodyshop, true);
|
let { html, pdf, filename } = await RenderTemplate(
|
||||||
|
emailConfig.template,
|
||||||
|
bodyshop,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
const response = await axios.post("/render/inlinecss", {
|
const response = await axios.post("/render/inlinecss", {
|
||||||
html: html,
|
html: html,
|
||||||
url: `${window.location.protocol}://${window.location.host}/`,
|
url: `${window.location.protocol}://${window.location.host}/`,
|
||||||
});
|
});
|
||||||
setRawHtml(response.data);
|
setRawHtml(response.data);
|
||||||
|
|
||||||
|
if (pdf) {
|
||||||
|
setPdfCopytoAttach({ pdf, filename });
|
||||||
|
}
|
||||||
|
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
...emailConfig.messageOptions,
|
...emailConfig.messageOptions,
|
||||||
cc:
|
cc:
|
||||||
@@ -166,8 +196,8 @@ const toBase64 = (file) =>
|
|||||||
reader.onerror = (error) => reject(error);
|
reader.onerror = (error) => reject(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
const asyncForEach = async (array, callback) => {
|
// const asyncForEach = async (array, callback) => {
|
||||||
for (let index = 0; index < array.length; index++) {
|
// for (let index = 0; index < array.length; index++) {
|
||||||
await callback(array[index], index, array);
|
// await callback(array[index], index, array);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { withApollo } from "@apollo/client/react/hoc";
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent, messaging } from "../../firebase/firebase.utils";
|
//import { logImEXEvent, messaging } from "../../firebase/firebase.utils";
|
||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -15,21 +15,20 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
class FcmNotificationComponent extends Component {
|
class FcmNotificationComponent extends Component {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
//const { client, currentUser } = this.props;
|
//const { client, currentUser } = this.props;
|
||||||
if (!!!messaging) return; //Skip all of the notification functionality if the firebase SDK could not start.
|
// if (!!!messaging) return; //Skip all of the notification functionality if the firebase SDK could not start.
|
||||||
|
// messaging
|
||||||
messaging
|
// .requestPermission()
|
||||||
.requestPermission()
|
// .then(async function () {
|
||||||
.then(async function () {
|
// // const token = await messaging.getToken();
|
||||||
// const token = await messaging.getToken();
|
// // client.mutate({
|
||||||
// client.mutate({
|
// // mutation: UPDATE_FCM_TOKEN,
|
||||||
// mutation: UPDATE_FCM_TOKEN,
|
// // variables: { authEmail: currentUser.email, token: { [token]: true } },
|
||||||
// variables: { authEmail: currentUser.email, token: { [token]: true } },
|
// // });
|
||||||
// });
|
// })
|
||||||
})
|
// .catch(function (err) {
|
||||||
.catch(function (err) {
|
// console.log("Unable to get permission to notify.", err);
|
||||||
console.log("Unable to get permission to notify.", err);
|
// logImEXEvent("fcm_permission_denied", { message: err });
|
||||||
logImEXEvent("fcm_permission_denied", { message: err });
|
// });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function GlobalSearch() {
|
|||||||
<span>{`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${
|
<span>{`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${
|
||||||
job.v_model_desc || ""
|
job.v_model_desc || ""
|
||||||
}`}</span>
|
}`}</span>
|
||||||
<span>{`${job.clm_no}`}</span>
|
<span>{`${job.clm_no || ""}`}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
@@ -91,8 +91,8 @@ export default function GlobalSearch() {
|
|||||||
vehicle.v_make_desc || ""
|
vehicle.v_make_desc || ""
|
||||||
} ${vehicle.v_model_desc || ""}`}
|
} ${vehicle.v_model_desc || ""}`}
|
||||||
</span>
|
</span>
|
||||||
<span>{vehicle.plate_no}</span>
|
<span>{vehicle.plate_no || ""}</span>
|
||||||
<span> {vehicle.v_vin}</span>
|
<span> {vehicle.v_vin || ""}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
@@ -108,10 +108,11 @@ export default function GlobalSearch() {
|
|||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/jobs/${payment.job.id}`}>
|
<Link to={`/manage/jobs/${payment.job.id}`}>
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
<Space size="small" split={<Divider type="vertical" />}>
|
||||||
|
<span>{payment.paymentnum}</span>
|
||||||
<span>{payment.job.ro_number}</span>
|
<span>{payment.job.ro_number}</span>
|
||||||
<span>{payment.job.memo}</span>
|
<span>{payment.memo || ""}</span>
|
||||||
<span>{payment.job.amount}</span>
|
<span>{payment.amount || ""}</span>
|
||||||
<span>{payment.job.transactionid}</span>
|
<span>{payment.transactionid || ""}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
@@ -167,7 +168,6 @@ export default function GlobalSearch() {
|
|||||||
<AutoComplete
|
<AutoComplete
|
||||||
options={options}
|
options={options}
|
||||||
onSearch={handleSearch}
|
onSearch={handleSearch}
|
||||||
allowClear
|
|
||||||
placeholder={t("general.labels.globalsearch")}
|
placeholder={t("general.labels.globalsearch")}
|
||||||
>
|
>
|
||||||
<Input.Search loading={loading} />
|
<Input.Search loading={loading} />
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export function Jobd3RdPartyModal({ bodyshop, jobId }) {
|
|||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("printcenter.jobs.3rdpartyfields.ponumber")}
|
label={t("printcenter.jobs.3rdpartyfields.refnumber")}
|
||||||
name="ponumber"
|
name="ponumber"
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
|
|||||||
@@ -1,24 +1,50 @@
|
|||||||
import { Button, Popover, Space } from "antd";
|
import { AlertFilled } from "@ant-design/icons";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Divider,
|
||||||
|
Dropdown,
|
||||||
|
Menu,
|
||||||
|
notification,
|
||||||
|
Popover,
|
||||||
|
Space,
|
||||||
|
} from "antd";
|
||||||
|
import parsePhoneNumber from "libphonenumber-js";
|
||||||
|
import moment from "moment";
|
||||||
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import {
|
||||||
|
openChatByPhone,
|
||||||
|
setMessage,
|
||||||
|
} from "../../redux/messaging/messaging.actions";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||||
import DataLabel from "../data-label/data-label.component";
|
import DataLabel from "../data-label/data-label.component";
|
||||||
import ScheduleAtChange from "./job-at-change.component";
|
import ScheduleAtChange from "./job-at-change.component";
|
||||||
import ScheduleEventColor from "./schedule-event.color.component";
|
import ScheduleEventColor from "./schedule-event.color.component";
|
||||||
import queryString from "query-string";
|
import ScheduleEventNote from "./schedule-event.note.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setScheduleContext: (context) =>
|
setScheduleContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "schedule" })),
|
dispatch(setModalContext({ context: context, modal: "schedule" })),
|
||||||
|
openChatByPhone: (phone) => dispatch(openChatByPhone(phone)),
|
||||||
|
setMessage: (text) => dispatch(setMessage(text)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ScheduleEventComponent({
|
export function ScheduleEventComponent({
|
||||||
|
bodyshop,
|
||||||
|
setMessage,
|
||||||
|
openChatByPhone,
|
||||||
event,
|
event,
|
||||||
refetch,
|
refetch,
|
||||||
handleCancel,
|
handleCancel,
|
||||||
@@ -38,7 +64,7 @@ export function ScheduleEventComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const popoverContent = (
|
const popoverContent = (
|
||||||
<div>
|
<div style={{ maxWidth: "40vw" }}>
|
||||||
{!event.isintake ? (
|
{!event.isintake ? (
|
||||||
<strong>{event.title}</strong>
|
<strong>{event.title}</strong>
|
||||||
) : (
|
) : (
|
||||||
@@ -75,17 +101,19 @@ export function ScheduleEventComponent({
|
|||||||
{(event.job && event.job.ownr_ea) || ""}
|
{(event.job && event.job.ownr_ea) || ""}
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
<DataLabel label={t("jobs.fields.ownr_ph1")}>
|
<DataLabel label={t("jobs.fields.ownr_ph1")}>
|
||||||
<PhoneFormatter>
|
<ChatOpenButton
|
||||||
{(event.job && event.job.ownr_ph1) || ""}
|
phone={event.job && event.job.ownr_ph1}
|
||||||
</PhoneFormatter>
|
jobid={event.job.id}
|
||||||
|
/>
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
<DataLabel label={t("jobs.fields.alt_transport")}>
|
<DataLabel label={t("jobs.fields.alt_transport")}>
|
||||||
{(event.job && event.job.alt_transport) || ""}
|
{(event.job && event.job.alt_transport) || ""}
|
||||||
<ScheduleAtChange job={event && event.job} />
|
<ScheduleAtChange job={event && event.job} />
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
|
<ScheduleEventNote event={event} />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
<Divider />
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{event.job ? (
|
{event.job ? (
|
||||||
<Link to={`/manage/jobs/${event.job && event.job.id}`}>
|
<Link to={`/manage/jobs/${event.job && event.job.id}`}>
|
||||||
@@ -106,23 +134,62 @@ export function ScheduleEventComponent({
|
|||||||
{t("appointments.actions.preview")}
|
{t("appointments.actions.preview")}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
<Button
|
|
||||||
onClick={() => {
|
<Dropdown
|
||||||
const Template = TemplateList("job").appointment_reminder;
|
overlay={
|
||||||
GenerateDocument(
|
<Menu>
|
||||||
{
|
<Menu.Item
|
||||||
name: Template.key,
|
onClick={() => {
|
||||||
variables: { id: event.job.id },
|
const Template = TemplateList("job").appointment_reminder;
|
||||||
},
|
GenerateDocument(
|
||||||
{ to: event.job && event.job.ownr_ea, subject: Template.subject },
|
{
|
||||||
"e",
|
name: Template.key,
|
||||||
event.job && event.job.id
|
variables: { id: event.job.id },
|
||||||
);
|
},
|
||||||
}}
|
{
|
||||||
disabled={event.arrived}
|
to: event.job && event.job.ownr_ea,
|
||||||
|
subject: Template.subject,
|
||||||
|
},
|
||||||
|
"e",
|
||||||
|
event.job && event.job.id
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
disabled={event.arrived}
|
||||||
|
>
|
||||||
|
{t("general.labels.email")}
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item
|
||||||
|
onClick={() => {
|
||||||
|
const p = parsePhoneNumber(event.job.ownr_ph1, "CA");
|
||||||
|
if (p && p.isValid()) {
|
||||||
|
openChatByPhone({
|
||||||
|
phone_num: p.formatInternational(),
|
||||||
|
jobid: event.job.id,
|
||||||
|
});
|
||||||
|
setMessage(
|
||||||
|
t("appointments.labels.reminder", {
|
||||||
|
shopname: bodyshop.shopname,
|
||||||
|
date: moment(event.start).format("MM/DD/YYYY"),
|
||||||
|
time: moment(event.start).format("HH:MM a"),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
setVisible(false);
|
||||||
|
} else {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("messaging.error.invalidphone"),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
disabled={event.arrived || !bodyshop.messagingservicesid}
|
||||||
|
>
|
||||||
|
{t("general.labels.sms")}
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t("appointments.actions.sendreminder")}
|
<Button>{t("appointments.actions.sendreminder")}</Button>
|
||||||
</Button>
|
</Dropdown>
|
||||||
|
|
||||||
<Button onClick={() => handleCancel(event.id)} disabled={event.arrived}>
|
<Button onClick={() => handleCancel(event.id)} disabled={event.arrived}>
|
||||||
{t("appointments.actions.cancel")}
|
{t("appointments.actions.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -161,6 +228,7 @@ export function ScheduleEventComponent({
|
|||||||
const RegularEvent = event.isintake ? (
|
const RegularEvent = event.isintake ? (
|
||||||
<div style={{ display: "flex", flexWrap: "wrap" }}>
|
<div style={{ display: "flex", flexWrap: "wrap" }}>
|
||||||
<Space>
|
<Space>
|
||||||
|
{event.note && <AlertFilled className="production-alert" />}
|
||||||
<strong>{`${event.job.ro_number || t("general.labels.na")}`}</strong>
|
<strong>{`${event.job.ro_number || t("general.labels.na")}`}</strong>
|
||||||
<span>{`${(event.job && event.job.ownr_fn) || ""} ${
|
<span>{`${(event.job && event.job.ownr_fn) || ""} ${
|
||||||
(event.job && event.job.ownr_ln) || ""
|
(event.job && event.job.ownr_ln) || ""
|
||||||
@@ -202,4 +270,7 @@ export function ScheduleEventComponent({
|
|||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(null, mapDispatchToProps)(ScheduleEventComponent);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ScheduleEventComponent);
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import { EditFilled, SaveFilled } from "@ant-design/icons";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Button, Input, notification, Space } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import DataLabel from "../data-label/data-label.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ScheduleEventNote({ event }) {
|
||||||
|
const [editing, setEditing] = useState(false);
|
||||||
|
const [note, setNote] = useState(event.note || "");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [updateAppointment] = useMutation(UPDATE_APPOINTMENT);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const toggleEdit = async () => {
|
||||||
|
if (editing) {
|
||||||
|
//Await the update
|
||||||
|
setLoading(true);
|
||||||
|
const result = await updateAppointment({
|
||||||
|
variables: {
|
||||||
|
appid: event.id,
|
||||||
|
app: { note },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!!!result.errors) {
|
||||||
|
// notification["success"]({ message: t("appointments.successes.saved") });
|
||||||
|
} else {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("jobs.errors.saving", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setEditing(false);
|
||||||
|
} else {
|
||||||
|
setEditing(true);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DataLabel label={t("appointments.fields.note")}>
|
||||||
|
<Space flex>
|
||||||
|
{!editing ? (
|
||||||
|
event.note || ""
|
||||||
|
) : (
|
||||||
|
<Input.TextArea
|
||||||
|
rows={3}
|
||||||
|
value={note}
|
||||||
|
onChange={(e) => setNote(e.target.value)}
|
||||||
|
style={{ maxWidth: "8vw" }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Button onClick={toggleEdit} loading={loading}>
|
||||||
|
{editing ? <SaveFilled /> : <EditFilled />}
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</DataLabel>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(ScheduleEventNote);
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { useQuery } from "@apollo/client";
|
||||||
|
import { Card, Table } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { QUERY_AUDIT_TRAIL } from "../../graphql/audit_trail.queries";
|
||||||
|
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
|
|
||||||
|
export default function JobAuditTrail({ jobId }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { loading, data } = useQuery(QUERY_AUDIT_TRAIL, {
|
||||||
|
variables: { jobid: jobId },
|
||||||
|
skip: !jobId,
|
||||||
|
});
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("audit.fields.created"),
|
||||||
|
dataIndex: "created",
|
||||||
|
key: "created",
|
||||||
|
render: (text, record) => (
|
||||||
|
<DateTimeFormatter>{record.created}</DateTimeFormatter>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("audit.fields.useremail"),
|
||||||
|
dataIndex: "useremail",
|
||||||
|
key: "useremail",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("audit.fields.operation"),
|
||||||
|
dataIndex: "operation",
|
||||||
|
key: "operation",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card title={t("jobs.labels.audit")}>
|
||||||
|
<Table
|
||||||
|
loading={loading}
|
||||||
|
columns={columns}
|
||||||
|
rowKey="id"
|
||||||
|
dataSource={data ? data.audit_trail : []}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -16,16 +16,21 @@ import {
|
|||||||
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
||||||
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
||||||
import moment from "moment-business-days";
|
import moment from "moment-business-days";
|
||||||
|
import { insertAuditTrail } from "../../../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
|
||||||
|
import { UPDATE_OWNER } from "../../../../graphql/owners.queries";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobChecklistForm({
|
export function JobChecklistForm({
|
||||||
|
insertAuditTrail,
|
||||||
formItems,
|
formItems,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
currentUser,
|
currentUser,
|
||||||
@@ -37,6 +42,8 @@ export function JobChecklistForm({
|
|||||||
const [intakeJob] = useMutation(UPDATE_JOB);
|
const [intakeJob] = useMutation(UPDATE_JOB);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [markAptArrived] = useMutation(MARK_LATEST_APPOINTMENT_AS_ARRIVED);
|
const [markAptArrived] = useMutation(MARK_LATEST_APPOINTMENT_AS_ARRIVED);
|
||||||
|
const [updateOwner] = useMutation(UPDATE_OWNER);
|
||||||
|
|
||||||
const { jobId } = useParams();
|
const { jobId } = useParams();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const search = queryString.parse(useLocation().search);
|
const search = queryString.parse(useLocation().search);
|
||||||
@@ -57,8 +64,16 @@ export function JobChecklistForm({
|
|||||||
...(type === "intake" && { actual_in: new Date() }),
|
...(type === "intake" && { actual_in: new Date() }),
|
||||||
...(type === "intake" && {
|
...(type === "intake" && {
|
||||||
production_vars: {
|
production_vars: {
|
||||||
...job.production_vars,
|
...(job ? job.production_vars : {}),
|
||||||
...values.production_vars,
|
|
||||||
|
note:
|
||||||
|
values.production_vars &&
|
||||||
|
values.production_vars.note &&
|
||||||
|
values.production_vars.note !== ""
|
||||||
|
? values &&
|
||||||
|
values.production_vars &&
|
||||||
|
values.production_vars.note
|
||||||
|
: job && job.production_vars && job.production_vars.note,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
...(type === "intake" && {
|
...(type === "intake" && {
|
||||||
@@ -104,11 +119,40 @@ export function JobChecklistForm({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type === "intake" && job.owner && job.owner.id) {
|
||||||
|
//Updae Owner Allow to Text
|
||||||
|
const updateOwnerResult = await updateOwner({
|
||||||
|
variables: {
|
||||||
|
ownerId: job.owner.id,
|
||||||
|
owner: { allow_text_message: values.allow_text_message },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!!updateOwnerResult.errors) {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("checklist.errors.complete", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|
||||||
if (!!!result.errors) {
|
if (!!!result.errors) {
|
||||||
notification["success"]({ message: t("checklist.successes.completed") });
|
notification["success"]({ message: t("checklist.successes.completed") });
|
||||||
history.push(`/manage/jobs/${jobId}`);
|
history.push(`/manage/jobs/${jobId}`);
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobId,
|
||||||
|
operation: AuditTrailMapping.jobchecklist(
|
||||||
|
type,
|
||||||
|
(type === "deliver" && values.removeFromProduction && false) ||
|
||||||
|
(type === "intake" && values.addToProduction),
|
||||||
|
(type === "intake" && bodyshop.md_ro_statuses.default_arrived) ||
|
||||||
|
(type === "deliver" && bodyshop.md_ro_statuses.default_delivered)
|
||||||
|
),
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("checklist.errors.complete", {
|
message: t("checklist.errors.complete", {
|
||||||
@@ -135,6 +179,7 @@ export function JobChecklistForm({
|
|||||||
initialValues={{
|
initialValues={{
|
||||||
...(type === "intake" && {
|
...(type === "intake" && {
|
||||||
addToProduction: true,
|
addToProduction: true,
|
||||||
|
allow_text_message: job.owner && job.owner.allow_text_message,
|
||||||
scheduled_completion:
|
scheduled_completion:
|
||||||
(job && job.scheduled_completion) ||
|
(job && job.scheduled_completion) ||
|
||||||
moment().businessAdd(
|
moment().businessAdd(
|
||||||
@@ -170,6 +215,14 @@ export function JobChecklistForm({
|
|||||||
>
|
>
|
||||||
<Switch disabled={readOnly} />
|
<Switch disabled={readOnly} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="allow_text_message"
|
||||||
|
valuePropName="checked"
|
||||||
|
label={t("checklist.labels.allow_text_message")}
|
||||||
|
disabled={readOnly}
|
||||||
|
>
|
||||||
|
<Switch disabled={readOnly} />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="scheduled_completion"
|
name="scheduled_completion"
|
||||||
label={t("jobs.fields.scheduled_completion")}
|
label={t("jobs.fields.scheduled_completion")}
|
||||||
@@ -194,6 +247,7 @@ export function JobChecklistForm({
|
|||||||
name={["production_vars", "note"]}
|
name={["production_vars", "note"]}
|
||||||
label={t("jobs.fields.production_vars.note")}
|
label={t("jobs.fields.production_vars.note")}
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
|
trigger="onChange"
|
||||||
>
|
>
|
||||||
<Input.TextArea rows={3} disabled={readOnly} />
|
<Input.TextArea rows={3} disabled={readOnly} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -295,18 +295,18 @@ export function JobLinesComponent({
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await deleteJobLine({
|
await deleteJobLine({
|
||||||
variables: { joblineId: record.id },
|
variables: { joblineId: record.id },
|
||||||
update(cache) {
|
// update(cache) {
|
||||||
cache.modify({
|
// cache.modify({
|
||||||
id: cache.identify(job),
|
// id: cache.identify(job),
|
||||||
fields: {
|
// fields: {
|
||||||
joblines(existingJobLines, { readField }) {
|
// joblines(existingJobLines, { readField }) {
|
||||||
return existingJobLines.filter(
|
// return existingJobLines.filter(
|
||||||
(jlRef) => record.id !== readField("id", jlRef)
|
// (jlRef) => record.id !== readField("id", jlRef)
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
});
|
});
|
||||||
await axios.post("/job/totalsssu", {
|
await axios.post("/job/totalsssu", {
|
||||||
id: job.id,
|
id: job.id,
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ export function JobEmployeeAssignments({
|
|||||||
});
|
});
|
||||||
const [visibility, setVisibility] = useState(false);
|
const [visibility, setVisibility] = useState(false);
|
||||||
|
|
||||||
const onChange = (e) => {
|
const onChange = (value, option) => {
|
||||||
setAssignment({ ...assignment, employeeid: e });
|
setAssignment({ ...assignment, employeeid: value, name: option.name });
|
||||||
};
|
};
|
||||||
|
|
||||||
const popContent = (
|
const popContent = (
|
||||||
@@ -56,7 +56,11 @@ export function JobEmployeeAssignments({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{bodyshop.employees.map((emp) => (
|
{bodyshop.employees.map((emp) => (
|
||||||
<Select.Option value={emp.id} key={emp.id}>
|
<Select.Option
|
||||||
|
value={emp.id}
|
||||||
|
key={emp.id}
|
||||||
|
name={`${emp.first_name} ${emp.last_name}`}
|
||||||
|
>
|
||||||
{`${emp.first_name} ${emp.last_name}`}
|
{`${emp.first_name} ${emp.last_name}`}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -6,14 +6,34 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
|||||||
import { UPDATE_JOB_ASSIGNMENTS } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB_ASSIGNMENTS } from "../../graphql/jobs.queries";
|
||||||
import JobEmployeeAssignmentsComponent from "./job-employee-assignments.component";
|
import JobEmployeeAssignmentsComponent from "./job-employee-assignments.component";
|
||||||
|
|
||||||
export default function JobEmployeeAssignmentsContainer({ job, refetch }) {
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(JobEmployeeAssignmentsContainer);
|
||||||
|
|
||||||
|
export function JobEmployeeAssignmentsContainer({
|
||||||
|
job,
|
||||||
|
refetch,
|
||||||
|
insertAuditTrail,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updateJob] = useMutation(UPDATE_JOB_ASSIGNMENTS);
|
const [updateJob] = useMutation(UPDATE_JOB_ASSIGNMENTS);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleAdd = async (assignment) => {
|
const handleAdd = async (assignment) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { operation, employeeid } = assignment;
|
const { operation, employeeid, name } = assignment;
|
||||||
logImEXEvent("job_assign_employee", { operation });
|
logImEXEvent("job_assign_employee", { operation });
|
||||||
|
|
||||||
let empAssignment = determineFieldName(operation);
|
let empAssignment = determineFieldName(operation);
|
||||||
@@ -23,6 +43,11 @@ export default function JobEmployeeAssignmentsContainer({ job, refetch }) {
|
|||||||
});
|
});
|
||||||
if (refetch) refetch();
|
if (refetch) refetch();
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobassignmentchange(operation, name),
|
||||||
|
});
|
||||||
|
|
||||||
if (!!result.errors) {
|
if (!!result.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.assigning", {
|
message: t("jobs.errors.assigning", {
|
||||||
@@ -48,6 +73,10 @@ export default function JobEmployeeAssignmentsContainer({ job, refetch }) {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobassignmentremoved(operation),
|
||||||
|
});
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export function JobLineStatusPopup({ bodyshop, jobline, disabled }) {
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ width: "100%", minHeight: "2rem", cursor: "pointer" }}
|
style={{ width: "100%", minHeight: "1rem", cursor: "pointer" }}
|
||||||
onClick={() => !disabled && setEditing(true)}
|
onClick={() => !disabled && setEditing(true)}
|
||||||
>
|
>
|
||||||
{jobline.status}
|
{jobline.status}
|
||||||
|
|||||||
@@ -115,18 +115,18 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("joblines.fields.mod_lb_hrs")}
|
label={t("joblines.fields.mod_lb_hrs")}
|
||||||
name="mod_lb_hrs"
|
name="mod_lb_hrs"
|
||||||
// rules={[
|
rules={[
|
||||||
// ({ getFieldValue }) => ({
|
({ getFieldValue }) => ({
|
||||||
// validator(rule, value) {
|
validator(rule, value) {
|
||||||
// if (!!getFieldValue("mod_lbr_ty") === !!value) {
|
if (!!getFieldValue("mod_lbr_ty") === !!value) {
|
||||||
// return Promise.resolve();
|
return Promise.resolve();
|
||||||
// }
|
}
|
||||||
// return Promise.reject(
|
return Promise.reject(
|
||||||
// t("joblines.validations.hrsrequirediflbrtyp")
|
t("joblines.validations.hrsrequirediflbrtyp")
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
// }),
|
}),
|
||||||
// ]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -169,18 +169,18 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("joblines.fields.part_qty")}
|
label={t("joblines.fields.part_qty")}
|
||||||
name="part_qty"
|
name="part_qty"
|
||||||
// rules={[
|
rules={[
|
||||||
// ({ getFieldValue }) => ({
|
({ getFieldValue }) => ({
|
||||||
// validator(rule, value) {
|
validator(rule, value) {
|
||||||
// if (!!getFieldValue("part_type") === !!value) {
|
if (!!getFieldValue("part_type") === !!value) {
|
||||||
// return Promise.resolve();
|
return Promise.resolve();
|
||||||
// }
|
}
|
||||||
// return Promise.reject(
|
return Promise.reject(
|
||||||
// t("joblines.validations.requiredifparttype")
|
t("joblines.validations.requiredifparttype")
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
// }),
|
}),
|
||||||
// ]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber precision={0} min={0} />
|
<InputNumber precision={0} min={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -190,28 +190,28 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("joblines.fields.act_price")}
|
label={t("joblines.fields.act_price")}
|
||||||
name="act_price"
|
name="act_price"
|
||||||
// rules={[
|
rules={[
|
||||||
// ({ getFieldValue }) => ({
|
({ getFieldValue }) => ({
|
||||||
// validator(rule, value) {
|
validator(rule, value) {
|
||||||
// if (!value || getFieldValue("part_type") !== "PAE") {
|
if (!value || getFieldValue("part_type") !== "PAE") {
|
||||||
// return Promise.resolve();
|
return Promise.resolve();
|
||||||
// }
|
}
|
||||||
// return Promise.reject(
|
return Promise.reject(
|
||||||
// t("joblines.validations.zeropriceexistingpart")
|
t("joblines.validations.zeropriceexistingpart")
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
// }),
|
}),
|
||||||
// ({ getFieldValue }) => ({
|
({ getFieldValue }) => ({
|
||||||
// validator(rule, value) {
|
validator(rule, value) {
|
||||||
// if (!!getFieldValue("part_type") === !!value) {
|
if (!!getFieldValue("part_type") === !!value) {
|
||||||
// return Promise.resolve();
|
return Promise.resolve();
|
||||||
// }
|
}
|
||||||
// return Promise.reject(
|
return Promise.reject(
|
||||||
// t("joblines.validations.requiredifparttype")
|
t("joblines.validations.requiredifparttype")
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
// }),
|
}),
|
||||||
// ]}
|
]}
|
||||||
>
|
>
|
||||||
<InputCurrency precision={2} min={0} />
|
<InputCurrency precision={2} min={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Button, Card, Space, Table } from "antd";
|
import { Button, Card, Space, Table } from "antd";
|
||||||
|
import { EditFilled } from "@ant-design/icons";
|
||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
import React, { useMemo, useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -115,16 +116,29 @@ export function JobPayments({
|
|||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<PrintWrapperComponent
|
<Space wrap>
|
||||||
templateObject={{
|
<Button
|
||||||
name: TemplateList("payment").payment_receipt.key,
|
disabled={record.exportedat}
|
||||||
variables: { id: record.id },
|
onClick={() => {
|
||||||
}}
|
setPaymentContext({
|
||||||
messageObject={{
|
actions: { refetch: refetch },
|
||||||
to: job.ownr_ea,
|
context: record,
|
||||||
}}
|
});
|
||||||
id={job.id}
|
}}
|
||||||
/>
|
>
|
||||||
|
<EditFilled />
|
||||||
|
</Button>
|
||||||
|
<PrintWrapperComponent
|
||||||
|
templateObject={{
|
||||||
|
name: TemplateList("payment").payment_receipt.key,
|
||||||
|
variables: { id: record.id },
|
||||||
|
}}
|
||||||
|
messageObject={{
|
||||||
|
to: job.ownr_ea,
|
||||||
|
}}
|
||||||
|
id={job.id}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Checkbox, PageHeader, Table } from "antd";
|
import { Checkbox, Table, Typography } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
@@ -21,6 +21,7 @@ export default function JobReconciliationBillsTable({
|
|||||||
title: t("billlines.fields.line_desc"),
|
title: t("billlines.fields.line_desc"),
|
||||||
dataIndex: "line_desc",
|
dataIndex: "line_desc",
|
||||||
key: "line_desc",
|
key: "line_desc",
|
||||||
|
width: "35%",
|
||||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
||||||
@@ -29,6 +30,8 @@ export default function JobReconciliationBillsTable({
|
|||||||
title: t("billlines.labels.from"),
|
title: t("billlines.labels.from"),
|
||||||
dataIndex: "from",
|
dataIndex: "from",
|
||||||
key: "from",
|
key: "from",
|
||||||
|
width: "20%",
|
||||||
|
ellipsis: true,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
`${record.bill.vendor && record.bill.vendor.name} / ${
|
`${record.bill.vendor && record.bill.vendor.name} / ${
|
||||||
record.bill.invoice_number
|
record.bill.invoice_number
|
||||||
@@ -57,7 +60,7 @@ export default function JobReconciliationBillsTable({
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("billlines.fields.quantity"),
|
title: t("joblines.fields.part_qty"),
|
||||||
dataIndex: "quantity",
|
dataIndex: "quantity",
|
||||||
key: "quantity",
|
key: "quantity",
|
||||||
sorter: (a, b) => a.quantity - b.quantity,
|
sorter: (a, b) => a.quantity - b.quantity,
|
||||||
@@ -86,10 +89,12 @@ export default function JobReconciliationBillsTable({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageHeader title={t("bills.labels.bills")}>
|
<div>
|
||||||
|
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
|
||||||
<Table
|
<Table
|
||||||
pagination={false}
|
pagination={false}
|
||||||
scroll={{ y: "40vh", x: true }}
|
size="small"
|
||||||
|
scroll={{ y: "80vh", x: true }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={invoiceLineData}
|
dataSource={invoiceLineData}
|
||||||
@@ -99,6 +104,6 @@ export default function JobReconciliationBillsTable({
|
|||||||
selectedRowKeys: selectedLines,
|
selectedRowKeys: selectedLines,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</PageHeader>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,21 +22,23 @@ export default function JobReconciliationModalComponent({ job, bills }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div style={{ flex: 1, display: "flex", flexDirection: "column" }}>
|
||||||
<Row gutter={[16, 16]}>
|
<div style={{ flex: 1 }}>
|
||||||
<Col span={12}>
|
<Row gutter={8}>
|
||||||
<JobReconciliationPartsTable
|
<Col span={12}>
|
||||||
jobLineData={jobLineData}
|
<JobReconciliationPartsTable
|
||||||
jobLineState={jobLineState}
|
jobLineData={jobLineData}
|
||||||
/>
|
jobLineState={jobLineState}
|
||||||
</Col>
|
/>
|
||||||
<Col span={12}>
|
</Col>
|
||||||
<JobReconciliationBillsTable
|
<Col span={12}>
|
||||||
invoiceLineData={invoiceLineData}
|
<JobReconciliationBillsTable
|
||||||
billLineState={billLineState}
|
invoiceLineData={invoiceLineData}
|
||||||
/>
|
billLineState={billLineState}
|
||||||
</Col>
|
/>
|
||||||
</Row>
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
<Row>
|
<Row>
|
||||||
<JobReconciliationTotals
|
<JobReconciliationTotals
|
||||||
jobLines={jobLineData}
|
jobLines={jobLineData}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.imex-reconciliation-modal {
|
||||||
|
top: 20px;
|
||||||
|
.ant-modal-content {
|
||||||
|
height: 95vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.ant-modal-body {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import { selectReconciliation } from "../../redux/modals/modals.selectors";
|
|||||||
import JobReconciliationModalComponent from "./job-reconciliation-modal.component";
|
import JobReconciliationModalComponent from "./job-reconciliation-modal.component";
|
||||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
import "./job-reconciliation-modal.styles.scss";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
reconciliationModal: selectReconciliation,
|
reconciliationModal: selectReconciliation,
|
||||||
@@ -38,23 +39,23 @@ function JobReconciliationModalContainer({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={t("jobs.labels.reconciliationheader")}
|
title={t("jobs.labels.reconciliationheader")}
|
||||||
width={"90%"}
|
width={"95%"}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
okText={t("general.actions.close")}
|
okText={t("general.actions.close")}
|
||||||
onOk={handleCancel}
|
onOk={handleCancel}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
cancelButtonProps={{ display: "none" }}
|
cancelButtonProps={{ display: "none" }}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
|
className="imex-reconciliation-modal"
|
||||||
>
|
>
|
||||||
<LoadingSpinner loading={loading}>
|
{loading && <LoadingSpinner loading={loading} />}
|
||||||
{error && <AlertComponent message={error.message} type="error" />}
|
{error && <AlertComponent message={error.message} type="error" />}
|
||||||
{data && (
|
{data && (
|
||||||
<JobReconciliationModalComponent
|
<JobReconciliationModalComponent
|
||||||
job={data && data.jobs_by_pk}
|
job={data && data.jobs_by_pk}
|
||||||
bills={data && data.bills}
|
bills={data && data.bills}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</LoadingSpinner>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { PageHeader, Table } from "antd";
|
import { Table, Typography } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
@@ -102,11 +102,13 @@ export default function JobReconcilitionPartsTable({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageHeader title={t("jobs.labels.lines")}>
|
<div>
|
||||||
|
<Typography.Title level={4}>{t("jobs.labels.lines")}</Typography.Title>
|
||||||
<Table
|
<Table
|
||||||
pagination={false}
|
pagination={false}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
scroll={{ y: "40vh", x: true }}
|
size="small"
|
||||||
|
scroll={{ y: "80vh", x: true }}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={jobLineData}
|
dataSource={jobLineData}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
@@ -122,6 +124,6 @@ export default function JobReconcilitionPartsTable({
|
|||||||
<div style={{ fontStyle: "italic", margin: "4px" }}>
|
<div style={{ fontStyle: "italic", margin: "4px" }}>
|
||||||
{t("jobs.labels.reconciliation.removedpartsstrikethrough")}
|
{t("jobs.labels.reconciliation.removedpartsstrikethrough")}
|
||||||
</div>
|
</div>
|
||||||
</PageHeader>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Card, Form, notification, Popover } from "antd";
|
import { Button, Card, Form, InputNumber, notification, Popover } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { INSERT_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
|
import { INSERT_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
import InputNumberCalculator from "../form-input-number-calculator/form-input-number-calculator.component";
|
|
||||||
|
|
||||||
export default function ScoreboardAddButton({
|
export default function ScoreboardAddButton({
|
||||||
job,
|
job,
|
||||||
@@ -73,7 +72,7 @@ export default function ScoreboardAddButton({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumberCalculator precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("scoreboard.fields.painthrs")}
|
label={t("scoreboard.fields.painthrs")}
|
||||||
@@ -85,7 +84,7 @@ export default function ScoreboardAddButton({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumberCalculator precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Button type="primary" htmlType="submit">
|
<Button type="primary" htmlType="submit">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { LoadingOutlined } from "@ant-design/icons";
|
import { LoadingOutlined } from "@ant-design/icons";
|
||||||
import { useLazyQuery } from "@apollo/client";
|
import { useLazyQuery } from "@apollo/client";
|
||||||
import { Empty, Select } from "antd";
|
import { Empty, Select, Space, Tag } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React, { forwardRef, useEffect } from "react";
|
import React, { forwardRef, useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -15,6 +15,7 @@ const JobSearchSelect = (
|
|||||||
{
|
{
|
||||||
disabled,
|
disabled,
|
||||||
convertedOnly = false,
|
convertedOnly = false,
|
||||||
|
notInvoiced = false,
|
||||||
notExported = true,
|
notExported = true,
|
||||||
clm_no = false,
|
clm_no = false,
|
||||||
...restProps
|
...restProps
|
||||||
@@ -30,6 +31,7 @@ const JobSearchSelect = (
|
|||||||
variables: {
|
variables: {
|
||||||
...(convertedOnly ? { isConverted: true } : {}),
|
...(convertedOnly ? { isConverted: true } : {}),
|
||||||
...(notExported ? { notExported: true } : {}),
|
...(notExported ? { notExported: true } : {}),
|
||||||
|
...(notInvoiced ? { notInvoiced: true } : {}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
@@ -80,13 +82,20 @@ const JobSearchSelect = (
|
|||||||
{theOptions
|
{theOptions
|
||||||
? theOptions.map((o) => (
|
? theOptions.map((o) => (
|
||||||
<Option key={o.id} value={o.id} status={o.status}>
|
<Option key={o.id} value={o.id} status={o.status}>
|
||||||
{`${clm_no && o.clm_no ? `${o.clm_no} | ` : ""}${
|
<Space align="center">
|
||||||
o.ro_number || t("general.labels.na")
|
<span>
|
||||||
} | ${o.ownr_ln || ""} ${o.ownr_fn || ""} ${
|
{`${clm_no && o.clm_no ? `${o.clm_no} | ` : ""}${
|
||||||
o.ownr_co_nm ? ` ${o.ownr_co_num}` : ""
|
o.ro_number || t("general.labels.na")
|
||||||
}| ${o.v_model_yr || ""} ${o.v_make_desc || ""} ${
|
} | ${o.ownr_ln || ""} ${o.ownr_fn || ""} ${
|
||||||
o.v_model_desc || ""
|
o.ownr_co_nm ? ` ${o.ownr_co_num}` : ""
|
||||||
}`}
|
}| ${o.v_model_yr || ""} ${o.v_make_desc || ""} ${
|
||||||
|
o.v_model_desc || ""
|
||||||
|
}`}
|
||||||
|
</span>
|
||||||
|
<Tag>
|
||||||
|
<strong>{o.status}</strong>
|
||||||
|
</Tag>
|
||||||
|
</Space>
|
||||||
</Option>
|
</Option>
|
||||||
))
|
))
|
||||||
: null}
|
: null}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { DownCircleFilled } from "@ant-design/icons";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Button, Dropdown, Menu, notification } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries";
|
||||||
|
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)(JobsAdminStatus);
|
||||||
|
|
||||||
|
export function JobsAdminStatus({ bodyshop, job }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS);
|
||||||
|
const updateJobStatus = (status) => {
|
||||||
|
mutationUpdateJobstatus({
|
||||||
|
variables: { jobId: job.id, status: status },
|
||||||
|
})
|
||||||
|
.then((r) => {
|
||||||
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
|
// refetch();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
notification["error"]({ message: t("jobs.errors.saving") });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusmenu = (
|
||||||
|
<Menu
|
||||||
|
onClick={(e) => {
|
||||||
|
updateJobStatus(e.key);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{bodyshop.md_ro_statuses.statuses.map((item) => (
|
||||||
|
<Menu.Item key={item}>{item}</Menu.Item>
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dropdown overlay={statusmenu} trigger={["click"]} key="changestatus">
|
||||||
|
<Button shape="round">
|
||||||
|
<span>{job.status}</span>
|
||||||
|
|
||||||
|
<DownCircleFilled />
|
||||||
|
</Button>
|
||||||
|
</Dropdown>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,8 +6,8 @@ import { useTranslation } from "react-i18next";
|
|||||||
export default function JobAdminDeleteIntake({ job }) {
|
export default function JobAdminDeleteIntake({ job }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [updateJob] = useMutation(gql`
|
const [deleteIntake] = useMutation(gql`
|
||||||
mutation UPDATE_JOB($jobId: uuid!) {
|
mutation DELETE_INTAKE($jobId: uuid!) {
|
||||||
update_jobs_by_pk(
|
update_jobs_by_pk(
|
||||||
pk_columns: { id: $jobId }
|
pk_columns: { id: $jobId }
|
||||||
_set: { intakechecklist: null }
|
_set: { intakechecklist: null }
|
||||||
@@ -18,9 +18,39 @@ export default function JobAdminDeleteIntake({ job }) {
|
|||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
const [DELETE_DELIVERY] = useMutation(gql`
|
||||||
|
mutation DELETE_DELIVERY($jobId: uuid!) {
|
||||||
|
update_jobs_by_pk(
|
||||||
|
pk_columns: { id: $jobId }
|
||||||
|
_set: { deliverchecklist: null }
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
deliverchecklist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
const handleDelete = async (values) => {
|
const handleDelete = async (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await updateJob({
|
const result = await deleteIntake({
|
||||||
|
variables: { jobId: job.id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!!!result.errors) {
|
||||||
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
|
} else {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("jobs.errors.saving", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteDelivery = async (values) => {
|
||||||
|
setLoading(true);
|
||||||
|
const result = await DELETE_DELIVERY({
|
||||||
variables: { jobId: job.id },
|
variables: { jobId: job.id },
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -34,12 +64,16 @@ export default function JobAdminDeleteIntake({ job }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
//Get the owner details, populate it all back into the job.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button loading={loading} onClick={handleDelete}>
|
<>
|
||||||
{t("jobs.labels.deleteintake")}
|
<Button loading={loading} onClick={handleDelete}>
|
||||||
</Button>
|
{t("jobs.labels.deleteintake")}
|
||||||
|
</Button>
|
||||||
|
<Button loading={loading} onClick={handleDeleteDelivery}>
|
||||||
|
{t("jobs.labels.deletedelivery")}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import moment from "moment";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
@@ -21,8 +22,8 @@ export default connect(
|
|||||||
export function JobAdminMarkReexport({ bodyshop, job }) {
|
export function JobAdminMarkReexport({ bodyshop, job }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [updateJob] = useMutation(gql`
|
const [markJobForReexport] = useMutation(gql`
|
||||||
mutation UPDATE_JOB($jobId: uuid!) {
|
mutation MARK_JOB_FOR_REEXPORT($jobId: uuid!) {
|
||||||
update_jobs_by_pk(
|
update_jobs_by_pk(
|
||||||
pk_columns: { id: $jobId }
|
pk_columns: { id: $jobId }
|
||||||
_set: { date_exported: null
|
_set: { date_exported: null
|
||||||
@@ -30,14 +31,84 @@ export function JobAdminMarkReexport({ bodyshop, job }) {
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
intakechecklist
|
date_exported
|
||||||
|
status
|
||||||
|
date_invoiced
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
const handleUpdate = async (values) => {
|
const [markJobExported] = useMutation(gql`
|
||||||
|
mutation MARK_JOB_AS_EXPORTED($jobId: uuid!, $date_exported: timestamptz!) {
|
||||||
|
update_jobs_by_pk(
|
||||||
|
pk_columns: { id: $jobId }
|
||||||
|
_set: { date_exported: $date_exported
|
||||||
|
status: "${bodyshop.md_ro_statuses.default_exported}"
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
date_exported
|
||||||
|
date_invoiced
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
const [markJobUninvoiced] = useMutation(gql`
|
||||||
|
mutation MARK_JOB_AS_UNINVOICED($jobId: uuid!, ) {
|
||||||
|
update_jobs_by_pk(
|
||||||
|
pk_columns: { id: $jobId }
|
||||||
|
_set: { date_exported: null
|
||||||
|
date_invoiced: null
|
||||||
|
status: "${bodyshop.md_ro_statuses.default_delivered}"
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
date_exported
|
||||||
|
date_invoiced
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
|
const handleMarkForExport = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await updateJob({
|
const result = await markJobForReexport({
|
||||||
|
variables: { jobId: job.id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.errors) {
|
||||||
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
|
} else {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("jobs.errors.saving", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMarkExported = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
const result = await markJobExported({
|
||||||
|
variables: { jobId: job.id, date_exported: moment() },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.errors) {
|
||||||
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
|
} else {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("jobs.errors.saving", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleUninvoice = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
const result = await markJobUninvoiced({
|
||||||
variables: { jobId: job.id },
|
variables: { jobId: job.id },
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -51,16 +122,31 @@ export function JobAdminMarkReexport({ bodyshop, job }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
//Get the owner details, populate it all back into the job.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<>
|
||||||
loading={loading}
|
<Button
|
||||||
disabled={!job.date_exported}
|
loading={loading}
|
||||||
onClick={handleUpdate}
|
disabled={!job.date_exported}
|
||||||
>
|
onClick={handleMarkForExport}
|
||||||
{t("jobs.labels.markforreexport")}
|
>
|
||||||
</Button>
|
{t("jobs.labels.markforreexport")}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
disabled={job.date_exported}
|
||||||
|
onClick={handleMarkExported}
|
||||||
|
>
|
||||||
|
{t("jobs.actions.markasexported")}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
disabled={!job.date_invoiced || job.date_exported}
|
||||||
|
onClick={handleUninvoice}
|
||||||
|
>
|
||||||
|
{t("jobs.actions.uninvoice")}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
|||||||
query: GET_ALL_JOBLINES_BY_PK,
|
query: GET_ALL_JOBLINES_BY_PK,
|
||||||
variables: { id: jobId },
|
variables: { id: jobId },
|
||||||
});
|
});
|
||||||
|
|
||||||
const existingLines = _.cloneDeep(existingLinesFromDb);
|
const existingLines = _.cloneDeep(existingLinesFromDb);
|
||||||
const linesToInsert = [];
|
const linesToInsert = [];
|
||||||
const linesToUpdate = [];
|
const linesToUpdate = [];
|
||||||
@@ -19,11 +20,14 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
|||||||
const matchingIndex = existingLines.findIndex(
|
const matchingIndex = existingLines.findIndex(
|
||||||
(eL) => eL.unq_seq === newLine.unq_seq
|
(eL) => eL.unq_seq === newLine.unq_seq
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//Should do a check to make sure there is only 1 matching unq sequence number.
|
||||||
|
|
||||||
if (matchingIndex >= 0) {
|
if (matchingIndex >= 0) {
|
||||||
//Found a relevant matching line. Add it to lines to update.
|
//Found a relevant matching line. Add it to lines to update.
|
||||||
linesToUpdate.push({
|
linesToUpdate.push({
|
||||||
id: existingLines[matchingIndex].id,
|
id: existingLines[matchingIndex].id,
|
||||||
newData: newLine,
|
newData: { ...newLine, removed: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
//Splice out item we found for performance.
|
//Splice out item we found for performance.
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export function JobsAvailableComponent({
|
|||||||
title: t("jobs.fields.cieca_id"),
|
title: t("jobs.fields.cieca_id"),
|
||||||
dataIndex: "cieca_id",
|
dataIndex: "cieca_id",
|
||||||
key: "cieca_id",
|
key: "cieca_id",
|
||||||
sorter: (a, b) => alphaSort(a, b),
|
sorter: (a, b) => alphaSort(a.cieca_id, b.cieca_id),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
@@ -68,9 +68,10 @@ export function JobsAvailableComponent({
|
|||||||
//width: "8%",
|
//width: "8%",
|
||||||
// onFilter: (value, record) => record.ro_number.includes(value),
|
// onFilter: (value, record) => record.ro_number.includes(value),
|
||||||
// filteredValue: state.filteredInfo.text || null,
|
// filteredValue: state.filteredInfo.text || null,
|
||||||
sorter: (a, b) => alphaSort(a, b),
|
sorter: (a, b) =>
|
||||||
|
alphaSort(a.job && a.job.ro_number, b.job && b.job.ro_number),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "job_id" && state.sortedInfo.order,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
record.job ? (
|
record.job ? (
|
||||||
<Link to={`/manage/jobs/${record.job.id}`}>
|
<Link to={`/manage/jobs/${record.job.id}`}>
|
||||||
@@ -87,7 +88,7 @@ export function JobsAvailableComponent({
|
|||||||
dataIndex: "ownr_name",
|
dataIndex: "ownr_name",
|
||||||
key: "ownr_name",
|
key: "ownr_name",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: (a, b) => alphaSort(a.ownr_name, b.ownr_name),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
import { Col, notification, Row } from "antd";
|
import { Col, notification, Row } from "antd";
|
||||||
import Axios from "axios";
|
import Axios from "axios";
|
||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
import _ from "lodash";
|
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
@@ -25,10 +24,12 @@ import {
|
|||||||
import { INSERT_NEW_JOB, UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { INSERT_NEW_JOB, UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { INSERT_NEW_NOTE } from "../../graphql/notes.queries";
|
import { INSERT_NEW_NOTE } from "../../graphql/notes.queries";
|
||||||
import { SEARCH_VEHICLE_BY_VIN } from "../../graphql/vehicles.queries";
|
import { SEARCH_VEHICLE_BY_VIN } from "../../graphql/vehicles.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component";
|
import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component";
|
||||||
import JobsFindModalContainer from "../jobs-find-modal/jobs-find-modal.container";
|
import JobsFindModalContainer from "../jobs-find-modal/jobs-find-modal.container";
|
||||||
@@ -42,8 +43,15 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
export function JobsAvailableContainer({
|
||||||
|
bodyshop,
|
||||||
|
currentUser,
|
||||||
|
insertAuditTrail,
|
||||||
|
}) {
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_JOBS, {
|
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_JOBS, {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
});
|
});
|
||||||
@@ -66,7 +74,7 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
|
|
||||||
const estDataLazyLoad = useLazyQuery(QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK);
|
const estDataLazyLoad = useLazyQuery(QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK);
|
||||||
const [loadEstData, estData] = estDataLazyLoad;
|
const [loadEstData, estDataRaw] = estDataLazyLoad;
|
||||||
|
|
||||||
const importOptionsState = useState({ overrideHeaders: false });
|
const importOptionsState = useState({ overrideHeaders: false });
|
||||||
const importOptions = importOptionsState[0];
|
const importOptions = importOptionsState[0];
|
||||||
@@ -79,13 +87,9 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
setOwnerModalVisible(false);
|
setOwnerModalVisible(false);
|
||||||
setInsertLoading(true);
|
setInsertLoading(true);
|
||||||
|
|
||||||
if (
|
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
||||||
!(
|
|
||||||
estData.data &&
|
if (!(estData && estData.est_data)) {
|
||||||
estData.data.available_jobs_by_pk &&
|
|
||||||
estData.data.available_jobs_by_pk.est_data
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
//We don't have the right data. Error!
|
//We don't have the right data. Error!
|
||||||
setInsertLoading(false);
|
setInsertLoading(false);
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
@@ -93,32 +97,31 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
||||||
|
await CheckTaxRates(estData, bodyshop);
|
||||||
|
|
||||||
const newTotals = (
|
const newTotals = (
|
||||||
await Axios.post("/job/totals", {
|
await Axios.post("/job/totals", {
|
||||||
job: {
|
job: {
|
||||||
...estData.data.available_jobs_by_pk.est_data,
|
...estData.est_data,
|
||||||
joblines: estData.data.available_jobs_by_pk.est_data.joblines.data,
|
joblines: estData.est_data.joblines.data,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
let existingVehicles;
|
let existingVehicles;
|
||||||
if (
|
if (estData.est_data.vehicle && estData.est_data.vin) {
|
||||||
estData.data.available_jobs_by_pk.est_data.vehicle &&
|
|
||||||
estData.data.available_jobs_by_pk.est_data.vin
|
|
||||||
) {
|
|
||||||
//There's vehicle data, need to double check the VIN.
|
//There's vehicle data, need to double check the VIN.
|
||||||
existingVehicles = await client.query({
|
existingVehicles = await client.query({
|
||||||
query: SEARCH_VEHICLE_BY_VIN,
|
query: SEARCH_VEHICLE_BY_VIN,
|
||||||
variables: {
|
variables: {
|
||||||
vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin,
|
vin: estData.est_data.vehicle.data.v_vin,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const newJob = {
|
const newJob = {
|
||||||
...estData.data.available_jobs_by_pk.est_data,
|
...estData.est_data,
|
||||||
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
|
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
|
||||||
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
|
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
|
||||||
job_totals: newTotals,
|
job_totals: newTotals,
|
||||||
@@ -157,8 +160,13 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
});
|
});
|
||||||
//Job has been inserted. Clean up the available jobs record.
|
//Job has been inserted. Clean up the available jobs record.
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: r.data.insert_jobs.returning[0].id,
|
||||||
|
operation: AuditTrailMapping.jobimported(),
|
||||||
|
});
|
||||||
|
|
||||||
deleteJob({
|
deleteJob({
|
||||||
variables: { id: estData.data.available_jobs_by_pk.id },
|
variables: { id: estData.id },
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
refetch();
|
refetch();
|
||||||
setInsertLoading(false);
|
setInsertLoading(false);
|
||||||
@@ -181,32 +189,32 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
setJobModalVisible(false);
|
setJobModalVisible(false);
|
||||||
setInsertLoading(true);
|
setInsertLoading(true);
|
||||||
|
|
||||||
if (
|
const estData = estDataRaw.data.available_jobs_by_pk;
|
||||||
!(
|
|
||||||
estData.data &&
|
if (!(estData && estData.est_data)) {
|
||||||
estData.data.available_jobs_by_pk &&
|
|
||||||
estData.data.available_jobs_by_pk.est_data
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
//We don't have the right data. Error!
|
//We don't have the right data. Error!
|
||||||
setInsertLoading(false);
|
setInsertLoading(false);
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.creating", { error: "No job data present." }),
|
message: t("jobs.errors.creating", { error: "No job data present." }),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
||||||
|
await CheckTaxRates(estData, bodyshop);
|
||||||
|
|
||||||
//create upsert job
|
//create upsert job
|
||||||
let supp = _.cloneDeep(estData.data.available_jobs_by_pk.est_data);
|
let supp = replaceEmpty({ ...estData.est_data });
|
||||||
|
|
||||||
delete supp.owner;
|
delete supp.owner;
|
||||||
delete supp.vehicle;
|
delete supp.vehicle;
|
||||||
if (importOptions.overrideHeaders) {
|
delete supp.ins_co_nm;
|
||||||
|
if (!importOptions.overrideHeaders) {
|
||||||
HeaderFields.forEach((item) => delete supp[item]);
|
HeaderFields.forEach((item) => delete supp[item]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let suppDelta = await GetSupplementDelta(
|
let suppDelta = await GetSupplementDelta(
|
||||||
client,
|
client,
|
||||||
selectedJob,
|
selectedJob,
|
||||||
estData.data.available_jobs_by_pk.est_data.joblines.data
|
supp.joblines.data
|
||||||
);
|
);
|
||||||
|
|
||||||
delete supp.joblines;
|
delete supp.joblines;
|
||||||
@@ -265,7 +273,7 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
//Job has been inserted. Clean up the available jobs record.
|
//Job has been inserted. Clean up the available jobs record.
|
||||||
|
|
||||||
deleteJob({
|
deleteJob({
|
||||||
variables: { id: estData.data.available_jobs_by_pk.id },
|
variables: { id: estData.id },
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
refetch();
|
refetch();
|
||||||
setInsertLoading(false);
|
setInsertLoading(false);
|
||||||
@@ -283,17 +291,21 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: selectedJob,
|
||||||
|
operation: AuditTrailMapping.jobsupplement(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const owner =
|
const owner =
|
||||||
estData.data &&
|
estDataRaw.data &&
|
||||||
estData.data.available_jobs_by_pk &&
|
estDataRaw.data.available_jobs_by_pk &&
|
||||||
estData.data.available_jobs_by_pk.est_data &&
|
estDataRaw.data.available_jobs_by_pk.est_data &&
|
||||||
estData.data.available_jobs_by_pk.est_data.owner &&
|
estDataRaw.data.available_jobs_by_pk.est_data.owner &&
|
||||||
estData.data.available_jobs_by_pk.est_data.owner.data &&
|
estDataRaw.data.available_jobs_by_pk.est_data.owner.data &&
|
||||||
!estData.data.available_jobs_by_pk.issupplement
|
!estDataRaw.data.available_jobs_by_pk.issupplement
|
||||||
? estData.data.available_jobs_by_pk.est_data.owner.data
|
? estDataRaw.data.available_jobs_by_pk.est_data.owner.data
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const onOwnerModalCancel = () => {
|
const onOwnerModalCancel = () => {
|
||||||
@@ -331,8 +343,8 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
message={t("jobs.labels.creating_new_job")}
|
message={t("jobs.labels.creating_new_job")}
|
||||||
>
|
>
|
||||||
<OwnerFindModalContainer
|
<OwnerFindModalContainer
|
||||||
loading={estData.loading}
|
loading={estDataRaw.loading}
|
||||||
error={estData.error}
|
error={estDataRaw.error}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
selectedOwner={selectedOwner}
|
selectedOwner={selectedOwner}
|
||||||
setSelectedOwner={setSelectedOwner}
|
setSelectedOwner={setSelectedOwner}
|
||||||
@@ -341,8 +353,8 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
onCancel={onOwnerModalCancel}
|
onCancel={onOwnerModalCancel}
|
||||||
/>
|
/>
|
||||||
<JobsFindModalContainer
|
<JobsFindModalContainer
|
||||||
loading={estData.loading}
|
loading={estDataRaw.loading}
|
||||||
error={estData.error}
|
error={estDataRaw.error}
|
||||||
selectedJob={selectedJob}
|
selectedJob={selectedJob}
|
||||||
setSelectedJob={setSelectedJob}
|
setSelectedJob={setSelectedJob}
|
||||||
importOptionsState={importOptionsState}
|
importOptionsState={importOptionsState}
|
||||||
@@ -368,4 +380,119 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
|
|||||||
</LoadingSpinner>
|
</LoadingSpinner>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(mapStateToProps, null)(JobsAvailableContainer);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(JobsAvailableContainer);
|
||||||
|
|
||||||
|
function replaceEmpty(someObj, replaceValue = null) {
|
||||||
|
const replacer = (key, value) =>
|
||||||
|
value === "" ? replaceValue || null : value;
|
||||||
|
//^ because you seem to want to replace (strings) "null" or "undefined" too
|
||||||
|
const temp = JSON.stringify(someObj, replacer);
|
||||||
|
console.log("Parsed", JSON.parse(temp));
|
||||||
|
return JSON.parse(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmDialog(msg) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
let confirmed = window.confirm(msg);
|
||||||
|
|
||||||
|
return confirmed ? resolve(true) : resolve(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function CheckTaxRates(estData, bodyshop) {
|
||||||
|
//LKQ Check
|
||||||
|
if (
|
||||||
|
!estData.est_data.parts_tax_rates?.PAL ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAL?.prt_tax_rt === null ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAL?.prt_tax_rt === 0
|
||||||
|
) {
|
||||||
|
const res = await confirmDialog(
|
||||||
|
`ImEX Online has detected that there is a missing tax rate for LKQ parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
|
||||||
|
);
|
||||||
|
if (res) {
|
||||||
|
if (!estData.est_data.parts_tax_rates.PAL) {
|
||||||
|
estData.est_data.parts_tax_rates.PAL = {
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: true,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_type: "PAL",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
estData.est_data.parts_tax_rates.PAL.prt_tax_rt =
|
||||||
|
bodyshop.bill_tax_rates.state_tax_rate / 100;
|
||||||
|
estData.est_data.parts_tax_rates.PAL.prt_tax_in = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//PAC Check
|
||||||
|
if (
|
||||||
|
!estData.est_data.parts_tax_rates?.PAC ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAC?.prt_tax_rt === null ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAC?.prt_tax_rt === 0
|
||||||
|
) {
|
||||||
|
const res = await confirmDialog(
|
||||||
|
`ImEX Online has detected that there is a missing tax rate for rechromed parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
|
||||||
|
);
|
||||||
|
if (res) {
|
||||||
|
if (!estData.est_data.parts_tax_rates.PAC) {
|
||||||
|
estData.est_data.parts_tax_rates.PAC = {
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: true,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_type: "PAC",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
estData.est_data.parts_tax_rates.PAC.prt_tax_rt =
|
||||||
|
bodyshop.bill_tax_rates.state_tax_rate / 100;
|
||||||
|
estData.est_data.parts_tax_rates.PAC.prt_tax_in = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//PAM Check
|
||||||
|
if (
|
||||||
|
!estData.est_data.parts_tax_rates?.PAM ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAM?.prt_tax_rt === null ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAM?.prt_tax_rt === 0
|
||||||
|
) {
|
||||||
|
const res = await confirmDialog(
|
||||||
|
`ImEX Online has detected that there is a missing tax rate for remanufactured parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
|
||||||
|
);
|
||||||
|
if (res) {
|
||||||
|
if (!estData.est_data.parts_tax_rates.PAM) {
|
||||||
|
estData.est_data.parts_tax_rates.PAM = {
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: true,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_type: "PAM",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
estData.est_data.parts_tax_rates.PAM.prt_tax_rt =
|
||||||
|
bodyshop.bill_tax_rates.state_tax_rate / 100;
|
||||||
|
estData.est_data.parts_tax_rates.PAM.prt_tax_in = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!estData.est_data.parts_tax_rates?.PAR ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAR?.prt_tax_rt === null ||
|
||||||
|
estData.est_data.parts_tax_rates?.PAR?.prt_tax_rt === 0
|
||||||
|
) {
|
||||||
|
const res = await confirmDialog(
|
||||||
|
`ImEX Online has detected that there is a missing tax rate for recored parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
|
||||||
|
);
|
||||||
|
if (res) {
|
||||||
|
if (!estData.est_data.parts_tax_rates.PAR) {
|
||||||
|
estData.est_data.parts_tax_rates.PAR = {
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: true,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_type: "PAR",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
estData.est_data.parts_tax_rates.PAR.prt_tax_rt =
|
||||||
|
bodyshop.bill_tax_rates.state_tax_rate / 100;
|
||||||
|
estData.est_data.parts_tax_rates.PAR.prt_tax_in = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,18 +6,21 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsChangeStatus({ job, bodyshop, jobRO }) {
|
export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [availableStatuses, setAvailableStatuses] = useState([]);
|
const [availableStatuses, setAvailableStatuses] = useState([]);
|
||||||
@@ -29,6 +32,10 @@ export function JobsChangeStatus({ job, bodyshop, jobRO }) {
|
|||||||
})
|
})
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
notification["success"]({ message: t("jobs.successes.save") });
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobstatuschange(status),
|
||||||
|
});
|
||||||
// refetch();
|
// refetch();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button } from "antd";
|
import { Button, Dropdown, Menu } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -12,11 +12,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
|
|
||||||
export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const handleAllocate = () => {
|
|
||||||
logImEXEvent("jobs_close_allocate_auto");
|
|
||||||
|
|
||||||
const { defaults } = bodyshop.md_responsibility_centers;
|
|
||||||
|
|
||||||
|
const handleAllocate = (defaults) => {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
joblines: joblines.map((jl) => {
|
joblines: joblines.map((jl) => {
|
||||||
const ret = _.cloneDeep(jl);
|
const ret = _.cloneDeep(jl);
|
||||||
@@ -32,7 +29,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
|||||||
}
|
}
|
||||||
//Verify that this is also manually updated in server/job-costing
|
//Verify that this is also manually updated in server/job-costing
|
||||||
if (!jl.part_type && !jl.mod_lbr_ty) {
|
if (!jl.part_type && !jl.mod_lbr_ty) {
|
||||||
const lineDesc = jl.line_desc.toLowerCase();
|
const lineDesc = jl.line_desc ? jl.line_desc.toLowerCase() : "";
|
||||||
if (lineDesc.includes("shop materials")) {
|
if (lineDesc.includes("shop materials")) {
|
||||||
ret.profitcenter_part = defaults.profits["MASH"];
|
ret.profitcenter_part = defaults.profits["MASH"];
|
||||||
} else if (lineDesc.includes("paint/materials")) {
|
} else if (lineDesc.includes("paint/materials")) {
|
||||||
@@ -48,8 +45,36 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
const handleAutoAllocateClick = () => {
|
||||||
<Button onClick={handleAllocate} disabled={disabled}>
|
logImEXEvent("jobs_close_allocate_auto");
|
||||||
|
|
||||||
|
const { defaults } = bodyshop.md_responsibility_centers;
|
||||||
|
handleAllocate(defaults);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMenuClick = ({ item, key, keyPath, domEvent }) => {
|
||||||
|
logImEXEvent("jobs_close_allocate_auto_dms");
|
||||||
|
handleAllocate(
|
||||||
|
bodyshop.md_responsibility_centers.dms_defaults.find(
|
||||||
|
(x) => x.name === key
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const overlay = bodyshop.cdk_dealerid && (
|
||||||
|
<Menu onClick={handleMenuClick}>
|
||||||
|
{bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => (
|
||||||
|
<Menu.Item key={mapping.name}>{mapping.name}</Menu.Item>
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
|
return bodyshop.cdk_dealerid ? (
|
||||||
|
<Dropdown overlay={overlay}>
|
||||||
|
<Button disabled={disabled}>{t("jobs.actions.dmsautoallocate")}</Button>
|
||||||
|
</Dropdown>
|
||||||
|
) : (
|
||||||
|
<Button onClick={handleAutoAllocateClick} disabled={disabled}>
|
||||||
{t("jobs.actions.autoallocate")}
|
{t("jobs.actions.autoallocate")}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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 { useHistory } from "react-router-dom";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -24,12 +25,19 @@ export function JobsCloseExportButton({
|
|||||||
currentUser,
|
currentUser,
|
||||||
jobId,
|
jobId,
|
||||||
disabled,
|
disabled,
|
||||||
|
setSelectedJobs,
|
||||||
}) {
|
}) {
|
||||||
|
const history = useHistory();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updateJob] = useMutation(UPDATE_JOB);
|
const [updateJob] = useMutation(UPDATE_JOB);
|
||||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleQbxml = async () => {
|
const handleQbxml = async () => {
|
||||||
|
if (bodyshop.cdk_dealerid) {
|
||||||
|
history.push(`/manage/dms?jobId=${jobId}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
logImEXEvent("jobs_close_export");
|
logImEXEvent("jobs_close_export");
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -147,18 +155,18 @@ export function JobsCloseExportButton({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (setSelectedJobs) {
|
||||||
|
setSelectedJobs((selectedJobs) => {
|
||||||
|
return selectedJobs.filter((i) => i !== jobId);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
|
||||||
onClick={handleQbxml}
|
|
||||||
loading={loading}
|
|
||||||
disabled={disabled}
|
|
||||||
type="dashed"
|
|
||||||
>
|
|
||||||
{t("jobs.actions.export")}
|
{t("jobs.actions.export")}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { CONVERT_JOB_TO_RO } from "../../graphql/jobs.queries";
|
import { CONVERT_JOB_TO_RO } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -22,10 +24,17 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) {
|
export function JobsConvertButton({
|
||||||
|
bodyshop,
|
||||||
|
job,
|
||||||
|
refetch,
|
||||||
|
jobRO,
|
||||||
|
insertAuditTrail,
|
||||||
|
}) {
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
|
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
|
||||||
@@ -43,6 +52,14 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) {
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("jobs.successes.converted"),
|
message: t("jobs.successes.converted"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobconverted(
|
||||||
|
res.data.update_jobs.returning[0].ro_number
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import FormItemPhone, {
|
|||||||
PhoneItemFormatterValidation,
|
PhoneItemFormatterValidation,
|
||||||
} from "../form-items-formatted/phone-form-item.component";
|
} from "../form-items-formatted/phone-form-item.component";
|
||||||
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
||||||
import { JobsDetailRatesParts } from "../jobs-detail-rates/jobs-detail-rates.parts.component";
|
import JobsDetailRatesParts from "../jobs-detail-rates/jobs-detail-rates.parts.component";
|
||||||
|
import JobsMarkPstExempt from "../jobs-mark-pst-exempt/jobs-mark-pst-exempt.component";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -187,7 +188,7 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
|||||||
header={t("menus.jobsdetail.financials")}
|
header={t("menus.jobsdetail.financials")}
|
||||||
>
|
>
|
||||||
<JobsDetailRatesChangeButton form={form} />
|
<JobsDetailRatesChangeButton form={form} />
|
||||||
|
<JobsMarkPstExempt form={form} />
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item label={t("jobs.fields.ded_amt")} name="ded_amt">
|
<Form.Item label={t("jobs.fields.ded_amt")} name="ded_amt">
|
||||||
<CurrencyInput />
|
<CurrencyInput />
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import { store } from "../../redux/store";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
export default function AddToProduction(
|
export default function AddToProduction(
|
||||||
apolloClient,
|
apolloClient,
|
||||||
@@ -21,6 +24,13 @@ export default function AddToProduction(
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: i18n.t("jobs.successes.save"),
|
message: i18n.t("jobs.successes.save"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobId,
|
||||||
|
operation: AuditTrailMapping.jobinproductionchange(!remove),
|
||||||
|
})
|
||||||
|
);
|
||||||
if (completionCallback) completionCallback();
|
if (completionCallback) completionCallback();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -142,7 +142,10 @@ export function JobsDetailHeaderActions({
|
|||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
key="entertimetickets"
|
key="entertimetickets"
|
||||||
disabled={!job.converted}
|
disabled={
|
||||||
|
!job.converted ||
|
||||||
|
(!bodyshop.tt_allow_post_to_invoiced && job.date_invoiced)
|
||||||
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
logImEXEvent("job_header_enter_time_ticekts");
|
logImEXEvent("job_header_enter_time_ticekts");
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import JobAltTransportChange from "../job-at-change/job-at-change.component";
|
|||||||
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
|
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
|
||||||
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
|
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
|
||||||
import "./jobs-detail-header.styles.scss";
|
import "./jobs-detail-header.styles.scss";
|
||||||
|
import JobsRelatedRos from "../jobs-related-ros/jobs-related-ros.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
@@ -80,6 +81,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
<span style={{ margin: "0rem .5rem" }}>/</span>
|
<span style={{ margin: "0rem .5rem" }}>/</span>
|
||||||
<CurrencyFormatter>{job.owner_owing}</CurrencyFormatter>
|
<CurrencyFormatter>{job.owner_owing}</CurrencyFormatter>
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
|
|
||||||
<DataLabel label={t("jobs.fields.alt_transport")}>
|
<DataLabel label={t("jobs.fields.alt_transport")}>
|
||||||
{job.alt_transport}
|
{job.alt_transport}
|
||||||
<JobAltTransportChange job={job} />
|
<JobAltTransportChange job={job} />
|
||||||
@@ -177,6 +179,9 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
<DataLabel key="4" label={t("vehicles.fields.v_vin")}>
|
<DataLabel key="4" label={t("vehicles.fields.v_vin")}>
|
||||||
{`${job.v_vin || t("general.labels.na")}`}
|
{`${job.v_vin || t("general.labels.na")}`}
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
|
<DataLabel label={t("jobs.labels.relatedros")}>
|
||||||
|
<JobsRelatedRos jobid={job.id} job={job} />
|
||||||
|
</DataLabel>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -1,20 +1,32 @@
|
|||||||
import { Form, Input, InputNumber, Select, Space, Switch, Tooltip } from "antd";
|
import {
|
||||||
|
Divider,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Select,
|
||||||
|
Space,
|
||||||
|
Switch,
|
||||||
|
Tooltip,
|
||||||
|
} from "antd";
|
||||||
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";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CABCpvrtCalculator from "../ca-bc-pvrt-calculator/ca-bc-pvrt-calculator.component";
|
import CABCpvrtCalculator from "../ca-bc-pvrt-calculator/ca-bc-pvrt-calculator.component";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
||||||
|
import JobsMarkPstExempt from "../jobs-mark-pst-exempt/jobs-mark-pst-exempt.component";
|
||||||
import FormRow from "../layout-form-row/layout-form-row.component";
|
import FormRow from "../layout-form-row/layout-form-row.component";
|
||||||
import JobsDetailRatesParts from "./jobs-detail-rates.parts.component";
|
import JobsDetailRatesParts from "./jobs-detail-rates.parts.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsDetailRates({ jobRO, form, job }) {
|
export function JobsDetailRates({ jobRO, form, job, bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -67,7 +79,7 @@ export function JobsDetailRates({ jobRO, form, job }) {
|
|||||||
label={t("jobs.fields.adjustment_bottom_line")}
|
label={t("jobs.fields.adjustment_bottom_line")}
|
||||||
name="adjustment_bottom_line"
|
name="adjustment_bottom_line"
|
||||||
>
|
>
|
||||||
<CurrencyInput disabled={jobRO} />
|
<CurrencyInput disabled={jobRO || bodyshop.cdk_dealerid} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Space align="end">
|
<Space align="end">
|
||||||
<Form.Item label={t("jobs.fields.ca_bc_pvrt")} name="ca_bc_pvrt">
|
<Form.Item label={t("jobs.fields.ca_bc_pvrt")} name="ca_bc_pvrt">
|
||||||
@@ -103,8 +115,19 @@ export function JobsDetailRates({ jobRO, form, job }) {
|
|||||||
<Switch disabled={jobRO} />
|
<Switch disabled={jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
<JobsDetailRatesChangeButton form={form} disabled={jobRO} />
|
<Divider
|
||||||
<FormRow header={t("jobs.forms.laborrates")}>
|
orientation="left"
|
||||||
|
type="horizontal"
|
||||||
|
style={{ marginTop: ".8rem", float: "right" }}
|
||||||
|
>
|
||||||
|
{t("jobs.forms.laborrates")}
|
||||||
|
</Divider>
|
||||||
|
<Space>
|
||||||
|
<div></div>
|
||||||
|
<JobsDetailRatesChangeButton form={form} disabled={jobRO} />
|
||||||
|
<JobsMarkPstExempt form={form} />
|
||||||
|
</Space>
|
||||||
|
<FormRow noDivider>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.labor_rate_desc")}
|
label={t("jobs.fields.labor_rate_desc")}
|
||||||
name="labor_rate_desc"
|
name="labor_rate_desc"
|
||||||
@@ -180,7 +203,6 @@ export function JobsDetailRates({ jobRO, form, job }) {
|
|||||||
<CurrencyInput disabled={jobRO} />
|
<CurrencyInput disabled={jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
<JobsDetailRatesParts form={form} />
|
<JobsDetailRatesParts form={form} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ export function JobsDetailRatesParts({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Collapse defaultActiveKey={expanded && "rates"}>
|
<Collapse defaultActiveKey={expanded && "rates"}>
|
||||||
<Collapse.Panel header={t("jobs.labels.parts_tax_rates")} key="rates">
|
<Collapse.Panel
|
||||||
|
forceRender
|
||||||
|
header={t("jobs.labels.parts_tax_rates")}
|
||||||
|
key="rates"
|
||||||
|
>
|
||||||
<LayoutFormRow header={t("joblines.fields.part_types.PAA")}>
|
<LayoutFormRow header={t("joblines.fields.part_types.PAA")}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.parts_tax_rates.prt_discp")}
|
label={t("jobs.fields.parts_tax_rates.prt_discp")}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import { Popconfirm, Button } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import _ from "lodash";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
jobRO: selectJobReadOnly,
|
||||||
|
});
|
||||||
|
|
||||||
|
export function JobsMarkPstExempt({ jobRO, form }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handleConfirm = () => {
|
||||||
|
const newPartRates = _.cloneDeep(form.getFieldValue("parts_tax_rates"));
|
||||||
|
|
||||||
|
Object.keys(newPartRates).forEach((key) => {
|
||||||
|
newPartRates[key] = {
|
||||||
|
...newPartRates[key],
|
||||||
|
prt_tax_in: false,
|
||||||
|
prt_tax_rt: 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
form.setFieldsValue({
|
||||||
|
state_tax_rate: 0,
|
||||||
|
tax_lbr_rt: 0,
|
||||||
|
tax_levies_rt: 0,
|
||||||
|
tax_sub_rt: 0,
|
||||||
|
tax_shop_mat_rt: 0,
|
||||||
|
tax_paint_mat_rt: 0,
|
||||||
|
tax_str_rt: 0,
|
||||||
|
tax_tow_rt: 0,
|
||||||
|
parts_tax_rates: newPartRates,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Popconfirm
|
||||||
|
onConfirm={handleConfirm}
|
||||||
|
disabled={jobRO}
|
||||||
|
okText={t("general.labels.yes")}
|
||||||
|
cancelText={t("general.labels.no")}
|
||||||
|
title={t("jobs.actions.markpstexemptconfirm")}
|
||||||
|
>
|
||||||
|
<Button type="link" disabled={jobRO}>
|
||||||
|
{t("jobs.actions.markpstexempt")}
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default connect(mapStateToProps, null)(JobsMarkPstExempt);
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Space, Tag } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
|
export default function JobsRelatedRos({ jobid, job }) {
|
||||||
|
if (!(job && job.vehicle && job.vehicle.jobs)) return null;
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
{job.vehicle.jobs
|
||||||
|
.filter((j) => j.id !== job.id)
|
||||||
|
.map((j) => (
|
||||||
|
<Tag key={j.id}>
|
||||||
|
<Link to={`/manage/jobs/${j?.id}`}>{`${j.ro_number || "N/A"}${
|
||||||
|
j.clm_no ? ` | ${j.clm_no}` : ""
|
||||||
|
}${j.status ? ` | ${j.status}` : ""}`}</Link>
|
||||||
|
</Tag>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ import { alphaSort } from "../../utils/sorters";
|
|||||||
import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component";
|
import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component";
|
||||||
import "./labor-allocations-table.styles.scss";
|
import "./labor-allocations-table.styles.scss";
|
||||||
import { CalculateAllocationsTotals } from "./labor-allocations-table.utility";
|
import { CalculateAllocationsTotals } from "./labor-allocations-table.utility";
|
||||||
|
import _ from "lodash";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
technician: selectTechnician,
|
technician: selectTechnician,
|
||||||
@@ -57,6 +57,7 @@ export function LaborAllocationsTable({
|
|||||||
sorter: (a, b) => alphaSort(a.cost_center, b.cost_center),
|
sorter: (a, b) => alphaSort(a.cost_center, b.cost_center),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "cost_center" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "cost_center" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => `${record.cost_center} (${record.mod_lbr_ty})`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.labels.hrs_total"),
|
title: t("jobs.labels.hrs_total"),
|
||||||
@@ -113,7 +114,7 @@ export function LaborAllocationsTable({
|
|||||||
color: record.difference >= 0 ? "green" : "red",
|
color: record.difference >= 0 ? "green" : "red",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{record.difference}
|
{_.round(record.difference, 1)}
|
||||||
</strong>
|
</strong>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export const CalculateAllocationsTotals = (
|
|||||||
const r = {
|
const r = {
|
||||||
opcode: value,
|
opcode: value,
|
||||||
cost_center: responsibilitycenters.defaults.costs[value],
|
cost_center: responsibilitycenters.defaults.costs[value],
|
||||||
|
mod_lbr_ty: value,
|
||||||
total: joblines.reduce((acc2, val2) => {
|
total: joblines.reduce((acc2, val2) => {
|
||||||
return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2;
|
return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2;
|
||||||
}, 0),
|
}, 0),
|
||||||
|
|||||||
@@ -31,11 +31,14 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
|||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.vehicle"),
|
||||||
dataIndex: "vehicleid",
|
dataIndex: "vehicleid",
|
||||||
key: "vehicleid",
|
key: "vehicleid",
|
||||||
render: (text, record) => (
|
render: (text, record) =>
|
||||||
<Link to={`/manage/vehicles/${record.vehicleid}`}>
|
record.vehicleid ? (
|
||||||
{`${record.v_model_yr} ${record.v_make_desc} ${record.v_model_desc}`}
|
<Link to={`/manage/vehicles/${record.vehicleid}`}>
|
||||||
</Link>
|
{`${record.v_model_yr} ${record.v_make_desc} ${record.v_model_desc}`}
|
||||||
),
|
</Link>
|
||||||
|
) : (
|
||||||
|
t("jobs.errors.novehicle")
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.clm_no"),
|
title: t("jobs.fields.clm_no"),
|
||||||
|
|||||||
@@ -90,7 +90,11 @@ export function PartsOrderListTableComponent({
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
disabled={jobRO || record.return}
|
disabled={
|
||||||
|
jobRO ||
|
||||||
|
record.return ||
|
||||||
|
record.vendor.id === bodyshop.inhousevendorid
|
||||||
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
logImEXEvent("parts_order_receive_bill");
|
logImEXEvent("parts_order_receive_bill");
|
||||||
setPartsReceiveContext({
|
setPartsReceiveContext({
|
||||||
@@ -139,7 +143,10 @@ export function PartsOrderListTableComponent({
|
|||||||
</Button>
|
</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
<Button
|
<Button
|
||||||
disabled={jobRO ? !record.return : jobRO}
|
disabled={
|
||||||
|
(jobRO ? !record.return : jobRO) ||
|
||||||
|
record.vendor.id === bodyshop.inhousevendorid
|
||||||
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
logImEXEvent("parts_order_receive_bill");
|
logImEXEvent("parts_order_receive_bill");
|
||||||
|
|
||||||
@@ -157,7 +164,7 @@ export function PartsOrderListTableComponent({
|
|||||||
quantity: pol.quantity,
|
quantity: pol.quantity,
|
||||||
|
|
||||||
actual_price: pol.act_price,
|
actual_price: pol.act_price,
|
||||||
cost_center: pol.jobline.part_type
|
cost_center: pol.jobline?.part_type
|
||||||
? responsibilityCenters.defaults.costs[
|
? responsibilityCenters.defaults.costs[
|
||||||
pol.jobline.part_type
|
pol.jobline.part_type
|
||||||
] || null
|
] || null
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ export default function PartsOrderModalComponent({
|
|||||||
label={t("parts_orders.fields.quantity")}
|
label={t("parts_orders.fields.quantity")}
|
||||||
key={`${index}quantity`}
|
key={`${index}quantity`}
|
||||||
name={[field.name, "quantity"]}
|
name={[field.name, "quantity"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
|||||||
import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries";
|
import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries";
|
||||||
import { INSERT_NEW_PARTS_ORDERS } from "../../graphql/parts-orders.queries";
|
import { INSERT_NEW_PARTS_ORDERS } from "../../graphql/parts-orders.queries";
|
||||||
import { QUERY_ALL_VENDORS_FOR_ORDER } from "../../graphql/vendors.queries";
|
import { QUERY_ALL_VENDORS_FOR_ORDER } from "../../graphql/vendors.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||||
import {
|
import {
|
||||||
setModalContext,
|
setModalContext,
|
||||||
@@ -19,6 +20,7 @@ import {
|
|||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
@@ -36,6 +38,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")),
|
||||||
setBillEnterContext: (context) =>
|
setBillEnterContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function PartsOrderModalContainer({
|
export function PartsOrderModalContainer({
|
||||||
@@ -45,6 +49,7 @@ export function PartsOrderModalContainer({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
setEmailOptions,
|
setEmailOptions,
|
||||||
setBillEnterContext,
|
setBillEnterContext,
|
||||||
|
insertAuditTrail,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -101,12 +106,26 @@ export function PartsOrderModalContainer({
|
|||||||
|
|
||||||
const jobLinesResult = await updateJobLines({
|
const jobLinesResult = await updateJobLines({
|
||||||
variables: {
|
variables: {
|
||||||
ids: values.parts_order_lines.data.map((item) => item.job_line_id),
|
ids: values.parts_order_lines.data
|
||||||
|
.filter((item) => item.job_line_id)
|
||||||
|
.map((item) => item.job_line_id),
|
||||||
status: isReturn
|
status: isReturn
|
||||||
? bodyshop.md_order_statuses.default_returned || "Returned*"
|
? bodyshop.md_order_statuses.default_returned || "Returned*"
|
||||||
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobId,
|
||||||
|
operation: isReturn
|
||||||
|
? AuditTrailMapping.jobspartsreturn(
|
||||||
|
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||||
|
)
|
||||||
|
: AuditTrailMapping.jobspartsorder(
|
||||||
|
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
if (!!jobLinesResult.errors) {
|
if (!!jobLinesResult.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("parts_orders.errors.creating"),
|
message: t("parts_orders.errors.creating"),
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export function PayableExportButton({
|
|||||||
billId,
|
billId,
|
||||||
disabled,
|
disabled,
|
||||||
loadingCallback,
|
loadingCallback,
|
||||||
|
setSelectedBills,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updateBill] = useMutation(UPDATE_BILLS);
|
const [updateBill] = useMutation(UPDATE_BILLS);
|
||||||
@@ -142,6 +143,11 @@ export function PayableExportButton({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (setSelectedBills) {
|
||||||
|
setSelectedBills((selectedBills) => {
|
||||||
|
return selectedBills.filter((i) => i !== billId);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!loadingCallback) loadingCallback(false);
|
if (!!loadingCallback) loadingCallback(false);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function PaymentExportButton({
|
|||||||
paymentId,
|
paymentId,
|
||||||
disabled,
|
disabled,
|
||||||
loadingCallback,
|
loadingCallback,
|
||||||
|
setSelectedPayments,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updatePayment] = useMutation(UPDATE_PAYMENTS);
|
const [updatePayment] = useMutation(UPDATE_PAYMENTS);
|
||||||
@@ -141,6 +142,12 @@ export function PaymentExportButton({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setSelectedPayments) {
|
||||||
|
setSelectedPayments((selectedBills) => {
|
||||||
|
return selectedBills.filter((i) => i !== paymentId);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!loadingCallback) loadingCallback(false);
|
if (!!loadingCallback) loadingCallback(false);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import React, { 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";
|
||||||
import { auth } from "../../firebase/firebase.utils";
|
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
import { UPDATE_PAYMENTS } from "../../graphql/payments.queries";
|
import { UPDATE_PAYMENTS } from "../../graphql/payments.queries";
|
||||||
import {
|
import {
|
||||||
@@ -37,15 +36,9 @@ export function PaymentsExportAllButton({
|
|||||||
|
|
||||||
let QbXmlResponse;
|
let QbXmlResponse;
|
||||||
try {
|
try {
|
||||||
QbXmlResponse = await axios.post(
|
QbXmlResponse = await axios.post("/accounting/qbxml/payments", {
|
||||||
"/accounting/qbxml/payments",
|
payments: paymentIds,
|
||||||
{ payments: paymentIds },
|
});
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error getting QBXML from Server.", error);
|
console.log("Error getting QBXML from Server.", error);
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
|
|||||||
@@ -14,12 +14,25 @@ import IndefiniteLoading from "../indefinite-loading/indefinite-loading.componen
|
|||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import ProductionBoardFilters from "../production-board-filters/production-board-filters.component";
|
import ProductionBoardFilters from "../production-board-filters/production-board-filters.component";
|
||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
technician: selectTechnician,
|
technician: selectTechnician,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ProductionBoardKanbanComponent({ data, bodyshop, technician }) {
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ProductionBoardKanbanComponent({
|
||||||
|
data,
|
||||||
|
bodyshop,
|
||||||
|
technician,
|
||||||
|
insertAuditTrail,
|
||||||
|
}) {
|
||||||
const [boardLanes, setBoardLanes] = useState({
|
const [boardLanes, setBoardLanes] = useState({
|
||||||
columns: [{ id: "Loading...", title: "Loading...", cards: [] }],
|
columns: [{ id: "Loading...", title: "Loading...", cards: [] }],
|
||||||
});
|
});
|
||||||
@@ -104,6 +117,11 @@ export function ProductionBoardKanbanComponent({ data, bodyshop, technician }) {
|
|||||||
newChildCardNewParent
|
newChildCardNewParent
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: card.id,
|
||||||
|
operation: AuditTrailMapping.jobstatuschange(destination.toColumnId),
|
||||||
|
});
|
||||||
|
|
||||||
if (update.errors) {
|
if (update.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("production.errors.boardupdate", {
|
message: t("production.errors.boardupdate", {
|
||||||
@@ -130,4 +148,7 @@ export function ProductionBoardKanbanComponent({ data, bodyshop, technician }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(mapStateToProps, null)(ProductionBoardKanbanComponent);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ProductionBoardKanbanComponent);
|
||||||
|
|||||||
@@ -16,24 +16,32 @@ import { connect } from "react-redux";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const iconStyle = { marginLeft: ".3rem" };
|
const iconStyle = { marginLeft: ".3rem" };
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ProductionListEmpAssignment({ bodyshop, record, type }) {
|
export function ProductionListEmpAssignment({
|
||||||
|
insertAuditTrail,
|
||||||
|
bodyshop,
|
||||||
|
record,
|
||||||
|
type,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updateJob] = useMutation(UPDATE_JOB);
|
const [updateJob] = useMutation(UPDATE_JOB);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleAdd = async (assignment) => {
|
const handleAdd = async (assignment) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { operation, employeeid } = assignment;
|
const { operation, employeeid, name } = assignment;
|
||||||
logImEXEvent("job_assign_employee", { operation });
|
logImEXEvent("job_assign_employee", { operation });
|
||||||
|
|
||||||
let empAssignment = determineFieldName(operation);
|
let empAssignment = determineFieldName(operation);
|
||||||
@@ -44,6 +52,11 @@ export function ProductionListEmpAssignment({ bodyshop, record, type }) {
|
|||||||
awaitRefetchQueries: true,
|
awaitRefetchQueries: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: record.id,
|
||||||
|
operation: AuditTrailMapping.jobassignmentchange(empAssignment, name),
|
||||||
|
});
|
||||||
|
|
||||||
if (!!result.errors) {
|
if (!!result.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.assigning", {
|
message: t("jobs.errors.assigning", {
|
||||||
@@ -64,6 +77,11 @@ export function ProductionListEmpAssignment({ bodyshop, record, type }) {
|
|||||||
awaitRefetchQueries: true,
|
awaitRefetchQueries: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: record.id,
|
||||||
|
operation: AuditTrailMapping.jobassignmentremoved(empAssignment),
|
||||||
|
});
|
||||||
|
|
||||||
if (!!result.errors) {
|
if (!!result.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.assigning", {
|
message: t("jobs.errors.assigning", {
|
||||||
@@ -80,8 +98,8 @@ export function ProductionListEmpAssignment({ bodyshop, record, type }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [visibility, setVisibility] = useState(false);
|
const [visibility, setVisibility] = useState(false);
|
||||||
const onChange = (e) => {
|
const onChange = (e, option) => {
|
||||||
setAssignment({ ...assignment, employeeid: e });
|
setAssignment({ ...assignment, employeeid: e, name: option.name });
|
||||||
};
|
};
|
||||||
|
|
||||||
const popContent = (
|
const popContent = (
|
||||||
@@ -99,7 +117,11 @@ export function ProductionListEmpAssignment({ bodyshop, record, type }) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{bodyshop.employees.map((emp) => (
|
{bodyshop.employees.map((emp) => (
|
||||||
<Select.Option value={emp.id} key={emp.id}>
|
<Select.Option
|
||||||
|
value={emp.id}
|
||||||
|
key={emp.id}
|
||||||
|
name={`${emp.first_name} ${emp.last_name}`}
|
||||||
|
>
|
||||||
{`${emp.first_name} ${emp.last_name}`}
|
{`${emp.first_name} ${emp.last_name}`}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -6,12 +6,21 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
export function ProductionListColumnStatus({ record, bodyshop }) {
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
export function ProductionListColumnStatus({
|
||||||
|
record,
|
||||||
|
bodyshop,
|
||||||
|
insertAuditTrail,
|
||||||
|
}) {
|
||||||
const [updateJob] = useMutation(UPDATE_JOB);
|
const [updateJob] = useMutation(UPDATE_JOB);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
@@ -28,6 +37,11 @@ export function ProductionListColumnStatus({ record, bodyshop }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: record.id,
|
||||||
|
operation: AuditTrailMapping.jobstatuschange(key),
|
||||||
|
});
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,4 +66,7 @@ export function ProductionListColumnStatus({ record, bodyshop }) {
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(mapStateToProps, null)(ProductionListColumnStatus);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ProductionListColumnStatus);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export function ProductionListTable({
|
|||||||
currentUser,
|
currentUser,
|
||||||
state,
|
state,
|
||||||
setColumns,
|
setColumns,
|
||||||
|
setState,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW);
|
const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW);
|
||||||
@@ -43,6 +44,10 @@ export function ProductionListTable({
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
setState(
|
||||||
|
bodyshop.production_config.filter((pc) => pc.name === value)[0].columns
|
||||||
|
.tableState
|
||||||
|
);
|
||||||
|
|
||||||
const assoc = bodyshop.associations.find(
|
const assoc = bodyshop.associations.find(
|
||||||
(a) => a.useremail === currentUser.email
|
(a) => a.useremail === currentUser.email
|
||||||
@@ -77,6 +82,8 @@ export function ProductionListTable({
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setState(bodyshop.production_config[0].columns.tableState);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ export function ProductionListTable({
|
|||||||
|
|
||||||
const [state, setState] = useState(
|
const [state, setState] = useState(
|
||||||
(bodyshop.production_config &&
|
(bodyshop.production_config &&
|
||||||
bodyshop.production_config.find((p) => p.name === defaultView)
|
bodyshop.production_config.find((p) => p.name === defaultView)?.columns
|
||||||
?.tableState) ||
|
.tableState) ||
|
||||||
bodyshop.production_config[0]?.tableState || {
|
bodyshop.production_config[0]?.columns.tableState || {
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
filteredInfo: { text: "" },
|
filteredInfo: { text: "" },
|
||||||
}
|
}
|
||||||
@@ -173,6 +173,7 @@ export function ProductionListTable({
|
|||||||
|
|
||||||
<ProductionListTableViewSelect
|
<ProductionListTableViewSelect
|
||||||
state={state}
|
state={state}
|
||||||
|
setState={setState}
|
||||||
setColumns={setColumns}
|
setColumns={setColumns}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { Button, Form, Input } from "antd";
|
import { Button, Form, Input, notification } from "antd";
|
||||||
|
import { LockOutlined } from "@ant-design/icons";
|
||||||
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";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { updateUserDetails } from "../../redux/user/user.actions";
|
import { updateUserDetails } from "../../redux/user/user.actions";
|
||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import {
|
||||||
|
logImEXEvent,
|
||||||
|
updateCurrentPassword,
|
||||||
|
} from "../../firebase/firebase.utils";
|
||||||
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -28,33 +33,96 @@ export default connect(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleChangePassword = async ({ password }) => {
|
||||||
|
logImEXEvent("password_update");
|
||||||
|
try {
|
||||||
|
await updateCurrentPassword(password);
|
||||||
|
notification.success({
|
||||||
|
message: t("user.successess.passwordchanged"),
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
notification.error({
|
||||||
|
message: error.message,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form
|
<Form
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
autoComplete={"no"}
|
autoComplete={"no"}
|
||||||
initialValues={currentUser}
|
initialValues={currentUser}
|
||||||
|
layout="vertical"
|
||||||
>
|
>
|
||||||
<Form.Item
|
<LayoutFormRow>
|
||||||
label={t("user.fields.displayname")}
|
<Form.Item
|
||||||
rules={[
|
label={t("user.fields.displayname")}
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
//message: t("general.validation.required"),
|
required: true,
|
||||||
},
|
//message: t("general.validation.required"),
|
||||||
]}
|
},
|
||||||
name="displayName"
|
]}
|
||||||
>
|
name="displayName"
|
||||||
<Input />
|
>
|
||||||
</Form.Item>
|
<Input />
|
||||||
<Form.Item label={t("user.fields.photourl")} name="photoURL">
|
</Form.Item>
|
||||||
<Input />
|
<Form.Item label={t("user.fields.photourl")} name="photoURL">
|
||||||
</Form.Item>
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
|
|
||||||
<Button type="primary" key="submit" htmlType="submit">
|
<Button type="primary" key="submit" htmlType="submit">
|
||||||
{t("user.actions.updateprofile")}
|
{t("user.actions.updateprofile")}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
<Form
|
||||||
|
onFinish={handleChangePassword}
|
||||||
|
autoComplete={"no"}
|
||||||
|
initialValues={currentUser}
|
||||||
|
layout="vertical"
|
||||||
|
>
|
||||||
|
<LayoutFormRow>
|
||||||
|
<Form.Item label={t("general.labels.newpassword")} name="password">
|
||||||
|
<Input
|
||||||
|
prefix={<LockOutlined />}
|
||||||
|
type="password"
|
||||||
|
placeholder={t("general.labels.password")}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("general.labels.confirmpassword")}
|
||||||
|
name="password-confirm"
|
||||||
|
dependencies={["password"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
({ getFieldValue }) => ({
|
||||||
|
validator(rule, value) {
|
||||||
|
if (!value || getFieldValue("password") === value) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return Promise.reject(
|
||||||
|
t("general.labels.passwordsdonotmatch")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
prefix={<LockOutlined />}
|
||||||
|
type="password"
|
||||||
|
placeholder={t("general.labels.password")}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
|
<Button type="primary" key="submit" htmlType="submit">
|
||||||
|
{t("user.actions.changepassword")}
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { Button, Space } from "antd";
|
||||||
|
import Axios from "axios";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
//import QboImg from "./qbo_signin.png";
|
||||||
|
import queryString from "query-string";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { useCookies } from "react-cookie";
|
||||||
|
|
||||||
|
export default function QboAuthorizeComponent() {
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
const [, setCookie] = useCookies(["access_token", "refresh_token"]);
|
||||||
|
|
||||||
|
const handleQbSignIn = async () => {
|
||||||
|
const result = await Axios.post("/qbo/authorize");
|
||||||
|
console.log("pushing to history", result.data);
|
||||||
|
window.location.href = result.data;
|
||||||
|
};
|
||||||
|
const qs = queryString.parse(location.search);
|
||||||
|
|
||||||
|
const { error } = qs;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const { code, state, realmId } = qs;
|
||||||
|
const hasBeenCalledBack = code && realmId && state;
|
||||||
|
|
||||||
|
if (hasBeenCalledBack) {
|
||||||
|
setCookie("qbo_code", code, { path: "/" });
|
||||||
|
setCookie("qbo_state", state, { path: "/" });
|
||||||
|
|
||||||
|
let expires = new Date();
|
||||||
|
expires.setTime(expires.getTime() + 8726400 * 1000);
|
||||||
|
|
||||||
|
setCookie("qbo_realmId", realmId, {
|
||||||
|
path: "/",
|
||||||
|
expires,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [qs, location, setCookie]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Space wrap>
|
||||||
|
<Button onClick={handleQbSignIn}>
|
||||||
|
{/* <img
|
||||||
|
src={QboImg}
|
||||||
|
alt="Sign in with Intuit"
|
||||||
|
onClick={handleQbSignIn}
|
||||||
|
/> */}
|
||||||
|
auth
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={async () => {
|
||||||
|
const response = await Axios.get(`/qbo/refresh`, {
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Refresh Token
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={async () => {
|
||||||
|
const response = await Axios.post(`/qbo/receivables`, {
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
REC
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
{error && JSON.parse(decodeURIComponent(error)).error_description}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
BIN
client/src/components/qbo-authorize/qbo_signin.png
Normal file
BIN
client/src/components/qbo-authorize/qbo_signin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -52,8 +52,9 @@ const ret = {
|
|||||||
|
|
||||||
"shiftclock:view": 2,
|
"shiftclock:view": 2,
|
||||||
|
|
||||||
|
"shop:config": 4,
|
||||||
|
"shop:rbac": 5,
|
||||||
"shop:vendors": 2,
|
"shop:vendors": 2,
|
||||||
"shop:rbac": 1,
|
|
||||||
"shop:dashboard": 3,
|
"shop:dashboard": 3,
|
||||||
"shop:templates": 4,
|
"shop:templates": 4,
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useLazyQuery } from "@apollo/client";
|
import { useLazyQuery } from "@apollo/client";
|
||||||
import { Button, DatePicker, Form, Radio } from "antd";
|
import { Button, DatePicker, Form, Radio, Space } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -13,6 +13,7 @@ import { GenerateDocument } from "../../utils/RenderTemplate";
|
|||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component";
|
import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component";
|
||||||
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
||||||
|
import "./report-center-modal.styles.scss";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
reportCenterModal: selectReportCenter,
|
reportCenterModal: selectReportCenter,
|
||||||
@@ -60,8 +61,12 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
|||||||
{
|
{
|
||||||
name: values.key,
|
name: values.key,
|
||||||
variables: {
|
variables: {
|
||||||
...(start ? { start: moment(start).format("YYYY-MM-DD") } : {}),
|
...(start
|
||||||
...(end ? { end: moment(end).format("YYYY-MM-DD") } : {}),
|
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
||||||
|
: {}),
|
||||||
|
...(end
|
||||||
|
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
|
||||||
|
: {}),
|
||||||
...(id ? { id: id } : {}),
|
...(id ? { id: id } : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -86,6 +91,7 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
name="key"
|
name="key"
|
||||||
label={t("reportcenter.labels.key")}
|
label={t("reportcenter.labels.key")}
|
||||||
|
// className="radio-group-columns"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -93,12 +99,21 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Radio.Group style={{ columns: "3 auto" }}>
|
<Radio.Group>
|
||||||
{Object.keys(Templates).map((key) => (
|
<Space
|
||||||
<Radio key={key} value={key}>
|
direction="vertical"
|
||||||
{Templates[key].title}
|
wrap
|
||||||
</Radio>
|
size="small"
|
||||||
))}
|
style={{
|
||||||
|
maxHeight: "50vh",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{Object.keys(Templates).map((key) => (
|
||||||
|
<Radio key={key} value={key}>
|
||||||
|
{Templates[key].title}
|
||||||
|
</Radio>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item dependencies={["key"]}>
|
<Form.Item dependencies={["key"]}>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function ReportCenterModalContainer({
|
|||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
cancelButtonProps={{ style: { display: "none" } }}
|
cancelButtonProps={{ style: { display: "none" } }}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
width="60%"
|
width="80%"
|
||||||
>
|
>
|
||||||
<ReportCenterModalComponent />
|
<ReportCenterModalComponent />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.radio-group-columns {
|
||||||
|
.ant-radio-group {
|
||||||
|
// display: block;
|
||||||
|
}
|
||||||
|
.ant-radio-wrapper {
|
||||||
|
display: block;
|
||||||
|
span {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,14 @@
|
|||||||
import { Button, Card, Col, Form, Row, Select, Switch } from "antd";
|
import {
|
||||||
|
Button,
|
||||||
|
Col,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
Row,
|
||||||
|
Select,
|
||||||
|
Space,
|
||||||
|
Switch,
|
||||||
|
Typography,
|
||||||
|
} from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@@ -91,31 +101,34 @@ export function ScheduleJobModalComponent({
|
|||||||
<DateTimePicker onlyFuture />
|
<DateTimePicker onlyFuture />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<Card title={t("appointments.labels.smartscheduling")}>
|
|
||||||
|
<Typography.Title level={4}>
|
||||||
|
{t("appointments.labels.smartscheduling")}
|
||||||
|
</Typography.Title>
|
||||||
|
|
||||||
|
{
|
||||||
|
// smartOptions.length > 0 && (
|
||||||
|
// <div>{t("appointments.labels.suggesteddates")}</div>
|
||||||
|
// )
|
||||||
|
}
|
||||||
|
<Space wrap>
|
||||||
<Button onClick={handleSmartScheduling} loading={loading}>
|
<Button onClick={handleSmartScheduling} loading={loading}>
|
||||||
{t("appointments.actions.calculate")}
|
{t("appointments.actions.calculate")}
|
||||||
</Button>
|
</Button>
|
||||||
{smartOptions.length > 0 && (
|
{smartOptions.map((d, idx) => (
|
||||||
<div>{t("appointments.labels.suggesteddates")}</div>
|
<Button
|
||||||
)}
|
className="imex-flex-row__margin"
|
||||||
<div
|
key={idx}
|
||||||
className="imex-flex-row imex-flex-row__flex-space-around"
|
onClick={() => {
|
||||||
style={{ flexWrap: "wrap" }}
|
form.setFieldsValue({ start: new moment(d).add(8, "hours") });
|
||||||
>
|
handleDateBlur();
|
||||||
{smartOptions.map((d, idx) => (
|
}}
|
||||||
<Button
|
>
|
||||||
className="imex-flex-row__margin"
|
<DateFormatter>{d}</DateFormatter>
|
||||||
key={idx}
|
</Button>
|
||||||
onClick={() => {
|
))}
|
||||||
form.setFieldsValue({ start: new moment(d).add(8, "hours") });
|
</Space>
|
||||||
handleDateBlur();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<DateFormatter>{d}</DateFormatter>
|
|
||||||
</Button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
<LayoutFormRow grow>
|
<LayoutFormRow grow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="notifyCustomer"
|
name="notifyCustomer"
|
||||||
@@ -124,12 +137,9 @@ export function ScheduleJobModalComponent({
|
|||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item shouldUpdate>
|
|
||||||
{() => (
|
<Form.Item name="email" label={t("jobs.fields.ownr_ea")}>
|
||||||
<Form.Item name="email" label={t("jobs.fields.ownr_ea")}>
|
<EmailInput disabled={!form.getFieldValue("notifyCustomer")} />
|
||||||
<EmailInput disabled={!form.getFieldValue("notifyCustomer")} />
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow grow>
|
<LayoutFormRow grow>
|
||||||
@@ -158,6 +168,9 @@ export function ScheduleJobModalComponent({
|
|||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item name={"note"} label={t("appointments.fields.note")}>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
{t("appointments.labels.history")}
|
{t("appointments.labels.history")}
|
||||||
<ScheduleExistingAppointmentsList
|
<ScheduleExistingAppointmentsList
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ export function ScheduleJobModalContainer({
|
|||||||
start: moment(values.start),
|
start: moment(values.start),
|
||||||
end: moment(values.start).add(bodyshop.appt_length || 60, "minutes"),
|
end: moment(values.start).add(bodyshop.appt_length || 60, "minutes"),
|
||||||
color: values.color,
|
color: values.color,
|
||||||
|
note:values.note
|
||||||
},
|
},
|
||||||
jobId: jobId,
|
jobId: jobId,
|
||||||
altTransport: values.alt_transport,
|
altTransport: values.alt_transport,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
||||||
|
import _ from "lodash";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
@@ -52,17 +52,22 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
|
|||||||
|
|
||||||
const theValue = {
|
const theValue = {
|
||||||
date: moment(val).format("D dd"),
|
date: moment(val).format("D dd"),
|
||||||
paintHrs: dayhrs.painthrs,
|
paintHrs: _.round(dayhrs.painthrs, 1),
|
||||||
bodyHrs: dayhrs.bodyhrs,
|
bodyHrs: _.round(dayhrs.bodyhrs, 1),
|
||||||
accTargetHrs: Utils.AsOfDateTargetHours(
|
accTargetHrs: _.round(
|
||||||
bodyshop.scoreboard_target.dailyBodyTarget +
|
Utils.AsOfDateTargetHours(
|
||||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
bodyshop.scoreboard_target.dailyBodyTarget +
|
||||||
val
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
val
|
||||||
|
),
|
||||||
|
1
|
||||||
),
|
),
|
||||||
accHrs:
|
accHrs: _.round(
|
||||||
acc.length > 0
|
acc.length > 0
|
||||||
? acc[acc.length - 1].accHrs + dayhrs.painthrs + dayhrs.bodyhrs
|
? acc[acc.length - 1].accHrs + dayhrs.painthrs + dayhrs.bodyhrs
|
||||||
: dayhrs.painthrs + dayhrs.bodyhrs,
|
: dayhrs.painthrs + dayhrs.bodyhrs,
|
||||||
|
1
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
return [...acc, theValue];
|
return [...acc, theValue];
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { Button, Card, Dropdown, Form, notification } from "antd";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Button, Card, Dropdown, Form, InputNumber, notification } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { UPDATE_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
|
import { UPDATE_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
import InputNumberCalculator from "../form-input-number-calculator/form-input-number-calculator.component";
|
|
||||||
|
|
||||||
export default function ScoreboardEntryEdit({ entry }) {
|
export default function ScoreboardEntryEdit({ entry }) {
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
@@ -64,7 +63,7 @@ export default function ScoreboardEntryEdit({ entry }) {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumberCalculator precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("scoreboard.fields.painthrs")}
|
label={t("scoreboard.fields.painthrs")}
|
||||||
@@ -76,7 +75,7 @@ export default function ScoreboardEntryEdit({ entry }) {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumberCalculator precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Button type="primary" loading={loading} htmlType="submit">
|
<Button type="primary" loading={loading} htmlType="submit">
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { Button, Card, Tabs } from "antd";
|
import { Button, Card, Tabs } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import ShopInfoGeneral from "./shop-info.general.component";
|
import ShopInfoGeneral from "./shop-info.general.component";
|
||||||
import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component";
|
import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component";
|
||||||
import ShopInfoLaborRates from "./shop-info.laborrates.component";
|
import ShopInfoLaborRates from "./shop-info.laborrates.component";
|
||||||
@@ -11,7 +14,15 @@ import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
|||||||
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
|
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
|
||||||
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
|
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
|
||||||
|
|
||||||
export default function ShopInfoComponent({ form, saveLoading }) {
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoComponent);
|
||||||
|
|
||||||
|
export function ShopInfoComponent({ bodyshop, form, saveLoading }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
@@ -53,6 +64,7 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
<ShopInfoResponsibilityCenterComponent form={form} />
|
<ShopInfoResponsibilityCenterComponent form={form} />
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
|
|
||||||
<Tabs.TabPane key="checklists" tab={t("bodyshop.labels.checklists")}>
|
<Tabs.TabPane key="checklists" tab={t("bodyshop.labels.checklists")}>
|
||||||
<ShopInfoIntakeChecklistComponent form={form} />
|
<ShopInfoIntakeChecklistComponent form={form} />
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
|
|||||||
@@ -165,6 +165,20 @@ export default function ShopInfoGeneral({ form }) {
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.labels.printlater")}
|
||||||
|
valuePropName="checked"
|
||||||
|
name={["accountingconfig", "printlater"]}
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.labels.emaillater")}
|
||||||
|
valuePropName="checked"
|
||||||
|
name={["accountingconfig", "emaillater"]}
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.inhousevendorid")}
|
label={t("bodyshop.fields.inhousevendorid")}
|
||||||
name={"inhousevendorid"}
|
name={"inhousevendorid"}
|
||||||
@@ -436,6 +450,21 @@ export default function ShopInfoGeneral({ form }) {
|
|||||||
>
|
>
|
||||||
<CurrencyInput />
|
<CurrencyInput />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name={["attach_pdf_to_email"]}
|
||||||
|
label={t("bodyshop.fields.attach_pdf_to_email")}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={["tt_allow_post_to_invoiced"]}
|
||||||
|
label={t("bodyshop.fields.tt_allow_post_to_invoiced")}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow grow header={t("bodyshop.labels.messagingpresets")}>
|
<LayoutFormRow grow header={t("bodyshop.labels.messagingpresets")}>
|
||||||
<Form.List name={["md_messaging_presets"]}>
|
<Form.List name={["md_messaging_presets"]}>
|
||||||
|
|||||||
@@ -513,6 +513,18 @@ export default function ShopInfoRbacComponent({ form }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.shop.config")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "shop:config"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.shop.rbac")}
|
label={t("bodyshop.fields.rbac.shop.rbac")}
|
||||||
rules={[
|
rules={[
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,10 @@ export function TechClockInComponent({ form, bodyshop, technician }) {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<JobSearchSelect />
|
<JobSearchSelect
|
||||||
|
convertedOnly={!bodyshop.tt_allow_post_to_invoiced}
|
||||||
|
notExported={!bodyshop.tt_allow_post_to_invoiced}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Card, Space, Table } from "antd";
|
|
||||||
import { EditFilled } from "@ant-design/icons";
|
import { EditFilled } from "@ant-design/icons";
|
||||||
|
import { Card, Space, Table } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useMemo, useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import {
|
import {
|
||||||
selectAuthLevel,
|
selectAuthLevel,
|
||||||
@@ -16,8 +17,6 @@ import RbacWrapper, {
|
|||||||
HasRbacAccess,
|
HasRbacAccess,
|
||||||
} from "../rbac-wrapper/rbac-wrapper.component";
|
} from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
|
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
authLevel: selectAuthLevel,
|
authLevel: selectAuthLevel,
|
||||||
@@ -105,7 +104,8 @@ export function TimeTicketList({
|
|||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
|
sorter: (a, b) =>
|
||||||
|
alphaSort(a.job && a.job.ro_number, b.job && b.job.ro_number),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
@@ -267,8 +267,12 @@ export function TimeTicketList({
|
|||||||
<Table.Summary.Cell />
|
<Table.Summary.Cell />
|
||||||
<Table.Summary.Cell />
|
<Table.Summary.Cell />
|
||||||
<Table.Summary.Cell />
|
<Table.Summary.Cell />
|
||||||
<Table.Summary.Cell>{totals.productivehrs}</Table.Summary.Cell>
|
<Table.Summary.Cell>
|
||||||
<Table.Summary.Cell>{totals.actualhrs}</Table.Summary.Cell>
|
{totals.productivehrs.toFixed(1)}
|
||||||
|
</Table.Summary.Cell>
|
||||||
|
<Table.Summary.Cell>
|
||||||
|
{totals.actualhrs.toFixed(1)}
|
||||||
|
</Table.Summary.Cell>
|
||||||
<Table.Summary.Cell>
|
<Table.Summary.Cell>
|
||||||
{totals.actualhrs === 0 || !totals.actualhrs
|
{totals.actualhrs === 0 || !totals.actualhrs
|
||||||
? "∞"
|
? "∞"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
import { useQuery } from "@apollo/client";
|
||||||
import { Form, Input, InputNumber, Select } from "antd";
|
import { Form, Input, InputNumber, Select, Switch } from "antd";
|
||||||
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";
|
||||||
@@ -48,7 +48,9 @@ export function TimeTicketModalComponent({
|
|||||||
{emps &&
|
{emps &&
|
||||||
emps.rates.map((item) => (
|
emps.rates.map((item) => (
|
||||||
<Select.Option key={item.cost_center}>
|
<Select.Option key={item.cost_center}>
|
||||||
{item.cost_center}
|
{item.cost_center === "timetickets.labels.shift"
|
||||||
|
? t(item.cost_center)
|
||||||
|
: item.cost_center}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
@@ -82,7 +84,10 @@ export function TimeTicketModalComponent({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<JobSearchSelect convertedOnly notExported={false} />
|
<JobSearchSelect
|
||||||
|
convertedOnly={!bodyshop.tt_allow_post_to_invoiced}
|
||||||
|
notExported={!bodyshop.tt_allow_post_to_invoiced}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -108,7 +113,17 @@ export function TimeTicketModalComponent({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<EmployeeSearchSelect options={employeeAutoCompleteOptions} />
|
<EmployeeSearchSelect
|
||||||
|
options={employeeAutoCompleteOptions}
|
||||||
|
onSelect={(value) => {
|
||||||
|
console.log(value);
|
||||||
|
const emps =
|
||||||
|
employeeAutoCompleteOptions &&
|
||||||
|
employeeAutoCompleteOptions.filter((e) => e.id === value)[0];
|
||||||
|
console.log(emps);
|
||||||
|
form.setFieldsValue({ flat_rate: emps && emps.flat_rate });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
shouldUpdate={(prev, cur) => prev.employeeid !== cur.employeeid}
|
shouldUpdate={(prev, cur) => prev.employeeid !== cur.employeeid}
|
||||||
@@ -135,6 +150,14 @@ export function TimeTicketModalComponent({
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="flat_rate"
|
||||||
|
label={t("timetickets.fields.flat_rate")}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Link } from "react-router-dom";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import ImEXOnlineLogo from "../../assets/logo192.png";
|
import ImEXOnlineLogo from "../../assets/logo192.png";
|
||||||
import { auth } from "../../firebase/firebase.utils";
|
import { auth } from "../../firebase/firebase.utils";
|
||||||
|
import { checkActionCode } from "@firebase/auth";
|
||||||
import { validatePasswordResetStart } from "../../redux/user/user.actions";
|
import { validatePasswordResetStart } from "../../redux/user/user.actions";
|
||||||
import { selectPasswordReset } from "../../redux/user/user.selectors";
|
import { selectPasswordReset } from "../../redux/user/user.selectors";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
@@ -35,7 +36,7 @@ export function UserValidatePwReset({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function checkCodeValid() {
|
async function checkCodeValid() {
|
||||||
try {
|
try {
|
||||||
const codeValid = await auth.checkActionCode(oobCode);
|
const codeValid = await checkActionCode(auth, oobCode);
|
||||||
console.log("codeValid :>> ", codeValid);
|
console.log("codeValid :>> ", codeValid);
|
||||||
setCodeValid({ loading: false, ...codeValid });
|
setCodeValid({ loading: false, ...codeValid });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user