0
0
Fork 0

refs #7409 fix balance

This commit is contained in:
Carlos Satorres 2024-07-10 13:22:19 +02:00
parent 36fc988df2
commit 05fcff1cbf
3 changed files with 47 additions and 0 deletions

View File

@ -937,6 +937,7 @@ worker:
debit: Debt
credit: Have
concept: Concept
id: id
wagon:
type:
name: Name

View File

@ -930,6 +930,7 @@ worker:
debit: Debe
credit: Haber
concept: Concepto
id: id
wagon:
type:
name: Nombre

View File

@ -1,14 +1,27 @@
<script setup>
import axios from 'axios';
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useQuasar } from 'quasar';
import { useVnConfirm } from 'composables/useVnConfirm';
import VnTable from 'components/VnTable/VnTable.vue';
const tableRef = ref();
const { t } = useI18n();
const route = useRoute();
const entityId = computed(() => route.params.id);
const quasar = useQuasar();
const { openConfirmationModal } = useVnConfirm();
const columns = computed(() => [
{
align: 'left',
name: 'id',
label: t('worker.balance.tableVisibleColumns.id'),
field: 'id',
cardVisible: true,
},
{
align: 'left',
name: 'paymentDate',
@ -57,11 +70,43 @@ const columns = computed(() => [
field: 'concept',
cardVisible: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('Remove'),
icon: 'delete',
action: (row) =>
openConfirmationModal(t('CHANGE ME!'), t('CHANGE ME!'), () =>
deleteBalance(row)
),
isPrimary: true,
},
],
},
]);
async function deleteBalance({ id }) {
try {
await axios.delete(`workerIncomes/${id}`);
quasar.notify({
message: t('Remove incomes'),
type: 'positive',
});
tableRef.value.reload();
} catch (error) {
quasar.notify({
message: t('Error'),
type: 'error',
});
}
}
</script>
<template>
<VnTable
class="column flex-center"
ref="tableRef"
data-key="WorkerBalance"
:url="`Workers/${entityId}/incomes`"