From 0225f2753509963782103378facd7417a31a454c Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Tue, 29 Jan 2019 00:48:04 +0100 Subject: [PATCH] - adding Progress % --- quasar.conf.js | 2 + .../todos/SingleTodo/SingleTodo.scss | 37 ++++++++++++++++++- src/components/todos/SingleTodo/SingleTodo.ts | 32 ++++++++++++++++ .../todos/SingleTodo/SingleTodo.vue | 37 +++++++++++++++++-- src/components/todos/todo/todo.ts | 5 ++- src/components/todos/todo/todo.vue | 7 ++-- src/model/Todos.ts | 3 +- src/plugins/vue-idb.js | 2 +- src/store/Modules/rescodes.ts | 19 +++++++++- 9 files changed, 131 insertions(+), 13 deletions(-) diff --git a/quasar.conf.js b/quasar.conf.js index 6a50d08..279e4d2 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -150,6 +150,8 @@ module.exports = function (ctx) { 'QSlideTransition', 'QTable', 'QContextMenu', + 'QProgress', + 'QSlider', ], directives: [ 'Ripple', diff --git a/src/components/todos/SingleTodo/SingleTodo.scss b/src/components/todos/SingleTodo/SingleTodo.scss index 3cd7a9f..9436309 100644 --- a/src/components/todos/SingleTodo/SingleTodo.scss +++ b/src/components/todos/SingleTodo/SingleTodo.scss @@ -42,7 +42,10 @@ .pos-item { max-width: 24px; min-width: 24px; - margin: 0 auto; + margin-left: 1px; + margin-right: 1px; + padding-left: 1px; + padding-right: 1px; height: 36px; line-height: 36px; text-align: center; @@ -122,6 +125,38 @@ min-width: 24px; } +.progress-item { + max-width: 32px; + min-width: 24px; + flex: 1; + order: 2; + text-align: right; +} + + +.percProgress { + height: 24px; + line-height: 24px; + color: #888; +} + +.menuProgress { + width:50px; +} + +.colProgress { +} + +.lowperc { + color: red; +} +.medperc { + color: blue; +} +.highperc { + color: green; +} + .myexpired { padding-top: 0px; padding-bottom: 0px; diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts index 86df520..3a372e5 100644 --- a/src/components/todos/SingleTodo/SingleTodo.ts +++ b/src/components/todos/SingleTodo/SingleTodo.ts @@ -27,6 +27,9 @@ export default class SingleTodo extends Vue { public sel: boolean = false public inEdit: boolean = false public precDescr: string = '' + public menuProgress: string = 'menuprogress' + public percProgress: string = 'percProgress' + public colProgress: string = 'blue' $q: any @Prop({ required: true }) itemtodo: ITodo @@ -48,10 +51,15 @@ export default class SingleTodo extends Vue { this.watchupdate() } + @Watch('itemtodo.descr') valueChanged5() { this.precDescr = this.itemtodo.descr } + @Watch('itemtodo.progress') valueChanged6() { + this.updateClasses() + } + isTodo() { return this.isTodoByElem(this.itemtodo) } @@ -82,6 +90,23 @@ export default class SingleTodo extends Vue { this.classExpiringEx += ' status_completed' } + this.menuProgress = 'menuProgress' + this.percProgress = 'percProgress' + + let mycolcl = '' + if (this.itemtodo.progress < 33) { + mycolcl = ' lowperc' + } else if (this.itemtodo.progress < 66) { + mycolcl = ' medperc' + } else { + mycolcl = ' highperc' + } + + this.colProgress = mycolcl + + this.menuProgress += mycolcl + this.percProgress += mycolcl + // if (this.inEdit) { // this.classDescr += ' hide' // this.classDescrEdit += ' show' @@ -293,4 +318,11 @@ export default class SingleTodo extends Vue { // this.$q.notify('setPriority: ' + elem) } + + getPercentageProgress() { + if (this.itemtodo.completed) + return 100 + else + return this.itemtodo.progress + } } diff --git a/src/components/todos/SingleTodo/SingleTodo.vue b/src/components/todos/SingleTodo/SingleTodo.vue index f6dab78..af44643 100644 --- a/src/components/todos/SingleTodo/SingleTodo.vue +++ b/src/components/todos/SingleTodo/SingleTodo.vue @@ -1,5 +1,5 @@