From 145d26403f6dbc09f9402ef752fb63ab0ef0d02e Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 13 Jun 2024 15:42:18 +0530 Subject: [PATCH 01/14] fix: removed unique from doctype field --- crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.json b/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.json index c780557a..00012770 100644 --- a/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.json +++ b/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.json @@ -19,8 +19,7 @@ "in_list_view": 1, "in_standard_filter": 1, "label": "Document Type", - "options": "DocType", - "unique": 1 + "options": "DocType" }, { "fieldname": "type", @@ -47,7 +46,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-06-07 17:01:20.250697", + "modified": "2024-06-13 15:10:01.612851", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Fields Layout", From 22a46827a9352a5d0e2a57b1c5750ee9ddaf9878 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 13 Jun 2024 15:43:43 +0530 Subject: [PATCH 02/14] refactor: renamed get_quick_entry_fields and made it generic --- crm/api/doc.py | 6 +++--- frontend/src/components/Modals/ContactModal.vue | 4 ++-- frontend/src/components/Modals/DealModal.vue | 4 ++-- frontend/src/components/Modals/LeadModal.vue | 4 ++-- frontend/src/components/Modals/OrganizationModal.vue | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crm/api/doc.py b/crm/api/doc.py index 0c535e99..c1739280 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -158,10 +158,10 @@ def get_group_by_fields(doctype: str): @frappe.whitelist() -def get_quick_entry_fields(doctype: str): +def get_fields_layout(doctype: str, type: str): sections = [] - if frappe.db.exists("CRM Fields Layout", {"dt": doctype, "type": "Quick Entry"}): - layout = frappe.get_doc("CRM Fields Layout", {"dt": doctype, "type": "Quick Entry"}) + if frappe.db.exists("CRM Fields Layout", {"dt": doctype, "type": type}): + layout = frappe.get_doc("CRM Fields Layout", {"dt": doctype, "type": type}) else: return [] diff --git a/frontend/src/components/Modals/ContactModal.vue b/frontend/src/components/Modals/ContactModal.vue index 7ec75161..4e23756f 100644 --- a/frontend/src/components/Modals/ContactModal.vue +++ b/frontend/src/components/Modals/ContactModal.vue @@ -235,9 +235,9 @@ const detailFields = computed(() => { }) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'Contact'], - params: { doctype: 'Contact' }, + params: { doctype: 'Contact', type: 'Quick Entry'}, auto: true, }) diff --git a/frontend/src/components/Modals/DealModal.vue b/frontend/src/components/Modals/DealModal.vue index bf465ddc..be2f7a72 100644 --- a/frontend/src/components/Modals/DealModal.vue +++ b/frontend/src/components/Modals/DealModal.vue @@ -77,9 +77,9 @@ const chooseExistingContact = ref(false) const chooseExistingOrganization = ref(false) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'CRM Deal'], - params: { doctype: 'CRM Deal' }, + params: { doctype: 'CRM Deal', type: 'Quick Entry'}, auto: true, transform: (data) => { return data.forEach((section) => { diff --git a/frontend/src/components/Modals/LeadModal.vue b/frontend/src/components/Modals/LeadModal.vue index 54e7566e..a8245ffc 100644 --- a/frontend/src/components/Modals/LeadModal.vue +++ b/frontend/src/components/Modals/LeadModal.vue @@ -40,9 +40,9 @@ const error = ref(null) const isLeadCreating = ref(false) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'CRM Lead'], - params: { doctype: 'CRM Lead' }, + params: { doctype: 'CRM Lead', type: 'Quick Entry' }, auto: true, transform: (data) => { return data.forEach((section) => { diff --git a/frontend/src/components/Modals/OrganizationModal.vue b/frontend/src/components/Modals/OrganizationModal.vue index 08a7e91a..d04205dc 100644 --- a/frontend/src/components/Modals/OrganizationModal.vue +++ b/frontend/src/components/Modals/OrganizationModal.vue @@ -225,9 +225,9 @@ const fields = computed(() => { }) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'CRM Organization'], - params: { doctype: 'CRM Organization' }, + params: { doctype: 'CRM Organization', type: 'Quick Entry'}, auto: true, }) From e59d9b142678f626a3c7715eea7dd910b4603519 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 13 Jun 2024 15:44:40 +0530 Subject: [PATCH 03/14] refactor: calculate gap from left/right in resizer based on parent ref passed --- frontend/src/components/Resizer.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/src/components/Resizer.vue b/frontend/src/components/Resizer.vue index e81df9e7..ebe0029b 100644 --- a/frontend/src/components/Resizer.vue +++ b/frontend/src/components/Resizer.vue @@ -28,6 +28,10 @@ const props = defineProps({ type: String, default: 'left', }, + parent: { + type: Object, + default: null, + }, }) const sidebarResizing = ref(false) @@ -58,6 +62,9 @@ function resize(e) { sidebarWidth.value = props.side == 'left' ? e.clientX : window.innerWidth - e.clientX + let gap = props.parent ? distance() : 0 + sidebarWidth.value = sidebarWidth.value - gap + // snap to props.defaultWidth let range = [props.defaultWidth - 10, props.defaultWidth + 10] if (sidebarWidth.value > range[0] && sidebarWidth.value < range[1]) { @@ -71,4 +78,9 @@ function resize(e) { sidebarWidth.value = props.maxWidth } } +function distance() { + if (!props.parent) return 0 + const rect = props.parent.getBoundingClientRect() + return window.innerWidth - rect[props.side] +} From 50984571072f9bb137b30b0ed72fae24432ba136 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 13 Jun 2024 15:46:25 +0530 Subject: [PATCH 04/14] fix: removed default padding from settings page --- frontend/src/components/SectionFields.vue | 2 +- frontend/src/components/Settings/ProfileSettings.vue | 2 +- frontend/src/components/Settings/SettingsModal.vue | 2 +- frontend/src/components/Settings/SettingsPage.vue | 11 ++++++++--- frontend/src/components/Settings/TwilioSettings.vue | 2 +- frontend/src/components/Settings/WhatsAppSettings.vue | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/SectionFields.vue b/frontend/src/components/SectionFields.vue index 63d43e00..d80868b5 100644 --- a/frontend/src/components/SectionFields.vue +++ b/frontend/src/components/SectionFields.vue @@ -136,7 +136,7 @@ const _fields = computed(() => { let all_fields = [] props.fields?.forEach((field) => { let df = field.all_properties - if (df.depends_on) evaluate_depends_on(df.depends_on, field) + if (df?.depends_on) evaluate_depends_on(df.depends_on, field) all_fields.push(field) }) return all_fields diff --git a/frontend/src/components/Settings/ProfileSettings.vue b/frontend/src/components/Settings/ProfileSettings.vue index a2ef0974..34b92f11 100644 --- a/frontend/src/components/Settings/ProfileSettings.vue +++ b/frontend/src/components/Settings/ProfileSettings.vue @@ -1,5 +1,5 @@