|
@@ -1,7 +1,17 @@
|
|
|
<template>
|
|
<template>
|
|
|
<main class="d-flex align-baseline">
|
|
<main class="d-flex align-baseline">
|
|
|
|
|
|
|
|
- <UiInputDatePicker class="time-range" v-if="showRange" label="period_choose" :data="[]" :range="true"/>
|
|
|
|
|
|
|
+ <div v-if="show" class="d-flex align-baseline">
|
|
|
|
|
+ <span class="mr-2 ot_dark_grey--text font-weight-bold">{{$t('period_choose')}}</span>
|
|
|
|
|
+ <UiInputDatePicker
|
|
|
|
|
+ class="time-range"
|
|
|
|
|
+ label="date_choose"
|
|
|
|
|
+ :data="datesRange"
|
|
|
|
|
+ :range="true"
|
|
|
|
|
+ :dense="true"
|
|
|
|
|
+ :singleLine="true"
|
|
|
|
|
+ v-on:update="updateDateTimeRange"/>
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
<v-tooltip bottom>
|
|
<v-tooltip bottom>
|
|
|
<template v-slot:activator="{ on, attrs }">
|
|
<template v-slot:activator="{ on, attrs }">
|
|
@@ -10,7 +20,7 @@
|
|
|
max-height="25"
|
|
max-height="25"
|
|
|
v-bind="attrs"
|
|
v-bind="attrs"
|
|
|
v-on="on"
|
|
v-on="on"
|
|
|
- @click="showRange=!showRange"
|
|
|
|
|
|
|
+ @click="show=!show"
|
|
|
elevation="0"
|
|
elevation="0"
|
|
|
max-width="10px"
|
|
max-width="10px"
|
|
|
min-width="10px"
|
|
min-width="10px"
|
|
@@ -25,14 +35,46 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
- import {defineComponent, ref} from '@nuxtjs/composition-api'
|
|
|
|
|
|
|
+ import {defineComponent, onUnmounted, ref, useContext, watch, computed, ComputedRef} from '@nuxtjs/composition-api'
|
|
|
|
|
+ import {$useMyProfileUpdater} from "~/use/updater/useMyProfileUpdater";
|
|
|
|
|
+ import {$useDirtyForm} from "~/use/form/useDirtyForm";
|
|
|
|
|
+ import {Ref, WatchStopHandle} from "@vue/composition-api";
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
- setup() {
|
|
|
|
|
- const showRange = ref(false)
|
|
|
|
|
|
|
+ setup(_, {emit}) {
|
|
|
|
|
+ const {store, $dataPersister} = useContext()
|
|
|
|
|
+ const {markFormAsNotDirty} = $useDirtyForm(store)
|
|
|
|
|
+ const {updateMyProfile, setHistoricalRange, historical} = $useMyProfileUpdater(store, $dataPersister)
|
|
|
|
|
+
|
|
|
|
|
+ const datesRange:ComputedRef<Array<string>> = computed(()=>{
|
|
|
|
|
+ return [historical.value.dateStart, historical.value.dateEnd]
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const show:Ref<boolean> = ref(false)
|
|
|
|
|
+ if(historical.value.dateStart || historical.value.dateEnd){
|
|
|
|
|
+ show.value = true
|
|
|
|
|
+ emit('showDateTimeRange', true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const unwatch:WatchStopHandle = watch(show, (newValue) => {
|
|
|
|
|
+ emit('showDateTimeRange', newValue)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ onUnmounted(()=>{
|
|
|
|
|
+ unwatch()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const updateDateTimeRange = async (dates:Array<string>):Promise<any> =>{
|
|
|
|
|
+ setHistoricalRange(dates)
|
|
|
|
|
+ markFormAsNotDirty()
|
|
|
|
|
+ await updateMyProfile()
|
|
|
|
|
+ window.location.reload()
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
- showRange
|
|
|
|
|
|
|
+ show,
|
|
|
|
|
+ datesRange,
|
|
|
|
|
+ updateDateTimeRange
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -54,11 +96,11 @@
|
|
|
margin-top: 0 !important;
|
|
margin-top: 0 !important;
|
|
|
}
|
|
}
|
|
|
.v-icon{
|
|
.v-icon{
|
|
|
- font-size: 16px;
|
|
|
|
|
|
|
+ font-size: 20px;
|
|
|
}
|
|
}
|
|
|
input{
|
|
input{
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
|
- width: 200px !important;
|
|
|
|
|
|
|
+ width: 400px !important;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|