Merged in release/2024-10-25 (pull request #1848)
Release/2024-10-25 - IO-2921, IO-2966, IO-2973, IO-2974, IO-2978, IO-2992, IO-2996, IO-2998
This commit is contained in:
0
.localstack/.gitkeep
Normal file
0
.localstack/.gitkeep
Normal file
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
@@ -14,6 +14,21 @@
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000",
|
||||
"webRoot": "${workspaceRoot}/client/src"
|
||||
},
|
||||
{
|
||||
"name": "Attach to Node.js in Docker",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"address": "localhost",
|
||||
"port": 9229,
|
||||
"localRoot": "${workspaceFolder}",
|
||||
"remoteRoot": "/app",
|
||||
"protocol": "inspector",
|
||||
"restart": true,
|
||||
"sourceMaps": true,
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ RUN npm i --no-package-lock
|
||||
COPY . .
|
||||
|
||||
# Expose the port your app runs on (adjust if necessary)
|
||||
EXPOSE 4000
|
||||
EXPOSE 4000 9229
|
||||
|
||||
# Start the application
|
||||
CMD ["nodemon", "--legacy-watch", "server.js"]
|
||||
CMD ["nodemon", "--legacy-watch", "--inspect=0.0.0.0:9229", "server.js"]
|
||||
|
||||
1
_reference/localEmailViewer/.gitignore
vendored
Normal file
1
_reference/localEmailViewer/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
7
_reference/localEmailViewer/README.md
Normal file
7
_reference/localEmailViewer/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
This will connect to your dockers local stack session and render the email in HTML.
|
||||
|
||||
```shell
|
||||
node index.js
|
||||
```
|
||||
|
||||
http://localhost:3334
|
||||
116
_reference/localEmailViewer/index.js
Normal file
116
_reference/localEmailViewer/index.js
Normal file
@@ -0,0 +1,116 @@
|
||||
// index.js
|
||||
|
||||
import express from 'express';
|
||||
import fetch from 'node-fetch';
|
||||
import {simpleParser} from 'mailparser';
|
||||
|
||||
const app = express();
|
||||
const PORT = 3334;
|
||||
|
||||
app.get('/', async (req, res) => {
|
||||
try {
|
||||
const response = await fetch('http://localhost:4566/_aws/ses');
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
const data = await response.json();
|
||||
const messagesHtml = await parseMessages(data.messages);
|
||||
res.send(renderHtml(messagesHtml));
|
||||
} catch (error) {
|
||||
console.error('Error fetching messages:', error);
|
||||
res.status(500).send('Error fetching messages');
|
||||
}
|
||||
});
|
||||
|
||||
async function parseMessages(messages) {
|
||||
const parsedMessages = await Promise.all(
|
||||
messages.map(async (message, index) => {
|
||||
try {
|
||||
const parsed = await simpleParser(message.RawData);
|
||||
return `
|
||||
<div class="shadow-md rounded-lg p-4 mb-6" style="background-color: lightgray">
|
||||
<div class="shadow-md rounded-lg p-4 mb-6" style="background-color: white">
|
||||
<div class="mb-2">
|
||||
<span class="font-bold text-lg">Message ${index + 1}</span>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="font-semibold">From:</span> ${message.Source}
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="font-semibold">Region:</span> ${message.Region}
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="font-semibold">Timestamp:</span> ${message.Timestamp}
|
||||
</div>
|
||||
</div>
|
||||
<div class="prose">
|
||||
${parsed.html || parsed.textAsHtml || 'No HTML content available'}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} catch (error) {
|
||||
console.error('Error parsing email:', error);
|
||||
return `
|
||||
<div class="bg-white shadow-md rounded-lg p-4 mb-6">
|
||||
<div class="mb-2">
|
||||
<span class="font-bold text-lg">Message ${index + 1}</span>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="font-semibold">From:</span> ${message.Source}
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="font-semibold">Region:</span> ${message.Region}
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="font-semibold">Timestamp:</span> ${message.Timestamp}
|
||||
</div>
|
||||
<div class="text-red-500">
|
||||
Error parsing email content
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
})
|
||||
);
|
||||
return parsedMessages.join('');
|
||||
}
|
||||
|
||||
function renderHtml(messagesHtml) {
|
||||
return `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Email Messages Viewer</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
body {
|
||||
background-color: #f3f4f6;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
padding: 20px;
|
||||
}
|
||||
.prose {
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container bg-white shadow-lg rounded-lg p-6">
|
||||
<h1 class="text-2xl font-bold text-center mb-6">Email Messages Viewer</h1>
|
||||
<div id="messages-container">
|
||||
${messagesHtml}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on http://localhost:${PORT}`);
|
||||
});
|
||||
1214
_reference/localEmailViewer/package-lock.json
generated
Normal file
1214
_reference/localEmailViewer/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
18
_reference/localEmailViewer/package.json
Normal file
18
_reference/localEmailViewer/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "localemailviewer",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"express": "^4.21.1",
|
||||
"mailparser": "^3.7.1",
|
||||
"node-fetch": "^3.3.2"
|
||||
}
|
||||
}
|
||||
27
certs/id_rsa
Normal file
27
certs/id_rsa
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAQEAvNl5fuVmLNv72BZNxnTqX5CHf5Xi8UxjYaYxHITSCx7blnhpVYLd
|
||||
qXvcOWXzbsfjch/den73QiW4n2FYz75oGMhUGlOYzdWKA9I9Sj09Qy1R06RhwDiZGd5qaM
|
||||
swEeXpkNmi2u4Qd2kJeDfUQUigjC09V81O/vrniGtQAJScfiG/itdm+Ufn09Z4MYk0HWjq
|
||||
iDokNEskoEPsibYIrb+Q6vdtuPkZO+wU/smXhPtgw5ST6oQdmm/gVNsRg5XNzxrire+z1G
|
||||
WatnnVL3hPnnfpnf8W589dyms7GGJwhPerSGTN1bn0T4+9C69Cd7LBJtxiuFdRmdlGLLLP
|
||||
RR48Rur71wAAA9AEfVsdBH1bHQAAAAdzc2gtcnNhAAABAQC82Xl+5WYs2/vYFk3GdOpfkI
|
||||
d/leLxTGNhpjEchNILHtuWeGlVgt2pe9w5ZfNux+NyH916fvdCJbifYVjPvmgYyFQaU5jN
|
||||
1YoD0j1KPT1DLVHTpGHAOJkZ3mpoyzAR5emQ2aLa7hB3aQl4N9RBSKCMLT1XzU7++ueIa1
|
||||
AAlJx+Ib+K12b5R+fT1ngxiTQdaOqIOiQ0SySgQ+yJtgitv5Dq9224+Rk77BT+yZeE+2DD
|
||||
lJPqhB2ab+BU2xGDlc3PGuKt77PUZZq2edUveE+ed+md/xbnz13KazsYYnCE96tIZM3Vuf
|
||||
RPj70Lr0J3ssEm3GK4V1GZ2UYsss9FHjxG6vvXAAAAAwEAAQAAAQAQTosSLQbMmtY9S3e9
|
||||
yjyusdExcCTfhyQRu4MEHmfws+JsNMuLqbgwOVTD1AzYJQR7x0qdmDcLjCxL/uDnV16vvS
|
||||
Sd/Vf1dhnryIyoS29tzI0DRG94ZKq7tBvmHp1w/jRT4KcSVnovhW9e5Rs74+SRFhr06PKI
|
||||
S+wQOIv48Nwue9+QUMsMCpWgKXHx7SHNTHvnAfqdhi9O29SWlMA+v+mELZ5Cl+HU0UTt2I
|
||||
A1BxOe1N8FjN7KE2viJexsl3is1PuqMkpLl/wyHBJTVzUadl6DRALJQIm7/YO5goE72YOV
|
||||
Lpo27do3zjhC87dlKdATvZUzfKV0LuUVdxq/PNDZMUbBAAAAgQDShAqDZiDrdTUaGXfUVm
|
||||
QzcnVNbh2/KgZh4uux9QNHST562W6cnN7qxoRwVrM4BCOk1Kl73QQZW4nDvXX3PVC5j038
|
||||
8AXkcBHS9j9f4h72ue7D2jqlbHFa7aGU9zYgk9mbBF+GX3tDntkAIQjLtwOLfj1iiJ/clX
|
||||
mHFUAY1V4L8AAAAIEA3E4t/v0yU5D9AOI0r17UNYqfeyDoKAEDR4QbbFjO1l0kLnEJy7Zx
|
||||
Mhj18GilYg2y0P0v8dSM/oWXS8Hua2t5i9Exlv6gHhGlQ80mwYcVGIxewZ/pPeCPw0U+kt
|
||||
EKUjt09m9Oe7+6xHQsTBj9hY8/vqPmQwRalZFcLdhHiDiVKTcAAACBANtykaPXdVzEFx7D
|
||||
UOlsjVL7zM0EVOFXf9JJQ6BhazhmsEI2PYt3IpgGMo8cXkoUofAOIYjf421AabN1BqSO5J
|
||||
XTMxM0ZV3JmLLi804Mu9h1iFrVTBdLYOMJdc2VCo1EwHWpo9SXOyjxce/znvcIOU04aZhu
|
||||
TaPg816X+E+gw5JhAAAAFGRhdmVARGF2ZVJpY2hlci1JTUVYAQIDBAUG
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
certs/id_rsa.pub
Normal file
1
certs/id_rsa.pub
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC82Xl+5WYs2/vYFk3GdOpfkId/leLxTGNhpjEchNILHtuWeGlVgt2pe9w5ZfNux+NyH916fvdCJbifYVjPvmgYyFQaU5jN1YoD0j1KPT1DLVHTpGHAOJkZ3mpoyzAR5emQ2aLa7hB3aQl4N9RBSKCMLT1XzU7++ueIa1AAlJx+Ib+K12b5R+fT1ngxiTQdaOqIOiQ0SySgQ+yJtgitv5Dq9224+Rk77BT+yZeE+2DDlJPqhB2ab+BU2xGDlc3PGuKt77PUZZq2edUveE+ed+md/xbnz13KazsYYnCE96tIZM3VufRPj70Lr0J3ssEm3GK4V1GZ2UYsss9FHjxG6vvX dave@DaveRicher-IMEX
|
||||
@@ -7,10 +7,10 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CiecaSelect from "../../utils/Ciecaselect";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import BillLineSearchSelect from "../bill-line-search-select/bill-line-search-select.component";
|
||||
import BilllineAddInventory from "../billline-add-inventory/billline-add-inventory.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -72,7 +72,14 @@ export function BillEnterModalLinesComponent({
|
||||
<BillLineSearchSelect
|
||||
disabled={disabled}
|
||||
options={lineData}
|
||||
style={{ width: "100%", minWidth: "10rem" }}
|
||||
style={{
|
||||
width: "20rem",
|
||||
maxWidth: "20rem",
|
||||
minWidth: "10rem",
|
||||
whiteSpace: "normal",
|
||||
height: "auto",
|
||||
minHeight: "32px" // default height of Ant Design inputs
|
||||
}}
|
||||
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
||||
onSelect={(value, opt) => {
|
||||
setFieldsValue({
|
||||
@@ -105,7 +112,7 @@ export function BillEnterModalLinesComponent({
|
||||
title: t("billlines.fields.line_desc"),
|
||||
dataIndex: "line_desc",
|
||||
editable: true,
|
||||
|
||||
width: "20rem",
|
||||
formItemProps: (field) => {
|
||||
return {
|
||||
key: `${field.index}line_desc`,
|
||||
@@ -119,7 +126,7 @@ export function BillEnterModalLinesComponent({
|
||||
]
|
||||
};
|
||||
},
|
||||
formInput: (record, index) => <Input disabled={disabled} />
|
||||
formInput: (record, index) => <Input.TextArea disabled={disabled} autoSize />
|
||||
},
|
||||
{
|
||||
title: t("billlines.fields.quantity"),
|
||||
|
||||
@@ -11,7 +11,7 @@ const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps },
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
showSearch
|
||||
popupMatchSelectWidth={false}
|
||||
popupMatchSelectWidth={true}
|
||||
optionLabelProp={"name"}
|
||||
// optionFilterProp="line_desc"
|
||||
filterOption={(inputValue, option) => {
|
||||
@@ -43,7 +43,7 @@ const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps },
|
||||
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
||||
}${item.alt_partno ? ` (${item.alt_partno})` : ""}`.trim(),
|
||||
label: (
|
||||
<>
|
||||
<div style={{ whiteSpace: 'normal', wordBreak: 'break-word' }}>
|
||||
<span>
|
||||
{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
||||
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
||||
@@ -57,7 +57,7 @@ const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps },
|
||||
<span style={{ float: "right", paddingleft: "1rem" }}>
|
||||
{item.act_price ? `$${item.act_price && item.act_price.toFixed(2)}` : ``}
|
||||
</span>
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}))
|
||||
]}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { WarningFilled } from "@ant-design/icons";
|
||||
import { Form, Input, InputNumber, Space } from "antd";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import dayjs from "../../utils/day";
|
||||
//import ContractLicenseDecodeButton from "../contract-license-decode-button/contract-license-decode-button.component";
|
||||
import ContractStatusSelector from "../contract-status-select/contract-status-select.component";
|
||||
import ContractsRatesChangeButton from "../contracts-rates-change-button/contracts-rates-change-button.component";
|
||||
import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component";
|
||||
import FormDateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||
import {
|
||||
default as DateTimePicker,
|
||||
default as FormDateTimePicker
|
||||
} from "../form-date-time-picker/form-date-time-picker.component";
|
||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||
import InputPhone, { PhoneItemFormatterValidation } from "../form-items-formatted/phone-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
@@ -18,10 +20,10 @@ import ContractFormJobPrefill from "./contract-form-job-prefill.component";
|
||||
export default function ContractFormComponent({ form, create = false, selectedJobState, selectedCar }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div>
|
||||
<FormFieldsChanged form={form} />
|
||||
<>
|
||||
{!create && <FormFieldsChanged form={form} />}
|
||||
<LayoutFormRow>
|
||||
{create ? null : (
|
||||
{!create && (
|
||||
<Form.Item
|
||||
label={t("contracts.fields.status")}
|
||||
name="status"
|
||||
@@ -50,7 +52,7 @@ export default function ContractFormComponent({ form, create = false, selectedJo
|
||||
<Form.Item label={t("contracts.fields.scheduledreturn")} name="scheduledreturn">
|
||||
<FormDateTimePicker />
|
||||
</Form.Item>
|
||||
{create ? null : (
|
||||
{!create && (
|
||||
<Form.Item label={t("contracts.fields.actualreturn")} name="actualreturn">
|
||||
<FormDateTimePicker />
|
||||
</Form.Item>
|
||||
@@ -122,7 +124,7 @@ export default function ContractFormComponent({ form, create = false, selectedJo
|
||||
}}
|
||||
</Form.Item>
|
||||
)}
|
||||
{create ? null : (
|
||||
{!create && (
|
||||
<Form.Item label={t("contracts.fields.kmend")} name="kmend">
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
@@ -145,25 +147,21 @@ export default function ContractFormComponent({ form, create = false, selectedJo
|
||||
>
|
||||
<CourtesyCarFuelSlider />
|
||||
</Form.Item>
|
||||
{create ? null : (
|
||||
{!create && (
|
||||
<Form.Item label={t("contracts.fields.fuelin")} name="fuelin" span={8}>
|
||||
<CourtesyCarFuelSlider />
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
<div>
|
||||
<Space wrap>
|
||||
{selectedJobState && (
|
||||
<div>
|
||||
<ContractFormJobPrefill jobId={selectedJobState && selectedJobState[0]} form={form} />
|
||||
</div>
|
||||
)}
|
||||
{
|
||||
//<ContractLicenseDecodeButton form={form} />
|
||||
}
|
||||
</Space>
|
||||
</div>
|
||||
<LayoutFormRow header={t("contracts.labels.driverinformation")}>
|
||||
<Space wrap>
|
||||
{create && selectedJobState && (
|
||||
<ContractFormJobPrefill jobId={selectedJobState && selectedJobState[0]} form={form} />
|
||||
)}
|
||||
{/* {<ContractLicenseDecodeButton form={form} />} */}
|
||||
</Space>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow noDivider={true}>
|
||||
<Form.Item
|
||||
label={t("contracts.fields.driver_dlnumber")}
|
||||
name="driver_dlnumber"
|
||||
@@ -183,9 +181,8 @@ export default function ContractFormComponent({ form, create = false, selectedJo
|
||||
const dlExpiresBeforeReturn = dayjs(form.getFieldValue("driver_dlexpiry")).isBefore(
|
||||
dayjs(form.getFieldValue("scheduledreturn"))
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<>
|
||||
<Form.Item
|
||||
label={t("contracts.fields.driver_dlexpiry")}
|
||||
name="driver_dlexpiry"
|
||||
@@ -204,11 +201,10 @@ export default function ContractFormComponent({ form, create = false, selectedJo
|
||||
<span>{t("contracts.labels.dlexpirebeforereturn")}</span>
|
||||
</Space>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t("contracts.fields.driver_dlst")} name="driver_dlst">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
@@ -315,6 +311,6 @@ export default function ContractFormComponent({ form, create = false, selectedJo
|
||||
<InputNumber precision={2} />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import ScheduleEventColor from "./schedule-event.color.component";
|
||||
import ScheduleEventNote from "./schedule-event.note.component";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
||||
import ProductionListColumnComment from "../production-list-columns/production-list-columns.comment.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
@@ -127,6 +128,9 @@ export function ScheduleEventComponent({
|
||||
{(event.job && event.job.alt_transport) || ""}
|
||||
<ScheduleAtChange job={event && event.job} />
|
||||
</DataLabel>
|
||||
<DataLabel label={t("jobs.fields.comment")} valueStyle={{ overflow: "hidden", textOverflow: "ellipsis" }}>
|
||||
<ProductionListColumnComment record={event && event.job} />
|
||||
</DataLabel>
|
||||
<ScheduleEventNote event={event} />
|
||||
</div>
|
||||
) : (
|
||||
@@ -316,6 +320,7 @@ export function ScheduleEventComponent({
|
||||
})`}
|
||||
|
||||
{event.job && event.job.alt_transport && <div style={{ margin: ".1rem" }}>{event.job.alt_transport}</div>}
|
||||
{event?.job?.comment && `C: ${event.job.comment}`}
|
||||
</Space>
|
||||
) : (
|
||||
<div
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import Board from "./trello-board/index";
|
||||
import { Button, notification, Skeleton, Space } from "antd";
|
||||
import { PageHeader } from "@ant-design/pro-layout";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { Button, notification, Skeleton, Space } from "antd";
|
||||
import cloneDeep from "lodash/cloneDeep";
|
||||
import isEqual from "lodash/isEqual";
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import NoteUpsertModal from "../../components/note-upsert-modal/note-upsert-modal.container";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { generate_UPDATE_JOB_KANBAN } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
@@ -15,14 +17,13 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
import IndefiniteLoading from "../indefinite-loading/indefinite-loading.component";
|
||||
import ProductionBoardFilters from "../production-board-filters/production-board-filters.component";
|
||||
import ProductionListDetailComponent from "../production-list-detail/production-list-detail.component";
|
||||
import ProductionListPrint from "../production-list-table/production-list-print.component.jsx";
|
||||
import CardColorLegend from "./production-board-kanban-card-color-legend.component.jsx";
|
||||
import "./production-board-kanban.styles.scss";
|
||||
import { createBoardData } from "./production-board-kanban.utils.js";
|
||||
import ProductionBoardKanbanSettings from "./settings/production-board-kanban.settings.component.jsx";
|
||||
import cloneDeep from "lodash/cloneDeep";
|
||||
import isEqual from "lodash/isEqual";
|
||||
import { defaultFilters, mergeWithDefaults } from "./settings/defaultKanbanSettings.js";
|
||||
import NoteUpsertModal from "../../components/note-upsert-modal/note-upsert-modal.container";
|
||||
import ProductionBoardKanbanSettings from "./settings/production-board-kanban.settings.component.jsx";
|
||||
import Board from "./trello-board/index";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
@@ -214,6 +215,7 @@ function ProductionBoardKanbanComponent({ data, bodyshop, refetch, insertAuditTr
|
||||
bodyshop={bodyshop}
|
||||
data={data}
|
||||
/>
|
||||
<ProductionListPrint />
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -77,7 +77,7 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
||||
|
||||
const matchingColumnConfig = useMemo(() => {
|
||||
return bodyshop?.production_config?.find((p) => p.name === defaultView);
|
||||
}, [bodyshop.production_config]);
|
||||
}, [bodyshop.production_config, defaultView]);
|
||||
|
||||
useEffect(() => {
|
||||
const newColumns =
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
import { Button, Card, Space, Switch, Table } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import dayjs from "../../utils/day";
|
||||
import {
|
||||
CheckCircleFilled,
|
||||
CheckCircleOutlined,
|
||||
@@ -15,9 +8,16 @@ import {
|
||||
PlusCircleFilled,
|
||||
SyncOutlined
|
||||
} from "@ant-design/icons";
|
||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
||||
import { Button, Card, Space, Switch, Table } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
||||
import dayjs from "../../utils/day";
|
||||
|
||||
/**
|
||||
* Task List Component
|
||||
@@ -140,6 +140,17 @@ function TaskListComponent({
|
||||
render: (text, record) => <DateTimeFormatter>{record.created_at}</DateTimeFormatter>
|
||||
});
|
||||
|
||||
columns.push({
|
||||
title: t("tasks.fields.created_by"),
|
||||
dataIndex: "created_by",
|
||||
key: "created_by",
|
||||
width: "10%",
|
||||
defaultSortOrder: "descend",
|
||||
sorter: true,
|
||||
sortOrder: sortcolumn === "created_by" && sortorder,
|
||||
render: (text, record) => record.created_by
|
||||
});
|
||||
|
||||
if (!onlyMine) {
|
||||
columns.push({
|
||||
title: t("tasks.fields.assigned_to"),
|
||||
|
||||
@@ -48,6 +48,7 @@ export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
|
||||
v_model_desc
|
||||
est_ct_fn
|
||||
est_ct_ln
|
||||
comment
|
||||
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }) {
|
||||
aggregate {
|
||||
sum {
|
||||
|
||||
@@ -3044,6 +3044,7 @@
|
||||
"production_by_target_date": "Production by Target Date",
|
||||
"production_by_technician": "Production by Technician",
|
||||
"production_by_technician_one": "Production filtered by Technician",
|
||||
"production_not_production_status": "Production not in Production Status",
|
||||
"production_over_time": "Production Level over Time",
|
||||
"psr_by_make": "Percent of Sales by Vehicle Make",
|
||||
"purchase_return_ratio_grouped_by_vendor_detail": "Purchase & Return Ratio by Vendor (Detail)",
|
||||
@@ -3186,6 +3187,7 @@
|
||||
"billid": "Bill",
|
||||
"completed": "Completed",
|
||||
"created_at": "Created At",
|
||||
"created_by": "Created By",
|
||||
"description": "Description",
|
||||
"due_date": "Due Date",
|
||||
"job": {
|
||||
|
||||
@@ -3044,6 +3044,7 @@
|
||||
"production_by_target_date": "",
|
||||
"production_by_technician": "",
|
||||
"production_by_technician_one": "",
|
||||
"production_not_production_status": "",
|
||||
"production_over_time": "",
|
||||
"psr_by_make": "",
|
||||
"purchase_return_ratio_grouped_by_vendor_detail": "",
|
||||
@@ -3186,6 +3187,7 @@
|
||||
"billid": "",
|
||||
"completed": "",
|
||||
"created_at": "",
|
||||
"created_by": "",
|
||||
"description": "",
|
||||
"due_date": "",
|
||||
"job": {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2333,6 +2333,14 @@ export const TemplateList = (type, context) => {
|
||||
key: "production_by_technician",
|
||||
//idtype: "vendor",
|
||||
disabled: false
|
||||
},
|
||||
production_not_production_status: {
|
||||
title: i18n.t("reportcenter.templates.production_not_production_status"),
|
||||
description: "",
|
||||
subject: i18n.t("reportcenter.templates.production_not_production_status"),
|
||||
key: "production_not_production_status",
|
||||
//idtype: "vendor",
|
||||
disabled: false
|
||||
}
|
||||
}
|
||||
: {}),
|
||||
|
||||
@@ -74,7 +74,7 @@ services:
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
- SERVICES=ses
|
||||
- SERVICES=ses,secretsmanager,cloudwatch,logs
|
||||
- DEBUG=0
|
||||
- AWS_ACCESS_KEY_ID=test
|
||||
- AWS_SECRET_ACCESS_KEY=test
|
||||
@@ -101,6 +101,10 @@ services:
|
||||
depends_on:
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- './localstack:/tmp/localstack'
|
||||
- './certs:/tmp/certs'
|
||||
|
||||
environment:
|
||||
- AWS_ACCESS_KEY_ID=test
|
||||
- AWS_SECRET_ACCESS_KEY=test
|
||||
@@ -110,6 +114,8 @@ services:
|
||||
"
|
||||
aws --endpoint-url=http://localstack:4566 ses verify-domain-identity --domain imex.online --region ca-central-1
|
||||
aws --endpoint-url=http://localstack:4566 ses verify-email-identity --email-address noreply@imex.online --region ca-central-1
|
||||
aws --endpoint-url=http://localstack:4566 secretsmanager create-secret --name CHATTER_PRIVATE_KEY --secret-string file:///tmp/certs/id_rsa
|
||||
aws --endpoint-url=http://localstack:4566 logs create-log-group --log-group-name development --region ca-central-1
|
||||
"
|
||||
# Node App: The Main IMEX API
|
||||
node-app:
|
||||
@@ -134,6 +140,7 @@ services:
|
||||
condition: service_completed_successfully
|
||||
ports:
|
||||
- "4000:4000"
|
||||
- "9229:9229"
|
||||
volumes:
|
||||
- .:/app
|
||||
- node-app-npm-cache:/app/node_modules
|
||||
|
||||
1532
package-lock.json
generated
1532
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -19,10 +19,11 @@
|
||||
"makeitpretty": "prettier --write \"**/*.{css,js,json,jsx,scss}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-elasticache": "^3.665.0",
|
||||
"@aws-sdk/client-secrets-manager": "^3.654.0",
|
||||
"@aws-sdk/client-ses": "^3.654.0",
|
||||
"@aws-sdk/credential-provider-node": "^3.654.0",
|
||||
"@aws-sdk/client-cloudwatch-logs": "^3.679.0",
|
||||
"@aws-sdk/client-elasticache": "^3.675.0",
|
||||
"@aws-sdk/client-secrets-manager": "^3.675.0",
|
||||
"@aws-sdk/client-ses": "^3.675.0",
|
||||
"@aws-sdk/credential-provider-node": "^3.675.0",
|
||||
"@opensearch-project/opensearch": "^2.12.0",
|
||||
"@socket.io/admin-ui": "^0.5.1",
|
||||
"@socket.io/redis-adapter": "^8.3.0",
|
||||
@@ -32,40 +33,41 @@
|
||||
"bluebird": "^3.7.2",
|
||||
"body-parser": "^1.20.3",
|
||||
"canvas": "^2.11.2",
|
||||
"chart.js": "^4.4.4",
|
||||
"cloudinary": "^2.5.0",
|
||||
"chart.js": "^4.4.5",
|
||||
"cloudinary": "^2.5.1",
|
||||
"compression": "^1.7.4",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"cookie-parser": "^1.4.7",
|
||||
"cors": "2.8.5",
|
||||
"csrf": "^3.1.0",
|
||||
"dinero.js": "^1.9.1",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.21.0",
|
||||
"firebase-admin": "^12.5.0",
|
||||
"express": "^4.21.1",
|
||||
"firebase-admin": "^12.6.0",
|
||||
"graphql": "^16.9.0",
|
||||
"graphql-request": "^6.1.0",
|
||||
"graylog2": "^0.2.1",
|
||||
"inline-css": "^4.0.2",
|
||||
"intuit-oauth": "^4.1.2",
|
||||
"ioredis": "^5.4.1",
|
||||
"json-2-csv": "^5.5.5",
|
||||
"json-2-csv": "^5.5.6",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.30.1",
|
||||
"moment-timezone": "^0.5.45",
|
||||
"moment-timezone": "^0.5.46",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"node-mailjet": "^6.0.6",
|
||||
"node-persist": "^4.0.3",
|
||||
"nodemailer": "^6.9.15",
|
||||
"phone": "^3.1.50",
|
||||
"phone": "^3.1.51",
|
||||
"recursive-diff": "^1.0.9",
|
||||
"redis": "^4.7.0",
|
||||
"rimraf": "^6.0.1",
|
||||
"soap": "^1.1.4",
|
||||
"soap": "^1.1.5",
|
||||
"socket.io": "^4.8.0",
|
||||
"socket.io-adapter": "^2.5.5",
|
||||
"ssh2-sftp-client": "^10.0.3",
|
||||
"twilio": "^4.23.0",
|
||||
"uuid": "^10.0.0",
|
||||
"winston": "^3.15.0",
|
||||
"winston-cloudwatch": "^6.3.0",
|
||||
"xml2js": "^0.6.2",
|
||||
"xmlbuilder2": "^3.1.1"
|
||||
},
|
||||
|
||||
14
server.js
14
server.js
@@ -1,5 +1,10 @@
|
||||
const cors = require("cors");
|
||||
// Load environment variables THIS MUST BE AT THE TOP
|
||||
const path = require("path");
|
||||
require("dotenv").config({
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
|
||||
const cors = require("cors");
|
||||
const http = require("http");
|
||||
const Redis = require("ioredis");
|
||||
const express = require("express");
|
||||
@@ -18,11 +23,6 @@ const { redisSocketEvents } = require("./server/web-sockets/redisSocketEvents");
|
||||
const { ElastiCacheClient, DescribeCacheClustersCommand } = require("@aws-sdk/client-elasticache");
|
||||
const { default: InstanceManager } = require("./server/utils/instanceMgr");
|
||||
|
||||
// Load environment variables
|
||||
require("dotenv").config({
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
|
||||
const CLUSTER_RETRY_BASE_DELAY = 100;
|
||||
const CLUSTER_RETRY_MAX_DELAY = 5000;
|
||||
const CLUSTER_RETRY_JITTER = 100;
|
||||
@@ -174,7 +174,7 @@ const connectToRedisCluster = async () => {
|
||||
Math.min(CLUSTER_RETRY_BASE_DELAY + times * 50, CLUSTER_RETRY_MAX_DELAY) + Math.random() * CLUSTER_RETRY_JITTER;
|
||||
logger.log(
|
||||
`[${process.env.NODE_ENV}] Redis cluster not yet ready. Retrying in ${delay.toFixed(2)}ms`,
|
||||
"ERROR",
|
||||
"WARN",
|
||||
"redis",
|
||||
"api"
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ axios.interceptors.request.use((x) => {
|
||||
const printable = `${new Date()} | Request: ${x.method.toUpperCase()} | ${
|
||||
x.url
|
||||
} | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`;
|
||||
console.log(printable);
|
||||
//console.log(printable);
|
||||
|
||||
CdkBase.createJsonEvent(socket, "TRACE", `Raw Request: ${printable}`, x.data);
|
||||
|
||||
@@ -35,7 +35,7 @@ axios.interceptors.response.use((x) => {
|
||||
const socket = x.config.socket;
|
||||
|
||||
const printable = `${new Date()} | Response: ${x.status} | ${JSON.stringify(x.data)}`;
|
||||
console.log(printable);
|
||||
//console.log(printable);
|
||||
CdkBase.createJsonEvent(socket, "TRACE", `Raw Response: ${printable}`, x.data);
|
||||
|
||||
return x;
|
||||
|
||||
@@ -26,7 +26,7 @@ axios.interceptors.request.use((x) => {
|
||||
const printable = `${new Date()} | Request: ${x.method.toUpperCase()} | ${
|
||||
x.url
|
||||
} | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`;
|
||||
console.log(printable);
|
||||
//console.log(printable);
|
||||
|
||||
CdkBase.createJsonEvent(socket, "TRACE", `Raw Request: ${printable}`, x.data);
|
||||
|
||||
@@ -37,7 +37,7 @@ axios.interceptors.response.use((x) => {
|
||||
const socket = x.config.socket;
|
||||
|
||||
const printable = `${new Date()} | Response: ${x.status} | ${JSON.stringify(x.data)}`;
|
||||
console.log(printable);
|
||||
//console.log(printable);
|
||||
CdkBase.createJsonEvent(socket, "TRACE", `Raw Response: ${printable}`, x.data);
|
||||
|
||||
return x;
|
||||
|
||||
@@ -207,7 +207,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
});
|
||||
|
||||
if (!hasMapaLine && jobs_by_pk.job_totals.rates.mapa.total.amount > 0) {
|
||||
// console.log("Adding MAPA Line Manually.");
|
||||
// //console.log("Adding MAPA Line Manually.");
|
||||
const mapaAccountName = responsibilityCenters.defaults.profits.MAPA;
|
||||
|
||||
const mapaAccount = responsibilityCenters.profits.find((c) => c.name === mapaAccountName);
|
||||
@@ -272,12 +272,12 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
});
|
||||
}
|
||||
} else {
|
||||
//console.log("NO MAPA ACCOUNT FOUND!!");
|
||||
////console.log("NO MAPA ACCOUNT FOUND!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasMashLine && jobs_by_pk.job_totals.rates.mash.total.amount > 0) {
|
||||
// console.log("Adding MASH Line Manually.");
|
||||
// //console.log("Adding MASH Line Manually.");
|
||||
|
||||
const mashAccountName = responsibilityCenters.defaults.profits.MASH;
|
||||
|
||||
@@ -341,7 +341,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// console.log("NO MASH ACCOUNT FOUND!!");
|
||||
// //console.log("NO MASH ACCOUNT FOUND!!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
|
||||
: taxCodes[taxAccountCode];
|
||||
for (let tyCounter = 1; tyCounter <= 5; tyCounter++) {
|
||||
const taxAmount = Dinero(job_totals.totals.us_sales_tax_breakdown[`ty${tyCounter}Tax`]);
|
||||
console.log(`Tax ${tyCounter}`, taxAmount.toFormat());
|
||||
//console.log(`Tax ${tyCounter}`, taxAmount.toFormat());
|
||||
if (taxAmount.getAmount() > 0) {
|
||||
if (qbo) {
|
||||
InvoiceLineAdd.push({
|
||||
|
||||
@@ -121,7 +121,7 @@ exports.default = async (req, res) => {
|
||||
|
||||
res.status(200).json(ret);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("qbo-payable-create-error", "ERROR", req.user.email, {
|
||||
error: error.message,
|
||||
stack: error.stack
|
||||
|
||||
@@ -182,7 +182,7 @@ exports.default = async (req, res) => {
|
||||
|
||||
res.status(200).json(ret);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("qbo-payment-create-error", "ERROR", req.user.email, {
|
||||
error: error.message,
|
||||
stack: error.stack
|
||||
|
||||
@@ -185,7 +185,7 @@ exports.default = async (req, res) => {
|
||||
error?.response?.data ||
|
||||
error?.message
|
||||
});
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("qbo-receivable-create-error", "ERROR", req.user.email, {
|
||||
error: error.message,
|
||||
stack: error.stack
|
||||
@@ -211,7 +211,7 @@ exports.default = async (req, res) => {
|
||||
|
||||
res.status(200).json(ret);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("qbo-receivable-create-error", "ERROR", req.user.email, {
|
||||
error: error.message,
|
||||
stack: error.stack
|
||||
|
||||
@@ -9,7 +9,7 @@ require("dotenv").config({
|
||||
const client = require("../graphql-client/graphql-client").client;
|
||||
|
||||
exports.createAssociation = async (req, res) => {
|
||||
logger.log("admin-create-association", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-create-association", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -31,7 +31,7 @@ exports.createAssociation = async (req, res) => {
|
||||
res.json(result);
|
||||
};
|
||||
exports.createShop = async (req, res) => {
|
||||
logger.log("admin-create-shop", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-create-shop", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -64,7 +64,7 @@ exports.createShop = async (req, res) => {
|
||||
}
|
||||
};
|
||||
exports.updateCounter = async (req, res) => {
|
||||
logger.log("admin-update-counter", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-update-counter", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -91,7 +91,7 @@ exports.updateCounter = async (req, res) => {
|
||||
}
|
||||
};
|
||||
exports.updateShop = async (req, res) => {
|
||||
logger.log("admin-update-shop", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-update-shop", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ exports.defaultRoute = async function (req, res) {
|
||||
const jobData = await QueryJobData(req, req.BearerToken, req.body.jobid);
|
||||
return res.status(200).json({ data: calculateAllocations(req, jobData) });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
////console.log(error);
|
||||
CdkBase.createLogEvent(req, "ERROR", `Error encountered in CdkCalculateAllocations. ${error}`);
|
||||
res.status(500).json({ error: `Error encountered in CdkCalculateAllocations. ${error}` });
|
||||
}
|
||||
@@ -33,7 +33,7 @@ exports.default = async function (socket, jobid) {
|
||||
const jobData = await QueryJobData(socket, "Bearer " + socket.handshake.auth.token, jobid);
|
||||
return calculateAllocations(socket, jobData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
////console.log(error);
|
||||
CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkCalculateAllocations. ${error}`);
|
||||
}
|
||||
};
|
||||
@@ -212,7 +212,7 @@ function calculateAllocations(connectionData, job) {
|
||||
});
|
||||
|
||||
if (!hasMapaLine && job.job_totals.rates.mapa.total.amount > 0) {
|
||||
// console.log("Adding MAPA Line Manually.");
|
||||
// //console.log("Adding MAPA Line Manually.");
|
||||
const mapaAccountName = selectedDmsAllocationConfig.profits.MAPA;
|
||||
|
||||
const mapaAccount = bodyshop.md_responsibility_centers.profits.find((c) => c.name === mapaAccountName);
|
||||
@@ -224,7 +224,7 @@ function calculateAllocations(connectionData, job) {
|
||||
Dinero(job.job_totals.rates.mapa.total)
|
||||
);
|
||||
} else {
|
||||
//console.log("NO MAPA ACCOUNT FOUND!!");
|
||||
////console.log("NO MAPA ACCOUNT FOUND!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -820,7 +820,7 @@ exports.default = async (req, res) => {
|
||||
job: JSON.stringify({ id: job.id, ro_number: job.ro_number }),
|
||||
error: error.message || JSON.stringify(error)
|
||||
});
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.log("arms-failed-job", "ERROR", "api", job.shopid, {
|
||||
@@ -886,7 +886,10 @@ exports.default = async (req, res) => {
|
||||
const [result, rawResponse, , rawRequest] = entegralResponse;
|
||||
} catch (error) {
|
||||
fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml);
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("arms-error-shop", "ERROR", "api", bodyshop.id, {
|
||||
error
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
//Error at the shop level.
|
||||
|
||||
@@ -206,9 +206,6 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
|
||||
const repairCosts = CreateCosts(job);
|
||||
|
||||
if (job.ro_number === "QBD209") {
|
||||
console.log("Stop here");
|
||||
}
|
||||
//Calculate detail only lines.
|
||||
const detailAdjustments = job.joblines
|
||||
.filter((jl) => jl.ah_detail_line && jl.mod_lbr_ty)
|
||||
|
||||
@@ -154,7 +154,7 @@ exports.default = async (req, res) => {
|
||||
async function getPrivateKey() {
|
||||
// Connect to AWS Secrets Manager
|
||||
const client = new SecretsManagerClient({ region: "ca-central-1" });
|
||||
const command = new GetSecretValueCommand({ SecretId: CHATTER_PRIVATE_KEY });
|
||||
const command = new GetSecretValueCommand({ SecretId: "CHATTER_PRIVATE_KEY" });
|
||||
|
||||
logger.log("chatter-get-private-key", "DEBUG", "api", null, null);
|
||||
try {
|
||||
|
||||
@@ -77,6 +77,7 @@ const formatPriority = (priority) => {
|
||||
* @param priority
|
||||
* @param description
|
||||
* @param dueDate
|
||||
* @param createdBy
|
||||
* @param bodyshop
|
||||
* @param job
|
||||
* @param taskId
|
||||
@@ -96,11 +97,11 @@ const getEndpoints = (bodyshop) =>
|
||||
: "https://romeonline.io"
|
||||
});
|
||||
|
||||
const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId, dateLine) => {
|
||||
const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId, dateLine, createdBy) => {
|
||||
const endPoints = getEndpoints(bodyshop);
|
||||
return {
|
||||
header: title,
|
||||
subHeader: `Body Shop: ${bodyshop.shopname} | Priority: ${formatPriority(priority)} ${formatDate(dueDate)}`,
|
||||
subHeader: `Body Shop: ${bodyshop.shopname} | Priority: ${formatPriority(priority)} ${formatDate(dueDate)} | Created By: ${createdBy || "N/A"}`,
|
||||
body: `Reference: ${job.ro_number || "N/A"} | ${job.ownr_co_nm ? job.ownr_co_nm : `${job.ownr_fn || ""} ${job.ownr_ln || ""}`.trim()} | ${`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${job.v_model_desc || ""}`.trim()}<br>${description ? description.concat("<br>") : ""}<a href="${endPoints}/manage/tasks/alltasks?taskid=${taskId}">View this task.</a>`,
|
||||
dateLine
|
||||
};
|
||||
@@ -181,7 +182,8 @@ const taskAssignedEmail = async (req, res) => {
|
||||
tasks_by_pk.bodyshop,
|
||||
tasks_by_pk.job,
|
||||
newTask.id,
|
||||
dateLine
|
||||
dateLine,
|
||||
newTask.created_by
|
||||
)
|
||||
),
|
||||
null,
|
||||
@@ -268,7 +270,8 @@ const tasksRemindEmail = async (req, res) => {
|
||||
onlyTask.bodyshop,
|
||||
onlyTask.job,
|
||||
onlyTask.id,
|
||||
dateLine
|
||||
dateLine,
|
||||
onlyTask.created_by
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ admin.initializeApp({
|
||||
});
|
||||
|
||||
const createUser = async (req, res) => {
|
||||
logger.log("admin-create-user", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-create-user", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -97,7 +97,7 @@ const sendPromanagerWelcomeEmail = (req, res) => {
|
||||
|
||||
// Validate email before proceeding
|
||||
if (!dbUser.validemail) {
|
||||
logger.log("admin-send-welcome-email-skip", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-send-welcome-email-skip", "debug", req.user.email, null, {
|
||||
message: "User email is not valid, skipping email.",
|
||||
email
|
||||
});
|
||||
@@ -107,7 +107,7 @@ const sendPromanagerWelcomeEmail = (req, res) => {
|
||||
// Check if the user's company is ProManager
|
||||
const convenientCompany = dbUser.associations?.[0]?.bodyshop?.convenient_company;
|
||||
if (convenientCompany !== "promanager") {
|
||||
logger.log("admin-send-welcome-email-skip", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-send-welcome-email-skip", "debug", req.user.email, null, {
|
||||
message: 'convenient_company is not "promanager", skipping email.',
|
||||
convenientCompany
|
||||
});
|
||||
@@ -141,7 +141,7 @@ const sendPromanagerWelcomeEmail = (req, res) => {
|
||||
})
|
||||
.then(() => {
|
||||
// Log success and return response
|
||||
logger.log("admin-send-welcome-email", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-send-welcome-email", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true,
|
||||
emailSentTo: email
|
||||
@@ -161,7 +161,7 @@ const sendPromanagerWelcomeEmail = (req, res) => {
|
||||
};
|
||||
|
||||
const updateUser = (req, res) => {
|
||||
logger.log("admin-update-user", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-update-user", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -184,7 +184,7 @@ const updateUser = (req, res) => {
|
||||
.then((userRecord) => {
|
||||
// See the UserRecord reference doc for the contents of userRecord.
|
||||
|
||||
logger.log("admin-update-user-success", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-update-user-success", "debug", req.user.email, null, {
|
||||
userRecord,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -199,7 +199,7 @@ const updateUser = (req, res) => {
|
||||
};
|
||||
|
||||
const getUser = (req, res) => {
|
||||
logger.log("admin-get-user", "ADMIN", req.user.email, null, {
|
||||
logger.log("admin-get-user", "debug", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true
|
||||
});
|
||||
@@ -321,7 +321,7 @@ module.exports = {
|
||||
// admin.auth().setCustomUserClaims(uid, {
|
||||
// ioadmin: true,
|
||||
// "https://hasura.io/jwt/claims": {
|
||||
// "x-hasura-default-role": "admin",
|
||||
// "x-hasura-default-role": "debug",
|
||||
// "x-hasura-allowed-roles": ["admin"],
|
||||
// "x-hasura-user-id": uid,
|
||||
// },
|
||||
|
||||
@@ -2506,6 +2506,7 @@ exports.QUERY_TASK_BY_ID = `
|
||||
query QUERY_TASK_BY_ID($id: uuid!) {
|
||||
tasks_by_pk(id: $id) {
|
||||
id
|
||||
created_by
|
||||
assigned_to_employee{
|
||||
id
|
||||
user_email
|
||||
|
||||
@@ -78,7 +78,7 @@ exports.lightbox_credentials = async (req, res) => {
|
||||
|
||||
res.send(response.data);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("intellipay-lightbox-credentials-error", "ERROR", req.user?.email, null, {
|
||||
error: JSON.stringify(error)
|
||||
});
|
||||
@@ -109,7 +109,7 @@ exports.payment_refund = async (req, res) => {
|
||||
|
||||
res.send(response.data);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("intellipay-refund-error", "ERROR", req.user?.email, null, {
|
||||
error: JSON.stringify(error)
|
||||
});
|
||||
@@ -143,7 +143,7 @@ exports.generate_payment_url = async (req, res) => {
|
||||
|
||||
res.send(response.data);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("intellipay-payment-url-error", "ERROR", req.user?.email, null, {
|
||||
error: JSON.stringify(error)
|
||||
});
|
||||
|
||||
@@ -28,10 +28,10 @@ exports.default = async (req, res) => {
|
||||
// }
|
||||
// });
|
||||
|
||||
ioRedis.to(getBodyshopRoom(bodyshopid)).emit("bodyshop-message", {
|
||||
operationName,
|
||||
useremail
|
||||
});
|
||||
// ioRedis.to(getBodyshopRoom(bodyshopid)).emit("bodyshop-message", {
|
||||
// operationName,
|
||||
// useremail
|
||||
// });
|
||||
|
||||
res.sendStatus(200);
|
||||
} catch (error) {
|
||||
|
||||
@@ -866,8 +866,8 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
}
|
||||
});
|
||||
|
||||
console.log("*** Taxable Amounts***");
|
||||
console.table(JSON.parse(JSON.stringify(taxableAmounts)));
|
||||
// console.log("*** Taxable Amounts***");
|
||||
// console.table(JSON.parse(JSON.stringify(taxableAmounts)));
|
||||
|
||||
//For the taxable amounts, figure out which tax type applies.
|
||||
//Then sum up the total of that tax type and then calculate the thresholds.
|
||||
@@ -979,8 +979,8 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
}
|
||||
|
||||
const remainingTaxableAmounts = taxableAmountsByTier;
|
||||
console.log("*** Taxable Amounts by Tier***");
|
||||
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
||||
// console.log("*** Taxable Amounts by Tier***");
|
||||
// console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
||||
|
||||
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
|
||||
try {
|
||||
@@ -1030,8 +1030,8 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
}
|
||||
});
|
||||
|
||||
console.log("*** Total Tax by Tier Amounts***");
|
||||
console.table(JSON.parse(JSON.stringify(totalTaxByTier)));
|
||||
// console.log("*** Total Tax by Tier Amounts***");
|
||||
// console.table(JSON.parse(JSON.stringify(totalTaxByTier)));
|
||||
|
||||
stateTax = stateTax
|
||||
.add(totalTaxByTier.ty1Tax)
|
||||
|
||||
@@ -182,7 +182,7 @@ async function AutoAddAtsIfRequired({ job, client }) {
|
||||
job.joblines[atsLineIndex].act_price = atsAmount;
|
||||
}
|
||||
|
||||
console.log(job.jobLines);
|
||||
//console.log(job.jobLines);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
};
|
||||
|
||||
const response = await osClient.index(payload);
|
||||
console.log(response.body);
|
||||
//console.log(response.body);
|
||||
res.status(200).json(response.body);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -255,7 +255,7 @@ async function OpenSearchSearchHandler(req, res) {
|
||||
|
||||
res.json(body);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
//console.log(error);
|
||||
logger.log("os-search-error", "ERROR", req.user.email, null, {
|
||||
error: JSON.stringify(error)
|
||||
});
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
const { createCanvas } = require("canvas");
|
||||
const Chart = require("chart.js/auto");
|
||||
const logger = require("../utils/logger");
|
||||
|
||||
const { backgroundColors, borderColors } = require("./canvas-colors");
|
||||
const { isObject, defaultsDeep, isNumber } = require("lodash");
|
||||
|
||||
exports.canvastest = function (req, res) {
|
||||
console.log("Incoming test request.", req);
|
||||
//console.log("Incoming test request.", req);
|
||||
res.status(200).send("OK");
|
||||
};
|
||||
|
||||
exports.canvas = function (req, res) {
|
||||
const { w, h, values, keys, override } = req.body;
|
||||
console.log("Incoming Canvas Request:", w, h, values, keys, override);
|
||||
|
||||
//console.log("Incoming Canvas Request:", w, h, values, keys, override);
|
||||
logger.log("inbound-canvas-creation", "debug", "jsr", null, { w, h, values, keys, override });
|
||||
// Gate required values
|
||||
if (!values || !keys) {
|
||||
res.status(400).send("Missing required data");
|
||||
|
||||
@@ -47,7 +47,7 @@ exports.receive = async (req, res) => {
|
||||
//Found a bodyshop - should always happen.
|
||||
if (response.bodyshops[0].conversations.length === 0) {
|
||||
//No conversation Found, create one.
|
||||
console.log("[SMS Receive] No conversation found. Creating one.");
|
||||
//console.log("[SMS Receive] No conversation found. Creating one.");
|
||||
newMessage.conversation = {
|
||||
data: {
|
||||
bodyshopid: response.bodyshops[0].id,
|
||||
@@ -56,7 +56,7 @@ exports.receive = async (req, res) => {
|
||||
};
|
||||
} else if (response.bodyshops[0].conversations.length === 1) {
|
||||
//Just add it to the conversation
|
||||
console.log("[SMS Receive] Conversation found. Added ID.");
|
||||
//console.log("[SMS Receive] Conversation found. Added ID.");
|
||||
newMessage.conversationid = response.bodyshops[0].conversations[0].id;
|
||||
} else {
|
||||
//We should never get here.
|
||||
@@ -123,7 +123,14 @@ exports.receive = async (req, res) => {
|
||||
}
|
||||
}
|
||||
} catch (e1) {
|
||||
console.log("e1", e1);
|
||||
logger.log("sms-inbound-error", "ERROR", "api", null, {
|
||||
msid: req.body.SmsMessageSid,
|
||||
text: req.body.Body,
|
||||
image: !!req.body.MediaUrl0,
|
||||
image_path: generateMediaArray(req.body),
|
||||
messagingServiceSid: req.body.MessagingServiceSid,
|
||||
error: e1
|
||||
});
|
||||
res.sendStatus(500).json(e1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,109 @@
|
||||
const graylog2 = require("graylog2");
|
||||
|
||||
const logger = new graylog2.graylog({
|
||||
servers: [{ host: "logs.bodyshop.app", port: 12201 }]
|
||||
// Load environment variables THIS MUST BE AT THE TOP
|
||||
const path = require("path");
|
||||
require("dotenv").config({
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
|
||||
function log(message, type, user, record, object) {
|
||||
if (type !== "ioevent")
|
||||
console.log(message, {
|
||||
type,
|
||||
env: process.env.NODE_ENV || "development",
|
||||
user,
|
||||
record,
|
||||
...object
|
||||
});
|
||||
logger.log(message, message, {
|
||||
type,
|
||||
env: process.env.NODE_ENV || "development",
|
||||
user,
|
||||
record,
|
||||
...object
|
||||
});
|
||||
}
|
||||
const InstanceManager = require("../utils/instanceMgr").default;
|
||||
const winston = require("winston");
|
||||
const WinstonCloudWatch = require("winston-cloudwatch");
|
||||
const { isString, isEmpty } = require("lodash");
|
||||
|
||||
module.exports = { log };
|
||||
const createLogger = () => {
|
||||
try {
|
||||
const isLocal = isString(process.env?.LOCALSTACK_HOSTNAME) && !isEmpty(process.env?.LOCALSTACK_HOSTNAME);
|
||||
const logGroupName = isLocal ? "development" : process.env.CLOUDWATCH_LOG_GROUP;
|
||||
|
||||
const winstonCloudwatchTransportDefaults = {
|
||||
logGroupName: logGroupName,
|
||||
awsOptions: {
|
||||
region: InstanceManager({
|
||||
imex: "ca-central-1",
|
||||
rome: "us-east-2"
|
||||
})
|
||||
},
|
||||
jsonMessage: true
|
||||
};
|
||||
|
||||
if (isLocal) {
|
||||
winstonCloudwatchTransportDefaults.awsOptions.endpoint = `http://${process.env.LOCALSTACK_HOSTNAME}:4566`;
|
||||
console.log(
|
||||
`Winston Transports set to LocalStack end point: ${winstonCloudwatchTransportDefaults.awsOptions.endpoint}`
|
||||
);
|
||||
}
|
||||
|
||||
const levelFilter = (levels) => {
|
||||
return winston.format((info) => {
|
||||
if (Array.isArray(levels)) {
|
||||
return levels.includes(info.level) ? info : false;
|
||||
} else {
|
||||
return info.level === levels ? info : false;
|
||||
}
|
||||
})();
|
||||
};
|
||||
|
||||
const createProductionTransport = (level, logStreamName, filters) => {
|
||||
return new WinstonCloudWatch({
|
||||
level,
|
||||
logStreamName: logStreamName || level,
|
||||
format: levelFilter(filters || level),
|
||||
...winstonCloudwatchTransportDefaults
|
||||
});
|
||||
};
|
||||
|
||||
const getDevelopmentTransports = () => [
|
||||
new winston.transports.Console({
|
||||
level: "silly",
|
||||
format: winston.format.combine(
|
||||
winston.format.colorize(),
|
||||
winston.format.timestamp(),
|
||||
winston.format.printf(({ level, message, timestamp, user, record, object }) => {
|
||||
return `${timestamp} [${level}]: ${message} ${
|
||||
user ? `| user: ${JSON.stringify(user)}` : ""
|
||||
} ${record ? `| record: ${JSON.stringify(record)}` : ""} ${
|
||||
object ? `| object: ${JSON.stringify(object, null, 2)}` : ""
|
||||
}`;
|
||||
})
|
||||
)
|
||||
})
|
||||
];
|
||||
|
||||
const getProductionTransports = () => [
|
||||
createProductionTransport("error"),
|
||||
createProductionTransport("warn"),
|
||||
createProductionTransport("info"),
|
||||
createProductionTransport("silly", "debug", ["http", "verbose", "debug", "silly"])
|
||||
];
|
||||
|
||||
const winstonLogger = winston.createLogger({
|
||||
format: winston.format.json(),
|
||||
transports:
|
||||
process.env.NODE_ENV === "production"
|
||||
? getProductionTransports()
|
||||
: [...getDevelopmentTransports(), ...getProductionTransports()]
|
||||
});
|
||||
|
||||
const log = (message, type, user, record, meta) => {
|
||||
winstonLogger.log({
|
||||
level: type.toLowerCase(),
|
||||
message,
|
||||
user,
|
||||
record,
|
||||
meta
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
log,
|
||||
logger: winstonLogger
|
||||
};
|
||||
} catch (e) {
|
||||
console.error("Error setting up enhanced Logger, defaulting to console.: " + e?.message || "");
|
||||
return {
|
||||
log: console.log,
|
||||
logger: console.log
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = createLogger();
|
||||
|
||||
@@ -8,7 +8,7 @@ const redisSocketEvents = ({
|
||||
}) => {
|
||||
// Logging helper functions
|
||||
const createLogEvent = (socket, level, message) => {
|
||||
console.log(`[IOREDIS LOG EVENT] - ${socket?.user?.email} - ${socket.id} - ${message}`);
|
||||
//console.log(`[IOREDIS LOG EVENT] - ${socket?.user?.email} - ${socket.id} - ${message}`);
|
||||
logger.log("ioredis-log-event", level, socket?.user?.email, null, { wsmessage: message });
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ const redisSocketEvents = ({
|
||||
next(new Error("Authentication error - no authorization token."));
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Uncaught connection error:::", error);
|
||||
//console.log("Uncaught connection error:::", error);
|
||||
logger.log("websocket-connection-error", "error", null, null, {
|
||||
...error
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ io.use(function (socket, next) {
|
||||
next(new Error("Authentication error - no authorization token."));
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Uncaught connection error:::", error);
|
||||
//console.log("Uncaught connection error:::", error);
|
||||
logger.log("websocket-connection-error", "error", null, null, {
|
||||
token: socket.handshake.auth.token,
|
||||
...error
|
||||
@@ -122,7 +122,7 @@ io.on("connection", (socket) => {
|
||||
|
||||
function createLogEvent(socket, level, message) {
|
||||
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy(level)) {
|
||||
console.log(`[WS LOG EVENT] ${level} - ${new Date()} - ${socket.user.email} - ${socket.id} - ${message}`);
|
||||
// console.log(`[WS LOG EVENT] ${level} - ${new Date()} - ${socket.user.email} - ${socket.id} - ${message}`);
|
||||
socket.emit("log-event", {
|
||||
timestamp: new Date(),
|
||||
level,
|
||||
@@ -148,7 +148,7 @@ function createLogEvent(socket, level, message) {
|
||||
|
||||
function createJsonEvent(socket, level, message, json) {
|
||||
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy(level)) {
|
||||
console.log(`[WS LOG EVENT] ${level} - ${new Date()} - ${socket.user.email} - ${socket.id} - ${message}`);
|
||||
//console.log(`[WS LOG EVENT] ${level} - ${new Date()} - ${socket.user.email} - ${socket.id} - ${message}`);
|
||||
socket.emit("log-event", {
|
||||
timestamp: new Date(),
|
||||
level,
|
||||
|
||||
Reference in New Issue
Block a user