fix: replaced all User Autocomplete with Link Component
This commit is contained in:
parent
512783e7af
commit
d41219b446
@ -44,19 +44,25 @@
|
|||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Autocomplete
|
<Link
|
||||||
:options="activeAgents"
|
class="form-control"
|
||||||
:value="getUser(_task.assigned_to).full_name"
|
:value="getUser(_task.assigned_to).full_name"
|
||||||
@change="(option) => (_task.assigned_to = option.email)"
|
doctype="User"
|
||||||
|
@change="(option) => (_task.assigned_to = option)"
|
||||||
placeholder="Assignee"
|
placeholder="Assignee"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<UserAvatar class="mr-2 !h-4 !w-4" :user="_task.assigned_to" />
|
<UserAvatar class="mr-2 !h-4 !w-4" :user="_task.assigned_to" />
|
||||||
</template>
|
</template>
|
||||||
<template #item-prefix="{ option }">
|
<template #item-prefix="{ option }">
|
||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
</Autocomplete>
|
<template #item-label="{ option }">
|
||||||
|
<Tooltip :text="option.value">
|
||||||
|
{{ getUser(option.value).full_name }}
|
||||||
|
</Tooltip>
|
||||||
|
</template>
|
||||||
|
</Link>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
class="datepicker w-36"
|
class="datepicker w-36"
|
||||||
v-model="_task.due_date"
|
v-model="_task.due_date"
|
||||||
@ -81,14 +87,15 @@
|
|||||||
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
||||||
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
import { activeAgents, taskStatusOptions, taskPriorityOptions } from '@/utils'
|
import Link from '@/components/Controls/Link.vue'
|
||||||
|
import { taskStatusOptions, taskPriorityOptions } from '@/utils'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import {
|
import {
|
||||||
TextInput,
|
TextInput,
|
||||||
TextEditor,
|
TextEditor,
|
||||||
Dialog,
|
Dialog,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Autocomplete,
|
Tooltip,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
call,
|
call,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
|
|||||||
@ -45,24 +45,11 @@
|
|||||||
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
<template #item-label="{ option }">
|
<template #item-label="{ option }">
|
||||||
{{ getUser(option.value).full_name }}
|
<Tooltip :text="option.value">
|
||||||
|
{{ getUser(option.value).full_name }}
|
||||||
|
</Tooltip>
|
||||||
</template>
|
</template>
|
||||||
</Link>
|
</Link>
|
||||||
<FormControl
|
|
||||||
v-else-if="field.type === 'user'"
|
|
||||||
type="autocomplete"
|
|
||||||
:options="activeAgents"
|
|
||||||
:value="getUser(newDeal[field.name]).full_name"
|
|
||||||
@change="(option) => (newDeal[field.name] = option.email)"
|
|
||||||
:placeholder="field.placeholder"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<UserAvatar class="mr-2" :user="newDeal[field.name]" size="sm" />
|
|
||||||
</template>
|
|
||||||
<template #item-prefix="{ option }">
|
|
||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
|
||||||
</template>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl v-else type="text" v-model="newDeal[field.name]" />
|
<FormControl v-else type="text" v-model="newDeal[field.name]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -85,8 +72,7 @@ import Link from '@/components/Controls/Link.vue'
|
|||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { activeAgents } from '@/utils'
|
import { FormControl, Tooltip } from 'frappe-ui'
|
||||||
import { FormControl, Button, Dropdown, FeatherIcon } from 'frappe-ui'
|
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
|
|||||||
@ -45,7 +45,9 @@
|
|||||||
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
<template #item-label="{ option }">
|
<template #item-label="{ option }">
|
||||||
{{ getUser(option.value).full_name }}
|
<Tooltip :text="option.value">
|
||||||
|
{{ getUser(option.value).full_name }}
|
||||||
|
</Tooltip>
|
||||||
</template>
|
</template>
|
||||||
</Link>
|
</Link>
|
||||||
<FormControl v-else type="text" v-model="newLead[field.name]" />
|
<FormControl v-else type="text" v-model="newLead[field.name]" />
|
||||||
@ -70,8 +72,7 @@ import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
|||||||
import Link from '@/components/Controls/Link.vue'
|
import Link from '@/components/Controls/Link.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { activeAgents } from '@/utils'
|
import { FormControl, Tooltip } from 'frappe-ui'
|
||||||
import { FormControl, Button, Dropdown, FeatherIcon } from 'frappe-ui'
|
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
|
|||||||
@ -4,20 +4,25 @@
|
|||||||
<Breadcrumbs :items="breadcrumbs" />
|
<Breadcrumbs :items="breadcrumbs" />
|
||||||
</template>
|
</template>
|
||||||
<template #right-header>
|
<template #right-header>
|
||||||
<FormControl
|
<Link
|
||||||
type="autocomplete"
|
class="form-control"
|
||||||
:options="activeAgents"
|
|
||||||
:value="getUser(deal.data.deal_owner).full_name"
|
:value="getUser(deal.data.deal_owner).full_name"
|
||||||
@change="(option) => updateField('deal_owner', option.email)"
|
doctype="User"
|
||||||
placeholder="Deal owner"
|
@change="(option) => updateField('deal_owner', option)"
|
||||||
|
placeholder="Deal Owner"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<UserAvatar class="mr-2" :user="deal.data.deal_owner" size="sm" />
|
<UserAvatar class="mr-2" :user="deal.data.deal_owner" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
<template #item-prefix="{ option }">
|
<template #item-prefix="{ option }">
|
||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
<template #item-label="{ option }">
|
||||||
|
<Tooltip :text="option.value">
|
||||||
|
{{ getUser(option.value).full_name }}
|
||||||
|
</Tooltip>
|
||||||
|
</template>
|
||||||
|
</Link>
|
||||||
<Dropdown :options="statusOptions('deal', updateField)">
|
<Dropdown :options="statusOptions('deal', updateField)">
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button
|
<Button
|
||||||
@ -344,7 +349,6 @@ import SectionFields from '@/components/SectionFields.vue'
|
|||||||
import {
|
import {
|
||||||
openWebsite,
|
openWebsite,
|
||||||
createToast,
|
createToast,
|
||||||
activeAgents,
|
|
||||||
dateFormat,
|
dateFormat,
|
||||||
timeAgo,
|
timeAgo,
|
||||||
formatTime,
|
formatTime,
|
||||||
@ -356,7 +360,6 @@ import { statusesStore } from '@/stores/statuses'
|
|||||||
import {
|
import {
|
||||||
createResource,
|
createResource,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
FormControl,
|
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Avatar,
|
Avatar,
|
||||||
|
|||||||
@ -4,20 +4,25 @@
|
|||||||
<Breadcrumbs :items="breadcrumbs" />
|
<Breadcrumbs :items="breadcrumbs" />
|
||||||
</template>
|
</template>
|
||||||
<template #right-header>
|
<template #right-header>
|
||||||
<FormControl
|
<Link
|
||||||
type="autocomplete"
|
class="form-control"
|
||||||
:options="activeAgents"
|
|
||||||
:value="getUser(lead.data.lead_owner).full_name"
|
:value="getUser(lead.data.lead_owner).full_name"
|
||||||
@change="(option) => updateField('lead_owner', option.email)"
|
doctype="User"
|
||||||
placeholder="Lead owner"
|
@change="(option) => updateField('lead_owner', option)"
|
||||||
|
placeholder="Lead Owner"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<UserAvatar class="mr-2" :user="lead.data.lead_owner" size="sm" />
|
<UserAvatar class="mr-2" :user="lead.data.lead_owner" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
<template #item-prefix="{ option }">
|
<template #item-prefix="{ option }">
|
||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
<UserAvatar class="mr-2" :user="option.value" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
<template #item-label="{ option }">
|
||||||
|
<Tooltip :text="option.value">
|
||||||
|
{{ getUser(option.value).full_name }}
|
||||||
|
</Tooltip>
|
||||||
|
</template>
|
||||||
|
</Link>
|
||||||
<Dropdown :options="statusOptions('lead', updateField)">
|
<Dropdown :options="statusOptions('lead', updateField)">
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button
|
<Button
|
||||||
@ -247,10 +252,10 @@ import UserAvatar from '@/components/UserAvatar.vue'
|
|||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import Section from '@/components/Section.vue'
|
import Section from '@/components/Section.vue'
|
||||||
import SectionFields from '@/components/SectionFields.vue'
|
import SectionFields from '@/components/SectionFields.vue'
|
||||||
|
import Link from '@/components/Controls/Link.vue'
|
||||||
import {
|
import {
|
||||||
openWebsite,
|
openWebsite,
|
||||||
createToast,
|
createToast,
|
||||||
activeAgents,
|
|
||||||
dateFormat,
|
dateFormat,
|
||||||
timeAgo,
|
timeAgo,
|
||||||
formatTime,
|
formatTime,
|
||||||
@ -264,7 +269,6 @@ import {
|
|||||||
FileUploader,
|
FileUploader,
|
||||||
ErrorMessage,
|
ErrorMessage,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
FormControl,
|
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Avatar,
|
Avatar,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
||||||
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
|
||||||
import { useDateFormat, useTimeAgo } from '@vueuse/core'
|
import { useDateFormat, useTimeAgo } from '@vueuse/core'
|
||||||
import { toast } from 'frappe-ui'
|
import { toast } from 'frappe-ui'
|
||||||
import { h, computed } from 'vue'
|
import { h, computed } from 'vue'
|
||||||
@ -107,19 +106,3 @@ export function formatNumberIntoCurrency(value) {
|
|||||||
export function startCase(str) {
|
export function startCase(str) {
|
||||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { users } = usersStore()
|
|
||||||
|
|
||||||
export const activeAgents = computed(() => {
|
|
||||||
const nonAgents = ['Administrator', 'admin@example.com', 'Guest']
|
|
||||||
return users.data
|
|
||||||
.filter((user) => !nonAgents.includes(user.name))
|
|
||||||
.sort((a, b) => a.full_name - b.full_name)
|
|
||||||
.map((user) => {
|
|
||||||
return {
|
|
||||||
label: user.full_name,
|
|
||||||
value: user.email,
|
|
||||||
...user,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user