feat: refs #7936 add useAccountShortToStandard composable
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-12-04 17:40:29 +01:00
parent 2ab6380f97
commit 482505b800
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,4 @@
export function useAccountShortToStandard(val) {
if (!val || !/^\d+(\.\d*)$/.test(val)) return;
return val?.replace('.', '0'.repeat(11 - val.length));
}

View File

@ -12,6 +12,7 @@ import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
import { getExchange } from 'src/composables/getExchange';
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
const { t } = useI18n();
@ -172,6 +173,13 @@ const formatOpt = (row, { model, options }, prop) => {
:option-label="col.optionLabel"
:filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
:hide-selected="false"
:display-value="formatOpt(row, col, 'name')"
@keydown.tab="
row[col.model] = useAccountShortToStandard(
$event.target.value
)
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">