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. // Handle request response success.
const onSuccess = (response) => { const onSuccess = (response) => {
AppToaster.show({ AppToaster.show({
message: intl.get('notify_via_sms.dialog.success_message'), message: intl.get('notify_invoice_via_sms.dialog.success_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
setSubmitting(false); setSubmitting(false);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1442,24 +1442,33 @@
"bad_debt.cancel_alert.message": "هل أنت متأكد أنك تريد شطب هذه الفاتورة؟ ", "bad_debt.cancel_alert.message": "هل أنت متأكد أنك تريد شطب هذه الفاتورة؟ ",
"notify_via_sms.dialog.send_notification_to":"إرسال إشعار إلى ", "notify_via_sms.dialog.send_notification_to":"إرسال إشعار إلى ",
"notify_via_sms.dialog.message_text":"نص رسالة ", "notify_via_sms.dialog.message_text":"نص رسالة ",
"notify_via_sms.dialog.notification_type": "Notification type",
"notify_via_sms.dialog.notify_via_sms":"Notify vis SMS", "notify_via_sms.dialog.notify_via_sms":"Notify vis SMS",
"notify_via_sms.dialog.error_message":"Notify vis SMS", "notiify_via_sms.dialog.sms_note": "<strong>Note :</strong> One SMS unit can contain amaximum of 160 characters. <strong>{value}</strong> SMS units will be used to send this SMS notification.",
"notify_via_sms.dialog.phone_invalid_error_message":"Sms notification cannot be sent, customer personal phone number is invalid, please enter a valid one and try again.", "notify_Via_sms.dialog.customer_phone_number_does_not_eixst": "The customer phone number does not eixst, please enter a personal phone number to the customer.",
"notify_Via_sms.dialog.customer_phone_number_invalid": "The customer phone number is invalid, please enter a valid personal phone number to the customer.",
"notify_via_sms.dialog.phone_invalid_error_message":"Sms notification cannot be sent, customer personal phone number is invalid, please enter a valid one and try again.",
"notify_via_sms.dialog.customer_no_phone_error_message":"الزبون ليس لديه رقم هاتف.", "notify_via_sms.dialog.customer_no_phone_error_message":"الزبون ليس لديه رقم هاتف.",
"notify_invoice_via_sms.dialog.success_message":"The sale invoice sms notification has been sent successfully", "notify_invoice_via_sms.dialog.success_message":"The sale invoice sms notification has been sent successfully",
"notify_estimate_via_sms.dialog.success_message":"تم إرسال إشعار الرسائل القصيرة الخاصة بتقدير المبيعات بنجاح. ", "notify_estimate_via_sms.dialog.success_message":"تم إرسال إشعار الرسائل القصيرة الخاصة بتقدير المبيعات بنجاح. ",
"notify_receipt_via_sms.dialog.success_message":"The sale receipt sms notification has been sent successfully", "notify_receipt_via_sms.dialog.success_message":"The sale receipt sms notification has been sent successfully",
"notify_payment_receive_via_sms.dialog.success_message":"تم إرسال إشعار الدفع بنجاح. ", "notify_payment_receive_via_sms.dialog.success_message":"تم إرسال إشعار الدفع بنجاح. ",
"send": "إرسال",
"sms_integration.label":"SMS Integration", "sms_integration.label":"SMS Integration",
"sms_integration.label.overview":"نظرة عامة", "sms_integration.label.overview":"Overview",
"sms_integration.label.sms_messages":"رسائل SMS ", "sms_integration.label.sms_messages":"SMS Messages ",
"sms_message.label.sms_messages_template":" إشعارات رسائل قصيرة ",
"sms_messages.label_mesage":"رسالة ", "sms_messages.label_mesage":"رسالة ",
"sms_messages.label_notification":"إشعار", "sms_messages.label_notification":"إشعار",
"sms_messages.label_auto":"Auto", "sms_messages.label_auto":"Auto",
"sms_message":"رسالة SMS" , "sms_messages.label_edit_message": "Edit message",
"sms_message.dialog.success_message":"Sms notification settings has been updated successfully.", "sms_messages.notification_switch_change_success_message":"SMS notification hs been enabled successfully.",
"sms_message.dialog.label": "SMS message",
"sms_message.dialog.sms_note": "<strong>Note :</strong> One SMS unit can contain amaximum of 160 characters. <strong>{value}</strong> SMS units will be used to send this SMS notification.",
"sms_message.dialog.success_message": "Sms notification settings has been updated successfully.",
"sms_message.dialog.unsupported_variables_error_message": "Unsupported variables",
"sms_message.dialog.message_variable_description":"<strong>{value}</strong> References to the current company name.",
"edit_message_text":"تعديل نص رسالة", "edit_message_text":"تعديل نص رسالة",
"enable_notification":"تفعيل الإشعارات" "enable_notification":"تفعيل الإشعارات",
"send_sms":"Send SMS",
"save_sms_message":"Save SMS Message"
} }

View File

@@ -1427,26 +1427,34 @@
"bad_debt.dialog.success_message": "The given sale invoice has been writte-off successfully.", "bad_debt.dialog.success_message": "The given sale invoice has been writte-off successfully.",
"bad_debt.cancel_alert.success_message": "The given sale invoice has been canceled write-off successfully.", "bad_debt.cancel_alert.success_message": "The given sale invoice has been canceled write-off successfully.",
"bad_debt.cancel_alert.message": "Are you sure you want to write off this invoice?", "bad_debt.cancel_alert.message": "Are you sure you want to write off this invoice?",
"notify_via_sms.dialog.send_notification_to":"Send notification to", "notify_via_sms.dialog.send_notification_to": "Send notification to",
"notify_via_sms.dialog.message_text":"Message Text", "notify_via_sms.dialog.message_text": "Message Text",
"notify_via_sms.dialog.notify_via_sms":"Notify vis SMS", "notify_via_sms.dialog.notification_type": "Notification type",
"notify_via_sms.dialog.phone_invalid_error_message":"Sms notification cannot be sent, customer personal phone number is invalid, please enter a valid one and try again.", "notify_via_sms.dialog.notify_via_sms": "Notify vis SMS",
"notify_via_sms.dialog.customer_no_phone_error_message":"The customer has no phone number.", "notiify_via_sms.dialog.sms_note": "<strong>Note :</strong> One SMS unit can contain amaximum of 160 characters. <strong>{value}</strong> SMS units will be used to send this SMS notification.",
"notify_invoice_via_sms.dialog.success_message":"The sale invoice sms notification has been sent successfully", "notify_Via_sms.dialog.customer_phone_number_does_not_eixst": "The customer phone number does not eixst, please enter a personal phone number to the customer.",
"notify_estimate_via_sms.dialog.success_message":"The sale estimate sms notification has been sent successfully", "notify_Via_sms.dialog.customer_phone_number_invalid": "The customer phone number is invalid, please enter a valid personal phone number to the customer.",
"notify_receipt_via_sms.dialog.success_message":"The sale receipt sms notification has been sent successfully", "notify_via_sms.dialog.phone_invalid_error_message": "Sms notification cannot be sent, customer personal phone number is invalid, please enter a valid one and try again.",
"notify_payment_receive_via_sms.dialog.success_message":"The payment notification has been sent successfully.", "notify_via_sms.dialog.customer_no_phone_error_message": "The customer has no phone number.",
"send": "Send", "notify_invoice_via_sms.dialog.success_message": "The sale invoice sms notification has been sent successfully.",
"sms_integration.label":"SMS Integration", "notify_estimate_via_sms.dialog.success_message": "The sale estimate sms notification has been sent successfully",
"sms_integration.label.overview":"Overview", "notify_receipt_via_sms.dialog.success_message": "The sale receipt sms notification has been sent successfully",
"sms_integration.label.sms_messages":"SMS Messages", "notify_payment_receive_via_sms.dialog.success_message": "The payment notification has been sent successfully.",
"sms_messages.label_notification":"Notification", "sms_integration.label": "SMS Integration",
"sms_messages.label_mesage":"Message", "sms_integration.label.overview": "Overview",
"sms_messages.label_auto":"Auto", "sms_integration.label.sms_messages": "SMS Messages",
"sms_message.dialog.label":"SMS message", "sms_messages.label_notification": "Notification",
"sms_message.dialog.success_message":"Sms notification settings has been updated successfully.", "sms_messages.label_mesage": "Message",
"sms_message.dialog.unsupported_variables_error_message":"Unsupported variables", "sms_messages.label_auto": "Auto",
"edit_message_text":"Edit message text", "sms_messages.label_edit_message": "Edit message",
"enable_notification":"Enable notification" "sms_messages.notification_switch_change_success_message": "SMS notification hs been enabled successfully.",
"sms_message.dialog.label": "SMS message",
"sms_message.dialog.sms_note": "<strong>Note :</strong> One SMS unit can contain amaximum of 160 characters. <strong>{value}</strong> SMS units will be used to send this SMS notification.",
"sms_message.dialog.success_message": "Sms notification settings has been updated successfully.",
"sms_message.dialog.unsupported_variables_error_message": "Unsupported variables",
"sms_message.dialog.message_variable_description": "<strong>{value}</strong> References to the current company name.",
"edit_message_text": "Edit message text",
"enable_notification": "Enable notification",
"send_sms": "Send SMS",
"save_sms_message": "Save SMS Message"
} }