Compare commits
20 Commits
feature/IO
...
feature/co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b22480bd02 | ||
|
|
15792cb0ef | ||
|
|
856a24d496 | ||
|
|
74d6bcc004 | ||
|
|
01664c52ec | ||
|
|
e66d52784f | ||
|
|
a75969097e | ||
|
|
a384fd5072 | ||
|
|
490c66a9cb | ||
|
|
d38dab0738 | ||
|
|
37624d385f | ||
|
|
d565934288 | ||
|
|
5d03574d65 | ||
|
|
34f7c115b4 | ||
|
|
3ac74df504 | ||
|
|
d5f13f750f | ||
|
|
b9ddac36a9 | ||
|
|
c982dde1f5 | ||
|
|
7f61f652f7 | ||
|
|
282a22ff51 |
@@ -1,5 +1,9 @@
|
||||
root = true
|
||||
|
||||
# NOTE: Keep only EditorConfig properties that Prettier actually respects.
|
||||
# Style choices (quotes, bracket spacing, print width, etc.) live in `.prettierrc.js`.
|
||||
# Removing pseudo/unsupported keys (quote_type, bracketSpacing, max_line_length) that
|
||||
# previously caused editor vs CLI confusion.
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
@@ -7,14 +11,11 @@ indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = false
|
||||
quote_type = single
|
||||
max_line_length = 100
|
||||
bracketSpacing = false
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.yml]
|
||||
[*\.yml]
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
|
||||
11
.prettierignore
Normal file
11
.prettierignore
Normal file
@@ -0,0 +1,11 @@
|
||||
# Folders & files to skip during formatting
|
||||
node_modules
|
||||
build
|
||||
dist
|
||||
dev-dist
|
||||
coverage
|
||||
logs
|
||||
*.log
|
||||
# Generated / compiled assets
|
||||
client/dev-dist
|
||||
client/dist
|
||||
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@@ -39,5 +39,13 @@
|
||||
"timetickets",
|
||||
"touchtime"
|
||||
],
|
||||
"eslint.workingDirectories": ["./", "./client"]
|
||||
"eslint.workingDirectories": ["./", "./client"],
|
||||
// Formatting alignment: ensure VS Code uses project Prettier config
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
// Disable eslint's fixAll on save if it causes style churn; turn back on once stylistic rules removed or using eslint-config-prettier
|
||||
"prettier.useEditorConfig": true
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getAuth, updatePassword, updateProfile } from "@firebase/auth";
|
||||
import { getFirestore } from "@firebase/firestore";
|
||||
import { getMessaging, getToken, onMessage } from "@firebase/messaging";
|
||||
import { store } from "../redux/store";
|
||||
import * as amplitude from '@amplitude/analytics-browser';
|
||||
//import * as amplitude from '@amplitude/analytics-browser';
|
||||
import posthog from 'posthog-js'
|
||||
|
||||
const config = JSON.parse(import.meta.env.VITE_APP_FIREBASE_CONFIG);
|
||||
@@ -91,14 +91,14 @@ export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
|
||||
// dbevent: false,
|
||||
// env: `master-AIO|${import.meta.env.VITE_APP_GIT_SHA_DATE}`
|
||||
// });
|
||||
console.log(
|
||||
"%c[Analytics]",
|
||||
"background-color: green ;font-weight:bold;",
|
||||
eventName,
|
||||
eventParams
|
||||
);
|
||||
// console.log(
|
||||
// "%c[Analytics]",
|
||||
// "background-color: green ;font-weight:bold;",
|
||||
// eventName,
|
||||
// eventParams
|
||||
// );
|
||||
logEvent(analytics, eventName, eventParams);
|
||||
amplitude.track(eventName, eventParams);
|
||||
//amplitude.track(eventName, eventParams);
|
||||
posthog.capture(eventName, eventParams);
|
||||
|
||||
} finally {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { persistor, store } from "./redux/store";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import "./translations/i18n";
|
||||
import "./utils/CleanAxios";
|
||||
import * as amplitude from "@amplitude/analytics-browser";
|
||||
//import * as amplitude from "@amplitude/analytics-browser";
|
||||
import { PostHogProvider } from "posthog-js/react";
|
||||
import posthog from "posthog-js";
|
||||
|
||||
@@ -26,23 +26,23 @@ registerSW({ immediate: true });
|
||||
// Dinero.globalLocale = "en-CA";
|
||||
Dinero.globalRoundingMode = "HALF_EVEN";
|
||||
|
||||
amplitude.init(import.meta.env.VITE_APP_AMP_KEY, {
|
||||
defaultTracking: true,
|
||||
serverUrl: import.meta.env.VITE_APP_AMP_URL
|
||||
// {
|
||||
// attribution: {
|
||||
// excludeReferrers: true,
|
||||
// initialEmptyValue: true,
|
||||
// resetSessionOnNewCampaign: true,
|
||||
// },
|
||||
// fileDownloads: true,
|
||||
// formInteractions: true,
|
||||
// pageViews: {
|
||||
// trackHistoryChanges: 'all'
|
||||
// },
|
||||
// sessions: true
|
||||
// }
|
||||
});
|
||||
// amplitude.init(import.meta.env.VITE_APP_AMP_KEY, {
|
||||
// defaultTracking: true,
|
||||
// serverUrl: import.meta.env.VITE_APP_AMP_URL
|
||||
// // {
|
||||
// // attribution: {
|
||||
// // excludeReferrers: true,
|
||||
// // initialEmptyValue: true,
|
||||
// // resetSessionOnNewCampaign: true,
|
||||
// // },
|
||||
// // fileDownloads: true,
|
||||
// // formInteractions: true,
|
||||
// // pageViews: {
|
||||
// // trackHistoryChanges: 'all'
|
||||
// // },
|
||||
// // sessions: true
|
||||
// // }
|
||||
// });
|
||||
|
||||
posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_KEY, {
|
||||
autocapture: false,
|
||||
|
||||
@@ -49,7 +49,7 @@ import {
|
||||
validatePasswordResetSuccess
|
||||
} from "./user.actions";
|
||||
import UserActionTypes from "./user.types";
|
||||
import * as amplitude from '@amplitude/analytics-browser';
|
||||
//import * as amplitude from '@amplitude/analytics-browser';
|
||||
import posthog from 'posthog-js';
|
||||
|
||||
const fpPromise = FingerprintJS.load();
|
||||
@@ -92,7 +92,7 @@ export function* isUserAuthenticated() {
|
||||
}
|
||||
|
||||
LogRocket.identify(user.email);
|
||||
amplitude.setUserId(user.email);
|
||||
//amplitude.setUserId(user.email);
|
||||
posthog.identify(user.email);
|
||||
|
||||
const eulaQuery = yield client.query({
|
||||
@@ -139,7 +139,7 @@ export function* signOutStart() {
|
||||
imexshopid: state.user.bodyshop.imexshopid,
|
||||
type: "messaging"
|
||||
});
|
||||
amplitude.reset();
|
||||
//amplitude.reset();
|
||||
} catch {
|
||||
console.log("No FCM token. Skipping unsubscribe.");
|
||||
}
|
||||
@@ -365,7 +365,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
}
|
||||
|
||||
try {
|
||||
amplitude.setGroup('Shop', payload.shopname);
|
||||
//amplitude.setGroup('Shop', payload.shopname);
|
||||
window.$crisp.push(["set", "user:company", [payload.shopname]]);
|
||||
if (authRecord[0] && authRecord[0].user.validemail) {
|
||||
window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]);
|
||||
|
||||
@@ -51,12 +51,13 @@
|
||||
comment: ""
|
||||
- name: Rome Usage Report
|
||||
webhook: '{{HASURA_API_URL}}/data/usagereport'
|
||||
schedule: 0 12 * * 5
|
||||
schedule: 0 12 * * 3,5
|
||||
include_in_metadata: true
|
||||
payload: {}
|
||||
headers:
|
||||
- name: x-imex-auth
|
||||
value_from_env: DATAPUMP_AUTH
|
||||
comment: ""
|
||||
- name: Task Reminders
|
||||
webhook: '{{HASURA_API_URL}}/tasks-remind-handler'
|
||||
schedule: '*/15 * * * *'
|
||||
|
||||
@@ -944,6 +944,7 @@
|
||||
- autohouseid
|
||||
- bill_allow_post_to_closed
|
||||
- bill_tax_rates
|
||||
- carfax_exclude
|
||||
- cdk_configuration
|
||||
- cdk_dealerid
|
||||
- chatterid
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."bodyshops" add column "carfax_exclude" boolean
|
||||
-- not null default 'false';
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."bodyshops" add column "carfax_exclude" boolean
|
||||
not null default 'false';
|
||||
@@ -10,7 +10,8 @@
|
||||
"setup": "rm -rf node_modules && npm i && cd client && rm -rf node_modules && npm i",
|
||||
"setup:win": "rimraf node_modules && npm i && cd client && rimraf node_modules && npm i",
|
||||
"start": "node server.js",
|
||||
"makeitpretty": "prettier --write \"**/*.{css,js,json,jsx,scss}\"",
|
||||
"makeitpretty": "npm run format",
|
||||
"format": "prettier --config .prettierrc.js --ignore-path .prettierignore --write .",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"test:unit": "vitest run",
|
||||
|
||||
@@ -99,7 +99,7 @@ exports.default = async (req, res) => {
|
||||
await processShopData(shopsToProcess, start, end, skipUpload, ignoreDateFilter, allXMLResults, allErrors);
|
||||
|
||||
await sendServerEmail({
|
||||
subject: `CARFAX Report ${moment().format("MM-DD-YY")}`,
|
||||
subject: `Project Mexico Report ${moment().format("MM-DD-YY")}`,
|
||||
text: `Errors:\n${JSON.stringify(allErrors, null, 2)}\n\nUploaded:\n${JSON.stringify(
|
||||
allXMLResults.map((x) => ({
|
||||
imexshopid: x.imexshopid,
|
||||
@@ -164,35 +164,36 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
|
||||
|
||||
if (skipUpload) {
|
||||
fs.writeFileSync(`./logs/${jsonObj.filename}`, jsonObj.json);
|
||||
uploadToS3(jsonObj);
|
||||
} else {
|
||||
await uploadViaSFTP(jsonObj);
|
||||
}
|
||||
|
||||
await sendMexicoBillingEmail({
|
||||
subject: `${shopid.toUpperCase()}_Mexico${InstanceManager({
|
||||
imex: "IO",
|
||||
rome: "RO"
|
||||
})}_${moment().format("MMDDYYYY")} ROs ${jsonObj.count} Error ${errorCode(jsonObj)}`,
|
||||
text: `Errors:\n${JSON.stringify(
|
||||
erroredJobs.map((ej) => ({
|
||||
ro_number: ej.job?.ro_number,
|
||||
jobid: ej.job?.id,
|
||||
error: ej.error
|
||||
})),
|
||||
null,
|
||||
2
|
||||
)}\n\nUploaded:\n${JSON.stringify(
|
||||
{
|
||||
bodyshopid: bodyshop.id,
|
||||
imexshopid: shopid,
|
||||
count: jsonObj.count,
|
||||
filename: jsonObj.filename,
|
||||
result: jsonObj.result
|
||||
},
|
||||
null,
|
||||
2
|
||||
)}`
|
||||
});
|
||||
await sendMexicoBillingEmail({
|
||||
subject: `${shopid.replace(/_/g, "").toUpperCase()}_Mexico${InstanceManager({
|
||||
imex: "IO",
|
||||
rome: "RO"
|
||||
})}_${moment().format("MMDDYYYY")} ROs ${jsonObj.count} Error ${errorCode(jsonObj)}`,
|
||||
text: `Errors:\n${JSON.stringify(
|
||||
erroredJobs.map((ej) => ({
|
||||
ro_number: ej.job?.ro_number,
|
||||
jobid: ej.job?.id,
|
||||
error: ej.error
|
||||
})),
|
||||
null,
|
||||
2
|
||||
)}\n\nUploaded:\n${JSON.stringify(
|
||||
{
|
||||
bodyshopid: bodyshop.id,
|
||||
imexshopid: shopid,
|
||||
count: jsonObj.count,
|
||||
filename: jsonObj.filename,
|
||||
result: jsonObj.result
|
||||
},
|
||||
null,
|
||||
2
|
||||
)}`
|
||||
});
|
||||
}
|
||||
|
||||
allXMLResults.push({
|
||||
bodyshopid: bodyshop.id,
|
||||
@@ -292,17 +293,22 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
||||
v_make: job.v_make_desc || "",
|
||||
v_model: job.v_model_desc || "",
|
||||
|
||||
date_estimated:
|
||||
(job.date_estimated && moment(job.date_estimated).tz(job.bodyshop.timezone).format(AHDateFormat)) ||
|
||||
(job.created_at && moment(job.created_at).tz(job.bodyshop.timezone).format(AHDateFormat)) ||
|
||||
"",
|
||||
data_opened:
|
||||
(job.date_open && moment(job.date_open).tz(job.bodyshop.timezone).format(AHDateFormat)) ||
|
||||
(job.created_at && moment(job.created_at).tz(job.bodyshop.timezone).format(AHDateFormat)) ||
|
||||
"",
|
||||
date_invoiced:
|
||||
(job.date_invoiced && moment(job.date_invoiced).tz(job.bodyshop.timezone).format(AHDateFormat)) || "",
|
||||
loss_date: (job.loss_date && moment(job.loss_date).format(AHDateFormat)) || "",
|
||||
date_estimated: [job.date_estimated, job.created_at].find((date) => date)
|
||||
? moment([job.date_open, job.created_at].find((date) => date))
|
||||
.tz(job.bodyshop.timezone)
|
||||
.format(AHDateFormat)
|
||||
: "",
|
||||
data_opened: [job.date_open, job.created_at].find((date) => date)
|
||||
? moment([job.date_open, job.created_at].find((date) => date))
|
||||
.tz(job.bodyshop.timezone)
|
||||
.format(AHDateFormat)
|
||||
: "",
|
||||
date_invoiced: [job.date_invoiced, job.actual_delivery, job.actual_completion].find((date) => date)
|
||||
? moment([job.date_invoiced, job.actual_delivery, job.actual_completion].find((date) => date))
|
||||
.tz(job.bodyshop.timezone)
|
||||
.format(AHDateFormat)
|
||||
: "",
|
||||
loss_date: job.loss_date ? moment(job.loss_date).format(AHDateFormat) : "",
|
||||
|
||||
ins_co_nm: job.ins_co_nm || "",
|
||||
loss_desc: job.loss_desc || "",
|
||||
@@ -329,7 +335,9 @@ const GenerateDetailLines = (line) => {
|
||||
line_desc: line.line_desc ? line.line_desc.replace(NON_ASCII_REGEX, "") : null,
|
||||
oem_partno: line.oem_partno ? line.oem_partno.replace(NON_ASCII_REGEX, "") : null,
|
||||
alt_partno: line.alt_partno ? line.alt_partno.replace(NON_ASCII_REGEX, "") : null,
|
||||
op_code_desc: line.op_code_desc ? line.op_code_desc.replace(NON_ASCII_REGEX, "") : null,
|
||||
lbr_ty: generateLaborType(line.mod_lbr_ty),
|
||||
lbr_hrs: line.mod_lb_hrs || 0,
|
||||
part_qty: line.part_qty || 0,
|
||||
part_type: generatePartType(line.part_type),
|
||||
act_price: line.act_price || 0
|
||||
|
||||
@@ -879,39 +879,43 @@ exports.CHATTER_QUERY = `query CHATTER_EXPORT($start: timestamptz, $bodyshopid:
|
||||
}`;
|
||||
|
||||
exports.CARFAX_QUERY = `query CARFAX_EXPORT($start: timestamptz, $bodyshopid: uuid!, $end: timestamptz) {
|
||||
bodyshops_by_pk(id: $bodyshopid){
|
||||
bodyshops_by_pk(id: $bodyshopid) {
|
||||
id
|
||||
shopname
|
||||
imexshopid
|
||||
timezone
|
||||
}
|
||||
jobs(where: {_and: [{converted: {_eq: true}}, {v_vin: {_is_null: false}}, {date_invoiced: {_gt: $start}}, {date_invoiced: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
||||
id
|
||||
jobs(where: {_and: [{_or: [{date_invoiced: {_gt: $start, _lte: $end}}, {actual_delivery: {_gt: $start, _lte: $end}, date_invoiced: {_is_null: true}}, {actual_completion: {_gt: $start, _lte: $end}, actual_delivery: {_is_null: true}, date_invoiced: {_is_null: true}}]}, {_not: {_and: [{date_invoiced: {_is_null: true}}, {actual_delivery: {_is_null: true}}, {actual_completion: {_is_null: true}}]}}, {shopid: {_eq: $bodyshopid}}, {voided: {_neq: true}}, {v_vin: {_is_null: false}}, {ro_number: {_is_null: false}}]}) {
|
||||
actual_completion
|
||||
actual_delivery
|
||||
area_of_damage
|
||||
created_at
|
||||
ro_number
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
v_vin
|
||||
date_estimated
|
||||
date_open
|
||||
date_invoiced
|
||||
loss_date
|
||||
date_open
|
||||
id
|
||||
ins_co_nm
|
||||
job_totals
|
||||
joblines(where: {removed: {_eq: false}}) {
|
||||
act_price
|
||||
alt_partno
|
||||
line_desc
|
||||
mod_lb_hrs
|
||||
mod_lbr_ty
|
||||
oem_partno
|
||||
op_code_desc
|
||||
part_type
|
||||
part_qty
|
||||
}
|
||||
loss_date
|
||||
loss_desc
|
||||
ro_number
|
||||
theft_ind
|
||||
tlos_ind
|
||||
job_totals
|
||||
area_of_damage
|
||||
joblines(where: {removed: {_eq: false}}) {
|
||||
line_desc
|
||||
oem_partno
|
||||
alt_partno
|
||||
mod_lbr_ty
|
||||
part_qty
|
||||
part_type
|
||||
act_price
|
||||
}
|
||||
v_make_desc
|
||||
v_model_desc
|
||||
v_model_yr
|
||||
v_vin
|
||||
}
|
||||
}`;
|
||||
|
||||
@@ -1854,7 +1858,7 @@ exports.GET_CHATTER_SHOPS = `query GET_CHATTER_SHOPS {
|
||||
}`;
|
||||
|
||||
exports.GET_CARFAX_SHOPS = `query GET_CARFAX_SHOPS {
|
||||
bodyshops(where: {external_shop_id: {_is_null: true}}){
|
||||
bodyshops(where: {external_shop_id: {_is_null: true}, carfax_exclude: {_neq: "true"}}){
|
||||
id
|
||||
shopname
|
||||
imexshopid
|
||||
|
||||
@@ -384,6 +384,8 @@ async function CalculateRatesTotals({ job, client }) {
|
||||
if (item.lbr_op === "OP14" && item.act_price > 0 && (!item.part_type || item.mod_lb_hrs === 0)) {
|
||||
//Scenario where SGI may pay out hours using a part price.
|
||||
if (!ret[item.mod_lbr_ty.toLowerCase()].total) {
|
||||
ret[item.mod_lbr_ty.toLowerCase()].base = Dinero();
|
||||
ret[item.mod_lbr_ty.toLowerCase()].adjustment = Dinero();
|
||||
ret[item.mod_lbr_ty.toLowerCase()].total = Dinero();
|
||||
}
|
||||
ret[item.mod_lbr_ty.toLowerCase()].total = ret[item.mod_lbr_ty.toLowerCase()].total.add(
|
||||
|
||||
Reference in New Issue
Block a user