From ffb0ae7a79f62a84c0647348aad9c4ff40bbb065 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 1 Aug 2023 18:20:51 +0530 Subject: [PATCH] fix: added form control in details section --- frontend/src/pages/Lead.vue | 99 ++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 12 deletions(-) diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index 923f8ccc..b513e065 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -61,7 +61,7 @@ -
+
{{ section.label }} @@ -90,10 +90,55 @@
{{ field.label }}
-
{{ field.value }}
+
+ + + + + + + + +
+ {{ lead.doc[field.name] }} +
+
@@ -118,6 +163,8 @@ import { createDocumentResource, Avatar, FeatherIcon, + Autocomplete, + FormControl, Dropdown, } from 'frappe-ui' import { TransitionPresets, useTransition } from '@vueuse/core' @@ -125,7 +172,7 @@ import { usersStore } from '@/stores/users' import { ref, computed, h } from 'vue' import Breadcrumbs from '@/components/Breadcrumbs.vue' -const { getUser } = usersStore() +const { getUser, users } = usersStore() const props = defineProps({ leadId: { @@ -271,19 +318,30 @@ const detailSections = computed(() => { fields: [ { label: 'Status', - value: lead.doc.status, + type: 'select', + name: 'status', + options: [ + { label: 'New', value: 'New' }, + { label: 'Contact made', value: 'Contact made' }, + { label: 'Proposal made', value: 'Proposal made' }, + { label: 'Negotiation', value: 'Negotiation' }, + { label: 'Converted', value: 'Converted' }, + ], }, { label: 'Lead Owner', - value: getUser(lead.doc.lead_owner).full_name, + type: 'link', + name: 'full_name', }, { label: 'Organization', - value: lead.doc.organization_name, + type: 'data', + name: 'organization_name', }, { label: 'Website', - value: lead.doc.organization_website, + type: 'data', + name: 'organization_website', }, ], }, @@ -293,18 +351,35 @@ const detailSections = computed(() => { fields: [ { label: 'Name', - value: lead.doc.lead_name, + type: 'data', + name: 'lead_name', }, { label: 'Email', - value: lead.doc.email, + type: 'email', + name: 'email', }, { label: 'Mobile No.', - value: lead.doc.mobile_no, + type: 'phone', + name: 'mobile_no', }, ], }, ] }) + +const activeAgents = computed(() => { + const nonAgents = ['Administrator', '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, + } + }) +})