From 4c58e491693f05920e563ae9accad5bd646237f8 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Thu, 11 Nov 2021 17:20:53 +0200 Subject: [PATCH] fix: SMS notification types. --- .../NotifyEstimateViaSMSForm.js | 5 +++-- .../NotifyInvoiceViaSMSForm.js | 21 ++++++++++++------- .../NotifyPaymentReceiveViaSMSForm.js | 7 +++++-- .../NotifyReceiptViaSMSForm.js | 3 ++- .../NotifyViaSMS/NotifyViaSMSFormFields.js | 4 ++-- src/lang/ar/index.json | 7 ++++++- src/lang/en/index.json | 7 ++++++- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/containers/Dialogs/NotifyEstimateViaSMSDialog/NotifyEstimateViaSMSForm.js b/src/containers/Dialogs/NotifyEstimateViaSMSDialog/NotifyEstimateViaSMSForm.js index 30b58a3c5..13bcefe70 100644 --- a/src/containers/Dialogs/NotifyEstimateViaSMSDialog/NotifyEstimateViaSMSForm.js +++ b/src/containers/Dialogs/NotifyEstimateViaSMSDialog/NotifyEstimateViaSMSForm.js @@ -13,7 +13,7 @@ import { compose } from 'utils'; const notificationType = { key: 'sale-estimate-details', - label: 'Sale estimate details', + label: intl.get('sms_notification.estimate_details.type'), }; function NotifyEstimateViaSMSForm({ @@ -60,6 +60,7 @@ function NotifyEstimateViaSMSForm({ const initialValues = { ...estimateSMSDetail, + notification_key: notificationType.key, }; // Handle the form cancel. const handleFormCancel = () => { @@ -69,7 +70,7 @@ function NotifyEstimateViaSMSForm({ return ( { return pick(values, ['notification_key']); }; +// Momerize the notification types. +const notificationTypes = [ + { + key: 'details', + label: intl.get('sms_notification.invoice_details.type'), + }, + { + key: 'reminder', + label: intl.get('sms_notification.invoice_reminder.type'), + }, +]; + /** * Notify Invoice Via SMS Form. */ @@ -80,14 +92,7 @@ function NotifyInvoiceViaSMSForm({ setNotificationType(values.notification_key); } }; - // Momerize the notification types. - const notificationTypes = React.useMemo( - () => [ - { key: 'details', label: 'Invoice details' }, - { key: 'reminder', label: 'Invoice reminder' }, - ], - [], - ); + return ( ({ ...paymentReceiveMSDetail }), + () => ({ + ...paymentReceiveMSDetail, + notification_key: notificationType.key, + }), [paymentReceiveMSDetail], ); diff --git a/src/containers/Dialogs/NotifyReceiptViaSMSDialog/NotifyReceiptViaSMSForm.js b/src/containers/Dialogs/NotifyReceiptViaSMSDialog/NotifyReceiptViaSMSForm.js index 7597b3dcb..185d25301 100644 --- a/src/containers/Dialogs/NotifyReceiptViaSMSDialog/NotifyReceiptViaSMSForm.js +++ b/src/containers/Dialogs/NotifyReceiptViaSMSDialog/NotifyReceiptViaSMSForm.js @@ -13,7 +13,7 @@ import { compose } from 'utils'; const notificationType = { key: 'sale-receipt-details', - label: 'Sale receipt details', + label: intl.get('sms_notification.receipt_details.type'), }; /** @@ -66,6 +66,7 @@ function NotifyReceiptViaSMSForm({ const initialValues = React.useMemo( () => ({ ...receiptSMSDetail, + notification_key: notificationType.key, }), [receiptSMSDetail], ); diff --git a/src/containers/NotifyViaSMS/NotifyViaSMSFormFields.js b/src/containers/NotifyViaSMS/NotifyViaSMSFormFields.js index 3b08b070e..d8dcb4aa0 100644 --- a/src/containers/NotifyViaSMS/NotifyViaSMSFormFields.js +++ b/src/containers/NotifyViaSMS/NotifyViaSMSFormFields.js @@ -16,7 +16,7 @@ export default function NotifyViaSMSFormFields({ notificationTypes }) { return ( - {({ form, meta: { error, touched } }) => ( + {({ form, field: { value }, meta: { error, touched } }) => ( } className={classNames(CLASSES.FILL)} @@ -26,7 +26,7 @@ export default function NotifyViaSMSFormFields({ notificationTypes }) {