IO-2053 Confirm before marking as exported.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { gql, useMutation } from "@apollo/client";
|
import { gql, useMutation } from "@apollo/client";
|
||||||
import { Button, notification } from "antd";
|
import { Button, notification, Popconfirm } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -34,6 +34,7 @@ export function BillMarkSelectedExported({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||||
const [updateBill] = useMutation(gql`
|
const [updateBill] = useMutation(gql`
|
||||||
mutation UPDATE_BILL($billIds: [uuid!]!) {
|
mutation UPDATE_BILL($billIds: [uuid!]!) {
|
||||||
@@ -84,11 +85,24 @@ export function BillMarkSelectedExported({
|
|||||||
completedCallback && completedCallback([]);
|
completedCallback && completedCallback([]);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
refetch && refetch();
|
refetch && refetch();
|
||||||
|
setVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button loading={loading} disabled={disabled} onClick={handleUpdate}>
|
<Popconfirm
|
||||||
{t("bills.labels.markexported")}
|
visible={visible}
|
||||||
</Button>
|
title={t("general.labels.areyousure")}
|
||||||
|
onCancel={() => setVisible(false)}
|
||||||
|
onConfirm={handleUpdate}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
disabled={disabled}
|
||||||
|
onClick={() => setVisible(true)}
|
||||||
|
>
|
||||||
|
{t("bills.labels.markexported")}
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { gql, useMutation } from "@apollo/client";
|
import { gql, useMutation } from "@apollo/client";
|
||||||
import { Button, notification } from "antd";
|
import { Button, notification, Popconfirm } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -34,6 +34,8 @@ export function PaymentMarkSelectedExported({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||||
const [updatePayments] = useMutation(gql`
|
const [updatePayments] = useMutation(gql`
|
||||||
mutation UPDATE_PAYMENTS($paymentIds: [uuid!]!, $exportedat: timestamptz!) {
|
mutation UPDATE_PAYMENTS($paymentIds: [uuid!]!, $exportedat: timestamptz!) {
|
||||||
@@ -86,11 +88,24 @@ export function PaymentMarkSelectedExported({
|
|||||||
completedCallback && completedCallback([]);
|
completedCallback && completedCallback([]);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
refetch && refetch();
|
refetch && refetch();
|
||||||
|
setVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button loading={loading} disabled={disabled} onClick={handleUpdate}>
|
<Popconfirm
|
||||||
{t("bills.labels.markexported")}
|
visible={visible}
|
||||||
</Button>
|
title={t("general.labels.areyousure")}
|
||||||
|
onCancel={() => setVisible(false)}
|
||||||
|
onConfirm={handleUpdate}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
disabled={disabled}
|
||||||
|
onClick={() => setVisible(true)}
|
||||||
|
>
|
||||||
|
{t("bills.labels.markexported")}
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user