mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop
This commit is contained in:
@@ -27,7 +27,7 @@ export function BalanceSheetAlerts() {
|
|||||||
<Icon icon="info-block" iconSize={12} />{' '}
|
<Icon icon="info-block" iconSize={12} />{' '}
|
||||||
<T id={'just_a_moment_we_re_calculating_your_cost_transactions'} />
|
<T id={'just_a_moment_we_re_calculating_your_cost_transactions'} />
|
||||||
<Button onClick={handleRecalcReport} minimal={true} small={true}>
|
<Button onClick={handleRecalcReport} minimal={true} small={true}>
|
||||||
<T id={'refresh'} />
|
<T id={'report.compute_running.refresh'} />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</If>
|
</If>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import React from 'react';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
import { useSettings, useSettingSMSNotifications } from 'hooks/query';
|
import { useSettings, useSettingSMSNotifications } from 'hooks/query';
|
||||||
import PreferencesPageLoader from '../PreferencesPageLoader';
|
|
||||||
|
|
||||||
const SMSIntegrationContext = React.createContext();
|
const SMSIntegrationContext = React.createContext();
|
||||||
|
|
||||||
@@ -13,13 +12,17 @@ function SMSIntegrationProvider({ ...props }) {
|
|||||||
//Fetches Organization Settings.
|
//Fetches Organization Settings.
|
||||||
const { isLoading: isSettingsLoading } = useSettings();
|
const { isLoading: isSettingsLoading } = useSettings();
|
||||||
|
|
||||||
const { data: notifications, isLoading: isSMSNotificationsLoading } =
|
const {
|
||||||
useSettingSMSNotifications();
|
data: notifications,
|
||||||
|
isLoading: isSMSNotificationsLoading,
|
||||||
|
isFetching: isSMSNotificationsFetching,
|
||||||
|
} = useSettingSMSNotifications();
|
||||||
|
|
||||||
// Provider state.
|
// Provider state.
|
||||||
const provider = {
|
const provider = {
|
||||||
notifications,
|
notifications,
|
||||||
isSMSNotificationsLoading,
|
isSMSNotificationsLoading,
|
||||||
|
isSMSNotificationsFetching,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -24,20 +24,24 @@ function SMSMessagesDataTable({
|
|||||||
const { mutateAsync: editSMSNotificationMutate } =
|
const { mutateAsync: editSMSNotificationMutate } =
|
||||||
useSettingEditSMSNotification();
|
useSettingEditSMSNotification();
|
||||||
|
|
||||||
|
const toggleSmsNotification = (notificationKey, value) => {
|
||||||
|
editSMSNotificationMutate({
|
||||||
|
notification_key: notificationKey,
|
||||||
|
is_notification_enabled: value,
|
||||||
|
}).then(() => {
|
||||||
|
AppToaster.show({
|
||||||
|
message: intl.get(
|
||||||
|
'sms_messages.notification_switch_change_success_message',
|
||||||
|
),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Handle notification switch change.
|
// Handle notification switch change.
|
||||||
const handleNotificationSwitchChange = React.useCallback(
|
const handleNotificationSwitchChange = React.useCallback(
|
||||||
(event, value, notification) => {
|
(event, value, notification) => {
|
||||||
editSMSNotificationMutate({
|
toggleSmsNotification(notification.key, value);
|
||||||
notification_key: notification.key,
|
|
||||||
is_notification_enabled: value,
|
|
||||||
}).then(() => {
|
|
||||||
AppToaster.show({
|
|
||||||
message: intl.get(
|
|
||||||
'sms_messages.notification_switch_change_success_message',
|
|
||||||
),
|
|
||||||
intent: Intent.SUCCESS,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
[editSMSNotificationMutate],
|
[editSMSNotificationMutate],
|
||||||
);
|
);
|
||||||
@@ -47,28 +51,37 @@ function SMSMessagesDataTable({
|
|||||||
onSwitchChange: handleNotificationSwitchChange,
|
onSwitchChange: handleNotificationSwitchChange,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { notifications, isSMSNotificationsLoading } =
|
const {
|
||||||
useSMSIntegrationContext();
|
notifications,
|
||||||
|
isSMSNotificationsLoading,
|
||||||
|
isSMSNotificationsFetching,
|
||||||
|
} = useSMSIntegrationContext();
|
||||||
|
|
||||||
// handle edit message link click
|
// handle edit message link click
|
||||||
const handleEditMessageText = ({ key }) => {
|
const handleEditMessageText = ({ key }) => {
|
||||||
openDialog('sms-message-form', { notificationkey: key });
|
openDialog('sms-message-form', { notificationkey: key });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEnableNotification = () => {};
|
const handleEnableNotification = (notification) => {
|
||||||
|
toggleSmsNotification(notification.key, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDisableNotification = (notification) => {
|
||||||
|
toggleSmsNotification(notification.key, false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SMSNotificationsTable
|
<SMSNotificationsTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={notifications}
|
data={notifications}
|
||||||
loading={isSMSNotificationsLoading}
|
loading={isSMSNotificationsLoading}
|
||||||
progressBarLoading={isSMSNotificationsLoading}
|
progressBarLoading={isSMSNotificationsFetching}
|
||||||
TableLoadingRenderer={TableSkeletonRows}
|
TableLoadingRenderer={TableSkeletonRows}
|
||||||
noInitialFetch={true}
|
|
||||||
ContextMenu={ActionsMenu}
|
ContextMenu={ActionsMenu}
|
||||||
payload={{
|
payload={{
|
||||||
onEditMessageText: handleEditMessageText,
|
onEditMessageText: handleEditMessageText,
|
||||||
onEnableNotification: handleEnableNotification,
|
onEnableNotification: handleEnableNotification,
|
||||||
|
onDisableNotification: handleDisableNotification,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
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 { Intent, Button, Menu, MenuItem } from '@blueprintjs/core';
|
import { Intent, Button, Menu, MenuItem, MenuDivider } from '@blueprintjs/core';
|
||||||
|
|
||||||
import { SwitchFieldCell } from 'components/DataTableCells';
|
import { SwitchFieldCell } from 'components/DataTableCells';
|
||||||
|
|
||||||
import { safeInvoke } from 'utils';
|
import { safeInvoke } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,19 +46,27 @@ export const SMSMessageCell = ({
|
|||||||
* Context menu of SMS notification messages.
|
* Context menu of SMS notification messages.
|
||||||
*/
|
*/
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
payload: { onEditMessageText, onEnableNotification },
|
payload: { onEditMessageText, onEnableNotification, onDisableNotification },
|
||||||
row: { original },
|
row: { original },
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('edit_message_text')}
|
text={intl.get('sms_notifications.edit_message_text')}
|
||||||
onClick={safeInvoke(onEditMessageText, original)}
|
onClick={() => safeInvoke(onEditMessageText, original)}
|
||||||
/>
|
|
||||||
<MenuItem
|
|
||||||
text={intl.get('enable_notification')}
|
|
||||||
onClick={safeInvoke(onEnableNotification, original)}
|
|
||||||
/>
|
/>
|
||||||
|
<MenuDivider />
|
||||||
|
{!original.is_notification_enabled ? (
|
||||||
|
<MenuItem
|
||||||
|
text={intl.get('sms_notifications.enable_notification')}
|
||||||
|
onClick={() => safeInvoke(onEnableNotification, original)}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<MenuItem
|
||||||
|
text={intl.get('sms_notifications.disable_notification')}
|
||||||
|
onClick={() => safeInvoke(onDisableNotification, original)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1445,8 +1445,8 @@
|
|||||||
"notify_via_sms.dialog.notification_type": "نوع الإشعار",
|
"notify_via_sms.dialog.notification_type": "نوع الإشعار",
|
||||||
"notify_via_sms.dialog.notify_via_sms": "إشعار عبر رسائل قصيرة",
|
"notify_via_sms.dialog.notify_via_sms": "إشعار عبر رسائل قصيرة",
|
||||||
"notiify_via_sms.dialog.sms_note": "<strong>ملاحظة :</strong> يمكن أن تحتوي رسالة قصيرة الواحدة على 160 حرفًا كحد أقصى <strong>{value}</strong>. سيتم استخدام وحدات الرسائل القصيرة لإرسال هذا إشعار عبر الرسائل القصيرة. ",
|
"notiify_via_sms.dialog.sms_note": "<strong>ملاحظة :</strong> يمكن أن تحتوي رسالة قصيرة الواحدة على 160 حرفًا كحد أقصى <strong>{value}</strong>. سيتم استخدام وحدات الرسائل القصيرة لإرسال هذا إشعار عبر الرسائل القصيرة. ",
|
||||||
"notify_Via_sms.dialog.customer_phone_number_does_not_eixst": "رقم هاتف العميل غير موجود ، يرجى إدخال رقم هاتف للعميل. ",
|
"notify_Via_sms.dialog.customer_phone_number_does_not_eixst": "رقم هاتف الزبون غير موجود ، يرجى إدخال رقم هاتف للعميل. ",
|
||||||
"notify_Via_sms.dialog.customer_phone_number_invalid": "رقم هاتف العميل غير صالح ، يرجى إدخال رقم هاتف صحيح للعميل. ",
|
"notify_Via_sms.dialog.customer_phone_number_invalid": "رقم هاتف الزبون غير صالح ، يرجى إدخال رقم هاتف صحيح للعميل. ",
|
||||||
"notify_via_sms.dialog.phone_invalid_error_message": "لا يمكن إرسال إشعار الرسائل القصيرة ، رقم الهاتف للعميل غير صالح ، يرجى إدخال رقم صالح والمحاولة مرة أخرى.",
|
"notify_via_sms.dialog.phone_invalid_error_message": "لا يمكن إرسال إشعار الرسائل القصيرة ، رقم الهاتف للعميل غير صالح ، يرجى إدخال رقم صالح والمحاولة مرة أخرى.",
|
||||||
"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": "تم إرسال إشعار فاتورة البيع عبر الرسائل القصيرة بنجاح ",
|
"notify_invoice_via_sms.dialog.success_message": "تم إرسال إشعار فاتورة البيع عبر الرسائل القصيرة بنجاح ",
|
||||||
@@ -1467,9 +1467,11 @@
|
|||||||
"sms_message.dialog.success_message": "تم تحديث إعدادات إشعار الرسائل القصيرة بنجاح. ",
|
"sms_message.dialog.success_message": "تم تحديث إعدادات إشعار الرسائل القصيرة بنجاح. ",
|
||||||
"sms_message.dialog.unsupported_variables_error_message": "متغيرات غير مدعومة",
|
"sms_message.dialog.unsupported_variables_error_message": "متغيرات غير مدعومة",
|
||||||
"sms_message.dialog.message_variable_description": "<strong>{value}</strong> إشارة لاسم الشركة الحالي.",
|
"sms_message.dialog.message_variable_description": "<strong>{value}</strong> إشارة لاسم الشركة الحالي.",
|
||||||
"edit_message_text": "تعديل نص رسالة",
|
"sms_notifications.edit_message_text": "تعديل نص رسالة",
|
||||||
"enable_notification": "تفعيل الإشعارات",
|
"sms_notifications.enable_notification": "تفعيل الإشعارات",
|
||||||
|
"sms_notifications.disable_notification": "تعطيل الإشعارات",
|
||||||
"send_sms": "إرسال رسالة قصيرة",
|
"send_sms": "إرسال رسالة قصيرة",
|
||||||
"save_sms_message": "حفظ رسالة قصيرة",
|
"save_sms_message": "حفظ رسالة قصيرة",
|
||||||
"sms_message.edit_form.reset_to_default_message": "إعادة التعيين إلى الرسالة الافتراضية."
|
"sms_message.edit_form.reset_to_default_message": "إعادة التعيين إلى الرسالة الافتراضية.",
|
||||||
|
"report.compute_running.refresh": "تحديث"
|
||||||
}
|
}
|
||||||
@@ -1454,9 +1454,11 @@
|
|||||||
"sms_message.dialog.success_message": "Sms notification settings has been updated successfully.",
|
"sms_message.dialog.success_message": "Sms notification settings has been updated successfully.",
|
||||||
"sms_message.dialog.unsupported_variables_error_message": "Unsupported variables",
|
"sms_message.dialog.unsupported_variables_error_message": "Unsupported variables",
|
||||||
"sms_message.dialog.message_variable_description": "<strong>{value}</strong> References to the current company name.",
|
"sms_message.dialog.message_variable_description": "<strong>{value}</strong> References to the current company name.",
|
||||||
"edit_message_text": "Edit message text",
|
"sms_notifications.edit_message_text": "Edit message text",
|
||||||
"enable_notification": "Enable notification",
|
"sms_notifications.enable_notification": "Enable notification",
|
||||||
|
"sms_notifications.disable_notification": "Disable notification",
|
||||||
"send_sms": "Send SMS",
|
"send_sms": "Send SMS",
|
||||||
"save_sms_message": "Save SMS Message",
|
"save_sms_message": "Save SMS Message",
|
||||||
"sms_message.edit_form.reset_to_default_message": "Reset to default message."
|
"sms_message.edit_form.reset_to_default_message": "Reset to default message.",
|
||||||
|
"report.compute_running.refresh": "Refresh"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user