mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: Reset to defailt SMS message.
This commit is contained in:
@@ -1,23 +1,13 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Button } from '@blueprintjs/core';
|
|
||||||
|
|
||||||
export const ButtonLink = styled(Button)`
|
export const ButtonLink = styled.button`
|
||||||
line-height: inherit;
|
color: #0052cc;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&.bp3-small {
|
&:hover,
|
||||||
min-height: auto;
|
&:active {
|
||||||
min-width: auto;
|
text-decoration: underline;
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
&:not([class*='bp3-intent-']) {
|
|
||||||
&,
|
|
||||||
&:hover {
|
|
||||||
color: #0052cc;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,11 +1,29 @@
|
|||||||
import React from 'react';
|
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';
|
import { inputIntent } from 'utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
export default function SMSMessageFormFields() {
|
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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* ----------- Message Text ----------- */}
|
{/* ----------- Message Text ----------- */}
|
||||||
@@ -15,7 +33,19 @@ export default function SMSMessageFormFields() {
|
|||||||
label={<T id={'notify_via_sms.dialog.message_text'} />}
|
label={<T id={'notify_via_sms.dialog.message_text'} />}
|
||||||
className={'form-group--message_text'}
|
className={'form-group--message_text'}
|
||||||
intent={inputIntent({ error, touched })}
|
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
|
<TextArea
|
||||||
growVertically={true}
|
growVertically={true}
|
||||||
@@ -29,3 +59,7 @@ export default function SMSMessageFormFields() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ResetButton = styled(Button)`
|
||||||
|
font-size: 12px;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Menu, MenuItem } from '@blueprintjs/core';
|
import { Intent, Button, Menu, MenuItem } from '@blueprintjs/core';
|
||||||
|
|
||||||
import { ButtonLink } from 'components';
|
|
||||||
import { SwitchFieldCell } from 'components/DataTableCells';
|
import { SwitchFieldCell } from 'components/DataTableCells';
|
||||||
|
|
||||||
import { safeInvoke } from 'utils';
|
import { safeInvoke } from 'utils';
|
||||||
@@ -32,9 +31,14 @@ export const SMSMessageCell = ({
|
|||||||
<div>
|
<div>
|
||||||
<MessageBox>{original.sms_message}</MessageBox>
|
<MessageBox>{original.sms_message}</MessageBox>
|
||||||
<MessageBoxActions>
|
<MessageBoxActions>
|
||||||
<ButtonLink onClick={() => safeInvoke(onEditMessageText, original)}>
|
<Button
|
||||||
|
minimal={true}
|
||||||
|
small={true}
|
||||||
|
intent={Intent.NONE}
|
||||||
|
onClick={() => safeInvoke(onEditMessageText, original)}
|
||||||
|
>
|
||||||
{intl.get('sms_messages.label_edit_message')}
|
{intl.get('sms_messages.label_edit_message')}
|
||||||
</ButtonLink>
|
</Button>
|
||||||
</MessageBoxActions>
|
</MessageBoxActions>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -87,7 +91,6 @@ export function useSMSIntegrationTableColumns({ onSwitchChange }) {
|
|||||||
accessor: 'sms_message',
|
accessor: 'sms_message',
|
||||||
Cell: SMSMessageCell,
|
Cell: SMSMessageCell,
|
||||||
className: 'sms_message',
|
className: 'sms_message',
|
||||||
// clickable: true,
|
|
||||||
width: '180',
|
width: '180',
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1446,7 +1446,7 @@
|
|||||||
"sms_messages.label_notification": "Notification",
|
"sms_messages.label_notification": "Notification",
|
||||||
"sms_messages.label_mesage": "Message",
|
"sms_messages.label_mesage": "Message",
|
||||||
"sms_messages.label_auto": "Auto",
|
"sms_messages.label_auto": "Auto",
|
||||||
"sms_messages.label_edit_message": "Edit message",
|
"sms_messages.label_edit_message": "Edit Message",
|
||||||
"sms_messages.notification_switch_change_success_message": "SMS notification hs been enabled successfully.",
|
"sms_messages.notification_switch_change_success_message": "SMS notification hs been enabled successfully.",
|
||||||
"sms_message.dialog.label": "SMS message",
|
"sms_message.dialog.label": "SMS message",
|
||||||
"sms_message.dialog.sms_note": "<strong>Note :</strong> One SMS unit can contain a maximum of 160 characters. <strong>{value}</strong> SMS units will be used to send this SMS notification.",
|
"sms_message.dialog.sms_note": "<strong>Note :</strong> One SMS unit can contain a maximum of 160 characters. <strong>{value}</strong> SMS units will be used to send this SMS notification.",
|
||||||
|
|||||||
Reference in New Issue
Block a user