feat: refs #7936 add autocomplete on tab fn
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
f61509f376
commit
8a1cda6914
|
@ -119,7 +119,17 @@ function taxRate(invoiceInTax) {
|
|||
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
||||
}
|
||||
|
||||
const formatLabel = (row, prop) => `${row.id}: ${row[prop]}`;
|
||||
function autocompleteExpense(evt, row, col) {
|
||||
const val = evt.target.value;
|
||||
if (!val) return;
|
||||
|
||||
const param = isNaN(val) ? row[col.model] : val;
|
||||
const lookup = expenses.value.find(
|
||||
({ id }) => id == useAccountShortToStandard(param)
|
||||
);
|
||||
|
||||
if (lookup) row[col.model] = lookup;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -163,11 +173,7 @@ const formatLabel = (row, prop) => `${row.id}: ${row[prop]}`;
|
|||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'name']"
|
||||
:tooltip="t('Create a new expense')"
|
||||
@keydown.tab="
|
||||
row[col.model] = useAccountShortToStandard(
|
||||
$event.target.value
|
||||
)
|
||||
"
|
||||
@keydown.tab="autocompleteExpense($event, row, col)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
Loading…
Reference in New Issue