fix: refs #8388 update the right row
This commit is contained in:
parent
6a7fcd1afe
commit
8d0d19d4c7
|
@ -25,7 +25,6 @@ const sageTaxTypes = ref([]);
|
||||||
const sageTransactionTypes = ref([]);
|
const sageTransactionTypes = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const invoiceInFormRef = ref();
|
const invoiceInFormRef = ref();
|
||||||
const expenseRef = ref();
|
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
actionIcon: {
|
actionIcon: {
|
||||||
|
@ -139,7 +138,7 @@ function taxRate(invoiceInTax) {
|
||||||
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function autocompleteExpense(evt, row, col) {
|
function autocompleteExpense(evt, row, col, ref) {
|
||||||
const val = evt.target.value;
|
const val = evt.target.value;
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
|
|
||||||
|
@ -148,7 +147,7 @@ function autocompleteExpense(evt, row, col) {
|
||||||
({ id }) => id == useAccountShortToStandard(param),
|
({ id }) => id == useAccountShortToStandard(param),
|
||||||
);
|
);
|
||||||
|
|
||||||
expenseRef.value.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
ref.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCursor(ref) {
|
function setCursor(ref) {
|
||||||
|
@ -156,7 +155,9 @@ function setCursor(ref) {
|
||||||
const select = ref.vnSelectDialogRef
|
const select = ref.vnSelectDialogRef
|
||||||
? ref.vnSelectDialogRef.vnSelectRef
|
? ref.vnSelectDialogRef.vnSelectRef
|
||||||
: ref.vnSelectRef;
|
: ref.vnSelectRef;
|
||||||
select.$el.querySelector('input').setSelectionRange(0, 0);
|
const input = select.$el.querySelector('input');
|
||||||
|
input.focus();
|
||||||
|
input.setSelectionRange(0, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -196,15 +197,24 @@ function setCursor(ref) {
|
||||||
<template #body-cell-expense="{ row, col }">
|
<template #body-cell-expense="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
ref="expenseRef"
|
:ref="`expenseRef-${row.$index}`"
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
@keydown.tab="autocompleteExpense($event, row, col)"
|
@keydown.tab="
|
||||||
@update:model-value="setCursor($refs.expenseRef)"
|
autocompleteExpense(
|
||||||
|
$event,
|
||||||
|
row,
|
||||||
|
col,
|
||||||
|
$refs[`expenseRef-${row.$index}`],
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:model-value="
|
||||||
|
setCursor($refs[`expenseRef-${row.$index}`])
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -231,14 +241,16 @@ function setCursor(ref) {
|
||||||
<template #body-cell-sageiva="{ row, col }">
|
<template #body-cell-sageiva="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
ref="sageivaRef"
|
:ref="`sageivaRef-${row.$index}`"
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'vat']"
|
:filter-options="['id', 'vat']"
|
||||||
data-cy="vat-sageiva"
|
data-cy="vat-sageiva"
|
||||||
@update:model-value="setCursor($refs.sageivaRef)"
|
@update:model-value="
|
||||||
|
setCursor($refs[`sageivaRef-${row.$index}`])
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -256,13 +268,15 @@ function setCursor(ref) {
|
||||||
<template #body-cell-sagetransaction="{ row, col }">
|
<template #body-cell-sagetransaction="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
ref="sagetransactionRef"
|
:ref="`sagetransactionRef-${row.$index}`"
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'transaction']"
|
:filter-options="['id', 'transaction']"
|
||||||
@update:model-value="setCursor($refs.sagetransactionRef)"
|
@update:model-value="
|
||||||
|
setCursor($refs[`sagetransactionRef-${row.$index}`])
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
Loading…
Reference in New Issue