feat: refs #8388 add setCursor
This commit is contained in:
parent
42b86f05ce
commit
6a7fcd1afe
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, nextTick } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
@ -97,6 +97,20 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
const taxableBaseTotal = computed(() => {
|
||||
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
|
||||
});
|
||||
|
||||
const taxRateTotal = computed(() => {
|
||||
return getTotal(invoiceInFormRef.value.formData, null, {
|
||||
cb: taxRate,
|
||||
});
|
||||
});
|
||||
|
||||
const combinedTotal = computed(() => {
|
||||
return +taxableBaseTotal.value + +taxRateTotal.value;
|
||||
});
|
||||
|
||||
const filter = {
|
||||
fields: [
|
||||
'id',
|
||||
|
@ -137,19 +151,14 @@ function autocompleteExpense(evt, row, col) {
|
|||
expenseRef.value.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
||||
}
|
||||
|
||||
const taxableBaseTotal = computed(() => {
|
||||
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
|
||||
});
|
||||
|
||||
const taxRateTotal = computed(() => {
|
||||
return getTotal(invoiceInFormRef.value.formData, null, {
|
||||
cb: taxRate,
|
||||
function setCursor(ref) {
|
||||
nextTick(() => {
|
||||
const select = ref.vnSelectDialogRef
|
||||
? ref.vnSelectDialogRef.vnSelectRef
|
||||
: ref.vnSelectRef;
|
||||
select.$el.querySelector('input').setSelectionRange(0, 0);
|
||||
});
|
||||
});
|
||||
|
||||
const combinedTotal = computed(() => {
|
||||
return +taxableBaseTotal.value + +taxRateTotal.value;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -195,6 +204,7 @@ const combinedTotal = computed(() => {
|
|||
:filter-options="['id', 'name']"
|
||||
:tooltip="t('Create a new expense')"
|
||||
@keydown.tab="autocompleteExpense($event, row, col)"
|
||||
@update:model-value="setCursor($refs.expenseRef)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -221,12 +231,14 @@ const combinedTotal = computed(() => {
|
|||
<template #body-cell-sageiva="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
ref="sageivaRef"
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'vat']"
|
||||
data-cy="vat-sageiva"
|
||||
@update:model-value="setCursor($refs.sageivaRef)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -244,11 +256,13 @@ const combinedTotal = computed(() => {
|
|||
<template #body-cell-sagetransaction="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
ref="sagetransactionRef"
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'transaction']"
|
||||
@update:model-value="setCursor($refs.sagetransactionRef)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
Loading…
Reference in New Issue