From 504f215c5ac66b15b51fdf487a9bf39be7193264 Mon Sep 17 00:00:00 2001 From: nquidox Date: Tue, 4 Nov 2025 16:46:37 +0300 Subject: [PATCH] zero prices fixes --- src/views/ZeroPricesView.vue | 21 ++++++++++++++++--- src/views/ZeroPricesView/ZeroPriceCard.vue | 15 ++++++------- .../ZeroPricesView/ZeroPricesToolbar.vue | 10 ++++++++- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/views/ZeroPricesView.vue b/src/views/ZeroPricesView.vue index adab776..6e5820e 100644 --- a/src/views/ZeroPricesView.vue +++ b/src/views/ZeroPricesView.vue @@ -17,10 +17,17 @@ const handleToggle = ({ id, merch_uuid, checked }) => { } } +const handleSelectAll = () => { + toDelete.value = zeroPrices.value.map(item => ({ + id: item.id, + merch_uuid: item.merch_uuid + })) +} + const fetchZeroPrices = async () => { try { const response = await getZeroPrices() - zeroPrices.value = response.data + zeroPrices.value = Array.isArray(response.data) ? response.data : [] } catch (error) { console.error(error) } @@ -43,10 +50,18 @@ onMounted(() => {
- +
- +
diff --git a/src/views/ZeroPricesView/ZeroPriceCard.vue b/src/views/ZeroPricesView/ZeroPriceCard.vue index 10c80d7..44236ee 100644 --- a/src/views/ZeroPricesView/ZeroPriceCard.vue +++ b/src/views/ZeroPricesView/ZeroPriceCard.vue @@ -1,21 +1,22 @@ @@ -24,7 +25,7 @@ const handleCheckboxChange = () => {
- + Delete diff --git a/src/views/ZeroPricesView/ZeroPricesToolbar.vue b/src/views/ZeroPricesView/ZeroPricesToolbar.vue index 122e3d5..abe01cb 100644 --- a/src/views/ZeroPricesView/ZeroPricesToolbar.vue +++ b/src/views/ZeroPricesView/ZeroPricesToolbar.vue @@ -10,7 +10,7 @@ const props = defineProps({ const messages = useMessage() const { deleteZeroPrices } = useZeroPrices() -const emit = defineEmits(['deleted']) +const emit = defineEmits(['deleted', 'selectAll']) const handleDelete = async () => { try { @@ -22,6 +22,11 @@ const handleDelete = async () => { messages.error("Error deleting selected prices") } } + +const handleSelectAll = async () => { + emit('selectAll') +} +