#6317 create vnCurrency #181

Merged
jorgep merged 16 commits from 6317-createVnCurrency into dev 2024-03-01 07:39:06 +00:00
4 changed files with 8 additions and 13 deletions
Showing only changes of commit c6e9ae2c5f - Show all commits

View File

@ -2,7 +2,6 @@
import { computed } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useCapitalize } from 'src/composables/useCapitalize'; import { useCapitalize } from 'src/composables/useCapitalize';
import { useValidNumber } from 'src/composables/useValidNumber';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({ const props = defineProps({
@ -19,15 +18,16 @@ const amount = computed({
return props.modelValue; return props.modelValue;
}, },
set(val) { set(val) {
emit('update:modelValue', val.replaceAll(',', '.')); emit('update:modelValue', val);
}, },
}); });
</script> </script>
<template> <template>
<VnInput <VnInput
v-model="amount" v-model="amount"
type="number"
step="any"
:label="useCapitalize(t('amount'))" :label="useCapitalize(t('amount'))"
:rules="[(val) => useValidNumber(val) || !val]"
is-outlined is-outlined
> >
<template #prepend v-if="icon"> <template #prepend v-if="icon">
@ -35,11 +35,6 @@ const amount = computed({
</template> </template>
</VnInput> </VnInput>
</template> </template>
<style lang="scss" scoped>
.q-input {
max-height: 44px;
}
</style>
<i18n> <i18n>
es: es:
amount: importe amount: importe

View File

@ -1,3 +0,0 @@
export function useValidNumber(value) {
return /^(\d|\d+(\.)?\d+)$/.test(value);
}

View File

@ -8,6 +8,7 @@ import { useArrayData } from 'src/composables/useArrayData';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -158,9 +159,9 @@ async function insert() {
</template> </template>
<template #body-cell-amount="{ row }"> <template #body-cell-amount="{ row }">
<QTd> <QTd>
<QInput <VnCurrency
v-model="row.amount" v-model="row.amount"
jorgep marked this conversation as resolved
Review

Aci si que el has gastat

Aci si que el has gastat
type="number" :is-outlined="false"
clearable clearable
clear-icon="close" clear-icon="close"
/> />

View File

@ -5,10 +5,12 @@ describe('InvoiceInList', () => {
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content'; ':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)'; const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header'; const summaryHeaders = '.summaryBody .header';
const screen = '.q-page-container > .q-drawer-container > .fullscreen';
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/list`); cy.visit(`/#/invoice-in/list`);
cy.get(screen).click();
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {