Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add initial state for modals

dominik-zeglen80be7911fc2c
diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
index a4d608a809..928ff89344 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
@@ -334,12 +334,14 @@ class OrderDetailsPageComponent extends React.Component<
onSubmit={onOrderFulfill}
/>
<OrderPaymentDialog
+ initial={maybe(() => order.total.gross.amount)}
open={openedPaymentCaptureDialog && !!order}
variant="capture"
onClose={this.togglePaymentCaptureDialog}
onSubmit={onPaymentCapture}
/>
<OrderPaymentDialog
+ initial={maybe(() => order.total.gross.amount)}
open={openedPaymentRefundDialog && !!order}
variant="refund"
onClose={this.togglePaymentRefundDialog}
diff --git a/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
index b03af0ae7d..c924ce15a8 100644
--- a/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
@@ -10,27 +10,29 @@ import Form from "../../../components/Form";
import i18n from "../../../i18n";
export interface FormData {
- amount: string;
+ amount: number;
}
interface OrderPaymentDialogProps {
open: boolean;
+ initial: number;
variant: string;
onClose: () => void;
onSubmit: (data: FormData) => void;
}
-const initialForm: FormData = { amount: "0" };
-
const OrderPaymentDialog: React.StatelessComponent<OrderPaymentDialogProps> = ({
open,
+ initial,
variant,
onClose,
onSubmit
}) => (
<Dialog open={open}>
<Form
- initial={initialForm}
+ initial={{
+ amount: initial
+ }}
onSubmit={data => {
onSubmit(data);
onClose();