From 53ebfc3ebb9a274ab40fe87b4d16cafc595fdb23 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 25 Jul 2023 21:31:07 +0530 Subject: [PATCH] fix: selected rows count on floating island --- frontend/src/components/ListView.vue | 50 ++++++++++++++++++++++++++-- frontend/src/pages/Contacts.vue | 2 +- frontend/src/pages/Leads.vue | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/ListView.vue b/frontend/src/components/ListView.vue index 433416a7..8f19c6d2 100644 --- a/frontend/src/components/ListView.vue +++ b/frontend/src/components/ListView.vue @@ -1,7 +1,7 @@ @@ -195,6 +235,10 @@ function getValue(value) { } let selections = reactive(new Set()) +let selectedText = computed(() => { + let title = selections.size === 1 ? props.title : `${props.title}s` + return `${selections.size} ${title} selected` +}) const allRowsSelected = computed(() => { if (!props.rows.length) return false @@ -207,8 +251,8 @@ function toggleRow(row) { } } -function toggleAllRows() { - if (allRowsSelected.value) { +function toggleAllRows(select) { + if (!select || allRowsSelected.value) { selections.clear() return } diff --git a/frontend/src/pages/Contacts.vue b/frontend/src/pages/Contacts.vue index d45ae7fe..b0fdf138 100644 --- a/frontend/src/pages/Contacts.vue +++ b/frontend/src/pages/Contacts.vue @@ -7,7 +7,7 @@ import ListView from '../components/ListView.vue' import { computed } from 'vue' import { createListResource } from 'frappe-ui' -const title = 'Contacts' +const title = 'Contact' const contacts = createListResource({ type: 'list', diff --git a/frontend/src/pages/Leads.vue b/frontend/src/pages/Leads.vue index 836896e6..fb3246ca 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -8,7 +8,7 @@ import { computed } from 'vue' import { createListResource } from 'frappe-ui' import { usersStore } from '../stores/users' -const title = 'Leads' +const title = 'Lead' const { getUser } = usersStore() const leads = createListResource({