diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index a0f6bf479..22ef1622c 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -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, diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index d6b35d4da..6c77d44df 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -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" > [ 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', diff --git a/src/pages/Login/LoginMain.vue b/src/pages/Login/LoginMain.vue index c17201969..44b868ebd 100644 --- a/src/pages/Login/LoginMain.vue +++ b/src/pages/Login/LoginMain.vue @@ -1,6 +1,6 @@