This commit is contained in:
parent
a5064e2e2f
commit
e49a9f4165
|
@ -0,0 +1,34 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import { useFirstUpper } from 'src/composables/useFirstUpper';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const amount = ref();
|
||||||
|
|
||||||
|
const isValidNumber = (value) => /^(\d|\d+(\.)?\d+)$/.test(value);
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnInput
|
||||||
|
:label="useFirstUpper(t('amount'))"
|
||||||
|
v-model="amount"
|
||||||
|
is-outlined
|
||||||
|
@update:model-value="
|
||||||
|
(value) => {
|
||||||
|
if (value.includes(',')) amount.value = amount.replace(',', '.');
|
||||||
|
}
|
||||||
|
"
|
||||||
|
:rules="[(val) => isValidNumber(val) || !val || 'Please type a number']"
|
||||||
|
lazy-rules
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<QIcon name="euro" size="sm" />
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
amount: importe
|
||||||
|
</i18n>
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
import VnCurrency from 'src/components/common/VnCurrency.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -51,28 +51,9 @@ function isValidNumber(value) {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnCurrency v-model="params.amount" />
|
||||||
:label="t('Amount')"
|
|
||||||
v-model="params.amount"
|
|
||||||
is-outlined
|
|
||||||
@update:model-value="
|
|
||||||
(value) => {
|
|
||||||
if (value.includes(','))
|
|
||||||
params.amount = params.amount.replace(',', '.');
|
|
||||||
}
|
|
||||||
"
|
|
||||||
:rules="[
|
|
||||||
(val) => isValidNumber(val) || !val || 'Please type a number',
|
|
||||||
]"
|
|
||||||
lazy-rules
|
|
||||||
>
|
|
||||||
<template #prepend>
|
|
||||||
<QIcon name="euro" size="sm" />
|
|
||||||
</template>
|
|
||||||
</VnInput>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate v-model="params.from" :label="t('From')" is-outlined />
|
<VnInputDate v-model="params.from" :label="t('From')" is-outlined />
|
||||||
|
|
Loading…
Reference in New Issue