From 244f1b85cc7129a29b8080f769f3d16f69cfd483 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 26 Jul 2024 20:57:45 +0530 Subject: [PATCH 01/44] fix: contacts not loading in deal on first load --- frontend/src/pages/Deal.vue | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index af2a8b47..39bf9d56 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -174,8 +174,8 @@ {{ __('Loading...') }}
@@ -603,22 +603,11 @@ const deal_contacts = createResource({ params: { name: props.dealId }, cache: ['deal_contacts', props.dealId], auto: true, - onSuccess: (data) => { - let contactSection = fieldsLayout.data?.find( - (section) => section.name == 'contacts_section', - ) - if (!contactSection) return - contactSection.contacts = data.map((contact) => { - return { - name: contact.name, - full_name: contact.full_name, - email: contact.email, - mobile_no: contact.mobile_no, - image: contact.image, - is_primary: contact.is_primary, - opened: false, - } + transform: (data) => { + data.forEach((contact) => { + contact.opened = false }) + return data }, }) From 48f05fc1af8c0624ea10f33dfeae4659151096a2 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 30 Jul 2024 17:06:02 +0530 Subject: [PATCH 02/44] fix: handle empty values --- .../doctype/crm_view_settings/crm_view_settings.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crm/fcrm/doctype/crm_view_settings/crm_view_settings.py b/crm/fcrm/doctype/crm_view_settings/crm_view_settings.py index 86f1bff5..5cc74938 100644 --- a/crm/fcrm/doctype/crm_view_settings/crm_view_settings.py +++ b/crm/fcrm/doctype/crm_view_settings/crm_view_settings.py @@ -53,11 +53,11 @@ def create(view): def update(view): view = frappe._dict(view) - filters = parse_json(view.filters) or {} - columns = parse_json(view.columns) or [] - rows = parse_json(view.rows) or [] - kanban_columns = parse_json(view.kanban_columns) or [] - kanban_fields = parse_json(view.kanban_fields) or [] + filters = parse_json(view.filters or {}) + columns = parse_json(view.columns or []) + rows = parse_json(view.rows or []) + kanban_columns = parse_json(view.kanban_columns or []) + kanban_fields = parse_json(view.kanban_fields or []) default_rows = sync_default_rows(view.doctype) rows = rows + default_rows if default_rows else rows From 686400a96540426e25825e3d765aea95bf5e0664 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 5 Aug 2024 12:56:33 +0530 Subject: [PATCH 03/44] fix: industry not getting synced on convertion --- crm/fcrm/doctype/crm_lead/crm_lead.py | 1 + 1 file changed, 1 insertion(+) diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index ee99057d..75ca04e0 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -149,6 +149,7 @@ class CRMLead(Document): "organization_name": self.organization, "website": self.website, "territory": self.territory, + "industry": self.industry, "annual_revenue": self.annual_revenue, } ) From 2d3db4e63d03b2717bde43119695cc20bcd4acec Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 5 Aug 2024 13:11:28 +0530 Subject: [PATCH 04/44] feat: Bulk convert lead --- frontend/src/components/ListBulkActions.vue | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/frontend/src/components/ListBulkActions.vue b/frontend/src/components/ListBulkActions.vue index 5b5bfdaa..84af5b2f 100644 --- a/frontend/src/components/ListBulkActions.vue +++ b/frontend/src/components/ListBulkActions.vue @@ -56,6 +56,39 @@ function editValues(selections, unselectAll) { unselectAllAction.value = unselectAll } +function convertToDeal(selections, unselectAll) { + $dialog({ + title: __('Convert to Deal'), + message: __('Are you sure you want to convert {0} Lead(s) to Deal(s)?', [ + selections.size, + ]), + variant: 'solid', + theme: 'blue', + actions: [ + { + label: __('Convert'), + variant: 'solid', + onClick: (close) => { + Array.from(selections).forEach((name) => { + call('crm.fcrm.doctype.crm_lead.crm_lead.convert_to_deal', { + lead: name, + }).then(() => { + createToast({ + title: __('Converted successfully'), + icon: 'check', + iconClasses: 'text-green-600', + }) + list.value.reload() + unselectAll() + close() + }) + }) + }, + }, + ], + }) +} + function deleteValues(selections, unselectAll) { $dialog({ title: __('Delete'), @@ -162,6 +195,13 @@ function bulkActions(selections, unselectAll) { }) } + if (!props.options.hideDelete) { + actions.push({ + label: __('Convert to Deal'), + onClick: () => convertToDeal(selections, unselectAll), + }) + } + customBulkActions.value.forEach((action) => { actions.push({ label: __(action.label), From a5fef2f26b53d0e09e53c81ab4cde335e82261f1 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 6 Aug 2024 01:38:59 +0530 Subject: [PATCH 05/44] fix: only add convert to deal bulk action on leads listview --- frontend/src/components/ListBulkActions.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/ListBulkActions.vue b/frontend/src/components/ListBulkActions.vue index 84af5b2f..b58c02e6 100644 --- a/frontend/src/components/ListBulkActions.vue +++ b/frontend/src/components/ListBulkActions.vue @@ -195,7 +195,7 @@ function bulkActions(selections, unselectAll) { }) } - if (!props.options.hideDelete) { + if (props.doctype === 'CRM Lead') { actions.push({ label: __('Convert to Deal'), onClick: () => convertToDeal(selections, unselectAll), From 670c32264223efefe94dd31f73f1b49715d6d067 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 12 Aug 2024 17:50:38 +0530 Subject: [PATCH 06/44] fix: include crm in apps page --- crm/hooks.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crm/hooks.py b/crm/hooks.py index 740c21b2..6b904971 100644 --- a/crm/hooks.py +++ b/crm/hooks.py @@ -4,11 +4,23 @@ app_publisher = "Frappe Technologies Pvt. Ltd." app_description = "Kick-ass Open Source CRM" app_email = "shariq@frappe.io" app_license = "AGPLv3" -app_icon_url = "" +app_icon_url = "/assets/crm/manifest/apple-icon-180.png" app_icon_title = "CRM" app_icon_route = "/crm" +# Apps +# ------------------ + # required_apps = [] +include_as_app = [ + { + "name": "crm", + "logo": "/assets/crm/manifest/apple-icon-180.png", + "title": "CRM", + "route": "/crm", + # "has_permission": "crm.api.permission.has_app_permission" + } +] # Includes in # ------------------ From e45f8238d84890bbbdc5da91f60a7ee60979d816 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 12 Aug 2024 19:13:34 +0530 Subject: [PATCH 07/44] chore: renamed include_as_app to include_in_apps_screen --- crm/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crm/hooks.py b/crm/hooks.py index 6b904971..ce6f23e8 100644 --- a/crm/hooks.py +++ b/crm/hooks.py @@ -12,7 +12,7 @@ app_icon_route = "/crm" # ------------------ # required_apps = [] -include_as_app = [ +add_to_apps_screen = [ { "name": "crm", "logo": "/assets/crm/manifest/apple-icon-180.png", From 0732cfa19c03aab4453c051a07f783c6888a4941 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 12 Aug 2024 21:39:40 +0530 Subject: [PATCH 08/44] feat: app switcher --- frontend/src/components/Apps.vue | 68 ++++++++++++++++++++++ frontend/src/components/Icons/AppsIcon.vue | 17 ++++++ frontend/src/components/UserDropdown.vue | 7 +-- 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/Apps.vue create mode 100644 frontend/src/components/Icons/AppsIcon.vue diff --git a/frontend/src/components/Apps.vue b/frontend/src/components/Apps.vue new file mode 100644 index 00000000..cbe00983 --- /dev/null +++ b/frontend/src/components/Apps.vue @@ -0,0 +1,68 @@ + + diff --git a/frontend/src/components/Icons/AppsIcon.vue b/frontend/src/components/Icons/AppsIcon.vue new file mode 100644 index 00000000..2b314745 --- /dev/null +++ b/frontend/src/components/Icons/AppsIcon.vue @@ -0,0 +1,17 @@ + diff --git a/frontend/src/components/UserDropdown.vue b/frontend/src/components/UserDropdown.vue index 8ec7ca2f..cf5bf263 100644 --- a/frontend/src/components/UserDropdown.vue +++ b/frontend/src/components/UserDropdown.vue @@ -50,10 +50,11 @@ diff --git a/frontend/src/router.js b/frontend/src/router.js index dff911ec..aa254224 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -102,11 +102,6 @@ const routes = [ name: 'Invalid Page', component: () => import('@/pages/InvalidPage.vue'), }, - { - path: '/login', - name: 'Login', - component: () => import('@/pages/Login.vue'), - }, ] const handleMobileView = (componentName) => { @@ -150,8 +145,9 @@ router.beforeEach(async (to, from, next) => { if (to.name === 'Login' && isLoggedIn) { next({ name: 'Leads' }) - } else if (to.name !== 'Login' && !isLoggedIn) { - next({ name: 'Login' }) + } else if (!isLoggedIn) { + users?.reset?.() + window.location.href = "/login?redirect-to=/crm"; } else if (to.matched.length === 0) { next({ name: 'Invalid Page' }) } else { diff --git a/frontend/src/stores/session.js b/frontend/src/stores/session.js index 3a5c2b80..6c4f7d1b 100644 --- a/frontend/src/stores/session.js +++ b/frontend/src/stores/session.js @@ -35,7 +35,6 @@ export const sessionStore = defineStore('crm-session', () => { const logout = createResource({ url: 'logout', onSuccess() { - users.reset() user.value = null router.replace({ name: 'Login' }) }, From 928fdffa17ec60eb18ca50cb5fc65d77e29b17ed Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 13 Aug 2024 16:42:06 +0530 Subject: [PATCH 13/44] revert: bump frappeui to 0.1.66 --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index a5060017..1784013a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,7 +14,7 @@ "@vueuse/core": "^10.3.0", "@vueuse/integrations": "^10.3.0", "feather-icons": "^4.28.0", - "frappe-ui": "^0.1.66", + "frappe-ui": "^0.1.65", "gemoji": "^8.1.0", "lodash": "^4.17.21", "mime": "^4.0.1", From 4466669a2b8e0c6e602265e1f66e970c3b35077c Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 14 Aug 2024 10:49:17 +0530 Subject: [PATCH 14/44] fix: style changes & use framework icon from frappe --- frontend/src/components/Apps.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Apps.vue b/frontend/src/components/Apps.vue index 225f2517..aea4c002 100644 --- a/frontend/src/components/Apps.vue +++ b/frontend/src/components/Apps.vue @@ -3,7 +3,8 @@