diff --git a/src/components/ui/VnConfirm.vue b/src/components/ui/VnConfirm.vue index f04e51224..00db77b5c 100644 --- a/src/components/ui/VnConfirm.vue +++ b/src/components/ui/VnConfirm.vue @@ -66,7 +66,7 @@ async function confirm() { - {{ message }} + [ format: (value) => toCurrency(value), sortable: true, }, - { - name: 'actions', - label: t('Actions'), - }, ]); const selected = ref([]); @@ -145,22 +141,40 @@ function onUpdateDiscount(response) { }); } -async function confirmRemove(id, index) { +async function confirmRemove() { + const rows = selected.value; + const count = rows.length; + + if (count === 0) { + return quasar.notify({ + message: 'You must select at least one row', + type: 'warning', + }); + } + quasar .dialog({ component: VnConfirm, componentProps: { - title: t('Delete claimed sale'), - data: { id }, + title: t('Delete claimed sales'), + message: t('You are about to remove {count} rows', count, { count }), + data: { rows }, promise: remove, }, }) - .onOk(() => store.data.splice(index, 1)); + .onOk(() => { + for (const row of rows) { + const orgData = store.data; + const index = orgData.findIndex((item) => item.id === row.id); + store.data.splice(index, 1); + } + }); } -async function remove({ id }) { - if (!id) return; - await axios.delete(`ClaimBeginnings/${id}`); +async function remove({ rows }) { + if (!rows.length) return; + const body = { deletes: rows.map((row) => row.id) }; + await axios.post(`ClaimBeginnings/crud`, body); quasar.notify({ type: 'positive', message: t('globals.rowRemoved'), @@ -172,23 +186,29 @@ function showImportDialog() { .dialog({ component: ClaimLinesImport, }) - .onOk(() => {}); + .onOk(() => arrayData.refresh()); } - + Lines + + {{ t('Amount') }} - {{ toCurrency(amount) }} + + {{ toCurrency(amount) }} + {{ t('Amount Claimed') }} - {{ toCurrency(amountClaimed) }} + + {{ toCurrency(amountClaimed) }} + - + @@ -217,6 +237,7 @@ function showImportDialog() { selection="multiple" v-model:selected="selected" hide-pagination + :grid="$q.screen.lt.md" > @@ -273,20 +294,6 @@ function showImportDialog() { /> - - - - Delete claimed sale - - - @@ -294,26 +301,46 @@ function showImportDialog() { - + + {{ t('globals.remove') }} + + {{ t('globals.add') }} - - + + - + + + @@ -322,11 +349,16 @@ function showImportDialog() { +en: + You are about to remove {count} rows: ' + You are about to remove {count} row | + You are about to remove {count} rows' es: Delivered: Entregado Quantity: Cantidad @@ -337,7 +369,11 @@ es: Actions: Acciones Amount: Total Amount Claimed: Cantidad reclamada - Delete claimed sale: Eliminar venta reclamada + Delete claimed sales: Eliminar ventas reclamadas Discount updated: Descuento actualizado Claimed quantity: Cantidad reclamada + row: 'línea | líneas' + You are about to remove {count} rows: ' + Vas a eliminar {count} línea | + Vas a eliminar {count} líneas' diff --git a/src/pages/Claim/Card/ClaimLinesImport.vue b/src/pages/Claim/Card/ClaimLinesImport.vue index 14ba6d3c9..ed657e4cd 100644 --- a/src/pages/Claim/Card/ClaimLinesImport.vue +++ b/src/pages/Claim/Card/ClaimLinesImport.vue @@ -1,80 +1,139 @@ + (claimableSales = data)" + auto-load + /> - {{ t('Available Sales') }} + {{ t('Available sales lines') }} + - - - - - - - + @@ -91,17 +150,12 @@ const scrollable = ref(); + + +es: + Available sales lines: Líneas de venta disponibles + Delivered: Entrega + Quantity: Cantidad + Description: Descripción + Price: Precio + Discount: Descuento + Lines added to claim: Lineas añadidas a la reclamación + You must select at least one: Debes seleccionar al menos una +