feat(customer): add contact duplicate.

This commit is contained in:
elforjani3
2021-03-03 16:39:44 +02:00
parent 30f66480d0
commit 7eca87215c
5 changed files with 56 additions and 18 deletions

View File

@@ -29,6 +29,8 @@ function CustomersTable({
// #withAlerts
openAlert,
// #withDialogActions
openDialog,
}) {
const history = useHistory();
@@ -66,6 +68,10 @@ function CustomersTable({
history.push(`/customers/${customer.id}/edit`);
};
const handleContactDuplicate = ({ id }) => {
openDialog('contact-duplicate', { contactId: id });
};
if (isEmptyStatus) {
return <CustomersEmptyStatus />;
}
@@ -95,6 +101,7 @@ function CustomersTable({
payload={{
onDelete: handleCustomerDelete,
onEdit: handleCustomerEdit,
onDuplicate: handleContactDuplicate,
}}
ContextMenu={ActionsMenu}
/>

View File

@@ -18,7 +18,7 @@ import { useIntl } from 'react-intl';
*/
export function ActionsMenu({
row: { original },
payload: { onEdit, onDelete },
payload: { onEdit, onDelete ,onDuplicate },
}) {
const { formatMessage } = useIntl();
@@ -34,6 +34,11 @@ export function ActionsMenu({
text={formatMessage({ id: 'edit_customer' })}
onClick={safeCallback(onEdit, original)}
/>
<MenuItem
icon={<Icon icon="duplicate-18" />}
text={formatMessage({ id: 'duplicate' })}
onClick={safeCallback(onDuplicate, original)}
/>
<MenuItem
icon={<Icon icon="trash-16" iconSize={16} />}
text={formatMessage({ id: 'delete_customer' })}