Updated all packages and fixed errors thrown by new ESLint

This commit is contained in:
Patrick Fic
2020-10-30 12:40:27 -07:00
parent fe02f80cc7
commit 3721f7ffe2
18 changed files with 25458 additions and 3676 deletions

View File

@@ -1,6 +1,6 @@
import { Alert } from "antd";
import { logImEXEvent } from "../../firebase/firebase.utils";
import React from "react";
import { logImEXEvent } from "../../firebase/firebase.utils";
export default function AlertComponent(props) {
if (props.type === "error") logImEXEvent("alert_render", { ...props });

View File

@@ -1,17 +1,13 @@
import { shallow } from "enzyme";
import React from "react";
import ReactDOM from "react-dom";
import Alert from "./alert.component";
import { MockedProvider } from "@apollo/react-testing";
import { shallow, mount } from "enzyme";
const div = document.createElement("div");
describe("Alert component", () => {
let wrapper;
beforeEach(() => {
const mockProps = {
type: "error",
message: "Test error message."
message: "Test error message.",
};
wrapper = shallow(<Alert {...mockProps} />);

View File

@@ -1,9 +1,7 @@
import { mount, shallow } from "enzyme";
import { mount } from "enzyme";
import React from "react";
import { AllocationsAssignmentComponent } from "./allocations-assignment.component";
import { MockBodyshop } from "../../utils/TestingHelpers";
import { Select } from "antd";
const div = document.createElement("div");
import { AllocationsAssignmentComponent } from "./allocations-assignment.component";
describe("AllocationsAssignmentComponent component", () => {
let wrapper;

View File

@@ -3,11 +3,12 @@ import Rate from "./rate/rate.component";
import Slider from "./slider/slider.component";
import Text from "./text/text.component";
import Textarea from "./textarea/textarea.component";
export default {
const e = {
checkbox: CheckboxFormItem,
slider: Slider,
text: Text,
textarea: Textarea,
rate: Rate,
};
export default e;

View File

@@ -17,39 +17,41 @@ export function JobCostingModalComponent({ bodyshop, job }) {
const defaultProfits = bodyshop.md_responsibility_centers.defaults.profits;
// const defaultCosts = bodyshop.md_responsibility_centers.defaults.costs;
const jobLineTotalsByProfitCenter = job.joblines.reduce(
(acc, val) => {
const laborProfitCenter = defaultProfits[val.mod_lbr_ty] || "?";
const jobLineTotalsByProfitCenter =
job &&
job.joblines.reduce(
(acc, val) => {
const laborProfitCenter = defaultProfits[val.mod_lbr_ty] || "?";
const rateName = `rate_${(val.mod_lbr_ty || "").toLowerCase()}`;
const laborAmount = Dinero({
amount: Math.round((job[rateName] || 0) * 100),
}).multiply(val.mod_lb_hrs || 0);
if (!!!acc.labor[laborProfitCenter])
acc.labor[laborProfitCenter] = Dinero();
acc.labor[laborProfitCenter] = acc.labor[laborProfitCenter].add(
laborAmount
);
const partsProfitCenter = defaultProfits[val.part_type] || "?";
if (!!!partsProfitCenter)
console.log(
"Unknown cost/profit center mapping for parts.",
val.part_type
const rateName = `rate_${(val.mod_lbr_ty || "").toLowerCase()}`;
const laborAmount = Dinero({
amount: Math.round((job[rateName] || 0) * 100),
}).multiply(val.mod_lb_hrs || 0);
if (!!!acc.labor[laborProfitCenter])
acc.labor[laborProfitCenter] = Dinero();
acc.labor[laborProfitCenter] = acc.labor[laborProfitCenter].add(
laborAmount
);
const partsAmount = Dinero({
amount: Math.round((val.act_price || 0) * 100),
}).multiply(val.part_qty || 1);
if (!!!acc.parts[partsProfitCenter])
acc.parts[partsProfitCenter] = Dinero();
acc.parts[partsProfitCenter] = acc.parts[partsProfitCenter].add(
partsAmount
);
return acc;
},
{ parts: {}, labor: {} }
);
const partsProfitCenter = defaultProfits[val.part_type] || "?";
if (!!!partsProfitCenter)
console.log(
"Unknown cost/profit center mapping for parts.",
val.part_type
);
const partsAmount = Dinero({
amount: Math.round((val.act_price || 0) * 100),
}).multiply(val.part_qty || 1);
if (!!!acc.parts[partsProfitCenter])
acc.parts[partsProfitCenter] = Dinero();
acc.parts[partsProfitCenter] = acc.parts[partsProfitCenter].add(
partsAmount
);
return acc;
},
{ parts: {}, labor: {} }
);
const billTotalsByProfitCenter = job.bills.reduce((bill_acc, bill_val) => {
//At the invoice level.

View File

@@ -40,7 +40,6 @@ export function JobCostingModalContainer({
onCancel={() => toggleModalVisible()}
width="90%"
destroyOnClose
forceRender
>
{error ? <AlertComponent message={error.message} type="error" /> : null}
{loading ? (

View File

@@ -1,7 +1,7 @@
import React from "react";
import { useTranslation } from "react-i18next";
export default ({ dmg1, dmg2 }) => {
const Car = ({ dmg1, dmg2 }) => {
const { t } = useTranslation();
return (
@@ -744,3 +744,5 @@ export default ({ dmg1, dmg2 }) => {
</div>
);
};
export default Car;

View File

@@ -13,7 +13,7 @@ import ProductionListColumnNote from "./production-list-columns.productionnote.c
import ProductionListColumnStatus from "./production-list-columns.status.component";
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
export default [
const r = [
{
title: i18n.t("jobs.actions.viewdetail"),
dataIndex: "viewdetail",
@@ -219,3 +219,5 @@ export default [
),
},
];
export default r;

View File

@@ -1,11 +1,11 @@
import React from "react";
import { Resizable } from "react-resizable";
export default (props) => {
export default function ResizableComponent(props) {
const { onResize, width, ...restProps } = props;
return (
<Resizable width={width || 200} height={0} onResize={onResize}>
<th {...restProps} />
</Resizable>
);
};
}

View File

@@ -1,4 +1,4 @@
export default {
const ret = {
"accounting:payables": 1,
"accounting:payments": 1,
"accounting:receivables": 1,
@@ -50,3 +50,4 @@ export default {
"timetickets:enter": 3,
"timetickets:list": 3,
};
export default ret;