++ If press DELETE or BACKSPACE and is blank description, delete the Todos.

- fix: if offline, doesn't save to cache??  if I refresh page, the data disappear
- ++ field to the percent progress
- fix: Refreshing 2 times the array todos.. because there is a filter
This commit is contained in:
Paolo Arena
2019-02-12 19:09:43 +01:00
parent a024b78e95
commit 259e2dc4e2
17 changed files with 252 additions and 188 deletions

View File

@@ -43,6 +43,7 @@ export default class Todo extends Vue {
itemDragEnd: any = null
selrowid: number = 0
polling = null
mytypetransgroup: string = 'crossfade'
fieldtochange: String [] = ['descr', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'id_next', 'pos', 'enableExpiring', 'progress']
@@ -65,7 +66,10 @@ export default class Todo extends Vue {
@Watch('$route.params.category') changecat() {
// console.log('changecat')
this.load()
this.mytypetransgroup = 'nessuno'
this.updatetable().then(() => {
this.mytypetransgroup = 'crossfade'
})
}
get todos_changed() {
@@ -82,7 +86,7 @@ export default class Todo extends Vue {
// this.$q.notify('Changed...')
// console.log('Todos.state.todos_changed CHANGED!', value, oldValue)
console.log('Todos.state.todos_changed CHANGED!', value, oldValue)
this.updatetable(true)
}
@@ -600,12 +604,16 @@ export default class Todo extends Vue {
}
async updatetable(refresh: boolean = false) {
// console.log('updatetable')
console.log('updatetable')
this.prevRecords = [...this.todos_arr]
return await Todos.actions.getTodosByCategory(this.getCategory())
.then(arrtemp => {
.then(arrris => {
this.todos_arr = []
let arrtemp = [...arrris]
arrtemp = _.orderBy(arrtemp, ['completed', 'priority', 'pos'], ['asc', 'desc', 'asc'])
@@ -620,6 +628,8 @@ export default class Todo extends Vue {
this.todos_arr = [...arrtemp] // make copy
console.log('AGGIORNA todos_arr')
})
}

View File

@@ -12,7 +12,7 @@
<div class="drag">
<draggable v-model="todos_arr" :options="{draggable:'.myitemdrag'}"
@start="onStart" @end="onEnd" class="dragArea">
<transition-group>
<transition-group :name="mytypetransgroup" >
<div :id="getmyid(mytodo._id)" :key="mytodo._id" v-for="mytodo in todos_arr" class="myitemdrag">
<div v-if="(prior !== mytodo.priority) && !mytodo.completed" :class="getTitlePriority(mytodo.priority)">