diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 3237df8c35..3258def3fc 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -30,6 +30,9 @@ specifiers: '@rush-temp/devmodel-resources': file:./projects/devmodel-resources.tgz '@rush-temp/elastic': file:./projects/elastic.tgz '@rush-temp/front': file:./projects/front.tgz + '@rush-temp/lead': file:./projects/lead.tgz + '@rush-temp/lead-assets': file:./projects/lead-assets.tgz + '@rush-temp/lead-resources': file:./projects/lead-resources.tgz '@rush-temp/login': file:./projects/login.tgz '@rush-temp/login-assets': file:./projects/login-assets.tgz '@rush-temp/login-resources': file:./projects/login-resources.tgz @@ -41,6 +44,7 @@ specifiers: '@rush-temp/model-contact': file:./projects/model-contact.tgz '@rush-temp/model-core': file:./projects/model-core.tgz '@rush-temp/model-demo': file:./projects/model-demo.tgz + '@rush-temp/model-lead': file:./projects/model-lead.tgz '@rush-temp/model-recruit': file:./projects/model-recruit.tgz '@rush-temp/model-rig': file:./projects/model-rig.tgz '@rush-temp/model-server-chunter': file:./projects/model-server-chunter.tgz @@ -189,6 +193,9 @@ dependencies: '@rush-temp/devmodel-resources': file:projects/devmodel-resources.tgz_e1367da94684b005adf08f025c517b1a '@rush-temp/elastic': file:projects/elastic.tgz '@rush-temp/front': file:projects/front.tgz + '@rush-temp/lead': file:projects/lead.tgz + '@rush-temp/lead-assets': file:projects/lead-assets.tgz + '@rush-temp/lead-resources': file:projects/lead-resources.tgz_476f694f64637160ae71e12ff57815b9 '@rush-temp/login': file:projects/login.tgz '@rush-temp/login-assets': file:projects/login-assets.tgz '@rush-temp/login-resources': file:projects/login-resources.tgz_476f694f64637160ae71e12ff57815b9 @@ -200,6 +207,7 @@ dependencies: '@rush-temp/model-contact': file:projects/model-contact.tgz_typescript@4.4.3 '@rush-temp/model-core': file:projects/model-core.tgz_typescript@4.4.3 '@rush-temp/model-demo': file:projects/model-demo.tgz_typescript@4.4.3 + '@rush-temp/model-lead': file:projects/model-lead.tgz_typescript@4.4.3 '@rush-temp/model-recruit': file:projects/model-recruit.tgz_typescript@4.4.3 '@rush-temp/model-rig': file:projects/model-rig.tgz_2dc8ed62b2dfc2128abe8b9eb802dbe2 '@rush-temp/model-server-chunter': file:projects/model-server-chunter.tgz_typescript@4.4.3 @@ -10125,6 +10133,67 @@ packages: - supports-color dev: false + file:projects/lead-assets.tgz: + resolution: {integrity: sha512-cRYB8PutP6HmaJjoEMLIEyMQEhKAQaCu0w2NJMF5TUW9vokia/22TXsHo1+xEGI1rx2epywbGXet/fL40tdbDw==, tarball: file:projects/lead-assets.tgz} + name: '@rush-temp/lead-assets' + version: 0.0.0 + dev: false + + file:projects/lead-resources.tgz_476f694f64637160ae71e12ff57815b9: + resolution: {integrity: sha512-JO4mPZzFqoE1LYtroNwlQAUPqc2nbyarfsVlsnAC0uX87jvl7HA78tCDVzuh8LHZfexY0ilrcu1Y0ItOymdT9g==, tarball: file:projects/lead-resources.tgz} + id: file:projects/lead-resources.tgz + name: '@rush-temp/lead-resources' + version: 0.0.0 + dependencies: + '@typescript-eslint/eslint-plugin': 5.4.0_87dbf04088b125598d0271706532eaf3 + '@typescript-eslint/parser': 5.4.0_eslint@7.32.0+typescript@4.4.3 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_05a8ea1454e6ca4c9f98b94b8f3abf9c + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.1.1_eslint@7.32.0 + eslint-plugin-svelte3: 3.2.1_eslint@7.32.0+svelte@3.43.1 + prettier: 2.4.1 + prettier-plugin-svelte: 2.5.0_prettier@2.4.1+svelte@3.43.1 + sass: 1.42.1 + svelte: 3.43.1 + svelte-check: 2.2.10_3708ed3db7329f2cbf76db19160094b1 + svelte-loader: 3.1.2_svelte@3.43.1 + svelte-preprocess: 4.9.8_b1ccfb371c7d68f75291f5a547be0b14 + typescript: 4.4.3 + transitivePeerDependencies: + - '@babel/core' + - coffeescript + - less + - node-sass + - postcss + - postcss-load-config + - pug + - stylus + - sugarss + - supports-color + dev: false + + file:projects/lead.tgz: + resolution: {integrity: sha512-fdeirdweHpZ+WcGz5xlKcvue+gtDXhK5WNFINY6XnhVgfUvNsEtEgiWX1RaQ8uSReXbaEok6GGmhsV29SOr1lQ==, tarball: file:projects/lead.tgz} + name: '@rush-temp/lead' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.41.1 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.4.0_87dbf04088b125598d0271706532eaf3 + '@typescript-eslint/parser': 5.4.0_eslint@7.32.0+typescript@4.4.3 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_05a8ea1454e6ca4c9f98b94b8f3abf9c + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.1.1_eslint@7.32.0 + prettier: 2.4.1 + typescript: 4.4.3 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/login-assets.tgz: resolution: {integrity: sha512-a/tWogP5p3gmtAVHY5bGyWLlR4YNEu/nMrTeDaLzi7DmjP0mnqCySe1rHU4UVks4AI6Svnhqo6RtRJOqRDTSoA==, tarball: file:projects/login-assets.tgz} name: '@rush-temp/login-assets' @@ -10208,7 +10277,7 @@ packages: dev: false file:projects/model-all.tgz_typescript@4.4.3: - resolution: {integrity: sha512-76M/a9+Fy3fVPPgQDAPzjvn4b5KY2+VlRURicy5qStQDzRLmNHefnOdDDCxgO3eU/99TMnN6a+11Gjeu7NM/6w==, tarball: file:projects/model-all.tgz} + resolution: {integrity: sha512-yXQ6Y94ArLiTyq3DzmeZept/i472lkwoCxN5ewQYn+3RnWUwvrWTqv/HnfE4nC1oRaWFinp8rKRRtXt2uvI4EA==, tarball: file:projects/model-all.tgz} id: file:projects/model-all.tgz name: '@rush-temp/model-all' version: 0.0.0 @@ -10337,6 +10406,27 @@ packages: - typescript dev: false + file:projects/model-lead.tgz_typescript@4.4.3: + resolution: {integrity: sha512-uj6uS5KfwNIUxmSBOMO5fZT/OlT3JgXlo4OGEmg0LSGHRXUBI5nAkbLevY81kVQbtN3mKB7MPz1nLm09cxuhSw==, tarball: file:projects/model-lead.tgz} + id: file:projects/model-lead.tgz + name: '@rush-temp/model-lead' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.41.1 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.4.0_87dbf04088b125598d0271706532eaf3 + '@typescript-eslint/parser': 5.4.0_eslint@7.32.0+typescript@4.4.3 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_05a8ea1454e6ca4c9f98b94b8f3abf9c + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.1.1_eslint@7.32.0 + prettier: 2.4.1 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + file:projects/model-recruit.tgz_typescript@4.4.3: resolution: {integrity: sha512-LgqXtVecQ6ZdlAb4ufvWI+kDIeeMFtm/5mXvUXBbGsmg07rCa4tsqfm9uwecj6TvpaPYC3mlyYv/N316VeKeGA==, tarball: file:projects/model-recruit.tgz} id: file:projects/model-recruit.tgz diff --git a/dev/prod/package.json b/dev/prod/package.json index 4d4bc78d31..254484573f 100644 --- a/dev/prod/package.json +++ b/dev/prod/package.json @@ -83,6 +83,9 @@ "@anticrm/workbench-assets": "~0.6.0", "@anticrm/attachment": "~0.6.0", "@anticrm/attachment-assets": "~0.6.0", - "@anticrm/attachment-resources": "~0.6.0" + "@anticrm/attachment-resources": "~0.6.0", + "@anticrm/lead": "~0.6.0", + "@anticrm/lead-assets": "~0.6.0", + "@anticrm/lead-resources": "~0.6.0" } } diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index b628b25b60..26c24bc446 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -26,6 +26,7 @@ import { activityId } from '@anticrm/activity' import { settingId } from '@anticrm/setting' import { telegramId } from '@anticrm/telegram' import { attachmentId } from '@anticrm/attachment' +import { leadId } from '@anticrm/lead' import { clientId } from '@anticrm/client' import '@anticrm/login-assets' @@ -37,6 +38,7 @@ import '@anticrm/contact-assets' import '@anticrm/recruit-assets' import '@anticrm/activity-assets' import '@anticrm/setting-assets' +import '@anticrm/lead-assets' import '@anticrm/workbench-assets' import { setMetadata } from '@anticrm/platform' @@ -61,6 +63,7 @@ export function configurePlatform() { addLocation(recruitId, () => import(/* webpackChunkName: "recruit" */ '@anticrm/recruit-resources')) addLocation(activityId, () => import(/*webpackChunkName: "activity" */ '@anticrm/activity-resources')) addLocation(settingId, () => import(/* webpackChunkName: "setting" */ '@anticrm/setting-resources')) + addLocation(leadId, () => import(/* webpackChunkName: "lead" */ '@anticrm/lead-resources')) addLocation(telegramId, () => import(/* webpackChunkName: "telegram" */ '@anticrm/telegram-resources')) addLocation(attachmentId, () => import(/* webpackChunkName: "attachment" */ '@anticrm/attachment-resources')) } diff --git a/models/all/package.json b/models/all/package.json index deb8963e82..3408ec9f16 100644 --- a/models/all/package.json +++ b/models/all/package.json @@ -36,6 +36,7 @@ "@anticrm/model-task": "~0.6.0", "@anticrm/model-chunter": "~0.6.0", "@anticrm/model-recruit": "~0.6.0", + "@anticrm/model-lead": "~0.6.0", "@anticrm/model-setting": "~0.6.0", "@anticrm/model-telegram": "~0.6.0", "@anticrm/model-demo": "~0.6.0", diff --git a/models/all/src/index.ts b/models/all/src/index.ts index ee50974c3e..48b7220025 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -25,6 +25,7 @@ import { createModel as recruitModel } from '@anticrm/model-recruit' import { createModel as settingModel } from '@anticrm/model-setting' import { createModel as telegramModel } from '@anticrm/model-telegram' import { createModel as attachmentModel } from '@anticrm/model-attachment' +import { createModel as leadModel } from '@anticrm/model-lead' import { createModel as serverCoreModel } from '@anticrm/model-server-core' import { createModel as serverChunterModel } from '@anticrm/model-server-chunter' @@ -47,6 +48,7 @@ taskModel(builder) recruitModel(builder) settingModel(builder) telegramModel(builder) +leadModel(builder) serverCoreModel(builder) serverChunterModel(builder) diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 93a7b68cc4..daaa183c0c 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -216,6 +216,10 @@ export function createModel (builder: Builder): void { builder.mixin(contact.class.Organization, core.class.Class, view.mixin.AttributePresenter, { presenter: contact.component.OrganizationPresenter }) + + builder.mixin(contact.class.Contact, core.class.Class, view.mixin.AttributePresenter, { + presenter: contact.component.ContactPresenter + }) } export { contact as default } diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index d7dd8cd2d4..484297196d 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -23,6 +23,7 @@ import {} from '@anticrm/core' export const ids = mergeIds(contactId, contact, { component: { PersonPresenter: '' as AnyComponent, + ContactPresenter: '' as AnyComponent, ChannelsPresenter: '' as AnyComponent, CreatePerson: '' as AnyComponent, EditPerson: '' as AnyComponent, diff --git a/models/lead/.eslintrc.js b/models/lead/.eslintrc.js new file mode 100644 index 0000000000..c3c2c49417 --- /dev/null +++ b/models/lead/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/lead/.npmignore b/models/lead/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/lead/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/lead/config/rig.json b/models/lead/config/rig.json new file mode 100644 index 0000000000..e9a9ee9add --- /dev/null +++ b/models/lead/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/model-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/models/lead/package.json b/models/lead/package.json new file mode 100644 index 0000000000..c909ad1981 --- /dev/null +++ b/models/lead/package.json @@ -0,0 +1,43 @@ +{ + "name": "@anticrm/model-lead", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.41.1" + }, + "dependencies": { + "@anticrm/core": "~0.6.11", + "@anticrm/model": "~0.6.0", + "@anticrm/ui": "~0.6.0", + "@anticrm/contact": "~0.6.2", + "@anticrm/platform": "~0.6.5", + "@anticrm/model-core": "~0.6.0", + "@anticrm/model-view": "~0.6.0", + "@anticrm/model-workbench": "~0.6.1", + "@anticrm/model-contact": "~0.6.1", + "@anticrm/model-chunter": "~0.6.0", + "@anticrm/model-attachment": "~0.6.0", + "@anticrm/lead": "~0.6.0", + "@anticrm/lead-resources": "~0.6.0", + "@anticrm/view": "~0.6.0" + } +} diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts new file mode 100644 index 0000000000..6aaa30f4ba --- /dev/null +++ b/models/lead/src/index.ts @@ -0,0 +1,143 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import type { Contact } from '@anticrm/contact' +import type { Doc, Domain, FindOptions, Ref } from '@anticrm/core' +import { Builder, Model, Prop, TypeRef, TypeString, UX } from '@anticrm/model' +import chunter from '@anticrm/model-chunter' +import contact from '@anticrm/model-contact' +import core, { TDocWithState, TSpaceWithStates } from '@anticrm/model-core' +import view from '@anticrm/model-view' +import workbench from '@anticrm/model-workbench' +import type { IntlString } from '@anticrm/platform' +import type { Funnel, Lead } from '@anticrm/lead' +import { createKanban } from '@anticrm/lead' +import lead from './plugin' +import attachment from '@anticrm/model-attachment' + +export const DOMAIN_LEAD = 'lead' as Domain + +@Model(lead.class.Funnel, core.class.SpaceWithStates) +@UX(lead.string.Funnel, lead.icon.Funnel) +export class TFunnel extends TSpaceWithStates implements Funnel {} + +@Model(lead.class.Lead, core.class.Doc, DOMAIN_LEAD, [core.interface.DocWithState]) +@UX('Lead' as IntlString) +export class TLead extends TDocWithState implements Lead { + @Prop(TypeString(), 'Title' as IntlString) + title!: string + + @Prop(TypeRef(contact.class.Contact), lead.string.Customer) + customer!: Ref + + @Prop(TypeString(), 'Comments' as IntlString) + comments?: number + + @Prop(TypeString(), 'Attachments' as IntlString) + attachments?: number +} + +export function createModel (builder: Builder): void { + builder.createModel(TFunnel, TLead) + + builder.mixin(lead.class.Funnel, core.class.Class, workbench.mixin.SpaceView, { + view: { + class: lead.class.Lead, + createItemDialog: lead.component.CreateLead + } + }) + + builder.createDoc(workbench.class.Application, core.space.Model, { + label: lead.string.LeadApplication, + icon: lead.icon.LeadApplication, + hidden: false, + navigatorModel: { + spaces: [ + { + label: lead.string.Funnels, + spaceClass: lead.class.Funnel, + addSpaceLabel: lead.string.CreateFunnel, + createComponent: lead.component.CreateFunnel + } + ] + } + }) + builder.createDoc(lead.class.Funnel, core.space.Model, { + name: 'Funnel', + description: 'Default funnel', + private: false, + members: [] + }, lead.space.DefaultFunnel) + + builder.createDoc(view.class.Viewlet, core.space.Model, { + attachTo: lead.class.Lead, + descriptor: view.viewlet.Table, + open: lead.component.EditLead, + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + options: { + lookup: { + customer: contact.class.Contact, + state: core.class.State + } + } as FindOptions, // TODO: fix + config: [ + '', + '$lookup.customer', + '$lookup.state', + { presenter: attachment.component.AttachmentsPresenter, label: 'Files' }, + { presenter: chunter.component.CommentsPresenter, label: 'Comments' }, + 'modifiedOn', + '$lookup.customer.channels'] + }) + + builder.createDoc(view.class.Viewlet, core.space.Model, { + attachTo: lead.class.Lead, + descriptor: view.viewlet.Kanban, + open: lead.component.EditLead, + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + options: { + lookup: { + customer: contact.class.Contact, + state: core.class.State + } + } as FindOptions, // TODO: fix + config: ['$lookup.customer', '$lookup.state'] + }) + + builder.mixin(lead.class.Lead, core.class.Class, view.mixin.KanbanCard, { + card: lead.component.KanbanCard + }) + + builder.mixin(lead.class.Lead, core.class.Class, view.mixin.ObjectEditor, { + editor: lead.component.EditLead + }) + + builder.mixin(lead.class.Lead, core.class.Class, view.mixin.AttributePresenter, { + presenter: lead.component.LeadPresenter + }) + + builder.createDoc(view.class.Sequence, view.space.Sequence, { + attachedTo: lead.class.Lead, + sequence: 0 + }) + + createKanban(lead.space.DefaultFunnel, async (_class, space, data, id) => { + builder.createDoc(_class, space, data, id) + return await Promise.resolve() + }).catch((err) => console.error(err)) +} + +export { default } from './plugin' diff --git a/models/lead/src/plugin.ts b/models/lead/src/plugin.ts new file mode 100644 index 0000000000..9a9023626f --- /dev/null +++ b/models/lead/src/plugin.ts @@ -0,0 +1,40 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import type { Ref, Space } from '@anticrm/core' +import type { IntlString } from '@anticrm/platform' +import { mergeIds } from '@anticrm/platform' +import { leadId } from '@anticrm/lead' +import lead from '@anticrm/lead-resources/src/plugin' +import type { AnyComponent } from '@anticrm/ui' + +export default mergeIds(leadId, lead, { + string: { + Funnel: '' as IntlString, + Funnels: '' as IntlString, + LeadApplication: '' as IntlString + }, + component: { + CreateFunnel: '' as AnyComponent, + CreateLead: '' as AnyComponent, + EditLead: '' as AnyComponent, + KanbanCard: '' as AnyComponent, + LeadPresenter: '' as AnyComponent + }, + space: { + DefaultFunnel: '' as Ref + } +}) diff --git a/models/lead/tsconfig.json b/models/lead/tsconfig.json new file mode 100644 index 0000000000..1d60db76b4 --- /dev/null +++ b/models/lead/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/packages/presentation/src/components/UserBox.svelte b/packages/presentation/src/components/UserBox.svelte index 33db11e08e..72e42a789c 100644 --- a/packages/presentation/src/components/UserBox.svelte +++ b/packages/presentation/src/components/UserBox.svelte @@ -1,14 +1,15 @@ @@ -23,27 +24,27 @@ import UsersPopup from './UsersPopup.svelte' import type { Ref, Class } from '@anticrm/core' - import { formatName, Person } from '@anticrm/contact' + import contact, { Contact, formatName } from '@anticrm/contact' import { createEventDispatcher } from 'svelte' - export let _class: Ref> + export let _class: Ref> export let title: IntlString export let caption: IntlString - export let value: Ref | null | undefined + export let value: Ref | null | undefined export let show: boolean = false export let allowDeselect = false export let titleDeselect: IntlString | undefined = undefined - + const dispatch = createEventDispatcher() - let selected: Person | undefined + let selected: Contact | undefined let btn: HTMLElement let container: HTMLElement let opened: boolean = false const client = getClient() - async function updateSelected (value: Ref) { + async function updateSelected (value: Ref) { selected = await client.findOne(_class, { _id: value }) } @@ -57,6 +58,11 @@ show = false } }) + + function getName (obj: Contact): string { + const isPerson = client.getHierarchy().isDerived(obj._class, contact.class.Person) + return isPerson ? formatName(obj.name) : obj.name + }
- {#if selected}{formatName(selected.name)}{:else}
diff --git a/plugins/activity-resources/src/components/TxView.svelte b/plugins/activity-resources/src/components/TxView.svelte index d036f1c544..5e22f1ce71 100644 --- a/plugins/activity-resources/src/components/TxView.svelte +++ b/plugins/activity-resources/src/components/TxView.svelte @@ -216,9 +216,9 @@ {#each model as m} {#await getValue(m, tx.updateTx) then value} {#if value === null} - unset {m.label} + unset {:else} - changed {m.label} to + changed
{/if} {/await} diff --git a/plugins/attachment-resources/src/index.ts b/plugins/attachment-resources/src/index.ts index d40afb3e1a..cb140ad7d4 100644 --- a/plugins/attachment-resources/src/index.ts +++ b/plugins/attachment-resources/src/index.ts @@ -18,7 +18,7 @@ import AttachmentPresenter from './components/AttachmentPresenter.svelte' import TxAttachmentCreate from './components/activity/TxAttachmentCreate.svelte' import Attachments from './components/Attachments.svelte' -export { AttachmentsPresenter } +export { Attachments, AttachmentsPresenter } export default async () => ({ component: { diff --git a/plugins/contact-resources/package.json b/plugins/contact-resources/package.json index a6ff5546d5..5827045ba3 100644 --- a/plugins/contact-resources/package.json +++ b/plugins/contact-resources/package.json @@ -37,7 +37,7 @@ "@anticrm/presentation": "~0.6.2", "@anticrm/core": "~0.6.11", "@anticrm/view": "~0.6.0", - "@anticrm/attachment": "~0.6.0", + "@anticrm/attachment-resources": "~0.6.0", "@anticrm/panel": "~0.6.0" } } diff --git a/plugins/contact-resources/src/components/ChannelsPresenter.svelte b/plugins/contact-resources/src/components/ChannelsPresenter.svelte index e7e314b902..508a4b3b21 100644 --- a/plugins/contact-resources/src/components/ChannelsPresenter.svelte +++ b/plugins/contact-resources/src/components/ChannelsPresenter.svelte @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - + +{#if isPerson(value)} + +{:else} + +{/if} diff --git a/plugins/contact-resources/src/components/CreateOrganization.svelte b/plugins/contact-resources/src/components/CreateOrganization.svelte index 092a325618..f64d357104 100644 --- a/plugins/contact-resources/src/components/CreateOrganization.svelte +++ b/plugins/contact-resources/src/components/CreateOrganization.svelte @@ -1,24 +1,23 @@ - - 0} - spaceClass={contact.class.Organizations} - spaceLabel={contact.string.OrganizationsFolder} - spacePlaceholder={contact.string.SelectFolder} - bind:space={_space} - on:close={() => { dispatch('close') }}> - + 0} + spaceClass={contact.class.Organizations} + spaceLabel={contact.string.OrganizationsFolder} + spacePlaceholder={contact.string.SelectFolder} + bind:space={_space} + on:close={() => { + dispatch('close') + }} +>
-
+
{#if !object.channels || object.channels.length === 0} - showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { object.channels = result })} /> + + showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + object.channels = result + })} + /> {:else}
- showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { object.channels = result })} /> + + showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + object.channels = result + })} + />
{/if}
@@ -90,6 +108,8 @@ } .channels { margin-top: 1.25rem; - span { margin-left: .5rem; } + span { + margin-left: 0.5rem; + } } diff --git a/plugins/contact-resources/src/components/CreateOrganizations.svelte b/plugins/contact-resources/src/components/CreateOrganizations.svelte index 449ecf1b37..7aca879742 100644 --- a/plugins/contact-resources/src/components/CreateOrganizations.svelte +++ b/plugins/contact-resources/src/components/CreateOrganizations.svelte @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - { dispatch('close') }} + canSave={!!name} + on:close={() => { + dispatch('close') + }} > - - + + diff --git a/plugins/contact-resources/src/components/CreatePerson.svelte b/plugins/contact-resources/src/components/CreatePerson.svelte index bbf3bd21dd..53a1846653 100644 --- a/plugins/contact-resources/src/components/CreatePerson.svelte +++ b/plugins/contact-resources/src/components/CreatePerson.svelte @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - - 0 && lastName.length > 0} - spaceClass={contact.class.Persons} - spaceLabel={contact.string.PersonsFolder} - spacePlaceholder={contact.string.SelectFolder} - bind:space={_space} - on:close={() => { dispatch('close') }}> - + 0 && lastName.length > 0} + spaceClass={contact.class.Persons} + spaceLabel={contact.string.PersonsFolder} + spacePlaceholder={contact.string.SelectFolder} + bind:space={_space} + on:close={() => { + dispatch('close') + }} +>
-
-
-
+
+
+
{#if !object.channels || object.channels.length === 0} - showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { object.channels = result })} /> + + showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + object.channels = result + })} + /> {:else}
- showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { object.channels = result })} /> + + showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + object.channels = result + })} + />
{/if}
@@ -91,6 +109,8 @@ diff --git a/plugins/contact-resources/src/components/CreatePersons.svelte b/plugins/contact-resources/src/components/CreatePersons.svelte index 2b3782a38f..745d3ba6b5 100644 --- a/plugins/contact-resources/src/components/CreatePersons.svelte +++ b/plugins/contact-resources/src/components/CreatePersons.svelte @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - { dispatch('close') }} + canSave={!!name} + on:close={() => { + dispatch('close') + }} > - - + + diff --git a/plugins/contact-resources/src/components/EditOrganization.svelte b/plugins/contact-resources/src/components/EditOrganization.svelte index 6ed7769fbe..b3bf9609cd 100644 --- a/plugins/contact-resources/src/components/EditOrganization.svelte +++ b/plugins/contact-resources/src/components/EditOrganization.svelte @@ -13,18 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - {#if object !== undefined} - { dispatch('close') }}> -
- -
-
-
- {#if !object.channels || object.channels.length === 0} - showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { saveChannels(result) })} /> - - {:else} - { - if (ev.detail.presenter) { - fullSize = true - rightSection = ev.detail.presenter - } - }} /> -
- showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { saveChannels(result) })} /> -
- {/if} + { + dispatch('close') + }} + > +
+ +
+
+ +
+
+ {#if !object.channels || object.channels.length === 0} + + showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + saveChannels(result) + })} + /> + + {:else} + { + if (ev.detail.presenter) { + fullSize = true + rightSection = ev.detail.presenter + } + }} + /> +
+ + showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + saveChannels(result) + })} + /> +
+ {/if} +
-
-
- -
- +
+ +
+ {/if} diff --git a/plugins/contact-resources/src/components/EditPerson.svelte b/plugins/contact-resources/src/components/EditPerson.svelte index e3438bc70b..52502f3ef7 100644 --- a/plugins/contact-resources/src/components/EditPerson.svelte +++ b/plugins/contact-resources/src/components/EditPerson.svelte @@ -13,17 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - {#if object !== undefined} - { dispatch('close') }}> - + { + dispatch('close') + }} + > + -
-
- -
-
-
-
-
- {#if !object.channels || object.channels.length === 0} - showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { saveChannels(result) })} /> - - {:else} - { - if (ev.detail.presenter) { - fullSize = true - rightSection = ev.detail.presenter - } - }} /> -
- showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { saveChannels(result) })} /> -
- {/if} +
+
+ +
+
+
+ +
+
+ +
+
+ {#if !object.channels || object.channels.length === 0} + + showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + saveChannels(result) + })} + /> + + {:else} + { + if (ev.detail.presenter) { + fullSize = true + rightSection = ev.detail.presenter + } + }} + /> +
+ + showPopup(contact.component.SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { + saveChannels(result) + })} + /> +
+ {/if} +
-
-
- -
- +
+ +
+ {/if} diff --git a/plugins/contact-resources/src/components/OrganizationPresenter.svelte b/plugins/contact-resources/src/components/OrganizationPresenter.svelte index 225d2d2ad4..264142353d 100644 --- a/plugins/contact-resources/src/components/OrganizationPresenter.svelte +++ b/plugins/contact-resources/src/components/OrganizationPresenter.svelte @@ -1,37 +1,36 @@ -
@@ -49,7 +48,7 @@ async function onClick() { } .user { - margin-left: .5rem; + margin-left: 0.5rem; font-weight: 500; text-align: left; color: var(--theme-content-accent-color); diff --git a/plugins/contact-resources/src/components/PersonPresenter.svelte b/plugins/contact-resources/src/components/PersonPresenter.svelte index 8fea5a1b35..1ca02fb20c 100644 --- a/plugins/contact-resources/src/components/PersonPresenter.svelte +++ b/plugins/contact-resources/src/components/PersonPresenter.svelte @@ -13,35 +13,27 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - {#if value}
- +
{formatName(value.name)}
{:else} -
- Not defined -
+
Not defined
{/if} diff --git a/plugins/contact-resources/src/components/icons/Company.svelte b/plugins/contact-resources/src/components/icons/Company.svelte index a125c553dd..8476749835 100644 --- a/plugins/contact-resources/src/components/icons/Company.svelte +++ b/plugins/contact-resources/src/components/icons/Company.svelte @@ -13,12 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - - + diff --git a/plugins/contact-resources/src/index.ts b/plugins/contact-resources/src/index.ts index 118b9da57e..7277fecdf6 100644 --- a/plugins/contact-resources/src/index.ts +++ b/plugins/contact-resources/src/index.ts @@ -1,20 +1,21 @@ // // Copyright © 2020, 2021 Anticrm Platform Contributors. // Copyright © 2021 Hardcore Engineering Inc. -// +// // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may // obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// +// // See the License for the specific language governing permissions and // limitations under the License. // import PersonPresenter from './components/PersonPresenter.svelte' +import ContactPresenter from './components/ContactPresenter.svelte' import OrganizationPresenter from './components/OrganizationPresenter.svelte' import ChannelsPresenter from './components/ChannelsPresenter.svelte' import CreatePerson from './components/CreatePerson.svelte' @@ -24,9 +25,13 @@ import EditOrganization from './components/EditOrganization.svelte' import CreatePersons from './components/CreatePersons.svelte' import CreateOrganizations from './components/CreateOrganizations.svelte' import SocialEditor from './components/SocialEditor.svelte' +import { Resources } from '@anticrm/platform' -export default async () => ({ +export { ContactPresenter } + +export default async (): Promise => ({ component: { + ContactPresenter, PersonPresenter, OrganizationPresenter, ChannelsPresenter, @@ -37,5 +42,5 @@ export default async () => ({ CreatePersons, CreateOrganizations, SocialEditor - }, + } }) diff --git a/plugins/contact-resources/src/plugin.ts b/plugins/contact-resources/src/plugin.ts index cfbe377310..5c0fbe2287 100644 --- a/plugins/contact-resources/src/plugin.ts +++ b/plugins/contact-resources/src/plugin.ts @@ -1,14 +1,15 @@ // -// Copyright © 2020 Anticrm Platform Contributors. -// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may // obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// +// // See the License for the specific language governing permissions and // limitations under the License. // diff --git a/plugins/contact/src/index.ts b/plugins/contact/src/index.ts index 0c222970ed..7463cb91a7 100644 --- a/plugins/contact/src/index.ts +++ b/plugins/contact/src/index.ts @@ -65,14 +65,12 @@ export interface Person extends Contact { /** * @public */ -export interface Organization extends Contact { -} +export interface Organization extends Contact {} /** * @public */ -export interface Employee extends Person { -} +export interface Employee extends Person {} /** * @public diff --git a/plugins/lead-assets/assets/icons.svg b/plugins/lead-assets/assets/icons.svg new file mode 100644 index 0000000000..9598db2892 --- /dev/null +++ b/plugins/lead-assets/assets/icons.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/plugins/lead-assets/lang/en.json b/plugins/lead-assets/lang/en.json new file mode 100644 index 0000000000..5b9ff33aab --- /dev/null +++ b/plugins/lead-assets/lang/en.json @@ -0,0 +1,17 @@ +{ + "string": { + "CreateFunnel": "Create funnel", + "CreateLead": "Create lead", + "Funnel": "Funnel", + "FunnelName": "Funnel name", + "Funnels": "Funnels", + "MakePrivate": "Make private", + "MakePrivateDescription": "Only members can see it", + "LeadApplication": "Leads", + "SelectFunnel": "Select funnel", + "LeadName": "Lead name", + "More": "More...", + "Customer": "Customer", + "SelectCustomer": "Select customer" + } +} \ No newline at end of file diff --git a/plugins/lead-assets/package.json b/plugins/lead-assets/package.json new file mode 100644 index 0000000000..e4de672622 --- /dev/null +++ b/plugins/lead-assets/package.json @@ -0,0 +1,19 @@ +{ + "name": "@anticrm/lead-assets", + "version": "0.6.0", + "main": "src/index.ts", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "", + "build:docs": "api-extractor run --local", + "lint": "ts-standard src", + "lint:fix": "ts-standard --fix src", + "format": "prettier --write 'src/**/*.{ts*,js*,yml}' && ts-standard --fix src" + }, + "devDependencies": {}, + "dependencies": { + "@anticrm/platform": "~0.6.5", + "@anticrm/lead": "~0.6.0" + } +} diff --git a/plugins/lead-assets/src/index.ts b/plugins/lead-assets/src/index.ts new file mode 100644 index 0000000000..488b132755 --- /dev/null +++ b/plugins/lead-assets/src/index.ts @@ -0,0 +1,27 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { addStringsLoader, loadMetadata } from '@anticrm/platform' +import lead, {leadId} from '@anticrm/lead' + +const icons = require('../assets/icons.svg') +loadMetadata(lead.icon, { + Funnel: `${icons}#funnel`, + Lead: `${icons}#lead`, + LeadApplication: `${icons}#leadapplication` +}) + +addStringsLoader(leadId, async (lang: string) => await import(`../lang/${lang}.json`)) diff --git a/plugins/lead-assets/tsconfig.json b/plugins/lead-assets/tsconfig.json new file mode 100644 index 0000000000..cabe5aefad --- /dev/null +++ b/plugins/lead-assets/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "target": "esnext", + "module": "esnext", + "declaration": true, + "outDir": "./lib", + "strict": true, + "esModuleInterop": true, + "lib": [ + "esnext", + "dom" + ] + } +} \ No newline at end of file diff --git a/plugins/lead-resources/.eslintrc.js b/plugins/lead-resources/.eslintrc.js new file mode 100644 index 0000000000..a327214967 --- /dev/null +++ b/plugins/lead-resources/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/ui/config/eslint.config.json'], + parserOptions: { tsconfigRootDir: __dirname }, + settings: { + 'svelte3/ignore-styles': () => true + } +} diff --git a/plugins/lead-resources/package.json b/plugins/lead-resources/package.json new file mode 100644 index 0000000000..fe0148075b --- /dev/null +++ b/plugins/lead-resources/package.json @@ -0,0 +1,47 @@ +{ + "name": "@anticrm/lead-resources", + "version": "0.6.0", + "main": "src/index.ts", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "echo 'no build for ui'", + "build:docs": "api-extractor run --local", + "lint": "svelte-check && eslint", + "lint:fix": "eslint --fix src", + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + }, + "devDependencies": { + "svelte-loader": "^3.1.2", + "sass": "^1.37.5", + "svelte-preprocess": "^4.7.4", + "@anticrm/platform-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-svelte3": "~3.2.1", + "prettier-plugin-svelte": "^2.2.0", + "eslint": "^7.32.0", + "prettier": "^2.4.1", + "svelte-check": "^2.2.10", + "typescript": "^4.3.5" + }, + "dependencies": { + "@anticrm/platform": "~0.6.5", + "svelte": "^3.37.0", + "@anticrm/lead": "~0.6.0", + "@anticrm/ui": "~0.6.0", + "@anticrm/presentation": "~0.6.2", + "@anticrm/core": "~0.6.11", + "@anticrm/panel": "~0.6.0", + "@anticrm/contact": "~0.6.2", + "@anticrm/view": "~0.6.0", + "@anticrm/view-resources": "~0.6.0", + "@anticrm/attachment-resources": "~0.6.0", + "@anticrm/contact-resources": "~0.6.0", + "@anticrm/chunter-resources": "~0.6.0" + } +} diff --git a/plugins/lead-resources/postcss.config.js b/plugins/lead-resources/postcss.config.js new file mode 100644 index 0000000000..88752c6cb0 --- /dev/null +++ b/plugins/lead-resources/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + require('autoprefixer') + ] +} diff --git a/plugins/lead-resources/src/components/CreateFunnel.svelte b/plugins/lead-resources/src/components/CreateFunnel.svelte new file mode 100644 index 0000000000..5089f7c035 --- /dev/null +++ b/plugins/lead-resources/src/components/CreateFunnel.svelte @@ -0,0 +1,67 @@ + + + + 0} + on:close={() => { + dispatch('close') + }} +> + + + + + diff --git a/plugins/lead-resources/src/components/CreateLead.svelte b/plugins/lead-resources/src/components/CreateLead.svelte new file mode 100644 index 0000000000..bce5eb149f --- /dev/null +++ b/plugins/lead-resources/src/components/CreateLead.svelte @@ -0,0 +1,101 @@ + + + + 0 && customer !== null} + spaceClass={lead.class.Funnel} + spaceLabel={lead.string.FunnelName} + spacePlaceholder={lead.string.SelectFunnel} + bind:space={_space} + on:close={() => { + dispatch('close') + }} +> + + + + + + diff --git a/plugins/lead-resources/src/components/EditLead.svelte b/plugins/lead-resources/src/components/EditLead.svelte new file mode 100644 index 0000000000..c62d433237 --- /dev/null +++ b/plugins/lead-resources/src/components/EditLead.svelte @@ -0,0 +1,71 @@ + + + +{#if object !== undefined} + { + dispatch('close') + }} + > + + change('title', object.title)} + /> + { + change('customer', object.customer) + }} /> + + +
+ +
+
+{/if} diff --git a/plugins/lead-resources/src/components/KanbanCard.svelte b/plugins/lead-resources/src/components/KanbanCard.svelte new file mode 100644 index 0000000000..839e85cc22 --- /dev/null +++ b/plugins/lead-resources/src/components/KanbanCard.svelte @@ -0,0 +1,91 @@ + + + +
+
+
+
+
{object.title}
+
+
+
+
+ {#if object.$lookup?.customer} + + {/if} +
+ {#if (object.attachments ?? 0) > 0} +
+ {/if} + {#if (object.comments ?? 0) > 0} +
+ {/if} +
+ { + showMenu(evt) + }} + icon={IconMoreH} + size={'small'} + /> +
+
+
+
+ + diff --git a/plugins/lead-resources/src/components/LeadPresenter.svelte b/plugins/lead-resources/src/components/LeadPresenter.svelte new file mode 100644 index 0000000000..bacba4aa16 --- /dev/null +++ b/plugins/lead-resources/src/components/LeadPresenter.svelte @@ -0,0 +1,32 @@ + + + +
+ {value.title} +
diff --git a/plugins/lead-resources/src/index.ts b/plugins/lead-resources/src/index.ts new file mode 100644 index 0000000000..0824a9e57d --- /dev/null +++ b/plugins/lead-resources/src/index.ts @@ -0,0 +1,32 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Resources } from '@anticrm/platform' +import CreateFunnel from './components/CreateFunnel.svelte' +import CreateLead from './components/CreateLead.svelte' +import EditLead from './components/EditLead.svelte' +import KanbanCard from './components/KanbanCard.svelte' +import LeadPresenter from './components/LeadPresenter.svelte' + +export default async (): Promise => ({ + component: { + CreateFunnel, + CreateLead, + EditLead, + KanbanCard, + LeadPresenter + } +}) diff --git a/plugins/lead-resources/src/plugin.ts b/plugins/lead-resources/src/plugin.ts new file mode 100644 index 0000000000..cbe8172ce1 --- /dev/null +++ b/plugins/lead-resources/src/plugin.ts @@ -0,0 +1,33 @@ +// +// Copyright © 2020 Anticrm Platform Contributors. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { IntlString, mergeIds } from '@anticrm/platform' + +import lead, { leadId } from '@anticrm/lead' + +export default mergeIds(leadId, lead, { + string: { + FunnelName: '' as IntlString, + MakePrivate: '' as IntlString, + MakePrivateDescription: '' as IntlString, + CreateFunnel: '' as IntlString, + LeadName: '' as IntlString, + More: '' as IntlString, + SelectFunnel: '' as IntlString, + CreateLead: '' as IntlString, + Customer: '' as IntlString, + SelectCustomer: '' as IntlString + } +}) diff --git a/plugins/lead-resources/svelte.config.js b/plugins/lead-resources/svelte.config.js new file mode 100644 index 0000000000..944a06f73e --- /dev/null +++ b/plugins/lead-resources/svelte.config.js @@ -0,0 +1,5 @@ +const sveltePreprocess = require('svelte-preprocess') + +module.exports = { + preprocess: sveltePreprocess() +}; \ No newline at end of file diff --git a/plugins/lead-resources/tsconfig.json b/plugins/lead-resources/tsconfig.json new file mode 100644 index 0000000000..cabe5aefad --- /dev/null +++ b/plugins/lead-resources/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "target": "esnext", + "module": "esnext", + "declaration": true, + "outDir": "./lib", + "strict": true, + "esModuleInterop": true, + "lib": [ + "esnext", + "dom" + ] + } +} \ No newline at end of file diff --git a/plugins/lead/.eslintrc.js b/plugins/lead/.eslintrc.js new file mode 100644 index 0000000000..5da5872d4a --- /dev/null +++ b/plugins/lead/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/plugins/lead/.npmignore b/plugins/lead/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/plugins/lead/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/plugins/lead/package.json b/plugins/lead/package.json new file mode 100644 index 0000000000..1b81263b14 --- /dev/null +++ b/plugins/lead/package.json @@ -0,0 +1,34 @@ +{ + "name": "@anticrm/lead", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.41.1", + "typescript": "^4.3.5" + }, + "dependencies": { + "@anticrm/contact": "~0.6.2", + "@anticrm/core": "~0.6.11", + "@anticrm/platform": "~0.6.5", + "@anticrm/view": "~0.6.0" + } +} diff --git a/plugins/lead/src/index.ts b/plugins/lead/src/index.ts new file mode 100644 index 0000000000..d3a46b25f7 --- /dev/null +++ b/plugins/lead/src/index.ts @@ -0,0 +1,97 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { plugin } from '@anticrm/platform' +import type { Asset, Plugin } from '@anticrm/platform' +import core from '@anticrm/core' +import view, { Kanban } from '@anticrm/view' +import type { Class, Data, Doc, DocWithState, Ref, Space, SpaceWithStates, State } from '@anticrm/core' +import type { Contact } from '@anticrm/contact' + +/** + * @public + */ +export interface Funnel extends SpaceWithStates {} + +/** + * @public + */ +export interface Lead extends DocWithState { + title: string + customer: Ref + + comments?: number + attachments?: number +} + +/** + * @public + */ +export const leadId = 'lead' as Plugin + +export default plugin(leadId, { + class: { + Lead: '' as Ref>, + Funnel: '' as Ref> + }, + icon: { + Funnel: '' as Asset, + Lead: '' as Asset, + LeadApplication: '' as Asset + } +}) + +/** + * @public + */ +export async function createKanban ( + funnelId: Ref, + factory: (_class: Ref>, space: Ref, data: Data, id: Ref) => Promise +): Promise { + const states = [ + { color: '#7C6FCD', name: 'Incoming' }, + { color: '#6F7BC5', name: 'Negotation' }, + { color: '#77C07B', name: 'Offer preparing' }, + { color: '#A5D179', name: 'Make a decision' }, + { color: '#F28469', name: 'Contract conclusion' }, + { color: '#7C6FCD', name: 'Done' } + ] + const ids: Array> = [] + for (const st of states) { + const sid = (funnelId + '.state.' + st.name.toLowerCase().replace(' ', '_')) as Ref + await factory( + core.class.State, + funnelId, + { + title: st.name, + color: st.color + }, + sid + ) + ids.push(sid) + } + + await factory( + view.class.Kanban, + funnelId, + { + attachedTo: funnelId, + states: ids, + order: [] + }, + (funnelId + '.kanban.') as Ref + ) +} diff --git a/plugins/lead/tsconfig.json b/plugins/lead/tsconfig.json new file mode 100644 index 0000000000..32045300ce --- /dev/null +++ b/plugins/lead/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "lib": ["esnext", "dom"] + } +} \ No newline at end of file diff --git a/plugins/recruit-resources/package.json b/plugins/recruit-resources/package.json index 54cb20568c..0c80c33cb4 100644 --- a/plugins/recruit-resources/package.json +++ b/plugins/recruit-resources/package.json @@ -45,6 +45,7 @@ "@anticrm/panel": "~0.6.0", "@anticrm/activity":"~0.6.0", "@anticrm/attachment": "~0.6.0", + "@anticrm/attachment-resources": "~0.6.0", "@anticrm/chunter-resources": "~0.6.0", "@anticrm/view": "~0.6.0", "@anticrm/view-resources": "~0.6.0" diff --git a/plugins/recruit-resources/src/components/EditApplication.svelte b/plugins/recruit-resources/src/components/EditApplication.svelte index 74d2445fab..69bc51e3d0 100644 --- a/plugins/recruit-resources/src/components/EditApplication.svelte +++ b/plugins/recruit-resources/src/components/EditApplication.svelte @@ -19,7 +19,7 @@ import { createQuery } from '@anticrm/presentation' import { Panel } from '@anticrm/panel' import type { Candidate, Applicant, Vacancy } from '@anticrm/recruit' - import attachment from '@anticrm/attachment' + import { Attachments } from '@anticrm/attachment-resources' import Contact from './icons/Contact.svelte' import CandidateCard from './CandidateCard.svelte' import VacancyCard from './VacancyCard.svelte' @@ -27,7 +27,6 @@ import recruit from '../plugin' import { formatName } from '@anticrm/contact' import ApplicantHeader from './ApplicantHeader.svelte' - import { Component } from '@anticrm/ui' export let _id: Ref let object: Applicant @@ -56,7 +55,7 @@
- +
diff --git a/plugins/recruit-resources/src/components/EditCandidate.svelte b/plugins/recruit-resources/src/components/EditCandidate.svelte index 761450924d..d48a269ca3 100644 --- a/plugins/recruit-resources/src/components/EditCandidate.svelte +++ b/plugins/recruit-resources/src/components/EditCandidate.svelte @@ -16,14 +16,14 @@