diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 55028080c..a3c439cc7 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -305,6 +305,7 @@ defineExpose({ redirect: redirectFn, selected, CrudModelRef, + params, }); function handleOnDataSaved(_) { diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index c7ad908f9..a0976e92c 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -11,6 +11,9 @@ import TravelSummary from './Card/TravelSummary.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue'; import { toDate } from 'src/filters'; import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js'; +import { dateRange } from 'src/filters'; +import VnInputNumber from 'src/components/common/VnInputNumber.vue'; + const { viewSummary } = useSummaryDialog(); const router = useRouter(); const { t } = useI18n(); @@ -24,11 +27,27 @@ const $props = defineProps({ }, }); const entityId = computed(() => $props.id || route.params.id); + +onMounted(async () => { + stateStore.rightDrawer = true; + handleScopeDays(); +}); + const cloneTravel = (travelData) => { const stringifiedTravelData = JSON.stringify(travelData); 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) => { router.push({ name: 'TravelCreate', query: { travelData: queryParams } }); }; @@ -37,10 +56,6 @@ const redirectCreateEntryView = (travelData) => { router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } }); }; -onMounted(async () => { - stateStore.rightDrawer = true; -}); - const columns = computed(() => [ { align: 'left', @@ -241,6 +256,17 @@ const columns = computed(() => [ :class="{ 'is-active': row.isReceived }" /> +