0
0
Fork 0
This commit is contained in:
Jorge Penadés 2024-05-09 08:48:28 +02:00
commit ac935b9020
4 changed files with 30 additions and 16 deletions

View File

@ -53,10 +53,12 @@ defineExpose({
focus, focus,
}); });
const inputRules = (val) => { const inputRules = [
(val) => {
const { min } = vnInputRef.value.$attrs; const { min } = vnInputRef.value.$attrs;
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min }); if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
}; },
];
</script> </script>
<template> <template>
@ -73,8 +75,9 @@ const inputRules = (val) => {
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
@keyup.enter="onEnterPress()" @keyup.enter="onEnterPress()"
:clearable="false" :clearable="false"
:rules="[inputRules]" :rules="inputRules"
:lazy-rules="true" :lazy-rules="true"
hide-bottom-space
> >
<template v-if="$slots.prepend" #prepend> <template v-if="$slots.prepend" #prepend>
<slot name="prepend" /> <slot name="prepend" />

View File

@ -15,10 +15,3 @@ const stateStore = useStateStore();
<RouterView></RouterView> <RouterView></RouterView>
</QPageContainer> </QPageContainer>
</template> </template>
<style lang="scss">
#searchbar,
.search-panel {
width: 400px;
}
</style>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch } from 'vue'; import { nextTick, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -10,10 +10,13 @@ import WorkerCalendarItem from 'pages/Worker/Card/WorkerCalendarItem.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import axios from 'axios'; import axios from 'axios';
import { useRouter } from 'vue-router';
const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const workerIsFreelance = ref();
const WorkerFreelanceRef = ref();
const workerCalendarFilterRef = ref(null); const workerCalendarFilterRef = ref(null);
const workerCalendarRef = ref(null); const workerCalendarRef = ref(null);
const absenceType = ref(null); const absenceType = ref(null);
@ -128,6 +131,7 @@ const refreshData = () => {
updateYearHolidays(); updateYearHolidays();
updateContractHolidays(); updateContractHolidays();
getAbsences(); getAbsences();
WorkerFreelanceRef.value.fetch();
}; };
const onDeletedEvent = (timestamp) => { const onDeletedEvent = (timestamp) => {
@ -136,12 +140,21 @@ const onDeletedEvent = (timestamp) => {
if (festiveEventsMap.value[timestamp]) if (festiveEventsMap.value[timestamp])
eventsMap.value[timestamp] = 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()); watch([year, businessFk], () => refreshData());
</script> </script>
<template> <template>
<FetchData <FetchData
ref="activeContractRef"
:url="`Workers/${route.params.id}/activeContract`" :url="`Workers/${route.params.id}/activeContract`"
@on-fetch="onFetchActiveContract" @on-fetch="onFetchActiveContract"
auto-load auto-load
@ -151,6 +164,12 @@ watch([year, businessFk], () => refreshData());
@on-fetch="(data) => (isSubordinate = data)" @on-fetch="(data) => (isSubordinate = data)"
auto-load auto-load
/> />
<FetchData
:url="`Workers/${route.params.id}`"
@on-fetch="(data) => (workerIsFreelance = data.isFreelance)"
ref="WorkerFreelanceRef"
auto-load
/>
<template v-if="stateStore.isHeaderMounted()"> <template v-if="stateStore.isHeaderMounted()">
<Teleport to="#actions-append"> <Teleport to="#actions-append">
<div class="row q-gutter-x-sm"> <div class="row q-gutter-x-sm">
@ -181,7 +200,7 @@ watch([year, businessFk], () => refreshData());
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPage class="column items-center"> <QPage class="column items-center">
<QCard v-if="!hasWorkCenter"> <QCard v-if="workerIsFreelance">
<QCardSection class="text-center"> <QCardSection class="text-center">
{{ t('Autonomous worker') }} {{ t('Autonomous worker') }}
</QCardSection> </QCardSection>

View File

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