refs #6842 isFreelance #348

Merged
carlossa merged 4 commits from 6842-errorCalendar into dev 2024-05-08 10:21:28 +00:00
2 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, watch } from 'vue';
import { nextTick, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
carlossa marked this conversation as resolved
Review

Habéis duplicado esta linea @jsegarra

Habéis duplicado esta linea @jsegarra
@ -10,10 +10,13 @@ import WorkerCalendarItem from 'pages/Worker/Card/WorkerCalendarItem.vue';
import { useStateStore } from 'stores/useStateStore';
import axios from 'axios';
import { useRouter } from 'vue-router';
carlossa marked this conversation as resolved
Review

Habéis duplicado esta linea @jsegarra

Habéis duplicado esta linea @jsegarra
const router = useRouter();
carlossa marked this conversation as resolved
Review

Habéis duplicado esta linea @jsegarra

Habéis duplicado esta linea @jsegarra
Review

mmm, creo que no.
Hemos añadido useRouter y lo que habia es useRoute
useRouter!==useRoute

mmm, creo que no. Hemos añadido useRouter y lo que habia es useRoute useRouter!==useRoute
const stateStore = useStateStore();
const route = useRoute();
carlossa marked this conversation as resolved
Review

Habéis duplicado esta linea @jsegarra

Habéis duplicado esta linea @jsegarra
Review

mmm, creo que no.
Hemos añadido useRouter y lo que habia es useRoute
useRouter!==useRoute

mmm, creo que no. Hemos añadido useRouter y lo que habia es useRoute useRouter!==useRoute
const { t } = useI18n();
const workerIsFreelance = ref();
const WorkerFreelanceRef = ref();
const workerCalendarFilterRef = ref(null);
const workerCalendarRef = ref(null);
const absenceType = ref(null);
@ -128,6 +131,7 @@ const refreshData = () => {
updateYearHolidays();
updateContractHolidays();
getAbsences();
WorkerFreelanceRef.value.fetch();
};
const onDeletedEvent = (timestamp) => {
@ -136,12 +140,21 @@ const onDeletedEvent = (timestamp) => {
if (festiveEventsMap.value[timestamp])
eventsMap.value[timestamp] = festiveEventsMap.value[timestamp];
};
const activeContractRef = ref(null);
watch(
() => router.currentRoute.value.params.id,
async () => {
await nextTick();
await activeContractRef.value.fetch();
}
);
watch([year, businessFk], () => refreshData());
</script>
<template>
<FetchData
ref="activeContractRef"
:url="`Workers/${route.params.id}/activeContract`"
@on-fetch="onFetchActiveContract"
auto-load
@ -151,6 +164,12 @@ watch([year, businessFk], () => refreshData());
@on-fetch="(data) => (isSubordinate = data)"
auto-load
/>
<FetchData
:url="`Workers/${route.params.id}`"
@on-fetch="(data) => (workerIsFreelance = data.isFreelance)"
ref="WorkerFreelanceRef"
auto-load
/>
<template v-if="stateStore.isHeaderMounted()">
carlossa marked this conversation as resolved Outdated
Outdated
Review

Si ya haceis la peticion por JS pq la volveis a hacer en vue?

Si ya haceis la peticion por JS pq la volveis a hacer en vue?
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
@ -181,7 +200,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>

View File

@ -56,7 +56,6 @@ const filter = {
};
const sip = ref(null);
watch(
() => [worker.value?.sip?.extension, state.get('extension')],
([newWorkerSip, newStateExtension], [oldWorkerSip, oldStateExtension]) => {