Compare commits

...

39 Commits

Author SHA1 Message Date
Dave Richer
1ece04ed3e Merged release/2024-12-13 into feature/IO-2968-Parts-Scanning-Extension 2024-12-10 19:55:34 +00:00
Dave Richer
b8a298fc28 feature/IO-2968-Parts-Scanning-Extension 2024-12-10 11:15:24 -08:00
Allan Carr
e1b00f5081 Merged in hotfix/2024-12-09 (pull request #2008)
IO-3050 Adjust Customer setup
2024-12-09 21:15:35 +00:00
Allan Carr
cfbf59cd48 Merged in feature/IO-3050-QBO-BillEmail (pull request #2006)
IO-3050 Adjust Customer setup
2024-12-09 19:56:44 +00:00
Allan Carr
6a09209659 IO-3050 Adjust Customer setup
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-12-09 11:00:49 -08:00
Dave Richer
cec5f6e6e7 Merged in release/2024-12-06 (pull request #2005)
Release/2024 12 06 into master-AIO IO-3047 IO-3046 IO-3051 IO-3050 IO-3042 IO-3052
2024-12-07 04:46:43 +00:00
Dave Richer
82acaa35e1 Merged master-AIO into release/2024-12-06 2024-12-07 04:42:07 +00:00
Dave Richer
09b8a05b5a Merged in feature/IO-3051-canvas-handler-optimization (pull request #2002)
IO-3051 Replace inlince css with juice.
2024-12-05 23:31:44 +00:00
Patrick Fic
83a1952880 IO-3051 Replace inlince css with juice. 2024-12-05 15:30:37 -08:00
Dave Richer
e5d55f27b5 Merged in feature/IO-3052-Skia-Canvas-Handler (pull request #2000)
Feature/IO-3052 Skia Canvas Handler
2024-12-05 21:06:33 +00:00
Dave Richer
bfde72eed8 feature/IO-3052-Skia-Canvas-Handler: Fix missing checks
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 12:29:11 -08:00
Dave Richer
8fbd08d57f Merge branch 'feature/IO-3052-Skia-Canvas-Handler' of bitbucket.org:snaptsoft/bodyshop into feature/IO-3052-Skia-Canvas-Handler 2024-12-05 12:16:47 -08:00
Dave Richer
20bddb43b6 feature/IO-3052-Skia-Canvas-Handler: Fix missing checks
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 12:16:32 -08:00
Dave Richer
b38e0f611b Merged release/2024-12-06 into feature/IO-3052-Skia-Canvas-Handler 2024-12-05 20:14:53 +00:00
Dave Richer
c84fbcaba1 feature/IO-3052-Skia-Canvas-Handler: Optimizations
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 12:14:06 -08:00
Dave Richer
8f752d575a feature/IO-3052-Skia-Canvas-Handler: Optimizations
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 12:13:49 -08:00
Patrick Fic
2fe9ae513d Merged in feature/IO-3053-datadog (pull request #1999)
IO-3053 Add datadog watcher for Production and Test instances.
2024-12-05 20:10:24 +00:00
Patrick Fic
0001604552 Merged in feature/IO-3053-datadog (pull request #1998)
IO-3053 Add datadog watcher for Production and Test instances.
2024-12-05 20:09:26 +00:00
Patrick Fic
5cb93b1a2c IO-3053 Add datadog watcher for Production and Test instances. 2024-12-05 12:07:16 -08:00
Dave Richer
a04dcffc4c feature/IO-3052-Skia-Canvas-Handler: Merge release and fix PR's
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 12:01:58 -08:00
Dave Richer
50c99f7a1e feature/IO-3052-Skia-Canvas-Handler: Cleanup
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 11:52:14 -08:00
Dave Richer
86f3179bc0 feature/IO-3052-Skia-Canvas-Handler: Initial commit
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 11:26:36 -08:00
Dave Richer
6336e7568f feature/IO-3052-Skia-Canvas-Handler: Initial commit
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-12-05 11:26:23 -08:00
Allan Carr
f0f199335c Merged in feature/IO-3050-QBO-BillEmail (pull request #1995)
IO-3050 QBO BillEmail required if NeedToSend

Approved-by: Dave Richer
2024-12-05 17:23:18 +00:00
Allan Carr
9c7c9f4b6d Merged in feature/IO-3042-Jobs-Marked-Total-Loss (pull request #1996)
IO-3042 Jobs Marked as Total Loss

Approved-by: Dave Richer
2024-12-05 17:23:01 +00:00
Allan Carr
9001ceaed8 Merged in feature/IO-3051-canvas-handler-optimization (pull request #1994)
IO-3051 canvas-handler optimization

Approved-by: Dave Richer
2024-12-05 17:22:42 +00:00
Allan Carr
ab82e85c57 Merge branch 'release/2024-12-06' into feature/IO-3042-Jobs-Marked-Total-Loss
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>

# Conflicts:
#	client/src/utils/TemplateConstants.js
2024-12-04 18:33:35 -08:00
Allan Carr
2effe5ef50 IO-3042 Jobs Marked as Total Loss
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-12-04 18:30:22 -08:00
Allan Carr
006a2a5dca IO-3050 QBO BillEmail required if NeedToSend
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-12-04 15:59:05 -08:00
Allan Carr
a885bdec74 IO-3051 canvas-handler optimization
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-12-04 14:22:04 -08:00
Dave Richer
8d2bdb171b Merged in feature/IO-3048-Fix-Job-Bug-Messaging (pull request #1986)
feature/IO-3048-Fix-Job-Bug-Messaging - Job Tag weirdness, Messaging Name  Display, Unread Messages
2024-12-03 23:51:54 +00:00
Dave Richer
5d7eabbfa9 Merged in feature/IO-3048-Fix-Job-Bug-Messaging (pull request #1992)
feature/IO-3048-Fix-Job-Bug-Messaging - Unread count
2024-12-03 22:01:37 +00:00
Dave Richer
3a6af12446 Merged in feature/IO-3048-Fix-Job-Bug-Messaging (pull request #1990)
feature/IO-3048-Fix-Job-Bug-Messaging - Do not allow more than 1 of the same job to be associated with a conversation
2024-12-03 20:24:09 +00:00
Dave Richer
ca462f51ec Merged in feature/IO-3048-Fix-Job-Bug-Messaging (pull request #1987)
feature/IO-3048-Fix-Job-Bug-Messaging - Do not allow more than 1 of the same job to be associated with a conversation
2024-12-03 18:40:29 +00:00
Dave Richer
8ed81e9aed Merged in feature/IO-3048-Fix-Job-Bug-Messaging (pull request #1984)
feature/IO-3048-Fix-Job-Bug-Messaging - Fix tag weirdness and a vite error

Approved-by: Patrick Fic
2024-12-03 17:55:30 +00:00
Allan Carr
aad22f2e2d Merged in feature/IO-3047-accountingid-on-Owner-Page (pull request #1982)
IO-3047 Accounting ID on Owner Page

Approved-by: Dave Richer
2024-12-02 20:30:50 +00:00
Allan Carr
7a11b18037 Merged in feature/IO-3046-purchase_return_ratio_excel (pull request #1983)
IO-3046 purchase_return_ratio_excel

Approved-by: Dave Richer
2024-12-02 20:30:16 +00:00
Allan Carr
241322fa30 IO-3046 purchase_return_ratio_excel
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-12-02 11:09:30 -08:00
Allan Carr
f0461270de IO-3047 Accounting ID on Owner Page
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-12-02 08:52:18 -08:00
21 changed files with 1371 additions and 214 deletions

View File

@@ -0,0 +1,5 @@
#!/bin/bash
DD_API_KEY=58d91898a70c6fd659f6eea768a57976 DD_SITE="us3.datadoghq.com" bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
echo "Datadog agent installed."

View File

@@ -7,7 +7,6 @@ RUN dnf install -y git \
&& dnf install -y nodejs \
&& dnf clean all
# Install dependencies required by node-canvas
RUN dnf install -y \
gcc \
@@ -19,9 +18,22 @@ RUN dnf install -y \
libpng-devel \
make \
python3 \
fontconfig \
freetype \
python3-pip \
wget \
unzip \
&& dnf clean all
# Install Montserrat fonts
RUN cd /tmp \
&& wget https://images.imex.online/fonts/montserrat.zip -O montserrat.zip \
&& unzip montserrat.zip -d montserrat \
&& mv montserrat/montserrat/*.ttf /usr/share/fonts \
&& fc-cache -fv \
&& rm -rf /tmp/montserrat /tmp/montserrat.zip \
&& echo "Montserrat fonts installed and cached successfully."
# Set the working directory
WORKDIR /app

View File

@@ -25,6 +25,9 @@ export default function OwnerDetailFormComponent({ form, loading }) {
<Form.Item label={t("owners.fields.ownr_co_nm")} name="ownr_co_nm">
<Input />
</Form.Item>
<Form.Item label={t("owners.fields.accountingid")} name="accountingid">
<Input disabled/>
</Form.Item>
</LayoutFormRow>
<LayoutFormRow header={t("owners.forms.address")}>
<Form.Item label={t("owners.fields.ownr_addr1")} name="ownr_addr1">

View File

@@ -1,11 +1,4 @@
import isBetween from "dayjs/plugin/isBetween";
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import localeData from "dayjs/plugin/localeData";
import localizedFormat from "dayjs/plugin/localizedFormat";
import minMax from "dayjs/plugin/minMax";
import utc from "dayjs/plugin/utc";
import { DateLocalizer } from "react-big-calendar";
import {DateLocalizer} from "react-big-calendar";
function arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
@@ -29,7 +22,9 @@ function iterableToArrayLimit(arr, i) {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
if (_d) { // noinspection ThrowInsideFinallyBlockJS
throw _e;
}
}
}
return _arr;

View File

@@ -1,75 +1,188 @@
import { DeleteFilled } from "@ant-design/icons";
import { Button, Form, Input, Space } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import {DeleteFilled} from "@ant-design/icons";
import {Button, Col, Form, Input, Row, Select, Space, Switch} from "antd";
import React, {useMemo} from "react";
import {useTranslation} from "react-i18next";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
export default function ShopInfoPartsScan({ form }) {
const { t } = useTranslation();
const predefinedPartTypes = [
"PAN", "PAC", "PAR", "PAL", "PAA", "PAM", "PAP", "PAS", "PASL", "PAG"
];
const predefinedModLbrTypes = [
"LAA", "LAB", "LAD", "LAE", "LAF", "LAG", "LAM", "LAR", "LAS", "LAU",
"LA1", "LA2", "LA3", "LA4"
];
const getFieldType = (field) => {
if (["line_desc", "part_number"].includes(field)) return "string";
if (["act_price", "part_qty", "mod_lb_hrs"].includes(field)) return "number";
if (["part_type", "mod_lbr_ty"].includes(field)) return "predefined";
return null;
};
export default function ShopInfoPartsScan({form}) {
const {t} = useTranslation();
const watchedFields = Form.useWatch("md_parts_scan", form);
const operationOptions = useMemo(() => ({
string: [
{label: t("bodyshop.operations.contains"), value: "contains"},
{label: t("bodyshop.operations.equals"), value: "equals"},
{label: t("bodyshop.operations.starts_with"), value: "startsWith"},
{label: t("bodyshop.operations.ends_with"), value: "endsWith"},
],
number: [
{label: t("bodyshop.operations.equals"), value: "="},
{label: t("bodyshop.operations.greater_than"), value: ">"},
{label: t("bodyshop.operations.less_than"), value: "<"},
],
}), [t]);
return (
<div>
<LayoutFormRow header={t("bodyshop.labels.md_parts_scan")}>
<Form.List name={["md_parts_scan"]}>
{(fields, { add, remove, move }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key}>
<LayoutFormRow noDivider>
<Form.Item
label={t("bodyshop.fields.md_parts_scan.expression")}
key={`${index}expression`}
name={[field.name, "expression"]}
rules={[
{
required: true
//message: t("general.validation.required"),
}
]}
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.md_parts_scan.flags")}
key={`${index}flags`}
name={[field.name, "flags"]}
rules={[
{
required: true
//message: t("general.validation.required"),
}
]}
>
<Input />
</Form.Item>
{(fields, {add, remove, move}) => (
<div>
{fields.map((field, index) => {
const selectedField = watchedFields?.[index]?.field || "line_desc";
const fieldType = getFieldType(selectedField);
<Space wrap>
<DeleteFilled
onClick={() => {
remove(field.name);
}}
/>
<FormListMoveArrows move={move} index={index} total={fields.length} />
</Space>
</LayoutFormRow>
return (
<Form.Item key={field.key}>
<Row gutter={[16, 16]} align="middle">
{/* Select Field */}
<Col span={6}>
<Form.Item
label={t("bodyshop.fields.md_parts_scan.field")}
name={[field.name, "field"]}
rules={[
{
required: true,
message: t("general.validation.required", {
label: t("bodyshop.fields.md_parts_scan.field"),
}),
},
]}
>
<Select
options={[
{label: t("joblines.fields.line_desc"), value: "line_desc"},
{label: t("joblines.fields.part_type"), value: "part_type"},
{label: t("joblines.fields.act_price"), value: "act_price"},
{label: t("joblines.fields.part_qty"), value: "part_qty"},
{label: t("joblines.fields.mod_lbr_ty"), value: "mod_lbr_ty"},
{label: t("joblines.fields.mod_lb_hrs"), value: "mod_lb_hrs"},
{
label: `${t("joblines.fields.oem_partno")} / ${t("joblines.fields.alt_partno")}`,
value: "part_number"
},
]}
onChange={() => {
form.setFields([
{name: ["md_parts_scan", index, "operation"], value: "contains"},
{name: ["md_parts_scan", index, "value"], value: undefined},
]);
}}
/>
</Form.Item>
</Col>
{/* Operation */}
{fieldType !== "predefined" && fieldType && (
<Col span={6}>
<Form.Item
label={t("bodyshop.fields.md_parts_scan.operation")}
name={[field.name, "operation"]}
rules={[
{
required: true,
message: t("general.validation.required", {
label: t("bodyshop.fields.md_parts_scan.operation"),
}),
},
]}
>
<Select options={operationOptions[fieldType]}/>
</Form.Item>
</Col>
)}
{/* Value */}
{fieldType && (
<Col span={6}>
<Form.Item
label={t("bodyshop.fields.md_parts_scan.value")}
name={[field.name, "value"]}
rules={[
{
required: true,
message: t("general.validation.required", {
label: t("bodyshop.fields.md_parts_scan.value"),
}),
},
]}
>
{fieldType === "predefined" ? (
<Select
options={
selectedField === "part_type"
? predefinedPartTypes.map((type) => ({
label: type,
value: type
}))
: predefinedModLbrTypes.map((type) => ({
label: type,
value: type
}))
}
/>
) : (
<Input/>
)}
</Form.Item>
</Col>
)}
{/* Case Sensitivity */}
{fieldType === "string" && (
<Col span={4}>
<Form.Item
label={t("bodyshop.fields.md_parts_scan.caseInsensitive")}
name={[field.name, "caseInsensitive"]}
valuePropName="checked"
labelCol={{span: 14}}
wrapperCol={{span: 10}}
>
<Switch defaultChecked={true}/>
</Form.Item>
</Col>
)}
{/* Actions */}
<Col span={2}>
<Space>
<DeleteFilled onClick={() => remove(field.name)}/>
<FormListMoveArrows move={move} index={index} total={fields.length}/>
</Space>
</Col>
</Row>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("bodyshop.actions.addpartsrule")}
</Button>
</Form.Item>
</div>
);
}}
);
})}
<Form.Item>
<Button
type="dashed"
onClick={() => add({field: "line_desc", operation: "contains"})}
style={{width: "100%"}}
>
{t("bodyshop.actions.addpartsrule")}
</Button>
</Form.Item>
</div>
)}
</Form.List>
</LayoutFormRow>
</div>

View File

@@ -1,31 +1,32 @@
import { Alert, Form, InputNumber, Switch } from "antd";
import {Alert, Form, Switch} from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import {useTranslation} from "react-i18next";
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";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop
});
const mapDispatchToProps = (dispatch) => ({
const mapDispatchToProps = () => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoIntellipay);
export function ShopInfoIntellipay({ bodyshop, form }) {
const { t } = useTranslation();
// noinspection JSUnusedLocalSymbols
export function ShopInfoIntellipay({bodyshop, form}) {
const {t} = useTranslation();
return (
<>
<Form.Item dependencies={[["intellipay_config", "enable_cash_discount"]]}>
{() => {
const { intellipay_config } = form.getFieldsValue();
const {intellipay_config} = form.getFieldsValue();
if (intellipay_config?.enable_cash_discount)
return <Alert message={t("bodyshop.labels.intellipay_cash_discount")} />;
return <Alert message={t("bodyshop.labels.intellipay_cash_discount")}/>;
}}
</Form.Item>
@@ -35,7 +36,7 @@ export function ShopInfoIntellipay({ bodyshop, form }) {
valuePropName="checked"
name={["intellipay_config", "enable_cash_discount"]}
>
<Switch />
<Switch/>
</Form.Item>
</LayoutFormRow>
</>

View File

@@ -48,6 +48,7 @@ export const QUERY_OWNER_BY_ID = gql`
query QUERY_OWNER_BY_ID($id: uuid!) {
owners_by_pk(id: $id) {
id
accountingid
allow_text_message
ownr_addr1
ownr_addr2

View File

@@ -256,6 +256,15 @@
}
},
"bodyshop": {
"operations": {
"starts_with": "Starts With",
"contains": "Contains",
"ends_with": "Ends With",
"equals": "Equals",
"not_equals": "Not Equals",
"greater_than": "Greater Than",
"less_than": "Less Than"
},
"actions": {
"add_task_preset": "Add Task Preset",
"addapptcolor": "Add Appointment Color",
@@ -379,8 +388,10 @@
"md_lost_sale_reasons": "Lost Sale Reasons",
"md_parts_order_comment": "Parts Orders Comments",
"md_parts_scan": {
"expression": "RegEX Expression",
"flags": "Flags"
"field": "Field",
"operation": "Operation",
"value": "Value",
"caseInsensitive": "Case Insensitive"
},
"md_payment_types": "Payment Types",
"md_referral_sources": "Referral Sources",
@@ -1451,6 +1462,7 @@
"mod_lbr_ty": "Labor Type",
"notes": "Notes",
"oem_partno": "OEM Part #",
"alt_partno": "Alt Part #",
"op_code_desc": "Op Code Description",
"part_qty": "Qty.",
"part_type": "Part Type",
@@ -2394,6 +2406,7 @@
"selectexistingornew": "Select an existing owner record or create a new one. "
},
"fields": {
"accountingid": "Accounting ID",
"address": "Address",
"allow_text_message": "Permission to Text?",
"name": "Name",
@@ -3057,6 +3070,7 @@
"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_excel": "Purchase & Return Ratio - Excel",
"purchase_return_ratio_grouped_by_vendor_detail": "Purchase & Return Ratio by Vendor (Detail)",
"purchase_return_ratio_grouped_by_vendor_summary": "Purchase & Return Ratio by Vendor (Summary)",
"purchases_by_cost_center_detail": "Purchases by Cost Center (Detail)",
@@ -3082,6 +3096,7 @@
"timetickets": "Time Tickets",
"timetickets_employee": "Employee Time Tickets",
"timetickets_summary": "Time Tickets Summary",
"total_loss_jobs": "Jobs Marked as Total Loss",
"unclaimed_hrs": "Unflagged Hours",
"void_ros": "Void ROs",
"work_in_progress_committed_labour": "Work in Progress - Committed Labor",

View File

@@ -256,6 +256,15 @@
}
},
"bodyshop": {
"operations": {
"starts_with": "",
"contains": "",
"ends_with": "",
"equals": "",
"not_equals": "",
"greater_than": "",
"less_than": ""
},
"actions": {
"add_task_preset": "",
"addapptcolor": "",
@@ -379,8 +388,10 @@
"md_lost_sale_reasons": "",
"md_parts_order_comment": "",
"md_parts_scan": {
"expression": "",
"flags": ""
"field": "",
"operation": "",
"value": "",
"caseInsensitive": ""
},
"md_payment_types": "",
"md_referral_sources": "",
@@ -1451,6 +1462,7 @@
"mod_lbr_ty": "Tipo de trabajo",
"notes": "",
"oem_partno": "OEM parte #",
"alt_partno": "",
"op_code_desc": "",
"part_qty": "",
"part_type": "Tipo de parte",
@@ -2394,6 +2406,7 @@
"selectexistingornew": ""
},
"fields": {
"accountingid": "",
"address": "Dirección",
"allow_text_message": "Permiso de texto?",
"name": "Nombre",
@@ -3057,6 +3070,7 @@
"production_not_production_status": "",
"production_over_time": "",
"psr_by_make": "",
"purchase_return_ratio_excel": "",
"purchase_return_ratio_grouped_by_vendor_detail": "",
"purchase_return_ratio_grouped_by_vendor_summary": "",
"purchases_by_cost_center_detail": "",
@@ -3082,6 +3096,7 @@
"timetickets": "",
"timetickets_employee": "",
"timetickets_summary": "",
"total_loss_jobs": "",
"unclaimed_hrs": "",
"void_ros": "",
"work_in_progress_committed_labour": "",

View File

@@ -256,6 +256,15 @@
}
},
"bodyshop": {
"operations": {
"starts_with": "",
"contains": "",
"ends_with": "",
"equals": "",
"not_equals": "",
"greater_than": "",
"less_than": ""
},
"actions": {
"add_task_preset": "",
"addapptcolor": "",
@@ -379,8 +388,10 @@
"md_lost_sale_reasons": "",
"md_parts_order_comment": "",
"md_parts_scan": {
"expression": "",
"flags": ""
"field": "",
"operation": "",
"value": "",
"caseInsensitive": ""
},
"md_payment_types": "",
"md_referral_sources": "",
@@ -1451,6 +1462,7 @@
"mod_lbr_ty": "Type de travail",
"notes": "",
"oem_partno": "Pièce OEM #",
"alt_partno": "",
"op_code_desc": "",
"part_qty": "",
"part_type": "Type de pièce",
@@ -2394,6 +2406,7 @@
"selectexistingornew": ""
},
"fields": {
"accountingid": "",
"address": "Adresse",
"allow_text_message": "Autorisation de texte?",
"name": "Prénom",
@@ -3057,6 +3070,7 @@
"production_not_production_status": "",
"production_over_time": "",
"psr_by_make": "",
"purchase_return_ratio_excel": "",
"purchase_return_ratio_grouped_by_vendor_detail": "",
"purchase_return_ratio_grouped_by_vendor_summary": "",
"purchases_by_cost_center_detail": "",
@@ -3082,6 +3096,7 @@
"timetickets": "",
"timetickets_employee": "",
"timetickets_summary": "",
"total_loss_jobs": "",
"unclaimed_hrs": "",
"void_ros": "",
"work_in_progress_committed_labour": "",

View File

@@ -2184,6 +2184,30 @@ export const TemplateList = (type, context) => {
},
group: "payroll",
adp_payroll: true
},
purchase_return_ratio_excel: {
title: i18n.t("reportcenter.templates.purchase_return_ratio_excel"),
subject: i18n.t("reportcenter.templates.purchase_return_ratio_excel"),
key: "purchase_return_ratio_excel",
//idtype: "vendor",
reporttype: "excel",
disabled: false,
rangeFilter: {
object: i18n.t("reportcenter.labels.objects.bills"),
field: i18n.t("bills.fields.date")
},
group: "purchases"
},
total_loss_jobs: {
title: i18n.t("reportcenter.templates.total_loss_jobs"),
subject: i18n.t("reportcenter.templates.total_loss_jobs"),
key: "total_loss_jobs",
disabled: false,
rangeFilter: {
object: i18n.t("reportcenter.labels.objects.jobs"),
field: i18n.t("jobs.fields.date_open")
},
group: "jobs"
}
}
: {}),

847
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,7 @@
"cors": "2.8.5",
"crisp-status-reporter": "^1.2.2",
"csrf": "^3.1.0",
"dd-trace": "^5.28.0",
"dinero.js": "^1.9.1",
"dotenv": "^16.4.5",
"express": "^4.21.1",
@@ -51,6 +52,7 @@
"intuit-oauth": "^4.1.3",
"ioredis": "^5.4.1",
"json-2-csv": "^5.5.6",
"juice": "^11.0.0",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"moment-timezone": "^0.5.46",
@@ -62,6 +64,7 @@
"recursive-diff": "^1.0.9",
"redis": "^4.7.0",
"rimraf": "^6.0.1",
"skia-canvas": "^2.0.0",
"soap": "^1.1.6",
"socket.io": "^4.8.1",
"socket.io-adapter": "^2.5.5",

View File

@@ -4,6 +4,14 @@ require("dotenv").config({
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
});
if (process.env.NODE_ENV) {
const tracer = require("dd-trace").init({
profiling: true,
env: process.env.NODE_ENV,
service: "bodyshop-api"
});
}
const cors = require("cors");
const http = require("http");
const Redis = require("ioredis");

View File

@@ -328,6 +328,7 @@ async function InsertOwner(oauthClient, qbo_realmId, req, job, isThreeTier, pare
PostalCode: job.ownr_zip,
CountrySubDivisionCode: job.ownr_st
},
...(job.ownr_ea ? { PrimaryEmailAddr: { Address: job.ownr_ea.trim() } } : {}),
...(isThreeTier
? {
Job: true,
@@ -395,7 +396,7 @@ async function InsertJob(oauthClient, qbo_realmId, req, job, parentTierRef) {
PostalCode: job.ownr_zip,
CountrySubDivisionCode: job.ownr_st
},
...(job.ownr_ea ? { PrimaryEmailAddr: { Address: job.ownr_ea.trim() } } : {}),
Job: true,
ParentRef: {
value: parentTierRef.Id
@@ -556,7 +557,8 @@ async function InsertInvoice(oauthClient, qbo_realmId, req, job, bodyshop, paren
Line3: `${job.ownr_city || ""}, ${job.ownr_st || ""} ${job.ownr_zip || ""}`.trim(),
Line2: job.ownr_addr1 || "",
Line1: `${job.ownr_fn || ""} ${job.ownr_ln || ""} ${job.ownr_co_nm || ""}`
}
},
...(job.ownr_ea ? { BillEmail: { Address: job.ownr_ea.trim() } } : {})
};
logger.log("qbo-receivable-objectlog", "DEBUG", req.user.email, job.id, {
@@ -673,7 +675,8 @@ async function InsertInvoiceMultiPayerInvoice(
Line3: `${job.ownr_city || ""}, ${job.ownr_st || ""} ${job.ownr_zip || ""}`.trim(),
Line2: job.ownr_addr1 || "",
Line1: `${job.ownr_fn || ""} ${job.ownr_ln || ""} ${job.ownr_co_nm || ""}`
}
},
...(job.ownr_ea ? { BillEmail: { Address: job.ownr_ea.trim() } } : {})
};
logger.log("qbo-receivable-objectlog", "DEBUG", req.user.email, job.id, {

View File

@@ -2234,18 +2234,25 @@ exports.QUERY_PARTS_SCAN = `query QUERY_PARTS_SCAN ($id: uuid!) {
id
line_desc
critical
part_type
act_price
part_qty
mod_lbr_ty
mod_lb_hrs
oem_partno
alt_partno
}
}
}`;
exports.UPDATE_PARTS_CRITICAL = `mutation UPDATE_PARTS_CRITICAL ($IdsToMarkCritical:[uuid!]!, $jobid: uuid!){
critical: update_joblines(where:{id:{_in:$IdsToMarkCritical}}, _set:{critical: true}){
exports.UPDATE_PARTS_CRITICAL = `mutation UPDATE_PARTS_CRITICAL ($IdsToMarkCritical:[uuid!]!, $jobid: uuid!) {
critical: update_joblines(where: {id: {_in: $IdsToMarkCritical}}, _set: {critical: true}) {
affected_rows
}
notcritical: update_joblines(where:{id:{_nin:$IdsToMarkCritical}, jobid: {_eq: $jobid}}, _set:{critical: false}){
notcritical: update_joblines(where: {id: {_nin: $IdsToMarkCritical}, jobid: {_eq: $jobid}}, _set: {critical: false}) {
affected_rows
}
}`;
}`
exports.ACTIVE_SHOP_BY_USER = `query ACTIVE_SHOP_BY_USER($user: String) {
associations(where: {active: {_eq: true}, useremail: {_eq: $user}}) {

View File

@@ -0,0 +1,32 @@
const { isObject } = require("lodash");
const validateCanvasInputMiddleware = (req, res, next) => {
const { values, keys, override, w, h } = req.body;
if (!Array.isArray(values) || !Array.isArray(keys)) {
return res.status(400).send("Invalid input: 'values' and 'keys' must be arrays.");
}
if (values.some((value) => typeof value !== "number")) {
return res.status(400).send("Invalid input: 'values' must be an array of numbers.");
}
if (keys.some((key) => typeof key !== "string")) {
return res.status(400).send("Invalid input: 'keys' must be an array of strings.");
}
if (override && !isObject(override)) {
return res.status(400).send("Override must be an object");
}
if (w && (!Number.isFinite(w) || w <= 0)) {
return res.status(400).send("Width must be a positive number");
}
if (h && (!Number.isFinite(h) || h <= 0)) {
return res.status(400).send("Height must be a positive number");
}
next(); // Proceed to the next middleware or route handler
};
module.exports = validateCanvasInputMiddleware;

View File

@@ -1,50 +1,90 @@
const Dinero = require("dinero.js");
const queries = require("../graphql-client/queries");
const logger = require("../utils/logger");
const { job } = require("../scheduling/scheduling-job");
const _ = require("lodash");
// Dinero.defaultCurrency = "USD";
// Dinero.globalLocale = "en-CA";
const predefinedPartTypes = [
"PAN", "PAC", "PAR", "PAL", "PAA", "PAM", "PAP", "PAS", "PASL", "PAG",
];
const predefinedModLbrTypes = [
"LAA", "LAB", "LAD", "LAE", "LAF", "LAG", "LAM", "LAR", "LAS", "LAU",
"LA1", "LA2", "LA3", "LA4",
];
exports.partsScan = async function (req, res) {
console.log('hello')
const { jobid } = req.body;
const BearerToken = req.BearerToken;
const client = req.userGraphQLClient;
logger.log("job-parts-scan", "DEBUG", req.user?.email, jobid, null);
try {
//Query all jobline data using the user's authorization.
const data = await client.setHeaders({ Authorization: BearerToken }).request(queries.QUERY_PARTS_SCAN, {
id: jobid
});
const data = await client.setHeaders({ Authorization: BearerToken }).request(
queries.QUERY_PARTS_SCAN,
{ id: jobid }
);
//Create RegExps once for better performance.
const IdsToMarkCritical = [];
const RegExpressions = data.jobs_by_pk.bodyshop.md_parts_scan.map((r) => new RegExp(r.expression, r.flags));
const rules = data.jobs_by_pk.bodyshop.md_parts_scan || [];
if (!Array.isArray(rules)) {
// noinspection ExceptionCaughtLocallyJS
throw new Error("Invalid md_parts_scan format. Expected an array of rules.");
}
//Check each line against each regex rule.
data.jobs_by_pk.joblines.forEach((jobline) => {
RegExpressions.forEach((rExp) => {
if (jobline.line_desc.match(rExp)) {
IdsToMarkCritical.push(jobline);
const compiledRules = rules.map((rule) => ({
...rule,
regex:
typeof rule.value === "string" && rule.caseInsensitive
? new RegExp(rule.value, "i")
: typeof rule.value === "string"
? new RegExp(rule.value)
: null,
}));
const criticalIds = new Set();
for (const jobline of data.jobs_by_pk.joblines) {
for (const { field, regex, operation, value } of compiledRules) {
if (criticalIds.has(jobline.id)) break; // Skip further evaluation if already critical
let jobValue = jobline[field];
let match = false;
if (field === "part_number") {
match = regex
? regex.test(jobline.oem_partno || '') || regex.test(jobline.alt_partno || '')
: jobline.oem_partno === value || jobline.alt_partno === value;
} else if (field === "part_type") {
match = predefinedPartTypes.includes(value) && value === jobValue;
} else if (field === "mod_lbr_ty") {
match = predefinedModLbrTypes.includes(value) && value === jobValue;
} else if (regex && typeof jobValue === "string") {
if (operation === "contains") match = regex.test(jobValue);
if (operation === "startsWith") match = new RegExp(`^${value}`).test(jobValue);
if (operation === "endsWith") match = new RegExp(`${value}$`).test(jobValue);
if (operation === "equals") match = jobValue === value;
} else if (typeof jobValue === "number") {
if (operation === ">") match = jobValue > value;
if (operation === "<") match = jobValue < value;
if (operation === "=") match = jobValue === value;
}
});
});
const result = await client.setHeaders({ Authorization: BearerToken }).request(queries.UPDATE_PARTS_CRITICAL, {
IdsToMarkCritical: _.uniqBy(IdsToMarkCritical, "id").map((i) => i.id),
jobid: jobid
});
if (match) {
criticalIds.add(jobline.id);
break; // No need to evaluate further rules for this jobline
}
}
}
const result = await client.setHeaders({ Authorization: BearerToken }).request(
queries.UPDATE_PARTS_CRITICAL,
{ IdsToMarkCritical: Array.from(criticalIds), jobid }
);
res.status(200).json(result);
} catch (error) {
logger.log("job-parts-scan-error", "ERROR", req.user.email, jobid, {
logger.log("job-parts-scan-error", "ERROR", req.user?.email, jobid, {
jobid,
error
error: error.message,
});
res.status(400).json(JSON.stringify(error));
res.status(400).json(JSON.stringify({ message: error?.message }));
}
};

View File

@@ -1,43 +1,31 @@
const { createCanvas } = require("canvas");
const { Canvas, FontLibrary } = require("skia-canvas");
const Chart = require("chart.js/auto");
const logger = require("../utils/logger");
const { backgroundColors, borderColors } = require("./canvas-colors");
const { isObject, defaultsDeep, isNumber } = require("lodash");
const { defaultsDeep, isNumber } = require("lodash");
exports.canvastest = function (req, res) {
//console.log("Incoming test request.", req);
res.status(200).send("OK");
};
const CANVAS_QUEUE_LIMIT = 100;
exports.canvas = function (req, res) {
const { w, h, values, keys, override } = req.body;
//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");
return;
}
let isProcessing = false;
const requestQueue = [];
// Override must be an object if it exists
if (override && !isObject(override)) {
res.status(400).send("Override must be an object");
return;
}
try {
FontLibrary.use("Montserrat", [
"/usr/share/fonts/Montserrat-Regular.ttf",
"/usr/share/fonts/Montserrat-Bold.ttf",
"/usr/share/fonts/Montserrat-Italic.ttf"
]);
} catch (error) {
console.error(
"Error loading fonts Skia Canvas Fonts, please be sure to install Montserrat font package",
error.message
);
}
// Set the default Width and Height
let [width, height] = [500, 275];
// Allow for custom width and height
if (isNumber(w)) {
width = w;
}
if (isNumber(h)) {
height = h;
}
const configuration = {
// Utility to create a chart configuration
const getChartConfiguration = (keys, values, override) => {
const defaultConfiguration = {
type: "doughnut",
data: {
labels: keys,
@@ -53,6 +41,7 @@ exports.canvas = function (req, res) {
options: {
devicePixelRatio: 4,
responsive: false,
animation: false,
maintainAspectRatio: true,
circumference: 180,
rotation: -90,
@@ -73,21 +62,88 @@ exports.canvas = function (req, res) {
}
};
// If we have a valid override object, merge it with the default configuration object.
// This allows for you to override the default configuration with a custom one.
const defaults = () => {
if (!override || !isObject(override)) {
return configuration;
}
return defaultsDeep(override, configuration);
};
res.status(200).send(
(() => {
const canvas = createCanvas(width, height);
const ctx = canvas.getContext("2d");
new Chart(ctx, defaults());
return canvas.toDataURL();
})()
);
return defaultsDeep(override || {}, defaultConfiguration);
};
const processCanvasRequest = async (req, res, isSkia = false) => {
const { logger } = req;
const { w, h, values, keys, override } = req.body;
logger.log("inbound-canvas-creation", "debug", "jsr", null, { w, h, values, keys, override });
// Default width and height
const width = isNumber(w) && w > 0 ? w : 500;
const height = isNumber(h) && h > 0 ? h : 275;
const configuration = getChartConfiguration(keys, values, override);
// Placeholders to allow fine control over GAC
let canvas = null;
let ctx = null;
let chart = null;
let chartImage = null;
try {
// Create the canvas
canvas = isSkia ? new Canvas(width, height) : createCanvas(width, height);
ctx = canvas.getContext("2d");
// Render the chart
chart = new Chart(ctx, configuration);
// Generate and send the image
chartImage = isSkia ? (await canvas.toBuffer("image/png")).toString("base64") : canvas.toDataURL();
res.status(200).send(isSkia ? `data:image/png;base64,${chartImage}` : chartImage);
} catch (error) {
// Log the error and send the response
logger.log("canvas-error", "error", "jsr", null, { error: error.message });
res.status(500).send("Failed to generate canvas.");
} finally {
// Cleanup resources
if (chart) {
chart.destroy();
}
ctx = null; // Explicitly nullify for garbage collection
canvas = null; // Explicitly nullify for garbage collection
chartImage = null;
}
};
const enqueueRequest = (req, res, isSkia) => {
if (requestQueue.length >= CANVAS_QUEUE_LIMIT) {
res.status(503).send("Server is busy. Please try again later.");
return false;
}
requestQueue.push({ req, res, isSkia });
req.logger.log("inbound-canvas-creation-queue", "debug", "jsr", null, { queue: requestQueue.length });
return true;
};
const processNextInQueue = async () => {
while (requestQueue.length > 0) {
const { req, res, isSkia } = requestQueue.shift();
try {
await processCanvasRequest(req, res, isSkia);
} catch (err) {
console.error("canvas-queue-error", "error", "jsr", null, { error: err.message });
}
}
isProcessing = false;
};
exports.canvastest = function (req, res) {
res.status(200).send("OK");
};
exports.canvas = async (req, res) => {
if (isProcessing || !enqueueRequest(req, res, false)) return;
isProcessing = true;
processNextInQueue().catch((err) => console.error("canvas-processing-error", { error: err.message }));
};
exports.canvasSkia = async (req, res) => {
if (isProcessing || !enqueueRequest(req, res, true)) return;
isProcessing = true;
processNextInQueue().catch((err) => console.error("canvas-processing-error", { error: err.message }));
};

View File

@@ -3,24 +3,36 @@ require("dotenv").config({
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
});
const logger = require("../utils/logger");
const inlineCssTool = require("inline-css");
//const inlineCssTool = require("inline-css");
const juice = require("juice");
exports.inlinecss = (req, res) => {
exports.inlinecss = async (req, res) => {
//Perform request validation
logger.log("email-inline-css", "DEBUG", req.user.email, null, null);
const { html, url } = req.body;
inlineCssTool(html, { url: url })
.then((inlinedHtml) => {
res.send(inlinedHtml);
})
.catch((error) => {
logger.log("email-inline-css-error", "ERROR", req.user.email, null, {
error
});
res.send(error);
try {
const inlinedHtml = juice(html, {
applyAttributesTableElements: false,
preserveMediaQueries: false,
applyWidthAttributes: false
});
res.send(inlinedHtml);
} catch (error) {
logger.log("email-inline-css-error", "ERROR", req.user.email, null, {
error
});
res.send(error.message);
}
// inlineCssTool(html, { url: url })
// .then((inlinedHtml) => {
// res.send(inlinedHtml);
// })
// .catch((error) => {
// logger.log("email-inline-css-error", "ERROR", req.user.email, null, {
// error
// });
// });
};

View File

@@ -2,10 +2,12 @@ const express = require("express");
const router = express.Router();
const { inlinecss } = require("../render/inlinecss");
const validateFirebaseIdTokenMiddleware = require("../middleware/validateFirebaseIdTokenMiddleware");
const { canvas } = require("../render/canvas-handler");
const { canvas, canvasSkia } = require("../render/canvas-handler");
const validateCanvasInputMiddleware = require("../middleware/validateCanvasInputMiddleware");
// Define the route for inline CSS rendering
router.post("/inlinecss", validateFirebaseIdTokenMiddleware, inlinecss);
router.post("/canvas", validateFirebaseIdTokenMiddleware, canvas);
router.post("/canvas", [validateFirebaseIdTokenMiddleware, validateCanvasInputMiddleware], canvas);
router.post("/canvas-skia", [validateFirebaseIdTokenMiddleware, validateCanvasInputMiddleware], canvasSkia);
module.exports = router;