Commit efc804e4 authored by GuiΩ's avatar GuiΩ
Browse files

datepicker for seance

parent 7183e533
......@@ -43,7 +43,13 @@ Events:
<span v-if="!datePickerVisible" class="seance-date" @click="showDatePicker">
{{ seanceDate }}
</span>
<input v-if="datePickerVisible" v-model="date" size="10" @keyup="dateSave">
<datepicker
v-if="datePickerVisible"
ref="datePicker"
v-model="date"
:language="fr"
@input="dateSave">
</datepicker>
<br>
<template v-for="model of $store.state.latex.models">
<template v-if="model.type === 'SE'">
......@@ -58,17 +64,21 @@ Events:
<script>
import FeuilleListFeuilleSeanceSlot from "./FeuilleListFeuilleSeanceSlot";
import Datepicker from 'vuejs-datepicker';
import {fr} from 'vuejs-datepicker/dist/locale'
export default {
name: "FeuilleListFeuilleSeance",
components: {
FeuilleListFeuilleSeanceSlot,
Datepicker
},
props: {
seance_id: Number, // the current seance
},
data: function () {
return {
fr: fr,
date: new Date(), // the date of the seance
datePickerVisible: false, // is the date currently editing ?
scoreEditing: false, // are the scores currently editing ?
......@@ -111,10 +121,11 @@ export default {
},
showDatePicker() {
if (this.seance.date)
this.date = new Date(this.seance.date).toLocaleDateString('fr-FR');
this.date = new Date(this.seance.date);
else
this.date = new Date(Date.now()).toLocaleDateString('fr-FR');
this.date = new Date(Date.now());
this.datePickerVisible = true;
this.$nextTick(() => this.$refs.datePicker.showCalendar());
},
/**
* initiates the edition of the scores
......@@ -138,11 +149,8 @@ export default {
/**
* Save the date of the seance on the Enter press event
*/
dateSave(keyEvent) {
if (keyEvent.keyCode !== 13)
return;
var parts = this.date.split('/');
var newDate = parts[2] + '-' + (parts[1]) + '-' + parts[0];
dateSave(date) {
var newDate = new Date(date).toISOString().substr(0,10);
this.$store.dispatch('feuilles/patchSeance', {seance_id: this.seance_id, newValues: {date: newDate}})
.then(() => this.datePickerVisible = false)
.catch(error => console.log(error.response.data))
......
......@@ -22,11 +22,11 @@ let config = {
} else {
config.devServer
.public('http://0.0.0.0:8080')
// .public('http://0.0.0.0:8080')
.host('0.0.0.0')
.port(8080)
.hotOnly(true)
.watchOptions({poll: 1000})
// .hotOnly(true)
// .watchOptions({poll: 1000})
.https(false)
.headers({"Access-Control-Allow-Origin": ["\*"]})
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment