Compare commits
14 Commits
revert_tes
...
feature/ma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1afc81e7d | ||
|
|
6d5b8baadf | ||
|
|
07e36415e4 | ||
|
|
8dc480826b | ||
|
|
533a5b87ec | ||
|
|
7bd83557c1 | ||
|
|
ef290e79b1 | ||
|
|
713b3f4f6d | ||
|
|
8fd9614f69 | ||
|
|
6682a98770 | ||
|
|
be61850d18 | ||
|
|
f4208a2212 | ||
|
|
0b7278a2a8 | ||
|
|
bee078fe18 |
@@ -8,13 +8,13 @@ orbs:
|
|||||||
jobs:
|
jobs:
|
||||||
api-deploy:
|
api-deploy:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/node:18.18.2
|
- image: "cimg/base:stable"
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- eb/setup
|
- eb/setup
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
eb init imex-online-production-api -r ca-central-1 -p "Node.js 18 running on 64bit Amazon Linux 2"
|
eb init imex-online-production-api -r ca-central-1 -p "Node.js 16 running on 64bit Amazon Linux 2"
|
||||||
eb status --verbose
|
eb status --verbose
|
||||||
eb deploy
|
eb deploy
|
||||||
eb status
|
eb status
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -117,6 +117,4 @@ logs/oAuthClient-log.log
|
|||||||
|
|
||||||
.node-persist/**
|
.node-persist/**
|
||||||
|
|
||||||
/*.env.*
|
/*.env.*
|
||||||
.idea/*
|
|
||||||
.idea
|
|
||||||
13
README.MD
13
README.MD
@@ -1,3 +1,14 @@
|
|||||||
|
Yarn Dependency Management:
|
||||||
|
To force upgrades for some packages:
|
||||||
|
yarn upgrade-interactive --latest
|
||||||
|
|
||||||
|
To Start Hasura CLI:
|
||||||
|
npx hasura console
|
||||||
|
|
||||||
|
Migrating to Staging:
|
||||||
|
npx hasura migrate apply --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
|
||||||
|
npx hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret 'Test-ImEXOnlineBySnaptSoftware!'
|
||||||
|
|
||||||
NGROK TEsting:
|
NGROK TEsting:
|
||||||
./ngrok.exe http http://localhost:4000 -host-header="localhost:4000"
|
./ngrok.exe http http://localhost:4000 -host-header="localhost:4000"
|
||||||
|
|
||||||
@@ -10,4 +21,4 @@ hasura migrate apply --version "1620771761757" --skip-execution --endpoint https
|
|||||||
hasura migrate status --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
|
hasura migrate status --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
|
||||||
|
|
||||||
Generate the license file:
|
Generate the license file:
|
||||||
$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite
|
$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,6 @@ REACT_APP_CLOUDINARY_API_KEY=957865933348715
|
|||||||
REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250
|
REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250
|
||||||
REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4'
|
REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4'
|
||||||
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
|
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
|
||||||
REACT_APP_AXIOS_BASE_API_URL=http://localhost:4000
|
REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/
|
||||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
GENERATE_SOURCEMAP=false
|
|
||||||
REACT_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql
|
REACT_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql
|
||||||
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql
|
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql
|
||||||
REACT_APP_GA_CODE=231103507
|
REACT_APP_GA_CODE=231103507
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// craco.config.js
|
// craco.config.js
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const CracoLessPlugin = require("craco-less");
|
|
||||||
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
|
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -20,37 +19,6 @@ module.exports = {
|
|||||||
ignore: ["node_modules", "webpack.config.js"],
|
ignore: ["node_modules", "webpack.config.js"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
plugin: CracoLessPlugin,
|
|
||||||
options: {
|
|
||||||
lessLoaderOptions: {
|
|
||||||
lessOptions: {
|
|
||||||
modifyVars: {
|
|
||||||
...(process.env.NODE_ENV === "development"
|
|
||||||
? { "@primary-color": "#a51d1d" }
|
|
||||||
: {
|
|
||||||
//"@primary-color": "#1DA57A"
|
|
||||||
}),
|
|
||||||
// "@primary-color": " #1890ff", // primary color for all components
|
|
||||||
// "@link-color": "#1890ff", // link color
|
|
||||||
// "@success-color": "#52c41a", // success state color
|
|
||||||
// "@warning-color": "#faad14", // warning state color
|
|
||||||
// "@error-color": "#f5222d", // error state color
|
|
||||||
// "@font-size-base": "14px", // major text font size
|
|
||||||
// " @heading-color": "rgba(0, 0, 0, 0.85)", // heading text color
|
|
||||||
// "@text-color": "rgba(0, 0, 0, 0.65)", // major text color
|
|
||||||
// "@text-color-secondary": "rgba(0, 0, 0, 0.45)", // secondary text color
|
|
||||||
// "@disabled-color": "rgba(0, 0, 0, 0.25)", // disable state color
|
|
||||||
// "@border-radius-base": "2px", // major border radius
|
|
||||||
// "@border-color-base": "#d9d9d9", // major border color
|
|
||||||
// "@box-shadow-base":
|
|
||||||
// "0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08),0 9px 28px 8px rgba(0, 0, 0, 0.05); // major shadow for layers }",
|
|
||||||
},
|
|
||||||
javascriptEnabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
webpack: {
|
webpack: {
|
||||||
configure: (webpackConfig) => ({
|
configure: (webpackConfig) => ({
|
||||||
|
|||||||
24522
client/package-lock.json
generated
24522
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,73 +4,67 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"proxy": "http://localhost:4000",
|
"proxy": "http://localhost:4000",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.7.9",
|
"@ant-design/pro-layout": "^7.6.1",
|
||||||
|
"@apollo/client": "^3.6.9",
|
||||||
"@asseinfo/react-kanban": "^2.2.0",
|
"@asseinfo/react-kanban": "^2.2.0",
|
||||||
"@craco/craco": "^7.0.0",
|
"@craco/craco": "^7.0.0",
|
||||||
"@fingerprintjs/fingerprintjs": "^3.4.2",
|
|
||||||
"@jsreport/browser-client": "^3.1.0",
|
"@jsreport/browser-client": "^3.1.0",
|
||||||
"@sentry/react": "^7.40.0",
|
"@sentry/react": "^7.28.1",
|
||||||
"@sentry/tracing": "^7.40.0",
|
"@sentry/tracing": "^7.28.1",
|
||||||
"@splitsoftware/splitio-react": "^1.8.1",
|
"@splitsoftware/splitio-react": "^1.6.0",
|
||||||
"@tanem/react-nprogress": "^5.0.8",
|
"@tanem/react-nprogress": "^5.0.8",
|
||||||
"antd": "^4.24.8",
|
"antd": "5.1.5",
|
||||||
"apollo-link-logger": "^2.0.1",
|
"apollo-link-logger": "^2.0.0",
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.2.3",
|
||||||
"craco-less": "^2.0.0",
|
|
||||||
"dinero.js": "^1.9.1",
|
"dinero.js": "^1.9.1",
|
||||||
"dotenv": "^16.0.1",
|
|
||||||
"enquire-js": "^0.2.1",
|
"enquire-js": "^0.2.1",
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"exifr": "^7.1.3",
|
"exifr": "^7.1.3",
|
||||||
"firebase": "^9.17.1",
|
"firebase": "^9.9.1",
|
||||||
"graphql": "^16.6.0",
|
"graphql": "^16.5.0",
|
||||||
"i18next": "^22.4.10",
|
"i18next": "^22.4.6",
|
||||||
"i18next-browser-languagedetector": "^7.0.1",
|
"i18next-browser-languagedetector": "^7.0.1",
|
||||||
"jsoneditor": "^9.9.0",
|
|
||||||
"jsreport-browser-client-dist": "^1.3.0",
|
"jsreport-browser-client-dist": "^1.3.0",
|
||||||
"libphonenumber-js": "^1.10.21",
|
"libphonenumber-js": "^1.10.9",
|
||||||
"logrocket": "^3.0.1",
|
"logrocket": "^3.0.1",
|
||||||
"markerjs2": "^2.28.1",
|
"markerjs2": "^2.22.0",
|
||||||
"moment-business-days": "^1.2.0",
|
"moment-business-days": "^1.2.0",
|
||||||
"moment-timezone": "^0.5.41",
|
"moment-timezone": "^0.5.34",
|
||||||
"normalize-url": "^8.0.0",
|
"normalize-url": "^8.0.0",
|
||||||
"phone": "^3.1.35",
|
"phone": "^3.1.32",
|
||||||
"preval.macro": "^5.0.0",
|
"preval.macro": "^5.0.0",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"query-string": "^7.1.3",
|
"query-string": "^8.1.0",
|
||||||
"rc-queue-anim": "^2.0.0",
|
"rc-queue-anim": "^2.0.0",
|
||||||
"rc-scroll-anim": "^2.7.6",
|
"rc-scroll-anim": "^2.7.6",
|
||||||
"react": "^17.0.2",
|
"react": "^18.2.0",
|
||||||
"react-big-calendar": "^1.6.8",
|
"react-big-calendar": "^1.5.2",
|
||||||
"react-color": "^2.19.3",
|
"react-color": "^2.19.3",
|
||||||
"react-cookie": "^4.1.1",
|
"react-dom": "^18.2.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-drag-listview": "^2.0.0",
|
||||||
"react-drag-listview": "^0.2.1",
|
|
||||||
"react-grid-gallery": "^1.0.0",
|
"react-grid-gallery": "^1.0.0",
|
||||||
"react-grid-layout": "^1.3.4",
|
"react-grid-layout": "^1.3.4",
|
||||||
"react-i18next": "^12.2.0",
|
"react-i18next": "^12.1.1",
|
||||||
"react-icons": "^4.7.1",
|
"react-icons": "^4.7.1",
|
||||||
"react-image-lightbox": "^5.1.4",
|
"react-image-lightbox": "^5.1.4",
|
||||||
"react-intersection-observer": "^9.4.3",
|
"react-number-format": "^5.1.2",
|
||||||
"react-number-format": "^5.1.3",
|
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
"react-resizable": "^3.0.4",
|
"react-resizable": "^3.0.4",
|
||||||
"react-router-dom": "^5.3.0",
|
"react-router-dom": "^5.3.0",
|
||||||
"react-scripts": "^5.0.1",
|
"react-scripts": "^5.0.1",
|
||||||
"react-sticky": "^6.0.3",
|
"react-sticky": "^6.0.3",
|
||||||
"react-sublime-video": "^0.2.5",
|
|
||||||
"react-virtualized": "^9.22.3",
|
"react-virtualized": "^9.22.3",
|
||||||
"recharts": "^2.4.3",
|
"recharts": "^2.1.12",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.0",
|
||||||
"redux-persist": "^6.0.0",
|
"redux-persist": "^6.0.0",
|
||||||
"redux-saga": "^1.2.2",
|
"redux-saga": "^1.1.3",
|
||||||
"redux-state-sync": "^3.1.4",
|
"redux-state-sync": "^3.1.4",
|
||||||
"reselect": "^4.1.7",
|
"reselect": "^4.1.6",
|
||||||
"sass": "^1.58.3",
|
"sass": "^1.54.0",
|
||||||
"socket.io-client": "^4.6.1",
|
"socket.io-client": "^4.5.1",
|
||||||
"styled-components": "^5.3.6",
|
"styled-components": "^5.3.5",
|
||||||
"subscriptions-transport-ws": "^0.11.0",
|
"subscriptions-transport-ws": "^0.11.0",
|
||||||
"web-vitals": "^2.1.4",
|
"web-vitals": "^3.1.0",
|
||||||
"workbox-background-sync": "^6.5.3",
|
"workbox-background-sync": "^6.5.3",
|
||||||
"workbox-broadcast-update": "^6.5.3",
|
"workbox-broadcast-update": "^6.5.3",
|
||||||
"workbox-cacheable-response": "^6.5.3",
|
"workbox-cacheable-response": "^6.5.3",
|
||||||
@@ -82,15 +76,15 @@
|
|||||||
"workbox-range-requests": "^6.5.3",
|
"workbox-range-requests": "^6.5.3",
|
||||||
"workbox-routing": "^6.5.3",
|
"workbox-routing": "^6.5.3",
|
||||||
"workbox-strategies": "^6.5.3",
|
"workbox-strategies": "^6.5.3",
|
||||||
"workbox-streams": "^6.5.3",
|
"workbox-streams": "^6.5.3"
|
||||||
"yauzl": "^2.10.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
||||||
"start": "craco start",
|
"start": "craco start",
|
||||||
|
"startrs": "react-scripts 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",
|
||||||
"build:test": "env-cmd -f .env.test npm run build",
|
"build:test": "env-cmd -f .env.test yarn run build",
|
||||||
"build-deploy:test": "npm run build:test && s3cmd sync build/* s3://imex-online-test && echo '🚀 TESTING Deployed!'",
|
"build-deploy:test": "yarn run build:test && s3cmd sync build/* s3://imex-online-test && echo '🚀 TESTING Deployed!'",
|
||||||
"buildcra": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
|
"buildcra": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
|
||||||
"test": "cypress open",
|
"test": "cypress open",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
@@ -120,8 +114,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sentry/webpack-plugin": "^1.20.0",
|
"@sentry/webpack-plugin": "^1.20.0",
|
||||||
"@testing-library/cypress": "^8.0.3",
|
"@testing-library/cypress": "^9.0.0",
|
||||||
"cypress": "^10.3.1",
|
"cypress": "^12.3.0",
|
||||||
"eslint-plugin-cypress": "^2.12.1",
|
"eslint-plugin-cypress": "^2.12.1",
|
||||||
"react-error-overlay": "6.0.11",
|
"react-error-overlay": "6.0.11",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
|
|||||||
@@ -143,28 +143,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update row highlighting on production board.
|
|
||||||
|
//Update row highlighting on production board.
|
||||||
.ant-table-tbody > tr.ant-table-row:hover > td {
|
.ant-table-tbody > tr.ant-table-row:hover > td {
|
||||||
background: #e7f3ff !important;
|
background: #eaeaea !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-table-tbody > tr.ant-table-row-selected > td {
|
.job-line-manual{
|
||||||
background: #e6f7ff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.job-line-manual {
|
|
||||||
color: tomato;
|
color: tomato;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
td.ant-table-column-sort {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-tbody > tr.ant-table-row:nth-child(2n) > td {
|
|
||||||
background-color: #f4f4f4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rowWithColor > td {
|
|
||||||
background-color: var(--bgColor) !important;
|
|
||||||
}
|
|
||||||
|
|||||||
49
client/src/components/_test/paymentMethod.jsx
Normal file
49
client/src/components/_test/paymentMethod.jsx
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
||||||
|
});
|
||||||
|
|
||||||
|
function Test({ bodyshop, setEmailOptions }) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setEmailOptions({
|
||||||
|
messageOptions: {
|
||||||
|
to: ["patrickwf@gmail.com"],
|
||||||
|
replyTo: bodyshop.email,
|
||||||
|
},
|
||||||
|
template: {
|
||||||
|
name: TemplateList().parts_order.key,
|
||||||
|
variables: {
|
||||||
|
id: "a7c2d4e1-f519-42a9-a071-c48cf0f22979",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
send email
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
logImEXEvent("IMEXEVENT", { somethignArThare: 5 });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Log an ImEX Event.
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(Test);
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
{
|
|
||||||
"status": 24201299,
|
|
||||||
"custid": 19607899,
|
|
||||||
"paymentid": 24201299,
|
|
||||||
"response": "A",
|
|
||||||
"authcode": "498680",
|
|
||||||
"declinereason": "Approved",
|
|
||||||
"fee": 0,
|
|
||||||
"invoice": "",
|
|
||||||
"account": "john",
|
|
||||||
"amount": 1000,
|
|
||||||
"amountincludesfee": false,
|
|
||||||
"total": 1000,
|
|
||||||
"paymenttype": "C",
|
|
||||||
"methodhint": "VI ***1111",
|
|
||||||
"cardbrand": "Visa",
|
|
||||||
"cardnumdisplay": "***1111",
|
|
||||||
"receiptelements": {
|
|
||||||
"authcode": "498680",
|
|
||||||
"cust_srv_ph_num": "1-555-555-5555",
|
|
||||||
"rcpt_pg_ftr_txt": "Thank You\nPlease Come Again",
|
|
||||||
"rcpt_currency": "USD",
|
|
||||||
"responsecode": "A",
|
|
||||||
"rcpt_pay_mthd": "Visa",
|
|
||||||
"transid": "C00 915799",
|
|
||||||
"merch_disp_nm": "CP Devel Test",
|
|
||||||
"rcpt_input_mthd": "Keyed",
|
|
||||||
"rcpt_pg_hdr_txt": "Welcome!",
|
|
||||||
"rcpt_tran_time": "Thursday February 23 2023, 11:25:36 pm +08",
|
|
||||||
"rcpt_trans_type": "Normal Transaction (Sale)",
|
|
||||||
"message": "Approved",
|
|
||||||
"rcpt_dba_addr": "1234 Storefront Ave\nSome City, UT 84111",
|
|
||||||
"avsdata": "N",
|
|
||||||
"receiptrequirements": "S",
|
|
||||||
"rcpt_cardnum": "************1111",
|
|
||||||
"cv2result": "M",
|
|
||||||
"rfnd_policy_txt": "<b>No Refunds</b>\nStore Credit Only",
|
|
||||||
"labels": {
|
|
||||||
"tranref": "REF#",
|
|
||||||
"tid": "TID",
|
|
||||||
"validationcode": "ValCode",
|
|
||||||
"emvapplicationid": "AID",
|
|
||||||
"emvatc": "ATC",
|
|
||||||
"rcpt_pay_mthd": "Pay Method",
|
|
||||||
"transid": "TransID",
|
|
||||||
"rcpt_input_mthd": "IMode",
|
|
||||||
"emvtsi": "TSI",
|
|
||||||
"emvac": "AC",
|
|
||||||
"rcpt_trans_type": "TranType",
|
|
||||||
"emvapplicationname": "PApp",
|
|
||||||
"visarewards": "RewardsProg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"receipttoken": "H4sIAAAAAAAAACXMTQuCMBgA4P/ynh3tw_3dBI/ipQ8NOtRN53QiblpBRfTfCzo/8LwhxGAdZCCwFYoJJFQjI2kvHdGu74lVkgmrWyWNhASW5jW7cB87yHjKKePGJODnxrrnMl7dDTKmEJlSOqV/_N30XPpyj2Eddq57_KKZ8FLzmh_G1VQnVfhjiXGK1XYTc/h8AVOkf4qUAAAA",
|
|
||||||
"call": "card_payment",
|
|
||||||
"nonce": "488b5568-b5c1-4f38-8b2f-3b050f3abb11P",
|
|
||||||
"hmac": "JyPAJ9Yx0SlYBTtqns1OxAFRt+xF3l2UiLPO5zTDRBE=",
|
|
||||||
"paymentreferenceid": "C19607899P24201299",
|
|
||||||
"cardnum": "...1111",
|
|
||||||
"email": "",
|
|
||||||
"nameOnCard": "John Allen",
|
|
||||||
"cardType": "visa"
|
|
||||||
}
|
|
||||||
9
client/src/components/_test/test.component.jsx
Normal file
9
client/src/components/_test/test.component.jsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import React from "react";
|
||||||
|
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
||||||
|
export default function Test() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<QboAuthorizeComponent />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import { Button } from "antd";
|
|
||||||
import React from "react";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({});
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
|
||||||
setRefundPaymentContext: (context) =>
|
|
||||||
dispatch(setModalContext({ context: context, modal: "refund_payment" })),
|
|
||||||
});
|
|
||||||
|
|
||||||
function Test({ setRefundPaymentContext, refundPaymentModal }) {
|
|
||||||
console.log("refundPaymentModal", refundPaymentModal);
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
onClick={() =>
|
|
||||||
setRefundPaymentContext({
|
|
||||||
context: {},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Open Modal
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Test);
|
|
||||||
@@ -61,7 +61,7 @@ export function AllocationsAssignmentComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover content={popContent} visible={visibility}>
|
<Popover content={popContent} open={visibility}>
|
||||||
<Button onClick={() => setVisibility(true)}>
|
<Button onClick={() => setVisibility(true)}>
|
||||||
{t("allocations.actions.assign")}
|
{t("allocations.actions.assign")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default connect(
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover content={popContent} visible={visibility}>
|
<Popover content={popContent} open={visibility}>
|
||||||
<Button disabled={disabled} onClick={() => setVisibility(true)}>
|
<Button disabled={disabled} onClick={() => setVisibility(true)}>
|
||||||
{t("allocations.actions.assign")}
|
{t("allocations.actions.assign")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { DELETE_BILL } from "../../graphql/bills.queries";
|
import { DELETE_BILL } from "../../graphql/bills.queries";
|
||||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
|
|
||||||
export default function BillDeleteButton({ bill, callback }) {
|
export default function BillDeleteButton({ bill }) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [deleteBill] = useMutation(DELETE_BILL);
|
const [deleteBill] = useMutation(DELETE_BILL);
|
||||||
@@ -36,8 +36,6 @@ export default function BillDeleteButton({ bill, callback }) {
|
|||||||
|
|
||||||
if (!!!result.errors) {
|
if (!!!result.errors) {
|
||||||
notification["success"]({ message: t("bills.successes.deleted") });
|
notification["success"]({ message: t("bills.successes.deleted") });
|
||||||
|
|
||||||
if (callback && typeof callback === "function") callback(bill.id);
|
|
||||||
} else {
|
} else {
|
||||||
//Check if it's an fkey violation.
|
//Check if it's an fkey violation.
|
||||||
const error = JSON.stringify(result.errors);
|
const error = JSON.stringify(result.errors);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useMutation, useQuery } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import { Button, Form, PageHeader, Popconfirm, Space } from "antd";
|
import { PageHeader } from '@ant-design/pro-layout';
|
||||||
|
import { Button, Form, Popconfirm, Space } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@@ -178,7 +179,7 @@ export function BillDetailEditcontainer({
|
|||||||
<BillDetailEditReturn data={data} />
|
<BillDetailEditReturn data={data} />
|
||||||
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
visible={visible}
|
open={visible}
|
||||||
onConfirm={() => form.submit()}
|
onConfirm={() => form.submit()}
|
||||||
onCancel={() => setVisible(false)}
|
onCancel={() => setVisible(false)}
|
||||||
okButtonProps={{ loading: updateLoading }}
|
okButtonProps={{ loading: updateLoading }}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export function BillDetailEditReturn({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
open={visible}
|
||||||
onCancel={() => setVisible(false)}
|
onCancel={() => setVisible(false)}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
title={t("bills.actions.return")}
|
title={t("bills.actions.return")}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default function BillDetailEditcontainer() {
|
|||||||
history.push({ search: queryString.stringify(search) });
|
history.push({ search: queryString.stringify(search) });
|
||||||
}}
|
}}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
visible={search.billid}
|
open={search.billid}
|
||||||
>
|
>
|
||||||
<BillDetailEditComponent />
|
<BillDetailEditComponent />
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import { useApolloClient, useMutation } from "@apollo/client";
|
import { useApolloClient, useMutation } from "@apollo/client";
|
||||||
import { Button, Checkbox, Form, Modal, Space, notification } from "antd";
|
import { Button, Checkbox, Form, Modal, notification, Space } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useEffect, useState, useMemo } 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 { INSERT_NEW_BILL } from "../../graphql/bills.queries";
|
import { INSERT_NEW_BILL } from "../../graphql/bills.queries";
|
||||||
import { UPDATE_INVENTORY_LINES } from "../../graphql/inventory.queries";
|
|
||||||
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
|
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
|
||||||
import {
|
import {
|
||||||
QUERY_JOB_LBR_ADJUSTMENTS,
|
QUERY_JOB_LBR_ADJUSTMENTS,
|
||||||
UPDATE_JOB,
|
UPDATE_JOB,
|
||||||
} from "../../graphql/jobs.queries";
|
} from "../../graphql/jobs.queries";
|
||||||
import { MUTATION_MARK_RETURN_RECEIVED } from "../../graphql/parts-orders.queries";
|
import { MUTATION_MARK_RETURN_RECEIVED } from "../../graphql/parts-orders.queries";
|
||||||
|
import { UPDATE_INVENTORY_LINES } from "../../graphql/inventory.queries";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
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";
|
||||||
@@ -20,15 +20,15 @@ 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 { TemplateList } from "../../utils/TemplateConstants";
|
|
||||||
import confirmDialog from "../../utils/asyncConfirm";
|
import confirmDialog from "../../utils/asyncConfirm";
|
||||||
import useLocalStorage from "../../utils/useLocalStorage";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import BillFormContainer from "../bill-form/bill-form.container";
|
import BillFormContainer from "../bill-form/bill-form.container";
|
||||||
import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
|
import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
|
||||||
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
|
|
||||||
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
||||||
|
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
|
||||||
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
billEnterModal: selectBillEnterModal,
|
billEnterModal: selectBillEnterModal,
|
||||||
@@ -37,8 +37,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
|
||||||
insertAuditTrail: ({ jobid, billid, operation }) =>
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, billid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
const Templates = TemplateList("job_special");
|
const Templates = TemplateList("job_special");
|
||||||
@@ -126,24 +126,13 @@ function BillEnterModalContainer({
|
|||||||
deductedfromlbr: deductedfromlbr,
|
deductedfromlbr: deductedfromlbr,
|
||||||
lbr_adjustment,
|
lbr_adjustment,
|
||||||
joblineid: i.joblineid === "noline" ? null : i.joblineid,
|
joblineid: i.joblineid === "noline" ? null : i.joblineid,
|
||||||
applicable_taxes: {
|
|
||||||
federal:
|
|
||||||
(i.applicable_taxes && i.applicable_taxes.federal) ||
|
|
||||||
false,
|
|
||||||
state:
|
|
||||||
(i.applicable_taxes && i.applicable_taxes.state) ||
|
|
||||||
false,
|
|
||||||
local:
|
|
||||||
(i.applicable_taxes && i.applicable_taxes.local) ||
|
|
||||||
false,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID", "GET_JOB_BY_PK"],
|
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const adjKeys = Object.keys(adjustmentsToInsert);
|
const adjKeys = Object.keys(adjustmentsToInsert);
|
||||||
@@ -316,9 +305,7 @@ function BillEnterModalContainer({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: values.jobid,
|
jobid: values.jobid,
|
||||||
billid: billId,
|
billid: billId,
|
||||||
operation: AuditTrailMapping.billposted(
|
operation: AuditTrailMapping.billposted(remainingValues.invoice_number),
|
||||||
r1.data.insert_bills.returning[0].invoice_number
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (enterAgain) {
|
if (enterAgain) {
|
||||||
@@ -357,7 +344,7 @@ function BillEnterModalContainer({
|
|||||||
<Modal
|
<Modal
|
||||||
title={t("bills.labels.new")}
|
title={t("bills.labels.new")}
|
||||||
width={"98%"}
|
width={"98%"}
|
||||||
visible={billEnterModal.visible}
|
open={billEnterModal.visible}
|
||||||
okText={t("general.actions.save")}
|
okText={t("general.actions.save")}
|
||||||
keyboard="false"
|
keyboard="false"
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Icon, { UploadOutlined } from "@ant-design/icons";
|
import Icon, { UploadOutlined } from "@ant-design/icons";
|
||||||
import { useApolloClient } from "@apollo/client";
|
import { useApolloClient } from "@apollo/client";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { MdOpenInNew } from "react-icons/md";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
Divider,
|
Divider,
|
||||||
@@ -12,17 +12,14 @@ import {
|
|||||||
Switch,
|
Switch,
|
||||||
Upload,
|
Upload,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import moment from "moment";
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { MdOpenInNew } from "react-icons/md";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { CHECK_BILL_INVOICE_NUMBER } from "../../graphql/bills.queries";
|
import { CHECK_BILL_INVOICE_NUMBER } from "../../graphql/bills.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import BillFormLinesExtended from "../bill-form-lines-extended/bill-form-lines-extended.component";
|
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
@@ -31,6 +28,8 @@ import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
|||||||
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
||||||
import BillFormLines from "./bill-form.lines.component";
|
import BillFormLines from "./bill-form.lines.component";
|
||||||
import { CalculateBillTotal } from "./bill-form.totals.utility";
|
import { CalculateBillTotal } from "./bill-form.totals.utility";
|
||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
import BillFormLinesExtended from "../bill-form-lines-extended/bill-form-lines-extended.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -50,7 +49,6 @@ export function BillFormComponent({
|
|||||||
job,
|
job,
|
||||||
loadOutstandingReturns,
|
loadOutstandingReturns,
|
||||||
loadInventory,
|
loadInventory,
|
||||||
preferredMake,
|
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
@@ -60,11 +58,6 @@ export function BillFormComponent({
|
|||||||
{},
|
{},
|
||||||
bodyshop.imexshopid
|
bodyshop.imexshopid
|
||||||
);
|
);
|
||||||
const { ClosingPeriod } = useTreatments(
|
|
||||||
["ClosingPeriod"],
|
|
||||||
{},
|
|
||||||
bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleVendorSelect = (props, opt) => {
|
const handleVendorSelect = (props, opt) => {
|
||||||
setDiscount(opt.discount);
|
setDiscount(opt.discount);
|
||||||
@@ -186,7 +179,6 @@ export function BillFormComponent({
|
|||||||
<VendorSearchSelect
|
<VendorSearchSelect
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
options={vendorAutoCompleteOptions}
|
options={vendorAutoCompleteOptions}
|
||||||
preferredMake={preferredMake}
|
|
||||||
onSelect={handleVendorSelect}
|
onSelect={handleVendorSelect}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -267,37 +259,6 @@ export function BillFormComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
|
||||||
validator(rule, value) {
|
|
||||||
if (
|
|
||||||
ClosingPeriod.treatment === "on" &&
|
|
||||||
bodyshop.accountingconfig.ClosingPeriod
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
moment(value)
|
|
||||||
.startOf("day")
|
|
||||||
.isSameOrAfter(
|
|
||||||
moment(
|
|
||||||
bodyshop.accountingconfig.ClosingPeriod[0]
|
|
||||||
).startOf("day")
|
|
||||||
) &&
|
|
||||||
moment(value)
|
|
||||||
.startOf("day")
|
|
||||||
.isSameOrBefore(
|
|
||||||
moment(
|
|
||||||
bodyshop.accountingconfig.ClosingPeriod[1]
|
|
||||||
).endOf("day")
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return Promise.resolve();
|
|
||||||
} else {
|
|
||||||
return Promise.reject(t("bills.validation.closingperiod"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<FormDatePicker disabled={disabled} />
|
<FormDatePicker disabled={disabled} />
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { useLazyQuery, useQuery } from "@apollo/client";
|
import { useLazyQuery, useQuery } from "@apollo/client";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { QUERY_OUTSTANDING_INVENTORY } from "../../graphql/inventory.queries";
|
|
||||||
import { GET_JOB_LINES_TO_ENTER_BILL } from "../../graphql/jobs-lines.queries";
|
import { GET_JOB_LINES_TO_ENTER_BILL } from "../../graphql/jobs-lines.queries";
|
||||||
import { QUERY_UNRECEIVED_LINES } from "../../graphql/parts-orders.queries";
|
|
||||||
import { SEARCH_VENDOR_AUTOCOMPLETE } from "../../graphql/vendors.queries";
|
import { SEARCH_VENDOR_AUTOCOMPLETE } from "../../graphql/vendors.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import BillCmdReturnsTableComponent from "../bill-cm-returns-table/bill-cm-returns-table.component";
|
|
||||||
import BillInventoryTable from "../bill-inventory-table/bill-inventory-table.component";
|
|
||||||
import BillFormComponent from "./bill-form.component";
|
import BillFormComponent from "./bill-form.component";
|
||||||
|
import BillCmdReturnsTableComponent from "../bill-cm-returns-table/bill-cm-returns-table.component";
|
||||||
|
import { QUERY_UNRECEIVED_LINES } from "../../graphql/parts-orders.queries";
|
||||||
|
import BillInventoryTable from "../bill-inventory-table/bill-inventory-table.component";
|
||||||
|
import { QUERY_OUTSTANDING_INVENTORY } from "../../graphql/inventory.queries";
|
||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -59,7 +59,6 @@ export function BillFormContainer({
|
|||||||
disableInvNumber={disableInvNumber}
|
disableInvNumber={disableInvNumber}
|
||||||
loadOutstandingReturns={loadOutstandingReturns}
|
loadOutstandingReturns={loadOutstandingReturns}
|
||||||
loadInventory={loadInventory}
|
loadInventory={loadInventory}
|
||||||
preferredMake={lineData ? lineData.jobs_by_pk.v_make_desc : null}
|
|
||||||
/>
|
/>
|
||||||
{!billEdit && (
|
{!billEdit && (
|
||||||
<BillCmdReturnsTableComponent
|
<BillCmdReturnsTableComponent
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { selectBreadcrumbs } from "../../redux/application/application.selectors";
|
import { selectBreadcrumbs } from "../../redux/application/application.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import GlobalSearch from "../global-search/global-search.component";
|
import GlobalSearch from "../global-search/global-search.component";
|
||||||
import GlobalSearchOs from "../global-search/global-search-os.component";
|
|
||||||
import "./breadcrumbs.styles.scss";
|
import "./breadcrumbs.styles.scss";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
breadcrumbs: selectBreadcrumbs,
|
breadcrumbs: selectBreadcrumbs,
|
||||||
@@ -17,12 +15,6 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export function BreadCrumbs({ breadcrumbs, bodyshop }) {
|
export function BreadCrumbs({ breadcrumbs, bodyshop }) {
|
||||||
const { OpenSearch } = useTreatments(
|
|
||||||
["OpenSearch"],
|
|
||||||
{},
|
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row className="breadcrumb-container">
|
<Row className="breadcrumb-container">
|
||||||
<Col xs={24} sm={24} md={16}>
|
<Col xs={24} sm={24} md={16}>
|
||||||
@@ -46,7 +38,7 @@ export function BreadCrumbs({ breadcrumbs, bodyshop }) {
|
|||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={24} sm={24} md={8}>
|
<Col xs={24} sm={24} md={8}>
|
||||||
{OpenSearch.treatment === "on" ? <GlobalSearchOs /> : <GlobalSearch />}
|
<GlobalSearch />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export function ContractsFindModalContainer({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
open={visible}
|
||||||
width="70%"
|
width="70%"
|
||||||
title={t("payments.labels.findermodal")}
|
title={t("payments.labels.findermodal")}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
|
|||||||
@@ -10,10 +10,7 @@ export default function CABCpvrtCalculator({ disabled, form }) {
|
|||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
logImEXEvent("job_ca_bc_pvrt_calculate");
|
logImEXEvent("job_ca_bc_pvrt_calculate");
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({ ca_bc_pvrt: ((values.rate||0) * (values.days||0)).toFixed(2) });
|
||||||
ca_bc_pvrt: ((values.rate || 0) * (values.days || 0)).toFixed(2),
|
|
||||||
});
|
|
||||||
form.setFields([{ name: "ca_bc_pvrt", touched: true }]);
|
|
||||||
setVisibility(false);
|
setVisibility(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -38,7 +35,7 @@ export default function CABCpvrtCalculator({ disabled, form }) {
|
|||||||
<Popover
|
<Popover
|
||||||
destroyTooltipOnHide
|
destroyTooltipOnHide
|
||||||
content={popContent}
|
content={popContent}
|
||||||
visible={visibility}
|
open={visibility}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<Button disabled={disabled} onClick={() => setVisibility(true)}>
|
<Button disabled={disabled} onClick={() => setVisibility(true)}>
|
||||||
|
|||||||
@@ -1,374 +0,0 @@
|
|||||||
import { DeleteFilled } from "@ant-design/icons";
|
|
||||||
import { useLazyQuery, useMutation } from "@apollo/client";
|
|
||||||
import {
|
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Col,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Row,
|
|
||||||
Space,
|
|
||||||
Spin,
|
|
||||||
Statistic,
|
|
||||||
notification,
|
|
||||||
} from "antd";
|
|
||||||
import axios from "axios";
|
|
||||||
import moment from "moment";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import {
|
|
||||||
INSERT_PAYMENT_RESPONSE,
|
|
||||||
QUERY_RO_AND_OWNER_BY_JOB_PKS,
|
|
||||||
} from "../../graphql/payment_response.queries";
|
|
||||||
import { INSERT_NEW_PAYMENT } from "../../graphql/payments.queries";
|
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
|
||||||
import { selectCardPayment } from "../../redux/modals/modals.selectors";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|
||||||
import CurrencyFormItemComponent from "../form-items-formatted/currency-form-item.component";
|
|
||||||
import JobSearchSelectComponent from "../job-search-select/job-search-select.component";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
|
||||||
cardPaymentModal: selectCardPayment,
|
|
||||||
bodyshop: selectBodyshop,
|
|
||||||
});
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")),
|
|
||||||
});
|
|
||||||
|
|
||||||
const CardPaymentModalComponent = ({
|
|
||||||
bodyshop,
|
|
||||||
cardPaymentModal,
|
|
||||||
toggleModalVisible,
|
|
||||||
insertAuditTrail,
|
|
||||||
}) => {
|
|
||||||
const { context } = cardPaymentModal;
|
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
const [insertPayment] = useMutation(INSERT_NEW_PAYMENT);
|
|
||||||
const [insertPaymentResponse] = useMutation(INSERT_PAYMENT_RESPONSE);
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const [, { data, refetch, queryLoading }] = useLazyQuery(
|
|
||||||
QUERY_RO_AND_OWNER_BY_JOB_PKS,
|
|
||||||
{
|
|
||||||
variables: { jobids: [context.jobid] },
|
|
||||||
skip: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log("🚀 ~ file: card-payment-modal.component..jsx:61 ~ data:", data);
|
|
||||||
//Initialize the intellipay window.
|
|
||||||
const SetIntellipayCallbackFunctions = () => {
|
|
||||||
console.log("*** Set IntelliPay callback functions.");
|
|
||||||
window.intellipay.runOnClose(() => {
|
|
||||||
//window.intellipay.initialize();
|
|
||||||
});
|
|
||||||
|
|
||||||
window.intellipay.runOnApproval(async function (response) {
|
|
||||||
console.warn("*** Running On Approval Script ***");
|
|
||||||
form.setFieldValue("paymentResponse", response);
|
|
||||||
form.submit();
|
|
||||||
});
|
|
||||||
|
|
||||||
window.intellipay.runOnNonApproval(async function (response) {
|
|
||||||
// Mutate unsuccessful payment
|
|
||||||
|
|
||||||
const { payments } = form.getFieldsValue();
|
|
||||||
|
|
||||||
await insertPaymentResponse({
|
|
||||||
variables: {
|
|
||||||
paymentResponse: payments.map((payment) => ({
|
|
||||||
amount: payment.amount,
|
|
||||||
bodyshopid: bodyshop.id,
|
|
||||||
jobid: payment.jobid,
|
|
||||||
declinereason: response.declinereason,
|
|
||||||
ext_paymentid: response.paymentid.toString(),
|
|
||||||
successful: false,
|
|
||||||
response,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
payments.forEach((payment) =>
|
|
||||||
insertAuditTrail({
|
|
||||||
jobid: payment.jobid,
|
|
||||||
operation: AuditTrailMapping.failedpayment(),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
|
||||||
try {
|
|
||||||
await insertPayment({
|
|
||||||
variables: {
|
|
||||||
paymentInput: values.payments.map((payment) => ({
|
|
||||||
amount: payment.amount,
|
|
||||||
transactionid: (values.paymentResponse.paymentid || "").toString(),
|
|
||||||
payer: t("payments.labels.customer"),
|
|
||||||
type: values.paymentResponse.cardbrand,
|
|
||||||
jobid: payment.jobid,
|
|
||||||
date: moment(Date.now()),
|
|
||||||
payment_responses: {
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
amount: payment.amount,
|
|
||||||
bodyshopid: bodyshop.id,
|
|
||||||
|
|
||||||
jobid: payment.jobid,
|
|
||||||
declinereason: values.paymentResponse.declinereason,
|
|
||||||
ext_paymentid: values.paymentResponse.paymentid.toString(),
|
|
||||||
successful: true,
|
|
||||||
response: values.paymentResponse,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
refetchQueries: ["GET_JOB_BY_PK"],
|
|
||||||
});
|
|
||||||
toggleModalVisible();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
notification.open({
|
|
||||||
type: "error",
|
|
||||||
message: t("payments.errors.inserting", { error: error.message }),
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleIntelliPayCharge = async () => {
|
|
||||||
setLoading(true);
|
|
||||||
|
|
||||||
//Validate
|
|
||||||
try {
|
|
||||||
await form.validateFields();
|
|
||||||
} catch (error) {
|
|
||||||
setLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.post("/intellipay/lightbox_credentials", {
|
|
||||||
bodyshop,
|
|
||||||
refresh: !!window.intellipay,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (window.intellipay) {
|
|
||||||
// eslint-disable-next-line no-eval
|
|
||||||
eval(response.data);
|
|
||||||
SetIntellipayCallbackFunctions();
|
|
||||||
window.intellipay.autoOpen();
|
|
||||||
} else {
|
|
||||||
var rg = document.createRange();
|
|
||||||
let node = rg.createContextualFragment(response.data);
|
|
||||||
document.documentElement.appendChild(node);
|
|
||||||
SetIntellipayCallbackFunctions();
|
|
||||||
window.intellipay.isAutoOpen = true;
|
|
||||||
window.intellipay.initialize();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
notification.open({
|
|
||||||
type: "error",
|
|
||||||
message: t("job_payments.notifications.error.openingip"),
|
|
||||||
});
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card title="Card Payment">
|
|
||||||
<Spin spinning={loading}>
|
|
||||||
<Form
|
|
||||||
onFinish={handleFinish}
|
|
||||||
form={form}
|
|
||||||
layout="vertical"
|
|
||||||
initialValues={{
|
|
||||||
payments: context.jobid ? [{ jobid: context.jobid }] : [],
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Form.List name={["payments"]}>
|
|
||||||
{(fields, { add, remove, move }) => {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{fields.map((field, index) => (
|
|
||||||
<Form.Item key={field.key}>
|
|
||||||
<Row gutter={[16, 16]}>
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item
|
|
||||||
key={`${index}jobid`}
|
|
||||||
label={t("jobs.fields.ro_number")}
|
|
||||||
name={[field.name, "jobid"]}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<JobSearchSelectComponent
|
|
||||||
notExported={false}
|
|
||||||
clm_no
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col span={6}>
|
|
||||||
<Form.Item
|
|
||||||
key={`${index}amount`}
|
|
||||||
label={t("payments.fields.amount")}
|
|
||||||
name={[field.name, "amount"]}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<CurrencyFormItemComponent />
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col span={2}>
|
|
||||||
<DeleteFilled
|
|
||||||
style={{ margin: "1rem" }}
|
|
||||||
onClick={() => {
|
|
||||||
remove(field.name);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Form.Item>
|
|
||||||
))}
|
|
||||||
<Form.Item>
|
|
||||||
<Button
|
|
||||||
type="dashed"
|
|
||||||
onClick={() => {
|
|
||||||
add();
|
|
||||||
}}
|
|
||||||
style={{ width: "100%" }}
|
|
||||||
>
|
|
||||||
{t("general.actions.add")}
|
|
||||||
</Button>
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Form.List>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
shouldUpdate={(prevValues, curValues) =>
|
|
||||||
prevValues.payments?.map((p) => p?.jobid).join() !==
|
|
||||||
curValues.payments?.map((p) => p?.jobid).join()
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{() => {
|
|
||||||
console.log("Updating the owner info section.");
|
|
||||||
//If all of the job ids have been fileld in, then query and update the IP field.
|
|
||||||
const { payments } = form.getFieldsValue();
|
|
||||||
if (
|
|
||||||
payments?.length > 0 &&
|
|
||||||
payments?.filter((p) => p?.jobid).length === payments?.length
|
|
||||||
) {
|
|
||||||
console.log("**Calling refetch.");
|
|
||||||
refetch({ jobids: payments.map((p) => p.jobid) });
|
|
||||||
}
|
|
||||||
console.log(
|
|
||||||
"Acc info",
|
|
||||||
data,
|
|
||||||
payments && data && data.jobs.length > 0
|
|
||||||
? data.jobs.map((j) => j.ro_number).join(", ")
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Input
|
|
||||||
className="ipayfield"
|
|
||||||
data-ipayname="account"
|
|
||||||
//type="hidden"
|
|
||||||
value={
|
|
||||||
payments && data && data.jobs.length > 0
|
|
||||||
? data.jobs.map((j) => j.ro_number).join(", ")
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
hidden
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
className="ipayfield"
|
|
||||||
data-ipayname="email"
|
|
||||||
// type="hidden"
|
|
||||||
value={
|
|
||||||
payments && data && data.jobs.length > 0
|
|
||||||
? data.jobs.filter((j) => j.ownr_ea)[0]?.ownr_ea
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
hidden
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
shouldUpdate={(prevValues, curValues) =>
|
|
||||||
prevValues.payments?.map((p) => p?.amount).join() !==
|
|
||||||
curValues.payments?.map((p) => p?.amount).join()
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{() => {
|
|
||||||
const { payments } = form.getFieldsValue();
|
|
||||||
const totalAmountToCharge = payments?.reduce((acc, val) => {
|
|
||||||
return acc + (val?.amount || 0);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Space style={{ float: "right" }}>
|
|
||||||
<Statistic
|
|
||||||
title="Amount To Charge"
|
|
||||||
value={totalAmountToCharge}
|
|
||||||
precision={2}
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
className="ipayfield"
|
|
||||||
data-ipayname="amount"
|
|
||||||
//type="hidden"
|
|
||||||
value={totalAmountToCharge?.toFixed(2)}
|
|
||||||
hidden
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
// data-ipayname="submit"
|
|
||||||
className="ipayfield"
|
|
||||||
loading={queryLoading || loading}
|
|
||||||
disabled={!(totalAmountToCharge > 0)}
|
|
||||||
onClick={handleIntelliPayCharge}
|
|
||||||
>
|
|
||||||
{t("job_payments.buttons.proceedtopayment")}
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
{/* Lightbox payment response when it is completed */}
|
|
||||||
<Form.Item name="paymentResponse" hidden>
|
|
||||||
<Input type="hidden" />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Spin>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(CardPaymentModalComponent);
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
import { Button, Modal } from "antd";
|
|
||||||
import React from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
|
||||||
import { selectCardPayment } from "../../redux/modals/modals.selectors";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import CardPaymentModalComponent from "./card-payment-modal.component.";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
|
||||||
cardPaymentModal: selectCardPayment,
|
|
||||||
bodyshop: selectBodyshop,
|
|
||||||
});
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")),
|
|
||||||
});
|
|
||||||
|
|
||||||
function CardPaymentModalContainer({
|
|
||||||
cardPaymentModal,
|
|
||||||
toggleModalVisible,
|
|
||||||
bodyshop,
|
|
||||||
}) {
|
|
||||||
const { visible } = cardPaymentModal;
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
toggleModalVisible();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOK = () => {
|
|
||||||
toggleModalVisible();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
open={visible}
|
|
||||||
onOk={handleOK}
|
|
||||||
onCancel={handleCancel}
|
|
||||||
footer={[
|
|
||||||
<Button key="back" onClick={handleCancel}>
|
|
||||||
{t("job_payments.buttons.goback")}
|
|
||||||
</Button>,
|
|
||||||
]}
|
|
||||||
width="80%"
|
|
||||||
destroyOnClose
|
|
||||||
>
|
|
||||||
<CardPaymentModalComponent />
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(CardPaymentModalContainer);
|
|
||||||
@@ -1,19 +1,12 @@
|
|||||||
import { Badge, List, Tag } from "antd";
|
import { Badge, List, Tag } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import {
|
|
||||||
AutoSizer,
|
|
||||||
CellMeasurer,
|
|
||||||
CellMeasurerCache,
|
|
||||||
List as VirtualizedList,
|
|
||||||
} from "react-virtualized";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { setSelectedConversation } from "../../redux/messaging/messaging.actions";
|
import { setSelectedConversation } from "../../redux/messaging/messaging.actions";
|
||||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
|
|
||||||
import "./chat-conversation-list.styles.scss";
|
import "./chat-conversation-list.styles.scss";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -25,95 +18,59 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
dispatch(setSelectedConversation(conversationId)),
|
dispatch(setSelectedConversation(conversationId)),
|
||||||
});
|
});
|
||||||
|
|
||||||
function ChatConversationListComponent({
|
export function ChatConversationListComponent({
|
||||||
conversationList,
|
conversationList,
|
||||||
selectedConversation,
|
selectedConversation,
|
||||||
setSelectedConversation,
|
setSelectedConversation,
|
||||||
loadMoreConversations,
|
|
||||||
}) {
|
}) {
|
||||||
const cache = new CellMeasurerCache({
|
|
||||||
fixedWidth: true,
|
|
||||||
defaultHeight: 60,
|
|
||||||
});
|
|
||||||
|
|
||||||
const rowRenderer = ({ index, key, style, parent }) => {
|
|
||||||
const item = conversationList[index];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<CellMeasurer
|
|
||||||
key={key}
|
|
||||||
cache={cache}
|
|
||||||
parent={parent}
|
|
||||||
columnIndex={0}
|
|
||||||
rowIndex={index}
|
|
||||||
>
|
|
||||||
<List.Item
|
|
||||||
onClick={() => setSelectedConversation(item.id)}
|
|
||||||
className={`chat-list-item ${
|
|
||||||
item.id === selectedConversation
|
|
||||||
? "chat-list-selected-conversation"
|
|
||||||
: null
|
|
||||||
}`}
|
|
||||||
style={style}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "inline-block",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item.label && <div className="chat-name">{item.label}</div>}
|
|
||||||
{item.job_conversations.length > 0 ? (
|
|
||||||
<div className="chat-name">
|
|
||||||
{item.job_conversations.map((j, idx) => (
|
|
||||||
<div key={idx}>
|
|
||||||
<OwnerNameDisplay ownerObject={j.job} />
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<PhoneFormatter>{item.phone_num}</PhoneFormatter>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div style={{ display: "inline-block" }}>
|
|
||||||
<div>
|
|
||||||
{item.job_conversations.length > 0
|
|
||||||
? item.job_conversations.map((j, idx) => (
|
|
||||||
<Tag key={idx} className="ro-number-tag">
|
|
||||||
{j.job.ro_number}
|
|
||||||
</Tag>
|
|
||||||
))
|
|
||||||
: null}
|
|
||||||
</div>
|
|
||||||
<TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>
|
|
||||||
</div>
|
|
||||||
<Badge count={item.messages_aggregate.aggregate.count || 0} />
|
|
||||||
</List.Item>
|
|
||||||
</CellMeasurer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="chat-list-container">
|
<div className="chat-list-container">
|
||||||
<AutoSizer>
|
<List
|
||||||
{({ height, width }) => (
|
bordered
|
||||||
<VirtualizedList
|
dataSource={conversationList}
|
||||||
height={height}
|
renderItem={(item) => (
|
||||||
width={width}
|
<List.Item
|
||||||
rowCount={conversationList.length}
|
key={item.id}
|
||||||
rowHeight={cache.rowHeight}
|
onClick={() => setSelectedConversation(item.id)}
|
||||||
rowRenderer={rowRenderer}
|
className={`chat-list-item ${
|
||||||
onScroll={({ scrollTop, scrollHeight, clientHeight }) => {
|
item.id === selectedConversation
|
||||||
if (scrollTop + clientHeight === scrollHeight) {
|
? "chat-list-selected-conversation"
|
||||||
loadMoreConversations();
|
: null
|
||||||
}
|
}`}
|
||||||
}}
|
>
|
||||||
/>
|
<div sryle={{ display: "inline-block" }}>
|
||||||
|
{item.label && <div className="chat-name">{item.label}</div>}
|
||||||
|
{item.job_conversations.length > 0 ? (
|
||||||
|
<div className="chat-name">
|
||||||
|
{item.job_conversations.map((j, idx) => (
|
||||||
|
<div key={idx}>
|
||||||
|
<OwnerNameDisplay ownerObject={j.job} />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<PhoneFormatter>{item.phone_num}</PhoneFormatter>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div sryle={{ display: "inline-block" }}>
|
||||||
|
<div>
|
||||||
|
{item.job_conversations.length > 0
|
||||||
|
? item.job_conversations.map((j, idx) => (
|
||||||
|
<Tag key={idx} className="ro-number-tag">
|
||||||
|
{j.job.ro_number}
|
||||||
|
</Tag>
|
||||||
|
))
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
|
<TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>
|
||||||
|
</div>
|
||||||
|
<Badge count={item.messages_aggregate.aggregate.count || 0} />
|
||||||
|
</List.Item>
|
||||||
)}
|
)}
|
||||||
</AutoSizer>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
}
|
}
|
||||||
.chat-list-container {
|
.chat-list-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 1px solid gainsboro;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-list-item {
|
.chat-list-item {
|
||||||
@@ -22,6 +21,4 @@
|
|||||||
.ro-number-tag {
|
.ro-number-tag {
|
||||||
align-self: baseline;
|
align-self: baseline;
|
||||||
}
|
}
|
||||||
padding: 12px 24px;
|
|
||||||
border-bottom: 1px solid gainsboro;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export function ChatConversationContainer({ bodyshop, selectedConversation }) {
|
|||||||
MARK_MESSAGES_AS_READ_BY_CONVERSATION,
|
MARK_MESSAGES_AS_READ_BY_CONVERSATION,
|
||||||
{
|
{
|
||||||
variables: { conversationId: selectedConversation },
|
variables: { conversationId: selectedConversation },
|
||||||
refetchQueries: ["UNREAD_CONVERSATION_COUNT"],
|
|
||||||
update(cache) {
|
update(cache) {
|
||||||
cache.modify({
|
cache.modify({
|
||||||
id: cache.identify({
|
id: cache.identify({
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ export function ChatMediaSelector({
|
|||||||
}
|
}
|
||||||
title={t("messaging.labels.selectmedia")}
|
title={t("messaging.labels.selectmedia")}
|
||||||
trigger="click"
|
trigger="click"
|
||||||
visible={visible}
|
open={visible}
|
||||||
onVisibleChange={handleVisibleChange}
|
onOpenChange={handleVisibleChange}
|
||||||
>
|
>
|
||||||
<Badge count={selectedMedia.filter((s) => s.isSelected).length}>
|
<Badge count={selectedMedia.filter((s) => s.isSelected).length}>
|
||||||
<PictureFilled style={{ margin: "0 .5rem" }} />
|
<PictureFilled style={{ margin: "0 .5rem" }} />
|
||||||
|
|||||||
@@ -8,23 +8,15 @@ import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
|||||||
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { searchingForConversation } from "../../redux/messaging/messaging.selectors";
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
searchingForConversation: searchingForConversation,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
openChatByPhone: (phone) => dispatch(openChatByPhone(phone)),
|
openChatByPhone: (phone) => dispatch(openChatByPhone(phone)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ChatOpenButton({
|
export function ChatOpenButton({ bodyshop, phone, jobid, openChatByPhone }) {
|
||||||
bodyshop,
|
|
||||||
searchingForConversation,
|
|
||||||
phone,
|
|
||||||
jobid,
|
|
||||||
openChatByPhone,
|
|
||||||
}) {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (!phone) return <></>;
|
if (!phone) return <></>;
|
||||||
|
|
||||||
@@ -37,7 +29,7 @@ export function ChatOpenButton({
|
|||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const p = parsePhoneNumber(phone, "CA");
|
const p = parsePhoneNumber(phone, "CA");
|
||||||
if (searchingForConversation) return; //This is to prevent finding the same thing twice.
|
|
||||||
if (p && p.isValid()) {
|
if (p && p.isValid()) {
|
||||||
openChatByPhone({ phone_num: p.formatInternational(), jobid: jobid });
|
openChatByPhone({ phone_num: p.formatInternational(), jobid: jobid });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,16 +4,13 @@ import {
|
|||||||
ShrinkOutlined,
|
ShrinkOutlined,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useLazyQuery, useQuery } from "@apollo/client";
|
import { useQuery } from "@apollo/client";
|
||||||
import { Badge, Card, Col, Row, Space, Tag, Tooltip, Typography } from "antd";
|
import { Badge, Card, Col, Row, Space, Tag, Tooltip, Typography } from "antd";
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import React, { useEffect, 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 {
|
import { CONVERSATION_LIST_QUERY } from "../../graphql/conversations.queries";
|
||||||
CONVERSATION_LIST_QUERY,
|
|
||||||
UNREAD_CONVERSATION_COUNT,
|
|
||||||
} from "../../graphql/conversations.queries";
|
|
||||||
import { toggleChatVisible } from "../../redux/messaging/messaging.actions";
|
import { toggleChatVisible } from "../../redux/messaging/messaging.actions";
|
||||||
import {
|
import {
|
||||||
selectChatVisible,
|
selectChatVisible,
|
||||||
@@ -40,21 +37,12 @@ export function ChatPopupComponent({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [pollInterval, setpollInterval] = useState(0);
|
const [pollInterval, setpollInterval] = useState(0);
|
||||||
|
const { loading, data, refetch, called } = useQuery(CONVERSATION_LIST_QUERY, {
|
||||||
const { data: unreadData } = useQuery(UNREAD_CONVERSATION_COUNT, {
|
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
...(pollInterval > 0 ? { pollInterval } : {}),
|
...(pollInterval > 0 ? { pollInterval } : {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const [getConversations, { loading, data, refetch, fetchMore }] =
|
|
||||||
useLazyQuery(CONVERSATION_LIST_QUERY, {
|
|
||||||
fetchPolicy: "network-only",
|
|
||||||
nextFetchPolicy: "network-only",
|
|
||||||
skip: !chatVisible,
|
|
||||||
...(pollInterval > 0 ? { pollInterval } : {}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const fcmToken = sessionStorage.getItem("fcmtoken");
|
const fcmToken = sessionStorage.getItem("fcmtoken");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -66,24 +54,15 @@ export function ChatPopupComponent({
|
|||||||
}, [fcmToken]);
|
}, [fcmToken]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (chatVisible)
|
if (called && chatVisible) refetch();
|
||||||
getConversations({
|
}, [chatVisible, called, refetch]);
|
||||||
variables: {
|
|
||||||
offset: 0,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, [chatVisible, getConversations]);
|
|
||||||
|
|
||||||
const loadMoreConversations = useCallback(() => {
|
const unreadCount = data
|
||||||
if (data)
|
? data.conversations.reduce(
|
||||||
fetchMore({
|
(acc, val) => val.messages_aggregate.aggregate.count + acc,
|
||||||
variables: {
|
0
|
||||||
offset: data.conversations.length,
|
)
|
||||||
},
|
: 0;
|
||||||
});
|
|
||||||
}, [data, fetchMore]);
|
|
||||||
|
|
||||||
const unreadCount = unreadData?.messages_aggregate.aggregate.count || 0;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge count={unreadCount}>
|
<Badge count={unreadCount}>
|
||||||
@@ -118,7 +97,6 @@ export function ChatPopupComponent({
|
|||||||
) : (
|
) : (
|
||||||
<ChatConversationListComponent
|
<ChatConversationListComponent
|
||||||
conversationList={data ? data.conversations : []}
|
conversationList={data ? data.conversations : []}
|
||||||
loadMoreConversations={loadMoreConversations}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { PlusCircleOutlined } from "@ant-design/icons";
|
import { PlusCircleOutlined } from "@ant-design/icons";
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -16,19 +16,15 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export function ChatPresetsComponent({ bodyshop, setMessage, className }) {
|
export function ChatPresetsComponent({ bodyshop, setMessage, className }) {
|
||||||
const menu = (
|
const menu = bodyshop.md_messaging_presets.map((i, idx) => ({
|
||||||
<Menu>
|
label: i.label,
|
||||||
{bodyshop.md_messaging_presets.map((i, idx) => (
|
key: idx,
|
||||||
<Menu.Item onClick={() => setMessage(i.text)} key={idx}>
|
onClick: () => setMessage(i.text),
|
||||||
{i.label}
|
}));
|
||||||
</Menu.Item>
|
|
||||||
))}
|
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<Dropdown trigger={["click"]} overlay={menu}>
|
<Dropdown trigger={["click"]} menu={{ items: menu }} placement="top">
|
||||||
<PlusCircleOutlined />
|
<PlusCircleOutlined />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -59,14 +59,6 @@ export default function ContractsCarsComponent({
|
|||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "model" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "model" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t("courtesycars.fields.color"),
|
|
||||||
dataIndex: "color",
|
|
||||||
key: "color",
|
|
||||||
sorter: (a, b) => alphaSort(a.color, b.color),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "color" && state.sortedInfo.order,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t("courtesycars.fields.plate"),
|
title: t("courtesycars.fields.plate"),
|
||||||
dataIndex: "plate",
|
dataIndex: "plate",
|
||||||
@@ -101,9 +93,6 @@ export default function ContractsCarsComponent({
|
|||||||
(cc.model || "")
|
(cc.model || "")
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(state.search.toLowerCase()) ||
|
.includes(state.search.toLowerCase()) ||
|
||||||
(cc.color || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(state.search.toLowerCase()) ||
|
|
||||||
(cc.plate || "").toLowerCase().includes(state.search.toLowerCase())
|
(cc.plate || "").toLowerCase().includes(state.search.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ export function ContractConvertToRo({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Popover content={popContent} visible={visible}>
|
<Popover content={popContent} open={visible}>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setVisible(true)}
|
onClick={() => setVisible(true)}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import moment from "moment";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
//import ContractLicenseDecodeButton from "../contract-license-decode-button/contract-license-decode-button.component";
|
import ContractLicenseDecodeButton from "../contract-license-decode-button/contract-license-decode-button.component";
|
||||||
import ContractStatusSelector from "../contract-status-select/contract-status-select.component";
|
import ContractStatusSelector from "../contract-status-select/contract-status-select.component";
|
||||||
import ContractsRatesChangeButton from "../contracts-rates-change-button/contracts-rates-change-button.component";
|
import ContractsRatesChangeButton from "../contracts-rates-change-button/contracts-rates-change-button.component";
|
||||||
import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component";
|
import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component";
|
||||||
@@ -165,9 +165,7 @@ export default function ContractFormComponent({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{
|
<ContractLicenseDecodeButton form={form} />
|
||||||
//<ContractLicenseDecodeButton form={form} />
|
|
||||||
}
|
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
<LayoutFormRow header={t("contracts.labels.driverinformation")}>
|
<LayoutFormRow header={t("contracts.labels.driverinformation")}>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import { useQuery } from "@apollo/client";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ContractJobsComponent from "./contract-jobs.component";
|
import ContractJobsComponent from "./contract-jobs.component";
|
||||||
|
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -15,7 +15,6 @@ export function ContractJobsContainer({ selectedJobState, bodyshop }) {
|
|||||||
const { loading, error, data } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
const { loading, error, data } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||||
variables: {
|
variables: {
|
||||||
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open"],
|
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open"],
|
||||||
isConverted: true,
|
|
||||||
},
|
},
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default function ContractLicenseDecodeButton({ form }) {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal
|
<Modal
|
||||||
visible={modalVisible}
|
open={modalVisible}
|
||||||
okText={t("contracts.actions.senddltoform")}
|
okText={t("contracts.actions.senddltoform")}
|
||||||
onOk={handleInsertForm}
|
onOk={handleInsertForm}
|
||||||
okButtonProps={{ disabled: !!!decodedBarcode }}
|
okButtonProps={{ disabled: !!!decodedBarcode }}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export function ContractsFindModalContainer({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
open={visible}
|
||||||
width="70%"
|
width="70%"
|
||||||
title={t("contracts.labels.findermodal")}
|
title={t("contracts.labels.findermodal")}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ 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 { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
|
||||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import ContractsFindModalContainer from "../contracts-find-modal/contracts-find-modal.container";
|
import ContractsFindModalContainer from "../contracts-find-modal/contracts-find-modal.container";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
|
||||||
import moment from "moment";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import moment from "moment";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DownOutlined } from "@ant-design/icons";
|
import { DownOutlined } from "@ant-design/icons";
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown } 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";
|
||||||
@@ -13,25 +13,14 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
export function ContractsRatesChangeButton({ disabled, form, bodyshop }) {
|
export function ContractsRatesChangeButton({ disabled, form, bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleClick = ({ item, key, keyPath }) => {
|
const menu = bodyshop.md_ccc_rates.map((rate, idx) => ({
|
||||||
const { label, ...rate } = item.props.value;
|
onClick: () => form.setFieldsValue(rate),
|
||||||
form.setFieldsValue(rate);
|
key: idx,
|
||||||
};
|
label: rate.label,
|
||||||
|
}));
|
||||||
const menu = (
|
|
||||||
<div>
|
|
||||||
<Menu onClick={handleClick}>
|
|
||||||
{bodyshop.md_ccc_rates.map((rate, idx) => (
|
|
||||||
<Menu.Item value={rate} key={idx}>
|
|
||||||
{rate.label}
|
|
||||||
</Menu.Item>
|
|
||||||
))}
|
|
||||||
</Menu>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown overlay={menu} disabled={disabled}>
|
<Dropdown menu={{ items: menu }} disabled={disabled}>
|
||||||
<a
|
<a
|
||||||
className="ant-dropdown-link"
|
className="ant-dropdown-link"
|
||||||
href=" #"
|
href=" #"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { WarningFilled } from "@ant-design/icons";
|
import { WarningFilled } from "@ant-design/icons";
|
||||||
import { useApolloClient } from "@apollo/client";
|
import { useApolloClient } from "@apollo/client";
|
||||||
import { Button, Form, Input, InputNumber, PageHeader, Space } from "antd";
|
import { PageHeader } from '@ant-design/pro-layout';
|
||||||
|
import { Button, Form, Input, InputNumber, Space } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -34,18 +35,6 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
|
|
||||||
{/* <FormFieldsChanged form={form} /> */}
|
{/* <FormFieldsChanged form={form} /> */}
|
||||||
<LayoutFormRow header={t("courtesycars.labels.vehicle")}>
|
<LayoutFormRow header={t("courtesycars.labels.vehicle")}>
|
||||||
<Form.Item
|
|
||||||
label={t("courtesycars.fields.year")}
|
|
||||||
name="year"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.make")}
|
label={t("courtesycars.fields.make")}
|
||||||
name="make"
|
name="make"
|
||||||
@@ -70,6 +59,18 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("courtesycars.fields.year")}
|
||||||
|
name="year"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.plate")}
|
label={t("courtesycars.fields.plate")}
|
||||||
name="plate"
|
name="plate"
|
||||||
@@ -118,7 +119,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber min={0} precision={0} />
|
<InputNumber precision={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.fleetnumber")}
|
label={t("courtesycars.fields.fleetnumber")}
|
||||||
@@ -213,24 +214,49 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
<CourtesyCarStatus />
|
<CourtesyCarStatus />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("courtesycars.fields.nextservicekm")}
|
||||||
|
name="nextservicekm"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
<div>
|
<div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.nextservicekm")}
|
label={t("courtesycars.fields.nextservicedate")}
|
||||||
name="nextservicekm"
|
name="nextservicedate"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber min={0} precision={0} />
|
<FormDatePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
shouldUpdate={(p, c) =>
|
shouldUpdate={(p, c) =>
|
||||||
p.mileage !== c.mileage || p.nextservicekm !== c.nextservicekm
|
p.mileage !== c.mileage ||
|
||||||
|
p.nextservicedate !== c.nextservicedate ||
|
||||||
|
p.nextservicekm !== c.nextservicekm
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
|
const nextservicedate = form.getFieldValue("nextservicedate");
|
||||||
const nextservicekm = form.getFieldValue("nextservicekm");
|
const nextservicekm = form.getFieldValue("nextservicekm");
|
||||||
|
|
||||||
const mileageOver =
|
const mileageOver =
|
||||||
nextservicekm <= form.getFieldValue("mileage");
|
nextservicekm <= form.getFieldValue("mileage");
|
||||||
|
|
||||||
if (mileageOver)
|
const dueForService =
|
||||||
|
nextservicedate && moment(nextservicedate).isBefore(moment());
|
||||||
|
|
||||||
|
if (mileageOver || dueForService)
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" style={{ color: "tomato" }}>
|
<Space direction="vertical" style={{ color: "tomato" }}>
|
||||||
<span>
|
<span>
|
||||||
@@ -238,36 +264,6 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
{t("contracts.labels.cardueforservice")}
|
{t("contracts.labels.cardueforservice")}
|
||||||
</span>
|
</span>
|
||||||
<span>{`${nextservicekm} km`}</span>
|
<span>{`${nextservicekm} km`}</span>
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
|
|
||||||
return <></>;
|
|
||||||
}}
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Form.Item
|
|
||||||
label={t("courtesycars.fields.nextservicedate")}
|
|
||||||
name="nextservicedate"
|
|
||||||
>
|
|
||||||
<FormDatePicker />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
shouldUpdate={(p, c) => p.nextservicedate !== c.nextservicedate}
|
|
||||||
>
|
|
||||||
{() => {
|
|
||||||
const nextservicedate = form.getFieldValue("nextservicedate");
|
|
||||||
const dueForService =
|
|
||||||
nextservicedate &&
|
|
||||||
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
|
|
||||||
|
|
||||||
if (dueForService)
|
|
||||||
return (
|
|
||||||
<Space direction="vertical" style={{ color: "tomato" }}>
|
|
||||||
<span>
|
|
||||||
<WarningFilled style={{ marginRight: ".3rem" }} />
|
|
||||||
{t("contracts.labels.cardueforservice")}
|
|
||||||
</span>
|
|
||||||
<span>
|
<span>
|
||||||
<DateFormatter>{nextservicedate}</DateFormatter>
|
<DateFormatter>{nextservicedate}</DateFormatter>
|
||||||
</span>
|
</span>
|
||||||
@@ -288,6 +284,12 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.registrationexpires")}
|
label={t("courtesycars.fields.registrationexpires")}
|
||||||
name="registrationexpires"
|
name="registrationexpires"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<FormDatePicker />
|
<FormDatePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -299,8 +301,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
{() => {
|
{() => {
|
||||||
const expires = form.getFieldValue("registrationexpires");
|
const expires = form.getFieldValue("registrationexpires");
|
||||||
|
|
||||||
const dateover =
|
const dateover = expires && moment(expires).isBefore(moment());
|
||||||
expires && moment(expires).endOf("day").isBefore(moment());
|
|
||||||
|
|
||||||
if (dateover)
|
if (dateover)
|
||||||
return (
|
return (
|
||||||
@@ -330,13 +331,14 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
<FormDatePicker />
|
<FormDatePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
shouldUpdate={(p, c) => p.insuranceexpires !== c.insuranceexpires}
|
shouldUpdate={(p, c) =>
|
||||||
|
p.insuranceexpires !== c.insuranceexpires
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
const expires = form.getFieldValue("insuranceexpires");
|
const expires = form.getFieldValue("insuranceexpires");
|
||||||
|
|
||||||
const dateover =
|
const dateover = expires && moment(expires).isBefore(moment());
|
||||||
expires && moment(expires).endOf("day").isBefore(moment());
|
|
||||||
|
|
||||||
if (dateover)
|
if (dateover)
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export function CCReturnModalContainer({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={t("courtesycars.labels.return")}
|
title={t("courtesycars.labels.return")}
|
||||||
visible={visible}
|
open={visible}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
width={"90%"}
|
width={"90%"}
|
||||||
okText={t("general.actions.save")}
|
okText={t("general.actions.save")}
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Input,
|
Input, Space,
|
||||||
Menu,
|
|
||||||
Space,
|
|
||||||
Table,
|
Table,
|
||||||
Tooltip,
|
Tooltip
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@@ -15,8 +13,8 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||||
export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
@@ -115,14 +113,6 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "model" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "model" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t("courtesycars.fields.color"),
|
|
||||||
dataIndex: "color",
|
|
||||||
key: "color",
|
|
||||||
sorter: (a, b) => alphaSort(a.color, b.color),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "color" && state.sortedInfo.order,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t("courtesycars.fields.plate"),
|
title: t("courtesycars.fields.plate"),
|
||||||
dataIndex: "plate",
|
dataIndex: "plate",
|
||||||
@@ -174,7 +164,6 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
(c.year || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
(c.year || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||||
(c.make || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
(c.make || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||||
(c.model || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
(c.model || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||||
(c.plate || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
|
||||||
(t(c.status) || "").toLowerCase().includes(searchText.toLowerCase())
|
(t(c.status) || "").toLowerCase().includes(searchText.toLowerCase())
|
||||||
)
|
)
|
||||||
: courtesycars;
|
: courtesycars;
|
||||||
@@ -188,10 +177,14 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
</Button>
|
</Button>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
trigger="click"
|
trigger="click"
|
||||||
overlay={
|
menu={{
|
||||||
<Menu>
|
items: [
|
||||||
<Menu.Item
|
{
|
||||||
onClick={() =>
|
label: t(
|
||||||
|
"printcenter.courtesycarcontract.courtesy_car_inventory"
|
||||||
|
),
|
||||||
|
key: "cc_inv",
|
||||||
|
onClick: () =>
|
||||||
GenerateDocument(
|
GenerateDocument(
|
||||||
{
|
{
|
||||||
name: TemplateList("courtesycar").courtesy_car_inventory
|
name: TemplateList("courtesycar").courtesy_car_inventory
|
||||||
@@ -202,13 +195,10 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
"p"
|
"p"
|
||||||
)
|
),
|
||||||
}
|
},
|
||||||
>
|
],
|
||||||
{t("printcenter.courtesycarcontract.courtesy_car_inventory")}
|
}}
|
||||||
</Menu.Item>
|
|
||||||
</Menu>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Button>{t("general.labels.print")}</Button>
|
<Button>{t("general.labels.print")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|||||||
@@ -1,244 +0,0 @@
|
|||||||
import {
|
|
||||||
BranchesOutlined,
|
|
||||||
ExclamationCircleFilled,
|
|
||||||
PauseCircleOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
import { Card, Space, Table, Tooltip } from "antd";
|
|
||||||
import moment from "moment";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import ChatOpenButton from "../../chat-open-button/chat-open-button.component";
|
|
||||||
import OwnerNameDisplay from "../../owner-name-display/owner-name-display.component";
|
|
||||||
import DashboardRefreshRequired from "../refresh-required.component";
|
|
||||||
|
|
||||||
export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [state, setState] = useState({
|
|
||||||
sortedInfo: {},
|
|
||||||
});
|
|
||||||
if (!data) return null;
|
|
||||||
if (!data.scheduled_in_today)
|
|
||||||
return <DashboardRefreshRequired {...cardProps} />;
|
|
||||||
|
|
||||||
const appt = []; // Flatten Data
|
|
||||||
data.scheduled_in_today.forEach((item) => {
|
|
||||||
if (item.job) {
|
|
||||||
var i = {
|
|
||||||
canceled: item.canceled,
|
|
||||||
id: item.id,
|
|
||||||
alt_transport: item.job.alt_transport,
|
|
||||||
clm_no: item.job.clm_no,
|
|
||||||
jobid: item.job.jobid,
|
|
||||||
ins_co_nm: item.job.ins_co_nm,
|
|
||||||
iouparent: item.job.iouparent,
|
|
||||||
ownerid: item.job.ownerid,
|
|
||||||
ownr_co_nm: item.job.ownr_co_nm,
|
|
||||||
ownr_ea: item.job.ownr_ea,
|
|
||||||
ownr_fn: item.job.ownr_fn,
|
|
||||||
ownr_ln: item.job.ownr_ln,
|
|
||||||
ownr_ph1: item.job.ownr_ph1,
|
|
||||||
ownr_ph2: item.job.ownr_ph2,
|
|
||||||
production_vars: item.job.production_vars,
|
|
||||||
ro_number: item.job.ro_number,
|
|
||||||
suspended: item.job.suspended,
|
|
||||||
v_make_desc: item.job.v_make_desc,
|
|
||||||
v_model_desc: item.job.v_model_desc,
|
|
||||||
v_model_yr: item.job.v_model_yr,
|
|
||||||
v_vin: item.job.v_vin,
|
|
||||||
vehicleid: item.job.vehicleid,
|
|
||||||
note: item.note,
|
|
||||||
start: moment(item.start).format("hh:mm a"),
|
|
||||||
title: item.title,
|
|
||||||
};
|
|
||||||
appt.push(i);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
appt.sort(function (a, b) {
|
|
||||||
return new moment(a.start) - new moment(b.start);
|
|
||||||
});
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ro_number"),
|
|
||||||
dataIndex: "ro_number",
|
|
||||||
key: "ro_number",
|
|
||||||
render: (text, record) => (
|
|
||||||
<Link
|
|
||||||
to={"/manage/jobs/" + record.jobid}
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
<Space>
|
|
||||||
{record.ro_number || t("general.labels.na")}
|
|
||||||
{record.production_vars && record.production_vars.alert ? (
|
|
||||||
<ExclamationCircleFilled className="production-alert" />
|
|
||||||
) : null}
|
|
||||||
{record.suspended && (
|
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
|
||||||
)}
|
|
||||||
{record.iouparent && (
|
|
||||||
<Tooltip title={t("jobs.labels.iou")}>
|
|
||||||
<BranchesOutlined style={{ color: "orangered" }} />
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.owner"),
|
|
||||||
dataIndex: "owner",
|
|
||||||
key: "owner",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => {
|
|
||||||
return record.ownerid ? (
|
|
||||||
<Link
|
|
||||||
to={"/manage/owners/" + record.ownerid}
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ownr_ph1"),
|
|
||||||
dataIndex: "ownr_ph1",
|
|
||||||
key: "ownr_ph1",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.jobid} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ownr_ph2"),
|
|
||||||
dataIndex: "ownr_ph2",
|
|
||||||
key: "ownr_ph2",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.jobid} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ownr_ea"),
|
|
||||||
dataIndex: "ownr_ea",
|
|
||||||
key: "ownr_ea",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ea} jobid={record.jobid} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.vehicle"),
|
|
||||||
dataIndex: "vehicle",
|
|
||||||
key: "vehicle",
|
|
||||||
ellipsis: true,
|
|
||||||
render: (text, record) => {
|
|
||||||
return record.vehicleid ? (
|
|
||||||
<Link
|
|
||||||
to={"/manage/vehicles/" + record.vehicleid}
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
|
||||||
record.v_model_desc || ""
|
|
||||||
}`}
|
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
|
||||||
record.v_model_desc || ""
|
|
||||||
}`}</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ins_co_nm"),
|
|
||||||
dataIndex: "ins_co_nm",
|
|
||||||
key: "ins_co_nm",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("appointments.fields.time"),
|
|
||||||
dataIndex: "start",
|
|
||||||
key: "start",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("appointments.fields.alt_transport"),
|
|
||||||
dataIndex: "alt_transport",
|
|
||||||
key: "alt_transport",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleTableChange = (sorter) => {
|
|
||||||
setState({ ...state, sortedInfo: sorter });
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
title={t("dashboard.titles.scheduledintoday", {
|
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
|
||||||
})}
|
|
||||||
{...cardProps}
|
|
||||||
>
|
|
||||||
<div style={{ height: "100%" }}>
|
|
||||||
<Table
|
|
||||||
onChange={handleTableChange}
|
|
||||||
pagination={{ position: "top", defaultPageSize: 50 }}
|
|
||||||
columns={columns}
|
|
||||||
scroll={{ x: true, y: "calc(100% - 2em)" }}
|
|
||||||
rowKey="id"
|
|
||||||
style={{ height: "85%" }}
|
|
||||||
dataSource={appt}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DashboardScheduledInTodayGql = `
|
|
||||||
scheduled_in_today: appointments(where: {start: {_gte: "${moment()
|
|
||||||
.startOf("day")
|
|
||||||
.toISOString()}", _lte: "${moment()
|
|
||||||
.endOf("day")
|
|
||||||
.toISOString()}"}, canceled: {_eq: false}, block: {_neq: true}}) {
|
|
||||||
canceled
|
|
||||||
id
|
|
||||||
job {
|
|
||||||
alt_transport
|
|
||||||
clm_no
|
|
||||||
jobid: id
|
|
||||||
ins_co_nm
|
|
||||||
iouparent
|
|
||||||
ownerid
|
|
||||||
ownr_co_nm
|
|
||||||
ownr_ea
|
|
||||||
ownr_fn
|
|
||||||
ownr_ln
|
|
||||||
ownr_ph1
|
|
||||||
ownr_ph2
|
|
||||||
production_vars
|
|
||||||
ro_number
|
|
||||||
suspended
|
|
||||||
v_make_desc
|
|
||||||
v_model_desc
|
|
||||||
v_model_yr
|
|
||||||
v_vin
|
|
||||||
vehicleid
|
|
||||||
}
|
|
||||||
note
|
|
||||||
start
|
|
||||||
title
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
import {
|
|
||||||
BranchesOutlined,
|
|
||||||
ExclamationCircleFilled,
|
|
||||||
PauseCircleOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
import { Card, Space, Table, Tooltip } from "antd";
|
|
||||||
import moment from "moment";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import ChatOpenButton from "../../chat-open-button/chat-open-button.component";
|
|
||||||
import OwnerNameDisplay from "../../owner-name-display/owner-name-display.component";
|
|
||||||
import DashboardRefreshRequired from "../refresh-required.component";
|
|
||||||
|
|
||||||
export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [state, setState] = useState({
|
|
||||||
sortedInfo: {},
|
|
||||||
});
|
|
||||||
if (!data) return null;
|
|
||||||
if (!data.scheduled_out_today)
|
|
||||||
return <DashboardRefreshRequired {...cardProps} />;
|
|
||||||
|
|
||||||
data.scheduled_out_today.forEach((item) => {
|
|
||||||
item.scheduled_completion= moment(item.scheduled_completion).format("hh:mm a")
|
|
||||||
});
|
|
||||||
data.scheduled_out_today.sort(function (a, b) {
|
|
||||||
return new Date(a.scheduled_completion) - new Date(b.scheduled_completion);
|
|
||||||
});
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ro_number"),
|
|
||||||
dataIndex: "ro_number",
|
|
||||||
key: "ro_number",
|
|
||||||
render: (text, record) => (
|
|
||||||
<Link
|
|
||||||
to={"/manage/jobs/" + record.jobid}
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
<Space>
|
|
||||||
{record.ro_number || t("general.labels.na")}
|
|
||||||
{record.production_vars && record.production_vars.alert ? (
|
|
||||||
<ExclamationCircleFilled className="production-alert" />
|
|
||||||
) : null}
|
|
||||||
{record.suspended && (
|
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
|
||||||
)}
|
|
||||||
{record.iouparent && (
|
|
||||||
<Tooltip title={t("jobs.labels.iou")}>
|
|
||||||
<BranchesOutlined style={{ color: "orangered" }} />
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.owner"),
|
|
||||||
dataIndex: "owner",
|
|
||||||
key: "owner",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => {
|
|
||||||
return record.ownerid ? (
|
|
||||||
<Link
|
|
||||||
to={"/manage/owners/" + record.ownerid}
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ownr_ph1"),
|
|
||||||
dataIndex: "ownr_ph1",
|
|
||||||
key: "ownr_ph1",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.jobid} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ownr_ph2"),
|
|
||||||
dataIndex: "ownr_ph2",
|
|
||||||
key: "ownr_ph2",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.jobid} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ownr_ea"),
|
|
||||||
dataIndex: "ownr_ea",
|
|
||||||
key: "ownr_ea",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ea} jobid={record.jobid} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.vehicle"),
|
|
||||||
dataIndex: "vehicle",
|
|
||||||
key: "vehicle",
|
|
||||||
ellipsis: true,
|
|
||||||
render: (text, record) => {
|
|
||||||
return record.vehicleid ? (
|
|
||||||
<Link
|
|
||||||
to={"/manage/vehicles/" + record.vehicleid}
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
|
||||||
record.v_model_desc || ""
|
|
||||||
}`}
|
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
|
||||||
record.v_model_desc || ""
|
|
||||||
}`}</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.ins_co_nm"),
|
|
||||||
dataIndex: "ins_co_nm",
|
|
||||||
key: "ins_co_nm",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("jobs.fields.scheduled_completion"),
|
|
||||||
dataIndex: "scheduled_completion",
|
|
||||||
key: "scheduled_completion",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("appointments.fields.alt_transport"),
|
|
||||||
dataIndex: "alt_transport",
|
|
||||||
key: "alt_transport",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleTableChange = (sorter) => {
|
|
||||||
setState({ ...state, sortedInfo: sorter });
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
title={t("dashboard.titles.scheduledouttoday", {
|
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
|
||||||
})}
|
|
||||||
{...cardProps}
|
|
||||||
>
|
|
||||||
<div style={{ height: "100%" }}>
|
|
||||||
<Table
|
|
||||||
onChange={handleTableChange}
|
|
||||||
pagination={{ position: "top", defaultPageSize: 50 }}
|
|
||||||
columns={columns}
|
|
||||||
scroll={{ x: true, y: "calc(100% - 2em)" }}
|
|
||||||
rowKey="id"
|
|
||||||
style={{ height: "85%" }}
|
|
||||||
dataSource={data.scheduled_out_today}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DashboardScheduledOutTodayGql = `
|
|
||||||
scheduled_out_today: jobs(where: {
|
|
||||||
date_invoiced: {_is_null: true},
|
|
||||||
ro_number: {_is_null: false},
|
|
||||||
voided: {_eq: false},
|
|
||||||
scheduled_completion: {_gte: "${moment().startOf("day").toISOString()}",
|
|
||||||
_lte: "${moment().endOf("day").toISOString()}"}}) {
|
|
||||||
alt_transport
|
|
||||||
clm_no
|
|
||||||
jobid: id
|
|
||||||
ins_co_nm
|
|
||||||
iouparent
|
|
||||||
ownerid
|
|
||||||
ownr_co_nm
|
|
||||||
ownr_ea
|
|
||||||
ownr_fn
|
|
||||||
ownr_ln
|
|
||||||
ownr_ph1
|
|
||||||
ownr_ph2
|
|
||||||
production_vars
|
|
||||||
ro_number
|
|
||||||
scheduled_completion
|
|
||||||
suspended
|
|
||||||
v_make_desc
|
|
||||||
v_model_desc
|
|
||||||
v_model_yr
|
|
||||||
v_vin
|
|
||||||
vehicleid
|
|
||||||
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import Icon, { SyncOutlined } from "@ant-design/icons";
|
import Icon, { SyncOutlined } from "@ant-design/icons";
|
||||||
import { gql, useMutation, useQuery } from "@apollo/client";
|
import { gql, useMutation, useQuery } from "@apollo/client";
|
||||||
import { Button, Dropdown, Menu, PageHeader, Space, notification } from "antd";
|
import { PageHeader } from '@ant-design/pro-layout';
|
||||||
|
import { Button, Dropdown, Menu, notification, Space } from "antd";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -37,12 +38,6 @@ import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
|||||||
//Combination of the following:
|
//Combination of the following:
|
||||||
// /node_modules/react-grid-layout/css/styles.css
|
// /node_modules/react-grid-layout/css/styles.css
|
||||||
// /node_modules/react-resizable/css/styles.css
|
// /node_modules/react-resizable/css/styles.css
|
||||||
import DashboardScheduledInToday, {
|
|
||||||
DashboardScheduledInTodayGql,
|
|
||||||
} from "../dashboard-components/scheduled-in-today/scheduled-in-today.component";
|
|
||||||
import DashboardScheduledOutToday, {
|
|
||||||
DashboardScheduledOutTodayGql,
|
|
||||||
} from "../dashboard-components/scheduled-out-today/scheduled-out-today.component";
|
|
||||||
import "./dashboard-grid.styles.scss";
|
import "./dashboard-grid.styles.scss";
|
||||||
import { GenerateDashboardData } from "./dashboard-grid.utils";
|
import { GenerateDashboardData } from "./dashboard-grid.utils";
|
||||||
|
|
||||||
@@ -123,17 +118,15 @@ export function DashboardGridComponent({ currentUser, bodyshop }) {
|
|||||||
);
|
);
|
||||||
const existingLayoutKeys = state.items.map((i) => i.i);
|
const existingLayoutKeys = state.items.map((i) => i.i);
|
||||||
const addComponentOverlay = (
|
const addComponentOverlay = (
|
||||||
<Menu onClick={handleAddComponent}>
|
<Menu
|
||||||
{Object.keys(componentList).map((key) => (
|
onClick={handleAddComponent}
|
||||||
<Menu.Item
|
items={Object.keys(componentList).map((key) => ({
|
||||||
key={key}
|
key: key,
|
||||||
value={key}
|
value: key,
|
||||||
disabled={existingLayoutKeys.includes(key)}
|
disabled: existingLayoutKeys.includes(key),
|
||||||
>
|
label: componentList[key].label,
|
||||||
{componentList[key].label}
|
}))}
|
||||||
</Menu.Item>
|
></Menu>
|
||||||
))}
|
|
||||||
</Menu>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
@@ -274,28 +267,6 @@ const componentList = {
|
|||||||
w: 2,
|
w: 2,
|
||||||
h: 2,
|
h: 2,
|
||||||
},
|
},
|
||||||
ScheduleInToday: {
|
|
||||||
label: i18next.t("dashboard.titles.scheduledintoday", {
|
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
|
||||||
}),
|
|
||||||
component: DashboardScheduledInToday,
|
|
||||||
gqlFragment: DashboardScheduledInTodayGql,
|
|
||||||
minW: 10,
|
|
||||||
minH: 2,
|
|
||||||
w: 10,
|
|
||||||
h: 2,
|
|
||||||
},
|
|
||||||
ScheduleOutToday: {
|
|
||||||
label: i18next.t("dashboard.titles.scheduledouttoday", {
|
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
|
||||||
}),
|
|
||||||
component: DashboardScheduledOutToday,
|
|
||||||
gqlFragment: DashboardScheduledOutTodayGql,
|
|
||||||
minW: 10,
|
|
||||||
minH: 2,
|
|
||||||
w: 10,
|
|
||||||
h: 2,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createDashboardQuery = (state) => {
|
const createDashboardQuery = (state) => {
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ export default function DataLabel({
|
|||||||
vertical,
|
vertical,
|
||||||
visible = true,
|
visible = true,
|
||||||
valueStyle = {},
|
valueStyle = {},
|
||||||
valueClassName,
|
|
||||||
onValueClick,
|
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
if (!visible || (hideIfNull && !!!children)) return null;
|
if (!visible || (hideIfNull && !!!children)) return null;
|
||||||
@@ -18,7 +16,7 @@ export default function DataLabel({
|
|||||||
<div {...props} style={{ display: "flex" }}>
|
<div {...props} style={{ display: "flex" }}>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
// flex: 2,
|
flex: 2,
|
||||||
marginRight: ".2rem",
|
marginRight: ".2rem",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -30,10 +28,7 @@ export default function DataLabel({
|
|||||||
marginLeft: ".3rem",
|
marginLeft: ".3rem",
|
||||||
fontWeight: "bolder",
|
fontWeight: "bolder",
|
||||||
wordWrap: "break-word",
|
wordWrap: "break-word",
|
||||||
cursor: onValueClick !== undefined ? "pointer" : "",
|
|
||||||
}}
|
}}
|
||||||
className={valueClassName}
|
|
||||||
onClick={onValueClick}
|
|
||||||
>
|
>
|
||||||
{typeof children === "string" ? (
|
{typeof children === "string" ? (
|
||||||
<Typography.Text style={valueStyle}>{children}</Typography.Text>
|
<Typography.Text style={valueStyle}>{children}</Typography.Text>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export function DmsAllocationsSummaryAp({ socket, bodyshop, billids, title }) {
|
|||||||
key: "status",
|
key: "status",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("bills.fields.invoice_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: ["Posting", "Reference"],
|
dataIndex: ["Posting", "Reference"],
|
||||||
key: "reference",
|
key: "reference",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export function DmsCdkVehicles({ bodyshop, form, socket, job }) {
|
|||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
width={"90%"}
|
width={"90%"}
|
||||||
visible={visible}
|
open={visible}
|
||||||
onCancel={() => setVisible(false)}
|
onCancel={() => setVisible(false)}
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
|
|||||||
@@ -6,13 +6,10 @@ import {
|
|||||||
Dropdown,
|
Dropdown,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
InputNumber,
|
InputNumber, Select,
|
||||||
Menu,
|
|
||||||
Select,
|
|
||||||
Space,
|
Space,
|
||||||
Statistic,
|
Statistic,
|
||||||
Switch,
|
Typography
|
||||||
Typography,
|
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -184,20 +181,6 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
|||||||
<Space>
|
<Space>
|
||||||
<DmsCdkMakes form={form} socket={socket} job={job} />
|
<DmsCdkMakes form={form} socket={socket} job={job} />
|
||||||
<DmsCdkMakesRefetch />
|
<DmsCdkMakesRefetch />
|
||||||
<Form.Item
|
|
||||||
name="dms_unsold"
|
|
||||||
label={t("jobs.fields.dms.dms_unsold")}
|
|
||||||
initialValue={false}
|
|
||||||
>
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
name="dms_model_override"
|
|
||||||
label={t("jobs.fields.dms.dms_model_override")}
|
|
||||||
initialValue={false}
|
|
||||||
>
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -292,36 +275,32 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
|||||||
<div>
|
<div>
|
||||||
{t("jobs.fields.dms.payer.controlnumber")}{" "}
|
{t("jobs.fields.dms.payer.controlnumber")}{" "}
|
||||||
<Dropdown
|
<Dropdown
|
||||||
overlay={
|
menu={{
|
||||||
<Menu>
|
items:
|
||||||
{bodyshop.cdk_configuration.controllist &&
|
bodyshop.cdk_configuration.controllist &&
|
||||||
bodyshop.cdk_configuration.controllist.map(
|
bodyshop.cdk_configuration.controllist.map(
|
||||||
(key, idx) => (
|
(key, idx) => ({
|
||||||
<Menu.Item
|
key: idx,
|
||||||
key={idx}
|
label: key.name,
|
||||||
onClick={() => {
|
onClick: () => {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
payers: form
|
payers: form
|
||||||
.getFieldValue("payers")
|
.getFieldValue("payers")
|
||||||
.map((row, mapIndex) => {
|
.map((row, mapIndex) => {
|
||||||
if (index !== mapIndex)
|
if (index !== mapIndex)
|
||||||
return row;
|
return row;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
controlnumber:
|
controlnumber:
|
||||||
key.controlnumber,
|
key.controlnumber,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}}
|
},
|
||||||
>
|
})
|
||||||
{key.name}
|
),
|
||||||
</Menu.Item>
|
}}
|
||||||
)
|
|
||||||
)}
|
|
||||||
</Menu>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<a href=" #" onClick={(e) => e.preventDefault()}>
|
<a href=" #" onClick={(e) => e.preventDefault()}>
|
||||||
<DownOutlined />
|
<DownOutlined />
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
import { UploadOutlined, UserAddOutlined } from "@ant-design/icons";
|
import { UploadOutlined, UserAddOutlined } from "@ant-design/icons";
|
||||||
import {
|
import {
|
||||||
Button,
|
|
||||||
Divider,
|
Divider,
|
||||||
Dropdown,
|
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
Menu,
|
|
||||||
Select,
|
Select,
|
||||||
Space,
|
|
||||||
Tabs,
|
Tabs,
|
||||||
Upload,
|
Upload,
|
||||||
|
Space,
|
||||||
|
Menu,
|
||||||
|
Dropdown,
|
||||||
|
Button,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import _ from "lodash";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import EmailDocumentsComponent from "../email-documents/email-documents.component";
|
||||||
|
import _ from "lodash";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectEmailConfig } from "../../redux/email/email.selectors";
|
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import { CreateExplorerLinkForJob } from "../../utils/localmedia";
|
import { CreateExplorerLinkForJob } from "../../utils/localmedia";
|
||||||
import EmailDocumentsComponent from "../email-documents/email-documents.component";
|
import { selectEmailConfig } from "../../redux/email/email.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -54,51 +54,26 @@ export function EmailOverlayComponent({
|
|||||||
]),
|
]),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handle_CC_Click = ({ item, key, keyPath }) => {
|
|
||||||
const email = item.props.value;
|
|
||||||
form.setFieldsValue({
|
|
||||||
cc: _.uniq([
|
|
||||||
...(form.getFieldValue("cc") || ""),
|
|
||||||
...(typeof email === "string" ? [email] : email),
|
|
||||||
]),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
<div>
|
<div>
|
||||||
<Menu onClick={handleClick}>
|
<Menu
|
||||||
{bodyshop.employees
|
onClick={handleClick}
|
||||||
.filter((e) => e.user_email)
|
items={[
|
||||||
.map((e, idx) => (
|
...bodyshop.employees
|
||||||
<Menu.Item value={e.user_email} key={idx}>
|
.filter((e) => e.user_email)
|
||||||
{`${e.first_name} ${e.last_name}`}
|
.map((e, idx) => ({
|
||||||
</Menu.Item>
|
value: e.user_email,
|
||||||
))}
|
key: idx,
|
||||||
{bodyshop.md_to_emails.map((e, idx) => (
|
label: `${e.first_name} ${e.last_name}`,
|
||||||
<Menu.Item value={e.emails} key={idx + "group"}>
|
})),
|
||||||
{e.label}
|
...bodyshop.md_to_emails.map((e, idx) => ({
|
||||||
</Menu.Item>
|
value: e.emails,
|
||||||
))}
|
key: idx + "group",
|
||||||
</Menu>
|
label: e.label,
|
||||||
</div>
|
})),
|
||||||
);
|
]}
|
||||||
|
/>
|
||||||
const menuCC = (
|
|
||||||
<div>
|
|
||||||
<Menu onClick={handle_CC_Click}>
|
|
||||||
{bodyshop.employees
|
|
||||||
.filter((e) => e.user_email)
|
|
||||||
.map((e, idx) => (
|
|
||||||
<Menu.Item value={e.user_email} key={idx}>
|
|
||||||
{`${e.first_name} ${e.last_name}`}
|
|
||||||
</Menu.Item>
|
|
||||||
))}
|
|
||||||
{bodyshop.md_to_emails.map((e, idx) => (
|
|
||||||
<Menu.Item value={e.emails} key={idx + "group"}>
|
|
||||||
{e.label}
|
|
||||||
</Menu.Item>
|
|
||||||
))}
|
|
||||||
</Menu>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -150,23 +125,7 @@ export function EmailOverlayComponent({
|
|||||||
>
|
>
|
||||||
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("emails.fields.cc")} name="cc">
|
||||||
label={
|
|
||||||
<Space>
|
|
||||||
{t("emails.fields.cc")}
|
|
||||||
<Dropdown overlay={menuCC}>
|
|
||||||
<a
|
|
||||||
className="ant-dropdown-link"
|
|
||||||
href=" #"
|
|
||||||
onClick={(e) => e.preventDefault()}
|
|
||||||
>
|
|
||||||
<UserAddOutlined />
|
|
||||||
</a>
|
|
||||||
</Dropdown>
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
name="cc"
|
|
||||||
>
|
|
||||||
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export function EmailOverlayContainer({
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
],
|
],
|
||||||
media: selectedMedia.filter((m) => m.isSelected).map((m) => m.fullsize),
|
media: selectedMedia.filter((m) => m.isSelected).map((m) => m.src),
|
||||||
//attachments,
|
//attachments,
|
||||||
});
|
});
|
||||||
notification["success"]({ message: t("emails.successes.sent") });
|
notification["success"]({ message: t("emails.successes.sent") });
|
||||||
@@ -174,7 +174,7 @@ export function EmailOverlayContainer({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
visible={modalVisible}
|
open={modalVisible}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
width={"80%"}
|
width={"80%"}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ const FormInputNUmberCalculator = (
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Popover content={popContent} visible={history.length > 0}>
|
<Popover content={popContent} open={history.length > 0}>
|
||||||
<InputNumber
|
<InputNumber
|
||||||
ref={ref}
|
ref={ref}
|
||||||
value={value}
|
value={value}
|
||||||
|
|||||||
@@ -1,217 +0,0 @@
|
|||||||
import { AutoComplete, Divider, Input, Space } from "antd";
|
|
||||||
import axios from "axios";
|
|
||||||
import _ from "lodash";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { Link, useHistory } from "react-router-dom";
|
|
||||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
|
||||||
import OwnerNameDisplay, {
|
|
||||||
OwnerNameDisplayFunction,
|
|
||||||
} from "../owner-name-display/owner-name-display.component";
|
|
||||||
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
|
||||||
|
|
||||||
export default function GlobalSearchOs() {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const history = useHistory();
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
const [data, setData] = useState(false);
|
|
||||||
|
|
||||||
const executeSearch = async (v) => {
|
|
||||||
if (v && v && v !== "" && v.length >= 3) {
|
|
||||||
try {
|
|
||||||
setLoading(true);
|
|
||||||
const searchData = await axios.post("/search", {
|
|
||||||
search: v,
|
|
||||||
});
|
|
||||||
|
|
||||||
const resultsByType = {
|
|
||||||
payments: [],
|
|
||||||
jobs: [],
|
|
||||||
bills: [],
|
|
||||||
owners: [],
|
|
||||||
vehicles: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
searchData.data.hits.hits.forEach((hit) => {
|
|
||||||
resultsByType[hit._index].push(hit._source);
|
|
||||||
});
|
|
||||||
setData([
|
|
||||||
{
|
|
||||||
label: renderTitle(t("menus.header.search.jobs")),
|
|
||||||
options: resultsByType.jobs.map((job) => {
|
|
||||||
return {
|
|
||||||
key: job.id,
|
|
||||||
value: job.ro_number || "N/A",
|
|
||||||
label: (
|
|
||||||
<Link to={`/manage/jobs/${job.id}`}>
|
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
|
||||||
<strong>{job.ro_number || t("general.labels.na")}</strong>
|
|
||||||
<span>{`${job.status || ""}`}</span>
|
|
||||||
<span>
|
|
||||||
<OwnerNameDisplay ownerObject={job} />
|
|
||||||
</span>
|
|
||||||
<span>{`${job.v_model_yr || ""} ${
|
|
||||||
job.v_make_desc || ""
|
|
||||||
} ${job.v_model_desc || ""}`}</span>
|
|
||||||
<span>{`${job.clm_no || ""}`}</span>
|
|
||||||
<span>{`${job.plate_no || ""}`}</span>
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: renderTitle(t("menus.header.search.owners")),
|
|
||||||
options: resultsByType.owners.map((owner) => {
|
|
||||||
return {
|
|
||||||
key: owner.id,
|
|
||||||
value: OwnerNameDisplayFunction(owner),
|
|
||||||
label: (
|
|
||||||
<Link to={`/manage/owners/${owner.id}`}>
|
|
||||||
<Space
|
|
||||||
size="small"
|
|
||||||
split={<Divider type="vertical" />}
|
|
||||||
wrap
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
<OwnerNameDisplay ownerObject={owner} />
|
|
||||||
</span>
|
|
||||||
<PhoneNumberFormatter>
|
|
||||||
{owner.ownr_ph1}
|
|
||||||
</PhoneNumberFormatter>
|
|
||||||
<PhoneNumberFormatter>
|
|
||||||
{owner.ownr_ph2}
|
|
||||||
</PhoneNumberFormatter>
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: renderTitle(t("menus.header.search.vehicles")),
|
|
||||||
options: resultsByType.vehicles.map((vehicle) => {
|
|
||||||
return {
|
|
||||||
key: vehicle.id,
|
|
||||||
value: `${vehicle.v_model_yr || ""} ${
|
|
||||||
vehicle.v_make_desc || ""
|
|
||||||
} ${vehicle.v_model_desc || ""}`,
|
|
||||||
label: (
|
|
||||||
<Link to={`/manage/vehicles/${vehicle.id}`}>
|
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
|
||||||
<span>
|
|
||||||
{`${vehicle.v_model_yr || ""} ${
|
|
||||||
vehicle.v_make_desc || ""
|
|
||||||
} ${vehicle.v_model_desc || ""}`}
|
|
||||||
</span>
|
|
||||||
<span>{vehicle.plate_no || ""}</span>
|
|
||||||
<span>
|
|
||||||
<VehicleVinDisplay>
|
|
||||||
{vehicle.v_vin || ""}
|
|
||||||
</VehicleVinDisplay>
|
|
||||||
</span>
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: renderTitle(t("menus.header.search.payments")),
|
|
||||||
options: resultsByType.payments.map((payment) => {
|
|
||||||
return {
|
|
||||||
key: payment.id,
|
|
||||||
value: `${payment.job?.ro_number} ${payment.amount}`,
|
|
||||||
label: (
|
|
||||||
<Link to={`/manage/jobs/${payment.job?.id}`}>
|
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
|
||||||
<span>{payment.paymentnum}</span>
|
|
||||||
<span>{payment.job?.ro_number}</span>
|
|
||||||
<span>{payment.memo || ""}</span>
|
|
||||||
<span>{payment.amount || ""}</span>
|
|
||||||
<span>{payment.transactionid || ""}</span>
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: renderTitle(t("menus.header.search.bills")),
|
|
||||||
options: resultsByType.bills.map((bill) => {
|
|
||||||
return {
|
|
||||||
key: bill.id,
|
|
||||||
value: `${bill.invoice_number} - ${bill.vendor.name}`,
|
|
||||||
label: (
|
|
||||||
<Link to={`/manage/bills?billid=${bill.id}`}>
|
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
|
||||||
<span>{bill.invoice_number}</span>
|
|
||||||
<span>{bill.vendor.name}</span>
|
|
||||||
<span>{bill.date}</span>
|
|
||||||
</Space>
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// label: renderTitle(t("menus.header.search.phonebook")),
|
|
||||||
// options: resultsByType.search_phonebook.map((pb) => {
|
|
||||||
// return {
|
|
||||||
// key: pb.id,
|
|
||||||
// value: `${pb.firstname || ""} ${pb.lastname || ""} ${
|
|
||||||
// pb.company || ""
|
|
||||||
// }`,
|
|
||||||
// label: (
|
|
||||||
// <Link to={`/manage/phonebook?phonebookentry=${pb.id}`}>
|
|
||||||
// <Space size="small" split={<Divider type="vertical" />}>
|
|
||||||
// <span>{`${pb.firstname || ""} ${pb.lastname || ""} ${
|
|
||||||
// pb.company || ""
|
|
||||||
// }`}</span>
|
|
||||||
// <PhoneNumberFormatter>{pb.phone1}</PhoneNumberFormatter>
|
|
||||||
// <span>{pb.email}</span>
|
|
||||||
// </Space>
|
|
||||||
// </Link>
|
|
||||||
// ),
|
|
||||||
// };
|
|
||||||
// }),
|
|
||||||
// },
|
|
||||||
]);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("Error while fetching search results", error);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
|
||||||
debouncedExecuteSearch(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderTitle = (title) => {
|
|
||||||
return <span>{title}</span>;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AutoComplete
|
|
||||||
options={data}
|
|
||||||
onSearch={handleSearch}
|
|
||||||
defaultActiveFirstOption
|
|
||||||
onSelect={(val, opt) => {
|
|
||||||
history.push(opt.label.props.to);
|
|
||||||
}}
|
|
||||||
onClear={() => setData([])}
|
|
||||||
>
|
|
||||||
<Input.Search
|
|
||||||
size="large"
|
|
||||||
placeholder={t("general.labels.globalsearch")}
|
|
||||||
enterButton
|
|
||||||
allowClear
|
|
||||||
loading={loading}
|
|
||||||
/>
|
|
||||||
</AutoComplete>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useLazyQuery } from "@apollo/client";
|
import { useLazyQuery } from "@apollo/client";
|
||||||
import { AutoComplete, Divider, Input, Space } from "antd";
|
import { LoadingOutlined } from "@ant-design/icons";
|
||||||
|
import { AutoComplete, Divider, Space } 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";
|
||||||
@@ -18,18 +19,11 @@ export default function GlobalSearch() {
|
|||||||
useLazyQuery(GLOBAL_SEARCH_QUERY);
|
useLazyQuery(GLOBAL_SEARCH_QUERY);
|
||||||
|
|
||||||
const executeSearch = (v) => {
|
const executeSearch = (v) => {
|
||||||
if (
|
if (v && v.variables.search && v.variables.search !== "") callSearch(v);
|
||||||
v &&
|
|
||||||
v.variables.search &&
|
|
||||||
v.variables.search !== "" &&
|
|
||||||
v.variables.search.length >= 3
|
|
||||||
)
|
|
||||||
callSearch(v);
|
|
||||||
};
|
};
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
const handleSearch = (value) => {
|
||||||
console.log("Handle Search");
|
|
||||||
debouncedExecuteSearch({ variables: { search: value } });
|
debouncedExecuteSearch({ variables: { search: value } });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,7 +38,7 @@ export default function GlobalSearch() {
|
|||||||
options: data.search_jobs.map((job) => {
|
options: data.search_jobs.map((job) => {
|
||||||
return {
|
return {
|
||||||
key: job.id,
|
key: job.id,
|
||||||
value: job.ro_number || "N/A",
|
value: job.ro_number,
|
||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/jobs/${job.id}`}>
|
<Link to={`/manage/jobs/${job.id}`}>
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
<Space size="small" split={<Divider type="vertical" />}>
|
||||||
@@ -184,18 +178,13 @@ export default function GlobalSearch() {
|
|||||||
<AutoComplete
|
<AutoComplete
|
||||||
options={options}
|
options={options}
|
||||||
onSearch={handleSearch}
|
onSearch={handleSearch}
|
||||||
|
suffixIcon={loading && <LoadingOutlined spin />}
|
||||||
defaultActiveFirstOption
|
defaultActiveFirstOption
|
||||||
|
placeholder={t("general.labels.globalsearch")}
|
||||||
|
allowClear
|
||||||
onSelect={(val, opt) => {
|
onSelect={(val, opt) => {
|
||||||
history.push(opt.label.props.to);
|
history.push(opt.label.props.to);
|
||||||
}}
|
}}
|
||||||
>
|
></AutoComplete>
|
||||||
<Input.Search
|
|
||||||
size="large"
|
|
||||||
placeholder={t("general.labels.globalsearch")}
|
|
||||||
enterButton
|
|
||||||
allowClear
|
|
||||||
loading={loading}
|
|
||||||
/>
|
|
||||||
</AutoComplete>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import Icon, {
|
import Icon, {
|
||||||
BankFilled,
|
BankFilled,
|
||||||
BarChartOutlined,
|
BarChartOutlined,
|
||||||
CarFilled,
|
CarFilled,
|
||||||
CheckCircleOutlined,
|
|
||||||
ClockCircleFilled,
|
ClockCircleFilled,
|
||||||
|
CheckCircleOutlined,
|
||||||
DashboardFilled,
|
DashboardFilled,
|
||||||
DollarCircleFilled,
|
DollarCircleFilled,
|
||||||
ExportOutlined,
|
ExportOutlined,
|
||||||
@@ -25,7 +26,6 @@ import Icon, {
|
|||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
import { Layout, Menu } from "antd";
|
import { Layout, Menu } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -70,8 +70,6 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
setReportCenterContext: (context) =>
|
setReportCenterContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "reportCenter" })),
|
dispatch(setModalContext({ context: context, modal: "reportCenter" })),
|
||||||
signOutStart: () => dispatch(signOutStart()),
|
signOutStart: () => dispatch(signOutStart()),
|
||||||
setCardPaymentContext: (context) =>
|
|
||||||
dispatch(setModalContext({ context: context, modal: "cardPayment" })),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function Header({
|
function Header({
|
||||||
@@ -85,7 +83,6 @@ function Header({
|
|||||||
setPaymentContext,
|
setPaymentContext,
|
||||||
setReportCenterContext,
|
setReportCenterContext,
|
||||||
recentItems,
|
recentItems,
|
||||||
setCardPaymentContext,
|
|
||||||
}) {
|
}) {
|
||||||
const { Simple_Inventory } = useTreatments(
|
const { Simple_Inventory } = useTreatments(
|
||||||
["Simple_Inventory"],
|
["Simple_Inventory"],
|
||||||
@@ -97,11 +94,6 @@ function Header({
|
|||||||
{},
|
{},
|
||||||
bodyshop && bodyshop.imexshopid
|
bodyshop && bodyshop.imexshopid
|
||||||
);
|
);
|
||||||
const { ImEXPay } = useTreatments(
|
|
||||||
["ImEXPay"],
|
|
||||||
{},
|
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -114,324 +106,428 @@ function Header({
|
|||||||
selectedKeys={[selectedHeader]}
|
selectedKeys={[selectedHeader]}
|
||||||
onClick={handleMenuClick}
|
onClick={handleMenuClick}
|
||||||
subMenuCloseDelay={0.3}
|
subMenuCloseDelay={0.3}
|
||||||
>
|
items={[
|
||||||
<Menu.Item key="home" icon={<HomeFilled />}>
|
|
||||||
<Link to="/manage">{t("menus.header.home")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="schedule" icon={<Icon component={FaCalendarAlt} />}>
|
|
||||||
<Link to="/manage/schedule">{t("menus.header.schedule")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="jobssubmenu"
|
|
||||||
icon={<Icon component={FaCarCrash} />}
|
|
||||||
title={t("menus.header.jobs")}
|
|
||||||
>
|
|
||||||
<Menu.Item key="activejobs" icon={<FileFilled />}>
|
|
||||||
<Link to="/manage/jobs">{t("menus.header.activejobs")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="readyjobs" icon={<CheckCircleOutlined />}>
|
|
||||||
<Link to="/manage/jobs/ready">{t("menus.header.readyjobs")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="parts-queue" icon={<ToolFilled />}>
|
|
||||||
<Link to="/manage/partsqueue">{t("menus.header.parts-queue")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="availablejobs" icon={<ImportOutlined />}>
|
|
||||||
<Link to="/manage/available">
|
|
||||||
{t("menus.header.availablejobs")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="newjob" icon={<FileAddOutlined />}>
|
|
||||||
<Link to="/manage/jobs/new">{t("menus.header.newjob")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Divider key="div1" />
|
|
||||||
<Menu.Item key="alljobs" icon={<UnorderedListOutlined />}>
|
|
||||||
<Link to="/manage/jobs/all">{t("menus.header.alljobs")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Divider key="div2" />
|
|
||||||
<Menu.Item key="productionlist" icon={<ScheduleOutlined />}>
|
|
||||||
<Link to="/manage/production/list">
|
|
||||||
{t("menus.header.productionlist")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="productionboard" icon={<Icon component={BsKanban} />}>
|
|
||||||
<Link to="/manage/production/board">
|
|
||||||
{t("menus.header.productionboard")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Divider key="div3" />
|
|
||||||
<Menu.Item key="scoreboard" icon={<LineChartOutlined />}>
|
|
||||||
<Link to="/manage/scoreboard">{t("menus.header.scoreboard")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
</Menu.SubMenu>
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="customers"
|
|
||||||
icon={<UserOutlined />}
|
|
||||||
title={t("menus.header.customers")}
|
|
||||||
>
|
|
||||||
<Menu.Item key="owners" icon={<TeamOutlined />}>
|
|
||||||
<Link to="/manage/owners">{t("menus.header.owners")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="vehicles" icon={<CarFilled />}>
|
|
||||||
<Link to="/manage/vehicles">{t("menus.header.vehicles")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
</Menu.SubMenu>
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="ccs"
|
|
||||||
icon={<CarFilled />}
|
|
||||||
title={t("menus.header.courtesycars")}
|
|
||||||
>
|
|
||||||
<Menu.Item key="courtesycarsall" icon={<CarFilled />}>
|
|
||||||
<Link to="/manage/courtesycars">
|
|
||||||
{t("menus.header.courtesycars-all")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="contracts" icon={<FileFilled />}>
|
|
||||||
<Link to="/manage/courtesycars/contracts">
|
|
||||||
{t("menus.header.courtesycars-contracts")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="newcontract" icon={<FileAddFilled />}>
|
|
||||||
<Link to="/manage/courtesycars/contracts/new">
|
|
||||||
{t("menus.header.courtesycars-newcontract")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
</Menu.SubMenu>
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="accounting"
|
|
||||||
icon={<DollarCircleFilled />}
|
|
||||||
title={t("menus.header.accounting")}
|
|
||||||
>
|
|
||||||
<Menu.Item
|
|
||||||
key="bills"
|
|
||||||
icon={<Icon component={FaFileInvoiceDollar} />}
|
|
||||||
>
|
|
||||||
<Link to="/manage/bills">{t("menus.header.bills")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="enterbills"
|
|
||||||
icon={<Icon component={GiPayMoney} />}
|
|
||||||
onClick={() => {
|
|
||||||
setBillEnterContext({
|
|
||||||
actions: {},
|
|
||||||
context: {},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("menus.header.enterbills")}
|
|
||||||
</Menu.Item>
|
|
||||||
{Simple_Inventory.treatment === "on" && (
|
|
||||||
<>
|
|
||||||
<Menu.Divider key="div4" />
|
|
||||||
<Menu.Item
|
|
||||||
key="inventory"
|
|
||||||
icon={<Icon component={FaFileInvoiceDollar} />}
|
|
||||||
>
|
|
||||||
<Link to="/manage/inventory">
|
|
||||||
{t("menus.header.inventory")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Menu.Divider key="div7" />
|
|
||||||
<Menu.Item key="allpayments" icon={<BankFilled />}>
|
|
||||||
<Link to="/manage/payments">{t("menus.header.allpayments")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="enterpayments"
|
|
||||||
onClick={() => {
|
|
||||||
setPaymentContext({
|
|
||||||
actions: {},
|
|
||||||
context: null,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
icon={<Icon component={FaCreditCard} />}
|
|
||||||
>
|
|
||||||
{t("menus.header.enterpayment")}
|
|
||||||
</Menu.Item>
|
|
||||||
{ImEXPay.treatment === "on" && (
|
|
||||||
<Menu.Item
|
|
||||||
key="entercardpayments"
|
|
||||||
onClick={() => {
|
|
||||||
setCardPaymentContext({
|
|
||||||
actions: {},
|
|
||||||
context: {},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
icon={<Icon component={FaCreditCard} />}
|
|
||||||
>
|
|
||||||
{t("menus.header.entercardpayment")}
|
|
||||||
</Menu.Item>
|
|
||||||
)}
|
|
||||||
<Menu.Divider key="div5" />
|
|
||||||
<Menu.Item key="timetickets" icon={<FieldTimeOutlined />}>
|
|
||||||
<Link to="/manage/timetickets">
|
|
||||||
{t("menus.header.timetickets")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="entertimetickets"
|
|
||||||
icon={<Icon component={GiPlayerTime} />}
|
|
||||||
onClick={() => {
|
|
||||||
setTimeTicketContext({
|
|
||||||
actions: {},
|
|
||||||
context: {
|
|
||||||
created_by: currentUser.displayName
|
|
||||||
? currentUser.email.concat(" | ", currentUser.displayName)
|
|
||||||
: currentUser.email,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("menus.header.entertimeticket")}
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Divider key="div6" />
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="accountingexport"
|
|
||||||
title={t("menus.header.export")}
|
|
||||||
icon={<ExportOutlined />}
|
|
||||||
>
|
|
||||||
<Menu.Item key="receivables">
|
|
||||||
<Link to="/manage/accounting/receivables">
|
|
||||||
{t("menus.header.accounting-receivables")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
{(!(
|
|
||||||
(bodyshop && bodyshop.cdk_dealerid) ||
|
|
||||||
(bodyshop && bodyshop.pbs_serialnumber)
|
|
||||||
) ||
|
|
||||||
DmsAp.treatment === "on") && (
|
|
||||||
<Menu.Item key="payables">
|
|
||||||
<Link to="/manage/accounting/payables">
|
|
||||||
{t("menus.header.accounting-payables")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
)}
|
|
||||||
{!(
|
|
||||||
(bodyshop && bodyshop.cdk_dealerid) ||
|
|
||||||
(bodyshop && bodyshop.pbs_serialnumber)
|
|
||||||
) && (
|
|
||||||
<Menu.Item key="payments">
|
|
||||||
<Link to="/manage/accounting/payments">
|
|
||||||
{t("menus.header.accounting-payments")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
)}
|
|
||||||
<Menu.Item key="export-logs">
|
|
||||||
<Link to="/manage/accounting/exportlogs">
|
|
||||||
{t("menus.header.export-logs")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
</Menu.SubMenu>
|
|
||||||
</Menu.SubMenu>
|
|
||||||
<Menu.Item key="phonebook" icon={<PhoneOutlined />}>
|
|
||||||
<Link to="/manage/phonebook">{t("menus.header.phonebook")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="temporarydocs" icon={<PaperClipOutlined />}>
|
|
||||||
<Link to="/manage/temporarydocs">
|
|
||||||
{t("menus.header.temporarydocs")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="shopsubmenu"
|
|
||||||
title={t("menus.header.shop")}
|
|
||||||
icon={<SettingOutlined />}
|
|
||||||
>
|
|
||||||
<Menu.Item key="shop" icon={<Icon component={GiSettingsKnobs} />}>
|
|
||||||
<Link to="/manage/shop?tab=info">
|
|
||||||
{t("menus.header.shop_config")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="dashboard" icon={<DashboardFilled />}>
|
|
||||||
<Link to="/manage/dashboard">{t("menus.header.dashboard")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="reportcenter"
|
|
||||||
icon={<BarChartOutlined />}
|
|
||||||
onClick={() => {
|
|
||||||
setReportCenterContext({
|
|
||||||
actions: {},
|
|
||||||
context: {},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("menus.header.reportcenter")}
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="shop-vendors"
|
|
||||||
icon={<Icon component={IoBusinessOutline} />}
|
|
||||||
>
|
|
||||||
<Link to="/manage/shop/vendors">
|
|
||||||
{t("menus.header.shop_vendors")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="shop-csi" icon={<Icon component={RiSurveyLine} />}>
|
|
||||||
<Link to="/manage/shop/csi">{t("menus.header.shop_csi")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
</Menu.SubMenu>
|
|
||||||
<Menu.SubMenu
|
|
||||||
key="user"
|
|
||||||
title={
|
|
||||||
currentUser.displayName ||
|
|
||||||
currentUser.email ||
|
|
||||||
t("general.labels.unknown")
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Menu.Item key="signout" danger onClick={() => signOutStart()}>
|
|
||||||
{t("user.actions.signout")}
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="help"
|
|
||||||
onClick={() => {
|
|
||||||
window.open("https://help.imex.online/", "_blank");
|
|
||||||
}}
|
|
||||||
icon={<Icon component={QuestionCircleFilled} />}
|
|
||||||
>
|
|
||||||
{t("menus.header.help")}
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
key="rescue"
|
|
||||||
onClick={() => {
|
|
||||||
window.open("https://imexrescue.com/", "_blank");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("menus.header.rescueme")}
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="shiftclock">
|
|
||||||
<Link to="/manage/shiftclock">{t("menus.header.shiftclock")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="profile">
|
|
||||||
<Link to="/manage/profile">{t("menus.currentuser.profile")}</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
{
|
{
|
||||||
// <Menu.SubMenu
|
key: "home",
|
||||||
// key="langselecter"
|
icon: <HomeFilled />,
|
||||||
// title={
|
label: <Link to="/manage">{t("menus.header.home")}</Link>,
|
||||||
// <span>
|
},
|
||||||
// <GlobalOutlined />
|
{
|
||||||
// <span>{t("menus.currentuser.languageselector")}</span>
|
key: "schedule",
|
||||||
// </span>
|
icon: <Icon component={FaCalendarAlt} />,
|
||||||
// }
|
label: (
|
||||||
// >
|
<Link to="/manage/schedule">{t("menus.header.schedule")}</Link>
|
||||||
// <Menu.Item actiontype="lang-select" key="en-US">
|
),
|
||||||
// {t("general.languages.english")}
|
},
|
||||||
// </Menu.Item>
|
{
|
||||||
// <Menu.Item actiontype="lang-select" key="fr-CA">
|
key: "jobssubmenu",
|
||||||
// {t("general.languages.french")}
|
icon: <Icon component={FaCarCrash} />,
|
||||||
// </Menu.Item>
|
label: t("menus.header.jobs"),
|
||||||
// <Menu.Item actiontype="lang-select" key="es-MX">
|
children: [
|
||||||
// {t("general.languages.spanish")}
|
{
|
||||||
// </Menu.Item>
|
key: "activejobs",
|
||||||
// </Menu.SubMenu>
|
icon: <FileFilled />,
|
||||||
}
|
label: (
|
||||||
</Menu.SubMenu>
|
<Link to="/manage/jobs">{t("menus.header.activejobs")}</Link>
|
||||||
<Menu.SubMenu key="recent" title={<ClockCircleFilled />}>
|
),
|
||||||
{recentItems.map((i, idx) => (
|
},
|
||||||
<Menu.Item key={idx}>
|
{
|
||||||
<Link to={i.url}>{i.label}</Link>
|
key: "readyjobs",
|
||||||
</Menu.Item>
|
icon: <CheckCircleOutlined />,
|
||||||
))}
|
label: (
|
||||||
</Menu.SubMenu>
|
<Link to="/manage/jobs/ready">
|
||||||
</Menu>
|
{t("menus.header.readyjobs")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "parts-queue",
|
||||||
|
icon: <ToolFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/partsqueue">
|
||||||
|
{t("menus.header.parts-queue")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "availablejobs",
|
||||||
|
icon: <ImportOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/available">
|
||||||
|
{t("menus.header.availablejobs")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "newjob",
|
||||||
|
icon: <FileAddOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/jobs/new">{t("menus.header.newjob")}</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ type: "divider" },
|
||||||
|
{
|
||||||
|
key: "alljobs",
|
||||||
|
icon: <UnorderedListOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/jobs/all">{t("menus.header.alljobs")}</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ type: "divider" },
|
||||||
|
{
|
||||||
|
key: "productionlist",
|
||||||
|
icon: <ScheduleOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/production/list">
|
||||||
|
{t("menus.header.productionlist")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "productionboard",
|
||||||
|
icon: <Icon component={BsKanban} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/production/board">
|
||||||
|
{t("menus.header.productionboard")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "divider",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "scoreboard",
|
||||||
|
icon: <LineChartOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/scoreboard">
|
||||||
|
{t("menus.header.scoreboard")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "customers",
|
||||||
|
icon: <UserOutlined />,
|
||||||
|
label: t("menus.header.customers"),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "owners",
|
||||||
|
icon: <TeamOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/owners">{t("menus.header.owners")}</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "vehicles",
|
||||||
|
icon: <CarFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/vehicles">
|
||||||
|
{t("menus.header.vehicles")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "ccs",
|
||||||
|
icon: <CarFilled />,
|
||||||
|
label: t("menus.header.courtesycars"),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "courtesycarsall",
|
||||||
|
icon: <CarFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/courtesycars">
|
||||||
|
{t("menus.header.courtesycars-all")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "contracts",
|
||||||
|
icon: <FileFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/courtesycars/contracts">
|
||||||
|
{t("menus.header.courtesycars-contracts")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "newcontract",
|
||||||
|
icon: <FileAddFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/courtesycars/contracts/new">
|
||||||
|
{t("menus.header.courtesycars-newcontract")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "accounting",
|
||||||
|
icon: <DollarCircleFilled />,
|
||||||
|
label: t("menus.header.accounting"),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "bills",
|
||||||
|
icon: <Icon component={FaFileInvoiceDollar} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/bills">{t("menus.header.bills")}</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "enterbills",
|
||||||
|
icon: <Icon component={GiPayMoney} />,
|
||||||
|
onClick: () => {
|
||||||
|
setBillEnterContext({
|
||||||
|
actions: {},
|
||||||
|
context: {},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
label: t("menus.header.enterbills"),
|
||||||
|
},
|
||||||
|
...(Simple_Inventory.treatment === "on"
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
type: "divider",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "inventory",
|
||||||
|
icon: <Icon component={FaFileInvoiceDollar} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/inventory">
|
||||||
|
{t("menus.header.inventory")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
{ type: "divider" },
|
||||||
|
{
|
||||||
|
key: "allpayments",
|
||||||
|
icon: <BankFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/payments">
|
||||||
|
{t("menus.header.allpayments")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "enterpayments",
|
||||||
|
onClick: () => {
|
||||||
|
setPaymentContext({
|
||||||
|
actions: {},
|
||||||
|
context: null,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: <Icon component={FaCreditCard} />,
|
||||||
|
label: t("menus.header.enterpayment"),
|
||||||
|
},
|
||||||
|
{ type: "divider" },
|
||||||
|
{
|
||||||
|
key: "timetickets",
|
||||||
|
icon: <FieldTimeOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/timetickets">
|
||||||
|
{t("menus.header.timetickets")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "entertimetickets",
|
||||||
|
icon: <Icon component={GiPlayerTime} />,
|
||||||
|
onClick: () => {
|
||||||
|
setTimeTicketContext({
|
||||||
|
actions: {},
|
||||||
|
context: {},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
label: t("menus.header.entertimeticket"),
|
||||||
|
},
|
||||||
|
{ type: "divider" },
|
||||||
|
{
|
||||||
|
key: "accountingexport",
|
||||||
|
icon: <ExportOutlined />,
|
||||||
|
|
||||||
|
label: t("menus.header.export"),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "receivables",
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/accounting/receivables">
|
||||||
|
{t("menus.header.accounting-receivables")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
...(!(
|
||||||
|
(bodyshop && bodyshop.cdk_dealerid) ||
|
||||||
|
(bodyshop && bodyshop.pbs_serialnumber)
|
||||||
|
) || DmsAp.treatment === "on"
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
key: "payables",
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/accounting/payables">
|
||||||
|
{t("menus.header.accounting-payables")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
|
||||||
|
...(!(
|
||||||
|
(bodyshop && bodyshop.cdk_dealerid) ||
|
||||||
|
(bodyshop && bodyshop.pbs_serialnumber)
|
||||||
|
)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
key: "payments",
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/accounting/payments">
|
||||||
|
{t("menus.header.accounting-payments")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
{
|
||||||
|
key: "export-logs",
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/accounting/exportlogs">
|
||||||
|
{t("menus.header.export-logs")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "phonebook",
|
||||||
|
icon: <PhoneOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/phonebook">{t("menus.header.phonebook")}</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "temporarydocs",
|
||||||
|
icon: <PaperClipOutlined />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/temporarydocs">
|
||||||
|
{t("menus.header.temporarydocs")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "shopsubmenu",
|
||||||
|
icon: <SettingOutlined />,
|
||||||
|
label: t("menus.header.shop"),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "shop",
|
||||||
|
icon: <Icon component={GiSettingsKnobs} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/shop">{t("menus.header.shop_config")}</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "dashboard",
|
||||||
|
icon: <DashboardFilled />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/dashboard">
|
||||||
|
{t("menus.header.dashboard")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "reportcenter",
|
||||||
|
icon: <BarChartOutlined />,
|
||||||
|
onClick: () => {
|
||||||
|
setReportCenterContext({
|
||||||
|
actions: {},
|
||||||
|
context: {},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
label: t("menus.header.reportcenter"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "shop-vendors",
|
||||||
|
icon: <Icon component={IoBusinessOutline} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/shop/vendors">
|
||||||
|
{t("menus.header.shop_vendors")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "shop-csi",
|
||||||
|
icon: <Icon component={RiSurveyLine} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/shop/csi">
|
||||||
|
{t("menus.header.shop_csi")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "user",
|
||||||
|
label:
|
||||||
|
currentUser.displayName ||
|
||||||
|
currentUser.email ||
|
||||||
|
t("general.labels.unknown"),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "signout",
|
||||||
|
danger: true,
|
||||||
|
onClick: () => signOutStart(),
|
||||||
|
label: t("user.actions.signout"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "help",
|
||||||
|
icon: <Icon component={QuestionCircleFilled} />,
|
||||||
|
onClick: () => {
|
||||||
|
window.open("https://help.imex.online/", "_blank");
|
||||||
|
},
|
||||||
|
label: t("menus.header.help"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "rescue",
|
||||||
|
onClick: () => {
|
||||||
|
window.open("https://imexrescue.com/", "_blank");
|
||||||
|
},
|
||||||
|
label: t("menus.header.rescueme"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "shiftclock",
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/shiftclock">
|
||||||
|
{t("menus.header.shiftclock")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "profile",
|
||||||
|
label: (
|
||||||
|
<Link to="/manage/profile">
|
||||||
|
{t("menus.currentuser.profile")}
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "recent",
|
||||||
|
label: <ClockCircleFilled />,
|
||||||
|
children: recentItems.map((i, idx) => ({
|
||||||
|
key: idx,
|
||||||
|
label: <Link to={i.url}>{i.label}</Link>,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
></Menu>
|
||||||
</Layout.Header>
|
</Layout.Header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export function InventoryUpsertModalContainer({
|
|||||||
? t("inventory.actions.edit")
|
? t("inventory.actions.edit")
|
||||||
: t("inventory.actions.new")
|
: t("inventory.actions.new")
|
||||||
}
|
}
|
||||||
visible={visible}
|
open={visible}
|
||||||
okText={t("general.actions.save")}
|
okText={t("general.actions.save")}
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
form.submit();
|
form.submit();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR } from "../../graphql/vendors.queries";
|
import { SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR } from "../../graphql/vendors.queries";
|
||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
@@ -14,14 +13,13 @@ import VendorSearchSelect from "../vendor-search-select/vendor-search-select.com
|
|||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
technician: selectTechnician,
|
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
});
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Jobd3RdPartyModal);
|
export default connect(mapStateToProps, mapDispatchToProps)(Jobd3RdPartyModal);
|
||||||
|
|
||||||
export function Jobd3RdPartyModal({ bodyshop, jobId, job, technician }) {
|
export function Jobd3RdPartyModal({ bodyshop, jobId, job }) {
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
@@ -98,7 +96,7 @@ export function Jobd3RdPartyModal({ bodyshop, jobId, job, technician }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button onClick={showModal}>{t("printcenter.jobs.3rdpartypayer")}</Button>
|
<Button onClick={showModal}>{t("printcenter.jobs.3rdpartypayer")}</Button>
|
||||||
<Modal visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
|
<Modal open={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
|
||||||
<Form
|
<Form
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
autoComplete={"off"}
|
autoComplete={"off"}
|
||||||
@@ -214,9 +212,7 @@ export function Jobd3RdPartyModal({ bodyshop, jobId, job, technician }) {
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
{!technician ? (
|
<Radio value={"e"}>{t("parts_orders.labels.email")}</Radio>
|
||||||
<Radio value={"e"}>{t("parts_orders.labels.email")}</Radio>
|
|
||||||
) : null}
|
|
||||||
<Radio value={"p"}>{t("parts_orders.labels.print")}</Radio>
|
<Radio value={"p"}>{t("parts_orders.labels.print")}</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from "react";
|
import { DownOutlined } from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { Dropdown, notification } from "antd";
|
||||||
|
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 { Dropdown, Menu, notification } from "antd";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { DownOutlined } from "@ant-design/icons";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -37,18 +37,19 @@ export function JobAltTransportChange({ bodyshop, job }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const menu = (
|
const menu = [
|
||||||
<Menu selectedKeys={[job && job.alt_transport]} onClick={onClick}>
|
...(bodyshop.appt_alt_transport &&
|
||||||
{bodyshop.appt_alt_transport &&
|
bodyshop.appt_alt_transport.map((alt) => ({
|
||||||
bodyshop.appt_alt_transport.map((alt) => (
|
key: alt,
|
||||||
<Menu.Item key={alt}>{alt}</Menu.Item>
|
label: alt,
|
||||||
))}
|
value: alt,
|
||||||
<Menu.Divider />
|
onClick,
|
||||||
<Menu.Item key={"null"}>{t("general.actions.clear")}</Menu.Item>
|
}))),
|
||||||
</Menu>
|
{ type: "divider" },
|
||||||
);
|
{ key: "null", label: t("general.actions.clear"), onClick },
|
||||||
|
];
|
||||||
return (
|
return (
|
||||||
<Dropdown overlay={menu}>
|
<Dropdown menu={{ items: menu }}>
|
||||||
<a href=" #" onClick={(e) => e.preventDefault()}>
|
<a href=" #" onClick={(e) => e.preventDefault()}>
|
||||||
<DownOutlined />
|
<DownOutlined />
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from "react";
|
import { DownOutlined } from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
import { Dropdown, notification } from "antd";
|
||||||
|
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 { Dropdown, Menu, notification } from "antd";
|
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
||||||
import { DownOutlined } from "@ant-design/icons";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -44,21 +44,23 @@ export function ScheduleEventColor({ bodyshop, event }) {
|
|||||||
bodyshop.appt_colors.filter((color) => color.color.hex === event.color)[0]
|
bodyshop.appt_colors.filter((color) => color.color.hex === event.color)[0]
|
||||||
?.label;
|
?.label;
|
||||||
|
|
||||||
const menu = (
|
const menu = {
|
||||||
<Menu selectedKeys={[event.color]} onClick={onClick}>
|
items: [
|
||||||
{bodyshop.appt_colors &&
|
...(bodyshop.appt_colors &&
|
||||||
bodyshop.appt_colors.map((color) => (
|
bodyshop.appt_colors.map((color) => ({
|
||||||
<Menu.Item style={{ color: color.color.hex }} key={color.color.hex}>
|
style: { color: color.color.hex },
|
||||||
{color.label}
|
key: color.color.hex,
|
||||||
</Menu.Item>
|
label: color.label,
|
||||||
))}
|
}))),
|
||||||
<Menu.Divider />
|
{ type: "divider" },
|
||||||
<Menu.Item key={"null"}>{t("general.actions.clear")}</Menu.Item>
|
{ key: "null", value: t("general.actions.clear") },
|
||||||
</Menu>
|
],
|
||||||
);
|
selectedKeys: [event.color],
|
||||||
|
onClick: onClick,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown overlay={menu}>
|
<Dropdown menu={menu}>
|
||||||
<a href=" #" onClick={(e) => e.preventDefault()}>
|
<a href=" #" onClick={(e) => e.preventDefault()}>
|
||||||
{selectedColor}
|
{selectedColor}
|
||||||
<DownOutlined />
|
<DownOutlined />
|
||||||
|
|||||||
@@ -2,14 +2,9 @@ import { AlertFilled } from "@ant-design/icons";
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
Dropdown,
|
Dropdown, notification,
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Menu,
|
|
||||||
notification,
|
|
||||||
Popover,
|
Popover,
|
||||||
Select,
|
Space
|
||||||
Space,
|
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import parsePhoneNumber from "libphonenumber-js";
|
import parsePhoneNumber from "libphonenumber-js";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -21,7 +16,7 @@ import { Link, useHistory, useLocation } from "react-router-dom";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import {
|
import {
|
||||||
openChatByPhone,
|
openChatByPhone,
|
||||||
setMessage,
|
setMessage
|
||||||
} from "../../redux/messaging/messaging.actions";
|
} 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 { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
@@ -35,8 +30,6 @@ import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.
|
|||||||
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 ScheduleEventNote from "./schedule-event.note.component";
|
import ScheduleEventNote from "./schedule-event.note.component";
|
||||||
import { useMutation } from "@apollo/client";
|
|
||||||
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -61,44 +54,13 @@ export function ScheduleEventComponent({
|
|||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const searchParams = queryString.parse(useLocation().search);
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
const [updateAppointment] = useMutation(UPDATE_APPOINTMENT);
|
|
||||||
const [title, setTitle] = useState(event.title);
|
|
||||||
const blockContent = (
|
|
||||||
<Space direction="vertical" wrap>
|
|
||||||
<Input
|
|
||||||
value={title}
|
|
||||||
onChange={(e) => setTitle(e.currentTarget.value)}
|
|
||||||
onBlur={async () => {
|
|
||||||
await updateAppointment({
|
|
||||||
variables: {
|
|
||||||
appid: event.id,
|
|
||||||
app: {
|
|
||||||
title: title,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
optimisticResponse: {
|
|
||||||
update_appointments: {
|
|
||||||
__typename: "appointments_mutation_response",
|
|
||||||
returning: [
|
|
||||||
{
|
|
||||||
...event,
|
|
||||||
title: title,
|
|
||||||
__typename: "appointments",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
const blockContent = (
|
||||||
onClick={() => handleCancel({ id: event.id })}
|
<div>
|
||||||
disabled={event.arrived}
|
<Button onClick={() => handleCancel(event.id)} disabled={event.arrived}>
|
||||||
>
|
{t("appointments.actions.cancel")}
|
||||||
{t("appointments.actions.unblock")}
|
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const popoverContent = (
|
const popoverContent = (
|
||||||
@@ -185,10 +147,12 @@ export function ScheduleEventComponent({
|
|||||||
) : null}
|
) : null}
|
||||||
{event.job ? (
|
{event.job ? (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
overlay={
|
menu={{
|
||||||
<Menu>
|
items: [
|
||||||
<Menu.Item
|
{
|
||||||
onClick={() => {
|
disabled: event.arrived,
|
||||||
|
label: t("general.labels.email"),
|
||||||
|
onClick: () => {
|
||||||
const Template = TemplateList("job").appointment_reminder;
|
const Template = TemplateList("job").appointment_reminder;
|
||||||
GenerateDocument(
|
GenerateDocument(
|
||||||
{
|
{
|
||||||
@@ -202,13 +166,12 @@ export function ScheduleEventComponent({
|
|||||||
"e",
|
"e",
|
||||||
event.job && event.job.id
|
event.job && event.job.id
|
||||||
);
|
);
|
||||||
}}
|
},
|
||||||
disabled={event.arrived}
|
},
|
||||||
>
|
{
|
||||||
{t("general.labels.email")}
|
label: t("general.labels.sms"),
|
||||||
</Menu.Item>
|
disabled: event.arrived || !bodyshop.messagingservicesid,
|
||||||
<Menu.Item
|
onClick: () => {
|
||||||
onClick={() => {
|
|
||||||
const p = parsePhoneNumber(event.job.ownr_ph1, "CA");
|
const p = parsePhoneNumber(event.job.ownr_ph1, "CA");
|
||||||
if (p && p.isValid()) {
|
if (p && p.isValid()) {
|
||||||
openChatByPhone({
|
openChatByPhone({
|
||||||
@@ -228,67 +191,18 @@ export function ScheduleEventComponent({
|
|||||||
message: t("messaging.error.invalidphone"),
|
message: t("messaging.error.invalidphone"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}}
|
},
|
||||||
disabled={event.arrived || !bodyshop.messagingservicesid}
|
},
|
||||||
>
|
],
|
||||||
{t("general.labels.sms")}
|
}}
|
||||||
</Menu.Item>
|
|
||||||
</Menu>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Button>{t("appointments.actions.sendreminder")}</Button>
|
<Button>{t("appointments.actions.sendreminder")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
) : null}
|
) : null}
|
||||||
{event.arrived ? (
|
|
||||||
<Button
|
|
||||||
// onClick={() => handleCancel(event.id)}
|
|
||||||
disabled={event.arrived}
|
|
||||||
>
|
|
||||||
{t("appointments.actions.cancel")}
|
|
||||||
</Button>
|
|
||||||
) : (
|
|
||||||
<Popover
|
|
||||||
trigger="click"
|
|
||||||
disabled={event.arrived}
|
|
||||||
content={
|
|
||||||
<Form
|
|
||||||
layout="vertical"
|
|
||||||
onFinish={({ lost_sale_reason }) => {
|
|
||||||
handleCancel({ id: event.id, lost_sale_reason });
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
name="lost_sale_reason"
|
|
||||||
label={t("jobs.fields.lost_sale_reason")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Select
|
|
||||||
options={bodyshop.md_lost_sale_reasons.map((lsr) => ({
|
|
||||||
label: lsr,
|
|
||||||
value: lsr,
|
|
||||||
}))}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Button htmlType="submit">
|
|
||||||
{t("appointments.actions.cancel")}
|
|
||||||
</Button>
|
|
||||||
</Form>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
// onClick={() => handleCancel(event.id)}
|
|
||||||
disabled={event.arrived}
|
|
||||||
>
|
|
||||||
{t("appointments.actions.cancel")}
|
|
||||||
</Button>
|
|
||||||
</Popover>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
<Button onClick={() => handleCancel(event.id)} disabled={event.arrived}>
|
||||||
|
{t("appointments.actions.cancel")}
|
||||||
|
</Button>
|
||||||
{event.isintake ? (
|
{event.isintake ? (
|
||||||
<Button
|
<Button
|
||||||
disabled={event.arrived}
|
disabled={event.arrived}
|
||||||
@@ -369,8 +283,8 @@ export function ScheduleEventComponent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover
|
<Popover
|
||||||
visible={visible}
|
open={visible}
|
||||||
onVisibleChange={(vis) => !event.vacation && setVisible(vis)}
|
onOpenChange={(vis) => !event.vacation && setVisible(vis)}
|
||||||
trigger="click"
|
trigger="click"
|
||||||
content={event.block ? blockContent : popoverContent}
|
content={event.block ? blockContent : popoverContent}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -2,20 +2,16 @@ import { useMutation } from "@apollo/client";
|
|||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useDispatch } from "react-redux";
|
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { CANCEL_APPOINTMENT_BY_ID } from "../../graphql/appointments.queries";
|
import { CANCEL_APPOINTMENT_BY_ID } from "../../graphql/appointments.queries";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|
||||||
import ScheduleEventComponent from "./schedule-event.component";
|
import ScheduleEventComponent from "./schedule-event.component";
|
||||||
|
|
||||||
export default function ScheduleEventContainer({ bodyshop, event, refetch }) {
|
export default function ScheduleEventContainer({ bodyshop, event, refetch }) {
|
||||||
const dispatch = useDispatch();
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [cancelAppointment] = useMutation(CANCEL_APPOINTMENT_BY_ID);
|
const [cancelAppointment] = useMutation(CANCEL_APPOINTMENT_BY_ID);
|
||||||
const [updateJob] = useMutation(UPDATE_JOB);
|
const [updateJob] = useMutation(UPDATE_JOB);
|
||||||
const handleCancel = async ({ id, lost_sale_reason }) => {
|
const handleCancel = async (id) => {
|
||||||
logImEXEvent("schedule_cancel_appt");
|
logImEXEvent("schedule_cancel_appt");
|
||||||
|
|
||||||
const cancelAppt = await cancelAppointment({
|
const cancelAppt = await cancelAppointment({
|
||||||
@@ -38,24 +34,15 @@ export default function ScheduleEventContainer({ bodyshop, event, refetch }) {
|
|||||||
const jobUpdate = await updateJob({
|
const jobUpdate = await updateJob({
|
||||||
variables: {
|
variables: {
|
||||||
jobId: event.job.id,
|
jobId: event.job.id,
|
||||||
|
|
||||||
job: {
|
job: {
|
||||||
date_scheduled: null,
|
date_scheduled: null,
|
||||||
scheduled_in: null,
|
scheduled_in: null,
|
||||||
scheduled_completion: null,
|
scheduled_completion:null,
|
||||||
lost_sale_reason,
|
|
||||||
date_lost_sale: new Date(),
|
|
||||||
status: bodyshop.md_ro_statuses.default_imported,
|
status: bodyshop.md_ro_statuses.default_imported,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!jobUpdate.errors) {
|
|
||||||
dispatch(
|
|
||||||
insertAuditTrail({
|
|
||||||
jobid: event.job.id,
|
|
||||||
operation: AuditTrailMapping.appointmentcancel(lost_sale_reason),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!!jobUpdate.errors) {
|
if (!!jobUpdate.errors) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.updating", {
|
message: t("jobs.errors.updating", {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Card, Form, Input, notification, Switch } from "antd";
|
import { Button, Card, Form, Input, notification, Switch } from "antd";
|
||||||
import moment from "moment-business-days";
|
|
||||||
import queryString from "query-string";
|
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";
|
||||||
@@ -13,15 +12,16 @@ import {
|
|||||||
MARK_LATEST_APPOINTMENT_ARRIVED,
|
MARK_LATEST_APPOINTMENT_ARRIVED,
|
||||||
} from "../../../../graphql/appointments.queries";
|
} from "../../../../graphql/appointments.queries";
|
||||||
import { UPDATE_JOB } from "../../../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../../../graphql/jobs.queries";
|
||||||
import { UPDATE_OWNER } from "../../../../graphql/owners.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 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 { 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,
|
||||||
@@ -230,7 +230,6 @@ export function JobChecklistForm({
|
|||||||
)),
|
)),
|
||||||
scheduled_delivery:
|
scheduled_delivery:
|
||||||
job.scheduled_delivery && moment(job.scheduled_delivery),
|
job.scheduled_delivery && moment(job.scheduled_delivery),
|
||||||
production_vars: job.production_vars,
|
|
||||||
}),
|
}),
|
||||||
...(type === "deliver" && {
|
...(type === "deliver" && {
|
||||||
removeFromProduction: true,
|
removeFromProduction: true,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function JobCostingModalContainer({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
open={visible}
|
||||||
title={t("jobs.labels.jobcosting")}
|
title={t("jobs.labels.jobcosting")}
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export function JobDetailCards({ bodyshop, setPrintCenterContext }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
visible={!!selected}
|
open={!!selected}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
width={drawerPercentage}
|
width={drawerPercentage}
|
||||||
placement="right"
|
placement="right"
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
import {
|
import {
|
||||||
DeleteFilled,
|
DeleteFilled,
|
||||||
|
EditFilled,
|
||||||
FilterFilled,
|
FilterFilled,
|
||||||
|
HomeOutlined,
|
||||||
|
MinusCircleTwoTone,
|
||||||
|
PlusCircleTwoTone,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
WarningFilled,
|
WarningFilled,
|
||||||
EditFilled,
|
|
||||||
PlusCircleTwoTone,
|
|
||||||
MinusCircleTwoTone,
|
|
||||||
HomeOutlined,
|
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import {
|
import { PageHeader } from '@ant-design/pro-layout';
|
||||||
Button,
|
import { Button, Dropdown, Input, Space, Table, Tag } from "antd";
|
||||||
Dropdown,
|
|
||||||
Input,
|
|
||||||
Menu,
|
|
||||||
PageHeader,
|
|
||||||
Space,
|
|
||||||
Table,
|
|
||||||
Tag,
|
|
||||||
} from "antd";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -38,13 +30,13 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re
|
|||||||
// import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
|
// import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
|
||||||
// import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
|
// import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
|
||||||
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
|
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
|
||||||
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
|
||||||
import JobLinesExpander from "./job-lines-expander.component";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
||||||
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
|
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
|
||||||
|
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
||||||
|
import JobLinesExpander from "./job-lines-expander.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -105,9 +97,6 @@ export function JobLinesComponent({
|
|||||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||||
onCell: (record) => ({
|
onCell: (record) => ({
|
||||||
className: record.manual_line && "job-line-manual",
|
className: record.manual_line && "job-line-manual",
|
||||||
style: {
|
|
||||||
...(record.critical ? { boxShadow: " -.5em 0 0 #FFC107" } : {}),
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
||||||
@@ -348,7 +337,7 @@ export function JobLinesComponent({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setJobLineEditContext({
|
setJobLineEditContext({
|
||||||
actions: { refetch: refetch, submit: form && form.submit },
|
actions: { refetch: refetch, submit: form && form.submit },
|
||||||
context: { ...record, jobid: job.id },
|
context: record,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -401,7 +390,7 @@ export function JobLinesComponent({
|
|||||||
const markedTypes = [e.key];
|
const markedTypes = [e.key];
|
||||||
if (e.key === "PAN") markedTypes.push("PAP");
|
if (e.key === "PAN") markedTypes.push("PAP");
|
||||||
if (e.key === "PAS") markedTypes.push("PASL");
|
if (e.key === "PAS") markedTypes.push("PASL");
|
||||||
setSelectedLines((selectedLines) =>
|
setSelectedLines(
|
||||||
_.uniq([
|
_.uniq([
|
||||||
...selectedLines,
|
...selectedLines,
|
||||||
...jobLines.filter((item) => markedTypes.includes(item.part_type)),
|
...jobLines.filter((item) => markedTypes.includes(item.part_type)),
|
||||||
@@ -410,16 +399,17 @@ export function JobLinesComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const markMenu = (
|
const markMenu = {
|
||||||
<Menu onClick={handleMark}>
|
onClick: handleMark,
|
||||||
<Menu.Item key="PAA">{t("joblines.fields.part_types.PAA")}</Menu.Item>
|
items: [
|
||||||
<Menu.Item key="PAN">{t("joblines.fields.part_types.PAN")}</Menu.Item>
|
{ key: "PAA", label: t("joblines.fields.part_types.PAA") },
|
||||||
<Menu.Item key="PAL">{t("joblines.fields.part_types.PAL")}</Menu.Item>
|
{ key: "PAN", label: t("joblines.fields.part_types.PAN") },
|
||||||
<Menu.Item key="PAS">{t("joblines.fields.part_types.PAS")}</Menu.Item>
|
{ key: "PAL", label: t("joblines.fields.part_types.PAL") },
|
||||||
<Menu.Divider />
|
{ key: "PAS", label: t("joblines.fields.part_types.PAS") },
|
||||||
<Menu.Item key="clear">{t("general.labels.clear")}</Menu.Item>
|
{ type: "divider" },
|
||||||
</Menu>
|
{ key: "clear", label: t("general.labels.clear") },
|
||||||
);
|
],
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -549,7 +539,7 @@ export function JobLinesComponent({
|
|||||||
>
|
>
|
||||||
<FilterFilled /> {t("jobs.actions.filterpartsonly")}
|
<FilterFilled /> {t("jobs.actions.filterpartsonly")}
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown overlay={markMenu} trigger={["click"]}>
|
<Dropdown menu={markMenu} trigger={["click"]}>
|
||||||
<Button>{t("jobs.actions.mark")}</Button>
|
<Button>{t("jobs.actions.mark")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Button
|
<Button
|
||||||
@@ -614,17 +604,8 @@ export function JobLinesComponent({
|
|||||||
onSelectAll: (selected, selectedRows, changeRows) => {
|
onSelectAll: (selected, selectedRows, changeRows) => {
|
||||||
setSelectedLines(selectedRows);
|
setSelectedLines(selectedRows);
|
||||||
},
|
},
|
||||||
onSelect: (record, selected, selectedRows, nativeEvent) => {
|
onSelect: (record, selected, selectedRows, nativeEvent) =>
|
||||||
if (selected) {
|
setSelectedLines(selectedRows),
|
||||||
setSelectedLines((selectedLines) =>
|
|
||||||
_.uniqBy([...selectedLines, record], "id")
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
setSelectedLines((selectedLines) =>
|
|
||||||
selectedLines.filter((l) => l.id !== record.id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export function JobEmployeeAssignments({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover destroyTooltipOnHide content={popContent} visible={visibility}>
|
<Popover destroyTooltipOnHide content={popContent} open={visibility}>
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<DataLabel label={t("jobs.fields.employee_body")}>
|
<DataLabel label={t("jobs.fields.employee_body")}>
|
||||||
{body ? (
|
{body ? (
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ export function JobLineConvertToLabor({
|
|||||||
<Popover
|
<Popover
|
||||||
disabled={jobline.convertedtolbr}
|
disabled={jobline.convertedtolbr}
|
||||||
content={overlay}
|
content={overlay}
|
||||||
visible={visibility}
|
open={visibility}
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
>
|
>
|
||||||
<Tooltip title={t("joblines.actions.converttolabor")}>
|
<Tooltip title={t("joblines.actions.converttolabor")}>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
|
||||||
import { notification, Select } from "antd";
|
import { notification, Select } from "antd";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
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";
|
||||||
@@ -56,10 +56,8 @@ export function JobLineLocationPopup({ bodyshop, jobline, disabled }) {
|
|||||||
<LoadingSpinner loading={loading}>
|
<LoadingSpinner loading={loading}>
|
||||||
<Select
|
<Select
|
||||||
autoFocus
|
autoFocus
|
||||||
allowClear
|
|
||||||
dropdownMatchSelectWidth={100}
|
dropdownMatchSelectWidth={100}
|
||||||
value={location}
|
value={location}
|
||||||
onClear={() => setLocation(null)}
|
|
||||||
onSelect={handleChange}
|
onSelect={handleChange}
|
||||||
onBlur={handleSave}
|
onBlur={handleSave}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function JobLinesBillRefernece({ jobline }) {
|
|||||||
return (
|
return (
|
||||||
<div style={{ color: subletRequired && "tomato" }}>
|
<div style={{ color: subletRequired && "tomato" }}>
|
||||||
{subletRequired && <WarningFilled />}
|
{subletRequired && <WarningFilled />}
|
||||||
{`${billLine.actual_price.toFixed(2)} x ${billLine.quantity} (${
|
{`${(billLine.actual_price * billLine.quantity).toFixed(2)} (${
|
||||||
billLine.bill.vendor.name
|
billLine.bill.vendor.name
|
||||||
} #${billLine.bill.invoice_number})`}
|
} #${billLine.bill.invoice_number})`}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DownOutlined } from "@ant-design/icons";
|
import { DownOutlined } from "@ant-design/icons";
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown } 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";
|
||||||
@@ -21,30 +21,17 @@ export function JoblinePresetButton({ bodyshop, form }) {
|
|||||||
form.setFieldsValue(item);
|
form.setFieldsValue(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
const menu = (
|
const menu = {
|
||||||
<Menu
|
items: bodyshop.md_jobline_presets.map((i, idx) => ({
|
||||||
style={{
|
onClick: () => handleSelect(i),
|
||||||
columnCount: Math.max(
|
key: idx,
|
||||||
Math.floor(bodyshop.md_jobline_presets.length / 15),
|
label: i.label,
|
||||||
1
|
})),
|
||||||
),
|
};
|
||||||
}}
|
|
||||||
>
|
|
||||||
{bodyshop.md_jobline_presets.map((i, idx) => (
|
|
||||||
<Menu.Item
|
|
||||||
onClick={() => handleSelect(i)}
|
|
||||||
key={idx}
|
|
||||||
style={{ breakInside: "avoid" }}
|
|
||||||
>
|
|
||||||
{i.label}
|
|
||||||
</Menu.Item>
|
|
||||||
))}
|
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Dropdown trigger={["click"]} overlay={menu}>
|
<Dropdown trigger={["click"]} menu={menu}>
|
||||||
<a
|
<a
|
||||||
className="ant-dropdown-link"
|
className="ant-dropdown-link"
|
||||||
href="# "
|
href="# "
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ export function JobLinesUpsertModalComponent({
|
|||||||
{},
|
{},
|
||||||
bodyshop.imexshopid
|
bodyshop.imexshopid
|
||||||
);
|
);
|
||||||
const { Autohouse_Detail_line } = useTreatments(
|
|
||||||
["Autohouse_Detail_line"],
|
|
||||||
{},
|
|
||||||
bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@@ -54,7 +49,7 @@ export function JobLinesUpsertModalComponent({
|
|||||||
: t("joblines.labels.new")
|
: t("joblines.labels.new")
|
||||||
}
|
}
|
||||||
forceRender
|
forceRender
|
||||||
visible={visible}
|
open={visible}
|
||||||
width="60%"
|
width="60%"
|
||||||
okText={t("general.actions.save")}
|
okText={t("general.actions.save")}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
@@ -160,40 +155,6 @@ export function JobLinesUpsertModalComponent({
|
|||||||
>
|
>
|
||||||
<InputNumber precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{Autohouse_Detail_line.treatment === "on" && (
|
|
||||||
<Form.Item
|
|
||||||
label={t("joblines.fields.ah_detail_line")}
|
|
||||||
name="ah_detail_line"
|
|
||||||
valuePropName="checked"
|
|
||||||
dependencies={["mod_lbr_ty"]}
|
|
||||||
initialValue={false}
|
|
||||||
rules={[
|
|
||||||
({ getFieldValue }) => ({
|
|
||||||
validator(rule, value) {
|
|
||||||
if (
|
|
||||||
value === false ||
|
|
||||||
value === undefined ||
|
|
||||||
value === null
|
|
||||||
)
|
|
||||||
return Promise.resolve();
|
|
||||||
if (
|
|
||||||
value === true &&
|
|
||||||
["LA1", "LA2", "LA3", "LA4", "LAU"].includes(
|
|
||||||
getFieldValue("mod_lbr_ty")
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
return Promise.reject(
|
|
||||||
t("joblines.validations.ahdetailonlyonuserdefinedtypes")
|
|
||||||
);
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item label={t("joblines.fields.part_type")} name="part_type">
|
<Form.Item label={t("joblines.fields.part_type")} name="part_type">
|
||||||
@@ -257,6 +218,7 @@ export function JobLinesUpsertModalComponent({
|
|||||||
rules={[
|
rules={[
|
||||||
({ getFieldValue }) => ({
|
({ getFieldValue }) => ({
|
||||||
validator(rule, value) {
|
validator(rule, value) {
|
||||||
|
console.log(value);
|
||||||
if (!value || getFieldValue("part_type") !== "PAE") {
|
if (!value || getFieldValue("part_type") !== "PAE") {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@@ -267,6 +229,7 @@ export function JobLinesUpsertModalComponent({
|
|||||||
}),
|
}),
|
||||||
({ getFieldValue }) => ({
|
({ getFieldValue }) => ({
|
||||||
validator(rule, value) {
|
validator(rule, value) {
|
||||||
|
console.log(value, !!value);
|
||||||
if (
|
if (
|
||||||
!!getFieldValue("part_type") === (!!value || value === 0)
|
!!getFieldValue("part_type") === (!!value || value === 0)
|
||||||
) {
|
) {
|
||||||
@@ -289,7 +252,7 @@ export function JobLinesUpsertModalComponent({
|
|||||||
name="prt_dsmk_p"
|
name="prt_dsmk_p"
|
||||||
initialValue={0}
|
initialValue={0}
|
||||||
>
|
>
|
||||||
<InputNumber precision={0} min={-100} max={100} />
|
<InputNumber precision={0} min={0} max={100} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("joblines.fields.tax_part")}
|
label={t("joblines.fields.tax_part")}
|
||||||
|
|||||||
@@ -13,13 +13,8 @@ import { selectJobLineEditModal } from "../../redux/modals/modals.selectors";
|
|||||||
import UndefinedToNull from "../../utils/undefinedtonull";
|
import UndefinedToNull from "../../utils/undefinedtonull";
|
||||||
import JobLinesUpdsertModal from "./job-lines-upsert-modal.component";
|
import JobLinesUpdsertModal from "./job-lines-upsert-modal.component";
|
||||||
import Axios from "axios";
|
import Axios from "axios";
|
||||||
import Dinero from "dinero.js";
|
|
||||||
import CriticalPartsScan from "../../utils/criticalPartsScan";
|
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobLineEditModal: selectJobLineEditModal,
|
jobLineEditModal: selectJobLineEditModal,
|
||||||
bodyshop: selectBodyshop,
|
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("jobLineEdit")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("jobLineEdit")),
|
||||||
@@ -28,13 +23,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
function JobLinesUpsertModalContainer({
|
function JobLinesUpsertModalContainer({
|
||||||
jobLineEditModal,
|
jobLineEditModal,
|
||||||
toggleModalVisible,
|
toggleModalVisible,
|
||||||
bodyshop,
|
|
||||||
}) {
|
}) {
|
||||||
const { CriticalPartsScanning } = useTreatments(
|
|
||||||
["CriticalPartsScanning"],
|
|
||||||
{},
|
|
||||||
bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [insertJobLine] = useMutation(INSERT_NEW_JOB_LINE);
|
const [insertJobLine] = useMutation(INSERT_NEW_JOB_LINE);
|
||||||
const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
|
const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
|
||||||
@@ -51,15 +40,7 @@ function JobLinesUpsertModalContainer({
|
|||||||
manual_line: !(
|
manual_line: !(
|
||||||
jobLineEditModal.context && jobLineEditModal.context.id
|
jobLineEditModal.context && jobLineEditModal.context.id
|
||||||
),
|
),
|
||||||
...UndefinedToNull({
|
...UndefinedToNull(values),
|
||||||
...values,
|
|
||||||
prt_dsmk_m: Dinero({
|
|
||||||
amount: Math.round((values.act_price || 0) * 100),
|
|
||||||
})
|
|
||||||
.percentage(Math.abs(values.prt_dsmk_p || 0))
|
|
||||||
.multiply(values.prt_dsmk_p >= 0 ? 1 : -1)
|
|
||||||
.toFormat(0.0),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -87,15 +68,7 @@ function JobLinesUpsertModalContainer({
|
|||||||
const r = await updateJobLine({
|
const r = await updateJobLine({
|
||||||
variables: {
|
variables: {
|
||||||
lineId: jobLineEditModal.context.id,
|
lineId: jobLineEditModal.context.id,
|
||||||
line: {
|
line: values,
|
||||||
...values,
|
|
||||||
prt_dsmk_m: Dinero({
|
|
||||||
amount: Math.round(values.act_price * 100),
|
|
||||||
})
|
|
||||||
.percentage(Math.abs(values.prt_dsmk_p || 0))
|
|
||||||
.multiply(values.prt_dsmk_p >= 0 ? 1 : -1)
|
|
||||||
.toFormat(0.0),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
refetchQueries: ["GET_LINE_TICKET_BY_PK"],
|
refetchQueries: ["GET_LINE_TICKET_BY_PK"],
|
||||||
});
|
});
|
||||||
@@ -119,9 +92,6 @@ function JobLinesUpsertModalContainer({
|
|||||||
}
|
}
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
}
|
}
|
||||||
if (CriticalPartsScanning.treatment === "on") {
|
|
||||||
CriticalPartsScan(jobLineEditModal.context.jobid);
|
|
||||||
}
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,19 @@
|
|||||||
import { EditFilled } from "@ant-design/icons";
|
|
||||||
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";
|
||||||
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 {
|
|
||||||
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 { 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 { TemplateList } from "../../utils/TemplateConstants";
|
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import DataLabel from "../data-label/data-label.component";
|
import DataLabel from "../data-label/data-label.component";
|
||||||
import PaymentExpandedRowComponent from "../payment-expanded-row/payment-expanded-row.component";
|
|
||||||
import PaymentsGenerateLink from "../payments-generate-link/payments-generate-link.component";
|
|
||||||
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -30,34 +23,20 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPaymentContext: (context) =>
|
setPaymentContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "payment" })),
|
dispatch(setModalContext({ context: context, modal: "payment" })),
|
||||||
setCardPaymentContext: (context) =>
|
|
||||||
dispatch(setModalContext({ context: context, modal: "cardPayment" })),
|
|
||||||
openChatByPhone: (phone) => dispatch(openChatByPhone(phone)),
|
|
||||||
setMessage: (text) => dispatch(setMessage(text)),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobPayments({
|
export function JobPayments({
|
||||||
job,
|
job,
|
||||||
jobRO,
|
jobRO,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
setMessage,
|
|
||||||
openChatByPhone,
|
|
||||||
setPaymentContext,
|
setPaymentContext,
|
||||||
setCardPaymentContext,
|
|
||||||
refetch,
|
refetch,
|
||||||
}) {
|
}) {
|
||||||
const { ImEXPay } = useTreatments(
|
|
||||||
["ImEXPay"],
|
|
||||||
{},
|
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
filteredInfo: {},
|
filteredInfo: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("payments.fields.date"),
|
title: t("payments.fields.date"),
|
||||||
@@ -120,7 +99,7 @@ export function JobPayments({
|
|||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Button
|
<Button
|
||||||
// disabled={record.exportedat}
|
disabled={record.exportedat}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPaymentContext({
|
setPaymentContext({
|
||||||
actions: { refetch: refetch },
|
actions: { refetch: refetch },
|
||||||
@@ -170,21 +149,6 @@ export function JobPayments({
|
|||||||
title={t("payments.labels.title")}
|
title={t("payments.labels.title")}
|
||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{ImEXPay.treatment === "on" && (
|
|
||||||
<>
|
|
||||||
<Button
|
|
||||||
onClick={() =>
|
|
||||||
setCardPaymentContext({
|
|
||||||
actions: { refetch },
|
|
||||||
context: { jobid: job.id, balance },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("menus.header.entercardpayment")}
|
|
||||||
</Button>
|
|
||||||
<PaymentsGenerateLink job={job} />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Button
|
<Button
|
||||||
disabled={!job.converted}
|
disabled={!job.converted}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
@@ -196,7 +160,6 @@ export function JobPayments({
|
|||||||
>
|
>
|
||||||
{t("menus.header.enterpayment")}
|
{t("menus.header.enterpayment")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<DataLabel
|
<DataLabel
|
||||||
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
||||||
label={t("payments.labels.balance")}
|
label={t("payments.labels.balance")}
|
||||||
@@ -215,11 +178,6 @@ export function JobPayments({
|
|||||||
scroll={{
|
scroll={{
|
||||||
x: true,
|
x: true,
|
||||||
}}
|
}}
|
||||||
expandable={{
|
|
||||||
expandedRowRender: (record) => (
|
|
||||||
<PaymentExpandedRowComponent record={record} bodyshop={bodyshop} />
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
summary={() => (
|
summary={() => (
|
||||||
<>
|
<>
|
||||||
<Table.Summary.Row>
|
<Table.Summary.Row>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function JobReconciliationModalContainer({
|
|||||||
<Modal
|
<Modal
|
||||||
title={t("jobs.labels.reconciliationheader")}
|
title={t("jobs.labels.reconciliationheader")}
|
||||||
width={"95%"}
|
width={"95%"}
|
||||||
visible={visible}
|
open={visible}
|
||||||
okText={t("general.actions.close")}
|
okText={t("general.actions.close")}
|
||||||
onOk={handleCancel}
|
onOk={handleCancel}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ export default function ScoreboardAddButton({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover content={overlay} visible={visibility} placement="bottom">
|
<Popover content={overlay} open={visibility} placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
loading={loading}
|
loading={loading}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ const JobSearchSelect = (
|
|||||||
useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE);
|
useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE);
|
||||||
|
|
||||||
const executeSearch = (v) => {
|
const executeSearch = (v) => {
|
||||||
console.log(v);
|
if (v && v !== "") callSearch(v);
|
||||||
if (v && v.variables?.search !== "" && v.variables.search.length >= 2)
|
|
||||||
callSearch(v);
|
|
||||||
};
|
};
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { DownCircleFilled } from "@ant-design/icons";
|
import { DownCircleFilled } from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Dropdown, Menu, notification } from "antd";
|
import { Button, Dropdown, notification } 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";
|
||||||
@@ -40,20 +40,18 @@ export function JobsAdminStatus({ insertAuditTrail, bodyshop, job }) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusmenu = (
|
const statusmenu = {
|
||||||
<Menu
|
onClick: (e) => {
|
||||||
onClick={(e) => {
|
updateJobStatus(e.key);
|
||||||
updateJobStatus(e.key);
|
},
|
||||||
}}
|
items: bodyshop.md_ro_statuses.statuses.map((item) => ({
|
||||||
>
|
key: item,
|
||||||
{bodyshop.md_ro_statuses.statuses.map((item) => (
|
label: item,
|
||||||
<Menu.Item key={item}>{item}</Menu.Item>
|
})),
|
||||||
))}
|
};
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown overlay={statusmenu} trigger={["click"]} key="changestatus">
|
<Dropdown menu={statusmenu} trigger={["click"]} key="changestatus">
|
||||||
<Button shape="round">
|
<Button shape="round">
|
||||||
<span>{job.status}</span>
|
<span>{job.status}</span>
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
|
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Form, notification } from "antd";
|
import { Button, Form, notification } from "antd";
|
||||||
import moment from "moment";
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.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 FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
import moment from "moment";
|
||||||
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { DateTimeFormat } from "./../../utils/DateFormatter";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -39,8 +38,8 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await updateJob({
|
const result = await updateJob({
|
||||||
variables: { jobId: job.id, job: values },
|
variables: { jobId: job.id, job: values },
|
||||||
refetchQueries: ["GET_JOB_BY_PK"],
|
refetchQueries: ['GET_JOB_BY_PK'],
|
||||||
awaitRefetchQueries: true,
|
awaitRefetchQueries:true
|
||||||
});
|
});
|
||||||
|
|
||||||
const changedAuditFields = form.getFieldsValue(
|
const changedAuditFields = form.getFieldsValue(
|
||||||
@@ -54,7 +53,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
|||||||
operation: AuditTrailMapping.admin_jobfieldchange(
|
operation: AuditTrailMapping.admin_jobfieldchange(
|
||||||
key,
|
key,
|
||||||
changedAuditFields[key] instanceof moment
|
changedAuditFields[key] instanceof moment
|
||||||
? DateTimeFormat(changedAuditFields[key])
|
? moment(changedAuditFields[key]).format("MM/DD/YYYY hh:mm a")
|
||||||
: changedAuditFields[key]
|
: changedAuditFields[key]
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
@@ -127,10 +126,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
|||||||
<Form.Item label={t("jobs.fields.actual_in")} name="actual_in">
|
<Form.Item label={t("jobs.fields.actual_in")} name="actual_in">
|
||||||
<DateTimePicker />
|
<DateTimePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("jobs.fields.date_repairstarted")} name="date_repairstarted">
|
||||||
label={t("jobs.fields.date_repairstarted")}
|
|
||||||
name="date_repairstarted"
|
|
||||||
>
|
|
||||||
<DateTimePicker />
|
<DateTimePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -177,15 +173,6 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
|||||||
>
|
>
|
||||||
<DateTimePicker />
|
<DateTimePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.date_void")} name="date_void">
|
|
||||||
<DateTimePicker />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("jobs.fields.date_lost_sale")}
|
|
||||||
name="date_lost_sale"
|
|
||||||
>
|
|
||||||
<DateTimePicker />
|
|
||||||
</Form.Item>
|
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
import { gql, useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, notification } from "antd";
|
import { Button, notification } from "antd";
|
||||||
|
import { gql } from "@apollo/client";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import moment from "moment";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.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 moment from "moment";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -149,10 +150,6 @@ export function JobAdminMarkReexport({
|
|||||||
|
|
||||||
if (!result.errors) {
|
if (!result.errors) {
|
||||||
notification["success"]({ message: t("jobs.successes.save") });
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
insertAuditTrail({
|
|
||||||
jobid: job.id,
|
|
||||||
operation: AuditTrailMapping.admin_jobuninvoice(),
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.saving", {
|
message: t("jobs.errors.saving", {
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ export function JobsAdminUnvoid({
|
|||||||
mutation UNVOID_JOB($jobId: uuid!) {
|
mutation UNVOID_JOB($jobId: uuid!) {
|
||||||
update_jobs_by_pk(pk_columns: {id: $jobId}, _set: {voided: false, status: "${
|
update_jobs_by_pk(pk_columns: {id: $jobId}, _set: {voided: false, status: "${
|
||||||
bodyshop.md_ro_statuses.default_imported
|
bodyshop.md_ro_statuses.default_imported
|
||||||
}", date_void: null}) {
|
}"}) {
|
||||||
id
|
id
|
||||||
date_void
|
|
||||||
voided
|
voided
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
} from "@apollo/client";
|
} from "@apollo/client";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
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";
|
||||||
@@ -32,7 +31,6 @@ import {
|
|||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import confirmDialog from "../../utils/asyncConfirm";
|
import confirmDialog from "../../utils/asyncConfirm";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import CriticalPartsScan from "../../utils/criticalPartsScan";
|
|
||||||
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";
|
||||||
@@ -55,11 +53,6 @@ export function JobsAvailableContainer({
|
|||||||
currentUser,
|
currentUser,
|
||||||
insertAuditTrail,
|
insertAuditTrail,
|
||||||
}) {
|
}) {
|
||||||
const { CriticalPartsScanning } = useTreatments(
|
|
||||||
["CriticalPartsScanning"],
|
|
||||||
{},
|
|
||||||
bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_JOBS, {
|
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_JOBS, {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
@@ -73,8 +66,6 @@ export function JobsAvailableContainer({
|
|||||||
|
|
||||||
const [selectedJob, setSelectedJob] = useState(null);
|
const [selectedJob, setSelectedJob] = useState(null);
|
||||||
const [selectedOwner, setSelectedOwner] = useState(null);
|
const [selectedOwner, setSelectedOwner] = useState(null);
|
||||||
const [partsQueueToggle, setPartsQueueToggle] = useState(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
|
||||||
|
|
||||||
const [insertLoading, setInsertLoading] = useState(false);
|
const [insertLoading, setInsertLoading] = useState(false);
|
||||||
|
|
||||||
const [insertNote] = useMutation(INSERT_NEW_NOTE);
|
const [insertNote] = useMutation(INSERT_NEW_NOTE);
|
||||||
@@ -96,7 +87,6 @@ export function JobsAvailableContainer({
|
|||||||
logImEXEvent("job_import_new");
|
logImEXEvent("job_import_new");
|
||||||
|
|
||||||
setOwnerModalVisible(false);
|
setOwnerModalVisible(false);
|
||||||
|
|
||||||
setInsertLoading(true);
|
setInsertLoading(true);
|
||||||
|
|
||||||
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
||||||
@@ -123,7 +113,7 @@ export function JobsAvailableContainer({
|
|||||||
|
|
||||||
let existingVehicles;
|
let existingVehicles;
|
||||||
if (estData.est_data.v_vin) {
|
if (estData.est_data.v_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: {
|
||||||
@@ -138,7 +128,6 @@ export function JobsAvailableContainer({
|
|||||||
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,
|
||||||
date_open: moment(),
|
date_open: moment(),
|
||||||
status: bodyshop.md_ro_statuses.default_imported,
|
|
||||||
notes: {
|
notes: {
|
||||||
data: {
|
data: {
|
||||||
created_by: currentUser.email,
|
created_by: currentUser.email,
|
||||||
@@ -146,7 +135,7 @@ export function JobsAvailableContainer({
|
|||||||
text: t("jobs.labels.importnote"),
|
text: t("jobs.labels.importnote"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
queued_for_parts: partsQueueToggle,
|
queued_for_parts: true,
|
||||||
...(existingVehicles && existingVehicles.data.vehicles.length > 0
|
...(existingVehicles && existingVehicles.data.vehicles.length > 0
|
||||||
? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null }
|
? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null }
|
||||||
: {}),
|
: {}),
|
||||||
@@ -160,51 +149,43 @@ export function JobsAvailableContainer({
|
|||||||
delete newJob.vehicle;
|
delete newJob.vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
insertNewJob({
|
||||||
const r = await insertNewJob({
|
variables: {
|
||||||
variables: {
|
job: newJob,
|
||||||
job: newJob,
|
},
|
||||||
},
|
})
|
||||||
});
|
.then((r) => {
|
||||||
|
notification["success"]({
|
||||||
|
message: t("jobs.successes.created"),
|
||||||
|
onClick: () => {
|
||||||
|
history.push(`/manage/jobs/${r.data.insert_jobs.returning[0].id}`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
//Job has been inserted. Clean up the available jobs record.
|
||||||
|
|
||||||
if (CriticalPartsScanning.treatment === "on") {
|
insertAuditTrail({
|
||||||
CriticalPartsScan(r.data.insert_jobs.returning[0].id);
|
jobid: r.data.insert_jobs.returning[0].id,
|
||||||
}
|
operation: AuditTrailMapping.jobimported(),
|
||||||
|
});
|
||||||
|
|
||||||
notification["success"]({
|
deleteJob({
|
||||||
message: t("jobs.successes.created"),
|
variables: { id: estData.id },
|
||||||
onClick: () => {
|
}).then((r) => {
|
||||||
history.push(`/manage/jobs/${r.data.insert_jobs.returning[0].id}`);
|
refetch();
|
||||||
},
|
setInsertLoading(false);
|
||||||
});
|
});
|
||||||
//Job has been inserted. Clean up the available jobs record.
|
})
|
||||||
|
.catch((r) => {
|
||||||
insertAuditTrail({
|
//error while inserting
|
||||||
jobid: r.data.insert_jobs.returning[0].id,
|
notification["error"]({
|
||||||
operation: AuditTrailMapping.jobimported(),
|
message: t("jobs.errors.creating", { error: r.message }),
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteJob({
|
|
||||||
variables: { id: estData.id },
|
|
||||||
}).then((r) => {
|
|
||||||
refetch();
|
refetch();
|
||||||
setInsertLoading(false);
|
setInsertLoading(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
|
||||||
} catch (err) {
|
|
||||||
//error while inserting
|
|
||||||
notification["error"]({
|
|
||||||
message: t("jobs.errors.creating", { error: err.message }),
|
|
||||||
});
|
|
||||||
refetch().catch(e => {console.error(`Something went wrong in jobs available table container - ${err.message || ''}`)});
|
|
||||||
setInsertLoading(false);
|
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Supplement scenario
|
//Suplement scenario
|
||||||
const onJobFindModalOk = async () => {
|
const onJobFindModalOk = async () => {
|
||||||
logImEXEvent("job_import_supplement");
|
logImEXEvent("job_import_supplement");
|
||||||
|
|
||||||
@@ -256,16 +237,11 @@ export function JobsAvailableContainer({
|
|||||||
// "0.00"
|
// "0.00"
|
||||||
// ),
|
// ),
|
||||||
// job_totals: newTotals,
|
// job_totals: newTotals,
|
||||||
queued_for_parts: partsQueueToggle,
|
// queued_for_parts: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
|
||||||
|
|
||||||
if (CriticalPartsScanning.treatment === "on") {
|
|
||||||
CriticalPartsScan(updateResult.data.update_jobs.returning[0].id);
|
|
||||||
}
|
|
||||||
if (updateResult.errors) {
|
if (updateResult.errors) {
|
||||||
//error while inserting
|
//error while inserting
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
@@ -338,14 +314,12 @@ export function JobsAvailableContainer({
|
|||||||
const onOwnerModalCancel = () => {
|
const onOwnerModalCancel = () => {
|
||||||
setOwnerModalVisible(false);
|
setOwnerModalVisible(false);
|
||||||
setSelectedOwner(null);
|
setSelectedOwner(null);
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onJobModalCancel = () => {
|
const onJobModalCancel = () => {
|
||||||
setJobModalVisible(false);
|
setJobModalVisible(false);
|
||||||
modalSearchState[1]("");
|
modalSearchState[1]("");
|
||||||
setSelectedJob(null);
|
setSelectedJob(null);
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const addJobAsNew = (record) => {
|
const addJobAsNew = (record) => {
|
||||||
@@ -366,8 +340,6 @@ export function JobsAvailableContainer({
|
|||||||
}, [addJobAsSupp, availableJobId, clm_no]);
|
}, [addJobAsSupp, availableJobId, clm_no]);
|
||||||
|
|
||||||
if (error) return <AlertComponent type="error" message={error.message} />;
|
if (error) return <AlertComponent type="error" message={error.message} />;
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoadingSpinner
|
<LoadingSpinner
|
||||||
loading={insertLoading}
|
loading={insertLoading}
|
||||||
@@ -377,14 +349,11 @@ export function JobsAvailableContainer({
|
|||||||
loading={estDataRaw.loading}
|
loading={estDataRaw.loading}
|
||||||
error={estDataRaw.error}
|
error={estDataRaw.error}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
partsQueueToggle={partsQueueToggle}
|
|
||||||
setPartsQueueToggle={setPartsQueueToggle}
|
|
||||||
selectedOwner={selectedOwner}
|
selectedOwner={selectedOwner}
|
||||||
setSelectedOwner={setSelectedOwner}
|
setSelectedOwner={setSelectedOwner}
|
||||||
visible={ownerModalVisible}
|
visible={ownerModalVisible}
|
||||||
onOk={onOwnerFindModalOk}
|
onOk={onOwnerFindModalOk}
|
||||||
onCancel={onOwnerModalCancel}
|
onCancel={onOwnerModalCancel}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<JobsFindModalContainer
|
<JobsFindModalContainer
|
||||||
loading={estDataRaw.loading}
|
loading={estDataRaw.loading}
|
||||||
@@ -396,8 +365,6 @@ export function JobsAvailableContainer({
|
|||||||
onOk={onJobFindModalOk}
|
onOk={onJobFindModalOk}
|
||||||
onCancel={onJobModalCancel}
|
onCancel={onJobModalCancel}
|
||||||
modalSearchState={modalSearchState}
|
modalSearchState={modalSearchState}
|
||||||
partsQueueToggle={partsQueueToggle}
|
|
||||||
setPartsQueueToggle={setPartsQueueToggle}
|
|
||||||
/>
|
/>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { DownCircleFilled } from "@ant-design/icons";
|
import { DownCircleFilled } from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Dropdown, Menu, notification } from "antd";
|
import { Button, Dropdown, notification } from "antd";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -81,29 +81,32 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
|||||||
}
|
}
|
||||||
}, [job, setAvailableStatuses, bodyshop]);
|
}, [job, setAvailableStatuses, bodyshop]);
|
||||||
|
|
||||||
const statusmenu = (
|
const statusmenu = {
|
||||||
<Menu
|
onClick: (e) => {
|
||||||
onClick={(e) => {
|
updateJobStatus(e.key);
|
||||||
updateJobStatus(e.key);
|
},
|
||||||
}}
|
items: [
|
||||||
>
|
...availableStatuses.map((item) => ({
|
||||||
{availableStatuses.map((item) => (
|
key: item,
|
||||||
<Menu.Item key={item}>{item}</Menu.Item>
|
label: item,
|
||||||
))}
|
})),
|
||||||
{job.converted && (
|
...(job.converted
|
||||||
<>
|
? [
|
||||||
<Menu.Divider />
|
{
|
||||||
{otherStages.map((item, idx) => (
|
type: "divider",
|
||||||
<Menu.Item key={item}>{item}</Menu.Item>
|
},
|
||||||
))}
|
...otherStages.map((item, idx) => ({
|
||||||
</>
|
key: item,
|
||||||
)}
|
label: item,
|
||||||
</Menu>
|
})),
|
||||||
);
|
]
|
||||||
|
: []),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
overlay={statusmenu}
|
menu={statusmenu}
|
||||||
trigger={["click"]}
|
trigger={["click"]}
|
||||||
key="changestatus"
|
key="changestatus"
|
||||||
disabled={jobRO || !job.converted}
|
disabled={jobRO || !job.converted}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Dropdown, Menu } from "antd";
|
import { Button, Dropdown } 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";
|
||||||
@@ -62,18 +62,17 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const overlay = (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
const overlay = {
|
||||||
<Menu onClick={handleMenuClick}>
|
onClick: handleMenuClick,
|
||||||
{bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => (
|
items: bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => ({
|
||||||
<Menu.Item disabled={disabled} key={mapping.name}>
|
label: mapping.name,
|
||||||
{mapping.name}
|
key: mapping.name,
|
||||||
</Menu.Item>
|
disabled: disabled,
|
||||||
))}
|
})),
|
||||||
</Menu>
|
};
|
||||||
);
|
|
||||||
|
|
||||||
return bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? (
|
return bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? (
|
||||||
<Dropdown overlay={overlay}>
|
<Dropdown menu={overlay}>
|
||||||
<Button disabled={disabled}>{t("jobs.actions.dmsautoallocate")}</Button>
|
<Button disabled={disabled}>{t("jobs.actions.dmsautoallocate")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -4,35 +4,22 @@ import axios from "axios";
|
|||||||
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 { useHistory } from "react-router-dom";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
import { auth } from "../../firebase/firebase.utils";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import client from "../../utils/GraphQLClient";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateJobCache(items) {
|
|
||||||
client.cache.modify({
|
|
||||||
id: "ROOT_QUERY",
|
|
||||||
fields: {
|
|
||||||
jobs(existingJobs = []) {
|
|
||||||
return existingJobs.filter(
|
|
||||||
(jobRef) => jobRef.__ref.includes(items) === false
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function JobsCloseExportButton({
|
export function JobsCloseExportButton({
|
||||||
bodyshop,
|
bodyshop,
|
||||||
currentUser,
|
currentUser,
|
||||||
@@ -114,9 +101,6 @@ export function JobsCloseExportButton({
|
|||||||
|
|
||||||
//Check to see if any of them failed. If they didn't don't execute the update.
|
//Check to see if any of them failed. If they didn't don't execute the update.
|
||||||
const failedTransactions = PartnerResponse.data.filter((r) => !r.success);
|
const failedTransactions = PartnerResponse.data.filter((r) => !r.success);
|
||||||
const successfulTransactions = PartnerResponse.data.filter(
|
|
||||||
(r) => r.success
|
|
||||||
);
|
|
||||||
if (failedTransactions.length > 0) {
|
if (failedTransactions.length > 0) {
|
||||||
//Uh oh. At least one was no good.
|
//Uh oh. At least one was no good.
|
||||||
failedTransactions.forEach((ft) => {
|
failedTransactions.forEach((ft) => {
|
||||||
@@ -175,15 +159,12 @@ export function JobsCloseExportButton({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!!!jobUpdateResponse.errors) {
|
if (!jobUpdateResponse.errors) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "success",
|
type: "success",
|
||||||
key: "jobsuccessexport",
|
key: "jobsuccessexport",
|
||||||
message: t("jobs.successes.exported"),
|
message: t("jobs.successes.exported"),
|
||||||
});
|
});
|
||||||
updateJobCache(
|
|
||||||
jobUpdateResponse.data.update_jobs.returning.map((job) => job.id)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.exporting", {
|
message: t("jobs.errors.exporting", {
|
||||||
@@ -192,31 +173,13 @@ export function JobsCloseExportButton({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && successfulTransactions.length > 0) {
|
|
||||||
notification.open({
|
|
||||||
type: "success",
|
|
||||||
key: "jobsuccessexport",
|
|
||||||
message: t("jobs.successes.exported"),
|
|
||||||
});
|
|
||||||
updateJobCache([
|
|
||||||
...new Set(
|
|
||||||
successfulTransactions.map(
|
|
||||||
(st) =>
|
|
||||||
st[
|
|
||||||
bodyshop.accountingconfig && bodyshop.accountingconfig.qbo
|
|
||||||
? "jobid"
|
|
||||||
: "id"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (setSelectedJobs) {
|
if (setSelectedJobs) {
|
||||||
setSelectedJobs((selectedJobs) => {
|
setSelectedJobs((selectedJobs) => {
|
||||||
return selectedJobs.filter((i) => i !== jobId);
|
return selectedJobs.filter((i) => i !== jobId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch();
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,22 +43,14 @@ export function JobsConvertButton({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const handleConvert = async ({ employee_csr, category, ...values }) => {
|
const handleConvert = async (values) => {
|
||||||
if (parentFormIsFieldsTouched()) {
|
if (parentFormIsFieldsTouched()) {
|
||||||
alert(t("jobs.labels.savebeforeconversion"));
|
alert(t("jobs.labels.savebeforeconversion"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const res = await mutationConvertJob({
|
const res = await mutationConvertJob({
|
||||||
variables: {
|
variables: { jobId: job.id, ...values },
|
||||||
jobId: job.id,
|
|
||||||
job: {
|
|
||||||
converted: true,
|
|
||||||
...(bodyshop.enforce_conversion_csr ? { employee_csr } : {}),
|
|
||||||
...(bodyshop.enforce_conversion_category ? { category } : {}),
|
|
||||||
...values,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (values.ca_gst_registrant) {
|
if (values.ca_gst_registrant) {
|
||||||
@@ -95,7 +87,6 @@ export function JobsConvertButton({
|
|||||||
driveable: true,
|
driveable: true,
|
||||||
towin: false,
|
towin: false,
|
||||||
employee_csr: job.employee_csr,
|
employee_csr: job.employee_csr,
|
||||||
category: job.category,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -108,9 +99,9 @@ export function JobsConvertButton({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Select showSearch>
|
<Select>
|
||||||
{bodyshop.md_ins_cos.map((s, i) => (
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
<Select.Option key={i} value={s.name}>
|
<Select.Option key={s.name} value={s.name}>
|
||||||
{s.name}
|
{s.name}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
))}
|
))}
|
||||||
@@ -199,35 +190,13 @@ export function JobsConvertButton({
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
{bodyshop.enforce_conversion_category && (
|
<Form.Item
|
||||||
<Form.Item
|
label={t("jobs.fields.ca_gst_registrant")}
|
||||||
name={"category"}
|
name="ca_gst_registrant"
|
||||||
label={t("jobs.fields.category")}
|
valuePropName="checked"
|
||||||
rules={[
|
>
|
||||||
{
|
<Switch />
|
||||||
required: bodyshop.enforce_conversion_category,
|
</Form.Item>
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Select allowClear>
|
|
||||||
{bodyshop.md_categories.map((s) => (
|
|
||||||
<Select.Option key={s} value={s}>
|
|
||||||
{s}
|
|
||||||
</Select.Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
{bodyshop.region_config.toLowerCase().startsWith("ca") && (
|
|
||||||
<Form.Item
|
|
||||||
label={t("jobs.fields.ca_gst_registrant")}
|
|
||||||
name="ca_gst_registrant"
|
|
||||||
valuePropName="checked"
|
|
||||||
>
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.driveable")}
|
label={t("jobs.fields.driveable")}
|
||||||
name="driveable"
|
name="driveable"
|
||||||
@@ -257,7 +226,7 @@ export function JobsConvertButton({
|
|||||||
if (job.converted) return <></>;
|
if (job.converted) return <></>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover visible={visible} content={popMenu}>
|
<Popover open={visible} content={popMenu}>
|
||||||
<Button
|
<Button
|
||||||
key="convert"
|
key="convert"
|
||||||
type="danger"
|
type="danger"
|
||||||
|
|||||||
@@ -224,15 +224,13 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
|||||||
>
|
>
|
||||||
<CurrencyInput />
|
<CurrencyInput />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{bodyshop.region_config.toLowerCase().startsWith("ca") && (
|
<Form.Item
|
||||||
<Form.Item
|
label={t("jobs.fields.ca_gst_registrant")}
|
||||||
label={t("jobs.fields.ca_gst_registrant")}
|
name="ca_gst_registrant"
|
||||||
name="ca_gst_registrant"
|
valuePropName="checked"
|
||||||
valuePropName="checked"
|
>
|
||||||
>
|
<Switch />
|
||||||
<Switch />
|
</Form.Item>
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.other_amount_payable")}
|
label={t("jobs.fields.other_amount_payable")}
|
||||||
name="other_amount_payable"
|
name="other_amount_payable"
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ const colSpan = {
|
|||||||
lg: { span: 12 },
|
lg: { span: 12 },
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function JobsCreateVehicleInfoComponent({
|
export default function JobsCreateVehicleInfoComponent({ loading, vehicles }) {
|
||||||
loading,
|
|
||||||
vehicles,
|
|
||||||
form,
|
|
||||||
}) {
|
|
||||||
const [state, setState] = useContext(JobCreateContext);
|
const [state, setState] = useContext(JobCreateContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
@@ -62,7 +58,7 @@ export default function JobsCreateVehicleInfoComponent({
|
|||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...colSpan}>
|
<Col {...colSpan}>
|
||||||
<JobsCreateVehicleInfoNewComponent form={form}/>
|
<JobsCreateVehicleInfoNewComponent />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export default function JobsCreateVehicleInfoContainer({ form }) {
|
|||||||
<JobsCreateVehicleInfoComponent
|
<JobsCreateVehicleInfoComponent
|
||||||
loading={loading}
|
loading={loading}
|
||||||
vehicles={data ? data.search_vehicles : null}
|
vehicles={data ? data.search_vehicles : null}
|
||||||
form={form}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ import { useTranslation } from "react-i18next";
|
|||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
import JobsCreateVehicleInfoPredefined from "./jobs-create-vehicle-info.predefined.component";
|
|
||||||
|
|
||||||
export default function JobsCreateVehicleInfoNewComponent({ form }) {
|
export default function JobsCreateVehicleInfoNewComponent() {
|
||||||
const [state] = useContext(JobCreateContext);
|
const [state] = useContext(JobCreateContext);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -26,7 +25,7 @@ export default function JobsCreateVehicleInfoNewComponent({ form }) {
|
|||||||
<Input disabled={!state.vehicle.new} />
|
<Input disabled={!state.vehicle.new} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow grow noDivider>
|
<LayoutFormRow grow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("vehicles.fields.v_color")}
|
label={t("vehicles.fields.v_color")}
|
||||||
name={["vehicle", "data", "v_color"]}
|
name={["vehicle", "data", "v_color"]}
|
||||||
@@ -53,9 +52,8 @@ export default function JobsCreateVehicleInfoNewComponent({ form }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow grow noDivider>
|
<LayoutFormRow grow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
span={10}
|
|
||||||
label={t("vehicles.fields.v_make_desc")}
|
label={t("vehicles.fields.v_make_desc")}
|
||||||
name={["vehicle", "data", "v_make_desc"]}
|
name={["vehicle", "data", "v_make_desc"]}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -68,7 +66,6 @@ export default function JobsCreateVehicleInfoNewComponent({ form }) {
|
|||||||
<Input disabled={!state.vehicle.new} />
|
<Input disabled={!state.vehicle.new} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
span={11}
|
|
||||||
label={t("vehicles.fields.v_model_desc")}
|
label={t("vehicles.fields.v_model_desc")}
|
||||||
name={["vehicle", "data", "v_model_desc"]}
|
name={["vehicle", "data", "v_model_desc"]}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -80,11 +77,6 @@ export default function JobsCreateVehicleInfoNewComponent({ form }) {
|
|||||||
>
|
>
|
||||||
<Input disabled={!state.vehicle.new} />
|
<Input disabled={!state.vehicle.new} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<JobsCreateVehicleInfoPredefined
|
|
||||||
disabled={!state.vehicle.new}
|
|
||||||
form={form}
|
|
||||||
span={1}
|
|
||||||
/>
|
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow header={t("vehicles.forms.registration")} grow>
|
<LayoutFormRow header={t("vehicles.forms.registration")} grow>
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
import { PlusOutlined, SearchOutlined } from "@ant-design/icons";
|
|
||||||
import { Button, Input, Popover, Table } from "antd";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import PredefinedVehicles from "./predefined-vehicles.js";
|
|
||||||
|
|
||||||
export default function JobsCreateVehicleInfoPredefined({ disabled, form }) {
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const [search, setSearch] = useState("");
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const handleOpenChange = (newOpen) => {
|
|
||||||
setOpen(newOpen);
|
|
||||||
setSearch("");
|
|
||||||
};
|
|
||||||
const filteredPredefinedVehicles =
|
|
||||||
search === ""
|
|
||||||
? PredefinedVehicles
|
|
||||||
: PredefinedVehicles.filter(
|
|
||||||
(v) =>
|
|
||||||
v.make.toLowerCase().includes(search.toLowerCase()) ||
|
|
||||||
v.model.toLowerCase().includes(search.toLowerCase())
|
|
||||||
);
|
|
||||||
|
|
||||||
const popContent = () => (
|
|
||||||
<div>
|
|
||||||
<Table
|
|
||||||
size="small"
|
|
||||||
title={() => <Input.Search onSearch={(value) => setSearch(value)} />}
|
|
||||||
dataSource={filteredPredefinedVehicles}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
dataIndex: "make",
|
|
||||||
key: "make",
|
|
||||||
title: t("vehicles.fields.v_make_desc"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dataIndex: "model",
|
|
||||||
key: "model",
|
|
||||||
title: t("vehicles.fields.v_model_desc"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dataIndex: "select",
|
|
||||||
key: "select",
|
|
||||||
title: t("general.labels.actions"),
|
|
||||||
render: (value, record) => (
|
|
||||||
<Button
|
|
||||||
disabled={disabled}
|
|
||||||
onClick={() => {
|
|
||||||
form.setFieldsValue({
|
|
||||||
vehicle: {
|
|
||||||
data: {
|
|
||||||
v_make_desc: record.make,
|
|
||||||
v_model_desc: record.model,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
setOpen(false);
|
|
||||||
setSearch("");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PlusOutlined />
|
|
||||||
</Button>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<Popover
|
|
||||||
content={popContent}
|
|
||||||
trigger="click"
|
|
||||||
open={open}
|
|
||||||
placement="left"
|
|
||||||
onOpenChange={handleOpenChange}
|
|
||||||
destroyTooltipOnHide
|
|
||||||
>
|
|
||||||
<SearchOutlined style={{ cursor: "pointer" }} />
|
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
import { DownOutlined } from "@ant-design/icons";
|
import { DownOutlined } from "@ant-design/icons";
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -15,20 +15,17 @@ export function JobsDetailChangeEstimator({ disabled, form, bodyshop }) {
|
|||||||
form.setFieldsValue(est);
|
form.setFieldsValue(est);
|
||||||
};
|
};
|
||||||
|
|
||||||
const menu = (
|
const menu = {
|
||||||
<div>
|
onClick: handleClick,
|
||||||
<Menu onClick={handleClick}>
|
items: bodyshop.md_estimators.map((est, idx) => ({
|
||||||
{bodyshop.md_estimators.map((est, idx) => (
|
value: est,
|
||||||
<Menu.Item value={est} key={idx}>
|
key: idx,
|
||||||
{`${est.est_ct_fn} ${est.est_ct_ln}`}
|
label: `${est.est_ct_fn || ""} ${est.est_ct_ln || ""}`.trim(),
|
||||||
</Menu.Item>
|
})),
|
||||||
))}
|
};
|
||||||
</Menu>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown overlay={menu} disabled={disabled}>
|
<Dropdown menu={menu} disabled={disabled}>
|
||||||
<a
|
<a
|
||||||
className="ant-dropdown-link"
|
className="ant-dropdown-link"
|
||||||
href=" #"
|
href=" #"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DownOutlined } from "@ant-design/icons";
|
import { DownOutlined } from "@ant-design/icons";
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -15,23 +15,21 @@ export function JobsDetailChangeFilehandler({ disabled, form, bodyshop }) {
|
|||||||
form.setFieldsValue(est);
|
form.setFieldsValue(est);
|
||||||
};
|
};
|
||||||
|
|
||||||
const menu = (
|
const menu = {
|
||||||
<Menu
|
onClick: handleClick,
|
||||||
onClick={handleClick}
|
style: {
|
||||||
style={{
|
columnCount: Math.floor(bodyshop.md_filehandlers.length / 10) + 1,
|
||||||
columnCount: Math.floor(bodyshop.md_filehandlers.length / 10) + 1,
|
},
|
||||||
}}
|
items: bodyshop.md_filehandlers.map((est, idx) => ({
|
||||||
>
|
value: est,
|
||||||
{bodyshop.md_filehandlers.map((est, idx) => (
|
key: idx,
|
||||||
<Menu.Item value={est} key={idx} style={{ breakInside: "avoid" }}>
|
style: { breakInside: "avoid" },
|
||||||
{`${est.ins_ct_fn} ${est.ins_ct_ln}`}
|
label: `${est.ins_ct_fn || ""} ${est.ins_ct_ln || ""}`.trim(),
|
||||||
</Menu.Item>
|
})),
|
||||||
))}
|
};
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown overlay={menu} disabled={disabled}>
|
<Dropdown menu={menu} disabled={disabled}>
|
||||||
<a
|
<a
|
||||||
className="ant-dropdown-link"
|
className="ant-dropdown-link"
|
||||||
href=" #"
|
href=" #"
|
||||||
|
|||||||
@@ -141,17 +141,6 @@ export function JobsDetailDatesComponent({ jobRO, job, bodyshop }) {
|
|||||||
<Form.Item label={t("jobs.fields.date_exported")} name="date_exported">
|
<Form.Item label={t("jobs.fields.date_exported")} name="date_exported">
|
||||||
<DateTimePicker disabled={true || jobRO} />
|
<DateTimePicker disabled={true || jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("jobs.fields.date_void")} name="date_void">
|
|
||||||
<DateTimePicker disabled={true || jobRO} />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
label={t("jobs.fields.date_lost_sale")}
|
|
||||||
name="date_lost_sale"
|
|
||||||
>
|
|
||||||
<DateTimePicker disabled={true || jobRO} />
|
|
||||||
</Form.Item>
|
|
||||||
</FormRow>
|
</FormRow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
|||||||
</FormRow>
|
</FormRow>
|
||||||
<FormRow header={t("jobs.forms.other")}>
|
<FormRow header={t("jobs.forms.other")}>
|
||||||
<Form.Item label={t("jobs.fields.category")} name="category">
|
<Form.Item label={t("jobs.fields.category")} name="category">
|
||||||
<Select disabled={jobRO} allowClear>
|
<Select disabled={jobRO}>
|
||||||
{bodyshop.md_categories.map((s) => (
|
{bodyshop.md_categories.map((s) => (
|
||||||
<Select.Option key={s} value={s}>
|
<Select.Option key={s} value={s}>
|
||||||
{s}
|
{s}
|
||||||
@@ -289,12 +289,6 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
|||||||
>
|
>
|
||||||
<Input disabled={jobRO} />
|
<Input disabled={jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
|
||||||
label={t("jobs.fields.lost_sale_reason")}
|
|
||||||
name="lost_sale_reason"
|
|
||||||
>
|
|
||||||
<Input disabled={jobRO} allowClear />
|
|
||||||
</Form.Item>
|
|
||||||
</FormRow>
|
</FormRow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user