chore: refs #6273 Add default pay method for internal
gitea/salix-front/pipeline/pr-dev This commit looks good Details

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