From 9c59e4d0d82a7f250120b37fe73964e9bcc6d671 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 22 Jan 2025 13:47:07 +0530 Subject: [PATCH 1/6] fix: cannot add email & mobile no in contact --- frontend/src/components/SidePanelLayout.vue | 5 ++++- frontend/src/pages/Contact.vue | 6 ++---- frontend/src/pages/MobileContact.vue | 6 ++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/SidePanelLayout.vue b/frontend/src/components/SidePanelLayout.vue index 878bf695..4b47125c 100644 --- a/frontend/src/components/SidePanelLayout.vue +++ b/frontend/src/components/SidePanelLayout.vue @@ -101,7 +101,10 @@ :label="data[field.fieldname]" class="dropdown-button flex w-full items-center justify-between rounded border border-gray-100 bg-surface-gray-2 px-2 py-1.5 text-base text-ink-gray-8 placeholder-ink-gray-4 transition-colors hover:border-outline-gray-modals hover:bg-surface-gray-3 focus:border-outline-gray-4 focus:bg-surface-white focus:shadow-sm focus:outline-none focus:ring-0 focus-visible:ring-2 focus-visible:ring-outline-gray-3" > -
+
{{ data[field.fieldname] }}
{ return { @@ -340,7 +338,7 @@ const sections = createResource({ cache: ['sidePanelSections', 'Contact'], params: { doctype: 'Contact' }, auto: true, - transform: (data) => getParsedSections(data), + transform: (data) => computed(() => getParsedSections(data)), }) function getParsedSections(_sections) { diff --git a/frontend/src/pages/MobileContact.vue b/frontend/src/pages/MobileContact.vue index dc6dcfff..a3caf365 100644 --- a/frontend/src/pages/MobileContact.vue +++ b/frontend/src/pages/MobileContact.vue @@ -320,9 +320,7 @@ const tabs = [ const deals = createResource({ url: 'crm.api.contact.get_linked_deals', cache: ['deals', props.contactId], - params: { - contact: props.contactId, - }, + params: { contact: props.contactId }, auto: true, }) @@ -337,7 +335,7 @@ const sections = createResource({ cache: ['sidePanelSections', 'Contact'], params: { doctype: 'Contact' }, auto: true, - transform: (data) => getParsedSections(data), + transform: (data) => computed(() => getParsedSections(data)), }) function getParsedSections(_sections) { From e27a662f712466c7298bd2bf5a65590a577b3760 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 22 Jan 2025 17:12:20 +0530 Subject: [PATCH 2/6] fix: do not update field value instead create copy of it and use on client side --- crm/fcrm/doctype/crm_call_log/crm_call_log.py | 10 +++++----- frontend/src/utils/callLog.js | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/crm/fcrm/doctype/crm_call_log/crm_call_log.py b/crm/fcrm/doctype/crm_call_log/crm_call_log.py index 6560aa8e..dd873e6d 100644 --- a/crm/fcrm/doctype/crm_call_log/crm_call_log.py +++ b/crm/fcrm/doctype/crm_call_log/crm_call_log.py @@ -97,7 +97,7 @@ class CRMCallLog(Document): def parse_call_log(call): call["show_recording"] = False - call["duration"] = seconds_to_duration(call.get("duration")) + call["_duration"] = seconds_to_duration(call.get("duration")) if call.get("type") == "Incoming": call["activity_type"] = "incoming_call" contact = get_contact_by_phone_number(call.get("from")) @@ -106,11 +106,11 @@ def parse_call_log(call): if call.get("receiver") else [None, None] ) - call["caller"] = { + call["_caller"] = { "label": contact.get("full_name", "Unknown"), "image": contact.get("image"), } - call["receiver"] = { + call["_receiver"] = { "label": receiver[0], "image": receiver[1], } @@ -122,11 +122,11 @@ def parse_call_log(call): if call.get("caller") else [None, None] ) - call["caller"] = { + call["_caller"] = { "label": caller[0], "image": caller[1], } - call["receiver"] = { + call["_receiver"] = { "label": contact.get("full_name", "Unknown"), "image": contact.get("image"), } diff --git a/frontend/src/utils/callLog.js b/frontend/src/utils/callLog.js index 2629d69b..4c989d6c 100644 --- a/frontend/src/utils/callLog.js +++ b/frontend/src/utils/callLog.js @@ -9,9 +9,19 @@ export function getCallLogDetail(row, log, columns = []) { if (row === 'duration') { return { - label: log.duration, + label: log._duration, icon: 'clock', } + } else if (row === 'caller') { + return { + label: log._caller.label, + image: log._caller.image, + } + } else if (row === 'receiver') { + return { + label: log._receiver.label, + image: log._receiver.image, + } } else if (row === 'type') { return { label: log.type, From ae41e50a4cbebf14533de0929d83ec395f11a0a1 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 22 Jan 2025 17:44:55 +0530 Subject: [PATCH 3/6] fix: edit call log and layout --- frappe-ui | 2 +- .../src/components/Activities/CallArea.vue | 43 +- .../components/Modals/CallLogDetailModal.vue | 261 ++++++++++++ .../src/components/Modals/CallLogModal.vue | 402 ++++++++---------- frontend/src/pages/CallLogs.vue | 21 +- frontend/src/utils/callLog.js | 8 +- 6 files changed, 496 insertions(+), 241 deletions(-) create mode 100644 frontend/src/components/Modals/CallLogDetailModal.vue diff --git a/frappe-ui b/frappe-ui index 863eaae9..aea80633 160000 --- a/frappe-ui +++ b/frappe-ui @@ -1 +1 @@ -Subproject commit 863eaae9ada2edb287fc09fb21d05212bb5eebe9 +Subproject commit aea806331c179cc0cdb89b6a2f9de2130bd1061f diff --git a/frontend/src/components/Activities/CallArea.vue b/frontend/src/components/Activities/CallArea.vue index d2689580..ba54557e 100644 --- a/frontend/src/components/Activities/CallArea.vue +++ b/frontend/src/components/Activities/CallArea.vue @@ -1,14 +1,14 @@ - + @@ -89,7 +92,12 @@
- + + diff --git a/frontend/src/components/Modals/CallLogDetailModal.vue b/frontend/src/components/Modals/CallLogDetailModal.vue new file mode 100644 index 00000000..8f6758d4 --- /dev/null +++ b/frontend/src/components/Modals/CallLogDetailModal.vue @@ -0,0 +1,261 @@ + + + + + diff --git a/frontend/src/components/Modals/CallLogModal.vue b/frontend/src/components/Modals/CallLogModal.vue index fb8ec499..1932c285 100644 --- a/frontend/src/components/Modals/CallLogModal.vue +++ b/frontend/src/components/Modals/CallLogModal.vue @@ -1,245 +1,209 @@ diff --git a/frontend/src/utils/callLog.js b/frontend/src/utils/callLog.js index 4c989d6c..0a64eb32 100644 --- a/frontend/src/utils/callLog.js +++ b/frontend/src/utils/callLog.js @@ -14,13 +14,13 @@ export function getCallLogDetail(row, log, columns = []) { } } else if (row === 'caller') { return { - label: log._caller.label, - image: log._caller.image, + label: log._caller?.label, + image: log._caller?.image, } } else if (row === 'receiver') { return { - label: log._receiver.label, - image: log._receiver.image, + label: log._receiver?.label, + image: log._receiver?.image, } } else if (row === 'type') { return { From edab3ed65dbf339fbdccf5a71a7da030e0fa4fa8 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 22 Jan 2025 18:11:53 +0530 Subject: [PATCH 4/6] feat: allow manually create call logs --- crm/fcrm/doctype/crm_call_log/crm_call_log.json | 11 +++++------ frontend/src/components/Modals/CallLogModal.vue | 5 ++++- frontend/src/pages/CallLogs.vue | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/crm/fcrm/doctype/crm_call_log/crm_call_log.json b/crm/fcrm/doctype/crm_call_log/crm_call_log.json index 96416bf9..cb7f91c2 100644 --- a/crm/fcrm/doctype/crm_call_log/crm_call_log.json +++ b/crm/fcrm/doctype/crm_call_log/crm_call_log.json @@ -47,8 +47,7 @@ "fieldname": "status", "fieldtype": "Select", "label": "Status", - "options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled", - "read_only": 1 + "options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled" }, { "fieldname": "start_time", @@ -83,8 +82,7 @@ "fieldname": "duration", "fieldtype": "Duration", "in_list_view": 1, - "label": "Duration", - "read_only": 1 + "label": "Duration" }, { "fieldname": "recording_url", @@ -145,7 +143,8 @@ "in_list_view": 1, "in_standard_filter": 1, "label": "Telephony Medium", - "options": "\nManual\nTwilio\nExotel" + "options": "\nManual\nTwilio\nExotel", + "read_only": 1 }, { "fieldname": "section_break_gyqe", @@ -154,7 +153,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2025-01-17 21:46:01.558377", + "modified": "2025-01-22 17:57:59.289548", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Call Log", diff --git a/frontend/src/components/Modals/CallLogModal.vue b/frontend/src/components/Modals/CallLogModal.vue index 1932c285..b578f679 100644 --- a/frontend/src/components/Modals/CallLogModal.vue +++ b/frontend/src/components/Modals/CallLogModal.vue @@ -58,6 +58,7 @@ import FieldLayout from '@/components/FieldLayout/FieldLayout.vue' import EditIcon from '@/components/Icons/EditIcon.vue' import { usersStore } from '@/stores/users' import { isMobileView } from '@/composables/settings' +import { getRandom } from '@/utils' import { capture } from '@/telemetry' import { FeatherIcon, createResource, ErrorMessage } from 'frappe-ui' import { ref, nextTick, watch, computed } from 'vue' @@ -92,7 +93,7 @@ let _callLog = ref({ receiver: '', status: '', recording_url: '', - telephony_medium: '', + telephony_medium: 'Manual', }) const dialogOptions = computed(() => { @@ -159,6 +160,8 @@ const createCallLog = createResource({ return { doc: { doctype: 'CRM Call Log', + id: getRandom(6), + telephony_medium: 'Manual', ..._callLog.value, }, } diff --git a/frontend/src/pages/CallLogs.vue b/frontend/src/pages/CallLogs.vue index ae6dbfa1..29ea5f01 100644 --- a/frontend/src/pages/CallLogs.vue +++ b/frontend/src/pages/CallLogs.vue @@ -8,6 +8,9 @@ v-if="callLogsListView?.customListActions" :actions="callLogsListView.customListActions" /> + - + From 9faa9f71718762fdb6b7dcc597c116d34692d4f3 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 22 Jan 2025 18:20:47 +0530 Subject: [PATCH 5/6] patch: add and update default field layout for call log --- crm/install.py | 4 ++++ crm/patches.txt | 2 +- crm/patches/v1_0/create_default_fields_layout.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crm/install.py b/crm/install.py index b0201d6d..1e0d816f 100644 --- a/crm/install.py +++ b/crm/install.py @@ -138,6 +138,10 @@ def add_default_fields_layout(force=False): "doctype": "Address", "layout": '[{"name": "details_section", "columns": [{"name": "column_uSSG", "fields": ["address_title", "address_type", "address_line1", "address_line2", "city", "state", "country", "pincode"]}]}]', }, + "CRM Call Log-Quick Entry": { + "doctype": "CRM Call Log", + "layout": '[{"name":"details_section","columns":[{"name":"column_uMSG","fields":["type","from","duration"]},{"name":"column_wiZT","fields":["to","status","caller","receiver"]}]}]', + }, } sidebar_fields_layouts = { diff --git a/crm/patches.txt b/crm/patches.txt index f8fbb4c6..f602b2bc 100644 --- a/crm/patches.txt +++ b/crm/patches.txt @@ -7,7 +7,7 @@ crm.patches.v1_0.rename_twilio_settings_to_crm_twilio_settings [post_model_sync] # Patches added in this section will be executed after doctypes are migrated crm.patches.v1_0.create_email_template_custom_fields -crm.patches.v1_0.create_default_fields_layout #10/12/2024 +crm.patches.v1_0.create_default_fields_layout #22/01/2025 crm.patches.v1_0.create_default_sidebar_fields_layout crm.patches.v1_0.update_deal_quick_entry_layout crm.patches.v1_0.update_layouts_to_new_format diff --git a/crm/patches/v1_0/create_default_fields_layout.py b/crm/patches/v1_0/create_default_fields_layout.py index 383e7ac2..4f460478 100644 --- a/crm/patches/v1_0/create_default_fields_layout.py +++ b/crm/patches/v1_0/create_default_fields_layout.py @@ -1,5 +1,5 @@ - from crm.install import add_default_fields_layout + def execute(): - add_default_fields_layout() \ No newline at end of file + add_default_fields_layout() From 0a572c56f858c5d0a397200ddb2d31c0d238302e Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 22 Jan 2025 19:06:31 +0530 Subject: [PATCH 6/6] fix: allow adding/editing note and task in call log --- crm/integrations/api.py | 23 +++- .../components/Modals/CallLogDetailModal.vue | 115 +++++++++++++++++- frontend/src/components/Modals/TaskModal.vue | 7 +- 3 files changed, 134 insertions(+), 11 deletions(-) diff --git a/crm/integrations/api.py b/crm/integrations/api.py index b440e629..c1c4e198 100644 --- a/crm/integrations/api.py +++ b/crm/integrations/api.py @@ -53,15 +53,17 @@ def add_note_to_call_log(call_sid, note): _note = frappe.get_doc( { "doctype": "FCRM Note", + "title": note.get("title", "Call Note"), "content": note.get("content"), } ).insert(ignore_permissions=True) - call_log = frappe.get_cached_doc("CRM Call Log", call_sid) - call_log.link_with_reference_doc("FCRM Note", _note.name) - call_log.save(ignore_permissions=True) else: _note = frappe.set_value("FCRM Note", note.get("name"), "content", note.get("content")) + call_log = frappe.get_cached_doc("CRM Call Log", call_sid) + call_log.link_with_reference_doc("FCRM Note", _note.name) + call_log.save(ignore_permissions=True) + return _note @@ -75,21 +77,30 @@ def add_task_to_call_log(call_sid, task): "doctype": "CRM Task", "title": task.get("title"), "description": task.get("description"), + "assigned_to": task.get("assigned_to"), + "due_date": task.get("due_date"), + "status": task.get("status"), + "priority": task.get("priority"), } ).insert(ignore_permissions=True) - call_log = frappe.get_doc("CRM Call Log", call_sid) - call_log.link_with_reference_doc("CRM Task", _task.name) - call_log.save(ignore_permissions=True) else: _task = frappe.get_doc("CRM Task", task.get("name")) _task.update( { "title": task.get("title"), "description": task.get("description"), + "assigned_to": task.get("assigned_to"), + "due_date": task.get("due_date"), + "status": task.get("status"), + "priority": task.get("priority"), } ) _task.save(ignore_permissions=True) + call_log = frappe.get_doc("CRM Call Log", call_sid) + call_log.link_with_reference_doc("CRM Task", _task.name) + call_log.save(ignore_permissions=True) + return _task diff --git a/frontend/src/components/Modals/CallLogDetailModal.vue b/frontend/src/components/Modals/CallLogDetailModal.vue index 8f6758d4..3995e0f0 100644 --- a/frontend/src/components/Modals/CallLogDetailModal.vue +++ b/frontend/src/components/Modals/CallLogDetailModal.vue @@ -9,6 +9,30 @@
+ + +
+
+ +
+
+ +
{{ field.value }}
@@ -110,7 +151,8 @@
- + +