diff --git a/client/src/components/contract-form/contract-form.component.jsx b/client/src/components/contract-form/contract-form.component.jsx
index cf5ad03f5..bfc4c55b5 100644
--- a/client/src/components/contract-form/contract-form.component.jsx
+++ b/client/src/components/contract-form/contract-form.component.jsx
@@ -6,6 +6,8 @@ import FormDatePicker from "../form-date-picker/form-date-picker.component";
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
import InputPhone from "../form-items-formatted/phone-form-item.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
+import InputNumberCalculator from "../form-input-number-calculator/form-input-number-calculator.component";
+
export default function ContractFormComponent({ form, create = false }) {
const { t } = useTranslation();
return (
@@ -298,16 +300,16 @@ export default function ContractFormComponent({ form, create = false }) {
-
+
-
+
-
+
-
+
diff --git a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx
index 4c8438bbb..9028503c8 100644
--- a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx
+++ b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx
@@ -7,6 +7,8 @@ import FormDatePicker from "../form-date-picker/form-date-picker.component";
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
+import InputNumberCalculator from "../form-input-number-calculator/form-input-number-calculator.component";
+
export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
const { t } = useTranslation();
return (
@@ -172,7 +174,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
},
]}
>
-
+
{
const [value, setValue] = useState(formValue);
const [total, setTotal] = useState(0);
const [history, setHistory] = useState([]);
- const handleChange = (e) => {
- const key = e.target.value;
- switch (key) {
- case "/":
- case "*":
- case "+":
- case "-":
- return;
- default:
- setValue(key);
- return;
- }
- };
+ const ref = useRef(null);
const handleKeyDown = (e) => {
+ console.log("e :>> ", e.currentTarget.value);
const { key } = e;
-
let action;
switch (key) {
case "/":
@@ -38,11 +26,13 @@ const FormInputNUmberCalculator = (
action = "=";
break;
default:
+ setValue(e.currentTarget.value);
return;
}
-
const val = parseFloat(value);
setValue(null);
+ ref.current.blur();
+ ref.current.focus();
if (!isNaN(val)) {
setHistory([...history, val, action]);
}
@@ -82,7 +72,12 @@ const FormInputNUmberCalculator = (
}
}, 0);
setTotal(subTotal);
- if (history[history.length - 1] === "=") setValue(subTotal);
+ if (history[history.length - 1] === "=") {
+ setValue(subTotal);
+ ref.current.blur();
+ ref.current.focus();
+ setHistory([]);
+ }
}
}, [history]);
@@ -101,13 +96,13 @@ const FormInputNUmberCalculator = (
return (
diff --git a/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx b/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx
index c01cba278..781f716e0 100644
--- a/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx
+++ b/client/src/components/job-scoreboard-add-button/job-scoreboard-add-button.component.jsx
@@ -1,11 +1,12 @@
import { useMutation } from "@apollo/react-hooks";
-import { Button, Card, Form, InputNumber, notification, Popover } from "antd";
+import { Button, Card, Form, notification, Popover } from "antd";
import moment from "moment";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { INSERT_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
import FormDatePicker from "../form-date-picker/form-date-picker.component";
+import InputNumberCalculator from "../form-input-number-calculator/form-input-number-calculator.component";
export default function ScoreboardAddButton({ job, ...otherBtnProps }) {
const { t } = useTranslation();
@@ -68,7 +69,7 @@ export default function ScoreboardAddButton({ job, ...otherBtnProps }) {
},
]}
>
-
+
-
+