feat: add notify via SMS Form.

This commit is contained in:
elforjani13
2021-11-07 16:40:02 +02:00
parent 6dcb98a438
commit 7706d2992c
28 changed files with 577 additions and 155 deletions

View File

@@ -0,0 +1,52 @@
import React from 'react';
import intl from 'react-intl-universal';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
import NotifyViaSMSForm from '../../NotifyViaSMS/NotifyViaSMSForm';
import { useNotifyPaymentReceiveViaSMSContext } from './NotifyPaymentReceiveViaFormProvider';
import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils';
/**
* Notify Payment Recive Via SMS Form.
*/
function NotifyPaymentReceiveViaSMSForm({
// #withDialogActions
closeDialog,
}) {
const { dialogName, paymentReceiveId } =
useNotifyPaymentReceiveViaSMSContext();
// Handles the form submit.
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
// Handle request response success.
const onSuccess = (response) => {
AppToaster.show({
message: intl.get('notify_via_sms.dialog.success_message'),
intent: Intent.SUCCESS,
});
closeDialog(dialogName);
};
// Handle request response errors.
const onError = ({
response: {
data: { errors },
},
}) => {
setSubmitting(false);
};
};
return (
<NotifyViaSMSForm
NotificationDetail={{}}
NotificationName={dialogName}
onSubmit={handleFormSubmit}
/>
);
}
export default compose(withDialogActions)(NotifyPaymentReceiveViaSMSForm);