diff --git a/src/components/ui/CardList.vue b/src/components/ui/CardList.vue
index 6b93a88e6..7d7cee23e 100644
--- a/src/components/ui/CardList.vue
+++ b/src/components/ui/CardList.vue
@@ -1,28 +1,20 @@
@@ -41,8 +33,8 @@ const selectedItem = (item) => {
diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue
index 902dc212d..292fa2e0a 100644
--- a/src/pages/InvoiceOut/InvoiceOutList.vue
+++ b/src/pages/InvoiceOut/InvoiceOutList.vue
@@ -13,11 +13,9 @@ import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
const { t } = useI18n();
-const arrayElements = ref([]);
-const manageCheckboxes = ref(false);
+const selectedCards = ref(new Map());
const quasar = useQuasar();
const router = useRouter();
-const showSelect = ref(false);
const stateStore = useStateStore();
onMounted(() => (stateStore.rightDrawer = true));
@@ -36,42 +34,40 @@ function viewSummary(id) {
});
}
-const setShowSelect = () => {
- showSelect.value = !showSelect.value;
+const toggleIndividualCard = (cardData) => {
+ if (selectedCards.value.has(cardData.id)) {
+ selectedCards.value.delete(cardData.id);
+ return;
+ }
+ selectedCards.value.set(cardData.id, cardData);
};
-const setManageCheckboxes = (downloadType) => {
- console.log(downloadType);
-};
+const toggleAllCards = (cardsData) => {
+ const allSelected = selectedCards.value.size === cardsData.length;
-const addElement = (element) => {
- showSelect.value = false;
- manageCheckboxes.value = false;
- if (arrayElements.value.length >= 0) {
- const index = arrayElements.value.findIndex((item) => item.id === element.id);
- if (index >= 0) {
- arrayElements.value.splice(index, 1);
- } else {
- arrayElements.value.push(element);
- }
+ if (!allSelected) {
+ // Si no todas las tarjetas están seleccionadas, selecciónalas todas
+ cardsData.forEach((data) => {
+ if (!selectedCards.value.has(data.id)) {
+ selectedCards.value.set(data.id, data);
+ }
+ });
+ } else {
+ // Si todas las tarjetas están seleccionadas, deselecciónalas todas
+ selectedCards.value.clear();
}
};
-watch(manageCheckboxes, (current, prev) => {
- if (!current) {
- arrayElements.value = [];
- }
-});
-
-const downloadCsv = (rows) => {
- const data = arrayElements.value.length ? arrayElements.value : rows;
+const downloadCsv = () => {
+ if (selectedCards.value.size === 0) return;
+ const selectedCardsArray = Array.from(selectedCards.value.values());
let file;
- for (var i = 0; i < data.length; i++) {
- if (i == 0) file += Object.keys(data[i]).join(';') + '\n';
+ for (var i = 0; i < selectedCardsArray.length; i++) {
+ if (i == 0) file += Object.keys(selectedCardsArray[i]).join(';') + '\n';
file +=
- Object.keys(data[i])
+ Object.keys(selectedCardsArray[i])
.map(function (key) {
- return data[i][key];
+ return selectedCardsArray[i][key];
})
.join(';') + '\n';
}
@@ -79,7 +75,6 @@ const downloadCsv = (rows) => {
encoding: 'windows-1252',
mimeType: 'text/csv;charset=windows-1252;',
});
-
if (status === true) {
quasar.notify({
message: t('fileAllowed'),
@@ -137,14 +132,13 @@ const downloadCsv = (rows) => {
- {
-
-
+ -->
@@ -190,14 +183,14 @@ const downloadCsv = (rows) => {