Skip to content

Commit

Permalink
fix: allow assigned_to in listview
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Dec 27, 2023
1 parent 607d7bf commit 2bec432
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions crm/api/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def get_list_data(doctype: str, filters: dict, order_by: str):
"value": "modified_by",
"options": "User",
},
{"label": "Assigned To", "type": "Text", "value": "_assign"},
{"label": "Owner", "type": "Link", "value": "owner", "options": "User"},
]

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/ListViews/DealsListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
v-slot="{ column, item }"
:row="row"
>
<ListRowItem :item="item">
<div v-if="column.key === '_assign'" class="flex items-center">
<MultipleAvatar :avatars="item" />
</div>
<ListRowItem v-else :item="item">
<template #prefix>
<div v-if="column.key === 'status'">
<IndicatorIcon :class="item.color" />
Expand Down Expand Up @@ -86,6 +89,7 @@
</template>

<script setup>
import MultipleAvatar from '@/components/MultipleAvatar.vue'
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import {
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/ListViews/LeadsListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
v-slot="{ column, item }"
:row="row"
>
<ListRowItem :item="item">
<div v-if="column.key === '_assign'" class="flex items-center">
<MultipleAvatar :avatars="item" />
</div>
<ListRowItem v-else :item="item">
<template #prefix>
<div v-if="column.key === 'status'">
<IndicatorIcon :class="item.color" />
Expand Down Expand Up @@ -97,6 +100,7 @@
<script setup>
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import MultipleAvatar from '@/components/MultipleAvatar.vue'
import {
Avatar,
ListView,
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/pages/Deals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
<ViewSettings doctype="CRM Deal" v-model="deals" />
</div>
</div>
<DealsListView v-if="deals.data && rows.length" :rows="rows" :columns="deals.data.columns" />
<DealsListView
v-if="deals.data && rows.length"
:rows="rows"
:columns="deals.data.columns"
/>
<div v-else-if="deals.data" class="flex h-full items-center justify-center">
<div
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
Expand Down Expand Up @@ -193,6 +197,13 @@ const rows = computed(() => {
label: deal.deal_owner && getUser(deal.deal_owner).full_name,
...(deal.deal_owner && getUser(deal.deal_owner)),
}
} else if (row == '_assign') {
let assignees = JSON.parse(deal._assign) || []
_rows[row] = assignees.map((user) => ({
name: user,
image: getUser(user).user_image,
label: getUser(user).full_name,
}))
} else if (['modified', 'creation'].includes(row)) {
_rows[row] = {
label: dateFormat(deal[row], dateTooltipFormat),
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/pages/Leads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ const rows = computed(() => {
label: lead.lead_owner && getUser(lead.lead_owner).full_name,
...(lead.lead_owner && getUser(lead.lead_owner)),
}
} else if (row == '_assign') {
let assignees = JSON.parse(lead._assign) || []
_rows[row] = assignees.map((user) => ({
name: user,
image: getUser(user).user_image,
label: getUser(user).full_name,
}))
} else if (['modified', 'creation'].includes(row)) {
_rows[row] = {
label: dateFormat(lead[row], dateTooltipFormat),
Expand Down

0 comments on commit 2bec432

Please sign in to comment.