select 7-10 days

remotes/origin/hasaccess
Sanasol 8 years ago
parent dbdd1852bd
commit ef4b57bb4a
  1. 41
      web/src/components/CourseRedactor.vue
  2. 2
      web/src/components/inputs/LilSelect.vue

@ -115,10 +115,10 @@
<button disabled class="field__append">руб.</button>
</div>
</div>
<!--<label v-if="!live" class="info__switch switch switch_lg">-->
<!--<input type="checkbox" class="switch__input" v-model="course.is_featured">-->
<!--<span class="switch__content">Выделить</span>-->
<!--</label>-->
<label v-if="!live && me.role === ROLE_ADMIN" class="info__switch switch switch_lg">
<input type="checkbox" class="switch__input" v-model="course.is_featured">
<span class="switch__content">Выделить</span>
</label>
</div>
<div v-if="!live" class="info__fieldset">
<div class="info__field field">
@ -850,15 +850,34 @@
schedule.then((response) => {
if (response.data) {
this.scheduleOptions = _.orderBy(response.data.results.map((schedule) => {
var now = new Date();
now.setDate(now.getDate() + (schedule.weekday + (7 - now.getDay())) % 7);
return {
title: `${schedule.title} (${this.weekdays[schedule.weekday]}, ${moment(now).format("D MMM")})`,
let schedule = [];
response.data.results.forEach((item) => {
schedule[item.weekday] = item.title;
});
console.log('schedule', schedule);
let options = [];
for(let i=-7;i<=10;i++) {
let now = new Date();
now.setDate(now.getDate() + i);
let weekday = now.getDay() || 7;
console.log('data', i, now.getDay(), weekday, now, moment(now).format("D MMM"));
options.push({
title: `${schedule[weekday]} (${this.weekdays[weekday]}, ${moment(now).format("D MMM")})`,
value: moment(now).format('YYYY-MM-DD')
}
}), (item)=>{return moment(item.value)});
});
}
console.log('options',options);
this.scheduleOptions = _.orderBy(options, (item)=>{return moment(item.value)});
}
this.updateCategory();
});

@ -4,7 +4,7 @@
{{ selectedTitle }}
</div>
<div class="select__drop">
<div class="select__option" v-for="option in options" @click.stop.prevent="selectOption(option)">
<div v-for="option in options" :class="{ select__option: true, active: value && option.value == value.value }" @click.stop.prevent="selectOption(option)">
<div class="select__title">{{ option.title }}</div>
</div>
</div>

Loading…
Cancel
Save