added functionality to delete crm customer
parent
adf671bbd9
commit
9380798f96
|
@ -410,6 +410,10 @@
|
|||
"infoQrCode": "Mit dem Smartphone scannen zum Anrufen"
|
||||
}
|
||||
},
|
||||
"popconfirmDeleteCustomer": {
|
||||
"title": "Kunde löschen",
|
||||
"description": "Sind Sie sicher, dass Sie diesen Kunden löschen wollen?"
|
||||
},
|
||||
"logCard": {
|
||||
"popover": {
|
||||
"groupTaskId.title": "Gruppenaufgabe",
|
||||
|
|
|
@ -412,6 +412,10 @@
|
|||
"telephone": "Telephone",
|
||||
"notes": "Notes" ,
|
||||
"infoQrCode": "Scan with your smartphone to call"
|
||||
},
|
||||
"popconfirmDeleteCustomer": {
|
||||
"title": "Delete Customer",
|
||||
"description": "Are you sure you want to delete this customer?"
|
||||
}
|
||||
},
|
||||
"logCard": {
|
||||
|
|
|
@ -56,6 +56,7 @@ export const ReceivedMessagesCommands = {
|
|||
CrmLinkUsed: 52,
|
||||
CrmLinkDeleted: 53,
|
||||
CustomerFeedbackAddFeedback: 54,
|
||||
CrmCustomerDeleted: 55,
|
||||
};
|
||||
|
||||
// commands sent to the backend server
|
||||
|
@ -1125,6 +1126,11 @@ export function handleWebSocketMessage(
|
|||
case ReceivedMessagesCommands.CustomerFeedbackAddFeedback:
|
||||
customerFeedbackContext.setCustomerFeedbacks((arr) => [...arr, body]);
|
||||
break;
|
||||
case ReceivedMessagesCommands.CrmCustomerDeleted:
|
||||
crmContext.setCustomers((arr) =>
|
||||
arr.filter((customer) => customer.Id !== body)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
console.error("unknown command", cmd);
|
||||
break;
|
||||
|
|
|
@ -41,6 +41,7 @@ import {
|
|||
SearchOutlined,
|
||||
PhoneOutlined,
|
||||
DeleteOutlined,
|
||||
QuestionCircleOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { t } from "i18next";
|
||||
import { useCrmContext } from "../../Contexts/CrmContext";
|
||||
|
@ -877,6 +878,30 @@ function CustomerDrawer({ isOpen, setIsOpen, onClose, notificationApi }) {
|
|||
width={720}
|
||||
extra={
|
||||
<Space>
|
||||
<Popconfirm
|
||||
title={t("crm.popconfirmDeleteCustomer.title")}
|
||||
description={t("crm.popconfirmDeleteCustomer.description")}
|
||||
icon={<QuestionCircleOutlined style={{ color: "red" }} />}
|
||||
okText={t("common.button.delete")}
|
||||
cancelText={t("common.button.cancel")}
|
||||
onConfirm={() => {
|
||||
myFetch(
|
||||
`/crm/customer/delete/${crmContext.openDrawerCustomerId.current}`,
|
||||
"DELETE"
|
||||
)
|
||||
.then(() => {
|
||||
handleCloseDrawer();
|
||||
onClose();
|
||||
})
|
||||
.catch((status) => handleRequestError(status));
|
||||
}}
|
||||
okButtonProps={{ danger: true }}
|
||||
>
|
||||
<Button danger icon={<DeleteOutlined />}>
|
||||
Delete
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
|
||||
<CallProtocolModal
|
||||
formDealInfo={formDealInfo}
|
||||
notificationApi={notificationApi}
|
||||
|
|
Loading…
Reference in New Issue