From c8b13d16f3568aea38fc1ba81f88c31031efd454 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 15 Oct 2023 09:10:10 +0530 Subject: [PATCH] fix: delete contact --- frontend/src/pages/Contact.vue | 53 ++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index 5e3808fa..c4f71105 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -79,7 +79,12 @@ - + { - contacts.reload() - }, +async function changeContactImage(file) { + await call('frappe.client.set_value', { + doctype: 'Contact', + name: props.contact.name, + fieldname: 'image', + value: file?.file_url || '', + }) + contacts.reload() +} + +async function deleteContact() { + $dialog({ + title: 'Delete contact', + message: 'Are you sure you want to delete this contact?', + actions: [ + { + label: 'Delete', + theme: 'red', + variant: 'solid', + async onClick({ close }) { + await call('frappe.client.delete', { + doctype: 'Contact', + name: props.contact.name, + }) + contacts.reload() + close() + }, + }, + ], }) }