diff --git a/plugins/contact-resources/src/components/DeleteConfirmationPopup.svelte b/plugins/contact-resources/src/components/DeleteConfirmationPopup.svelte new file mode 100644 index 0000000000..c2fecefc38 --- /dev/null +++ b/plugins/contact-resources/src/components/DeleteConfirmationPopup.svelte @@ -0,0 +1,77 @@ + + + + dispatch('close')}> + + {#if canDelete} + + + + {:else} + + + + + + {#each creators as employee} + + + + {/each} + + + + {#each owners as employee} + + + + {/each} + + {/if} + + diff --git a/plugins/contact-resources/src/index.ts b/plugins/contact-resources/src/index.ts index 27d57ee6f0..d9e1acbe7f 100644 --- a/plugins/contact-resources/src/index.ts +++ b/plugins/contact-resources/src/index.ts @@ -78,6 +78,7 @@ import UserBoxItems from './components/UserBoxItems.svelte' import EmployeeFilter from './components/EmployeeFilter.svelte' import EmployeeFilterValuePresenter from './components/EmployeeFilterValuePresenter.svelte' import EmployeeAccountFilterValuePresenter from './components/EmployeeAccountFilterValuePresenter.svelte' +import DeleteConfirmationPopup from './components/DeleteConfirmationPopup.svelte' import contact from './plugin' import { @@ -298,7 +299,8 @@ export default async (): Promise => ({ UserBoxItems, EmployeeFilter, EmployeeFilterValuePresenter, - EmployeeAccountFilterValuePresenter + EmployeeAccountFilterValuePresenter, + DeleteConfirmationPopup }, completion: { EmployeeQuery: async ( diff --git a/plugins/contact/src/index.ts b/plugins/contact/src/index.ts index 7d4cdd61d8..5bb14f4378 100644 --- a/plugins/contact/src/index.ts +++ b/plugins/contact/src/index.ts @@ -195,7 +195,8 @@ export const contactPlugin = plugin(contactId, { Avatar: '' as AnyComponent, UserBoxList: '' as AnyComponent, ChannelPresenter: '' as AnyComponent, - SpaceMembers: '' as AnyComponent + SpaceMembers: '' as AnyComponent, + DeleteConfirmationPopup: '' as AnyComponent }, channelProvider: { Email: '' as Ref, diff --git a/plugins/view-assets/lang/en.json b/plugins/view-assets/lang/en.json index a34784cd62..5795aa08b0 100644 --- a/plugins/view-assets/lang/en.json +++ b/plugins/view-assets/lang/en.json @@ -13,7 +13,11 @@ "Table": "Table", "Role": "Role", "DeleteObject": "Delete object", - "DeleteObjectConfirm": "Do you want to delete this {count, plural, =1 {object} other {# objects}}?", + "DeleteObjectConfirm": "Do you want to delete {count, plural, =1 {this object} other {these # objects}}?", + "DeletePopupNoPermissionTitle": "Not enough permissions to delete.", + "DeletePopupNoPermissionLabel": "Please contact people from the list below for them to do so.", + "DeletePopupCreatorLabel": "Creators (can delete only ones that were created by them):", + "DeletePopupOwnerLabel": "Owners (can delete all of them):", "Archive": "Archive", "ArchiveConfirm": "Do you want to archive this {count, plural, =1 {object} other {# objects}}?", "Open": "Open", diff --git a/plugins/view-assets/lang/ru.json b/plugins/view-assets/lang/ru.json index 06f2fe2068..629c938615 100644 --- a/plugins/view-assets/lang/ru.json +++ b/plugins/view-assets/lang/ru.json @@ -14,6 +14,10 @@ "Role": "Роль", "DeleteObject": "Удалить объект", "DeleteObjectConfirm": "Вы действительно хотите удалить {count, plural, =1 {этот объект} other {эти # объекта}}?", + "DeletePopupNoPermissionTitle": "Недостаточно прав для удаления.", + "DeletePopupNoPermissionLabel": "Пожалуйста обратитесь к людям из списка ниже, чтобы они это сделали.", + "DeletePopupCreatorLabel": "Создатели объектов (могут удалить лишь те, что были созданы ими):", + "DeletePopupOwnerLabel": "Владельцы (могут удалить все):", "Archive": "Архивировать", "ArchiveConfirm": "Вы действительно хотите заархивировать {count, plural, =1 {этот объект} other {эти # объекта}}?", "Open": "Открыть", diff --git a/plugins/view-resources/src/actionImpl.ts b/plugins/view-resources/src/actionImpl.ts index 78c53b9c63..2d3d7cc16a 100644 --- a/plugins/view-resources/src/actionImpl.ts +++ b/plugins/view-resources/src/actionImpl.ts @@ -17,6 +17,7 @@ import { ContextStore, contextStore } from './context' import view from './plugin' import { FocusSelection, SelectDirection, focusStore, previewDocument, selectionStore } from './selection' import { deleteObjects, getObjectLinkFragment } from './utils' +import contact from '@hcengineering/contact' /** * Action to be used for copying text to clipboard. @@ -55,12 +56,10 @@ async function CopyTextToClipboard ( function Delete (object: Doc | Doc[]): void { showPopup( - MessageBox, + contact.component.DeleteConfirmationPopup, { - label: view.string.DeleteObject, - message: view.string.DeleteObjectConfirm, - params: { count: Array.isArray(object) ? object.length : 1 }, - action: async () => { + object, + deleteAction: async () => { const objs = Array.isArray(object) ? object : [object] await deleteObjects(getClient(), objs).catch((err) => console.error(err)) } diff --git a/plugins/view-resources/src/plugin.ts b/plugins/view-resources/src/plugin.ts index ab94d8e6ca..981db35773 100644 --- a/plugins/view-resources/src/plugin.ts +++ b/plugins/view-resources/src/plugin.ts @@ -36,6 +36,10 @@ export default mergeIds(viewId, view, { ChooseAColor: '' as IntlString, DeleteObject: '' as IntlString, DeleteObjectConfirm: '' as IntlString, + DeletePopupNoPermissionTitle: '' as IntlString, + DeletePopupNoPermissionLabel: '' as IntlString, + DeletePopupCreatorLabel: '' as IntlString, + DeletePopupOwnerLabel: '' as IntlString, Archive: '' as IntlString, ArchiveConfirm: '' as IntlString, Assignees: '' as IntlString,