Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
98bff6d8f6 IO-2824 Dev Server Instance Switch
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-06-20 10:56:07 -07:00
15 changed files with 64 additions and 119 deletions

View File

@@ -1,7 +1,8 @@
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
VITE_APP_GA_CODE=231099835 VITE_APP_GA_CODE=231099835
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} # VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
VITE_APP_CLOUDINARY_API_KEY=957865933348715 VITE_APP_CLOUDINARY_API_KEY=957865933348715

View File

@@ -1,7 +1,8 @@
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
VITE_APP_GA_CODE=231099835 VITE_APP_GA_CODE=231099835
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} # VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
VITE_APP_CLOUDINARY_API_KEY=957865933348715 VITE_APP_CLOUDINARY_API_KEY=957865933348715

View File

@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import InstanceRenderMgr from "../../utils/instanceRenderMgr"; import InstanceRenderMgr from "../../utils/instanceRenderMgr";
//To be used as a form element only. //To be used as a form element only.
const { Option } = Select;
const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps }, ref) => { const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps }, ref) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -1,5 +1,6 @@
import { useMutation } from "@apollo/client"; import { useMutation } from "@apollo/client";
import { Button, Card, Form, Input, notification, Switch } from "antd"; import { Button, Card, Form, Input, notification, Switch } from "antd";
import dayjs from "../../../../utils/day";
import queryString from "query-string"; import queryString from "query-string";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -13,7 +14,6 @@ import { UPDATE_OWNER } from "../../../../graphql/owners.queries";
import { insertAuditTrail } from "../../../../redux/application/application.actions"; import { insertAuditTrail } from "../../../../redux/application/application.actions";
import { selectBodyshop, selectCurrentUser } from "../../../../redux/user/user.selectors"; import { selectBodyshop, selectCurrentUser } from "../../../../redux/user/user.selectors";
import AuditTrailMapping from "../../../../utils/AuditTrailMappings"; import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
import dayjs from "../../../../utils/day";
import ConfigFormComponents from "../../../config-form-components/config-form-components.component"; import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component"; import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
@@ -275,19 +275,7 @@ export function JobChecklistForm({ insertAuditTrail, formItems, bodyshop, curren
> >
<DateTimePicker disabled={readOnly} /> <DateTimePicker disabled={readOnly} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item name="actual_delivery" label={t("jobs.fields.actual_delivery")} disabled={readOnly}>
name="actual_delivery"
label={t("jobs.fields.actual_delivery")}
rules={[
{
required: bodyshop.deliverchecklist.actual_delivery
? bodyshop.deliverchecklist.actual_delivery
: false
//message: t("general.validation.required"),
}
]}
disabled={readOnly}
>
<DateTimePicker disabled={readOnly} /> <DateTimePicker disabled={readOnly} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item

View File

@@ -3,7 +3,6 @@ import { Button, Space, notification } from "antd";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries"; import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries";
import InstanceRenderManager from "../../utils/instanceRenderMgr";
export default function JobAdminDeleteIntake({ job }) { export default function JobAdminDeleteIntake({ job }) {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -48,22 +47,16 @@ export default function JobAdminDeleteIntake({ job }) {
setLoading(false); setLoading(false);
}; };
const InstanceRender = InstanceRenderManager({ return (
imex: true,
rome: "USE_IMEX",
promanager: false
});
return InstanceRender ? (
<> <>
<Space wrap> <Space wrap>
<Button loading={loading} onClick={handleDelete} disabled={!job.intakechecklist}> <Button loading={loading} onClick={handleDelete} disabled={!job.intakechecklist}>
{t("jobs.labels.deleteintake")} {t("jobs.labels.deleteintake")}
</Button> </Button>
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverchecklist}> <Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverychecklist}>
{t("jobs.labels.deletedelivery")} {t("jobs.labels.deletedelivery")}
</Button> </Button>
</Space> </Space>
</> </>
) : null; );
} }

View File

@@ -319,18 +319,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
))} ))}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item
name={["deliverchecklist", "actual_delivery"]}
label={t("bodyshop.fields.deliver.require_actual_delivery_date")}
rules={[
{
required: true
//message: t("general.validation.required"),
}
]}
>
<Switch />
</Form.Item>
</SelectorDiv> </SelectorDiv>
</div> </div>
); );

View File

