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