1
0
forked from test/crm

fix: code cleanup

This commit is contained in:
Shariq Ansari 2025-03-21 16:24:25 +05:30
parent 33c314b704
commit a32749533f
3 changed files with 27 additions and 17 deletions

View File

@ -350,7 +350,9 @@ function getGroupedByRows(listRows, groupByField, columns) {
if (!option) {
filteredRows = listRows.filter((row) => !row[groupByField.fieldname])
} else {
filteredRows = listRows.filter((row) => row[groupByField.fieldname] == option)
filteredRows = listRows.filter(
(row) => row[groupByField.fieldname] == option,
)
}
let groupDetail = {
@ -382,16 +384,18 @@ function getKanbanRows(data, columns) {
}
function parseRows(rows, columns = []) {
let view_type = deals.value.data.view_type
let key = view_type === 'kanban' ? 'fieldname' : 'key'
let type = view_type === 'kanban' ? 'fieldtype' : 'type'
return rows.map((deal) => {
let _rows = {}
deals.value.data.rows.forEach((row) => {
_rows[row] = deal[row]
let fieldname = deals.value.data.view_type === 'kanban' ? 'fieldname' : 'key'
let fieldtype = deals.value.data.view_type === 'kanban' ? 'fieldtype' : 'type'
let fieldType = columns?.find(
(col) => (col[fieldname] || col.value) == row,
)?.[fieldtype]
let fieldType = columns?.find((col) => (col[key] || col.value) == row)?.[
type
]
if (
fieldType &&

View File

@ -370,7 +370,9 @@ function getGroupedByRows(listRows, groupByField, columns) {
if (!option) {
filteredRows = listRows.filter((row) => !row[groupByField.fieldname])
} else {
filteredRows = listRows.filter((row) => row[groupByField.fieldname] == option)
filteredRows = listRows.filter(
(row) => row[groupByField.fieldname] == option,
)
}
let groupDetail = {
@ -402,16 +404,18 @@ function getKanbanRows(data, columns) {
}
function parseRows(rows, columns = []) {
let view_type = leads.value.data.view_type
let key = view_type === 'kanban' ? 'fieldname' : 'key'
let type = view_type === 'kanban' ? 'fieldtype' : 'type'
return rows.map((lead) => {
let _rows = {}
leads.value?.data.rows.forEach((row) => {
_rows[row] = lead[row]
let fieldname = deals.value.data.view_type === 'kanban' ? 'fieldname' : 'key'
let fieldtype = deals.value.data.view_type === 'kanban' ? 'fieldtype' : 'type'
let fieldType = columns?.find(
(col) => (col[fieldname] || col.value) == row,
)?.[fieldtype]
let fieldType = columns?.find((col) => (col[key] || col.value) == row)?.[
type
]
if (
fieldType &&

View File

@ -257,16 +257,18 @@ function getKanbanRows(data, columns) {
}
function parseRows(rows, columns = []) {
let view_type = tasks.value.data.view_type
let key = view_type === 'kanban' ? 'fieldname' : 'key'
let type = view_type === 'kanban' ? 'fieldtype' : 'type'
return rows.map((task) => {
let _rows = {}
tasks.value?.data.rows.forEach((row) => {
_rows[row] = task[row]
let fieldname = deals.value.data.view_type === 'kanban' ? 'fieldname' : 'key'
let fieldtype = deals.value.data.view_type === 'kanban' ? 'fieldtype' : 'type'
let fieldType = columns?.find(
(col) => (col[fieldname] || col.value) == row,
)?.[fieldtype]
let fieldType = columns?.find((col) => (col[key] || col.value) == row)?.[
type
]
if (
fieldType &&