diff --git a/crm/api/contact.py b/crm/api/contact.py index 8ef93e43..5484bb9b 100644 --- a/crm/api/contact.py +++ b/crm/api/contact.py @@ -132,3 +132,36 @@ def set_as_primary(contact, field, value): contact.save() return True + + +@frappe.whitelist() +def search_emails(txt: str): + doctype = "Contact" + meta = frappe.get_meta(doctype) + filters = [["Contact", "email_id", "is", "set"]] + + if meta.get("fields", {"fieldname": "enabled", "fieldtype": "Check"}): + filters.append([doctype, "enabled", "=", 1]) + if meta.get("fields", {"fieldname": "disabled", "fieldtype": "Check"}): + filters.append([doctype, "disabled", "!=", 1]) + + or_filters = [] + search_fields = ["full_name", "email_id", "name"] + if txt: + for f in search_fields: + or_filters.append([doctype, f.strip(), "like", f"%{txt}%"]) + + results = frappe.get_list( + doctype, + filters=filters, + fields=search_fields, + or_filters=or_filters, + limit_start=0, + limit_page_length=20, + order_by='email_id, full_name, name', + ignore_permissions=False, + as_list=True, + strict=False, + ) + + return results \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 4f46436b..b899efda 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,6 +9,7 @@ "serve": "vite preview" }, "dependencies": { + "@tiptap/extension-paragraph": "^2.4.0", "@twilio/voice-sdk": "^2.10.2", "@vueuse/core": "^10.3.0", "@vueuse/integrations": "^10.3.0", diff --git a/frontend/src/components/Activities.vue b/frontend/src/components/Activities.vue index 3bf06991..8df55c2d 100644 --- a/frontend/src/components/Activities.vue +++ b/frontend/src/components/Activities.vue @@ -442,7 +442,7 @@ 'outgoing_call', ].includes(activity.activity_type), 'bg-white': ['added', 'removed', 'changed'].includes( - activity.activity_type + activity.activity_type, ), }" > @@ -528,7 +528,10 @@ {{ activity.data.bcc }} -
+
{ }, ] return actions.filter((action) => - action.condition ? action.condition() : true + action.condition ? action.condition() : true, ) }) @@ -1120,12 +1123,12 @@ const activities = computed(() => { } else if (props.title == 'Emails') { if (!all_activities.data?.versions) return [] activities = all_activities.data.versions.filter( - (activity) => activity.activity_type === 'communication' + (activity) => activity.activity_type === 'communication', ) } else if (props.title == 'Comments') { if (!all_activities.data?.versions) return [] activities = all_activities.data.versions.filter( - (activity) => activity.activity_type === 'comment' + (activity) => activity.activity_type === 'comment', ) } else if (props.title == 'Calls') { if (!all_activities.data?.calls) return [] @@ -1338,12 +1341,15 @@ function reply(email, reply_all = false) { editor.bccEmails = bcc } + let repliedMessage = `
${message}
` + editor.editor .chain() .clearContent() - .insertContent(message) + .insertContent('

.

') + .updateAttributes('paragraph', {class:'reply-to-content'}) + .insertContent(repliedMessage) .focus('all') - .setBlockquote() .insertContentAt(0, { type: 'paragraph' }) .focus('start') .run() diff --git a/frontend/src/components/CommentBox.vue b/frontend/src/components/CommentBox.vue index e5c8c1b1..ebdf00c9 100644 --- a/frontend/src/components/CommentBox.vue +++ b/frontend/src/components/CommentBox.vue @@ -12,7 +12,8 @@