#8388 fixInvoiceIn #1321

Merged
jorgep merged 18 commits from 8388-fixInvoiceIn into dev 2025-02-07 13:51:47 +00:00
2 changed files with 9 additions and 5 deletions
Showing only changes of commit 66665ba5dd - Show all commits

View File

@ -213,9 +213,12 @@ function filter(val, options) {
} }
function matchesSearch(val, search) { function matchesSearch(val, search) {
return /^\d+$/.test(search) ? val.startsWith(search) : val.includes(search); return isDigit(search) ? val.startsWith(search) : val.includes(search);
} }
function isDigit(val) {
return /^\d+$/.test(val);
}
async function fetchFilter(val) { async function fetchFilter(val) {
if (!$props.url) return; if (!$props.url) return;
@ -284,7 +287,9 @@ function nullishToTrue(value) {
return value ?? true; return value ?? true;
} }
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); function getVal(val) {
return $props.useLike ? { like: isDigit(val) ? `${val}%` : `%${val}%` } : val;
}
async function onScroll({ to, direction, from, index }) { async function onScroll({ to, direction, from, index }) {
const lastIndex = myOptions.value.length - 1; const lastIndex = myOptions.value.length - 1;

View File

@ -1,9 +1,7 @@
<script setup> <script setup>
import { computed } from 'vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
const model = defineModel({ type: [String, Number, Object] }); const model = defineModel({ type: [String, Number, Object] });
const url = 'Suppliers';
</script> </script>
<template> <template>
@ -11,10 +9,11 @@ const url = 'Suppliers';
:label="$t('globals.supplier')" :label="$t('globals.supplier')"
v-bind="$attrs" v-bind="$attrs"
v-model="model" v-model="model"
:url="url" url="Suppliers"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:fields="['id', 'name', 'nickname', 'nif']" :fields="['id', 'name', 'nickname', 'nif']"
:filter-options="['id', 'name', 'nickname', 'nif']"
sort-by="name ASC" sort-by="name ASC"
> >
<template #option="scope"> <template #option="scope">