Merge branch 'feature/notify-via-SMS' of https://github.com/bigcapitalhq/client into feature/notify-via-SMS

This commit is contained in:
a.bouhuolia
2021-11-09 18:19:24 +02:00
10 changed files with 76 additions and 51 deletions

View File

@@ -42,7 +42,7 @@ function NotifyInvoiceViaSMSForm({
// Handle request response success.
const onSuccess = (response) => {
AppToaster.show({
message: intl.get('notify_via_sms.dialog.success_message'),
message: intl.get('notify_invoice_via_sms.dialog.success_message'),
intent: Intent.SUCCESS,
});
setSubmitting(false);

View File

@@ -1,4 +1,5 @@
import React from 'react';
import intl from 'react-intl-universal';
import { Form, useFormikContext } from 'formik';
import styled from 'styled-components';
import { Classes } from '@blueprintjs/core';
@@ -30,7 +31,6 @@ export default function SMSMessageFormContent() {
<FormContent>
<FormFields>
<SMSMessageFormFields />
<SMSMessageVariables>
{messageVariables.map(({ variable, description }) => (
<MessageVariable>
@@ -65,9 +65,12 @@ function SMSMessagePreviewSection() {
<SMSPreviewSectionRoot>
<SMSMessagePreview message={message} />
<SMSPreviewSectionNote>
<strong>Note</strong>: Note: One SMS unit can contain a maximum of 160
characters. <strong>{messagesUnits}</strong> SMS units will be used to
send this SMS notification.
{intl.formatHTMLMessage(
{ id: 'sms_message.dialog.sms_note' },
{
value: messagesUnits,
},
)}
</SMSPreviewSectionNote>
</SMSPreviewSectionRoot>
);

View File

@@ -36,7 +36,7 @@ function SMSMessageFormFloatingActions({
style={{ minWidth: '75px' }}
type="submit"
>
Save SMS Message
<T id={'save_sms_message'} />
</Button>
<Button onClick={handleCancelBtnClick} style={{ minWidth: '75px' }}>
<T id={'cancel'} />

View File

@@ -1,4 +1,5 @@
import React from 'react';
import intl from 'react-intl-universal';
import { castArray, includes } from 'lodash';
import { Formik, Form, useFormikContext } from 'formik';
import styled from 'styled-components';
@@ -36,9 +37,12 @@ function SMSMessagePreviewSection() {
<SMSPreviewSectionRoot>
<SMSMessagePreview message={sms_message} />
<SMSPreviewSectionNote>
<strong>Note</strong>: Note: One SMS unit can contain a maximum of 160
characters. <strong>{messagesUnits}</strong> SMS units will be used to
send this SMS notification.
{intl.formatHTMLMessage(
{ id: 'notiify_via_sms.dialog.sms_note' },
{
value: messagesUnits,
},
)}
</SMSPreviewSectionNote>
</SMSPreviewSectionRoot>
);
@@ -115,14 +119,12 @@ function NotifyViaSMSAlerts({ calloutCodes }) {
return [
includes(calloutCodes, 100) && (
<Callout icon={null} intent={Intent.DANGER}>
The customer phone number does not eixst, please enter a personal phone
number to the customer.
{intl.get('notify_Via_sms.dialog.customer_phone_number_does_not_eixst')}
</Callout>
),
includes(calloutCodes, 200) && (
<Callout icon={null} intent={Intent.DANGER}>
The customer phone number is invalid, please enter a valid personal
phone number to the customer.
{intl.get('notify_Via_sms.dialog.customer_phone_number_invalid')}
</Callout>
),
];

View File

@@ -18,7 +18,7 @@ export default function NotifyViaSMSFormFields({ notificationTypes }) {
<FastField name={'notification_key'}>
{({ form, meta: { error, touched } }) => (
<FormGroup
label={'Notification type'}
label={<T id={'notify_via_sms.dialog.notification_type'} />}
className={classNames(CLASSES.FILL)}
intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name={'customer_name'} />}

View File

@@ -25,7 +25,7 @@ export default function NotifyViaSMSFormFloatingActions({ onCancel }) {
style={{ minWidth: '110px' }}
type="submit"
>
Send SMS
<T id={'send_sms'} />
</Button>
<Button
disabled={isSubmitting}
@@ -37,4 +37,4 @@ export default function NotifyViaSMSFormFloatingActions({ onCancel }) {
</DialogFooterActions>
</div>
);
}
}

View File

@@ -1,4 +1,5 @@
import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components';
import { Intent } from '@blueprintjs/core';
@@ -31,7 +32,9 @@ function SMSMessagesDataTable({
is_notification_enabled: value,
}).then(() => {
AppToaster.show({
message: 'SMS notification hs been enabled successfully.',
message: intl.get(
'sms_messages.notification_switch_change_success_message',
),
intent: Intent.SUCCESS,
});
});

View File

@@ -33,7 +33,7 @@ export const SMSMessageCell = ({
<MessageBox>{original.sms_message}</MessageBox>
<MessageBoxActions>
<ButtonLink onClick={() => safeInvoke(onEditMessageText, original)}>
Edit message
{intl.get('sms_messages.label_edit_message')}
</ButtonLink>
</MessageBoxActions>
</div>
@@ -87,7 +87,7 @@ export function useSMSIntegrationTableColumns({ onSwitchChange }) {
accessor: 'sms_message',
Cell: SMSMessageCell,
className: 'sms_message',
clickable: true,
// clickable: true,
width: '180',
disableSortBy: true,
},