fixes #4: days with groups are highlighted

This commit is contained in:
Davide Alberani 2017-01-16 23:21:37 +01:00
parent 890dad90db
commit 6da63a8c0b
3 changed files with 22 additions and 4 deletions

View file

@ -2,7 +2,7 @@
<div id="main-attendees"> <div id="main-attendees">
<md-layout md-gutter md-row> <md-layout md-gutter md-row>
<md-layout md-column md-flex="20" md-gutter> <md-layout md-column md-flex="20" md-gutter>
<datepicker id="datepicker" :value="date" :inline="true" @selected="getDay"></datepicker> <datepicker id="datepicker" :value="date" :inline="true" :highlighted="highlightedDates" @selected="getDay"></datepicker>
</md-layout> </md-layout>
<md-layout id="panel" md-column> <md-layout id="panel" md-column>
<md-layout md-row> <md-layout md-row>
@ -19,7 +19,7 @@ import Datepicker from 'vuejs-datepicker';
import Group from './Group'; import Group from './Group';
export default { export default {
data () { data() {
return { return {
date: null, // a Date object representing the selected date date: null, // a Date object representing the selected date
day: {}, day: {},
@ -27,6 +27,26 @@ export default {
} }
}, },
computed: {
highlightedDates() {
var ds = this.daysSummary.days || [];
var datesWithGroups = [];
for (var i=0; i < ds.length; i++) {
var [year, month, day] = ds[i].day.split('-');
year = parseInt(year);
month = parseInt(month) - 1;
day = parseInt(day);
if (isNaN(year) || isNaN(month) || isNaN(day)) {
continue;
}
datesWithGroups.push(new Date(year, month, day));
}
return {
dates: datesWithGroups
};
}
},
beforeCreate: function() { beforeCreate: function() {
this.daysUrl = this.$resource('days{/day}'); this.daysUrl = this.$resource('days{/day}');
this.attendeesUrl = this.$resource('attendees{/id}'); this.attendeesUrl = this.$resource('attendees{/id}');

View file

@ -33,7 +33,6 @@ export default {
computed: { computed: {
loggedInUser() { loggedInUser() {
console.log(this.$store.state.loggedInUser);
return this.$store.state.loggedInUser; return this.$store.state.loggedInUser;
} }
}, },

View file

@ -73,7 +73,6 @@ export default {
}, (response) => { }, (response) => {
alert('deleteUser: unable to get resource'); alert('deleteUser: unable to get resource');
}).then((data) => { }).then((data) => {
console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAA');
}); });
} }
} }