1
0
forked from test/crm

fix: created crm lead doctype and loaded the data in listview

also created some related doctypes
This commit is contained in:
Shariq Ansari 2023-07-25 11:37:48 +05:30
parent cd77d8ef78
commit 16fb41e609
17 changed files with 433 additions and 30 deletions

View File

View File

View File

@ -0,0 +1,8 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("CRM Industry", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,48 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:industry",
"creation": "2023-07-24 19:40:31.980882",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"industry"
],
"fields": [
{
"fieldname": "industry",
"fieldtype": "Data",
"label": "Industry",
"unique": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-07-24 19:40:31.980882",
"modified_by": "Administrator",
"module": "CRM",
"name": "CRM Industry",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CRMIndustry(Document):
pass

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestCRMIndustry(FrappeTestCase):
pass

View File

View File

@ -0,0 +1,8 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("CRM Lead", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,198 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "naming_series:",
"creation": "2023-07-24 12:19:39.616298",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"naming_series",
"salutation",
"first_name",
"middle_name",
"last_name",
"column_break_izjs",
"full_name",
"gender",
"column_break_lcuv",
"lead_owner",
"status",
"source",
"section_break_ymew",
"email",
"website",
"column_break_sijm",
"mobile_no",
"column_break_sjtw",
"phone",
"section_break_uixv",
"organization_name",
"no_of_employees",
"column_break_dbsv",
"annual_revenue",
"industry"
],
"fields": [
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"options": "CRM-LEAD-.YYYY.-"
},
{
"fieldname": "salutation",
"fieldtype": "Link",
"label": "Salutation",
"options": "Salutation"
},
{
"fieldname": "first_name",
"fieldtype": "Data",
"label": "First Name"
},
{
"fieldname": "middle_name",
"fieldtype": "Data",
"label": "Middle Name"
},
{
"fieldname": "last_name",
"fieldtype": "Data",
"label": "Last Name"
},
{
"fieldname": "column_break_lcuv",
"fieldtype": "Column Break"
},
{
"fieldname": "full_name",
"fieldtype": "Data",
"label": "Full Name",
"search_index": 1
},
{
"fieldname": "gender",
"fieldtype": "Link",
"label": "Gender",
"options": "Gender"
},
{
"fieldname": "column_break_izjs",
"fieldtype": "Column Break"
},
{
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Status",
"options": "New\nContact made\nProposal made\nNegotiation\nConverted",
"reqd": 1,
"search_index": 1
},
{
"fieldname": "section_break_ymew",
"fieldtype": "Section Break"
},
{
"fieldname": "email",
"fieldtype": "Data",
"label": "Email",
"options": "Email",
"search_index": 1
},
{
"fieldname": "website",
"fieldtype": "Data",
"label": "Website",
"options": "URL"
},
{
"fieldname": "column_break_sijm",
"fieldtype": "Column Break"
},
{
"fieldname": "mobile_no",
"fieldtype": "Phone",
"label": "Mobile No"
},
{
"fieldname": "column_break_sjtw",
"fieldtype": "Column Break"
},
{
"fieldname": "phone",
"fieldtype": "Phone",
"label": "Phone"
},
{
"fieldname": "section_break_uixv",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_dbsv",
"fieldtype": "Column Break"
},
{
"fieldname": "no_of_employees",
"fieldtype": "Select",
"label": "No. of Employees",
"options": "1-10\n11-50\n51-200\n201-500\n501-1000\n1000+"
},
{
"fieldname": "organization_name",
"fieldtype": "Data",
"label": "Organization Name"
},
{
"fieldname": "annual_revenue",
"fieldtype": "Currency",
"label": "Annual Revenue"
},
{
"fieldname": "lead_owner",
"fieldtype": "Link",
"label": "Lead Owner",
"options": "User"
},
{
"fieldname": "source",
"fieldtype": "Link",
"label": "Source",
"options": "CRM Lead Source"
},
{
"fieldname": "industry",
"fieldtype": "Link",
"label": "Industry",
"options": "CRM Industry"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-07-24 19:43:16.008607",
"modified_by": "Administrator",
"module": "CRM",
"name": "CRM Lead",
"naming_rule": "By \"Naming Series\" field",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CRMLead(Document):
pass

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestCRMLead(FrappeTestCase):
pass

View File

@ -0,0 +1,8 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("CRM Lead Source", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,55 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:source_name",
"creation": "2023-07-24 19:47:01.063203",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"source_name",
"details"
],
"fields": [
{
"fieldname": "source_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Source Name",
"reqd": 1,
"unique": 1
},
{
"fieldname": "details",
"fieldtype": "Text Editor",
"label": "Details"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-07-24 19:48:09.371379",
"modified_by": "Administrator",
"module": "CRM",
"name": "CRM Lead Source",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CRMLeadSource(Document):
pass

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestCRMLeadSource(FrappeTestCase):
pass

View File

@ -4,51 +4,75 @@
<script setup>
import ListView from '../components/ListView.vue'
import { computed } from 'vue'
import { createListResource } from 'frappe-ui'
const title = 'Leads'
const leads = createListResource({
type: 'list',
doctype: 'CRM Lead',
fields: [
'name',
'first_name',
'last_name',
'organization_name',
'status',
'email',
'mobile_no',
'lead_owner',
'modified',
],
orderBy: 'modified asc',
cache: 'Leads',
pageLength: 999,
auto: true,
})
leads.fetch()
const columns = [
{
label: 'Title',
key: 'title',
size: 'flex-1',
},
{
label: 'Company',
key: 'company',
label: 'Full name',
key: 'full_name',
size: 'w-44',
},
{
label: 'Stage',
key: 'stage',
size: 'w-40',
},
{
label: 'Contact',
key: 'contact',
label: 'Organization',
key: 'organization_name',
size: 'w-44',
},
{
label: 'Closed Date',
key: 'closedDate',
label: 'Status',
key: 'status',
size: 'w-44',
},
{
label: 'Value',
key: 'value',
size: 'w-40',
align: 'text-right',
label: 'Email',
key: 'email',
size: 'w-44',
},
{
label: 'Mobile no',
key: 'mobile_no',
size: 'w-44',
},
{
label: 'Lead owner',
key: 'lead_owner',
size: 'w-44',
},
]
const rows = [
{
title: 'Summer Catalog',
company: 'Stripe',
stage: 'Qualified',
contact: 'Angela Bower',
closedDate: '27 Sept, 2023',
value: 99000.0,
},
]
const rows = computed(() => {
return leads.data?.map((lead) => {
return {
full_name: lead.first_name + ' ' + lead.last_name,
organization_name: lead.organization_name,
status: lead.status,
email: lead.email,
mobile_no: lead.mobile_no,
lead_owner: lead.lead_owner,
}
})
})
</script>