mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
UBER-49: custom fields in CreateLead (#3249)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
867bc5ae91
commit
71193c54c2
@ -14,12 +14,12 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import contact, { Contact, Employee } from '@hcengineering/contact'
|
import contact, { Contact } from '@hcengineering/contact'
|
||||||
import { AttachedData, generateId, Ref, SortingOrder, Space } from '@hcengineering/core'
|
import { AttachedData, generateId, Ref, SortingOrder, Space } from '@hcengineering/core'
|
||||||
import type { Customer, Funnel, Lead } from '@hcengineering/lead'
|
import type { Customer, Funnel, Lead } from '@hcengineering/lead'
|
||||||
import { OK, Status } from '@hcengineering/platform'
|
import { OK, Status } from '@hcengineering/platform'
|
||||||
import { Card, createQuery, getClient, SpaceSelector } from '@hcengineering/presentation'
|
import { Card, createQuery, getClient, InlineAttributeBar, SpaceSelector } from '@hcengineering/presentation'
|
||||||
import { EmployeeBox, UserBox } from '@hcengineering/contact-resources'
|
import { UserBox } from '@hcengineering/contact-resources'
|
||||||
import task, { calcRank } from '@hcengineering/task'
|
import task, { calcRank } from '@hcengineering/task'
|
||||||
import { Button, createFocusManager, EditBox, FocusHandler, Label, Status as StatusControl } from '@hcengineering/ui'
|
import { Button, createFocusManager, EditBox, FocusHandler, Label, Status as StatusControl } from '@hcengineering/ui'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
@ -33,6 +33,7 @@
|
|||||||
const status: Status = OK
|
const status: Status = OK
|
||||||
|
|
||||||
let title: string = ''
|
let title: string = ''
|
||||||
|
const object: Partial<Lead> = {}
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
@ -52,8 +53,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let assignee: Ref<Employee> | undefined = undefined
|
|
||||||
|
|
||||||
async function createLead () {
|
async function createLead () {
|
||||||
const state = await client.findOne(task.class.State, { space: _space }, { sort: { rank: SortingOrder.Ascending } })
|
const state = await client.findOne(task.class.State, { space: _space }, { sort: { rank: SortingOrder.Ascending } })
|
||||||
if (state === undefined) {
|
if (state === undefined) {
|
||||||
@ -75,7 +74,8 @@
|
|||||||
rank: calcRank(lastOne, undefined),
|
rank: calcRank(lastOne, undefined),
|
||||||
assignee: null,
|
assignee: null,
|
||||||
startDate: null,
|
startDate: null,
|
||||||
dueDate: null
|
dueDate: null,
|
||||||
|
...object
|
||||||
}
|
}
|
||||||
|
|
||||||
const customerInstance = await client.findOne(contact.class.Contact, { _id: customer! })
|
const customerInstance = await client.findOne(contact.class.Contact, { _id: customer! })
|
||||||
@ -151,16 +151,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<svelte:fragment slot="pool">
|
<svelte:fragment slot="pool">
|
||||||
<EmployeeBox
|
|
||||||
focusIndex={2}
|
|
||||||
label={lead.string.Assignee}
|
|
||||||
kind={'secondary'}
|
|
||||||
size={'large'}
|
|
||||||
bind:value={assignee}
|
|
||||||
allowDeselect
|
|
||||||
showNavigate={false}
|
|
||||||
titleDeselect={lead.string.UnAssign}
|
|
||||||
/>
|
|
||||||
{#if !preserveCustomer}
|
{#if !preserveCustomer}
|
||||||
<UserBox
|
<UserBox
|
||||||
focusIndex={2}
|
focusIndex={2}
|
||||||
@ -173,5 +163,12 @@
|
|||||||
create={{ component: lead.component.CreateCustomer, label: lead.string.CreateCustomer }}
|
create={{ component: lead.component.CreateCustomer, label: lead.string.CreateCustomer }}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
<InlineAttributeBar
|
||||||
|
_class={lead.class.Lead}
|
||||||
|
{object}
|
||||||
|
toClass={task.class.Task}
|
||||||
|
on:update
|
||||||
|
extraProps={{ showNavigate: false }}
|
||||||
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</Card>
|
</Card>
|
||||||
|
Loading…
Reference in New Issue
Block a user