mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat: Reset to defailt SMS message.
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { useFormikContext, FastField, ErrorMessage } from 'formik';
|
||||
import { Intent, Button, FormGroup, TextArea } from '@blueprintjs/core';
|
||||
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import { useSMSMessageDialogContext } from './SMSMessageDialogProvider';
|
||||
|
||||
import { FastField, Field, ErrorMessage } from 'formik';
|
||||
import { Classes, FormGroup, TextArea } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, FieldRequiredHint } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export default function SMSMessageFormFields() {
|
||||
// SMS message dialog context.
|
||||
const { smsNotification } = useSMSMessageDialogContext();
|
||||
|
||||
// Form formik context.
|
||||
const { setFieldValue } = useFormikContext();
|
||||
|
||||
// Handle the button click.
|
||||
const handleBtnClick = () => {
|
||||
setFieldValue('message_text', smsNotification.default_sms_message);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* ----------- Message Text ----------- */}
|
||||
@@ -15,7 +33,19 @@ export default function SMSMessageFormFields() {
|
||||
label={<T id={'notify_via_sms.dialog.message_text'} />}
|
||||
className={'form-group--message_text'}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name={'message_text'} />}
|
||||
helperText={
|
||||
<>
|
||||
<ErrorMessage name={'message_text'} />
|
||||
<ResetButton
|
||||
minimal={true}
|
||||
small={true}
|
||||
intent={Intent.PRIMARY}
|
||||
onClick={handleBtnClick}
|
||||
>
|
||||
Reset to default message.
|
||||
</ResetButton>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TextArea
|
||||
growVertically={true}
|
||||
@@ -29,3 +59,7 @@ export default function SMSMessageFormFields() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const ResetButton = styled(Button)`
|
||||
font-size: 12px;
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user