From 0177b959caabc477ba70f71dfe0c0a56eb048619 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 6 Feb 2024 18:05:43 +0530 Subject: [PATCH 1/4] fix: allow bulk editing from deals listview --- crm/api/doc.py | 25 +++ .../components/ListViews/DealsListView.vue | 33 +++- .../src/components/Modals/EditValueModal.vue | 156 ++++++++++++++++++ frontend/src/pages/Deals.vue | 1 + 4 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/Modals/EditValueModal.vue diff --git a/crm/api/doc.py b/crm/api/doc.py index e3c8acc4..61755d5a 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -341,3 +341,28 @@ def get_assigned_users(doctype, name): ) return list(set(assigned_users)) + + +@frappe.whitelist() +def get_fields(doctype: str): + not_allowed_fieldtypes = list(frappe.model.no_value_fields) + ["Read Only"] + fields = frappe.get_meta(doctype).fields + + _fields = [] + + for field in fields: + if ( + field.fieldtype not in not_allowed_fieldtypes + and not field.hidden + and not field.read_only + and not field.is_virtual + and field.fieldname + ): + _fields.append({ + "label": field.label, + "type": field.fieldtype, + "value": field.fieldname, + "options": field.options, + }) + + return _fields \ No newline at end of file diff --git a/frontend/src/components/ListViews/DealsListView.vue b/frontend/src/components/ListViews/DealsListView.vue index 9d997421..076456ae 100644 --- a/frontend/src/components/ListViews/DealsListView.vue +++ b/frontend/src/components/ListViews/DealsListView.vue @@ -85,7 +85,15 @@ - + + + + diff --git a/frontend/src/components/Modals/EditValueModal.vue b/frontend/src/components/Modals/EditValueModal.vue new file mode 100644 index 00000000..9d4cdd2c --- /dev/null +++ b/frontend/src/components/Modals/EditValueModal.vue @@ -0,0 +1,156 @@ + + + diff --git a/frontend/src/pages/Deals.vue b/frontend/src/pages/Deals.vue index 14cf8c9c..7c9d51a4 100644 --- a/frontend/src/pages/Deals.vue +++ b/frontend/src/pages/Deals.vue @@ -26,6 +26,7 @@ }" @loadMore="() => loadMore++" @updatePageCount="(count) => (updatedPageCount = count)" + @reload="deals.reload()" />
Date: Tue, 6 Feb 2024 18:25:12 +0530 Subject: [PATCH 2/4] fix: allow bulk editing for all listview --- .../components/ListViews/ContactsListView.vue | 33 ++++++++++-- .../ListViews/EmailTemplatesListView.vue | 51 ++++++++++++++++--- .../components/ListViews/LeadsListView.vue | 33 ++++++++++-- .../ListViews/OrganizationsListView.vue | 33 ++++++++++-- .../components/ListViews/TasksListView.vue | 44 +++++++++++++--- frontend/src/pages/CallLogs.vue | 1 + frontend/src/pages/Contacts.vue | 1 + frontend/src/pages/EmailTemplates.vue | 2 +- frontend/src/pages/Leads.vue | 1 + frontend/src/pages/Organizations.vue | 1 + frontend/src/pages/Tasks.vue | 2 +- 11 files changed, 176 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/ListViews/ContactsListView.vue b/frontend/src/components/ListViews/ContactsListView.vue index 8e1c0d4e..fe234620 100644 --- a/frontend/src/components/ListViews/ContactsListView.vue +++ b/frontend/src/components/ListViews/ContactsListView.vue @@ -62,7 +62,15 @@ - + + + + diff --git a/frontend/src/components/ListViews/EmailTemplatesListView.vue b/frontend/src/components/ListViews/EmailTemplatesListView.vue index 72828956..1b9b8126 100644 --- a/frontend/src/components/ListViews/EmailTemplatesListView.vue +++ b/frontend/src/components/ListViews/EmailTemplatesListView.vue @@ -48,12 +48,23 @@ @@ -66,8 +77,17 @@ }" @loadMore="emit('loadMore')" /> + diff --git a/frontend/src/components/ListViews/LeadsListView.vue b/frontend/src/components/ListViews/LeadsListView.vue index a37d762a..57145746 100644 --- a/frontend/src/components/ListViews/LeadsListView.vue +++ b/frontend/src/components/ListViews/LeadsListView.vue @@ -94,7 +94,15 @@ - + + + + diff --git a/frontend/src/components/ListViews/OrganizationsListView.vue b/frontend/src/components/ListViews/OrganizationsListView.vue index c077e6b8..9dae1671 100644 --- a/frontend/src/components/ListViews/OrganizationsListView.vue +++ b/frontend/src/components/ListViews/OrganizationsListView.vue @@ -49,7 +49,15 @@ - + + + + diff --git a/frontend/src/components/ListViews/TasksListView.vue b/frontend/src/components/ListViews/TasksListView.vue index 42217336..52b61ed9 100644 --- a/frontend/src/components/ListViews/TasksListView.vue +++ b/frontend/src/components/ListViews/TasksListView.vue @@ -65,12 +65,23 @@ @@ -83,11 +94,20 @@ }" @loadMore="emit('loadMore')" /> + diff --git a/frontend/src/pages/CallLogs.vue b/frontend/src/pages/CallLogs.vue index 423ad240..7a2923d3 100644 --- a/frontend/src/pages/CallLogs.vue +++ b/frontend/src/pages/CallLogs.vue @@ -21,6 +21,7 @@ }" @loadMore="() => loadMore++" @updatePageCount="(count) => (updatedPageCount = count)" + @reload="callLogs.reload()" />
Date: Tue, 6 Feb 2024 18:36:06 +0530 Subject: [PATCH 3/4] fix: pass name along with task --- frontend/src/pages/Tasks.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/pages/Tasks.vue b/frontend/src/pages/Tasks.vue index 3f5557f8..2f6335ed 100644 --- a/frontend/src/pages/Tasks.vue +++ b/frontend/src/pages/Tasks.vue @@ -86,6 +86,7 @@ const rows = computed(() => { const showTaskModal = ref(false) const task = ref({ + name: '', title: '', description: '', assigned_to: '', @@ -99,6 +100,7 @@ const task = ref({ function showTask(name) { let t = rows.value?.find((row) => row.name === name) task.value = { + name: t.name, title: t.title, description: t.description, assigned_to: t.assigned_to?.email || '', @@ -113,6 +115,7 @@ function showTask(name) { function createTask() { task.value = { + name: '', title: '', description: '', assigned_to: '', From 41cfce7383fb6d640ba1745404ef31e9f171abe9 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 6 Feb 2024 18:36:39 +0530 Subject: [PATCH 4/4] fix: allow editing text editor field --- frontend/src/components/Modals/EditValueModal.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Modals/EditValueModal.vue b/frontend/src/components/Modals/EditValueModal.vue index 9d4cdd2c..f738c479 100644 --- a/frontend/src/components/Modals/EditValueModal.vue +++ b/frontend/src/components/Modals/EditValueModal.vue @@ -37,13 +37,14 @@ import DatePicker from '@/components/Controls/DatePicker.vue' import Link from '@/components/Controls/Link.vue' import Autocomplete from '@/components/frappe-ui/Autocomplete.vue' -import { FormControl, call, createResource } from 'frappe-ui' +import { FormControl, call, createResource, TextEditor } from 'frappe-ui' import { ref, computed, defineModel, onMounted, h } from 'vue' const typeCheck = ['Check'] const typeLink = ['Link', 'Dynamic Link'] const typeNumber = ['Float', 'Int', 'Currency', 'Percent'] const typeSelect = ['Select'] +const typeEditor = ['Text Editor'] const typeDate = ['Date', 'Datetime'] const props = defineProps({ @@ -149,6 +150,14 @@ function getValueComponent(f) { return h(FormControl, { type: 'number' }) } else if (typeDate.includes(type)) { return h(DatePicker) + } else if (typeEditor.includes(type)) { + return h(TextEditor, { + variant: 'outline', + editorClass: + '!prose-sm overflow-auto min-h-[80px] max-h-80 py-1.5 px-2 rounded border border-gray-300 bg-white hover:border-gray-400 hover:shadow-sm focus:bg-white focus:border-gray-500 focus:shadow-sm focus:ring-0 focus-visible:ring-2 focus-visible:ring-gray-400 text-gray-800 transition-colors', + bubbleMenu: true, + content: newValue.value, + }) } else { return h(FormControl, { type: 'text' }) }