Resolve NAN for divide by 0 on time tickets. IO-681
This commit is contained in:
@@ -29,6 +29,7 @@ export function TimeTicketModalContainer({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
}) {
|
}) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [enterAgain, setEnterAgain] = useState(false);
|
const [enterAgain, setEnterAgain] = useState(false);
|
||||||
const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET);
|
const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET);
|
||||||
@@ -39,6 +40,7 @@ export function TimeTicketModalContainer({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleFinish = (values) => {
|
const handleFinish = (values) => {
|
||||||
|
setLoading(true);
|
||||||
const emps = EmployeeAutoCompleteData.employees.filter(
|
const emps = EmployeeAutoCompleteData.employees.filter(
|
||||||
(e) => e.id === values.employeeid
|
(e) => e.id === values.employeeid
|
||||||
);
|
);
|
||||||
@@ -98,6 +100,7 @@ export function TimeTicketModalContainer({
|
|||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
}
|
}
|
||||||
setEnterAgain(false);
|
setEnterAgain(false);
|
||||||
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMutationError = (error) => {
|
const handleMutationError = (error) => {
|
||||||
@@ -107,6 +110,7 @@ export function TimeTicketModalContainer({
|
|||||||
message: JSON.stringify(error),
|
message: JSON.stringify(error),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
@@ -160,6 +164,7 @@ export function TimeTicketModalContainer({
|
|||||||
visible={timeTicketModal.visible}
|
visible={timeTicketModal.visible}
|
||||||
okText={t("general.actions.save")}
|
okText={t("general.actions.save")}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
|
okButtonProps={{ loading }}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
forceRender
|
forceRender
|
||||||
afterClose={() => form.resetFields()}
|
afterClose={() => form.resetFields()}
|
||||||
|
|||||||
@@ -146,7 +146,9 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
<Statistic
|
<Statistic
|
||||||
title={t("timetickets.fields.efficiency")}
|
title={t("timetickets.fields.efficiency")}
|
||||||
precision={1}
|
precision={1}
|
||||||
value={(prodHrs / actHrs) * 100}
|
value={
|
||||||
|
actHrs === 0 || !actHrs ? "∞" : (prodHrs / actHrs) * 100
|
||||||
|
}
|
||||||
suffix={"%"}
|
suffix={"%"}
|
||||||
/>
|
/>
|
||||||
<Statistic
|
<Statistic
|
||||||
|
|||||||
Reference in New Issue
Block a user