mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
Merge branch 'feature/notify-via-SMS' of https://github.com/bigcapitalhq/client into feature/notify-via-SMS
This commit is contained in:
@@ -41,12 +41,14 @@ function NotifyEstimateViaSMSForm({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
transformErrors(errors);
|
||||
if (errors) {
|
||||
transformErrors(errors, { setErrors });
|
||||
}
|
||||
setSubmitting(false);
|
||||
};
|
||||
createNotifyEstimateBySMSMutate([estimateId, values])
|
||||
.then(onSuccess)
|
||||
.then(onError);
|
||||
.catch(onError);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -53,7 +53,9 @@ function NotifyInvoiceViaSMSForm({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
transformErrors(errors);
|
||||
if (errors) {
|
||||
transformErrors(errors, { setErrors });
|
||||
}
|
||||
setSubmitting(false);
|
||||
};
|
||||
// Transformes the form values to request.
|
||||
|
||||
@@ -44,7 +44,10 @@ function NotifyPaymentReceiveViaSMSForm({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
transformErrors(errors);
|
||||
if (errors) {
|
||||
transformErrors(errors, { setErrors });
|
||||
}
|
||||
setSubmitting(false);
|
||||
};
|
||||
createNotifyPaymentReceivetBySMSMutate([paymentReceiveId, values])
|
||||
.then(onSuccess)
|
||||
|
||||
@@ -42,7 +42,10 @@ function NotifyReceiptViaSMSForm({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
transformErrors(errors);
|
||||
if (errors) {
|
||||
transformErrors(errors, { setErrors });
|
||||
}
|
||||
setSubmitting(false);
|
||||
};
|
||||
createNotifyReceiptBySMSMutate([receiptId, values])
|
||||
.then(onSuccess)
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AppToaster } from 'components';
|
||||
import SMSMessageFormContent from './SMSMessageFormContent';
|
||||
import { CreateSMSMessageFormSchema } from './SMSMessageForm.schema';
|
||||
import { useSMSMessageDialogContext } from './SMSMessageDialogProvider';
|
||||
import { transformErrors } from './utils';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
@@ -58,6 +59,9 @@ function SMSMessageForm({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
if (errors) {
|
||||
transformErrors(errors, { setErrors });
|
||||
}
|
||||
setSubmitting(false);
|
||||
};
|
||||
debugger;
|
||||
|
||||
@@ -20,7 +20,7 @@ function SMSMessageDialog({
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={intl.get('sms_message')}
|
||||
title={intl.get('sms_message.dialog.label')}
|
||||
isOpen={isOpen}
|
||||
canEscapeJeyClose={true}
|
||||
autoFocus={true}
|
||||
|
||||
15
src/containers/Dialogs/SMSMessageDialog/utils.js
Normal file
15
src/containers/Dialogs/SMSMessageDialog/utils.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { AppToaster } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
export const transformErrors = (errors, { setErrors }) => {
|
||||
if (
|
||||
errors.find((error) => error.type === 'UNSUPPORTED_SMS_MESSAGE_VARIABLES')
|
||||
) {
|
||||
setErrors({
|
||||
message_text: intl.get(
|
||||
'sms_message.dialog.unsupported_variables_error_message',
|
||||
),
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user