diff --git a/client/src/containers/Alerts/Contacts/ContactActivateAlert.js b/client/src/containers/Alerts/Contacts/ContactActivateAlert.js
new file mode 100644
index 000000000..965ed7384
--- /dev/null
+++ b/client/src/containers/Alerts/Contacts/ContactActivateAlert.js
@@ -0,0 +1,67 @@
+import React from 'react';
+import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
+import { Intent, Alert } from '@blueprintjs/core';
+import { AppToaster } from 'components';
+
+import { useActivateContact } from 'hooks/query';
+
+import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
+import withAlertActions from 'containers/Alert/withAlertActions';
+
+import { compose } from 'utils';
+
+/**
+ * Contact activate alert.
+ */
+function ContactActivateAlert({
+ name,
+
+ // #withAlertStoreConnect
+ isOpen,
+ payload: { contactId, service },
+
+ // #withAlertActions
+ closeAlert,
+}) {
+ const { mutateAsync: activateContact, isLoading } = useActivateContact();
+
+ // Handle activate contact alert cancel.
+ const handleCancelActivateContact = () => {
+ closeAlert(name);
+ };
+
+ // Handle confirm contact activated.
+ const handleConfirmContactActivate = () => {
+ activateContact(contactId)
+ .then(() => {
+ AppToaster.show({
+ message: intl.get('the_contact_has_been_activated_successfully'),
+ intent: Intent.SUCCESS,
+ });
+ })
+ .catch((error) => {})
+ .finally(() => {
+ closeAlert(name);
+ });
+ };
+
+ return (
+ }
+ confirmButtonText={}
+ intent={Intent.WARNING}
+ isOpen={isOpen}
+ onCancel={handleCancelActivateContact}
+ loading={isLoading}
+ onConfirm={handleConfirmContactActivate}
+ >
+
{intl.get('are_sure_to_activate_this_contact')}
+
+ );
+}
+
+export default compose(
+ withAlertStoreConnect(),
+ withAlertActions,
+)(ContactActivateAlert);
diff --git a/client/src/containers/Alerts/Contacts/ContactInactivateAlert.js b/client/src/containers/Alerts/Contacts/ContactInactivateAlert.js
new file mode 100644
index 000000000..d0961c424
--- /dev/null
+++ b/client/src/containers/Alerts/Contacts/ContactInactivateAlert.js
@@ -0,0 +1,70 @@
+import React from 'react';
+import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
+import { Intent, Alert } from '@blueprintjs/core';
+import { AppToaster } from 'components';
+
+import { useInactivateContact } from 'hooks/query';
+
+import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
+import withAlertActions from 'containers/Alert/withAlertActions';
+
+import { compose } from 'utils';
+
+/**
+ * Contact inactivate alert.
+ */
+function ContactInactivateAlert({
+ name,
+ // #withAlertStoreConnect
+ isOpen,
+ payload: { contactId, service },
+
+ // #withAlertActions
+ closeAlert,
+}) {
+ const { mutateAsync: inactivateContact, isLoading } = useInactivateContact();
+
+ // Handle cancel inactivate alert.
+ const handleCancelInactivateContact = () => {
+ closeAlert(name);
+ };
+
+ // Handle confirm contact Inactive.
+ const handleConfirmContactInactive = () => {
+ inactivateContact(contactId)
+ .then(() => {
+ AppToaster.show({
+ message: intl.get('the_contact_has_been_inactivated_successfully'),
+ intent: Intent.SUCCESS,
+ });
+ })
+ .catch((error) => {})
+ .finally(() => {
+ closeAlert(name);
+ });
+ };
+
+ return (
+ }
+ confirmButtonText={}
+ intent={Intent.WARNING}
+ isOpen={isOpen}
+ onCancel={handleCancelInactivateContact}
+ onConfirm={handleConfirmContactInactive}
+ loading={isLoading}
+ >
+
+ {intl.get('are_sure_to_inactive_this_contact', {
+ name: service,
+ })}
+
+
+ );
+}
+
+export default compose(
+ withAlertStoreConnect(),
+ withAlertActions,
+)(ContactInactivateAlert);
diff --git a/client/src/containers/Customers/CustomersAlerts.js b/client/src/containers/Customers/CustomersAlerts.js
index d56acb26c..6a51cd7a0 100644
--- a/client/src/containers/Customers/CustomersAlerts.js
+++ b/client/src/containers/Customers/CustomersAlerts.js
@@ -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 (
+
+
{/* */}
);
diff --git a/client/src/containers/Customers/CustomersLanding/CustomersTable.js b/client/src/containers/Customers/CustomersLanding/CustomersTable.js
index 817718599..cef76a13a 100644
--- a/client/src/containers/Customers/CustomersLanding/CustomersTable.js
+++ b/client/src/containers/Customers/CustomersLanding/CustomersTable.js
@@ -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 ;
}
@@ -102,6 +115,8 @@ function CustomersTable({
onDelete: handleCustomerDelete,
onEdit: handleCustomerEdit,
onDuplicate: handleContactDuplicate,
+ onInactivate: handleInactiveCustomer,
+ onActivate: handleActivateCustomer,
}}
ContextMenu={ActionsMenu}
/>
diff --git a/client/src/containers/Customers/CustomersLanding/components.js b/client/src/containers/Customers/CustomersLanding/components.js
index 8db27dc6c..fa6f05064 100644
--- a/client/src/containers/Customers/CustomersLanding/components.js
+++ b/client/src/containers/Customers/CustomersLanding/components.js
@@ -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 (