Skip to content

Commit

Permalink
fix(ux): assign: use HD Agent instead of User (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad committed Jul 11, 2023
1 parent 67dde67 commit 6de4cfb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
6 changes: 3 additions & 3 deletions desk/src/pages/desk/ticket-list/AssignedInfo.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<Tooltip v-if="agent" :text="getTooltipLabel(user.doc?.full_name)">
<Tooltip v-if="agent" :text="getTooltipLabel(user.doc?.agent_name)">
<Avatar
size="sm"
:label="user.doc?.full_name"
:label="user.doc?.agent_name"
:image="user.doc?.user_image"
/>
</Tooltip>
Expand All @@ -24,7 +24,7 @@ const assign = toRef(props, "assign");
const assignJson = computed(() => JSON.parse(assign.value));
const agent = computed(() => [...assignJson.value].pop());
const user = createDocumentResource({
doctype: "User",
doctype: "HD Agent",
name: agent.value,
auto: true,
cache: ["User", agent.value],
Expand Down
13 changes: 8 additions & 5 deletions helpdesk/helpdesk/doctype/hd_agent/hd_agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"fetch_from": "user.full_name",
"fieldname": "agent_name",
"fieldtype": "Data",
"hidden": 1,
"in_global_search": 1,
"in_standard_filter": 1,
"label": "Agent Name"
"is_virtual": 1,
"label": "Full name",
"read_only": 1
},
{
"default": "1",
Expand All @@ -45,12 +46,14 @@
"fetch_from": "user.user_image",
"fieldname": "user_image",
"fieldtype": "Data",
"label": "User Image"
"is_virtual": 1,
"label": "Image",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-03-26 23:16:09.421336",
"modified": "2023-07-11 15:44:27.134778",
"modified_by": "Administrator",
"module": "Helpdesk",
"name": "HD Agent",
Expand Down Expand Up @@ -96,4 +99,4 @@
"states": [],
"title_field": "agent_name",
"track_changes": 1
}
}
10 changes: 10 additions & 0 deletions helpdesk/helpdesk/doctype/hd_agent/hd_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ def in_group(self, group):

return False

@property
def agent_name(self):
user = frappe.get_cached_doc("User", self.user)
return user.full_name

@property
def user_image(self):
user = frappe.get_cached_doc("User", self.user)
return user.user_image


@frappe.whitelist()
def create_hd_agent(first_name, last_name, email, signature, team):
Expand Down

0 comments on commit 6de4cfb

Please sign in to comment.