0
0
Fork 0

chore: refs #6273 Add default pay method for internal

This commit is contained in:
Jorge Penadés 2024-06-07 12:24:48 +02:00
parent 8b93dbc57d
commit 213ba4ba52
1 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { onBeforeMount, ref } from 'vue'; import { onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { useUserConfig } from 'src/composables/useUserConfig'; import { useUserConfig } from 'src/composables/useUserConfig';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
@ -22,6 +23,7 @@ const payMethodsOptions = ref([]);
const bankEntitiesOptions = ref([]); const bankEntitiesOptions = ref([]);
const postcodesOptions = ref([]); const postcodesOptions = ref([]);
const formData = ref({ isFreelance: false }); const formData = ref({ isFreelance: false });
const defaultPayMethod = ref(0);
function handleLocation(data, location) { function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {}; const { town, code, provinceFk, countryFk } = location ?? {};
@ -34,15 +36,15 @@ function handleLocation(data, location) {
onBeforeMount(async () => { onBeforeMount(async () => {
const userInfo = await useUserConfig().fetch(); const userInfo = await useUserConfig().fetch();
formData.value.companyFk = userInfo.companyFk; formData.value.companyFk = userInfo.companyFk;
const { data } = await axios.get('WorkerConfigs/findOne', {
params: { field: ['payMethodFk'] },
});
defaultPayMethod.value = data.payMethodFk;
formData.value.payMethodFk = defaultPayMethod.value;
}); });
</script> </script>
<template> <template>
<FetchData
url="WorkerConfigs/findOne"
@on-fetch="(data) => (formData.payMethodFk = data.payMethodFk)"
:filter="{ field: ['payMethodFk'] }"
auto-load
/>
<FetchData <FetchData
url="Companies" url="Companies"
@on-fetch="(data) => (companiesOptions = data)" @on-fetch="(data) => (companiesOptions = data)"
@ -70,6 +72,7 @@ onBeforeMount(async () => {
v-model="formData.isFreelance" v-model="formData.isFreelance"
:val="false" :val="false"
:label="`${t('Internal')}`" :label="`${t('Internal')}`"
@update:model-value="formData.payMethodFk = defaultPayMethod"
/> />
<VnRadio <VnRadio
v-model="formData.isFreelance" v-model="formData.isFreelance"