mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-14 20:00:33 +00:00
feat: add notify by sms .
This commit is contained in:
@@ -17,33 +17,38 @@ function NotifyPaymentReceiveViaSMSForm({
|
||||
// #withDialogActions
|
||||
closeDialog,
|
||||
}) {
|
||||
const { dialogName, paymentReceiveId } =
|
||||
useNotifyPaymentReceiveViaSMSContext();
|
||||
const {
|
||||
dialogName,
|
||||
paymentReceiveId,
|
||||
paymentReceiveMSDetail,
|
||||
createNotifyPaymentReceivetBySMSMutate,
|
||||
} = 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'),
|
||||
message: intl.get(
|
||||
'notify_payment_receive_via_sms.dialog.success_message',
|
||||
),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
closeDialog(dialogName);
|
||||
};
|
||||
|
||||
// Handle request response errors.
|
||||
const onError = ({
|
||||
response: {
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
const onError = ({}) => {
|
||||
setSubmitting(false);
|
||||
};
|
||||
createNotifyPaymentReceivetBySMSMutate([paymentReceiveId, values])
|
||||
.then(onSuccess)
|
||||
.catch(onError);
|
||||
};
|
||||
|
||||
return (
|
||||
<NotifyViaSMSForm
|
||||
NotificationDetail={{}}
|
||||
NotificationDetail={paymentReceiveMSDetail}
|
||||
NotificationName={dialogName}
|
||||
onSubmit={handleFormSubmit}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user