forked from verdnatura/salix-front
Merge branch 'dev' into 7346-invoiceOutMultilple
This commit is contained in:
commit
ca3406fbc0
|
@ -87,6 +87,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
defaultTrim: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
|
@ -195,6 +199,7 @@ async function save() {
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
try {
|
try {
|
||||||
|
formData.value = trimData(formData.value);
|
||||||
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
||||||
const method = $props.urlCreate ? 'post' : 'patch';
|
const method = $props.urlCreate ? 'post' : 'patch';
|
||||||
const url =
|
const url =
|
||||||
|
@ -253,6 +258,14 @@ function updateAndEmit(evt, val, res) {
|
||||||
emit(evt, state.get(modelValue), 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({
|
defineExpose({
|
||||||
save,
|
save,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
|
|
@ -315,7 +315,7 @@ defineExpose({
|
||||||
col?.columnFilter !== false &&
|
col?.columnFilter !== false &&
|
||||||
col?.name !== 'tableActions'
|
col?.name !== 'tableActions'
|
||||||
"
|
"
|
||||||
v-model="orders[col.name]"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
|
@ -409,7 +409,7 @@ defineExpose({
|
||||||
style="height: 30px"
|
style="height: 30px"
|
||||||
>
|
>
|
||||||
<VnTableOrder
|
<VnTableOrder
|
||||||
v-model="orders[col.name]"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:label="col?.label"
|
:label="col?.label"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
|
|
|
@ -50,7 +50,7 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('claim.attendedBy'),
|
label: t('claim.attendedBy'),
|
||||||
name: 'attendedBy',
|
name: 'attendedBy',
|
||||||
cardVisible: true,
|
orderBy: 'workerFk',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -63,6 +63,7 @@ const columns = computed(() => [
|
||||||
optionFilter: 'firstName',
|
optionFilter: 'firstName',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { Notify, useQuasar } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
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 VnInput from 'src/components/common/VnInput.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const loginCache = useLogin();
|
const loginCache = useLogin();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
|
@ -44,10 +44,6 @@ describe('Login', () => {
|
||||||
|
|
||||||
it('should not set the token into session if any error occurred', async () => {
|
it('should not set the token into session if any error occurred', async () => {
|
||||||
vi.spyOn(axios, 'post').mockReturnValue({ data: null });
|
vi.spyOn(axios, 'post').mockReturnValue({ data: null });
|
||||||
vi.spyOn(vm.quasar, 'notify');
|
|
||||||
|
|
||||||
await vm.onSubmit();
|
await vm.onSubmit();
|
||||||
|
|
||||||
expect(vm.quasar.notify).not.toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue