From d8252cae19a9b63288bcc9b91edbd72a5ff763bd Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 26 Jun 2024 19:36:35 +0530 Subject: [PATCH] fix: added custom renderers for Lead/Deal/Task fields using slots for column title & kanban fields --- frontend/src/components/Kanban/KanbanView.vue | 47 +++-- frontend/src/pages/Deals.vue | 136 +++++++++++++- frontend/src/pages/Leads.vue | 171 +++++++++++++++++- frontend/src/pages/Tasks.vue | 99 +++++++++- 4 files changed, 431 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/Kanban/KanbanView.vue b/frontend/src/components/Kanban/KanbanView.vue index 715e02cd..368a569a 100644 --- a/frontend/src/components/Kanban/KanbanView.vue +++ b/frontend/src/components/Kanban/KanbanView.vue @@ -85,25 +85,40 @@ : undefined, }" > -
-
{{ fields[titleField] }}
-
{{ __('No Title') }}
-
-
-
-
-
{{ fields[value] || '-' }}
+ +
+
{{ fields[titleField] }}
+
{{ __('No Title') }}
+
+
+ +
+
-
-
-
+ +
+
+
+
diff --git a/frontend/src/pages/Deals.vue b/frontend/src/pages/Deals.vue index 6ef28a51..268888be 100644 --- a/frontend/src/pages/Deals.vue +++ b/frontend/src/pages/Deals.vue @@ -36,7 +36,129 @@ onNewClick: (column) => onNewClick(column), }" @update="(data) => viewControls.updateKanbanSettings(data)" - /> + > + + + + row.name == name)[field]) +} + // Rows const rows = computed(() => { if (!deals.value?.data?.data) return [] diff --git a/frontend/src/pages/Leads.vue b/frontend/src/pages/Leads.vue index 938bd7c2..68a0b728 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -37,7 +37,163 @@ onNewClick: (column) => onNewClick(column), }" @update="(data) => viewControls.updateKanbanSettings(data)" - /> + > + + + import CustomActions from '@/components/CustomActions.vue' +import PhoneIcon from '@/components/Icons/PhoneIcon.vue' import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue' import LeadsIcon from '@/components/Icons/LeadsIcon.vue' import LayoutHeader from '@/components/LayoutHeader.vue' @@ -89,7 +246,7 @@ import { usersStore } from '@/stores/users' import { organizationsStore } from '@/stores/organizations' import { statusesStore } from '@/stores/statuses' import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils' -import { Breadcrumbs } from 'frappe-ui' +import { Breadcrumbs, Avatar, Tooltip } from 'frappe-ui' import { useRoute } from 'vue-router' import { ref, computed, reactive, h } from 'vue' @@ -113,6 +270,16 @@ const triggerResize = ref(1) const updatedPageCount = ref(20) const viewControls = ref(null) +function getRow(name, field) { + function getValue(value) { + if (value && typeof value === 'object') { + return value + } + return { label: value } + } + return getValue(rows.value?.find((row) => row.name == name)[field]) +} + // Rows const rows = computed(() => { if (!leads.value?.data?.data) return [] diff --git a/frontend/src/pages/Tasks.vue b/frontend/src/pages/Tasks.vue index ea63013c..e93b1a6a 100644 --- a/frontend/src/pages/Tasks.vue +++ b/frontend/src/pages/Tasks.vue @@ -32,7 +32,90 @@ onNewClick: (column) => createTask(column), }" @update="(data) => viewControls.updateKanbanSettings(data)" - /> + > + + + import CustomActions from '@/components/CustomActions.vue' +import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue' +import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue' import EmailIcon from '@/components/Icons/EmailIcon.vue' import LayoutHeader from '@/components/LayoutHeader.vue' import ViewControls from '@/components/ViewControls.vue' @@ -83,7 +168,7 @@ import KanbanView from '@/components/Kanban/KanbanView.vue' import TaskModal from '@/components/Modals/TaskModal.vue' import { usersStore } from '@/stores/users' import { dateFormat, dateTooltipFormat, timeAgo } from '@/utils' -import { Breadcrumbs } from 'frappe-ui' +import { Breadcrumbs, Tooltip, Avatar, TextEditor } from 'frappe-ui' import { computed, ref } from 'vue' const breadcrumbs = [{ label: __('Tasks'), route: { name: 'Tasks' } }] @@ -99,6 +184,16 @@ const triggerResize = ref(1) const updatedPageCount = ref(20) const viewControls = ref(null) +function getRow(name, field) { + function getValue(value) { + if (value && typeof value === 'object') { + return value + } + return { label: value } + } + return getValue(rows.value?.find((row) => row.name == name)[field]) +} + const rows = computed(() => { if (!tasks.value?.data?.data) return []