From e77973d17b5464b516ea2f64b7dfabcab9660b11 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 23 Feb 2021 11:59:08 -0800 Subject: [PATCH] Resolve NAN for divide by 0 on time tickets. IO-681 --- .../time-ticket-modal/time-ticket-modal.container.jsx | 5 +++++ .../time-tickets-summary-employees.component.jsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx index 7cdc8f70a..aa8819ea2 100644 --- a/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx +++ b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx @@ -29,6 +29,7 @@ export function TimeTicketModalContainer({ bodyshop, }) { const [form] = Form.useForm(); + const [loading, setLoading] = useState(false); const { t } = useTranslation(); const [enterAgain, setEnterAgain] = useState(false); const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET); @@ -39,6 +40,7 @@ export function TimeTicketModalContainer({ }); const handleFinish = (values) => { + setLoading(true); const emps = EmployeeAutoCompleteData.employees.filter( (e) => e.id === values.employeeid ); @@ -98,6 +100,7 @@ export function TimeTicketModalContainer({ toggleModalVisible(); } setEnterAgain(false); + setLoading(false); }; const handleMutationError = (error) => { @@ -107,6 +110,7 @@ export function TimeTicketModalContainer({ message: JSON.stringify(error), }), }); + setLoading(false); }; const handleCancel = () => { @@ -160,6 +164,7 @@ export function TimeTicketModalContainer({ visible={timeTicketModal.visible} okText={t("general.actions.save")} onOk={() => form.submit()} + okButtonProps={{ loading }} onCancel={handleCancel} forceRender afterClose={() => form.resetFields()} diff --git a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx index 3f3c59955..1990837b8 100644 --- a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx +++ b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx @@ -146,7 +146,9 @@ export function TimeTicketsSummaryEmployees({