Skip to content

Commit

Permalink
geophystech#313 Минимальная дата в календаре для не авторизованных по…
Browse files Browse the repository at this point in the history
…льзователей.
  • Loading branch information
Arman Badalyan committed Jan 18, 2019
1 parent 01acdb8 commit e8b8634
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/assets/scss/_mixins.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import "mixins/keyframes";
@import "mixins/animation";
@import "mixins/calc";
@import "mixins/_keyframes.scss";
@import "mixins/_animation.scss";
@import "mixins/_calc.scss";
43 changes: 29 additions & 14 deletions src/components/Filters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,31 @@
<b-row no-gutters class="filter-inputs" align-v="center">
<b-col>
<b-input-group prepend="С">
<flat-pickr v-model.trim="filters.datetime_min"
class="form-control datetime-picker"
:config="minDatetimeConfig"
placeholder="Дата"
@input.native="onFiltersChange($event, 'datetime_min')"
:state="modelState('datetime_min')"
:disabled="disabled"/>
<flat-pickr
v-model.trim="filters.datetime_min"
class="form-control datetime-picker"
:config="minDatetimeConfig"
placeholder="Дата"
@input.native="onFiltersChange($event, 'datetime_min')"
:state="modelState('datetime_min')"
:disabled="disabled"
/>
</b-input-group>
</b-col>
</b-row>

<b-row no-gutters class="filter-inputs" align-v="center">
<b-col>
<b-input-group prepend="По">
<flat-pickr v-model.trim="filters.datetime_max"
class="form-control datetime-picker"
:config="maxDatetimeConfig"
placeholder="Дата"
@input.native="onFiltersChange($event, 'datetime_max')"
:state="modelState('datetime_max')"
:disabled="disabled"/>
<flat-pickr
v-model.trim="filters.datetime_max"
class="form-control datetime-picker"
:config="maxDatetimeConfig"
placeholder="Дата"
@input.native="onFiltersChange($event, 'datetime_max')"
:state="modelState('datetime_max')"
:disabled="disabled"
/>
</b-input-group>
</b-col>
</b-row>
Expand Down Expand Up @@ -212,6 +216,8 @@
locale: Russian,
mode: 'single',
time_24hr: true,
maxDate: null,
minDate: null,
wrap: true
},
filters: {
Expand Down Expand Up @@ -241,8 +247,17 @@
this.parseURL()
this.minDatetimeConfig.maxDate = this.$moment.utc().format('YYYY-MM-DD 00:00:00')
this.maxDatetimeConfig.maxDate = this.$moment.utc().format('YYYY-MM-DD 00:00:00')
if (!this.$store.getters.user.authenticated) {
this.minDatetimeConfig.minDate = this.minDatetimeConfig.defaultDate
this.maxDatetimeConfig.minDate = this.minDatetimeConfig.defaultDate
}
if (!this.filters.datetime_min) {
this.filters.datetime_min = this.minDatetimeConfig.defaultDate
this.maxDatetimeConfig.minDate = this.filters.datetime_min
this.updateURL()
}
},
Expand Down

0 comments on commit e8b8634

Please sign in to comment.