Skip to content

Commit

Permalink
feature: add deletion messagings[WTEL-3529]
Browse files Browse the repository at this point in the history
  • Loading branch information
Lera24 committed Mar 25, 2024
1 parent 2e7eb87 commit 4b254c1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/modules/contacts/modules/messaging/api/MessagingAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ const getList = async (params) => {
}
};

const deleteItem = async ({ id, parentId }) => {
try {
const response = await service.deleteIMClient(parentId, id);
return applyTransform(response.data, [
]);
} catch (err) {
throw applyTransform(err, [
notify,
]);
}
};

export default {
getList,
delete: deleteItem,
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<template>
<div class="contact-communication-tab">

<delete-confirmation-popup
v-if="isConfirmationPopup"
:callback="deleteCallback"
:delete-count="deleteCount"
@close="closeDelete"
/>

<wt-loader v-show="isLoading" />

<wt-dummy
Expand Down Expand Up @@ -31,6 +38,16 @@
<template #app="{ item }">
{{ item.app.name }}
</template>
<template #actions="{ item }">
<wt-icon-action
:disabled="!access.hasRbacEditAccess"
action="delete"
@click="askDeleteConfirmation({
deleted: item,
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
</div>
</div>
Expand All @@ -42,6 +59,11 @@ import { useI18n } from 'vue-i18n';
import { useStore } from 'vuex';
import { useTableFilters } from '@webitel/ui-sdk/src/modules/Filters/composables/useTableFilters';
import { useTableStore } from '@webitel/ui-sdk/src/modules/TableStoreModule/composables/useTableStore';
import DeleteConfirmationPopup
from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue';
import {
useDeleteConfirmationPopup
} from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup';
import ChatGatewayProvider
from '@webitel/ui-sdk/src/enums/ChatGatewayProvider/ChatGatewayProvider.enum';
import dummyLight from '../assets/messaging-dummy-light.svg';
Expand All @@ -67,11 +89,21 @@ const {
headers,
error,
deleteData,
sort,
} = useTableStore(props.namespace);
const { filtersNamespace } = useTableFilters(namespace);
const {
isVisible: isConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
const showDummy = computed(() => !dataList.value.length);
const darkMode = computed(() => store.getters['appearance/DARK_MODE']);
Expand Down

0 comments on commit 4b254c1

Please sign in to comment.