Skip to content

Commit

Permalink
fix: ticket: missing assignee (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad authored Jun 22, 2023
1 parent c08c70d commit 94e80c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion desk/src/pages/desk/ticket/TicketDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Last assignee from the list, where expected list length is just one. Transformed
object to be used with `Autocomplete`
*/
const assignedTo = computed(() => {
const assigned = [ticket.getAssignees.data?.message || []].pop();
const assigned = (ticket.getAssignees.data?.message || []).pop();
return agentStore.dropdown.find((agent) => agent.value === assigned?.name);
});
Expand Down
45 changes: 23 additions & 22 deletions desk/src/stores/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@ import { defineStore } from "pinia";
import { createListResource } from "frappe-ui";

type Agent = {
name: string;
agent_name: string;
is_active: boolean;
name: string;
agent_name: string;
is_active: boolean;
};

export const useAgentStore = defineStore("agent", () => {
const d__ = createListResource({
doctype: "HD Agent",
fields: ["*"],
auto: true,
pageLength: 99999,
});
const d__ = createListResource({
doctype: "HD Agent",
fields: ["*"],
auto: true,
pageLength: 99999,
});

const options: ComputedRef<Array<Agent>> = computed(
() => d__.list?.data || []
);
const dropdown = computed(() =>
options.value.map((o) => ({
label: o.agent_name,
value: o.name,
}))
);
const options: ComputedRef<Array<Agent>> = computed(
() => d__.list?.data || []
);

return {
dropdown,
options,
};
const dropdown = computed(() =>
options.value.map((o) => ({
label: o.agent_name,
value: o.name,
}))
);

return {
dropdown,
options,
};
});

0 comments on commit 94e80c8

Please sign in to comment.