Feat: write data on edit
This commit is contained in:
parent
899fd95dbd
commit
5020479b0a
@ -74,10 +74,14 @@ export default {
|
|||||||
...mapActions('travail', {
|
...mapActions('travail', {
|
||||||
'createMonth': 'createMonth',
|
'createMonth': 'createMonth',
|
||||||
}),
|
}),
|
||||||
|
...mapActions('config', {
|
||||||
|
'writeData': 'writeData',
|
||||||
|
}),
|
||||||
save: function () {
|
save: function () {
|
||||||
console.log("save")
|
console.log("save")
|
||||||
console.log(this.monthCopy)
|
console.log(this.monthCopy)
|
||||||
this.createMonth({date: this.monthDate, month: this.monthCopy})
|
this.createMonth({date: this.monthDate, month: this.monthCopy})
|
||||||
|
this.writeData()
|
||||||
},
|
},
|
||||||
cancel: function () {
|
cancel: function () {
|
||||||
this.monthCopy = this.theEmptyMonth
|
this.monthCopy = this.theEmptyMonth
|
||||||
|
@ -71,13 +71,14 @@ export default {
|
|||||||
'updateMonth': 'updateMonth',
|
'updateMonth': 'updateMonth',
|
||||||
}),
|
}),
|
||||||
...mapActions('config', {
|
...mapActions('config', {
|
||||||
'loadData': 'loadData',
|
'writeData': 'writeData',
|
||||||
}),
|
}),
|
||||||
toggleEdit: function () {
|
toggleEdit: function () {
|
||||||
this.editing = !this.editing
|
this.editing = !this.editing
|
||||||
},
|
},
|
||||||
save: function () {
|
save: function () {
|
||||||
this.updateMonth({date: this.TheDate, month: {...this.monthCopy}})
|
this.updateMonth({date: this.TheDate, month: {...this.monthCopy}})
|
||||||
|
this.writeData()
|
||||||
this.toggleEdit()
|
this.toggleEdit()
|
||||||
},
|
},
|
||||||
cancel: function () {
|
cancel: function () {
|
||||||
|
@ -71,6 +71,8 @@ export default {
|
|||||||
retrocessionMean: "retrocessionMean",
|
retrocessionMean: "retrocessionMean",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -183,11 +183,11 @@ const travail = {
|
|||||||
},
|
},
|
||||||
loadMonths (context) {
|
loadMonths (context) {
|
||||||
// import all months from storage
|
// import all months from storage
|
||||||
|
|
||||||
readFile(context.rootGetters["config/dataFilePath"], (err, data) => {
|
readFile(context.rootGetters["config/dataFilePath"], (err, data) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
const months = Papa.parse(data.toString(), {header: true, dynamicTyping:true})
|
const months = Papa.parse(data.toString(), {header: true, dynamicTyping:true, skipEmptyLines:true})
|
||||||
.data.reduce(
|
.data
|
||||||
|
.reduce(
|
||||||
(acc, el) => {
|
(acc, el) => {
|
||||||
acc[el.date] = el;
|
acc[el.date] = el;
|
||||||
return acc
|
return acc
|
||||||
|
Loading…
Reference in New Issue
Block a user