mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: Contact activate & inactivate.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import CustomerDeleteAlert from 'containers/Alerts/Customers/CustomerDeleteAlert';
|
||||
// import CustomerBulkDeleteAlert from 'containers/Alerts/Customers/CustomerBulkDeleteAlert';
|
||||
import ContactActivateAlert from '../../containers/Alerts/Contacts/ContactActivateAlert';
|
||||
import ContactInactivateAlert from '../../containers/Alerts/Contacts/ContactInactivateAlert';
|
||||
|
||||
/**
|
||||
* Customers alert.
|
||||
@@ -9,6 +11,8 @@ export default function ItemsAlerts() {
|
||||
return (
|
||||
<div>
|
||||
<CustomerDeleteAlert name={'customer-delete'} />
|
||||
<ContactActivateAlert name={'contact-activate'} />
|
||||
<ContactInactivateAlert name={'contact-inactivate'} />
|
||||
{/* <CustomerBulkDeleteAlert name={'customers-bulk-delete'} /> */}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -72,6 +72,19 @@ function CustomersTable({
|
||||
openDialog('contact-duplicate', { contactId: id });
|
||||
};
|
||||
|
||||
// Handle cancel/confirm inactive.
|
||||
const handleInactiveCustomer = ({ id, contact_service }) => {
|
||||
openAlert('contact-inactivate', {
|
||||
contactId: id,
|
||||
service: contact_service,
|
||||
});
|
||||
};
|
||||
|
||||
// Handle cancel/confirm activate.
|
||||
const handleActivateCustomer = ({ id, contact_service }) => {
|
||||
openAlert('contact-activate', { contactId: id, service: contact_service });
|
||||
};
|
||||
|
||||
if (isEmptyStatus) {
|
||||
return <CustomersEmptyStatus />;
|
||||
}
|
||||
@@ -102,6 +115,8 @@ function CustomersTable({
|
||||
onDelete: handleCustomerDelete,
|
||||
onEdit: handleCustomerEdit,
|
||||
onDuplicate: handleContactDuplicate,
|
||||
onInactivate: handleInactiveCustomer,
|
||||
onActivate: handleActivateCustomer,
|
||||
}}
|
||||
ContextMenu={ActionsMenu}
|
||||
/>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Position,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import { Icon, Money } from 'components';
|
||||
import { Icon, Money, If } from 'components';
|
||||
import { safeCallback } from 'utils';
|
||||
import { firstLettersArgs } from 'utils';
|
||||
import intl from 'react-intl-universal';
|
||||
@@ -18,10 +18,8 @@ import intl from 'react-intl-universal';
|
||||
*/
|
||||
export function ActionsMenu({
|
||||
row: { original },
|
||||
payload: { onEdit, onDelete, onDuplicate },
|
||||
payload: { onEdit, onDelete, onDuplicate, onInactivate, onActivate },
|
||||
}) {
|
||||
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<MenuItem
|
||||
@@ -39,6 +37,20 @@ export function ActionsMenu({
|
||||
text={intl.get('duplicate')}
|
||||
onClick={safeCallback(onDuplicate, original)}
|
||||
/>
|
||||
<If condition={original.active}>
|
||||
<MenuItem
|
||||
text={intl.get('inactivate_item')}
|
||||
icon={<Icon icon="pause-16" iconSize={16} />}
|
||||
onClick={safeCallback(onInactivate, original)}
|
||||
/>
|
||||
</If>
|
||||
<If condition={!original.active}>
|
||||
<MenuItem
|
||||
text={intl.get('activate_item')}
|
||||
icon={<Icon icon="play-16" iconSize={16} />}
|
||||
onClick={safeCallback(onActivate, original)}
|
||||
/>
|
||||
</If>
|
||||
<MenuItem
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
text={intl.get('delete_customer')}
|
||||
@@ -74,8 +86,6 @@ export function BalanceAccessor(row) {
|
||||
* Retrieve customers table columns.
|
||||
*/
|
||||
export function useCustomersTableColumns() {
|
||||
|
||||
|
||||
return useMemo(
|
||||
() => [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user