From 2a4661748df3a61ff64151914601a2115be30834 Mon Sep 17 00:00:00 2001 From: Denis Maslennikov <41147528+disant1@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:52:41 +0700 Subject: [PATCH] TSK-344: Draft for new Candidate/Person etc (#2432) --- models/recruit/src/index.ts | 3 +- .../src/components/EditableAvatar.svelte | 2 +- .../src/components/SelectAvatarPopup.svelte | 4 + .../src/components/CreateContact.svelte | 2 +- plugins/recruit-assets/lang/en.json | 3 + plugins/recruit-assets/lang/ru.json | 5 +- .../src/components/CreateCandidate.svelte | 219 +++++++++++++++--- .../src/components/NewCandidateHeader.svelte | 36 ++- plugins/recruit-resources/src/plugin.ts | 3 + plugins/recruit/package.json | 3 +- plugins/recruit/src/index.ts | 26 ++- tests/sanity/tests/tags.spec.ts | 2 +- 12 files changed, 269 insertions(+), 39 deletions(-) diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index d9e8f1ed85..874f3f78c2 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -224,7 +224,8 @@ export function createModel (builder: Builder): void { icon: contact.icon.Person, label: recruit.string.Talents, createLabel: recruit.string.TalentCreateLabel, - createComponent: recruit.component.CreateCandidate + createComponent: recruit.component.CreateCandidate, + createComponentProps: { shouldSaveDraft: true } }, position: 'vacancy' }, diff --git a/packages/presentation/src/components/EditableAvatar.svelte b/packages/presentation/src/components/EditableAvatar.svelte index 0253f6d63f..6a5af908ee 100644 --- a/packages/presentation/src/components/EditableAvatar.svelte +++ b/packages/presentation/src/components/EditableAvatar.svelte @@ -64,7 +64,7 @@ async function showSelectionPopup (e: MouseEvent) { if (!disabled) { - showPopup(SelectAvatarPopup, { avatar, email, id, icon, onSubmit: handlePopupSubmit }) + showPopup(SelectAvatarPopup, { avatar, email, id, file: direct, icon, onSubmit: handlePopupSubmit }) } } diff --git a/packages/presentation/src/components/SelectAvatarPopup.svelte b/packages/presentation/src/components/SelectAvatarPopup.svelte index 69f3fac822..7e747ac53f 100644 --- a/packages/presentation/src/components/SelectAvatarPopup.svelte +++ b/packages/presentation/src/components/SelectAvatarPopup.svelte @@ -35,6 +35,9 @@ const [schema, uri] = avatar?.split('://') || [] const initialSelectedType = (() => { + if (file) { + return AvatarType.IMAGE + } if (!avatar) { return AvatarType.COLOR } @@ -117,6 +120,7 @@ selectedFile = undefined } else { selectedFile = blob + selectedAvatarType = AvatarType.IMAGE } }) } diff --git a/plugins/contact-resources/src/components/CreateContact.svelte b/plugins/contact-resources/src/components/CreateContact.svelte index cf70e61abf..6a9dda6ecd 100644 --- a/plugins/contact-resources/src/components/CreateContact.svelte +++ b/plugins/contact-resources/src/components/CreateContact.svelte @@ -22,7 +22,7 @@ if (component) { action = async () => { closePopup() - showPopup(component, {}, 'top') + showPopup(component, { shouldSaveDraft: true }, 'top') } } else if (create) { action = await getResource(create) diff --git a/plugins/recruit-assets/lang/en.json b/plugins/recruit-assets/lang/en.json index a2d3ec558b..b305619c4e 100644 --- a/plugins/recruit-assets/lang/en.json +++ b/plugins/recruit-assets/lang/en.json @@ -20,6 +20,9 @@ "Talent": "Talent", "TalentCreateLabel": "Talent", "CreateTalent": "New Talent", + "CreateTalentDialogClose": "Do you want to close this dialog?", + "CreateTalentDialogCloseNote": "All changes will be lost", + "ResumeDraft": "Resume draft", "AssignRecruiter": "Assign recruiter", "UnAssignRecruiter": "Unassign recruiter", "UnAssignCompany": "Unassign Company", diff --git a/plugins/recruit-assets/lang/ru.json b/plugins/recruit-assets/lang/ru.json index ec32948c64..b0e808ef8b 100644 --- a/plugins/recruit-assets/lang/ru.json +++ b/plugins/recruit-assets/lang/ru.json @@ -17,8 +17,11 @@ "CreateApplication": "Новый Кандидат", "SelectVacancy": "Выбрать вакансию", "Talent": "Талант", - "TalentCreateLabel": "Таланта", + "TalentCreateLabel": "Талант", "CreateTalent": "Новый Талант", + "CreateTalentDialogClose": "Вы действительно хотите закрыть окно?", + "CreateTalentDialogCloseNote": "Все внесенные изменения будут потеряны", + "ResumeDraft": "Восстановить черновик", "AssignRecruiter": "Назначить рекрутера", "UnAssignRecruiter": "Отменить назначение рекрутера", "UnAssignCompany": "Отменить назначение компании", diff --git a/plugins/recruit-resources/src/components/CreateCandidate.svelte b/plugins/recruit-resources/src/components/CreateCandidate.svelte index 78ec62f760..42903f0c18 100644 --- a/plugins/recruit-resources/src/components/CreateCandidate.svelte +++ b/plugins/recruit-resources/src/components/CreateCandidate.svelte @@ -14,6 +14,7 @@ --> @@ -409,6 +575,7 @@ on:close={() => { dispatch('close') }} + onCancel={showConfirmationDialog} bind:createMore > diff --git a/plugins/recruit-resources/src/components/NewCandidateHeader.svelte b/plugins/recruit-resources/src/components/NewCandidateHeader.svelte index cf8aad7a50..bea6f3bb10 100644 --- a/plugins/recruit-resources/src/components/NewCandidateHeader.svelte +++ b/plugins/recruit-resources/src/components/NewCandidateHeader.svelte @@ -13,12 +13,19 @@ // limitations under the License. --> @@ -26,10 +33,29 @@
+ + diff --git a/plugins/recruit-resources/src/plugin.ts b/plugins/recruit-resources/src/plugin.ts index 8ab0abf36e..84bebff7f6 100644 --- a/plugins/recruit-resources/src/plugin.ts +++ b/plugins/recruit-resources/src/plugin.ts @@ -48,6 +48,9 @@ export default mergeIds(recruitId, recruit, { Talent: '' as IntlString, TalentCreateLabel: '' as IntlString, CreateTalent: '' as IntlString, + CreateTalentDialogClose: '' as IntlString, + CreateTalentDialogCloseNote: '' as IntlString, + ResumeDraft: '' as IntlString, AssignRecruiter: '' as IntlString, Recruiters: '' as IntlString, UnAssignRecruiter: '' as IntlString, diff --git a/plugins/recruit/package.json b/plugins/recruit/package.json index 36e6fd410a..e6df751a24 100644 --- a/plugins/recruit/package.json +++ b/plugins/recruit/package.json @@ -32,6 +32,7 @@ "@hcengineering/chunter": "~0.6.1", "@hcengineering/task": "~0.6.0", "@hcengineering/calendar": "~0.6.1", - "@hcengineering/ui": "^0.6.2" + "@hcengineering/ui": "^0.6.2", + "@hcengineering/tags": "~0.6.2" } } diff --git a/plugins/recruit/src/index.ts b/plugins/recruit/src/index.ts index d83ee3381a..3b1665f403 100644 --- a/plugins/recruit/src/index.ts +++ b/plugins/recruit/src/index.ts @@ -14,12 +14,13 @@ // import { Event } from '@hcengineering/calendar' -import type { Organization, Person } from '@hcengineering/contact' -import type { AttachedDoc, Class, Doc, Mixin, Ref, Space, Timestamp } from '@hcengineering/core' +import type { Channel, Organization, Person } from '@hcengineering/contact' +import type { AttachedData, AttachedDoc, Class, Doc, Mixin, Ref, Space, Timestamp } from '@hcengineering/core' import type { Asset, Plugin } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' import type { KanbanTemplateSpace, SpaceWithStates, Task } from '@hcengineering/task' import { AnyComponent } from '@hcengineering/ui' +import { TagReference } from '@hcengineering/tags' /** * @public @@ -58,6 +59,27 @@ export interface Candidate extends Person { reviews?: number } +/** + * @public + */ +export interface CandidateDraft extends Doc { + candidateId: Ref + firstName?: string + lastName?: string + title?: string + city: string + resumeUuid?: string + resumeName?: string + resumeSize?: number + resumeType?: string + resumeLastModified?: number + avatar?: File | undefined + channels: AttachedData[] + onsite?: boolean + remote?: boolean + skills: TagReference[] +} + /** * @public */ diff --git a/tests/sanity/tests/tags.spec.ts b/tests/sanity/tests/tags.spec.ts index f640eb1ae1..d202ccea98 100644 --- a/tests/sanity/tests/tags.spec.ts +++ b/tests/sanity/tests/tags.spec.ts @@ -43,7 +43,7 @@ test.describe('recruit tests', () => { // Click :nth-match(:text("Cancel"), 2) // await page.click('button:has-text("Cancel")') await page.keyboard.press('Escape') - await page.keyboard.press('Escape') + // await page.keyboard.press('Escape') // Click button:has-text("Create") await page.click('button:has-text("Create")') await page.waitForSelector('form.antiCard', { state: 'detached' })