0
0
Fork 0

Merge branch 'dev' into 7346-invoiceOutMultilple

This commit is contained in:
Javi Gallego 2024-08-19 10:27:48 +02:00
commit ca3406fbc0
5 changed files with 18 additions and 9 deletions

View File

@ -87,6 +87,10 @@ const $props = defineProps({
type: Boolean,
default: false,
},
defaultTrim: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['onFetch', 'onDataSaved']);
const modelValue = computed(
@ -195,6 +199,7 @@ async function save() {
isLoading.value = true;
try {
formData.value = trimData(formData.value);
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
const method = $props.urlCreate ? 'post' : 'patch';
const url =
@ -253,6 +258,14 @@ function updateAndEmit(evt, val, res) {
emit(evt, state.get(modelValue), res);
}
function trimData(data) {
if (!$props.defaultTrim) return data;
for (const key in data) {
if (typeof data[key] == 'string') data[key] = data[key].trim();
}
return data;
}
defineExpose({
save,
isLoading,

View File

@ -315,7 +315,7 @@ defineExpose({
col?.columnFilter !== false &&
col?.name !== 'tableActions'
"
v-model="orders[col.name]"
v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
@ -409,7 +409,7 @@ defineExpose({
style="height: 30px"
>
<VnTableOrder
v-model="orders[col.name]"
v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name"
:label="col?.label"
:data-key="$attrs['data-key']"

View File

@ -50,7 +50,7 @@ const columns = computed(() => [
align: 'left',
label: t('claim.attendedBy'),
name: 'attendedBy',
cardVisible: true,
orderBy: 'workerFk',
columnFilter: {
component: 'select',
attrs: {
@ -63,6 +63,7 @@ const columns = computed(() => [
optionFilter: 'firstName',
},
},
cardVisible: true,
},
{
align: 'left',

View File

@ -1,6 +1,6 @@
<script setup>
import { ref } from 'vue';
import { Notify, useQuasar } from 'quasar';
import { Notify } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
@ -11,7 +11,6 @@ import VnLogo from 'components/ui/VnLogo.vue';
import VnInput from 'src/components/common/VnInput.vue';
import axios from 'axios';
const quasar = useQuasar();
const session = useSession();
const loginCache = useLogin();
const router = useRouter();

View File

@ -44,10 +44,6 @@ describe('Login', () => {
it('should not set the token into session if any error occurred', async () => {
vi.spyOn(axios, 'post').mockReturnValue({ data: null });
vi.spyOn(vm.quasar, 'notify');
await vm.onSubmit();
expect(vm.quasar.notify).not.toHaveBeenCalled();
});
});