Compare commits
42 Commits
release/20
...
release/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a49c61105 | ||
|
|
448b6c723d | ||
|
|
74b9eb40b1 | ||
|
|
53af7a916c | ||
|
|
35bb79cc59 | ||
|
|
a7c3d89531 | ||
|
|
09cd44905a | ||
|
|
2b635ba3bf | ||
|
|
cd191dae70 | ||
|
|
780d8b926d | ||
|
|
267b927a7f | ||
|
|
2c793c25ee | ||
|
|
58848481c9 | ||
|
|
5bb1231d5e | ||
|
|
932bbd8fde | ||
|
|
76ea8ca2ed | ||
|
|
02fcbf7ffa | ||
|
|
1f7b53ee22 | ||
|
|
01977cefde | ||
|
|
26d22388c0 | ||
|
|
22a5c4a12d | ||
|
|
61edcf63be | ||
|
|
a09daf052b | ||
|
|
4393bf42ed | ||
|
|
df83acb5ed | ||
|
|
09cf49080b | ||
|
|
3b301efd27 | ||
|
|
2e843bbd8a | ||
|
|
b539ecaeb1 | ||
|
|
62cba80f82 | ||
|
|
7d7cd8d85e | ||
|
|
1cf2851e39 | ||
|
|
c644ed67fd | ||
|
|
3c9625b622 | ||
|
|
0109c9974f | ||
|
|
b601bf1c1f | ||
|
|
ca6f4070d0 | ||
|
|
112dfdf074 | ||
|
|
ff5611e123 | ||
|
|
485959c399 | ||
|
|
122d21d4eb | ||
|
|
e0157f6da4 |
@@ -1348,6 +1348,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>jobioucreated</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>jobmodifylbradj</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -2716,6 +2737,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>iouexists</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>local_tax</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -14157,6 +14199,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>tryagain</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>view</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -14204,6 +14267,27 @@
|
||||
<folder_node>
|
||||
<name>errors</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>fcm</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>notfound</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -14592,6 +14676,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>help</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>hours</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -17339,6 +17444,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>ioucreated</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>new</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -17800,6 +17926,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>createiou</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>deliver</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -24763,6 +24910,27 @@
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<concept_node>
|
||||
<name>createiouwarning</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>creating_new_job</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -27098,6 +27266,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>ioucreated</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>partsqueue</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -29738,6 +29927,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>nopush</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>phonenumber</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,53 +1,56 @@
|
||||
importScripts("https://www.gstatic.com/firebasejs/7.14.2/firebase-app.js");
|
||||
importScripts(
|
||||
"https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js"
|
||||
);
|
||||
// Scripts for firebase and firebase messaging
|
||||
importScripts("https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js");
|
||||
importScripts("https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js");
|
||||
|
||||
firebase.initializeApp({
|
||||
apiKey: "AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU",
|
||||
authDomain: "imex-prod.firebaseapp.com",
|
||||
databaseURL: "https://imex-prod.firebaseio.com",
|
||||
projectId: "imex-prod",
|
||||
storageBucket: "imex-prod.appspot.com",
|
||||
messagingSenderId: "253497221485",
|
||||
appId: "1:253497221485:web:3c81c483b94db84b227a64",
|
||||
measurementId: "G-NTWBKG2L0M",
|
||||
});
|
||||
// Initialize the Firebase app in the service worker by passing the generated config
|
||||
let firebaseConfig;
|
||||
switch (this.location.hostname) {
|
||||
case "localhost":
|
||||
firebaseConfig = {
|
||||
apiKey: "AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc",
|
||||
authDomain: "imex-dev.firebaseapp.com",
|
||||
databaseURL: "https://imex-dev.firebaseio.com",
|
||||
projectId: "imex-dev",
|
||||
storageBucket: "imex-dev.appspot.com",
|
||||
messagingSenderId: "759548147434",
|
||||
appId: "1:759548147434:web:e8239868a48ceb36700993",
|
||||
measurementId: "G-K5XRBVVB4S",
|
||||
};
|
||||
break;
|
||||
case "test.imex.online":
|
||||
firebaseConfig = {
|
||||
apiKey: "AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c",
|
||||
authDomain: "imex-test.firebaseapp.com",
|
||||
projectId: "imex-test",
|
||||
storageBucket: "imex-test.appspot.com",
|
||||
messagingSenderId: "991923618608",
|
||||
appId: "1:991923618608:web:633437569cdad78299bef5",
|
||||
// measurementId: "${config.measurementId}",
|
||||
};
|
||||
break;
|
||||
case "imex.online":
|
||||
default:
|
||||
firebaseConfig = {
|
||||
apiKey: "AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU",
|
||||
authDomain: "imex-prod.firebaseapp.com",
|
||||
databaseURL: "https://imex-prod.firebaseio.com",
|
||||
projectId: "imex-prod",
|
||||
storageBucket: "imex-prod.appspot.com",
|
||||
messagingSenderId: "253497221485",
|
||||
appId: "1:253497221485:web:3c81c483b94db84b227a64",
|
||||
measurementId: "G-NTWBKG2L0M",
|
||||
};
|
||||
}
|
||||
|
||||
// firebase.initializeApp({
|
||||
// apiKey: "AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc",
|
||||
// authDomain: "imex-dev.firebaseapp.com",
|
||||
// databaseURL: "https://imex-dev.firebaseio.com",
|
||||
// projectId: "imex-dev",
|
||||
// storageBucket: "imex-dev.appspot.com",
|
||||
// messagingSenderId: "759548147434",
|
||||
// appId: "1:759548147434:web:e8239868a48ceb36700993",
|
||||
// measurementId: "G-K5XRBVVB4S",
|
||||
// });
|
||||
firebase.initializeApp(firebaseConfig);
|
||||
|
||||
// Retrieve firebase messaging
|
||||
const messaging = firebase.messaging();
|
||||
|
||||
self.addEventListener("fetch", (fetch) => {
|
||||
//required for installation as a PWA. Can ignore for now.
|
||||
//console.log("fetch", fetch);
|
||||
});
|
||||
messaging.onBackgroundMessage(function (payload) {
|
||||
// Customize notification here
|
||||
const channel = new BroadcastChannel("imex-sw-messages");
|
||||
channel.postMessage(payload);
|
||||
|
||||
messaging.setBackgroundMessageHandler(function (payload) {
|
||||
return self.registration.showNotification(
|
||||
"[SW]" + payload.notification.title,
|
||||
payload.notification
|
||||
);
|
||||
});
|
||||
|
||||
//Handles the notification getting clicked.
|
||||
self.addEventListener("notificationclick", function (event) {
|
||||
console.log("SW notificationclick", event);
|
||||
// event.notification.close();
|
||||
if (event.action === "archive") {
|
||||
// Archive action was clicked
|
||||
archiveEmail();
|
||||
} else {
|
||||
// Main body of notification was clicked
|
||||
clients.openWindow("/inbox");
|
||||
}
|
||||
//self.registration.showNotification(notificationTitle, notificationOptions);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { ApolloProvider } from "@apollo/client";
|
||||
//import trackerRedux from "@openreplay/tracker-redux";
|
||||
import Tracker from "@openreplay/tracker";
|
||||
import trackerGraphQL from "@openreplay/tracker-graphql";
|
||||
import { SplitFactory, SplitSdk } from "@splitsoftware/splitio-react";
|
||||
import { ConfigProvider } from "antd";
|
||||
import enLocale from "antd/es/locale/en_US";
|
||||
@@ -10,30 +7,13 @@ import moment from "moment";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
|
||||
//import trackerAssist from "@openreplay/tracker-assist";
|
||||
import { getCurrentUser } from "../firebase/firebase.utils";
|
||||
import client from "../utils/GraphQLClient";
|
||||
import App from "./App";
|
||||
|
||||
|
||||
moment.locale("en-US");
|
||||
|
||||
export const tracker = new Tracker({
|
||||
projectKey: "trDmOZlEXUpjGsMtHroA",
|
||||
ingestPoint: "https://replay.imex.online/ingest",
|
||||
...(process.env.NODE_ENV === null || process.env.NODE_ENV === "development"
|
||||
? { __DISABLE_SECURE_MODE: true }
|
||||
: {}),
|
||||
// beaconSize: 10485760,
|
||||
onStart: async ({ sessionID }) => {
|
||||
const user = await getCurrentUser();
|
||||
if (user) tracker.setUserID(user.email);
|
||||
},
|
||||
});
|
||||
|
||||
// tracker.use(
|
||||
// trackerAssist({ confirmText: "Technical support is about to assist you." })
|
||||
// ); // check the list of available options below
|
||||
export const recordGraphQL = tracker.use(trackerGraphQL());
|
||||
//tracker.start();
|
||||
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { UploadOutlined } from "@ant-design/icons";
|
||||
import Icon, { UploadOutlined } from "@ant-design/icons";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { MdOpenInNew } from "react-icons/md";
|
||||
import {
|
||||
Alert,
|
||||
Divider,
|
||||
Form,
|
||||
Input,
|
||||
@@ -13,6 +15,7 @@ import {
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { CHECK_BILL_INVOICE_NUMBER } from "../../graphql/bills.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
@@ -132,6 +135,30 @@ export function BillFormComponent({
|
||||
/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
{job &&
|
||||
job.ious &&
|
||||
job.ious.length > 0 &&
|
||||
job.ious.map((iou) => (
|
||||
<Alert
|
||||
key={iou.id}
|
||||
type="warning"
|
||||
message={
|
||||
<Space>
|
||||
{t("bills.labels.iouexists")}
|
||||
<Link
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
to={`/manage/jobs/${iou.id}?tab=repairdata`}
|
||||
>
|
||||
<Space>
|
||||
{iou.ro_number}
|
||||
<Icon component={MdOpenInNew} />
|
||||
</Space>
|
||||
</Link>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t("bills.fields.invoice_number")}
|
||||
@@ -337,6 +364,7 @@ export function BillFormComponent({
|
||||
responsibilityCenters={responsibilityCenters}
|
||||
disabled={disabled}
|
||||
/>
|
||||
|
||||
<Form.Item
|
||||
name="upload"
|
||||
label="Upload"
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import { MessageOutlined } from "@ant-design/icons";
|
||||
import { Badge, Card } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { toggleChatVisible } from "../../redux/messaging/messaging.actions";
|
||||
import { selectChatVisible } from "../../redux/messaging/messaging.selectors";
|
||||
import ChatPopupComponent from '../chat-popup/chat-popup.component'
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
chatVisible: selectChatVisible,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
toggleChatVisible: () => dispatch(toggleChatVisible()),
|
||||
});
|
||||
|
||||
export function ChatAffixComponent({
|
||||
chatVisible,
|
||||
toggleChatVisible,
|
||||
conversationList,
|
||||
unreadCount,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Badge count={unreadCount}>
|
||||
<Card size='small'>
|
||||
{chatVisible ? (
|
||||
<ChatPopupComponent conversationList={conversationList} />
|
||||
) : (
|
||||
<div
|
||||
onClick={() => toggleChatVisible()}
|
||||
style={{ cursor: "pointer" }}>
|
||||
<MessageOutlined />
|
||||
<strong>{t("messaging.labels.messaging")}</strong>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ChatAffixComponent);
|
||||
@@ -1,13 +1,16 @@
|
||||
import { useSubscription } from "@apollo/client";
|
||||
import React from "react";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { getToken, onMessage } from "@firebase/messaging";
|
||||
import { Button, notification, Space } from "antd";
|
||||
import axios from "axios";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { CONVERSATION_LIST_SUBSCRIPTION } from "../../graphql/conversations.queries";
|
||||
import { messaging, requestForToken } from "../../firebase/firebase.utils";
|
||||
import { selectChatVisible } from "../../redux/messaging/messaging.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import ChatAffixComponent from "./chat-affix.component";
|
||||
import FcmHandler from "../../utils/fcm-handler";
|
||||
import ChatPopupComponent from "../chat-popup/chat-popup.component";
|
||||
import "./chat-affix.styles.scss";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
@@ -16,32 +19,87 @@ const mapStateToProps = createStructuredSelector({
|
||||
});
|
||||
|
||||
export function ChatAffixContainer({ bodyshop, chatVisible }) {
|
||||
const { loading, error, data } = useSubscription(
|
||||
CONVERSATION_LIST_SUBSCRIPTION,
|
||||
{
|
||||
skip: !bodyshop || (bodyshop && !bodyshop.messagingservicesid),
|
||||
}
|
||||
);
|
||||
const { t } = useTranslation();
|
||||
const client = useApolloClient();
|
||||
useEffect(() => {
|
||||
if (!bodyshop || !bodyshop.messagingservicesid) return;
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
async function SubscribeToTopic() {
|
||||
try {
|
||||
const r = await axios.post("/notifications/subscribe", {
|
||||
fcm_tokens: await getToken(messaging, {
|
||||
vapidKey: process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY,
|
||||
}),
|
||||
type: "messaging",
|
||||
imexshopid: bodyshop.imexshopid,
|
||||
});
|
||||
console.log("FCM Topic Subscription", r.data);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
"Error attempting to subscribe to messaging topic: ",
|
||||
error
|
||||
);
|
||||
notification.open({
|
||||
type: "warning",
|
||||
message: t("general.errors.fcm"),
|
||||
btn: (
|
||||
<Space>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await requestForToken();
|
||||
|
||||
SubscribeToTopic();
|
||||
}}
|
||||
>
|
||||
{t("general.actions.tryagain")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
const win = window.open(
|
||||
"https://help.imex.online/en/article/enabling-notifications-o978xi/",
|
||||
"_blank"
|
||||
);
|
||||
win.focus();
|
||||
}}
|
||||
>
|
||||
{t("general.labels.help")}
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
SubscribeToTopic();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [bodyshop]);
|
||||
|
||||
useEffect(() => {
|
||||
function handleMessage(payload) {
|
||||
FcmHandler({
|
||||
client,
|
||||
payload: (payload && payload.data && payload.data.data) || payload.data,
|
||||
});
|
||||
}
|
||||
let stopMessageListenr, channel;
|
||||
try {
|
||||
stopMessageListenr = onMessage(messaging, handleMessage);
|
||||
channel = new BroadcastChannel("imex-sw-messages");
|
||||
channel.addEventListener("message", handleMessage);
|
||||
} catch (error) {
|
||||
console.log("Unable to set event listeners.");
|
||||
}
|
||||
return () => {
|
||||
stopMessageListenr && stopMessageListenr();
|
||||
channel && channel.removeEventListener("message", handleMessage);
|
||||
};
|
||||
}, [client]);
|
||||
|
||||
if (!bodyshop || !bodyshop.messagingservicesid) return <></>;
|
||||
|
||||
return (
|
||||
<div className={`chat-affix ${chatVisible ? "chat-affix-open" : ""}`}>
|
||||
{bodyshop && bodyshop.messagingservicesid ? (
|
||||
<ChatAffixComponent
|
||||
conversationList={(data && data.conversations) || []}
|
||||
unreadCount={
|
||||
(data &&
|
||||
data.conversations.reduce((acc, val) => {
|
||||
return (acc = acc + val.messages_aggregate.aggregate.count);
|
||||
}, 0)) ||
|
||||
0
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
{bodyshop && bodyshop.messagingservicesid ? <ChatPopupComponent /> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { Badge, List, Tag, Tooltip } from "antd";
|
||||
import { AlertFilled } from "@ant-design/icons";
|
||||
import { Badge, List, Tag } from "antd";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setSelectedConversation } from "../../redux/messaging/messaging.actions";
|
||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||
import "./chat-conversation-list.styles.scss";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
selectedConversation: selectSelectedConversation,
|
||||
@@ -24,8 +22,6 @@ export function ChatConversationListComponent({
|
||||
selectedConversation,
|
||||
setSelectedConversation,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="chat-list-container">
|
||||
<List
|
||||
@@ -33,6 +29,7 @@ export function ChatConversationListComponent({
|
||||
dataSource={conversationList}
|
||||
renderItem={(item) => (
|
||||
<List.Item
|
||||
key={item.id}
|
||||
onClick={() => setSelectedConversation(item.id)}
|
||||
className={`chat-list-item ${
|
||||
item.id === selectedConversation
|
||||
@@ -43,19 +40,9 @@ export function ChatConversationListComponent({
|
||||
{item.job_conversations.length > 0 ? (
|
||||
<div className="chat-name">
|
||||
{item.job_conversations.map((j, idx) => (
|
||||
<div key={idx} style={{ display: "flex" }}>
|
||||
{j.job.owner && !j.job.owner.allow_text_message && (
|
||||
<Tooltip title={t("messaging.labels.noallowtxt")}>
|
||||
<AlertFilled
|
||||
className="production-alert"
|
||||
style={{ marginRight: ".3rem", alignItems: "center" }}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
<div>{`${j.job.ownr_fn || ""} ${j.job.ownr_ln || ""} ${
|
||||
j.job.ownr_co_nm || ""
|
||||
} `}</div>
|
||||
</div>
|
||||
<div key={idx}>{`${j.job.ownr_fn || ""} ${
|
||||
j.job.ownr_ln || ""
|
||||
} ${j.job.ownr_co_nm || ""} `}</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -9,6 +9,7 @@ import "./chat-conversation.styles.scss";
|
||||
export default function ChatConversationComponent({
|
||||
subState,
|
||||
conversation,
|
||||
messages,
|
||||
handleMarkConversationAsRead,
|
||||
}) {
|
||||
const [loading, error] = subState;
|
||||
@@ -16,8 +17,6 @@ export default function ChatConversationComponent({
|
||||
if (loading) return <LoadingSkeleton />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
const messages = (conversation && conversation.messages) || [];
|
||||
|
||||
return (
|
||||
<div
|
||||
className="chat-conversation"
|
||||
|
||||
@@ -1,18 +1,32 @@
|
||||
import { useMutation, useSubscription } from "@apollo/client";
|
||||
import { useMutation, useQuery, useSubscription } from "@apollo/client";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { CONVERSATION_SUBSCRIPTION_BY_PK } from "../../graphql/conversations.queries";
|
||||
import {
|
||||
CONVERSATION_SUBSCRIPTION_BY_PK,
|
||||
GET_CONVERSATION_DETAILS,
|
||||
} from "../../graphql/conversations.queries";
|
||||
import { MARK_MESSAGES_AS_READ_BY_CONVERSATION } from "../../graphql/messages.queries";
|
||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||
import ChatConversationComponent from "./chat-conversation.component";
|
||||
import axios from "axios";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
selectedConversation: selectSelectedConversation,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(ChatConversationContainer);
|
||||
|
||||
export function ChatConversationContainer({ selectedConversation }) {
|
||||
export function ChatConversationContainer({ bodyshop, selectedConversation }) {
|
||||
const {
|
||||
loading: convoLoading,
|
||||
error: convoError,
|
||||
data: convoData,
|
||||
} = useQuery(GET_CONVERSATION_DETAILS, {
|
||||
variables: { conversationId: selectedConversation },
|
||||
});
|
||||
|
||||
const { loading, error, data } = useSubscription(
|
||||
CONVERSATION_SUBSCRIPTION_BY_PK,
|
||||
{
|
||||
@@ -26,30 +40,46 @@ export function ChatConversationContainer({ selectedConversation }) {
|
||||
MARK_MESSAGES_AS_READ_BY_CONVERSATION,
|
||||
{
|
||||
variables: { conversationId: selectedConversation },
|
||||
update(cache) {
|
||||
cache.modify({
|
||||
id: cache.identify({
|
||||
__typename: "conversations",
|
||||
id: selectedConversation,
|
||||
}),
|
||||
fields: {
|
||||
messages_aggregate(cached) {
|
||||
return { aggregate: { count: 0 } };
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const unreadCount =
|
||||
(data &&
|
||||
data.conversations_by_pk &&
|
||||
data.conversations_by_pk &&
|
||||
data.conversations_by_pk.messages_aggregate &&
|
||||
data.conversations_by_pk.messages_aggregate.aggregate &&
|
||||
data.conversations_by_pk.messages_aggregate.aggregate.count) ||
|
||||
0;
|
||||
data &&
|
||||
data.messages &&
|
||||
data.messages.reduce((acc, val) => {
|
||||
return !val.read && !val.isoutbound ? acc + 1 : acc;
|
||||
}, 0);
|
||||
|
||||
const handleMarkConversationAsRead = async () => {
|
||||
if (unreadCount > 0 && !!selectedConversation && !markingAsReadInProgress) {
|
||||
setMarkingAsReadInProgress(true);
|
||||
await markConversationRead();
|
||||
await markConversationRead({});
|
||||
await axios.post("/sms/markConversationRead", {
|
||||
conversationid: selectedConversation,
|
||||
imexshopid: bodyshop.imexshopid,
|
||||
});
|
||||
setMarkingAsReadInProgress(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ChatConversationComponent
|
||||
subState={[loading, error]}
|
||||
conversation={data ? data.conversations_by_pk : {}}
|
||||
subState={[loading || convoLoading, error || convoError]}
|
||||
conversation={convoData ? convoData.conversations_by_pk : {}}
|
||||
messages={data ? data.messages : []}
|
||||
handleMarkConversationAsRead={handleMarkConversationAsRead}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ export function ChatNewConversation({ openChatByPhone }) {
|
||||
|
||||
return (
|
||||
<Popover trigger="click" content={popContent}>
|
||||
<PlusCircleFilled style={{ margin: "1rem" }} />
|
||||
<PlusCircleFilled />
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,54 +1,119 @@
|
||||
import { ShrinkOutlined, InfoCircleOutlined } from "@ant-design/icons";
|
||||
import { Col, Row, Tooltip, Typography } from "antd";
|
||||
import React from "react";
|
||||
import {
|
||||
InfoCircleOutlined,
|
||||
MessageOutlined,
|
||||
ShrinkOutlined,
|
||||
SyncOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Badge, Card, Col, Row, Space, Tag, Tooltip, Typography } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { CONVERSATION_LIST_QUERY } from "../../graphql/conversations.queries";
|
||||
import { toggleChatVisible } from "../../redux/messaging/messaging.actions";
|
||||
import {
|
||||
selectChatVisible,
|
||||
selectSelectedConversation,
|
||||
} from "../../redux/messaging/messaging.selectors";
|
||||
import ChatConversationListComponent from "../chat-conversation-list/chat-conversation-list.component";
|
||||
import ChatConversationContainer from "../chat-conversation/chat-conversation.container";
|
||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||
import "./chat-popup.styles.scss";
|
||||
import ChatNewConversation from "../chat-new-conversation/chat-new-conversation.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import "./chat-popup.styles.scss";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
selectedConversation: selectSelectedConversation,
|
||||
chatVisible: selectChatVisible,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
toggleChatVisible: () => dispatch(toggleChatVisible()),
|
||||
});
|
||||
|
||||
export function ChatPopupComponent({
|
||||
conversationList,
|
||||
chatVisible,
|
||||
selectedConversation,
|
||||
toggleChatVisible,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="chat-popup">
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
<Typography.Title level={4}>
|
||||
{t("messaging.labels.messaging")}
|
||||
</Typography.Title>
|
||||
<ChatNewConversation />
|
||||
<Tooltip title={t("messaging.labels.recentonly")}>
|
||||
<InfoCircleOutlined />
|
||||
</Tooltip>
|
||||
</div>
|
||||
<ShrinkOutlined
|
||||
onClick={() => toggleChatVisible()}
|
||||
style={{ position: "absolute", right: ".5rem", top: ".5rem" }}
|
||||
/>
|
||||
const [pollInterval, setpollInterval] = useState(0);
|
||||
const { loading, data, refetch, called } = useQuery(CONVERSATION_LIST_QUERY, {
|
||||
...(pollInterval > 0 ? { pollInterval } : {}),
|
||||
});
|
||||
|
||||
<Row gutter={[8, 8]} className="chat-popup-content">
|
||||
<Col span={8}>
|
||||
<ChatConversationListComponent conversationList={conversationList} />
|
||||
</Col>
|
||||
<Col span={16}>
|
||||
{selectedConversation ? <ChatConversationContainer /> : null}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
const fcmToken = sessionStorage.getItem("fcmtoken");
|
||||
|
||||
useEffect(() => {
|
||||
if (fcmToken) {
|
||||
setpollInterval(0);
|
||||
} else {
|
||||
setpollInterval(60000);
|
||||
}
|
||||
}, [fcmToken]);
|
||||
|
||||
useEffect(() => {
|
||||
if (called && chatVisible) refetch();
|
||||
}, [chatVisible, called, refetch]);
|
||||
|
||||
const unreadCount = data
|
||||
? data.conversations.reduce(
|
||||
(acc, val) => val.messages_aggregate.aggregate.count + acc,
|
||||
0
|
||||
)
|
||||
: 0;
|
||||
|
||||
return (
|
||||
<Badge count={unreadCount}>
|
||||
<Card size="small">
|
||||
{chatVisible ? (
|
||||
<div className="chat-popup">
|
||||
<Space align="center">
|
||||
<Typography.Title level={4}>
|
||||
{t("messaging.labels.messaging")}
|
||||
</Typography.Title>
|
||||
<ChatNewConversation />
|
||||
<Tooltip title={t("messaging.labels.recentonly")}>
|
||||
<InfoCircleOutlined />
|
||||
</Tooltip>
|
||||
<SyncOutlined
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => refetch()}
|
||||
/>
|
||||
{pollInterval > 0 && (
|
||||
<Tag color="yellow">{t("messaging.labels.nopush")}</Tag>
|
||||
)}
|
||||
</Space>
|
||||
<ShrinkOutlined
|
||||
onClick={() => toggleChatVisible()}
|
||||
style={{ position: "absolute", right: ".5rem", top: ".5rem" }}
|
||||
/>
|
||||
|
||||
<Row gutter={[8, 8]} className="chat-popup-content">
|
||||
<Col span={8}>
|
||||
{loading ? (
|
||||
<LoadingSpinner />
|
||||
) : (
|
||||
<ChatConversationListComponent
|
||||
conversationList={data ? data.conversations : []}
|
||||
/>
|
||||
)}
|
||||
</Col>
|
||||
<Col span={16}>
|
||||
{selectedConversation ? <ChatConversationContainer /> : null}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
onClick={() => toggleChatVisible()}
|
||||
style={{ cursor: "pointer" }}
|
||||
>
|
||||
<MessageOutlined />
|
||||
<strong>{t("messaging.labels.messaging")}</strong>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ChatPopupComponent);
|
||||
|
||||
@@ -97,18 +97,20 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
dataSource={allocationsSummary}
|
||||
locale={{ emptyText: t("dms.labels.refreshallocations") }}
|
||||
summary={() => {
|
||||
const totals = allocationsSummary.reduce(
|
||||
(acc, val) => {
|
||||
return {
|
||||
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||
};
|
||||
},
|
||||
{
|
||||
totalSale: Dinero(),
|
||||
totalCost: Dinero(),
|
||||
}
|
||||
);
|
||||
const totals =
|
||||
allocationsSummary &&
|
||||
allocationsSummary.reduce(
|
||||
(acc, val) => {
|
||||
return {
|
||||
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||
};
|
||||
},
|
||||
{
|
||||
totalSale: Dinero(),
|
||||
totalCost: Dinero(),
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<Table.Summary.Row>
|
||||
@@ -118,7 +120,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
</Typography.Title>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals.totalSale.toFormat()}
|
||||
{totals && totals.totalSale.toFormat()}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{
|
||||
|
||||
@@ -22,7 +22,9 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsLogEvents);
|
||||
|
||||
export function DmsLogEvents({ socket, logs, bodyshop }) {
|
||||
return (
|
||||
<Timeline pending reverse={true}>
|
||||
<Timeline pending
|
||||
reverse={true}
|
||||
>
|
||||
{logs.map((log, idx) => (
|
||||
<Timeline.Item key={idx} color={LogLevelHierarchy(log.level)}>
|
||||
<Space wrap align="start" style={{}}>
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import { tracker } from "../../App/App.container";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -37,7 +36,6 @@ class ErrorBoundary extends React.Component {
|
||||
componentDidCatch(error, info) {
|
||||
console.log("Exception Caught by Error Boundary.", error, info);
|
||||
this.setState({ ...this.state, error, info });
|
||||
tracker.event("error_boundary", error, true);
|
||||
}
|
||||
|
||||
handleErrorSubmit = () => {
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Button, notification, Popconfirm } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { UPDATE_JOB_LINES_IOU } from "../../graphql/jobs-lines.queries";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import { CreateIouForJob } from "../jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCreateIOU);
|
||||
|
||||
export function JobCreateIOU({
|
||||
bodyshop,
|
||||
currentUser,
|
||||
jobid,
|
||||
selectedJobLines,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const client = useApolloClient();
|
||||
const history = useHistory();
|
||||
|
||||
const { IOU_Tracking } = useTreatments(
|
||||
["IOU_Tracking"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
if (IOU_Tracking.treatment !== "on") return null;
|
||||
|
||||
const handleCreateIou = async () => {
|
||||
setLoading(true);
|
||||
//Query all of the job details to recreate.
|
||||
const iouId = await CreateIouForJob(
|
||||
client,
|
||||
jobid,
|
||||
{
|
||||
status: bodyshop.md_ro_statuses.default_open,
|
||||
bodyshopid: bodyshop.id,
|
||||
useremail: currentUser.email,
|
||||
},
|
||||
selectedJobLines
|
||||
);
|
||||
notification.open({
|
||||
type: "success",
|
||||
message: t("jobs.successes.ioucreated"),
|
||||
onClick: () => history.push(`/manage/jobs/${iouId}`),
|
||||
});
|
||||
const selectedJobLinesIds = selectedJobLines.map((l) => l.id);
|
||||
await client.mutate({
|
||||
mutation: UPDATE_JOB_LINES_IOU,
|
||||
variables: { ids: selectedJobLinesIds },
|
||||
update(cache) {
|
||||
cache.modify({
|
||||
id: cache.identify(jobid),
|
||||
fields: {
|
||||
joblines(existingJobLines, { readField }) {
|
||||
return existingJobLines.map((a) => {
|
||||
if (!selectedJobLinesIds.includes(a.id)) return a;
|
||||
return { ...a, ioucreated: true };
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Popconfirm
|
||||
title={t("jobs.labels.createiouwarning")}
|
||||
onConfirm={handleCreateIou}
|
||||
>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!selectedJobLines || selectedJobLines.length === 0}
|
||||
>
|
||||
{t("jobs.actions.createiou")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
);
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re
|
||||
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
|
||||
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
||||
import _ from "lodash";
|
||||
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -427,6 +428,7 @@ export function JobLinesComponent({
|
||||
>
|
||||
{t("joblines.actions.new")}
|
||||
</Button>
|
||||
<JobCreateIOU jobid={job.id} selectedJobLines={selectedLines} />
|
||||
<Input.Search
|
||||
placeholder={t("general.labels.search")}
|
||||
onChange={(e) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Input, notification } from "antd";
|
||||
import { Input, notification, Space } from "antd";
|
||||
import { FieldTimeOutlined } from "@ant-design/icons";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
|
||||
@@ -59,6 +60,12 @@ export default function JobLineNotePopup({ jobline, disabled }) {
|
||||
style={{ width: "100%", minHeight: "2rem", cursor: "pointer" }}
|
||||
onClick={() => !disabled && setEditing(true)}
|
||||
>
|
||||
{jobline.ioucreated && (
|
||||
<Space>
|
||||
<FieldTimeOutlined />
|
||||
{t("joblines.labels.ioucreated")}
|
||||
</Space>
|
||||
)}
|
||||
{jobline.notes}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -2,6 +2,8 @@ import Axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { INSERT_NEW_JOB, QUERY_JOB_FOR_DUPE } from "../../graphql/jobs.queries";
|
||||
import moment from "moment";
|
||||
import i18n from "i18next";
|
||||
|
||||
export default async function DuplicateJob(
|
||||
apolloClient,
|
||||
@@ -57,3 +59,71 @@ export default async function DuplicateJob(
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
export async function CreateIouForJob(
|
||||
apolloClient,
|
||||
jobId,
|
||||
config,
|
||||
jobLinesToKeep
|
||||
) {
|
||||
logImEXEvent("job_create_iou");
|
||||
|
||||
const { status } = config;
|
||||
//get a list of all fields on the job
|
||||
const res = await apolloClient.query({
|
||||
query: QUERY_JOB_FOR_DUPE,
|
||||
variables: { id: jobId },
|
||||
});
|
||||
|
||||
const { jobs_by_pk } = res.data;
|
||||
const existingJob = _.cloneDeep(jobs_by_pk);
|
||||
delete existingJob.__typename;
|
||||
delete existingJob.id;
|
||||
delete existingJob.createdat;
|
||||
delete existingJob.updatedat;
|
||||
|
||||
const newJob = {
|
||||
...existingJob,
|
||||
|
||||
converted: true,
|
||||
status: status,
|
||||
iouparent: jobId,
|
||||
date_open: moment(),
|
||||
audit_trails: {
|
||||
data: [
|
||||
{
|
||||
useremail: config.useremail,
|
||||
bodyshopid: config.bodyshopid,
|
||||
operation: i18n.t("audit_trail.messages.jobioucreated"),
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const selectedJoblinesIds = jobLinesToKeep.map((l) => l.id);
|
||||
|
||||
const _tempLines = _.cloneDeep(existingJob.joblines).filter((l) =>
|
||||
selectedJoblinesIds.includes(l.id)
|
||||
);
|
||||
_tempLines.forEach((line) => {
|
||||
delete line.id;
|
||||
delete line.__typename;
|
||||
line.manual_line = true;
|
||||
});
|
||||
|
||||
delete newJob.joblines;
|
||||
newJob.joblines = { data: _tempLines };
|
||||
|
||||
const res2 = await apolloClient.mutate({
|
||||
mutation: INSERT_NEW_JOB,
|
||||
variables: { job: [newJob] },
|
||||
});
|
||||
|
||||
Axios.post("/job/totalsssu", {
|
||||
id: res2.data.insert_jobs.returning[0].id,
|
||||
});
|
||||
|
||||
//insert the new job. call the callback with the returned ID when done.
|
||||
|
||||
return res2.data.insert_jobs.returning[0].id;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ import { useApolloClient } from "@apollo/client";
|
||||
import Board, { moveCard } from "@asseinfo/react-kanban";
|
||||
//import "@asseinfo/react-kanban/dist/styles.css";
|
||||
import "./production-board-kanban.styles.scss";
|
||||
import { Grid, notification, PageHeader, Space, Statistic } from "antd";
|
||||
import { SyncOutlined } from '@ant-design/icons'
|
||||
import { Grid, notification, Button, PageHeader, Space, Statistic } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -33,6 +34,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
export function ProductionBoardKanbanComponent({
|
||||
data,
|
||||
bodyshop,
|
||||
refetch,
|
||||
technician,
|
||||
insertAuditTrail,
|
||||
associationSettings,
|
||||
@@ -192,6 +194,9 @@ export function ProductionBoardKanbanComponent({
|
||||
}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch && refetch()}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
<ProductionBoardFilters
|
||||
filter={filter}
|
||||
setFilter={setFilter}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { useQuery, useSubscription } from "@apollo/client";
|
||||
import React from "react";
|
||||
import { useApolloClient, useQuery, useSubscription } from "@apollo/client";
|
||||
import _ from "lodash";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { SUBSCRIPTION_JOBS_IN_PRODUCTION } from "../../graphql/jobs.queries";
|
||||
import {
|
||||
QUERY_EXACT_JOBS_IN_PRODUCTION,
|
||||
QUERY_EXACT_JOB_IN_PRODUCTION,
|
||||
QUERY_JOBS_IN_PRODUCTION,
|
||||
SUBSCRIPTION_JOBS_IN_PRODUCTION,
|
||||
} from "../../graphql/jobs.queries";
|
||||
import { QUERY_KANBAN_SETTINGS } from "../../graphql/user.queries";
|
||||
import {
|
||||
selectBodyshop,
|
||||
@@ -14,13 +20,62 @@ const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
|
||||
export function ProductionBoardKanbanContainer({ bodyshop, currentUser }) {
|
||||
const { loading, data } = useSubscription(
|
||||
SUBSCRIPTION_JOBS_IN_PRODUCTION,
|
||||
{}
|
||||
const { refetch, loading, data } = useQuery(QUERY_JOBS_IN_PRODUCTION, {
|
||||
pollInterval: 3600000,
|
||||
});
|
||||
const client = useApolloClient();
|
||||
const [joblist, setJoblist] = useState([]);
|
||||
const { data: updatedJobs } = useSubscription(
|
||||
SUBSCRIPTION_JOBS_IN_PRODUCTION
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!(data && data.jobs)) return;
|
||||
setJoblist(
|
||||
data.jobs.map((j) => {
|
||||
return { id: j.id, updated_at: j.updated_at };
|
||||
})
|
||||
);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!updatedJobs || joblist.length === 0) return;
|
||||
|
||||
const jobDiff = _.differenceWith(
|
||||
joblist,
|
||||
updatedJobs.jobs,
|
||||
(a, b) => a.id === b.id && a.updated_at === b.updated_at
|
||||
);
|
||||
|
||||
jobDiff.forEach((job) => {
|
||||
getUpdatedJobData(job.id);
|
||||
});
|
||||
if (jobDiff.length > 1) {
|
||||
getUpdatedJobsData(jobDiff.map((j) => j.id));
|
||||
} else if (jobDiff.length === 1) {
|
||||
jobDiff.forEach((job) => {
|
||||
getUpdatedJobData(job.id);
|
||||
});
|
||||
}
|
||||
|
||||
setJoblist(updatedJobs.jobs);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [updatedJobs]);
|
||||
|
||||
const getUpdatedJobData = async (jobId) => {
|
||||
client.query({
|
||||
query: QUERY_EXACT_JOB_IN_PRODUCTION,
|
||||
variables: { id: jobId },
|
||||
});
|
||||
};
|
||||
const getUpdatedJobsData = async (jobIds) => {
|
||||
client.query({
|
||||
query: QUERY_EXACT_JOBS_IN_PRODUCTION,
|
||||
variables: { ids: jobIds },
|
||||
});
|
||||
};
|
||||
|
||||
const { loading: associationSettingsLoading, data: associationSettings } =
|
||||
useQuery(QUERY_KANBAN_SETTINGS, {
|
||||
variables: { email: currentUser.email },
|
||||
@@ -30,6 +85,7 @@ export function ProductionBoardKanbanContainer({ bodyshop, currentUser }) {
|
||||
<ProductionBoardKanbanComponent
|
||||
loading={loading || associationSettingsLoading}
|
||||
data={data ? data.jobs : []}
|
||||
refetch={refetch}
|
||||
associationSettings={
|
||||
associationSettings && associationSettings.associations[0]
|
||||
? associationSettings.associations[0]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Button,
|
||||
Dropdown,
|
||||
Input,
|
||||
Menu,
|
||||
@@ -24,7 +27,6 @@ import ProductionListSaveConfigButton from "../production-list-save-config-butto
|
||||
import ProductionListPrint from "./production-list-print.component";
|
||||
import ProductionListTableViewSelect from "./production-list-table-view-select.component";
|
||||
import ResizeableTitle from "./production-list-table.resizeable.component";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -35,6 +37,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
export function ProductionListTable({
|
||||
loading,
|
||||
data,
|
||||
refetch,
|
||||
bodyshop,
|
||||
technician,
|
||||
currentUser,
|
||||
@@ -42,6 +45,7 @@ export function ProductionListTable({
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const { Production_List_Status_Colors } = useTreatments([
|
||||
"Production_List_Status_Colors",
|
||||
bodyshop.imexshopid,
|
||||
]);
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
@@ -195,6 +199,9 @@ export function ProductionListTable({
|
||||
}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch && refetch()}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
<ProductionListColumnsAdd
|
||||
columnState={[columns, setColumns]}
|
||||
tableState={state}
|
||||
|
||||
@@ -1,13 +1,74 @@
|
||||
import { useSubscription } from "@apollo/client";
|
||||
import React from "react";
|
||||
import { SUBSCRIPTION_JOBS_IN_PRODUCTION } from "../../graphql/jobs.queries";
|
||||
import { useApolloClient, useQuery, useSubscription } from "@apollo/client";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import {
|
||||
QUERY_EXACT_JOBS_IN_PRODUCTION,
|
||||
QUERY_EXACT_JOB_IN_PRODUCTION,
|
||||
QUERY_JOBS_IN_PRODUCTION,
|
||||
SUBSCRIPTION_JOBS_IN_PRODUCTION,
|
||||
} from "../../graphql/jobs.queries";
|
||||
import ProductionListTable from "./production-list-table.component";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function ProductionListTableContainer() {
|
||||
const { loading, data } = useSubscription(
|
||||
SUBSCRIPTION_JOBS_IN_PRODUCTION,
|
||||
{}
|
||||
const { refetch, loading, data } = useQuery(QUERY_JOBS_IN_PRODUCTION, {
|
||||
pollInterval: 3600000,
|
||||
});
|
||||
const client = useApolloClient();
|
||||
const [joblist, setJoblist] = useState([]);
|
||||
const { data: updatedJobs } = useSubscription(
|
||||
SUBSCRIPTION_JOBS_IN_PRODUCTION
|
||||
);
|
||||
|
||||
return <ProductionListTable loading={loading} data={data ? data.jobs : []} />;
|
||||
useEffect(() => {
|
||||
if (!(data && data.jobs)) return;
|
||||
setJoblist(
|
||||
data.jobs.map((j) => {
|
||||
return { id: j.id, updated_at: j.updated_at };
|
||||
})
|
||||
);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!updatedJobs || joblist.length === 0) return;
|
||||
|
||||
const jobDiff = _.differenceWith(
|
||||
joblist,
|
||||
updatedJobs.jobs,
|
||||
(a, b) => a.id === b.id && a.updated_at === b.updated_at
|
||||
);
|
||||
console.log(jobDiff);
|
||||
if (jobDiff.length > 1) {
|
||||
getUpdatedJobsData(jobDiff.map((j) => j.id));
|
||||
} else if (jobDiff.length === 1) {
|
||||
console.log("length was 1");
|
||||
jobDiff.forEach((job) => {
|
||||
console.log("Job ", job);
|
||||
getUpdatedJobData(job.id);
|
||||
});
|
||||
}
|
||||
|
||||
setJoblist(updatedJobs.jobs);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [updatedJobs]);
|
||||
|
||||
const getUpdatedJobData = async (jobId) => {
|
||||
client.query({
|
||||
query: QUERY_EXACT_JOB_IN_PRODUCTION,
|
||||
variables: { id: jobId },
|
||||
});
|
||||
};
|
||||
const getUpdatedJobsData = async (jobIds) => {
|
||||
client.query({
|
||||
query: QUERY_EXACT_JOBS_IN_PRODUCTION,
|
||||
variables: { ids: jobIds },
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ProductionListTable
|
||||
loading={loading}
|
||||
data={data ? data.jobs : []}
|
||||
refetch={refetch}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Button, List, notification, Popover } from "antd";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
|
||||
import { UPDATE_JOB_LINE_SUBLET } from "../../graphql/jobs-lines.queries";
|
||||
export default function ProductionSubletsManageComponent({ subletJobLines }) {
|
||||
const { t } = useTranslation();
|
||||
const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
|
||||
const [updateJobLine] = useMutation(UPDATE_JOB_LINE_SUBLET);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const subletCount = useMemo(() => {
|
||||
return {
|
||||
@@ -22,6 +22,8 @@ export default function ProductionSubletsManageComponent({ subletJobLines }) {
|
||||
|
||||
const result = await updateJobLine({
|
||||
variables: {
|
||||
jobId: sublet.jobid,
|
||||
now: new Date(),
|
||||
lineId: sublet.id,
|
||||
line: {
|
||||
sublet_completed:
|
||||
|
||||
@@ -185,24 +185,14 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
shouldUpdate={(prev, cur) =>
|
||||
Templates[prev.key]?.idtype !== Templates[cur.key]?.idtype
|
||||
}
|
||||
style={{ display: "none", margin: 0, padding: 0 }}
|
||||
>
|
||||
{() => {
|
||||
form.setFieldsValue({ id: null });
|
||||
return null;
|
||||
}}
|
||||
</Form.Item>
|
||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
||||
{() => {
|
||||
const key = form.getFieldValue("key");
|
||||
const currentId = form.getFieldValue("id");
|
||||
if (!key) return null;
|
||||
//Kind of Id
|
||||
const idtype = Templates[key] && Templates[key].idtype;
|
||||
if (!idtype) {
|
||||
if (!idtype && currentId) {
|
||||
form.setFieldsValue({ id: null });
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -7,16 +7,31 @@ import { useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ShopInfoROStatusComponent);
|
||||
|
||||
const SelectorDiv = styled.div`
|
||||
.ant-form-item .ant-select {
|
||||
width: 200px;
|
||||
}
|
||||
`;
|
||||
|
||||
export default function ShopInfoROStatusComponent({ form }) {
|
||||
export function ShopInfoROStatusComponent({ bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
const { Production_List_Status_Colors } = useTreatments([
|
||||
"Production_List_Status_Colors",
|
||||
bodyshop.imexshopid,
|
||||
]);
|
||||
|
||||
const [options, setOptions] = useState(
|
||||
|
||||
@@ -2,8 +2,7 @@ import { getAnalytics, logEvent } from "firebase/analytics";
|
||||
import { initializeApp } from "firebase/app";
|
||||
import { getAuth, updatePassword, updateProfile } from "firebase/auth";
|
||||
import { getFirestore } from "firebase/firestore";
|
||||
import { tracker } from "../App/App.container";
|
||||
//import { getMessaging } from "firebase/messaging";
|
||||
import { getMessaging, getToken, onMessage } from "firebase/messaging";
|
||||
import { store } from "../redux/store";
|
||||
|
||||
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
|
||||
@@ -39,18 +38,42 @@ export const updateCurrentPassword = async (password) => {
|
||||
|
||||
return updatePassword(currentUser, password);
|
||||
};
|
||||
let messaging;
|
||||
try {
|
||||
messaging = getMessaging();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
//let messaging;
|
||||
// try {
|
||||
// messaging = getMessaging();
|
||||
// // Project Settings => Cloud Messaging => Web Push certificates
|
||||
// messaging.usePublicVapidKey(process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY);
|
||||
// console.log("[FCM UTIL] FCM initialized successfully.");
|
||||
// } catch {
|
||||
// console.log("[FCM UTIL] Firebase Messaging is likely unsupported.");
|
||||
// }
|
||||
export { messaging };
|
||||
|
||||
// export { messaging };
|
||||
export const requestForToken = () => {
|
||||
return getToken(messaging, {
|
||||
vapidKey: process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY,
|
||||
})
|
||||
.then((currentToken) => {
|
||||
if (currentToken) {
|
||||
console.log("current token for client: ", currentToken);
|
||||
window.sessionStorage.setItem("fcmtoken", currentToken);
|
||||
// Perform any other necessary action with the token
|
||||
} else {
|
||||
// Show permission request UI
|
||||
console.log(
|
||||
"No registration token available. Request permission to generate one."
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("An error occurred while retrieving token. ", err);
|
||||
});
|
||||
};
|
||||
export const onMessageListener = () =>
|
||||
new Promise((resolve) => {
|
||||
onMessage(messaging, (payload) => {
|
||||
console.log("Inbound FCM Message", payload);
|
||||
resolve(payload);
|
||||
});
|
||||
});
|
||||
|
||||
export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
|
||||
const state = stateProp || store.getState();
|
||||
@@ -70,9 +93,6 @@ export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
|
||||
// eventParams
|
||||
// );
|
||||
logEvent(analytics, eventName, eventParams);
|
||||
|
||||
//Log event to OpenReplay server.
|
||||
tracker.event(eventName, eventParams);
|
||||
};
|
||||
|
||||
// if (messaging) {
|
||||
|
||||
@@ -1,15 +1,54 @@
|
||||
import { gql } from "@apollo/client";
|
||||
|
||||
export const CONVERSATION_LIST_SUBSCRIPTION = gql`
|
||||
subscription CONVERSATION_LIST_SUBSCRIPTION {
|
||||
// export const CONVERSATION_LIST_SUBSCRIPTION = gql`
|
||||
// subscription CONVERSATION_LIST_SUBSCRIPTION {
|
||||
// conversations(
|
||||
// order_by: { updated_at: desc }
|
||||
// limit: 50
|
||||
// where: { archived: { _eq: false } }
|
||||
// ) {
|
||||
// phone_num
|
||||
// id
|
||||
// updated_at
|
||||
// unreadcnt
|
||||
// messages_aggregate(
|
||||
// where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||
// ) {
|
||||
// aggregate {
|
||||
// count
|
||||
// }
|
||||
// }
|
||||
// job_conversations {
|
||||
// job {
|
||||
// id
|
||||
// ro_number
|
||||
// ownr_fn
|
||||
// ownr_ln
|
||||
// ownr_co_nm
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `;
|
||||
|
||||
export const CONVERSATION_LIST_QUERY = gql`
|
||||
query CONVERSATION_LIST_QUERY {
|
||||
conversations(
|
||||
order_by: { updated_at: desc }
|
||||
limit: 100
|
||||
limit: 50
|
||||
where: { archived: { _eq: false } }
|
||||
) {
|
||||
phone_num
|
||||
id
|
||||
updated_at
|
||||
unreadcnt
|
||||
messages_aggregate(
|
||||
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||
) {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
}
|
||||
job_conversations {
|
||||
job {
|
||||
id
|
||||
@@ -17,17 +56,6 @@ export const CONVERSATION_LIST_SUBSCRIPTION = gql`
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
owner {
|
||||
id
|
||||
allow_text_message
|
||||
}
|
||||
}
|
||||
}
|
||||
messages_aggregate(
|
||||
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||
) {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,24 +64,26 @@ export const CONVERSATION_LIST_SUBSCRIPTION = gql`
|
||||
|
||||
export const CONVERSATION_SUBSCRIPTION_BY_PK = gql`
|
||||
subscription CONVERSATION_SUBSCRIPTION_BY_PK($conversationId: uuid!) {
|
||||
messages(
|
||||
order_by: { created_at: asc_nulls_first }
|
||||
where: { conversationid: { _eq: $conversationId } }
|
||||
) {
|
||||
id
|
||||
status
|
||||
text
|
||||
isoutbound
|
||||
image
|
||||
image_path
|
||||
userid
|
||||
created_at
|
||||
read
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_CONVERSATION_DETAILS = gql`
|
||||
query GET_CONVERSATION_DETAILS($conversationId: uuid!) {
|
||||
conversations_by_pk(id: $conversationId) {
|
||||
messages(order_by: { created_at: asc_nulls_first }) {
|
||||
id
|
||||
status
|
||||
text
|
||||
isoutbound
|
||||
image
|
||||
image_path
|
||||
userid
|
||||
created_at
|
||||
}
|
||||
messages_aggregate(
|
||||
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||
) {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
}
|
||||
id
|
||||
phone_num
|
||||
archived
|
||||
|
||||
@@ -136,6 +136,27 @@ export const RECEIVE_PARTS_LINE = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_JOB_LINE_SUBLET = gql`
|
||||
mutation UPDATE_JOB_LINE_SUBLET(
|
||||
$lineId: uuid!
|
||||
$line: joblines_set_input!
|
||||
$now: timestamptz!
|
||||
$jobId: uuid!
|
||||
) {
|
||||
update_jobs_by_pk(pk_columns: { id: $jobId }, _set: { updated_at: $now }) {
|
||||
id
|
||||
updated_at
|
||||
}
|
||||
update_joblines(where: { id: { _eq: $lineId } }, _set: $line) {
|
||||
returning {
|
||||
id
|
||||
sublet_completed
|
||||
sublet_ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_JOB_LINE = gql`
|
||||
mutation UPDATE_JOB_LINE($lineId: uuid!, $line: joblines_set_input!) {
|
||||
update_joblines(where: { id: { _eq: $lineId } }, _set: $line) {
|
||||
@@ -179,6 +200,10 @@ export const GET_JOB_LINES_TO_ENTER_BILL = gql`
|
||||
jobs_by_pk(id: $id) {
|
||||
id
|
||||
status
|
||||
ious {
|
||||
id
|
||||
ro_number
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -226,3 +251,14 @@ export const DELETE_JOB_LINE_BY_PK = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_JOB_LINES_IOU = gql`
|
||||
mutation UPDATE_JOB_LINES_IOU($ids: [uuid!]!) {
|
||||
update_joblines(where: { id: { _in: $ids } }, _set: { ioucreated: true }) {
|
||||
returning {
|
||||
ioucreated
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -105,10 +105,18 @@ export const QUERY_PARTS_QUEUE = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
|
||||
subscription SUBSCRIPTION_JOBS_IN_PRODUCTION {
|
||||
jobs(where: { inproduction: { _eq: true } }) {
|
||||
id
|
||||
updated_at
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_EXACT_JOB_IN_PRODUCTION = gql`
|
||||
query QUERY_EXACT_JOB_IN_PRODUCTION($id: uuid!) {
|
||||
jobs(where: { id: { _eq: $id } }) {
|
||||
id
|
||||
status
|
||||
ro_number
|
||||
@@ -171,6 +179,150 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
|
||||
line_desc
|
||||
sublet_ignored
|
||||
sublet_completed
|
||||
jobid
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql`
|
||||
query QUERY_EXACT_JOBS_IN_PRODUCTION($ids: [uuid!]!) {
|
||||
jobs(where: { id: { _in: $ids } }) {
|
||||
id
|
||||
status
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
clm_no
|
||||
v_make_desc
|
||||
v_color
|
||||
plate_no
|
||||
actual_in
|
||||
scheduled_completion
|
||||
scheduled_delivery
|
||||
date_last_contacted
|
||||
date_next_contact
|
||||
ins_co_nm
|
||||
clm_total
|
||||
ownr_ph1
|
||||
ownr_ph2
|
||||
special_coverage_policy
|
||||
owner_owing
|
||||
production_vars
|
||||
kanbanparent
|
||||
alt_transport
|
||||
employee_body
|
||||
employee_refinish
|
||||
employee_prep
|
||||
employee_csr
|
||||
labhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
|
||||
}
|
||||
) {
|
||||
aggregate {
|
||||
sum {
|
||||
mod_lb_hrs
|
||||
}
|
||||
}
|
||||
}
|
||||
larhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
|
||||
}
|
||||
) {
|
||||
aggregate {
|
||||
sum {
|
||||
mod_lb_hrs
|
||||
}
|
||||
}
|
||||
}
|
||||
subletLines: joblines(
|
||||
where: {
|
||||
_and: { part_type: { _in: ["PAS", "PASL"] }, removed: { _eq: false } }
|
||||
}
|
||||
order_by: { line_no: asc }
|
||||
) {
|
||||
id
|
||||
line_desc
|
||||
sublet_ignored
|
||||
sublet_completed
|
||||
jobid
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_JOBS_IN_PRODUCTION = gql`
|
||||
query QUERY_JOBS_IN_PRODUCTION {
|
||||
jobs(where: { inproduction: { _eq: true } }) {
|
||||
id
|
||||
updated_at
|
||||
status
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
clm_no
|
||||
v_make_desc
|
||||
v_color
|
||||
plate_no
|
||||
actual_in
|
||||
scheduled_completion
|
||||
scheduled_delivery
|
||||
date_last_contacted
|
||||
date_next_contact
|
||||
ins_co_nm
|
||||
clm_total
|
||||
ownr_ph1
|
||||
ownr_ph2
|
||||
special_coverage_policy
|
||||
owner_owing
|
||||
production_vars
|
||||
kanbanparent
|
||||
alt_transport
|
||||
employee_body
|
||||
employee_refinish
|
||||
employee_prep
|
||||
employee_csr
|
||||
labhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
|
||||
}
|
||||
) {
|
||||
aggregate {
|
||||
sum {
|
||||
mod_lb_hrs
|
||||
}
|
||||
}
|
||||
}
|
||||
larhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
|
||||
}
|
||||
) {
|
||||
aggregate {
|
||||
sum {
|
||||
mod_lb_hrs
|
||||
}
|
||||
}
|
||||
}
|
||||
subletLines: joblines(
|
||||
where: {
|
||||
_and: { part_type: { _in: ["PAS", "PASL"] }, removed: { _eq: false } }
|
||||
}
|
||||
order_by: { line_no: asc }
|
||||
) {
|
||||
id
|
||||
line_desc
|
||||
sublet_ignored
|
||||
sublet_completed
|
||||
jobid
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -529,6 +681,7 @@ export const GET_JOB_BY_PK = gql`
|
||||
manual_line
|
||||
prt_dsmk_p
|
||||
prt_dsmk_m
|
||||
ioucreated
|
||||
billlines(limit: 1, order_by: { bill: { date: desc } }) {
|
||||
id
|
||||
quantity
|
||||
@@ -874,6 +1027,7 @@ export const UPDATE_JOB = gql`
|
||||
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
|
||||
returning {
|
||||
id
|
||||
|
||||
date_exported
|
||||
status
|
||||
alt_transport
|
||||
@@ -1253,9 +1407,7 @@ export const QUERY_JOB_FOR_DUPE = gql`
|
||||
servicing_dealer
|
||||
servicing_dealer_contact
|
||||
shopid
|
||||
|
||||
state_tax_rate
|
||||
|
||||
tax_lbr_rt
|
||||
tax_levies_rt
|
||||
tax_paint_mat_rt
|
||||
@@ -1320,9 +1472,19 @@ export const QUERY_JOB_FOR_DUPE = gql`
|
||||
tax_part
|
||||
unq_seq
|
||||
manual_line
|
||||
notes
|
||||
line_no
|
||||
tran_code
|
||||
}
|
||||
driveable
|
||||
towin
|
||||
adj_g_disc
|
||||
adj_strdis
|
||||
adj_towdis
|
||||
ca_gst_registrant
|
||||
special_coverage_policy
|
||||
tax_registration_number
|
||||
tax_shop_mat_rt
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -1580,46 +1742,6 @@ export const QUERY_ALL_JOB_FIELDS = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const QUERY_JOBS_IN_PRODUCTION = gql`
|
||||
query QUERY_JOBS_IN_PRODUCTION {
|
||||
jobs(
|
||||
where: { inproduction: { _eq: true } }
|
||||
order_by: { scheduled_completion: asc }
|
||||
) {
|
||||
id
|
||||
ro_number
|
||||
ownr_co_nm
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
v_model_yr
|
||||
v_make_desc
|
||||
v_model_desc
|
||||
scheduled_completion
|
||||
labhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
|
||||
}
|
||||
) {
|
||||
aggregate {
|
||||
sum {
|
||||
mod_lb_hrs
|
||||
}
|
||||
}
|
||||
}
|
||||
larhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
|
||||
}
|
||||
) {
|
||||
aggregate {
|
||||
sum {
|
||||
mod_lb_hrs
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_ALL_JOBS_PAGINATED_STATUS_FILTERED = gql`
|
||||
query QUERY_ALL_JOBS_PAGINATED_STATUS_FILTERED(
|
||||
|
||||
@@ -8,6 +8,8 @@ export const MARK_MESSAGES_AS_READ_BY_CONVERSATION = gql`
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
read
|
||||
isoutbound
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
|
||||
<DmsCustomerSelector />
|
||||
|
||||
<Col span={24}>
|
||||
<div ref={logsRef}>
|
||||
<Col span={24}>
|
||||
<Card
|
||||
title={t("jobs.labels.dms.logs")}
|
||||
extra={
|
||||
@@ -193,8 +193,8 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
>
|
||||
<DmsLogEvents socket={socket} logs={logs} />
|
||||
</Card>
|
||||
</div>
|
||||
</Col>
|
||||
</div>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -146,11 +146,13 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
{t("general.actions.close")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||
<Button disabled={job.date_exported || !jobRO}>
|
||||
{t("jobs.actions.sendtodms")}
|
||||
</Button>
|
||||
</Link>
|
||||
{(bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid) && (
|
||||
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||
<Button disabled={job.date_exported || !jobRO}>
|
||||
{t("jobs.actions.sendtodms")}
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
<JobsScoreboardAdd job={job} disabled={false} />
|
||||
</Space>
|
||||
}
|
||||
|
||||
@@ -5,13 +5,12 @@ import preval from "preval.macro";
|
||||
import React, { lazy, Suspense, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
|
||||
import { Link, Route, Switch } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
||||
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
||||
import ConflictComponent from "../../components/conflict/conflict.component";
|
||||
import FcmNotification from "../../components/fcm-notification/fcm-notification.component";
|
||||
import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
|
||||
//import FooterComponent from "../../components/footer/footer.component";
|
||||
//Component Imports
|
||||
import HeaderContainer from "../../components/header/header.container";
|
||||
@@ -20,12 +19,11 @@ import PartnerPingComponent from "../../components/partner-ping/partner-ping.com
|
||||
import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container";
|
||||
import ShopSubStatusComponent from "../../components/shop-sub-status/shop-sub-status.component";
|
||||
import TestComponent from "../../components/_test/test.component";
|
||||
import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries";
|
||||
import { requestForToken } from "../../firebase/firebase.utils";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectInstanceConflict,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import client from "../../utils/GraphQLClient";
|
||||
import "./manage.page.styles.scss";
|
||||
|
||||
const ManageRootPage = lazy(() =>
|
||||
@@ -166,16 +164,15 @@ const Dms = lazy(() => import("../dms/dms.container"));
|
||||
const { Content, Footer } = Layout;
|
||||
|
||||
const stripePromise = new Promise((resolve, reject) => {
|
||||
client.query({ query: QUERY_STRIPE_ID }).then((resp) => {
|
||||
if (resp.data.bodyshops[0])
|
||||
resolve(
|
||||
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
|
||||
stripeAccount:
|
||||
resp.data.bodyshops[0].stripe_acct_id || "No Stripe Id Resolve",
|
||||
})
|
||||
);
|
||||
reject();
|
||||
});
|
||||
// client.query({ query: QUERY_STRIPE_ID }).then((resp) => {
|
||||
// if (resp.data.bodyshops[0])
|
||||
resolve(
|
||||
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
|
||||
stripeAccount: "No Stripe Id Resolve",
|
||||
})
|
||||
);
|
||||
// reject();
|
||||
// });
|
||||
});
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
@@ -188,7 +185,13 @@ export function Manage({ match, conflict, bodyshop }) {
|
||||
useEffect(() => {
|
||||
const widgetId = "IABVNO4scRKY11XBQkNr";
|
||||
window.noticeable.render("widget", widgetId);
|
||||
try {
|
||||
requestForToken();
|
||||
} catch (error) {
|
||||
console.log("Unable to request for token.", error);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.app");
|
||||
}, [t]);
|
||||
@@ -395,7 +398,6 @@ export function Manage({ match, conflict, bodyshop }) {
|
||||
<HeaderContainer />
|
||||
|
||||
<Content className="content-container">
|
||||
<FcmNotification />
|
||||
<PartnerPingComponent />
|
||||
<ErrorBoundary>{PageContent}</ErrorBoundary>
|
||||
<BackTop />
|
||||
|
||||
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
|
||||
import { Redirect, Route, Switch } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
|
||||
import FcmNotification from "../../components/fcm-notification/fcm-notification.component";
|
||||
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import TechHeader from "../../components/tech-header/tech-header.component";
|
||||
import TechSider from "../../components/tech-sider/tech-sider.component";
|
||||
@@ -58,7 +58,6 @@ export function TechPage({ technician, match }) {
|
||||
{technician ? null : <Redirect to={`${match.path}/login`} />}
|
||||
<TechHeader />
|
||||
<Content className="tech-content-container">
|
||||
<FcmNotification />
|
||||
<ErrorBoundary>
|
||||
<Suspense
|
||||
fallback={
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Fingerprint2 from "@fingerprintjs/fingerprintjs";
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { notification } from "antd";
|
||||
import { auth, analytics, firestore } from "../../firebase/firebase.utils";
|
||||
import { setUserId, setUserProperties } from "firebase/analytics";
|
||||
import {
|
||||
checkActionCode,
|
||||
@@ -13,8 +12,11 @@ import { doc } from "firebase/firestore";
|
||||
import i18next from "i18next";
|
||||
import LogRocket from "logrocket";
|
||||
import { all, call, delay, put, select, takeLatest } from "redux-saga/effects";
|
||||
import { factory, tracker } from "../../App/App.container";
|
||||
import { factory } from "../../App/App.container";
|
||||
import {
|
||||
analytics,
|
||||
auth,
|
||||
firestore,
|
||||
getCurrentUser,
|
||||
logImEXEvent,
|
||||
updateCurrentUser,
|
||||
@@ -75,7 +77,7 @@ export function* isUserAuthenticated() {
|
||||
}
|
||||
|
||||
LogRocket.identify(user.email);
|
||||
tracker.setUserID(user.email);
|
||||
|
||||
yield put(
|
||||
signInSuccess({
|
||||
uid: user.uid,
|
||||
@@ -174,7 +176,6 @@ export function* onSignInSuccess() {
|
||||
|
||||
export function* signInSuccessSaga({ payload }) {
|
||||
LogRocket.identify(payload.email);
|
||||
tracker.setUserID(payload.email);
|
||||
|
||||
try {
|
||||
// window.$crisp.push(["set", "user:email", [payload.email]]);
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
"jobfieldchanged": "Job field $t(jobs.fields.{{field}}) changed to {{value}}.",
|
||||
"jobimported": "Job imported.",
|
||||
"jobinproductionchange": "Job production status set to {{inproduction}}",
|
||||
"jobioucreated": "IOU Created.",
|
||||
"jobmodifylbradj": "Labor adjustments modified.",
|
||||
"jobnoteadded": "Note added to job.",
|
||||
"jobnotedeleted": "Note deleted from job.",
|
||||
@@ -176,6 +177,7 @@
|
||||
"entered_total": "Total of Entered Lines",
|
||||
"enteringcreditmemo": "You are entering a credit memo. Please ensure you are also entering positive values.",
|
||||
"federal_tax": "Federal Tax",
|
||||
"iouexists": "An IOU exists that is associated to this RO.",
|
||||
"local_tax": "Local Tax",
|
||||
"markforreexport": "Mark for Re-export",
|
||||
"new": "New Bill",
|
||||
@@ -897,10 +899,12 @@
|
||||
"selectall": "Select All",
|
||||
"senderrortosupport": "Send Error to Support",
|
||||
"submit": "Submit",
|
||||
"tryagain": "Try Again",
|
||||
"view": "View",
|
||||
"viewreleasenotes": "See What's Changed"
|
||||
},
|
||||
"errors": {
|
||||
"fcm": "You must allow notification permissions to have real time messaging. Click to try again.",
|
||||
"notfound": "No record was found."
|
||||
},
|
||||
"itemtypes": {
|
||||
@@ -923,6 +927,7 @@
|
||||
"exceptiontitle": "An error has occurred.",
|
||||
"friday": "Friday",
|
||||
"globalsearch": "Global Search",
|
||||
"help": "Help",
|
||||
"hours": "hrs",
|
||||
"in": "In",
|
||||
"instanceconflictext": "Your $t(titles.app) account can only be used on one device at any given time. Refresh your session to take control.",
|
||||
@@ -1082,6 +1087,7 @@
|
||||
"labels": {
|
||||
"billref": "Latest Bill",
|
||||
"edit": "Edit Line",
|
||||
"ioucreated": "IOU",
|
||||
"new": "New Line",
|
||||
"nostatus": "No Status",
|
||||
"presets": "Jobline Presets"
|
||||
@@ -1111,6 +1117,7 @@
|
||||
"changestatus": "Change Status",
|
||||
"changestimator": "Change Estimator",
|
||||
"convert": "Convert",
|
||||
"createiou": "Create IOU",
|
||||
"deliver": "Deliver",
|
||||
"dms": {
|
||||
"addpayer": "Add Payer",
|
||||
@@ -1469,6 +1476,7 @@
|
||||
"ownerinfo": "Owner Info",
|
||||
"vehicleinfo": "Vehicle Info"
|
||||
},
|
||||
"createiouwarning": "Are you sure you want to create an IOU for these lines? A new RO will be created based on those lines for this customer.",
|
||||
"creating_new_job": "Creating new job...",
|
||||
"deductible": {
|
||||
"stands": "Stands",
|
||||
@@ -1589,6 +1597,7 @@
|
||||
"duplicated": "Job duplicated successfully. ",
|
||||
"exported": "Job(s) exported successfully. ",
|
||||
"invoiced": "Job closed and invoiced successfully.",
|
||||
"ioucreated": "IOU created successfully. Click to see.",
|
||||
"partsqueue": "Job added to parts queue.",
|
||||
"save": "Job saved successfully.",
|
||||
"savetitle": "Record saved successfully.",
|
||||
@@ -1757,6 +1766,7 @@
|
||||
"messaging": "Messaging",
|
||||
"noallowtxt": "This customer has not indicated their permission to be messaged.",
|
||||
"nojobs": "Not associated to any job.",
|
||||
"nopush": "Polling Mode Enabled",
|
||||
"phonenumber": "Phone #",
|
||||
"presets": "Presets",
|
||||
"recentonly": "Only your most recent 50 conversations will be shown here. If you are looking for an older conversation, find the related contact and click their phone number to view the conversation.",
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
"jobfieldchanged": "",
|
||||
"jobimported": "",
|
||||
"jobinproductionchange": "",
|
||||
"jobioucreated": "",
|
||||
"jobmodifylbradj": "",
|
||||
"jobnoteadded": "",
|
||||
"jobnotedeleted": "",
|
||||
@@ -176,6 +177,7 @@
|
||||
"entered_total": "",
|
||||
"enteringcreditmemo": "",
|
||||
"federal_tax": "",
|
||||
"iouexists": "",
|
||||
"local_tax": "",
|
||||
"markforreexport": "",
|
||||
"new": "",
|
||||
@@ -897,10 +899,12 @@
|
||||
"selectall": "",
|
||||
"senderrortosupport": "",
|
||||
"submit": "",
|
||||
"tryagain": "",
|
||||
"view": "",
|
||||
"viewreleasenotes": ""
|
||||
},
|
||||
"errors": {
|
||||
"fcm": "",
|
||||
"notfound": ""
|
||||
},
|
||||
"itemtypes": {
|
||||
@@ -923,6 +927,7 @@
|
||||
"exceptiontitle": "",
|
||||
"friday": "",
|
||||
"globalsearch": "",
|
||||
"help": "",
|
||||
"hours": "",
|
||||
"in": "en",
|
||||
"instanceconflictext": "",
|
||||
@@ -1082,6 +1087,7 @@
|
||||
"labels": {
|
||||
"billref": "",
|
||||
"edit": "Línea de edición",
|
||||
"ioucreated": "",
|
||||
"new": "Nueva línea",
|
||||
"nostatus": "",
|
||||
"presets": ""
|
||||
@@ -1111,6 +1117,7 @@
|
||||
"changestatus": "Cambiar Estado",
|
||||
"changestimator": "",
|
||||
"convert": "Convertir",
|
||||
"createiou": "",
|
||||
"deliver": "",
|
||||
"dms": {
|
||||
"addpayer": "",
|
||||
@@ -1469,6 +1476,7 @@
|
||||
"ownerinfo": "",
|
||||
"vehicleinfo": ""
|
||||
},
|
||||
"createiouwarning": "",
|
||||
"creating_new_job": "Creando nuevo trabajo ...",
|
||||
"deductible": {
|
||||
"stands": "",
|
||||
@@ -1589,6 +1597,7 @@
|
||||
"duplicated": "",
|
||||
"exported": "",
|
||||
"invoiced": "",
|
||||
"ioucreated": "",
|
||||
"partsqueue": "",
|
||||
"save": "Trabajo guardado con éxito.",
|
||||
"savetitle": "Registro guardado con éxito.",
|
||||
@@ -1757,6 +1766,7 @@
|
||||
"messaging": "Mensajería",
|
||||
"noallowtxt": "",
|
||||
"nojobs": "",
|
||||
"nopush": "",
|
||||
"phonenumber": "",
|
||||
"presets": "",
|
||||
"recentonly": "",
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
"jobfieldchanged": "",
|
||||
"jobimported": "",
|
||||
"jobinproductionchange": "",
|
||||
"jobioucreated": "",
|
||||
"jobmodifylbradj": "",
|
||||
"jobnoteadded": "",
|
||||
"jobnotedeleted": "",
|
||||
@@ -176,6 +177,7 @@
|
||||
"entered_total": "",
|
||||
"enteringcreditmemo": "",
|
||||
"federal_tax": "",
|
||||
"iouexists": "",
|
||||
"local_tax": "",
|
||||
"markforreexport": "",
|
||||
"new": "",
|
||||
@@ -897,10 +899,12 @@
|
||||
"selectall": "",
|
||||
"senderrortosupport": "",
|
||||
"submit": "",
|
||||
"tryagain": "",
|
||||
"view": "",
|
||||
"viewreleasenotes": ""
|
||||
},
|
||||
"errors": {
|
||||
"fcm": "",
|
||||
"notfound": ""
|
||||
},
|
||||
"itemtypes": {
|
||||
@@ -923,6 +927,7 @@
|
||||
"exceptiontitle": "",
|
||||
"friday": "",
|
||||
"globalsearch": "",
|
||||
"help": "",
|
||||
"hours": "",
|
||||
"in": "dans",
|
||||
"instanceconflictext": "",
|
||||
@@ -1082,6 +1087,7 @@
|
||||
"labels": {
|
||||
"billref": "",
|
||||
"edit": "Ligne d'édition",
|
||||
"ioucreated": "",
|
||||
"new": "Nouvelle ligne",
|
||||
"nostatus": "",
|
||||
"presets": ""
|
||||
@@ -1111,6 +1117,7 @@
|
||||
"changestatus": "Changer le statut",
|
||||
"changestimator": "",
|
||||
"convert": "Convertir",
|
||||
"createiou": "",
|
||||
"deliver": "",
|
||||
"dms": {
|
||||
"addpayer": "",
|
||||
@@ -1469,6 +1476,7 @@
|
||||
"ownerinfo": "",
|
||||
"vehicleinfo": ""
|
||||
},
|
||||
"createiouwarning": "",
|
||||
"creating_new_job": "Création d'un nouvel emploi ...",
|
||||
"deductible": {
|
||||
"stands": "",
|
||||
@@ -1589,6 +1597,7 @@
|
||||
"duplicated": "",
|
||||
"exported": "",
|
||||
"invoiced": "",
|
||||
"ioucreated": "",
|
||||
"partsqueue": "",
|
||||
"save": "Le travail a été enregistré avec succès.",
|
||||
"savetitle": "Enregistrement enregistré avec succès.",
|
||||
@@ -1757,6 +1766,7 @@
|
||||
"messaging": "Messagerie",
|
||||
"noallowtxt": "",
|
||||
"nojobs": "",
|
||||
"nopush": "",
|
||||
"phonenumber": "",
|
||||
"presets": "",
|
||||
"recentonly": "",
|
||||
|
||||
@@ -91,13 +91,11 @@ export default function CiecaSelect(parts = true, labor = true) {
|
||||
}
|
||||
|
||||
export function GetPartTypeName(part_type) {
|
||||
console.log(part_type);
|
||||
if (!part_type) return null;
|
||||
return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`);
|
||||
}
|
||||
|
||||
export function Get(part_type) {
|
||||
console.log(part_type);
|
||||
if (!part_type) return null;
|
||||
return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ import { WebSocketLink } from "@apollo/client/link/ws";
|
||||
import { getMainDefinition } from "@apollo/client/utilities";
|
||||
//import { split } from "apollo-link";
|
||||
import apolloLogger from "apollo-link-logger";
|
||||
import axios from "axios";
|
||||
import { auth } from "../firebase/firebase.utils";
|
||||
import errorLink from "../graphql/apollo-error-handling";
|
||||
|
||||
import { store } from "../redux/store";
|
||||
const httpLink = new HttpLink({
|
||||
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
|
||||
});
|
||||
@@ -47,7 +48,24 @@ const roundTripLink = new ApolloLink((operation, forward) => {
|
||||
});
|
||||
|
||||
const TrackExecutionTime = async (operationName, time) => {
|
||||
//await axios.post("/ioevent", { operationName, time, dbevent: true });
|
||||
const rdxStore = store.getState();
|
||||
try {
|
||||
axios.post("/ioevent", {
|
||||
operationName,
|
||||
time,
|
||||
dbevent: true,
|
||||
user:
|
||||
rdxStore.user &&
|
||||
rdxStore.user.currentUser &&
|
||||
rdxStore.user.currentUser.email,
|
||||
imexshopid:
|
||||
rdxStore.user &&
|
||||
rdxStore.user.bodyshop &&
|
||||
rdxStore.user.bodyshop.imexshopid,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("IOEvent Error", error);
|
||||
}
|
||||
};
|
||||
|
||||
const subscriptionMiddleware = {
|
||||
|
||||
@@ -148,8 +148,6 @@ export async function RenderTemplates(
|
||||
},
|
||||
};
|
||||
|
||||
console.log("reportRequest", reportRequest);
|
||||
|
||||
try {
|
||||
const render = await jsreport.renderAsync(reportRequest);
|
||||
if (!renderAsHtml) {
|
||||
|
||||
34
client/src/utils/fcm-handler.js
Normal file
34
client/src/utils/fcm-handler.js
Normal file
@@ -0,0 +1,34 @@
|
||||
export default async function FcmHandler({ client, payload }) {
|
||||
console.log("Handling payload type", payload);
|
||||
switch (payload.type) {
|
||||
case "messaging-inbound":
|
||||
client.cache.modify({
|
||||
id: client.cache.identify({
|
||||
__typename: "conversations",
|
||||
id: payload.conversationid,
|
||||
}),
|
||||
fields: {
|
||||
messages_aggregate(cached) {
|
||||
return { aggregate: { count: cached.aggregate.count + 1 } };
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "messaging-mark-conversation-read":
|
||||
client.cache.modify({
|
||||
id: client.cache.identify({
|
||||
__typename: "conversations",
|
||||
id: payload.conversationid,
|
||||
}),
|
||||
fields: {
|
||||
messages_aggregate(cached) {
|
||||
return { aggregate: { count: 0 } };
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.log("No payload type set.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1172,11 +1172,12 @@
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- bodyshopid
|
||||
- created_at
|
||||
- id
|
||||
- phone_num
|
||||
- unreadcnt
|
||||
- updated_at
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
@@ -1186,6 +1187,7 @@
|
||||
- created_at
|
||||
- id
|
||||
- phone_num
|
||||
- unreadcnt
|
||||
- updated_at
|
||||
filter:
|
||||
bodyshop:
|
||||
@@ -1206,6 +1208,7 @@
|
||||
- created_at
|
||||
- id
|
||||
- phone_num
|
||||
- unreadcnt
|
||||
- updated_at
|
||||
filter:
|
||||
bodyshop:
|
||||
@@ -2123,6 +2126,7 @@
|
||||
- est_seq
|
||||
- glass_flag
|
||||
- id
|
||||
- ioucreated
|
||||
- jobid
|
||||
- lbr_amt
|
||||
- lbr_hrs_j
|
||||
@@ -2185,6 +2189,7 @@
|
||||
- est_seq
|
||||
- glass_flag
|
||||
- id
|
||||
- ioucreated
|
||||
- jobid
|
||||
- lbr_amt
|
||||
- lbr_hrs_j
|
||||
@@ -2258,6 +2263,7 @@
|
||||
- est_seq
|
||||
- glass_flag
|
||||
- id
|
||||
- ioucreated
|
||||
- jobid
|
||||
- lbr_amt
|
||||
- lbr_hrs_j
|
||||
@@ -2390,6 +2396,9 @@
|
||||
- name: employee_refinish_rel
|
||||
using:
|
||||
foreign_key_constraint_on: employee_refinish
|
||||
- name: iouparent_rel
|
||||
using:
|
||||
foreign_key_constraint_on: iouparent
|
||||
- name: owner
|
||||
using:
|
||||
foreign_key_constraint_on: ownerid
|
||||
@@ -2453,6 +2462,13 @@
|
||||
table:
|
||||
schema: public
|
||||
name: exportlog
|
||||
- name: ious
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: iouparent
|
||||
table:
|
||||
schema: public
|
||||
name: jobs
|
||||
- name: job_conversations
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
@@ -2678,6 +2694,7 @@
|
||||
- intakechecklist
|
||||
- invoice_allocation
|
||||
- invoice_date
|
||||
- iouparent
|
||||
- job_totals
|
||||
- kanbanparent
|
||||
- kmin
|
||||
@@ -2931,6 +2948,7 @@
|
||||
- intakechecklist
|
||||
- invoice_allocation
|
||||
- invoice_date
|
||||
- iouparent
|
||||
- job_totals
|
||||
- kanbanparent
|
||||
- kmin
|
||||
@@ -3194,6 +3212,7 @@
|
||||
- intakechecklist
|
||||
- invoice_allocation
|
||||
- invoice_date
|
||||
- iouparent
|
||||
- job_totals
|
||||
- kanbanparent
|
||||
- kmin
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."jobs" add column "iouparent" uuid
|
||||
-- null;
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."jobs" add column "iouparent" uuid
|
||||
null;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."jobs" drop constraint "jobs_iouparent_fkey";
|
||||
@@ -0,0 +1,5 @@
|
||||
alter table "public"."jobs"
|
||||
add constraint "jobs_iouparent_fkey"
|
||||
foreign key ("iouparent")
|
||||
references "public"."jobs"
|
||||
("id") on update set null on delete set null;
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF EXISTS "jobs_idx_iouparent";
|
||||
@@ -0,0 +1,2 @@
|
||||
CREATE INDEX "jobs_idx_iouparent" on
|
||||
"public"."jobs" using btree ("iouparent");
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."joblines" add column "ioucreated" boolean
|
||||
-- not null default 'false';
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."joblines" add column "ioucreated" boolean
|
||||
not null default 'false';
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."joblines" add column "iou" boolean
|
||||
-- not null default 'false';
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."joblines" add column "iou" boolean
|
||||
not null default 'false';
|
||||
@@ -0,0 +1,3 @@
|
||||
alter table "public"."joblines" alter column "iou" set default false;
|
||||
alter table "public"."joblines" alter column "iou" drop not null;
|
||||
alter table "public"."joblines" add column "iou" bool;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."joblines" drop column "iou" cascade;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."conversations" add column "unreadcnt" numeric
|
||||
-- not null default '0';
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."conversations" add column "unreadcnt" numeric
|
||||
not null default '0';
|
||||
14
package.json
14
package.json
@@ -17,13 +17,13 @@
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"aws-sdk": "^2.1028.0",
|
||||
"aws-sdk": "^2.1043.0",
|
||||
"axios": "^0.24.0",
|
||||
"bluebird": "^3.7.2",
|
||||
"body-parser": "^1.18.3",
|
||||
"cloudinary": "^1.27.1",
|
||||
"compression": "^1.7.4",
|
||||
"cookie-parser": "^1.4.5",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"cors": "2.8.5",
|
||||
"csrf": "^3.1.0",
|
||||
"dinero.js": "^1.9.1",
|
||||
@@ -31,7 +31,7 @@
|
||||
"express": "^4.16.4",
|
||||
"firebase-admin": "^10.0.0",
|
||||
"graphql": "^16.0.1",
|
||||
"graphql-request": "^3.6.1",
|
||||
"graphql-request": "^3.7.0",
|
||||
"graylog2": "^0.2.1",
|
||||
"inline-css": "^3.0.0",
|
||||
"intuit-oauth": "^4.0.0",
|
||||
@@ -40,13 +40,13 @@
|
||||
"node-mailjet": "^3.3.4",
|
||||
"node-quickbooks": "^2.0.39",
|
||||
"nodemailer": "^6.7.1",
|
||||
"phone": "^3.1.9",
|
||||
"phone": "^3.1.10",
|
||||
"query-string": "^7.0.1",
|
||||
"soap": "^0.43.0",
|
||||
"socket.io": "^4.3.2",
|
||||
"socket.io": "^4.4.0",
|
||||
"ssh2-sftp-client": "^7.1.0",
|
||||
"stripe": "^8.188.0",
|
||||
"twilio": "^3.71.1",
|
||||
"stripe": "^8.191.0",
|
||||
"twilio": "^3.71.3",
|
||||
"uuid": "^8.3.2",
|
||||
"xmlbuilder2": "^3.0.2"
|
||||
},
|
||||
|
||||
@@ -66,7 +66,6 @@ app.get("/test", async function (req, res) {
|
||||
"git rev-parse --short HEAD"
|
||||
);
|
||||
logger.log("test-api-status", "DEBUG", "api", { commit });
|
||||
|
||||
res.status(200).send(`OK - ${commit}`);
|
||||
});
|
||||
|
||||
@@ -114,6 +113,7 @@ app.post(
|
||||
twilio.webhook({ validate: process.env.NODE_ENV === "PRODUCTION" }),
|
||||
smsStatus.status
|
||||
);
|
||||
app.post("/sms/markConversationRead", smsStatus.markConversationRead);
|
||||
|
||||
var job = require("./server/job/job");
|
||||
app.post("/job/totals", fb.validateFirebaseIdToken, job.totals);
|
||||
@@ -133,9 +133,10 @@ app.post("/render/inlinecss", fb.validateFirebaseIdToken, inlineCss.inlinecss);
|
||||
|
||||
app.post(
|
||||
"/notifications/send",
|
||||
fb.validateFirebaseIdToken,
|
||||
|
||||
fb.sendNotification
|
||||
);
|
||||
app.post("/notifications/subscribe", fb.validateFirebaseIdToken, fb.subscribe);
|
||||
app.post("/adm/updateuser", fb.validateFirebaseIdToken, fb.updateUser);
|
||||
|
||||
//Stripe Processing
|
||||
|
||||
@@ -6,7 +6,7 @@ require("dotenv").config({
|
||||
),
|
||||
});
|
||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||
const axios = require("axios").default;
|
||||
const AxiosLib = require("axios").default;
|
||||
const queries = require("../../graphql-client/queries");
|
||||
const { PBS_ENDPOINTS, PBS_CREDENTIALS } = require("./pbs-constants");
|
||||
|
||||
@@ -15,6 +15,37 @@ const CalculateAllocations =
|
||||
require("../../cdk/cdk-calculate-allocations").default;
|
||||
const CdkBase = require("../../web-sockets/web-socket");
|
||||
const moment = require("moment");
|
||||
const Dinero = require("dinero.js");
|
||||
const axios = AxiosLib.create();
|
||||
axios.interceptors.request.use((x) => {
|
||||
const socket = x.socket;
|
||||
|
||||
const headers = {
|
||||
...x.headers.common,
|
||||
...x.headers[x.method],
|
||||
...x.headers,
|
||||
};
|
||||
const printable = `${new Date()} | Request: ${x.method.toUpperCase()} | ${
|
||||
x.url
|
||||
} | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`;
|
||||
console.log(printable);
|
||||
|
||||
CdkBase.createLogEvent(socket, "TRACE", `Raw Request: ${printable}`);
|
||||
|
||||
return x;
|
||||
});
|
||||
|
||||
axios.interceptors.response.use((x) => {
|
||||
const socket = x.config.socket;
|
||||
|
||||
const printable = `${new Date()} | Response: ${x.status} | ${JSON.stringify(
|
||||
x.data
|
||||
)}`;
|
||||
console.log(printable);
|
||||
CdkBase.createLogEvent(socket, "TRACE", `Raw Response: ${printable}`);
|
||||
|
||||
return x;
|
||||
});
|
||||
|
||||
exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
socket.logEvents = [];
|
||||
@@ -31,7 +62,7 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
socket.JobData = JobData;
|
||||
|
||||
//Query for the Vehicle record to get the associated customer.
|
||||
// socket.DmsVeh = await QueryVehicleFromDms(socket);
|
||||
socket.DmsVeh = await QueryVehicleFromDms(socket);
|
||||
//Todo: Need to validate the lines and methods below.
|
||||
if (socket.DmsVeh && socket.DmsVeh.CustomerRef) {
|
||||
//Get the associated customer from the Vehicle Record.
|
||||
@@ -72,7 +103,9 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`Upserting contact information to DMS for ${socket.JobData.ownr_fn} ${socket.JobData.ownr_ln} ${socket.JobData.ownr_co_nm}`
|
||||
`Upserting contact information to DMS for ${
|
||||
socket.JobData.ownr_fn || ""
|
||||
} ${socket.JobData.ownr_ln || ""} ${socket.JobData.ownr_co_nm || ""}`
|
||||
);
|
||||
const ownerRef = await UpsertContactData(socket, selectedCustomerId);
|
||||
|
||||
@@ -83,7 +116,9 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
|
||||
);
|
||||
await UpsertVehicleData(socket, ownerRef.ReferenceId);
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
|
||||
|
||||
await InsertAccountPostingData(socket);
|
||||
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
|
||||
await MarkJobExported(socket, socket.JobData.id);
|
||||
|
||||
@@ -135,7 +170,7 @@ async function QueryJobData(socket, jobid) {
|
||||
|
||||
async function QueryVehicleFromDms(socket) {
|
||||
try {
|
||||
const { data: VehicleGetResponse } = await axios.post(
|
||||
const { data: VehicleGetResponse, request } = await axios.post(
|
||||
PBS_ENDPOINTS.VehicleGet,
|
||||
{
|
||||
SerialNumber: socket.JobData.bodyshop.pbs_serialnumber,
|
||||
@@ -160,8 +195,9 @@ async function QueryVehicleFromDms(socket) {
|
||||
// IncludeBuildVehicles: false,
|
||||
// ShortVIN: "String",
|
||||
},
|
||||
{ auth: PBS_CREDENTIALS }
|
||||
{ auth: PBS_CREDENTIALS, socket }
|
||||
);
|
||||
|
||||
CheckForErrors(socket, VehicleGetResponse);
|
||||
return VehicleGetResponse;
|
||||
} catch (error) {
|
||||
@@ -180,13 +216,13 @@ async function QueryCustomersFromDms(socket) {
|
||||
{
|
||||
SerialNumber: socket.JobData.bodyshop.pbs_serialnumber,
|
||||
//ContactId: "00000000000000000000000000000000",
|
||||
ContactCode: socket.JobData.owner.accountingid,
|
||||
// ContactCode: socket.JobData.owner.accountingid,
|
||||
FirstName: socket.JobData.ownr_co_nm
|
||||
? socket.JobData.ownr_co_nm
|
||||
: socket.JobData.ownr_fn,
|
||||
LastName: socket.JobData.ownr_ln,
|
||||
PhoneNumber: socket.JobData.ownr_ph1,
|
||||
// EmailAddress: "String",
|
||||
EmailAddress: socket.JobData.ownr_ea,
|
||||
// ModifiedSince: "0001-01-01T00:00:00.0000000Z",
|
||||
// ModifiedUntil: "0001-01-01T00:00:00.0000000Z",
|
||||
// ContactIdList: ["00000000000000000000000000000000"],
|
||||
@@ -196,7 +232,7 @@ async function QueryCustomersFromDms(socket) {
|
||||
// DriverLicense: "String",
|
||||
// ZipCode: "String",
|
||||
},
|
||||
{ auth: PBS_CREDENTIALS }
|
||||
{ auth: PBS_CREDENTIALS, socket }
|
||||
);
|
||||
CheckForErrors(socket, CustomerGetResponse);
|
||||
return CustomerGetResponse && CustomerGetResponse.Contacts;
|
||||
@@ -232,7 +268,7 @@ async function QueryCustomerBycodeFromDms(socket, CustomerRef) {
|
||||
// DriverLicense: "String",
|
||||
// ZipCode: "String",
|
||||
},
|
||||
{ auth: PBS_CREDENTIALS }
|
||||
{ auth: PBS_CREDENTIALS, socket }
|
||||
);
|
||||
CheckForErrors(socket, CustomerGetResponse);
|
||||
return CustomerGetResponse && CustomerGetResponse.Contacts;
|
||||
@@ -318,7 +354,7 @@ async function UpsertContactData(socket, selectedCustomerId) {
|
||||
// UserRequest: "String",
|
||||
// UserRef: "00000000000000000000000000000000",
|
||||
},
|
||||
{ auth: PBS_CREDENTIALS }
|
||||
{ auth: PBS_CREDENTIALS, socket }
|
||||
);
|
||||
CheckForErrors(socket, ContactChangeResponse);
|
||||
return ContactChangeResponse;
|
||||
@@ -347,16 +383,17 @@ async function UpsertVehicleData(socket, ownerRef) {
|
||||
//FleetNumber: "String",
|
||||
//Status: "String",
|
||||
OwnerRef: ownerRef, // "00000000000000000000000000000000",
|
||||
//ModelNumber: "String",
|
||||
ModelNumber:
|
||||
socket.JobData.vehicle && socket.JobData.vehicle.v_makecode,
|
||||
Make: socket.JobData.v_make_desc,
|
||||
Model: socket.JobData.v_model_desc,
|
||||
//Trim: "String",
|
||||
Trim: socket.JobData.vehicle && socket.JobData.vehicle.v_trimcode,
|
||||
//VehicleType: "String",
|
||||
Year: socket.JobData.v_model_yr,
|
||||
Odometer: socket.JobData.kmin,
|
||||
Odometer: socket.JobData.kmout,
|
||||
ExteriorColor: {
|
||||
Code: socket.JobData.v_color,
|
||||
//Description: "String",
|
||||
Description: socket.JobData.v_color,
|
||||
},
|
||||
// InteriorColor: { Code: "String", Description: "String" },
|
||||
//Engine: "String",
|
||||
@@ -475,7 +512,7 @@ async function UpsertVehicleData(socket, ownerRef) {
|
||||
// UserRequest: "String",
|
||||
// UserRef: "00000000000000000000000000000000",
|
||||
},
|
||||
{ auth: PBS_CREDENTIALS }
|
||||
{ auth: PBS_CREDENTIALS, socket }
|
||||
);
|
||||
CheckForErrors(socket, VehicleChangeResponse);
|
||||
return VehicleChangeResponse;
|
||||
@@ -499,7 +536,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const item = {
|
||||
Account: alloc.profitCenter.dms_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.0"),
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -513,7 +550,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const item = {
|
||||
Account: alloc.costCenter.dms_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.cost.toFormat("0.0"),
|
||||
Amount: alloc.cost.toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -524,7 +561,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const itemWip = {
|
||||
Account: alloc.costCenter.dms_wip_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.cost.multiply(-1).toFormat("0.0"),
|
||||
Amount: alloc.cost.multiply(-1).toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -539,7 +576,7 @@ async function InsertAccountPostingData(socket) {
|
||||
const item2 = {
|
||||
Account: alloc.profitCenter.dms_acctnumber,
|
||||
ControlNumber: socket.JobData.ro_number,
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.0"),
|
||||
Amount: alloc.sale.multiply(-1).toFormat("0.00"),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
@@ -549,6 +586,21 @@ async function InsertAccountPostingData(socket) {
|
||||
}
|
||||
}
|
||||
});
|
||||
socket.txEnvelope.payers.forEach((payer) => {
|
||||
const item = {
|
||||
Account: payer.dms_acctnumber,
|
||||
ControlNumber: payer.controlnumber,
|
||||
Amount: Dinero({ amount: Math.round(payer.amount * 100) }).toFormat(
|
||||
"0.0"
|
||||
),
|
||||
//Comment: "String",
|
||||
//AdditionalInfo: "String",
|
||||
InvoiceNumber: socket.JobData.ro_number,
|
||||
InvoiceDate: moment(socket.JobData.date_invoiced).toISOString(),
|
||||
};
|
||||
|
||||
wips.push(item);
|
||||
});
|
||||
|
||||
const { data: AccountPostingChange } = await axios.post(
|
||||
PBS_ENDPOINTS.AccountingPostingChange,
|
||||
@@ -564,7 +616,7 @@ async function InsertAccountPostingData(socket) {
|
||||
Lines: wips,
|
||||
},
|
||||
},
|
||||
{ auth: PBS_CREDENTIALS }
|
||||
{ auth: PBS_CREDENTIALS, socket }
|
||||
);
|
||||
|
||||
CheckForErrors(socket, AccountPostingChange);
|
||||
|
||||
@@ -21,7 +21,7 @@ const entegralEndpoint =
|
||||
const client = require("../graphql-client/graphql-client").client;
|
||||
const uuid = require("uuid").v4;
|
||||
|
||||
const momentFormat = "yyyy-MM-DDTHH:mm:ss.SSSSSSSZ";
|
||||
const momentFormat = "yyyy-MM-DDTHH:mm:ss.SSS";
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
//Query for the List of Bodyshop Clients.
|
||||
@@ -47,7 +47,7 @@ exports.default = async (req, res) => {
|
||||
RqUID: transId,
|
||||
DocumentInfo: {
|
||||
BMSVer: "4.0.0",
|
||||
DocumentType: "Repair Order",
|
||||
DocumentType: "RO",
|
||||
DocumentVerCode: "EM",
|
||||
DocumentVerNum: GetSupplementNumber(job.joblines), //TODO Get Supplement Number
|
||||
DocumentStatus: GetDocumentstatus(job, bodyshop),
|
||||
@@ -63,8 +63,10 @@ exports.default = async (req, res) => {
|
||||
UploadDateTime: moment().format(momentFormat),
|
||||
},
|
||||
RepairEvent: {
|
||||
ArrivalDateTime:
|
||||
CreatedDateTime:
|
||||
job.date_open && moment(job.date_open).format(momentFormat),
|
||||
ArrivalDateTime:
|
||||
job.actual_in && moment(job.actual_in).format(momentFormat),
|
||||
ArrivalOdometerReading: job.kmin,
|
||||
TargetCompletionDateTime:
|
||||
job.scheduled_completion &&
|
||||
@@ -244,7 +246,12 @@ exports.default = async (req, res) => {
|
||||
},
|
||||
VehicleDesc: {
|
||||
//ProductionDate: "2009-10",
|
||||
ModelYear: job.v_model_yr,
|
||||
ModelYear:
|
||||
parseInt(job.v_model_yr) < 1900
|
||||
? parseInt(job.v_model_yr) < moment().format("YY")
|
||||
? `20${job.v_model_yr}`
|
||||
: `19${job.v_model_yr}`
|
||||
: job.v_model_yr,
|
||||
MakeDesc: job.v_make_desc,
|
||||
ModelName: job.v_model_desc,
|
||||
},
|
||||
@@ -455,7 +462,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Body Labor",
|
||||
TotalHours: job.job_totals.rates.lab.hours,
|
||||
TotalAmt: Dinero(job.job_totals.rates.lab.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -463,7 +470,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Frame Labor",
|
||||
TotalHours: job.job_totals.rates.laf.hours,
|
||||
TotalAmt: Dinero(job.job_totals.rates.laf.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -471,7 +478,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Mechanical Labor",
|
||||
TotalHours: job.job_totals.rates.lam.hours,
|
||||
TotalAmt: Dinero(job.job_totals.rates.lam.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -479,7 +486,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Refinish Labor",
|
||||
TotalHours: job.job_totals.rates.lar.hours,
|
||||
TotalAmt: Dinero(job.job_totals.rates.lar.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -490,7 +497,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.paa &&
|
||||
job.job_totals.parts.parts.list.paa.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAC",
|
||||
@@ -498,7 +505,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pac &&
|
||||
job.job_totals.parts.parts.list.pac.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAG",
|
||||
@@ -506,7 +513,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pag &&
|
||||
job.job_totals.parts.parts.list.pag.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAL",
|
||||
@@ -514,7 +521,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pal &&
|
||||
job.job_totals.parts.parts.list.pal.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAM",
|
||||
@@ -522,7 +529,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pam &&
|
||||
job.job_totals.parts.parts.list.pam.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAN",
|
||||
@@ -530,7 +537,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.pan &&
|
||||
job.job_totals.parts.parts.list.pan.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "PAR",
|
||||
@@ -538,7 +545,7 @@ exports.default = async (req, res) => {
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.parts.parts.list.par &&
|
||||
job.job_totals.parts.parts.list.par.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
],
|
||||
OtherChargesTotalsInfo: [
|
||||
@@ -546,21 +553,21 @@ exports.default = async (req, res) => {
|
||||
TotalType: "OTSL",
|
||||
TotalTypeDesc: "Sublet",
|
||||
TotalAmt: Dinero(job.job_totals.parts.sublets.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
TotalType: "MAPA",
|
||||
TotalTypeDesc: "Paint Materials",
|
||||
TotalAmt: Dinero(job.job_totals.rates.mapa.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
TotalType: "MASH",
|
||||
TotalTypeDesc: "Shop Materials",
|
||||
TotalAmt: Dinero(job.job_totals.rates.mash.total).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
// {
|
||||
@@ -574,14 +581,14 @@ exports.default = async (req, res) => {
|
||||
TotalType: "OTST",
|
||||
TotalTypeDesc: "Storage",
|
||||
TotalAmt: Dinero(job.job_totals.additional.storage).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
TotalType: "OTTW",
|
||||
TotalTypeDesc: "Towing",
|
||||
TotalAmt: Dinero(job.job_totals.additional.towing).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -589,16 +596,24 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Additional Charges",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.additional.additionalCosts
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
],
|
||||
SummaryTotalsInfo: [
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "TT",
|
||||
TotalTypeDesc: "Gross Total",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.totals.total_repairs
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "T2",
|
||||
TotalTypeDesc: "Net Total",
|
||||
TotalAmt: Dinero(job.job_totals.totals.subtotal).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -606,7 +621,7 @@ exports.default = async (req, res) => {
|
||||
TotalSubType: "F7",
|
||||
TotalTypeDesc: "Sales Tax",
|
||||
TotalAmt: Dinero(job.job_totals.totals.state_tax).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -614,17 +629,9 @@ exports.default = async (req, res) => {
|
||||
TotalSubType: "GST",
|
||||
TotalTypeDesc: "GST Tax",
|
||||
TotalAmt: Dinero(job.job_totals.totals.federal_tax).toFormat(
|
||||
"0.0"
|
||||
"0.00"
|
||||
),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
TotalSubType: "TT",
|
||||
TotalTypeDesc: "Gross Total",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.totals.total_repairs
|
||||
).toFormat("0.0"),
|
||||
},
|
||||
// {
|
||||
// TotalType: "TOT",
|
||||
// TotalSubType: "SM",
|
||||
@@ -637,7 +644,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Deductible",
|
||||
TotalAmt: Dinero({
|
||||
amount: Math.round((job.ded_amt || 0) * 100),
|
||||
}).toFormat("0.0"),
|
||||
}).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
@@ -645,7 +652,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Betterment",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.totals.custPayable.dep_taxes
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
@@ -659,7 +666,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Bottom Line Discount",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.additional.adjustments
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
{
|
||||
TotalType: "TOT",
|
||||
@@ -667,7 +674,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Insurance Pay",
|
||||
TotalAmt: Dinero(job.job_totals.totals.total_repairs)
|
||||
.subtract(Dinero(job.job_totals.totals.custPayable.total))
|
||||
.toFormat("0.0"),
|
||||
.toFormat("0.00"),
|
||||
},
|
||||
// {
|
||||
// TotalType: "TOT",
|
||||
@@ -681,7 +688,7 @@ exports.default = async (req, res) => {
|
||||
TotalTypeDesc: "Customer Pay",
|
||||
TotalAmt: Dinero(
|
||||
job.job_totals.totals.custPayable.total
|
||||
).toFormat("0.0"),
|
||||
).toFormat("0.00"),
|
||||
},
|
||||
],
|
||||
RepairTotalsType: 1,
|
||||
@@ -813,7 +820,7 @@ exports.default = async (req, res) => {
|
||||
|
||||
const [result, rawResponse, , rawRequest] = entegralResponse;
|
||||
console.log("🚀 ~ file: arms.js ~ line 806 ~ result", result);
|
||||
res.json(result);
|
||||
res.json({ result, obj: abc });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.json(error);
|
||||
|
||||
@@ -74,7 +74,7 @@ exports.default = async (req, res) => {
|
||||
{
|
||||
version: "1.0",
|
||||
encoding: "UTF-8",
|
||||
keepNullNodes: true,
|
||||
//keepNullNodes: true,
|
||||
},
|
||||
autoHouseObject
|
||||
)
|
||||
@@ -110,7 +110,8 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
res.json(allxmlsToUpload);
|
||||
return;
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
res.sendStatus(200);
|
||||
return;
|
||||
@@ -184,31 +185,31 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
}${job.est_ct_fn ? job.est_ct_fn : ""}`,
|
||||
},
|
||||
CustomerInformation: {
|
||||
FirstName: job.ownr_fn,
|
||||
LastName: job.ownr_ln,
|
||||
Street: job.ownr_addr1,
|
||||
City: job.ownr_city,
|
||||
State: job.ownr_st,
|
||||
Zip: job.ownr_zip,
|
||||
Phone1: job.ownr_ph1,
|
||||
FirstName: job.ownr_fn || "",
|
||||
LastName: job.ownr_ln || "",
|
||||
Street: job.ownr_addr1 || "",
|
||||
City: job.ownr_city || "",
|
||||
State: job.ownr_st || "",
|
||||
Zip: job.ownr_zip || "",
|
||||
Phone1: job.ownr_ph1 || "",
|
||||
Phone2: null,
|
||||
Phone2Extension: null,
|
||||
Phone3: null,
|
||||
Phone3Extension: null,
|
||||
FileComments: null,
|
||||
Source: null,
|
||||
Email: job.ownr_ea,
|
||||
Email: job.ownr_ea || "",
|
||||
RetWhsl: null,
|
||||
Cat: null,
|
||||
InsuredorClaimantFlag: null,
|
||||
},
|
||||
VehicleInformation: {
|
||||
Year: job.v_model_yr,
|
||||
Make: job.v_make_desc,
|
||||
Model: job.v_model_desc,
|
||||
VIN: job.v_vin,
|
||||
Year: job.v_model_yr || "",
|
||||
Make: job.v_make_desc || "",
|
||||
Model: job.v_model_desc || "",
|
||||
VIN: job.v_vin || "",
|
||||
License: job.plate_no,
|
||||
MileageIn: job.kmin,
|
||||
MileageIn: job.kmin || 0,
|
||||
Vehiclecolor: job.v_color,
|
||||
VehicleProductionDate: null,
|
||||
VehiclePaintCode: null,
|
||||
@@ -218,18 +219,18 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
},
|
||||
|
||||
InsuranceInformation: {
|
||||
InsuranceCo: job.ins_co_nm,
|
||||
CompanyName: job.ins_co_nm,
|
||||
Address: job.ins_addr1,
|
||||
City: job.ins_addr1,
|
||||
State: job.ins_city,
|
||||
Zip: job.ins_zip,
|
||||
Phone: job.ins_ph1,
|
||||
Fax: null,
|
||||
InsuranceCo: job.ins_co_nm || "",
|
||||
CompanyName: job.ins_co_nm || "",
|
||||
Address: job.ins_addr1 || "",
|
||||
City: job.ins_addr1 || "",
|
||||
State: job.ins_city || "",
|
||||
Zip: job.ins_zip || "",
|
||||
Phone: job.ins_ph1 || "",
|
||||
Fax: job.ins_fax || "",
|
||||
ClaimType: null,
|
||||
LossType: null,
|
||||
Policy: null,
|
||||
Claim: job.clm_no,
|
||||
LossType: job.loss_type || "",
|
||||
Policy: job.policy_no || "",
|
||||
Claim: job.clm_no || "",
|
||||
InsuredLastName: null,
|
||||
InsuredFirstName: null,
|
||||
ClaimantLastName: null,
|
||||
@@ -242,23 +243,28 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
OutsideAdjuster: null,
|
||||
},
|
||||
Dates: {
|
||||
DateofLoss: job.loss_date && moment(job.loss_date).format(AhDateFormat),
|
||||
DateofLoss:
|
||||
(job.loss_date && moment(job.loss_date).format(AhDateFormat)) || "",
|
||||
InitialCustomerContactDate: null,
|
||||
FirstFollowUpDate: null,
|
||||
ReferralDate: null,
|
||||
EstimateAppointmentDate: null,
|
||||
SecondFollowUpDate: null,
|
||||
AssignedDate:
|
||||
job.asgn_date && moment(job.asgn_date).format(AhDateFormat),
|
||||
(job.asgn_date && moment(job.asgn_date).format(AhDateFormat)) || "",
|
||||
EstComplete: null,
|
||||
CustomerAuthorizationDate: null,
|
||||
InsuranceAuthorizationDate: null,
|
||||
DateOpened: job.date_open && moment(job.date_open).format(AhDateFormat),
|
||||
DateOpened:
|
||||
(job.date_open && moment(job.date_open).format(AhDateFormat)) || "",
|
||||
ScheduledArrivalDate:
|
||||
job.scheduled_in && moment(job.scheduled_in).format(AhDateFormat),
|
||||
CarinShop: job.actual_in && moment(job.actual_in).format(AhDateFormat),
|
||||
(job.scheduled_in && moment(job.scheduled_in).format(AhDateFormat)) ||
|
||||
"",
|
||||
CarinShop:
|
||||
(job.actual_in && moment(job.actual_in).format(AhDateFormat)) || "",
|
||||
InsInspDate: null,
|
||||
StartDate: job.actual_in && moment(job.actual_in).format(AhDateFormat),
|
||||
StartDate:
|
||||
(job.actual_in && moment(job.actual_in).format(AhDateFormat)) || "",
|
||||
PartsOrder: null,
|
||||
TeardownHold: null,
|
||||
SupplementSubmittedDate: null,
|
||||
@@ -268,22 +274,28 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
AssntoPaint: null,
|
||||
AssntoDetail: null,
|
||||
PromiseDate:
|
||||
job.scheduled_completion &&
|
||||
moment(job.scheduled_completion).format(AhDateFormat),
|
||||
InsuranceTargetOut: null,
|
||||
(job.scheduled_completion &&
|
||||
moment(job.scheduled_completion).format(AhDateFormat)) ||
|
||||
"",
|
||||
//InsuranceTargetOut: null,
|
||||
CarComplete:
|
||||
job.actual_completion &&
|
||||
moment(job.actual_completion).format(AhDateFormat),
|
||||
(job.actual_completion &&
|
||||
moment(job.actual_completion).format(AhDateFormat)) ||
|
||||
"",
|
||||
DeliveryAppointmentDate:
|
||||
job.scheduled_delivery &&
|
||||
moment(job.scheduled_delivery).format(AhDateFormat),
|
||||
(job.scheduled_delivery &&
|
||||
moment(job.scheduled_delivery).format(AhDateFormat)) ||
|
||||
"",
|
||||
DateClosed:
|
||||
job.date_invoiced && moment(job.date_invoiced).format(AhDateFormat),
|
||||
(job.date_invoiced &&
|
||||
moment(job.date_invoiced).format(AhDateFormat)) ||
|
||||
"",
|
||||
CustomerPaidInFullDate: null,
|
||||
InsurancePaidInFullDate: null,
|
||||
CustPickup:
|
||||
job.actual_delivery &&
|
||||
moment(job.actual_delivery).format(AhDateFormat),
|
||||
(job.actual_delivery &&
|
||||
moment(job.actual_delivery).format(AhDateFormat)) ||
|
||||
"",
|
||||
AccountPostedDate:
|
||||
job.date_exported && moment(job.date_exported).format(AhDateFormat),
|
||||
CSIProcessedDate: null,
|
||||
@@ -291,85 +303,86 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
AdditionalFollowUpDate: null,
|
||||
},
|
||||
Rates: {
|
||||
BodyRate: job.rate_lab,
|
||||
RefinishRate: job.rate_lar,
|
||||
MechanicalRate: job.rate_lam,
|
||||
StructuralRate: job.rate_las,
|
||||
PMRate: job.rate_mapa,
|
||||
BMRate: job.rate_mash,
|
||||
BodyRate: job.rate_lab || 0,
|
||||
RefinishRate: job.rate_lar || 0,
|
||||
MechanicalRate: job.rate_lam || 0,
|
||||
StructuralRate: job.rate_las || 0,
|
||||
PMRate: job.rate_mapa || 0,
|
||||
BMRate: job.rate_mash || 0,
|
||||
TaxRate:
|
||||
job.parts_tax_rates &&
|
||||
job.parts_tax_rates.PAN &&
|
||||
job.parts_tax_rates.PAN.prt_tax_rt,
|
||||
StorageRateperDay: null,
|
||||
DaysStored: null,
|
||||
},
|
||||
EstimateTotals: {
|
||||
BodyHours: null,
|
||||
RefinishHours: null,
|
||||
MechanicalHours: null,
|
||||
StructuralHours: null,
|
||||
PartsTotal: null,
|
||||
PartsOEM: null,
|
||||
PartsAM: null,
|
||||
PartsReconditioned: null,
|
||||
PartsRecycled: null,
|
||||
PartsOther: null,
|
||||
SubletTotal: null,
|
||||
BodyLaborTotal: null,
|
||||
RefinishLaborTotal: null,
|
||||
MechanicalLaborTotal: null,
|
||||
StructuralLaborTotal: null,
|
||||
MiscellaneousChargeTotal: null,
|
||||
PMTotal: null,
|
||||
BMTotal: null,
|
||||
MiscTotal: null,
|
||||
TowingTotal: null,
|
||||
StorageTotal: null,
|
||||
DetailTotal: null,
|
||||
SalesTaxTotal: null,
|
||||
GrossTotal: null,
|
||||
DeductibleTotal: null,
|
||||
DepreciationTotal: null,
|
||||
Discount: null,
|
||||
CustomerPay: null,
|
||||
InsurancePay: null,
|
||||
Deposit: null,
|
||||
AmountDue: null,
|
||||
},
|
||||
SupplementTotals: {
|
||||
BodyHours: null,
|
||||
RefinishHours: null,
|
||||
MechanicalHours: null,
|
||||
StructuralHours: null,
|
||||
PartsTotal: null,
|
||||
PartsOEM: null,
|
||||
PartsAM: null,
|
||||
PartsReconditioned: null,
|
||||
PartsRecycled: null,
|
||||
PartsOther: null,
|
||||
SubletTotal: null,
|
||||
BodyLaborTotal: null,
|
||||
RefinishLaborTotal: null,
|
||||
MechanicalLaborTotal: null,
|
||||
StructuralLaborTotal: null,
|
||||
MiscellaneousChargeTotal: null,
|
||||
PMTotal: null,
|
||||
BMTotal: null,
|
||||
MiscTotal: null,
|
||||
TowingTotal: null,
|
||||
StorageTotal: null,
|
||||
DetailTotal: null,
|
||||
SalesTaxTotal: null,
|
||||
GrossTotal: null,
|
||||
DeductibleTotal: null,
|
||||
DepreciationTotal: null,
|
||||
Discount: null,
|
||||
CustomerPay: null,
|
||||
InsurancePay: null,
|
||||
Deposit: null,
|
||||
AmountDue: null,
|
||||
(job.parts_tax_rates &&
|
||||
job.parts_tax_rates.PAN &&
|
||||
job.parts_tax_rates.PAN.prt_tax_rt) ||
|
||||
0,
|
||||
StorageRateperDay: 0,
|
||||
DaysStored: 0,
|
||||
},
|
||||
// EstimateTotals: {
|
||||
// BodyHours: null,
|
||||
// RefinishHours: null,
|
||||
// MechanicalHours: null,
|
||||
// StructuralHours: null,
|
||||
// PartsTotal: null,
|
||||
// PartsOEM: null,
|
||||
// PartsAM: null,
|
||||
// PartsReconditioned: null,
|
||||
// PartsRecycled: null,
|
||||
// PartsOther: null,
|
||||
// SubletTotal: null,
|
||||
// BodyLaborTotal: null,
|
||||
// RefinishLaborTotal: null,
|
||||
// MechanicalLaborTotal: null,
|
||||
// StructuralLaborTotal: null,
|
||||
// MiscellaneousChargeTotal: null,
|
||||
// PMTotal: null,
|
||||
// BMTotal: null,
|
||||
// MiscTotal: null,
|
||||
// TowingTotal: null,
|
||||
// StorageTotal: null,
|
||||
// DetailTotal: null,
|
||||
// SalesTaxTotal: null,
|
||||
// GrossTotal: null,
|
||||
// DeductibleTotal: null,
|
||||
// DepreciationTotal: null,
|
||||
// Discount: null,
|
||||
// CustomerPay: null,
|
||||
// InsurancePay: null,
|
||||
// Deposit: null,
|
||||
// AmountDue: null,
|
||||
// },
|
||||
// SupplementTotals: {
|
||||
// BodyHours: null,
|
||||
// RefinishHours: null,
|
||||
// MechanicalHours: null,
|
||||
// StructuralHours: null,
|
||||
// PartsTotal: null,
|
||||
// PartsOEM: null,
|
||||
// PartsAM: null,
|
||||
// PartsReconditioned: null,
|
||||
// PartsRecycled: null,
|
||||
// PartsOther: null,
|
||||
// SubletTotal: null,
|
||||
// BodyLaborTotal: null,
|
||||
// RefinishLaborTotal: null,
|
||||
// MechanicalLaborTotal: null,
|
||||
// StructuralLaborTotal: null,
|
||||
// MiscellaneousChargeTotal: null,
|
||||
// PMTotal: null,
|
||||
// BMTotal: null,
|
||||
// MiscTotal: null,
|
||||
// TowingTotal: null,
|
||||
// StorageTotal: null,
|
||||
// DetailTotal: null,
|
||||
// SalesTaxTotal: null,
|
||||
// GrossTotal: null,
|
||||
// DeductibleTotal: null,
|
||||
// DepreciationTotal: null,
|
||||
// Discount: null,
|
||||
// CustomerPay: null,
|
||||
// InsurancePay: null,
|
||||
// Deposit: null,
|
||||
// AmountDue: null,
|
||||
// },
|
||||
RevisedTotals: {
|
||||
BodyHours: job.job_totals.rates.lab.hours,
|
||||
BodyRepairHours: job.joblines
|
||||
@@ -441,8 +454,8 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
),
|
||||
StructuralLaborTotalCost:
|
||||
repairCosts.StructuralLaborTotalCost.toFormat(AHDineroFormat),
|
||||
MiscellaneousChargeTotal: null,
|
||||
MiscellaneousChargeTotalCost: null,
|
||||
MiscellaneousChargeTotal: 0,
|
||||
MiscellaneousChargeTotalCost: 0,
|
||||
PMTotal: Dinero(job.job_totals.rates.mapa.total).toFormat(
|
||||
AHDineroFormat
|
||||
),
|
||||
@@ -461,17 +474,17 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
AHDineroFormat
|
||||
),
|
||||
StorageTotalCost: repairCosts.StorageTotalCost.toFormat(AHDineroFormat),
|
||||
DetailTotal: null,
|
||||
DetailTotalCost: null,
|
||||
DetailTotal: 0,
|
||||
DetailTotalCost: 0,
|
||||
SalesTaxTotal: Dinero(job.job_totals.totals.local_tax)
|
||||
.add(Dinero(job.job_totals.totals.state_tax))
|
||||
.add(Dinero(job.job_totals.totals.federal_tax))
|
||||
.toFormat(AHDineroFormat),
|
||||
SalesTaxTotalCost: null,
|
||||
SalesTaxTotalCost: 0,
|
||||
GrossTotal: Dinero(job.job_totals.totals.net_repairs).toFormat(
|
||||
AHDineroFormat
|
||||
),
|
||||
DeductibleTotal: job.ded_amt,
|
||||
DeductibleTotal: job.ded_amt || 0,
|
||||
DepreciationTotal: Dinero(
|
||||
job.job_totals.totals.custPayable.dep_taxes
|
||||
).toFormat(AHDineroFormat),
|
||||
@@ -496,8 +509,10 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
InsScreenCommentsLine2: null,
|
||||
AssignmentCaller: null,
|
||||
AssignmentDivision: null,
|
||||
LocationofPrimaryImpact: "12",
|
||||
LocationofSecondaryImpact: null,
|
||||
LocationofPrimaryImpact:
|
||||
(job.area_of_damage && job.area_of_damage.impact1) || 0,
|
||||
LocationofSecondaryImpact:
|
||||
(job.area_of_damage && job.area_of_damage.impact2) || 0,
|
||||
PaintTechID: null,
|
||||
PaintTechName: null,
|
||||
ImportType: null,
|
||||
@@ -517,7 +532,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
RentalDueDate: null,
|
||||
RentalActRetDate: null,
|
||||
RentalCompanyID: null,
|
||||
CSIID: null,
|
||||
// CSIID: null,
|
||||
InsGroupCode: null,
|
||||
},
|
||||
|
||||
@@ -669,36 +684,39 @@ const GenerateDetailLines = (line, statuses) => {
|
||||
const ret = {
|
||||
BackOrdered: line.status === statuses.default_bo ? "1" : "0",
|
||||
Cost:
|
||||
line.billlines[0] &&
|
||||
(line.billlines[0].actual_cost * line.billlines[0].quantity).toFixed(2),
|
||||
Critical: null,
|
||||
Description: line.line_desc,
|
||||
DiscountMarkup: null,
|
||||
(line.billlines[0] &&
|
||||
(line.billlines[0].actual_cost * line.billlines[0].quantity).toFixed(
|
||||
2
|
||||
)) ||
|
||||
0,
|
||||
//Critical: null,
|
||||
Description: line.line_desc || "",
|
||||
DiscountMarkup: line.prt_dsmk_m || "",
|
||||
InvoiceNumber: line.billlines[0] && line.billlines[0].bill.invoice_number,
|
||||
IOUPart: null,
|
||||
LineNumber: line.line_no,
|
||||
IOUPart: 0,
|
||||
LineNumber: line.line_no || 0,
|
||||
MarkUp: null,
|
||||
OrderedOn: null,
|
||||
OriginalCost: null,
|
||||
OriginalInvoiceNumber: null,
|
||||
PriceEach: line.billlines[0] && line.billlines[0].actual_cost,
|
||||
PriceEach: (line.billlines[0] && line.billlines[0].actual_cost) || 0,
|
||||
PartNumber: _.escape(line.oem_partno),
|
||||
ProfitPercent: null,
|
||||
PurchaseOrderNumber: null,
|
||||
Qty: line.part_qty,
|
||||
Status: line.status,
|
||||
SupplementNumber: null,
|
||||
Type: line.part_type,
|
||||
Vendor: line.billlines[0] && line.billlines[0].bill.vendor.name,
|
||||
Qty: line.part_qty || 0,
|
||||
Status: line.status || "",
|
||||
SupplementNumber: line.line_ind || "",
|
||||
Type: line.part_type || "",
|
||||
Vendor: (line.billlines[0] && line.billlines[0].bill.vendor.name) || "",
|
||||
VendorPaid: null,
|
||||
VendorPrice: line.billlines[0] && line.billlines[0].actual_price,
|
||||
VendorPrice: (line.billlines[0] && line.billlines[0].actual_price) || 0,
|
||||
Deleted: null,
|
||||
ExpectedOn: null,
|
||||
ReceivedOn: null,
|
||||
OrderedBy: null,
|
||||
ShipVia: null,
|
||||
VendorContact: null,
|
||||
EstimateAmount: line.act_price,
|
||||
EstimateAmount: line.act_price || 0,
|
||||
};
|
||||
return ret;
|
||||
};
|
||||
@@ -709,9 +727,9 @@ const generateNullDetailLine = () => {
|
||||
Cost: 0,
|
||||
Critical: null,
|
||||
Description: "No Lines on Estimate",
|
||||
DiscountMarkup: null,
|
||||
DiscountMarkup: 0,
|
||||
InvoiceNumber: null,
|
||||
IOUPart: null,
|
||||
IOUPart: 0,
|
||||
LineNumber: 0,
|
||||
MarkUp: null,
|
||||
OrderedOn: null,
|
||||
@@ -722,12 +740,12 @@ const generateNullDetailLine = () => {
|
||||
ProfitPercent: null,
|
||||
PurchaseOrderNumber: null,
|
||||
Qty: 0,
|
||||
Status: null,
|
||||
SupplementNumber: null,
|
||||
Type: null,
|
||||
Vendor: null,
|
||||
Status: "",
|
||||
SupplementNumber: 0,
|
||||
Type: "",
|
||||
Vendor: "",
|
||||
VendorPaid: null,
|
||||
VendorPrice: null,
|
||||
VendorPrice: 0,
|
||||
Deleted: null,
|
||||
ExpectedOn: null,
|
||||
ReceivedOn: null,
|
||||
|
||||
@@ -74,31 +74,48 @@ exports.updateUser = (req, res) => {
|
||||
});
|
||||
};
|
||||
|
||||
exports.sendNotification = (req, res) => {
|
||||
var registrationToken =
|
||||
"fqIWg8ENDFyrRrMWJ1sItR:APA91bHirdZ05Zo66flMlvala97SMXoiQGwP4oCvMwd-vVrSauD_WoNim3kXHGqyP-bzENjkXwA5icyUAReFbeHn6dIaPcbpcsXuY73-eJAXvZiu1gIsrd1BOsnj3dEMT7Q4F6mTPth1";
|
||||
var message = {
|
||||
notification: { title: "The Title", body: "The Body" },
|
||||
data: {
|
||||
jobid: "1234",
|
||||
},
|
||||
token: registrationToken,
|
||||
};
|
||||
exports.sendNotification = async (req, res) => {
|
||||
setTimeout(() => {
|
||||
// Send a message to the device corresponding to the provided
|
||||
// registration token.
|
||||
admin
|
||||
.messaging()
|
||||
.send({
|
||||
topic: "PRD_PATRICK-messaging",
|
||||
notification: {
|
||||
title: `ImEX Online Message - +16049992002`,
|
||||
body: "Test Noti.",
|
||||
//imageUrl: "https://thinkimex.com/img/io-fcm.png",
|
||||
},
|
||||
data: {
|
||||
type: "messaging-inbound",
|
||||
conversationid: "e0eb17c3-3a78-4e3f-b932-55ef35aa2297",
|
||||
text: "Hello. ",
|
||||
image_path: "",
|
||||
phone_num: "+16049992002",
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
// Response is a message ID string.
|
||||
console.log("Successfully sent message:", response);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error sending message:", error);
|
||||
});
|
||||
|
||||
// Send a message to the device corresponding to the provided
|
||||
// registration token.
|
||||
admin
|
||||
res.sendStatus(200);
|
||||
}, 500);
|
||||
};
|
||||
|
||||
exports.subscribe = async (req, res) => {
|
||||
const result = await admin
|
||||
.messaging()
|
||||
.send(message)
|
||||
.then((response) => {
|
||||
// Response is a message ID string.
|
||||
console.log("Successfully sent message:", response);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error sending message:", error);
|
||||
});
|
||||
.subscribeToTopic(
|
||||
req.body.fcm_tokens,
|
||||
`${req.body.imexshopid}-${req.body.type}`
|
||||
);
|
||||
|
||||
res.sendStatus(200);
|
||||
res.json(result);
|
||||
};
|
||||
|
||||
exports.validateFirebaseIdToken = async (req, res, next) => {
|
||||
|
||||
@@ -22,48 +22,74 @@ mutation UNARCHIVE_CONVERSATION($id: uuid!) {
|
||||
|
||||
exports.RECEIVE_MESSAGE = `
|
||||
mutation RECEIVE_MESSAGE($msg: [messages_insert_input!]!) {
|
||||
|
||||
insert_messages(objects: $msg) {
|
||||
insert_messages(objects: $msg) {
|
||||
returning {
|
||||
conversation {
|
||||
id
|
||||
archived
|
||||
bodyshop {
|
||||
associations(where: {active: {_eq: true}}) {
|
||||
user {
|
||||
fcmtokens
|
||||
}
|
||||
}
|
||||
bodyshop{
|
||||
imexshopid
|
||||
}
|
||||
created_at
|
||||
updated_at
|
||||
unreadcnt
|
||||
phone_num
|
||||
}
|
||||
conversationid
|
||||
created_at
|
||||
id
|
||||
image_path
|
||||
image
|
||||
isoutbound
|
||||
msid
|
||||
read
|
||||
text
|
||||
updated_at
|
||||
status
|
||||
userid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
|
||||
exports.INSERT_MESSAGE = `
|
||||
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!, $conversationid: uuid!) {
|
||||
update_conversations_by_pk(pk_columns: {id: $conversationid}, _set: {archived: false}) {
|
||||
id
|
||||
archived
|
||||
}
|
||||
insert_messages(objects: $msg) {
|
||||
insert_messages(objects: $msg) {
|
||||
returning {
|
||||
conversation {
|
||||
id
|
||||
archived
|
||||
bodyshop {
|
||||
associations(where: {active: {_eq: true}}) {
|
||||
user {
|
||||
fcmtokens
|
||||
}
|
||||
}
|
||||
bodyshop{
|
||||
imexshopid
|
||||
}
|
||||
created_at
|
||||
updated_at
|
||||
unreadcnt
|
||||
phone_num
|
||||
}
|
||||
conversationid
|
||||
created_at
|
||||
id
|
||||
image_path
|
||||
image
|
||||
isoutbound
|
||||
msid
|
||||
read
|
||||
text
|
||||
updated_at
|
||||
status
|
||||
userid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
|
||||
exports.UPDATE_MESSAGE_STATUS = `
|
||||
@@ -255,6 +281,8 @@ query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) {
|
||||
clm_no
|
||||
dms_allocation
|
||||
invoice_allocation
|
||||
kmin
|
||||
kmout
|
||||
ownerid
|
||||
ownr_ln
|
||||
ownr_fn
|
||||
@@ -302,6 +330,10 @@ query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) {
|
||||
v_make_desc
|
||||
v_color
|
||||
ca_customer_gst
|
||||
vehicle{
|
||||
v_trimcode
|
||||
v_makecode
|
||||
}
|
||||
bodyshop {
|
||||
id
|
||||
md_ro_statuses
|
||||
@@ -493,7 +525,7 @@ exports.QUERY_EMPLOYEE_PIN = `query QUERY_EMPLOYEE_PIN($shopId: uuid!, $employee
|
||||
}`;
|
||||
|
||||
exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshopid: uuid!) {
|
||||
jobs(where: {_and: [{converted :{_eq: true}},{updated_at: {_gt: $start}}, {shopid: {_eq: $bodyshopid}}]}) {
|
||||
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {shopid: {_eq: $bodyshopid}}]}, limit: 50) {
|
||||
id
|
||||
ro_number
|
||||
status
|
||||
@@ -501,6 +533,7 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
|
||||
est_ct_ln
|
||||
ownr_zip
|
||||
referral_source
|
||||
loss_type
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
@@ -575,6 +608,7 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
|
||||
joblines(where: {removed: {_eq: false}}) {
|
||||
id
|
||||
line_no
|
||||
line_ind
|
||||
status
|
||||
line_ind
|
||||
db_price
|
||||
@@ -644,6 +678,7 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
|
||||
exports.ENTEGRAL_EXPORT = `
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const client = require("../graphql-client/graphql-client").client;
|
||||
const queries = require("../graphql-client/queries");
|
||||
const path = require("path");
|
||||
const logger = require("../utils/logger");
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
@@ -10,15 +11,22 @@ require("dotenv").config({
|
||||
});
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
const { operationName, time, dbevent } = req.body;
|
||||
const { operationName, time, dbevent, user, imexshopid } = req.body;
|
||||
|
||||
try {
|
||||
await client.request(queries.INSERT_IOEVENT, {
|
||||
event: {
|
||||
operationname: operationName,
|
||||
time,
|
||||
dbevent,
|
||||
},
|
||||
// await client.request(queries.INSERT_IOEVENT, {
|
||||
// event: {
|
||||
// operationname: operationName,
|
||||
// time,
|
||||
// dbevent,
|
||||
// },
|
||||
// });
|
||||
console.log("IOEVENT", operationName, time, dbevent, user, imexshopid);
|
||||
logger.log("ioevent", "trace", user, null, {
|
||||
imexshopid,
|
||||
operationName,
|
||||
time,
|
||||
dbevent,
|
||||
});
|
||||
|
||||
res.sendStatus(200);
|
||||
|
||||
@@ -9,7 +9,7 @@ require("dotenv").config({
|
||||
const client = require("../graphql-client/graphql-client").client;
|
||||
const queries = require("../graphql-client/queries");
|
||||
const { phone } = require("phone");
|
||||
const admin = require("../firebase/firebase-handler").admin;
|
||||
const { admin } = require("../firebase/firebase-handler");
|
||||
const logger = require("../utils/logger");
|
||||
exports.receive = async (req, res) => {
|
||||
//Perform request validation
|
||||
@@ -78,21 +78,43 @@ exports.receive = async (req, res) => {
|
||||
});
|
||||
}
|
||||
try {
|
||||
let insertresp;
|
||||
if (response.bodyshops[0].conversations[0]) {
|
||||
const r3 = await client.request(queries.INSERT_MESSAGE, {
|
||||
insertresp = await client.request(queries.INSERT_MESSAGE, {
|
||||
msg: newMessage,
|
||||
conversationid:
|
||||
response.bodyshops[0].conversations[0] &&
|
||||
response.bodyshops[0].conversations[0].id,
|
||||
});
|
||||
} else {
|
||||
const r2 = await client.request(queries.RECEIVE_MESSAGE, {
|
||||
insertresp = await client.request(queries.RECEIVE_MESSAGE, {
|
||||
msg: newMessage,
|
||||
});
|
||||
}
|
||||
const message = insertresp.insert_messages.returning[0];
|
||||
const data = {
|
||||
type: "messaging-inbound",
|
||||
conversationid: message.conversationid || "",
|
||||
text: message.text || "",
|
||||
image_path: message.image_path || "",
|
||||
image: (message.image && message.image.toString()) || "",
|
||||
messageid: message.id || "",
|
||||
phone_num: message.conversation.phone_num || "",
|
||||
};
|
||||
|
||||
const fcmresp = await admin.messaging().send({
|
||||
topic: `${message.conversation.bodyshop.imexshopid}-messaging`,
|
||||
notification: {
|
||||
title: `ImEX Online Message - ${data.phone_num}`,
|
||||
body: message.image_path ? `Image ${message.text}` : message.text,
|
||||
//imageUrl: "https://thinkimex.com/img/io-fcm.png",
|
||||
},
|
||||
data,
|
||||
});
|
||||
|
||||
logger.log("sms-inbound-success", "DEBUG", "api", null, {
|
||||
newMessage,
|
||||
fcmresp,
|
||||
});
|
||||
res.status(200).send("");
|
||||
} catch (e2) {
|
||||
|
||||
@@ -10,6 +10,7 @@ const client = require("../graphql-client/graphql-client").client;
|
||||
const queries = require("../graphql-client/queries");
|
||||
const { phone } = require("phone");
|
||||
const logger = require("../utils/logger");
|
||||
const { admin } = require("../firebase/firebase-handler");
|
||||
|
||||
exports.status = (req, res) => {
|
||||
const { SmsSid, SmsStatus } = req.body;
|
||||
@@ -34,6 +35,23 @@ exports.status = (req, res) => {
|
||||
res.sendStatus(200);
|
||||
};
|
||||
|
||||
exports.markConversationRead = async (req, res) => {
|
||||
const { conversationid, imexshopid } = req.body;
|
||||
admin.messaging().send({
|
||||
topic: `${imexshopid}-messaging`,
|
||||
// notification: {
|
||||
// title: `ImEX Online Message - ${data.phone_num}`,
|
||||
// body: message.image_path ? `Image ${message.text}` : message.text,
|
||||
// imageUrl: "https://thinkimex.com/img/logo512.png",
|
||||
// },
|
||||
data: {
|
||||
type: "messaging-mark-conversation-read",
|
||||
conversationid: conversationid || "",
|
||||
},
|
||||
});
|
||||
res.send(200);
|
||||
};
|
||||
|
||||
// Inbound Sample
|
||||
// {
|
||||
// "SmsSid": "SM5205ea340e06437799d9345e7283457c",
|
||||
|
||||
@@ -5,13 +5,14 @@ const logger = new graylog2.graylog({
|
||||
});
|
||||
|
||||
function log(message, type, user, record, object) {
|
||||
console.log(message, {
|
||||
type,
|
||||
env: process.env.NODE_ENV || "development",
|
||||
user,
|
||||
record,
|
||||
...object,
|
||||
});
|
||||
if (type !== "ioevent")
|
||||
console.log(message, {
|
||||
type,
|
||||
env: process.env.NODE_ENV || "development",
|
||||
user,
|
||||
record,
|
||||
...object,
|
||||
});
|
||||
logger.log(message, {
|
||||
type,
|
||||
env: process.env.NODE_ENV || "development",
|
||||
|
||||
80
yarn.lock
80
yarn.lock
@@ -600,10 +600,10 @@ atob@2.1.2:
|
||||
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
||||
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
|
||||
|
||||
aws-sdk@^2.1028.0:
|
||||
version "2.1028.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1028.0.tgz#ce076076174afa9bd311406b8186ea90163e3331"
|
||||
integrity sha512-OmR0NcpU8zsDcUOZhM+eZ6CzlUFtuaEuRyjm6mxDO0KI7lJAp7/NzB6tcellRrgWxL+NO7b5TSxi+m28qu5ocQ==
|
||||
aws-sdk@^2.1043.0:
|
||||
version "2.1043.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1043.0.tgz#170a5b14b3ea25df760f9a6b437bfe35c9a1578e"
|
||||
integrity sha512-WysMTSLfi8ZCj6QAAitJkxObxOzGLhcu6FxoKHiEnrefvfQtSvwqUq7BbT/pIfijnF9dE/7e9XwjW8Dz/hqF4Q==
|
||||
dependencies:
|
||||
buffer "4.9.2"
|
||||
events "1.1.1"
|
||||
@@ -1004,12 +1004,12 @@ convert-source-map@^1.7.0:
|
||||
dependencies:
|
||||
safe-buffer "~5.1.1"
|
||||
|
||||
cookie-parser@^1.4.5:
|
||||
version "1.4.5"
|
||||
resolved "https://registry.yarnpkg.com/cookie-parser/-/cookie-parser-1.4.5.tgz#3e572d4b7c0c80f9c61daf604e4336831b5d1d49"
|
||||
integrity sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==
|
||||
cookie-parser@^1.4.6:
|
||||
version "1.4.6"
|
||||
resolved "https://registry.yarnpkg.com/cookie-parser/-/cookie-parser-1.4.6.tgz#3ac3a7d35a7a03bbc7e365073a26074824214594"
|
||||
integrity sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==
|
||||
dependencies:
|
||||
cookie "0.4.0"
|
||||
cookie "0.4.1"
|
||||
cookie-signature "1.0.6"
|
||||
|
||||
cookie-signature@1.0.6:
|
||||
@@ -1022,7 +1022,7 @@ cookie@0.4.0:
|
||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
|
||||
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
|
||||
|
||||
cookie@~0.4.1:
|
||||
cookie@0.4.1, cookie@~0.4.1:
|
||||
version "0.4.1"
|
||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1"
|
||||
integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==
|
||||
@@ -1352,10 +1352,10 @@ engine.io-parser@~5.0.0:
|
||||
dependencies:
|
||||
base64-arraybuffer "~1.0.1"
|
||||
|
||||
engine.io@~6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.0.0.tgz#2b993fcd73e6b3a6abb52b40b803651cd5747cf0"
|
||||
integrity sha512-Ui7yl3JajEIaACg8MOUwWvuuwU7jepZqX3BKs1ho7NQRuP4LhN4XIykXhp8bEy+x/DhA0LBZZXYSCkZDqrwMMg==
|
||||
engine.io@~6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.1.0.tgz#459eab0c3724899d7b63a20c3a6835cf92857939"
|
||||
integrity sha512-ErhZOVu2xweCjEfYcTdkCnEYUiZgkAcBBAhW4jbIvNG8SLU3orAqoJCiytZjYF7eTpVmmCrLDjLIEaPlUAs1uw==
|
||||
dependencies:
|
||||
"@types/cookie" "^0.4.1"
|
||||
"@types/cors" "^2.8.12"
|
||||
@@ -1976,10 +1976,10 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
|
||||
integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==
|
||||
|
||||
graphql-request@^3.6.1:
|
||||
version "3.6.1"
|
||||
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-3.6.1.tgz#689cce1da990131b40b05651f9f32bff506a1d8e"
|
||||
integrity sha512-Nm1EasrAQVZllyNTlHDLnLZjlhC6eRWnWP6KH//ytnAL08pjlLkdI2K+s6OV92p45hn5b/kUlLbDwACmRoLwrQ==
|
||||
graphql-request@^3.7.0:
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-3.7.0.tgz#c7406e537084f8b9788541e3e6704340ca13055b"
|
||||
integrity sha512-dw5PxHCgBneN2DDNqpWu8QkbbJ07oOziy8z+bK/TAXufsOLaETuVO4GkXrbs0WjhdKhBMN3BkpN/RIvUHkmNUQ==
|
||||
dependencies:
|
||||
cross-fetch "^3.0.6"
|
||||
extract-files "^9.0.0"
|
||||
@@ -2974,10 +2974,10 @@ performance-now@^2.1.0:
|
||||
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
|
||||
|
||||
phone@^3.1.9:
|
||||
version "3.1.9"
|
||||
resolved "https://registry.yarnpkg.com/phone/-/phone-3.1.9.tgz#692d70061c0d7391ebcd67f30bee4364b52264e5"
|
||||
integrity sha512-u5jPSlbB4lq9W2ptznEb4eBBKnr3y8xAL4Dsn4uFzUl2gWZE6QiQgxMUMelHq3VUUzFq1QM579SkTxJ+k++igg==
|
||||
phone@^3.1.10:
|
||||
version "3.1.10"
|
||||
resolved "https://registry.yarnpkg.com/phone/-/phone-3.1.10.tgz#7e9954b1cf8dcac2cf4f45bfd1e4f55e3833dcaf"
|
||||
integrity sha512-YhUCaFzvp2nGuAL/KkYZ1qDm8E51PkQswDFSzAmQ8jgNt6TU6iHMxp4KEQ2J/mFk9zco84iq6D2j5z7fm7W9Vw==
|
||||
|
||||
pick-util@^1.1.3:
|
||||
version "1.1.3"
|
||||
@@ -3525,10 +3525,10 @@ soap@^0.43.0:
|
||||
uuid "^8.3.2"
|
||||
xml-crypto "^2.1.3"
|
||||
|
||||
socket.io-adapter@~2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.3.2.tgz#039cd7c71a52abad984a6d57da2c0b7ecdd3c289"
|
||||
integrity sha512-PBZpxUPYjmoogY0aoaTmo1643JelsaS1CiAwNjRVdrI0X9Seuc19Y2Wife8k88avW6haG8cznvwbubAZwH4Mtg==
|
||||
socket.io-adapter@~2.3.3:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.3.3.tgz#4d6111e4d42e9f7646e365b4f578269821f13486"
|
||||
integrity sha512-Qd/iwn3VskrpNO60BeRyCyr8ZWw9CPZyitW4AQwmRZ8zCiyDiL+znRnWX6tDHXnWn1sJrM1+b6Mn6wEDJJ4aYQ==
|
||||
|
||||
socket.io-parser@~4.0.4:
|
||||
version "4.0.4"
|
||||
@@ -3539,16 +3539,16 @@ socket.io-parser@~4.0.4:
|
||||
component-emitter "~1.3.0"
|
||||
debug "~4.3.1"
|
||||
|
||||
socket.io@^4.3.2:
|
||||
version "4.3.2"
|
||||
resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.3.2.tgz#85ae0cf5cf18acbce648ac9f48aba66df8cea6bf"
|
||||
integrity sha512-6S5tV4jcY6dbZ/lLzD6EkvNWI3s81JO6ABP/EpvOlK1NPOcIj3AS4khi6xXw6JlZCASq82HQV4SapfmVMMl2dg==
|
||||
socket.io@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.4.0.tgz#8140a0db2c22235f88a6dceb867e4d5c9bd70507"
|
||||
integrity sha512-bnpJxswR9ov0Bw6ilhCvO38/1WPtE3eA2dtxi2Iq4/sFebiDJQzgKNYA7AuVVdGW09nrESXd90NbZqtDd9dzRQ==
|
||||
dependencies:
|
||||
accepts "~1.3.4"
|
||||
base64id "~2.0.0"
|
||||
debug "~4.3.2"
|
||||
engine.io "~6.0.0"
|
||||
socket.io-adapter "~2.3.2"
|
||||
engine.io "~6.1.0"
|
||||
socket.io-adapter "~2.3.3"
|
||||
socket.io-parser "~4.0.4"
|
||||
|
||||
socks-proxy-agent@5, socks-proxy-agent@^5.0.0:
|
||||
@@ -3749,10 +3749,10 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
||||
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
|
||||
|
||||
stripe@^8.188.0:
|
||||
version "8.188.0"
|
||||
resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.188.0.tgz#1d892c2f9000847c627db06a374529e7fbd2b83e"
|
||||
integrity sha512-AW5IOKq4y+ENfHddJPrLL/GSvGj1MnBvUe6QMI1z27x/4pMNrU7v0ZqzRSJCihWqP0tUuCmQibSYSbsV4XJ3zA==
|
||||
stripe@^8.191.0:
|
||||
version "8.191.0"
|
||||
resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.191.0.tgz#7bb56080dce2e2e9cc4f52dc05792626ea46bfd6"
|
||||
integrity sha512-3oyuIbuW3WDsbGnMUtIZPkr+sOUJ3NEtEwghd81ZuWc+Tq09MrgWXGekbVnbxA3TMFwfKOILw6QoiPA7za4JUg==
|
||||
dependencies:
|
||||
"@types/node" ">=8.1.0"
|
||||
qs "^6.6.0"
|
||||
@@ -3916,10 +3916,10 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
|
||||
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
|
||||
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
|
||||
|
||||
twilio@^3.71.1:
|
||||
version "3.71.1"
|
||||
resolved "https://registry.yarnpkg.com/twilio/-/twilio-3.71.1.tgz#15bbb4b51c75d91cc07a8149378c4af330e543cc"
|
||||
integrity sha512-P/KFvm33UW15EnpHJKgdTxUa1u6MlR/u+sCVnL4ie2TDRv6t7kX+ieIGQMpH7bP/z7FXkTjEt0lz4M+XJ/XWOg==
|
||||
twilio@^3.71.3:
|
||||
version "3.71.3"
|
||||
resolved "https://registry.yarnpkg.com/twilio/-/twilio-3.71.3.tgz#a446d2b49f8c1ed60b0dd830c919921358c17203"
|
||||
integrity sha512-m9eda9fvkHxMMDHRtXj8WKI0ViP4EG4xS5au5ay3ScfModhBZ1ZtyfWZ0AfWI++A7a1T1j3ZVNIZ+AMLwxSffw==
|
||||
dependencies:
|
||||
axios "^0.21.4"
|
||||
dayjs "^1.8.29"
|
||||
|
||||
Reference in New Issue
Block a user