From 1a1b978f82496ca6f264da643e2862f356c3cfaf Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 6 Mar 2024 12:01:05 +0400 Subject: [PATCH] UBERF-5827: add collaborative description for companies (#4851) Signed-off-by: Kristina Fefelova --- models/contact/src/index.ts | 33 +++- models/recruit/src/review.ts | 4 - .../src/components/CreateOrganization.svelte | 70 +++++++- .../components/EditOrganizationPanel.svelte | 163 ++++++++++++++++++ .../components/OrganizationPresenter.svelte | 12 +- plugins/contact-resources/src/index.ts | 4 +- plugins/contact-resources/src/utils.ts | 11 +- plugins/contact/src/index.ts | 4 +- plugins/recruit-resources/src/utils.ts | 3 +- .../src/components/EditDoc.svelte | 66 ++----- plugins/view-resources/src/utils.ts | 72 +++++++- 11 files changed, 365 insertions(+), 77 deletions(-) create mode 100644 plugins/contact-resources/src/components/EditOrganizationPanel.svelte diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 9ccd46a98f..eb6d887e0e 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -40,7 +40,8 @@ import { type Class, type Domain, type Ref, - type Timestamp + type Timestamp, + type Markup } from '@hcengineering/core' import { Collection, @@ -57,7 +58,8 @@ import { TypeString, TypeTimestamp, UX, - type Builder + type Builder, + TypeCollaborativeMarkup } from '@hcengineering/model' import attachment from '@hcengineering/model-attachment' import chunter from '@hcengineering/model-chunter' @@ -156,6 +158,10 @@ export class TMember extends TAttachedDoc implements Member { @Model(contact.class.Organization, contact.class.Contact) @UX(contact.string.Organization, contact.icon.Company, 'ORG', 'name') export class TOrganization extends TContact implements Organization { + @Prop(TypeCollaborativeMarkup(), core.string.Description) + @Index(IndexKind.FullText) + description?: Markup + @Prop(Collection(contact.class.Member), contact.string.Members) members!: number } @@ -771,6 +777,29 @@ export function createModel (builder: Builder): void { filters: [] }) + builder.mixin(contact.class.Organization, core.class.Class, view.mixin.ObjectPanel, { + component: contact.component.EditOrganizationPanel + }) + + createAction(builder, { + label: view.string.Open, + icon: view.icon.Open, + action: view.actionImpl.ShowPanel, + actionProps: { + component: contact.component.EditOrganizationPanel, + element: 'content' + }, + input: 'focus', + category: contact.category.Contact, + override: [view.action.Open], + keyBinding: ['keyE'], + target: contact.class.Organization, + context: { + mode: ['context', 'browser'], + group: 'create' + } + }) + builder.mixin(contact.class.Channel, core.class.Class, view.mixin.AttributeFilter, { component: contact.component.ChannelFilter }) diff --git a/models/recruit/src/review.ts b/models/recruit/src/review.ts index 4d2290dfe3..7845452c24 100644 --- a/models/recruit/src/review.ts +++ b/models/recruit/src/review.ts @@ -70,10 +70,6 @@ export function createReviewModel (builder: Builder): void { presenter: recruit.component.OpinionPresenter }) - builder.mixin(recruit.class.Review, core.class.Class, view.mixin.ObjectEditor, { - editor: recruit.component.EditReview - }) - createAction(builder, { action: view.actionImpl.ShowPopup, actionProps: { diff --git a/plugins/contact-resources/src/components/CreateOrganization.svelte b/plugins/contact-resources/src/components/CreateOrganization.svelte index 8248c01c42..46274ea2e1 100644 --- a/plugins/contact-resources/src/components/CreateOrganization.svelte +++ b/plugins/contact-resources/src/components/CreateOrganization.svelte @@ -14,10 +14,13 @@ --> @@ -80,13 +91,14 @@ 0} on:close={() => { dispatch('close') }} on:changeContent > -
+
@@ -98,6 +110,29 @@ focusIndex={1} />
+ + { + if (ev.detail.size > 0) attachments = ev.detail.values + else if (ev.detail.size === 0 && ev.detail.values != null) { + attachments.clear() + attachments = attachments + } + }} + /> + + + + {#if attachments.size > 0} + {#each Array.from(attachments.values()) as attachment} + { + if (result.detail !== undefined) descriptionBox.removeAttachmentById(result.detail._id) + }} + /> + {/each} + {/if} + + +