feat: refs #8277 add pre-account functionality and update daysAgo handling in EntryControl
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-03-21 12:25:14 +01:00
parent b528bb4ed1
commit dbb8d2a115
3 changed files with 25 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, markRaw, useTemplateRef, watch } from 'vue'; import { ref, computed, markRaw, useTemplateRef, onBeforeMount } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
@ -10,6 +10,7 @@ import EntryDescriptorProxy from './Card/EntryDescriptorProxy.vue';
import SupplierDescriptorProxy from '../Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from '../Supplier/Card/SupplierDescriptorProxy.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const MAXDAYS = 365; const MAXDAYS = 365;
@ -24,6 +25,7 @@ const countries = ref([]);
const entryTypes = ref([]); const entryTypes = ref([]);
const entryAccounts = ref([]); const entryAccounts = ref([]);
const warehouses = ref([]); const warehouses = ref([]);
const selectedRows = ref([]);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'id', name: 'id',
@ -189,15 +191,7 @@ const columns = computed(() => [
// }, // },
]); ]);
watch( onBeforeMount(() => (daysAgo.value = arrayData.store.userParams.daysAgo || DEFAULTDAYS));
() => arrayData.store.userParams.daysAgo,
(nVal, oVal) => {
if (!oVal && !nVal) daysAgo.value = DEFAULTDAYS;
else if (!nVal) daysAgo.value = MAXDAYS;
else daysAgo.value = nVal;
},
{ immediate: true },
);
function filterByDaysAgo(val) { function filterByDaysAgo(val) {
if (!val) val = DEFAULTDAYS; if (!val) val = DEFAULTDAYS;
@ -206,6 +200,12 @@ function filterByDaysAgo(val) {
arrayData.store.userParams.daysAgo = daysAgo.value; arrayData.store.userParams.daysAgo = daysAgo.value;
table.value.reload(); table.value.reload();
} }
async function preAccount() {
await axios.post('Entries/preAccount', {
ids: selectedRows.value.map((row) => row.id),
});
}
</script> </script>
<template> <template>
<FetchData <FetchData
@ -243,8 +243,10 @@ function filterByDaysAgo(val) {
:url :url
:label="t('entry.control.search')" :label="t('entry.control.search')"
:info="t('entry.control.searchInfo')" :info="t('entry.control.searchInfo')"
:search-remove-params="false"
/> />
<VnTable <VnTable
v-model:selected="selectedRows"
:data-key :data-key
:columns :columns
:search-url="dataKey" :search-url="dataKey"
@ -255,8 +257,19 @@ function filterByDaysAgo(val) {
:order="['landed DESC']" :order="['landed DESC']"
:right-search="false" :right-search="false"
:user-params="{ daysAgo }" :user-params="{ daysAgo }"
:row-click="false"
:table="{ selection: 'multiple' }"
> >
<template #top-left> <template #top-left>
<QBtn
icon="account_balance"
color="primary"
class="q-mr-sm"
:disable="!selectedRows.length"
@click="preAccount"
>
<QTooltip>{{ t('entry.control.preAccount') }}</QTooltip>
</QBtn>
<VnInputNumber <VnInputNumber
v-model="daysAgo" v-model="daysAgo"
:label="$t('globals.daysAgo')" :label="$t('globals.daysAgo')"

View File

@ -139,6 +139,7 @@ entry:
daysAgo: Max 365 days daysAgo: Max 365 days
search: Search search: Search
searchInfo: You can search by supplier name or nickname searchInfo: You can search by supplier name or nickname
preAccount: Pre-account
entryFilter: entryFilter:
params: params:
isExcludedFromAvailable: Excluded from available isExcludedFromAvailable: Excluded from available

View File

@ -89,6 +89,7 @@ entry:
daysAgo: Máximo 365 días daysAgo: Máximo 365 días
search: Buscar search: Buscar
searchInfo: Puedes buscar por nombre o alias de proveedor searchInfo: Puedes buscar por nombre o alias de proveedor
preAccount: Precontabilizar
params: params:
entryFk: Entrada entryFk: Entrada
observationTypeFk: Tipo de observación observationTypeFk: Tipo de observación