@@ -1,5 +1,5 @@
import { PageHeader } from "@ant-design/pro-layout";
import { Button, Result, Space, Steps } from "antd"; import { Button, Result, Space, Steps } from "antd";
import { PageHeader } from "@ant-design/pro-layout";
import React, { useContext, useState } from "react"; import React, { useContext, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -9,6 +9,7 @@ import JobsCreateJobsInfo from "../../components/jobs-create-jobs-info/jobs-crea
import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container"; import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container";
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container"; import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
import JobCreateContext from "../../pages/jobs-create/jobs-create.context"; import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
import FormsFieldChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component";
export default function JobsCreateComponent({ form }) { export default function JobsCreateComponent({ form }) {
const [pageIndex, setPageIndex] = useState(0); const [pageIndex, setPageIndex] = useState(0);
@@ -40,11 +41,10 @@ export default function JobsCreateComponent({ form }) {
const next = () => { const next = () => {
setPageIndex(pageIndex + 1); setPageIndex(pageIndex + 1);
console.log("Next"); console.log("NExt");
}; };
const prev = () => { const prev = () => {
setPageIndex(pageIndex - 1); setPageIndex(pageIndex - 1);
console.log("Previous");
}; };
const { Step } = Steps; const { Step } = Steps;
@@ -53,26 +53,26 @@ export default function JobsCreateComponent({ form }) {
<PageHeader <PageHeader
extra={ extra={
<Space wrap> <Space wrap>
{pageIndex > 0 && <Button onClick={() => prev()}>{t("general.actions.previous")}</Button>} {pageIndex > 0 && <Button onClick={() => prev()}>Previous</Button>}
{pageIndex < steps.length - 1 && ( {pageIndex < steps.length - 1 && (
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
next(); next();
form // form
.validateFields() // .validateFields()
.then((r) => { // .then((r) => {
if (steps[pageIndex].validation) { // if (steps[pageIndex].validation) {
setErrorMessage(null); // setErrorMessage(null);
next(); // next();
} else { // } else {
setErrorMessage(steps[pageIndex].error); // setErrorMessage(steps[pageIndex].error);
} // }
}) // })
.catch((error) => console.log("error", error)); // .catch((error) => console.log("error", error));
}} }}
> >
{t("general.actions.next")} Next
</Button> </Button>
)} )}
{pageIndex === steps.length - 1 && ( {pageIndex === steps.length - 1 && (
@@ -104,17 +104,17 @@ export default function JobsCreateComponent({ form }) {
}} }}
onClick={() => { onClick={() => {
setPageIndex(idx); setPageIndex(idx);
form // form
.validateFields() // .validateFields()
.then((r) => { // .then((r) => {
if (steps[pageIndex].validation) { // if (steps[pageIndex].validation) {
setErrorMessage(null); // setErrorMessage(null);
setPageIndex(idx); // setPageIndex(idx);
} else { // } else {
setErrorMessage(steps[pageIndex].error); // setErrorMessage(steps[pageIndex].error);
} // }
}) // })
.catch((error) => console.log("error", error)); // .catch((error) => console.log("error", error));
}} }}
/> />
))} ))}
@@ -144,7 +144,7 @@ export default function JobsCreateComponent({ form }) {
) : ( ) : (
<div> <div>
<ProgressButtons top /> <ProgressButtons top />
<FormsFieldChanged form={form} />
{errorMessage ? ( {errorMessage ? (
<div> <div>
<AlertComponent message={errorMessage} type="error" /> <AlertComponent message={errorMessage} type="error" />

View File

@@ -295,8 +295,7 @@
"dailypainttarget": "Scoreboard - Daily Paint Target", "dailypainttarget": "Scoreboard - Daily Paint Target",
"default_adjustment_rate": "Default Labor Deduction Adjustment Rate", "default_adjustment_rate": "Default Labor Deduction Adjustment Rate",
"deliver": { "deliver": {
"templates": "Delivery Templates", "templates": "Delivery Templates"
"require_actual_delivery_date": "Require Actual Delivery"
}, },
"dms": { "dms": {
"apcontrol": "AP Control Number", "apcontrol": "AP Control Number",
@@ -1140,8 +1139,6 @@
"download": "Download", "download": "Download",
"edit": "Edit", "edit": "Edit",
"login": "Login", "login": "Login",
"next": "Next",
"previous": "Previous",
"print": "Print", "print": "Print",
"refresh": "Refresh", "refresh": "Refresh",
"remove": "Remove", "remove": "Remove",

View File

@@ -295,8 +295,7 @@
"dailypainttarget": "", "dailypainttarget": "",
"default_adjustment_rate": "", "default_adjustment_rate": "",
"deliver": { "deliver": {
"templates": "", "templates": ""
"require_actual_delivery_date": ""
}, },
"dms": { "dms": {
"apcontrol": "", "apcontrol": "",
@@ -1140,8 +1139,6 @@
"download": "", "download": "",
"edit": "Editar", "edit": "Editar",
"login": "", "login": "",
"next": "",
"previous": "",
"print": "", "print": "",
"refresh": "", "refresh": "",
"remove": "", "remove": "",

View File

@@ -295,8 +295,7 @@
"dailypainttarget": "", "dailypainttarget": "",
"default_adjustment_rate": "", "default_adjustment_rate": "",
"deliver": { "deliver": {
"templates": "", "templates": ""
"require_actual_delivery_date": ""
}, },
"dms": { "dms": {
"apcontrol": "", "apcontrol": "",
@@ -1140,8 +1139,6 @@
"download": "", "download": "",
"edit": "modifier", "edit": "modifier",
"login": "", "login": "",
"next": "",
"previous": "",
"print": "", "print": "",
"refresh": "", "refresh": "",
"remove": "", "remove": "",

View File

@@ -12,6 +12,9 @@
"admin": "cd admin && npm start", "admin": "cd admin && npm start",
"client": "cd client && npm start", "client": "cd client && npm start",
"server": "nodemon server.js", "server": "nodemon server.js",
"server:imex": "nodemon server.js imex",
"server:rome": "nodemon server.js rome",
"server:promanager": "nodemon server.js promanager",
"build": "cd client && npm run build", "build": "cd client && npm run build",
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"", "dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",
"deva": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\" \"npm run admin\"", "deva": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\" \"npm run admin\"",

View File

@@ -8,9 +8,11 @@ const cookieParser = require("cookie-parser");
const http = require("http"); const http = require("http");
const { Server } = require("socket.io"); const { Server } = require("socket.io");
const instanceName = process.argv[2];
// Load environment variables // Load environment variables
require("dotenv").config({ require("dotenv").config({
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`) path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}${instanceName ? `.${instanceName}` : ''}`)
}); });
// Import custom utilities and handlers // Import custom utilities and handlers

View File

@@ -891,19 +891,22 @@ function checkStateTax(jobline, jobs_by_pk) {
} }
const isAdditionalCost = const isAdditionalCost =
(jobline.lbr_op === "OP13" || (jobline.lbr_op === "OP13" || (jobline.db_ref && jobline.db_ref.startsWith("9360"))) && !isPaintOrShopMat;
(jobline.lbr_op === "OP14" && jobline.act_price > 0 && jobline.mod_lb_hrs === 0) ||
(jobline.db_ref && jobline.db_ref.startsWith("9360")) ||
(jobline.db_ref && jobline.db_ref.startsWith("90051"))) &&
!isPaintOrShopMat;
if (!jobline.part_type && isAdditionalCost) { if (!jobline.part_type && isAdditionalCost) {
if (jobs_by_pk.tax_lbr_rt === 0) { if (jobs_by_pk.tax_lbr_rt === 0) {
return false; return false;
} else { } else {
return true; return true;
}
} }
}
if (
jobline.db_ref === "900511" ||
jobline.db_ref === "900510" ||
(jobline.mod_lb_hrs === 0 && jobline.act_price > 0 && jobline.lbr_op === "OP14")
)
return true; //Extending IO-1375 as a part of IO-2023
if (jobline.tax_part === false) { if (jobline.tax_part === false) {
return false; return false;

View File

@@ -318,9 +318,7 @@ function GenerateCostingData(job) {
if (!partsProfitCenter) if (!partsProfitCenter)
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type); console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
const partsAmount = Dinero({ const partsAmount = Dinero({
amount: val.act_price_before_ppc amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
? Math.round(val.act_price_before_ppc * 100)
: Math.round(val.act_price * 100)
}) })
.multiply(val.part_qty || 1) .multiply(val.part_qty || 1)
.add( .add(
@@ -329,9 +327,7 @@ function GenerateCostingData(job) {
? val.prt_dsmk_m ? val.prt_dsmk_m
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
: Dinero({ : Dinero({
amount: val.act_price_before_ppc amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
? Math.round(val.act_price_before_ppc * 100)
: Math.round(val.act_price * 100)
}) })
.multiply(val.part_qty || 0) .multiply(val.part_qty || 0)
.percentage(Math.abs(val.prt_dsmk_p || 0)) .percentage(Math.abs(val.prt_dsmk_p || 0))
@@ -372,10 +368,7 @@ function GenerateCostingData(job) {
} }
//Additional Profit Center //Additional Profit Center
if ( if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) {
(!val.part_type && !val.mod_lbr_ty) ||
(!val.part_type && val.mod_lbr_ty && val.act_price > 0 && val.lbr_op !== "OP14")
) {
//Does it already have a defined profit center? //Does it already have a defined profit center?
//If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate. //If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate.
const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown"; const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";

View File

@@ -909,25 +909,6 @@ function CalculateTaxesTotals(job, otherTotals) {
} }
}); });
if (job.adjustment_bottom_line) {
const subtotal_before_adjustment = subtotal.add(Dinero({ amount: Math.round(job.adjustment_bottom_line * -100) }));
const percent_of_adjustment =
Math.round(
subtotal_before_adjustment.toUnit() /
(job.adjustment_bottom_line > 0 ? job.adjustment_bottom_line : job.adjustment_bottom_line * -1)
) / 100;
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
taxable_adjustment = taxableAmountsByTier[taxTierKey].multiply(percent_of_adjustment);
console.log("🚀 ~ taxableAmountsByTier ~ taxable_adjustment:", taxable_adjustment)
if (job.adjustment_bottom_line > 0) {
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].add(taxable_adjustment);
} else {
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].subtract(taxable_adjustment);
}
});
}
const remainingTaxableAmounts = taxableAmountsByTier; const remainingTaxableAmounts = taxableAmountsByTier;
console.log("*** Taxable Amounts by Tier***"); console.log("*** Taxable Amounts by Tier***");
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier))); console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));