Added loading to parts receive modal.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Form, Modal, notification } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -31,7 +31,7 @@ export function PartsReceiveModalContainer({
|
||||
bodyshop,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { visible, context, actions } = partsReceiveModal;
|
||||
const { partsorderlines } = context;
|
||||
|
||||
@@ -42,7 +42,7 @@ export function PartsReceiveModalContainer({
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
logImEXEvent("parts_order_receive");
|
||||
|
||||
setLoading(true);
|
||||
const result = await Promise.all(
|
||||
values.partsorderlines.map((li) => {
|
||||
return receivePartsLine({
|
||||
@@ -75,7 +75,7 @@ export function PartsReceiveModalContainer({
|
||||
notification["success"]({
|
||||
message: t("parts_orders.successes.received"),
|
||||
});
|
||||
|
||||
setLoading(false);
|
||||
if (refetch) refetch();
|
||||
toggleModalVisible();
|
||||
};
|
||||
@@ -96,6 +96,7 @@ export function PartsReceiveModalContainer({
|
||||
title={t("parts_orders.labels.receive")}
|
||||
onCancel={() => toggleModalVisible()}
|
||||
onOk={() => form.submit()}
|
||||
okButtonProps={{ loading: loading }}
|
||||
destroyOnClose
|
||||
forceRender
|
||||
width="50%"
|
||||
|
||||
Reference in New Issue
Block a user