mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: add context menu in sms message table.
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Menu, MenuItem, MenuDivider } from '@blueprintjs/core';
|
||||
import { SwitchFieldCell } from 'components/DataTableCells';
|
||||
import { safeCallback } from 'utils';
|
||||
|
||||
export function ActionsMenu({
|
||||
payload: { onEditMessageText, onEnableNotification },
|
||||
row: { original },
|
||||
}) {
|
||||
return (
|
||||
<Menu>
|
||||
<MenuItem
|
||||
text={intl.get('edit_message_text')}
|
||||
onClick={safeCallback(onEditMessageText, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
text={intl.get('enable_notification')}
|
||||
onClick={safeCallback(onEnableNotification, original)}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification accessor.
|
||||
*/
|
||||
@@ -18,14 +37,14 @@ export const NotificationAccessor = (row) => {
|
||||
};
|
||||
|
||||
export const SMSMessageCell = ({
|
||||
payload: { onEditSMSMessage },
|
||||
payload: { onEditMessageText },
|
||||
row: { original },
|
||||
}) => (
|
||||
<div>
|
||||
{original.sms_message}
|
||||
<span
|
||||
className="edit-text"
|
||||
onClick={safeCallback(onEditSMSMessage, original)}
|
||||
onClick={safeCallback(onEditMessageText, original)}
|
||||
>
|
||||
{'Edit'}
|
||||
</span>
|
||||
@@ -35,7 +54,7 @@ export const SMSMessageCell = ({
|
||||
export function useSMSIntegrationTableColumns() {
|
||||
return React.useMemo(() => [
|
||||
{
|
||||
Header: intl.get('sms_message.label_Notification'),
|
||||
Header: intl.get('sms_messages.label_notification'),
|
||||
accessor: NotificationAccessor,
|
||||
className: 'notification',
|
||||
width: '180',
|
||||
@@ -49,7 +68,7 @@ export function useSMSIntegrationTableColumns() {
|
||||
disableSortBy: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('sms_message.label_mesage'),
|
||||
Header: intl.get('sms_messages.label_mesage'),
|
||||
accessor: 'sms_message',
|
||||
Cell: SMSMessageCell,
|
||||
className: 'sms_message',
|
||||
@@ -58,7 +77,7 @@ export function useSMSIntegrationTableColumns() {
|
||||
disableSortBy: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('sms_message.label_auto'),
|
||||
Header: intl.get('sms_messages.label_auto'),
|
||||
accessor: 'is_notification_enabled',
|
||||
Cell: SwitchFieldCell,
|
||||
className: 'is_notification_enabled',
|
||||
|
||||
Reference in New Issue
Block a user