fix: implemented liked_by in all listviews
This commit is contained in:
parent
64bb67d594
commit
fee14c8a1a
@ -10,7 +10,24 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')">
|
||||||
|
<ListHeaderItem
|
||||||
|
v-for="column in columns"
|
||||||
|
:key="column.key"
|
||||||
|
:item="column"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated', column)"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
v-if="column.key == '_liked_by'"
|
||||||
|
variant="ghosted"
|
||||||
|
class="!h-4"
|
||||||
|
:class="isLikeFilterApplied ? 'fill-red-500' : 'fill-white'"
|
||||||
|
@click="() => emit('applyLikeFilter')"
|
||||||
|
>
|
||||||
|
<HeartIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -79,6 +96,19 @@
|
|||||||
class="text-gray-900"
|
class="text-gray-900"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="truncate text-base"
|
class="truncate text-base"
|
||||||
@ -129,11 +159,13 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import HeartIcon from '@/components/Icons/HeartIcon.vue'
|
||||||
import ListBulkActions from '@/components/ListBulkActions.vue'
|
import ListBulkActions from '@/components/ListBulkActions.vue'
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
ListView,
|
ListView,
|
||||||
ListHeader,
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
ListRows,
|
ListRows,
|
||||||
ListRow,
|
ListRow,
|
||||||
ListSelectBanner,
|
ListSelectBanner,
|
||||||
@ -142,7 +174,8 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref, watch } from 'vue'
|
import { sessionStore } from '@/stores/session'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -170,11 +203,26 @@ const emit = defineEmits([
|
|||||||
'updatePageCount',
|
'updatePageCount',
|
||||||
'columnWidthUpdated',
|
'columnWidthUpdated',
|
||||||
'applyFilter',
|
'applyFilter',
|
||||||
|
'applyLikeFilter',
|
||||||
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const isLikeFilterApplied = computed(() => {
|
||||||
|
return list.value.params?.filters?._liked_by ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
|
const { user } = sessionStore()
|
||||||
|
|
||||||
|
function isLiked(item) {
|
||||||
|
if (item) {
|
||||||
|
let likedByMe = JSON.parse(item)
|
||||||
|
return likedByMe.includes(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
|
|||||||
@ -14,7 +14,24 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')">
|
||||||
|
<ListHeaderItem
|
||||||
|
v-for="column in columns"
|
||||||
|
:key="column.key"
|
||||||
|
:item="column"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated', column)"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
v-if="column.key == '_liked_by'"
|
||||||
|
variant="ghosted"
|
||||||
|
class="!h-4"
|
||||||
|
:class="isLikeFilterApplied ? 'fill-red-500' : 'fill-white'"
|
||||||
|
@click="() => emit('applyLikeFilter')"
|
||||||
|
>
|
||||||
|
<HeartIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -74,6 +91,19 @@
|
|||||||
class="text-gray-900"
|
class="text-gray-900"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="truncate text-base"
|
class="truncate text-base"
|
||||||
@ -124,12 +154,14 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import HeartIcon from '@/components/Icons/HeartIcon.vue'
|
||||||
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||||
import ListBulkActions from '@/components/ListBulkActions.vue'
|
import ListBulkActions from '@/components/ListBulkActions.vue'
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
ListView,
|
ListView,
|
||||||
ListHeader,
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
ListRows,
|
ListRows,
|
||||||
ListRow,
|
ListRow,
|
||||||
ListSelectBanner,
|
ListSelectBanner,
|
||||||
@ -138,7 +170,8 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref, watch } from 'vue'
|
import { sessionStore } from '@/stores/session'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -166,11 +199,26 @@ const emit = defineEmits([
|
|||||||
'updatePageCount',
|
'updatePageCount',
|
||||||
'columnWidthUpdated',
|
'columnWidthUpdated',
|
||||||
'applyFilter',
|
'applyFilter',
|
||||||
|
'applyLikeFilter',
|
||||||
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const isLikeFilterApplied = computed(() => {
|
||||||
|
return list.value.params?.filters?._liked_by ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
|
const { user } = sessionStore()
|
||||||
|
|
||||||
|
function isLiked(item) {
|
||||||
|
if (item) {
|
||||||
|
let likedByMe = JSON.parse(item)
|
||||||
|
return likedByMe.includes(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
|
|||||||
@ -11,7 +11,24 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')">
|
||||||
|
<ListHeaderItem
|
||||||
|
v-for="column in columns"
|
||||||
|
:key="column.key"
|
||||||
|
:item="column"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated', column)"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
v-if="column.key == '_liked_by'"
|
||||||
|
variant="ghosted"
|
||||||
|
class="!h-4"
|
||||||
|
:class="isLikeFilterApplied ? 'fill-red-500' : 'fill-white'"
|
||||||
|
@click="() => emit('applyLikeFilter')"
|
||||||
|
>
|
||||||
|
<HeartIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -62,6 +79,19 @@
|
|||||||
<div v-else-if="column.key === 'mobile_no'">
|
<div v-else-if="column.key === 'mobile_no'">
|
||||||
<PhoneIcon class="h-4 w-4" />
|
<PhoneIcon class="h-4 w-4" />
|
||||||
</div>
|
</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>
|
||||||
</template>
|
</template>
|
||||||
<template #default="{ label }">
|
<template #default="{ label }">
|
||||||
<div
|
<div
|
||||||
@ -164,6 +194,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import HeartIcon from '@/components/Icons/HeartIcon.vue'
|
||||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
||||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||||
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||||
@ -172,6 +203,7 @@ import {
|
|||||||
Avatar,
|
Avatar,
|
||||||
ListView,
|
ListView,
|
||||||
ListHeader,
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
ListRows,
|
ListRows,
|
||||||
ListRow,
|
ListRow,
|
||||||
ListRowItem,
|
ListRowItem,
|
||||||
@ -180,7 +212,8 @@ import {
|
|||||||
Dropdown,
|
Dropdown,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref, watch } from 'vue'
|
import { sessionStore } from '@/stores/session'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -208,11 +241,26 @@ const emit = defineEmits([
|
|||||||
'updatePageCount',
|
'updatePageCount',
|
||||||
'columnWidthUpdated',
|
'columnWidthUpdated',
|
||||||
'applyFilter',
|
'applyFilter',
|
||||||
|
'applyLikeFilter',
|
||||||
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const isLikeFilterApplied = computed(() => {
|
||||||
|
return list.value.params?.filters?._liked_by ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
|
const { user } = sessionStore()
|
||||||
|
|
||||||
|
function isLiked(item) {
|
||||||
|
if (item) {
|
||||||
|
let likedByMe = JSON.parse(item)
|
||||||
|
return likedByMe.includes(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
|
|||||||
@ -10,7 +10,24 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')">
|
||||||
|
<ListHeaderItem
|
||||||
|
v-for="column in columns"
|
||||||
|
:key="column.key"
|
||||||
|
:item="column"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated', column)"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
v-if="column.key == '_liked_by'"
|
||||||
|
variant="ghosted"
|
||||||
|
class="!h-4"
|
||||||
|
:class="isLikeFilterApplied ? 'fill-red-500' : 'fill-white'"
|
||||||
|
@click="() => emit('applyLikeFilter')"
|
||||||
|
>
|
||||||
|
<HeartIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -68,6 +85,19 @@
|
|||||||
class="text-gray-900"
|
class="text-gray-900"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="truncate text-base"
|
class="truncate text-base"
|
||||||
@ -117,10 +147,12 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import HeartIcon from '@/components/Icons/HeartIcon.vue'
|
||||||
import ListBulkActions from '@/components/ListBulkActions.vue'
|
import ListBulkActions from '@/components/ListBulkActions.vue'
|
||||||
import {
|
import {
|
||||||
ListView,
|
ListView,
|
||||||
ListHeader,
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
ListRows,
|
ListRows,
|
||||||
ListRow,
|
ListRow,
|
||||||
ListSelectBanner,
|
ListSelectBanner,
|
||||||
@ -129,7 +161,8 @@ import {
|
|||||||
Dropdown,
|
Dropdown,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref, watch } from 'vue'
|
import { sessionStore } from '@/stores/session'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -158,11 +191,26 @@ const emit = defineEmits([
|
|||||||
'showEmailTemplate',
|
'showEmailTemplate',
|
||||||
'columnWidthUpdated',
|
'columnWidthUpdated',
|
||||||
'applyFilter',
|
'applyFilter',
|
||||||
|
'applyLikeFilter',
|
||||||
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const isLikeFilterApplied = computed(() => {
|
||||||
|
return list.value.params?.filters?._liked_by ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
|
const { user } = sessionStore()
|
||||||
|
|
||||||
|
function isLiked(item) {
|
||||||
|
if (item) {
|
||||||
|
let likedByMe = JSON.parse(item)
|
||||||
|
return likedByMe.includes(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
|
|||||||
@ -13,7 +13,24 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')">
|
||||||
|
<ListHeaderItem
|
||||||
|
v-for="column in columns"
|
||||||
|
:key="column.key"
|
||||||
|
:item="column"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated', column)"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
v-if="column.key == '_liked_by'"
|
||||||
|
variant="ghosted"
|
||||||
|
class="!h-4"
|
||||||
|
:class="isLikeFilterApplied ? 'fill-red-500' : 'fill-white'"
|
||||||
|
@click="() => emit('applyLikeFilter')"
|
||||||
|
>
|
||||||
|
<HeartIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -61,6 +78,19 @@
|
|||||||
class="text-gray-900"
|
class="text-gray-900"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="truncate text-base"
|
class="truncate text-base"
|
||||||
@ -110,11 +140,13 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import HeartIcon from '@/components/Icons/HeartIcon.vue'
|
||||||
import ListBulkActions from '@/components/ListBulkActions.vue'
|
import ListBulkActions from '@/components/ListBulkActions.vue'
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
ListView,
|
ListView,
|
||||||
ListHeader,
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
ListRows,
|
ListRows,
|
||||||
ListRow,
|
ListRow,
|
||||||
ListSelectBanner,
|
ListSelectBanner,
|
||||||
@ -123,7 +155,8 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref, watch } from 'vue'
|
import { sessionStore } from '@/stores/session'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -151,11 +184,26 @@ const emit = defineEmits([
|
|||||||
'updatePageCount',
|
'updatePageCount',
|
||||||
'columnWidthUpdated',
|
'columnWidthUpdated',
|
||||||
'applyFilter',
|
'applyFilter',
|
||||||
|
'applyLikeFilter',
|
||||||
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const isLikeFilterApplied = computed(() => {
|
||||||
|
return list.value.params?.filters?._liked_by ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
|
const { user } = sessionStore()
|
||||||
|
|
||||||
|
function isLiked(item) {
|
||||||
|
if (item) {
|
||||||
|
let likedByMe = JSON.parse(item)
|
||||||
|
return likedByMe.includes(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
|
|||||||
@ -10,7 +10,24 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')">
|
||||||
|
<ListHeaderItem
|
||||||
|
v-for="column in columns"
|
||||||
|
:key="column.key"
|
||||||
|
:item="column"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated', column)"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
v-if="column.key == '_liked_by'"
|
||||||
|
variant="ghosted"
|
||||||
|
class="!h-4"
|
||||||
|
:class="isLikeFilterApplied ? 'fill-red-500' : 'fill-white'"
|
||||||
|
@click="() => emit('applyLikeFilter')"
|
||||||
|
>
|
||||||
|
<HeartIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -74,6 +91,19 @@
|
|||||||
class="text-gray-900"
|
class="text-gray-900"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="truncate text-base"
|
class="truncate text-base"
|
||||||
@ -123,6 +153,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import HeartIcon from '@/components/Icons/HeartIcon.vue'
|
||||||
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
||||||
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
||||||
import CalendarIcon from '@/components/Icons/CalendarIcon.vue'
|
import CalendarIcon from '@/components/Icons/CalendarIcon.vue'
|
||||||
@ -132,6 +163,7 @@ import {
|
|||||||
Avatar,
|
Avatar,
|
||||||
ListView,
|
ListView,
|
||||||
ListHeader,
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
ListRows,
|
ListRows,
|
||||||
ListRow,
|
ListRow,
|
||||||
ListSelectBanner,
|
ListSelectBanner,
|
||||||
@ -140,7 +172,8 @@ import {
|
|||||||
Dropdown,
|
Dropdown,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref, watch } from 'vue'
|
import { sessionStore } from '@/stores/session'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -169,11 +202,26 @@ const emit = defineEmits([
|
|||||||
'showTask',
|
'showTask',
|
||||||
'columnWidthUpdated',
|
'columnWidthUpdated',
|
||||||
'applyFilter',
|
'applyFilter',
|
||||||
|
'applyLikeFilter',
|
||||||
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const isLikeFilterApplied = computed(() => {
|
||||||
|
return list.value.params?.filters?._liked_by ? true : false
|
||||||
|
})
|
||||||
|
|
||||||
|
const { user } = sessionStore()
|
||||||
|
|
||||||
|
function isLiked(item) {
|
||||||
|
if (item) {
|
||||||
|
let likedByMe = JSON.parse(item)
|
||||||
|
return likedByMe.includes(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
|
|||||||
@ -36,6 +36,8 @@
|
|||||||
@columnWidthUpdated="() => triggerResize++"
|
@columnWidthUpdated="() => triggerResize++"
|
||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
@applyFilter="(data) => viewControls.applyFilter(data)"
|
@applyFilter="(data) => viewControls.applyFilter(data)"
|
||||||
|
@applyLikeFilter="(data) => viewControls.applyLikeFilter(data)"
|
||||||
|
@likeDoc="(data) => viewControls.likeDoc(data)"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-else-if="callLogs.data"
|
v-else-if="callLogs.data"
|
||||||
|
|||||||
@ -42,6 +42,8 @@
|
|||||||
@columnWidthUpdated="() => triggerResize++"
|
@columnWidthUpdated="() => triggerResize++"
|
||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
@applyFilter="(data) => viewControls.applyFilter(data)"
|
@applyFilter="(data) => viewControls.applyFilter(data)"
|
||||||
|
@applyLikeFilter="(data) => viewControls.applyLikeFilter(data)"
|
||||||
|
@likeDoc="(data) => viewControls.likeDoc(data)"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-else-if="contacts.data"
|
v-else-if="contacts.data"
|
||||||
|
|||||||
@ -42,6 +42,8 @@
|
|||||||
@columnWidthUpdated="() => triggerResize++"
|
@columnWidthUpdated="() => triggerResize++"
|
||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
@applyFilter="(data) => viewControls.applyFilter(data)"
|
@applyFilter="(data) => viewControls.applyFilter(data)"
|
||||||
|
@applyLikeFilter="(data) => viewControls.applyLikeFilter(data)"
|
||||||
|
@likeDoc="(data) => viewControls.likeDoc(data)"
|
||||||
/>
|
/>
|
||||||
<div v-else-if="deals.data" class="flex h-full items-center justify-center">
|
<div v-else-if="deals.data" class="flex h-full items-center justify-center">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -43,6 +43,8 @@
|
|||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
@showEmailTemplate="showEmailTemplate"
|
@showEmailTemplate="showEmailTemplate"
|
||||||
@applyFilter="(data) => viewControls.applyFilter(data)"
|
@applyFilter="(data) => viewControls.applyFilter(data)"
|
||||||
|
@applyLikeFilter="(data) => viewControls.applyLikeFilter(data)"
|
||||||
|
@likeDoc="(data) => viewControls.likeDoc(data)"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-else-if="emailTemplates.data"
|
v-else-if="emailTemplates.data"
|
||||||
|
|||||||
@ -42,6 +42,8 @@
|
|||||||
@columnWidthUpdated="() => triggerResize++"
|
@columnWidthUpdated="() => triggerResize++"
|
||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
@applyFilter="(data) => viewControls.applyFilter(data)"
|
@applyFilter="(data) => viewControls.applyFilter(data)"
|
||||||
|
@applyLikeFilter="(data) => viewControls.applyLikeFilter(data)"
|
||||||
|
@likeDoc="(data) => viewControls.likeDoc(data)"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-else-if="organizations.data"
|
v-else-if="organizations.data"
|
||||||
|
|||||||
@ -39,6 +39,8 @@
|
|||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
@showTask="showTask"
|
@showTask="showTask"
|
||||||
@applyFilter="(data) => viewControls.applyFilter(data)"
|
@applyFilter="(data) => viewControls.applyFilter(data)"
|
||||||
|
@applyLikeFilter="(data) => viewControls.applyLikeFilter(data)"
|
||||||
|
@likeDoc="(data) => viewControls.likeDoc(data)"
|
||||||
/>
|
/>
|
||||||
<div v-else-if="tasks.data" class="flex h-full items-center justify-center">
|
<div v-else-if="tasks.data" class="flex h-full items-center justify-center">
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user