forked from verdnatura/salix-front
refs #7155 scopeDays
This commit is contained in:
parent
25b7569791
commit
8be1833f9e
|
@ -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 } });
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue