0
0
Fork 0

Merge branch 'dev' into add_shortcut_add_subSections

This commit is contained in:
Javier Segarra 2024-09-18 12:25:23 +00:00
commit 98411d3c29
2 changed files with 31 additions and 4 deletions

View File

@ -305,6 +305,7 @@ defineExpose({
redirect: redirectFn, redirect: redirectFn,
selected, selected,
CrudModelRef, CrudModelRef,
params,
}); });
function handleOnDataSaved(_) { function handleOnDataSaved(_) {

View File

@ -11,6 +11,9 @@ import TravelSummary from './Card/TravelSummary.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js'; import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
import { dateRange } from 'src/filters';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
@ -24,11 +27,27 @@ const $props = defineProps({
}, },
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
onMounted(async () => {
stateStore.rightDrawer = true;
handleScopeDays();
});
const cloneTravel = (travelData) => { const cloneTravel = (travelData) => {
const stringifiedTravelData = JSON.stringify(travelData); const stringifiedTravelData = JSON.stringify(travelData);
redirectToCreateView(stringifiedTravelData); redirectToCreateView(stringifiedTravelData);
}; };
function handleScopeDays(days = 7) {
days = +days;
tableRef.value.params.scopeDays = days;
const [landedFrom, landedTo] = dateRange(Date.vnNew());
landedTo.setDate(landedTo.getDate() + days);
tableRef.value.params.landedFrom = landedFrom;
tableRef.value.params.landedTo = landedTo;
}
const redirectToCreateView = (queryParams) => { const redirectToCreateView = (queryParams) => {
router.push({ name: 'TravelCreate', query: { travelData: queryParams } }); router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
}; };
@ -37,10 +56,6 @@ const redirectCreateEntryView = (travelData) => {
router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } }); router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } });
}; };
onMounted(async () => {
stateStore.rightDrawer = true;
});
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -241,6 +256,17 @@ const columns = computed(() => [
:class="{ 'is-active': row.isReceived }" :class="{ 'is-active': row.isReceived }"
/> />
</template> </template>
<template #moreFilterPanel="{ params }">
<VnInputNumber
:label="t('params.scopeDays')"
v-model.number="params.scopeDays"
@keyup.enter="(evt) => handleScopeDays(evt.target.value)"
@remove="handleScopeDays()"
class="q-px-xs q-pr-lg"
filled
dense
/>
</template>
</VnTable> </VnTable>
</template> </template>