Skip to content

Commit

Permalink
Merge pull request #488 from frappe/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik authored Dec 25, 2024
2 parents f3e6409 + 4fab05e commit 298aabb
Show file tree
Hide file tree
Showing 37 changed files with 1,068 additions and 564 deletions.
1 change: 1 addition & 0 deletions crm/fcrm/doctype/crm_deal/crm_deal.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def default_list_data():
'label': 'Amount',
'type': 'Currency',
'key': 'annual_revenue',
'align': 'right',
'width': '9rem',
},
{
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/Activities/DataFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
<span>{{ __('Loading...') }}</span>
</div>
<div v-else>
<FieldLayout v-if="tabs.data" :tabs="tabs.data" :data="data.doc" />
<FieldLayout
v-if="tabs.data"
:tabs="tabs.data"
:data="data.doc"
:doctype="doctype"
/>
</div>
<DataFieldsModal
v-if="showDataFieldsModal"
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/ColumnSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
</div>
</template>
</Draggable>
<div class="mt-1.5 flex flex-col gap-1 border-t border-outline-gray-modals pt-1.5">
<div
class="mt-1.5 flex flex-col gap-1 border-t border-outline-gray-modals pt-1.5"
>
<Autocomplete
value=""
:options="fields"
Expand Down Expand Up @@ -213,11 +215,13 @@ const fields = computed(() => {
})
function addColumn(c) {
let align = ['Float', 'Int', 'Percent', 'Currency'].includes(c.type) ? 'right' : 'left'
let _column = {
label: c.label,
type: c.type,
key: c.value,
width: '10rem',
align,
}
columns.value.push(_column)
rows.value.push(c.value)
Expand Down
36 changes: 34 additions & 2 deletions frontend/src/components/FieldLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,30 @@
:placeholder="getPlaceholder(field)"
v-model="data[field.name]"
/>
<FormControl
v-else-if="field.type === 'Percent'"
type="text"
:value="getFormattedPercent(field.name, data)"
:placeholder="getPlaceholder(field)"
:disabled="Boolean(field.read_only)"
@change="data[field.name] = flt($event.target.value)"
/>
<FormControl
v-else-if="field.type === 'Float'"
type="text"
:value="getFormattedFloat(field.name, data)"
:placeholder="getPlaceholder(field)"
:disabled="Boolean(field.read_only)"
@change="data[field.name] = flt($event.target.value)"
/>
<FormControl
v-else-if="field.type === 'Currency'"
type="text"
:value="getFormattedCurrency(field.name, data)"
:placeholder="getPlaceholder(field)"
:disabled="Boolean(field.read_only)"
@change="data[field.name] = flt($event.target.value)"
/>
<FormControl
v-else
type="text"
Expand All @@ -213,22 +237,30 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import UserAvatar from '@/components/UserAvatar.vue'
import Link from '@/components/Controls/Link.vue'
import { getMeta } from '../stores/meta'
import { usersStore } from '@/stores/users'
import { getFormat } from '@/utils'
import { flt } from '@/utils/numberFormat.js'
import { Tabs, Tooltip, DatePicker, DateTimePicker } from 'frappe-ui'
import { ref, computed } from 'vue'
const { getUser } = usersStore()
const props = defineProps({
tabs: Array,
data: Object,
doctype: {
type: String,
default: 'CRM Lead',
},
modal: {
type: Boolean,
default: false,
},
})
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
getMeta(props.doctype)
const { getUser } = usersStore()
const hasTabs = computed(() => !props.tabs[0].no_tabs)
const tabIndex = ref(0)
Expand Down
181 changes: 90 additions & 91 deletions frontend/src/components/ListViews/CallLogsListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
row-key="name"
v-bind="$attrs"
>
<ListHeader class="sm:mx-5 mx-3" @columnWidthUpdated="emit('columnWidthUpdated')">
<ListHeader
class="sm:mx-5 mx-3"
@columnWidthUpdated="emit('columnWidthUpdated')"
>
<ListHeaderItem
v-for="column in columns"
:key="column.key"
Expand All @@ -29,32 +32,52 @@
</Button>
</ListHeaderItem>
</ListHeader>
<ListRows class="mx-3 sm:mx-5" id="list-rows">
<ListRow
v-for="row in rows"
:key="row.name"
v-slot="{ idx, column, item }"
:row="row"
>
<ListRowItem :item="item">
<template #prefix>
<div v-if="['caller', 'receiver'].includes(column.key)">
<Avatar
v-if="item.label"
class="flex items-center"
:image="item.image"
:label="item.label"
size="sm"
/>
</div>
<div v-else-if="['type', 'duration'].includes(column.key)">
<FeatherIcon :name="item.icon" class="h-3 w-3" />
</div>
</template>
<template #default="{ label }">
<div
v-if="['modified', 'creation'].includes(column.key)"
class="truncate text-base"
<ListRows
class="mx-3 sm:mx-5"
:rows="rows"
v-slot="{ idx, column, item }"
doctype="CRM Call Log"
>
<ListRowItem :item="item" :align="column.align">
<template #prefix>
<div v-if="['caller', 'receiver'].includes(column.key)">
<Avatar
v-if="item.label"
class="flex items-center"
:image="item.image"
:label="item.label"
size="sm"
/>
</div>
<div v-else-if="['type', 'duration'].includes(column.key)">
<FeatherIcon :name="item.icon" class="h-3 w-3" />
</div>
</template>
<template #default="{ label }">
<div
v-if="['modified', 'creation'].includes(column.key)"
class="truncate text-base"
@click="
(event) =>
emit('applyFilter', {
event,
idx,
column,
item,
firstColumn: columns[0],
})
"
>
<Tooltip :text="item.label">
<div>{{ item.timeAgo }}</div>
</Tooltip>
</div>
<div v-else-if="column.key === 'status'" class="truncate text-base">
<Badge
:variant="'subtle'"
:theme="item.color"
size="md"
:label="__(item.label)"
@click="
(event) =>
emit('applyFilter', {
Expand All @@ -65,69 +88,46 @@
firstColumn: columns[0],
})
"
>
<Tooltip :text="item.label">
<div>{{ item.timeAgo }}</div>
</Tooltip>
</div>
<div v-else-if="column.key === 'status'" class="truncate text-base">
<Badge
:variant="'subtle'"
:theme="item.color"
size="md"
:label="__(item.label)"
@click="
(event) =>
emit('applyFilter', {
event,
idx,
column,
item,
firstColumn: columns[0],
})
"
/>
</div>
<div v-else-if="column.type === 'Check'">
<FormControl
type="checkbox"
:modelValue="item"
:disabled="true"
class="text-ink-gray-9"
/>
</div>
<div v-else-if="column.key === '_liked_by'">
<Button
v-if="column.key == '_liked_by'"
variant="ghosted"
:class="isLiked(item) ? 'fill-red-500' : 'fill-white'"
@click.stop.prevent="
() =>
emit('likeDoc', { name: row.name, liked: isLiked(item) })
"
>
<HeartIcon class="h-4 w-4" />
</Button>
</div>
<div
v-else
class="truncate text-base"
@click="
(event) =>
emit('applyFilter', {
event,
idx,
column,
item,
firstColumn: columns[0],
})
/>
</div>
<div v-else-if="column.type === 'Check'">
<FormControl
type="checkbox"
:modelValue="item"
:disabled="true"
class="text-ink-gray-9"
/>
</div>
<div v-else-if="column.key === '_liked_by'">
<Button
v-if="column.key == '_liked_by'"
variant="ghosted"
:class="isLiked(item) ? 'fill-red-500' : 'fill-white'"
@click.stop.prevent="
() => emit('likeDoc', { name: row.name, liked: isLiked(item) })
"
>
{{ label }}
</div>
</template>
</ListRowItem>
</ListRow>
<HeartIcon class="h-4 w-4" />
</Button>
</div>
<div
v-else
class="truncate text-base"
@click="
(event) =>
emit('applyFilter', {
event,
idx,
column,
item,
firstColumn: columns[0],
})
"
>
{{ label }}
</div>
</template>
</ListRowItem>
</ListRows>
<ListSelectBanner>
<template #actions="{ selections, unselectAll }">
Expand Down Expand Up @@ -161,13 +161,12 @@
<script setup>
import HeartIcon from '@/components/Icons/HeartIcon.vue'
import ListBulkActions from '@/components/ListBulkActions.vue'
import ListRows from '@/components/ListViews/ListRows.vue'
import {
Avatar,
ListView,
ListHeader,
ListHeaderItem,
ListRows,
ListRow,
ListSelectBanner,
ListRowItem,
ListFooter,
Expand Down Expand Up @@ -232,7 +231,7 @@ const listBulkActionsRef = ref(null)
defineExpose({
customListActions: computed(
() => listBulkActionsRef.value?.customListActions
() => listBulkActionsRef.value?.customListActions,
),
})
</script>
Loading

0 comments on commit 298aabb

Please sign in to comment.