0
0
Fork 0

refs #7155 scopeDays

This commit is contained in:
Carlos Satorres 2024-09-13 08:49:36 +02:00
parent 25b7569791
commit 8be1833f9e
1 changed files with 13 additions and 0 deletions

View File

@ -11,6 +11,7 @@ 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';
const { viewSummary } = useSummaryDialog();
const router = useRouter();
const { t } = useI18n();
@ -29,6 +30,18 @@ const cloneTravel = (travelData) => {
redirectToCreateView(stringifiedTravelData);
};
const handleScopeDays = (params, days, callback) => {
const [from, to] = dateRange(Date.vnNew());
if (!days) {
Object.assign(params, { from, to, scopeDays: 1 });
} else {
params.from = from;
to.setDate(to.getDate() + days);
params.to = to;
}
if (callback) callback();
};
const redirectToCreateView = (queryParams) => {
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
};