0
0
Fork 0

refs #6842 isFreelance

This commit is contained in:
Carlos Satorres 2024-05-03 14:49:50 +02:00
parent 7e842f2ce1
commit 710b45f43a
1 changed files with 14 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import axios from 'axios';
const stateStore = useStateStore();
const route = useRoute();
const { t } = useI18n();
const workerIsFreelance = ref();
const workerCalendarFilterRef = ref(null);
const workerCalendarRef = ref(null);
const absenceType = ref(null);
@ -32,6 +32,12 @@ const onFetchActiveContract = (data) => {
hasWorkCenter.value = Boolean(data?.workCenterFk);
};
const isFreelance = async () => {
const { data } = await axios.get(`Workers/${route.params.id}`);
workerIsFreelance.value = data.isFreelance;
};
const addEvent = (day, newEvent, isFestive = false) => {
const timestamp = new Date(day).getTime();
let event = eventsMap.value[timestamp];
@ -128,6 +134,7 @@ const refreshData = () => {
updateYearHolidays();
updateContractHolidays();
getAbsences();
isFreelance();
};
const onDeletedEvent = (timestamp) => {
@ -151,6 +158,11 @@ watch([year, businessFk], () => refreshData());
@on-fetch="(data) => (isSubordinate = data)"
auto-load
/>
<FetchData
:url="`Workers/${route.params.id}`"
@on-fetch="(data) => (workerIsFreelance = data.isFreelance)"
auto-load
/>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
@ -181,7 +193,7 @@ watch([year, businessFk], () => refreshData());
</QScrollArea>
</QDrawer>
<QPage class="column items-center">
<QCard v-if="!hasWorkCenter">
<QCard v-if="workerIsFreelance">
<QCardSection class="text-center">
{{ t('Autonomous worker') }}
</QCardSection>