fix: show email/comment/task/note count in action area
This commit is contained in:
parent
0061788919
commit
519b2e45e0
@ -339,6 +339,9 @@ def get_data(
|
||||
page_length=20,
|
||||
)
|
||||
|
||||
for d in column_data:
|
||||
getCounts(d, doctype)
|
||||
|
||||
if kc.get("order"):
|
||||
column_data = sorted(
|
||||
column_data, key=lambda x: kc.get("order").index(x.get("name"))
|
||||
@ -615,3 +618,12 @@ def get_fields(doctype: str, allow_all_fieldtypes: bool = False):
|
||||
})
|
||||
|
||||
return _fields
|
||||
|
||||
|
||||
def getCounts(d, doctype):
|
||||
d["_email_count"] = frappe.db.count("Communication", filters={"reference_doctype": doctype, "reference_name": d.get("name"), "communication_type": "Communication"}) or 0
|
||||
d["_email_count"] = d["_email_count"] + frappe.db.count("Communication", filters={"reference_doctype": doctype, "reference_name": d.get("name"), "communication_type": "Automated Message"})
|
||||
d["_comment_count"] = frappe.db.count("Comment", filters={"reference_doctype": doctype, "reference_name": d.get("name"), "comment_type": "Comment"})
|
||||
d["_task_count"] = frappe.db.count("CRM Task", filters={"reference_doctype": doctype, "reference_docname": d.get("name")})
|
||||
d["_note_count"] = frappe.db.count("FCRM Note", filters={"reference_doctype": doctype, "reference_docname": d.get("name")})
|
||||
return d
|
||||
@ -161,7 +161,27 @@
|
||||
|
||||
<template #actions="{ itemName }">
|
||||
<div class="flex gap-2 items-center justify-between">
|
||||
<div></div>
|
||||
<div class="text-gray-500 flex items-center gap-1.5">
|
||||
<EmailAtIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_email_count').label">
|
||||
{{ getRow(itemName, '_email_count').label }}
|
||||
</span>
|
||||
<span class="text-3xl leading-[0]"> · </span>
|
||||
<NoteIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_note_count').label">
|
||||
{{ getRow(itemName, '_note_count').label }}
|
||||
</span>
|
||||
<span class="text-3xl leading-[0]"> · </span>
|
||||
<TaskIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_task_count').label">
|
||||
{{ getRow(itemName, '_task_count').label }}
|
||||
</span>
|
||||
<span class="text-3xl leading-[0]"> · </span>
|
||||
<CommentIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_comment_count').label">
|
||||
{{ getRow(itemName, '_comment_count').label }}
|
||||
</span>
|
||||
</div>
|
||||
<Dropdown
|
||||
class="flex items-center gap-2"
|
||||
:options="actions(itemName)"
|
||||
@ -225,9 +245,11 @@
|
||||
|
||||
<script setup>
|
||||
import CustomActions from '@/components/CustomActions.vue'
|
||||
import EmailAtIcon from '@/components/Icons/EmailAtIcon.vue'
|
||||
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||
import NoteIcon from '@/components/Icons/NoteIcon.vue'
|
||||
import TaskIcon from '@/components/Icons/TaskIcon.vue'
|
||||
import CommentIcon from '@/components/Icons/CommentIcon.vue'
|
||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
@ -418,6 +440,10 @@ function parseRows(rows) {
|
||||
}
|
||||
}
|
||||
})
|
||||
_rows['_email_count'] = deal._email_count
|
||||
_rows['_note_count'] = deal._note_count
|
||||
_rows['_task_count'] = deal._task_count
|
||||
_rows['_comment_count'] = deal._comment_count
|
||||
return _rows
|
||||
})
|
||||
}
|
||||
|
||||
@ -195,7 +195,27 @@
|
||||
</template>
|
||||
<template #actions="{ itemName }">
|
||||
<div class="flex gap-2 items-center justify-between">
|
||||
<div></div>
|
||||
<div class="text-gray-500 flex items-center gap-1.5">
|
||||
<EmailAtIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_email_count').label">
|
||||
{{ getRow(itemName, '_email_count').label }}
|
||||
</span>
|
||||
<span class="text-3xl leading-[0]"> · </span>
|
||||
<NoteIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_note_count').label">
|
||||
{{ getRow(itemName, '_note_count').label }}
|
||||
</span>
|
||||
<span class="text-3xl leading-[0]"> · </span>
|
||||
<TaskIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_task_count').label">
|
||||
{{ getRow(itemName, '_task_count').label }}
|
||||
</span>
|
||||
<span class="text-3xl leading-[0]"> · </span>
|
||||
<CommentIcon class="h-4 w-4" />
|
||||
<span v-if="getRow(itemName, '_comment_count').label">
|
||||
{{ getRow(itemName, '_comment_count').label }}
|
||||
</span>
|
||||
</div>
|
||||
<Dropdown
|
||||
class="flex items-center gap-2"
|
||||
:options="actions(itemName)"
|
||||
@ -259,9 +279,11 @@
|
||||
|
||||
<script setup>
|
||||
import CustomActions from '@/components/CustomActions.vue'
|
||||
import EmailAtIcon from '@/components/Icons/EmailAtIcon.vue'
|
||||
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||
import NoteIcon from '@/components/Icons/NoteIcon.vue'
|
||||
import TaskIcon from '@/components/Icons/TaskIcon.vue'
|
||||
import CommentIcon from '@/components/Icons/CommentIcon.vue'
|
||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||
import LeadsIcon from '@/components/Icons/LeadsIcon.vue'
|
||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
@ -447,6 +469,10 @@ function parseRows(rows) {
|
||||
}
|
||||
}
|
||||
})
|
||||
_rows['_email_count'] = lead._email_count
|
||||
_rows['_note_count'] = lead._note_count
|
||||
_rows['_task_count'] = lead._task_count
|
||||
_rows['_comment_count'] = lead._comment_count
|
||||
return _rows
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user