From e7bc5a900e7ac4ade963c67de6f2db2c38099bcf Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sat, 14 Oct 2023 16:01:15 +0530 Subject: [PATCH 1/6] feat: contact page --- frontend/src/components/Icons/EditIcon.vue | 16 ++ frontend/src/pages/Contact.vue | 57 +++++++ frontend/src/pages/Contacts.vue | 175 +++++++-------------- frontend/src/router.js | 8 + 4 files changed, 140 insertions(+), 116 deletions(-) create mode 100644 frontend/src/components/Icons/EditIcon.vue create mode 100644 frontend/src/pages/Contact.vue diff --git a/frontend/src/components/Icons/EditIcon.vue b/frontend/src/components/Icons/EditIcon.vue new file mode 100644 index 00000000..8edb183b --- /dev/null +++ b/frontend/src/components/Icons/EditIcon.vue @@ -0,0 +1,16 @@ + diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue new file mode 100644 index 00000000..2d9a4ba9 --- /dev/null +++ b/frontend/src/pages/Contact.vue @@ -0,0 +1,57 @@ + + + diff --git a/frontend/src/pages/Contacts.vue b/frontend/src/pages/Contacts.vue index 8d454617..8b2b61b6 100644 --- a/frontend/src/pages/Contacts.vue +++ b/frontend/src/pages/Contacts.vue @@ -9,136 +9,79 @@ -
-
- - - +
+
+ +
+ +
+ + {{ contact.full_name }} + + {{ contact.email_id }} +
+
+
-
- - -
- diff --git a/frontend/src/router.js b/frontend/src/router.js index 44da837f..28b5d0d5 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -38,6 +38,14 @@ const routes = [ path: '/contacts', name: 'Contacts', component: () => import('@/pages/Contacts.vue'), + children: [ + { + path: '/contacts/:contactId?', + name: 'Contact', + component: () => import('@/pages/Contact.vue'), + props: true, + }, + ], }, { path: '/call-logs', From 9bd4b79ea07ea716c6781848a49478a1746a5a0f Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 15 Oct 2023 08:23:45 +0530 Subject: [PATCH 2/6] fix: create/edit contact --- crm/api/session.py | 2 +- frontend/src/components/ContactModal.vue | 136 +++++++++++++++++++++++ frontend/src/pages/Contact.vue | 33 +++++- frontend/src/pages/Contacts.vue | 24 ++-- 4 files changed, 182 insertions(+), 13 deletions(-) create mode 100644 frontend/src/components/ContactModal.vue diff --git a/crm/api/session.py b/crm/api/session.py index e40a769b..c5fb5c4e 100644 --- a/crm/api/session.py +++ b/crm/api/session.py @@ -25,7 +25,7 @@ def get_contacts(): contacts = frappe.qb.get_query( "Contact", - fields=['name', 'full_name', 'image', 'email_id', 'mobile_no', 'phone', 'salutation'], + fields=['name', 'first_name', 'last_name', 'full_name', 'image', 'email_id', 'mobile_no', 'phone', 'salutation', 'company_name'], order_by="first_name asc", distinct=True, ).run(as_dict=1) diff --git a/frontend/src/components/ContactModal.vue b/frontend/src/components/ContactModal.vue new file mode 100644 index 00000000..5fd0d6ce --- /dev/null +++ b/frontend/src/components/ContactModal.vue @@ -0,0 +1,136 @@ + + + diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index 2d9a4ba9..62acd92b 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -11,18 +11,31 @@ {{ contact.salutation + ' ' + contact.full_name }}
-
+
{{ contact.email_id }}
- · -
+ · +
{{ contact.mobile_no }}
+ · +
+ + {{ contact.company_name }} +
-
+
diff --git a/frontend/src/pages/Contacts.vue b/frontend/src/pages/Contacts.vue index 8b2b61b6..7137911b 100644 --- a/frontend/src/pages/Contacts.vue +++ b/frontend/src/pages/Contacts.vue @@ -4,7 +4,7 @@ @@ -16,7 +16,7 @@ v-for="(contact, i) in contacts.data" :key="i" :class="[ - current_contact?.name === contact.name + currentContact?.name === contact.name ? 'bg-gray-50 hover:bg-gray-100' : 'hover:bg-gray-50', ]" @@ -33,7 +33,7 @@
- +
+ From c8b13d16f3568aea38fc1ba81f88c31031efd454 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 15 Oct 2023 09:10:10 +0530 Subject: [PATCH 4/6] 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() + }, + }, + ], }) } From f9f446a21b8d6e1f51279aefd7ef5f8c3f01642b Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 19 Oct 2023 17:05:59 +0530 Subject: [PATCH 5/6] fix: made sidebar links area scrollable --- frontend/src/components/AppSidebar.vue | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/AppSidebar.vue b/frontend/src/components/AppSidebar.vue index 7fc0af60..8d3fde2b 100644 --- a/frontend/src/components/AppSidebar.vue +++ b/frontend/src/components/AppSidebar.vue @@ -3,16 +3,18 @@ class="flex h-full flex-col justify-between transition-all duration-300 ease-in-out" :class="isSidebarCollapsed ? 'w-12' : 'w-56'" > -
+
- +
+ +
Date: Fri, 20 Oct 2023 14:22:41 +0530 Subject: [PATCH 6/6] build(deps): bump frappeui to 0.1.13 --- frappe-ui | 2 +- frontend/package.json | 2 +- frontend/yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frappe-ui b/frappe-ui index 1da086ae..89e3e41b 160000 --- a/frappe-ui +++ b/frappe-ui @@ -1 +1 @@ -Subproject commit 1da086aeed006cdc2ce15274ca8dc8ca6c905fb3 +Subproject commit 89e3e41b9d1aa378c15591b4d9365102befc8b8c diff --git a/frontend/package.json b/frontend/package.json index 67d6c91d..5bb2a96f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,7 +16,7 @@ "@vueuse/integrations": "^10.3.0", "autoprefixer": "^10.4.14", "feather-icons": "^4.28.0", - "frappe-ui": "^0.1.12", + "frappe-ui": "^0.1.13", "pinia": "^2.0.33", "postcss": "^8.4.5", "socket.io-client": "^4.7.2", diff --git a/frontend/yarn.lock b/frontend/yarn.lock index b8a64718..71c88884 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -943,10 +943,10 @@ fraction.js@^4.3.6: resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.6.tgz#e9e3acec6c9a28cf7bc36cbe35eea4ceb2c5c92d" integrity sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg== -frappe-ui@^0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/frappe-ui/-/frappe-ui-0.1.12.tgz#f112931897f75f307f18a3227ab641669cdfdddb" - integrity sha512-gb4aiNdcyiOYhJ1QZw1o+P26HSIM6T/3Dq4tfIq8uwvV2l3mk+xIW51g9lHLIUaYri44wojCrRCuCm8apO8xQw== +frappe-ui@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/frappe-ui/-/frappe-ui-0.1.13.tgz#083359500b1dd8d0bf7a15ed98184914edb248d9" + integrity sha512-Wdn0rftHY5BxpQPueWOd9fYQ//VYifKCen0rdIBjMyHGxCqxMkbHgJvKJE5NYQqbXcG1N/pO8k5po9bnuHgAMA== dependencies: "@headlessui/vue" "^1.7.14" "@popperjs/core" "^2.11.2"