From 38b3405664a2194e475fa377aa4fe596c4f5e802 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Sat, 30 Mar 2019 02:57:40 +0100 Subject: [PATCH] - added fields: longdescr, hoursworked, hoursplanned --- quasar.conf.js | 2 + src-pwa/custom-service-worker.js | 12 +- src/App.scss | 10 + src/components/CProgress/CProgress.scss | 39 ++++ src/components/CProgress/CProgress.ts | 36 ++++ src/components/CProgress/CProgress.vue | 22 ++ src/components/CProgress/index.ts | 1 + src/components/index.ts | 1 + .../projects/SingleProject/SingleProject.scss | 15 +- .../projects/SingleProject/SingleProject.ts | 56 +++-- .../projects/SingleProject/SingleProject.vue | 7 +- .../projects/SubMenusProj/SubMenusProj.vue | 2 +- .../todos/SingleTodo/SingleTodo.scss | 10 - src/components/todos/SingleTodo/SingleTodo.ts | 13 +- src/components/todos/SubMenus/SubMenus.vue | 2 +- src/model/Projects.ts | 33 +-- src/model/Todos.ts | 3 +- src/router/route-config.ts | 4 +- src/statics/i18n.js | 21 ++ src/statics/js/storage.js | 1 + src/store/Api/Instance.ts | 4 +- src/store/Api/index.ts | 2 +- src/store/Modules/ApiTables.ts | 30 ++- src/store/Modules/GlobalStore.ts | 2 +- src/store/Modules/Projects.ts | 185 +++++++--------- src/store/Modules/Todos.ts | 13 +- src/store/Modules/UserStore.ts | 3 +- src/store/Modules/tools.ts | 196 +++++++++++++---- src/views/admin/testp1/testp1.ts | 2 +- src/views/projects/proj-list/proj-list.scss | 53 ++++- src/views/projects/proj-list/proj-list.ts | 100 ++++++--- src/views/projects/proj-list/proj-list.vue | 198 ++++++++++++------ src/views/todo/todo.vue | 1 + 33 files changed, 753 insertions(+), 326 deletions(-) create mode 100644 src/components/CProgress/CProgress.scss create mode 100644 src/components/CProgress/CProgress.ts create mode 100644 src/components/CProgress/CProgress.vue create mode 100644 src/components/CProgress/index.ts diff --git a/quasar.conf.js b/quasar.conf.js index d08a385..dfb7e62 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -170,6 +170,8 @@ module.exports = function (ctx) { 'QPageScroller', 'QAvatar', 'QImg', + 'QSplitter', + 'QSeparator', 'QCarouselSlide' ], directives: [ diff --git a/src-pwa/custom-service-worker.js b/src-pwa/custom-service-worker.js index 8894d1e..a59cfe4 100644 --- a/src-pwa/custom-service-worker.js +++ b/src-pwa/custom-service-worker.js @@ -172,24 +172,24 @@ if (workbox) { console.log('*********+++++++++++++++++********** Records ', table + ' Received from Server [', myarr.length, 'record]', myarr) if (table === 'todos') { - for (let cat in data.categories) { + for (const cat in data.categories) { promiseChain = promiseChain.then(() => { return writeData('categories', { _id: cat, valore: data.categories[cat] }) }) } - for (let indrecCat in myarr) { - for (let indrec in myarr[indrecCat]) { + for (const arrsing of myarr) { + for (const rec of arrsing) { promiseChain = promiseChain.then(() => { - return writeData(table, myarr[indrecCat][indrec]) + return writeData(table, rec) }) } } } else { // Others tables - for (let indrec in myarr) { + for (const rec of myarr) { promiseChain = promiseChain.then(() => { - return writeData(table, myarr[indrec]) + return writeData(table, rec) }) } } diff --git a/src/App.scss b/src/App.scss index 75ee84e..c4b7fce 100644 --- a/src/App.scss +++ b/src/App.scss @@ -50,3 +50,13 @@ font-size: 1.1rem; text-align: center; } + +.lowperc { + color: red; +} +.medperc { + color: blue; +} +.highperc { + color: green; +} diff --git a/src/components/CProgress/CProgress.scss b/src/components/CProgress/CProgress.scss new file mode 100644 index 0000000..8dde2c1 --- /dev/null +++ b/src/components/CProgress/CProgress.scss @@ -0,0 +1,39 @@ +$heightBtn: 100%; + +.flex-item{ + // background-color: #d5e2eb; + padding: 2px; + margin: 2px; + margin-left: 3px; + margin-right: 3px; + color: #000; + font-size: 1rem; + height: $heightBtn; + line-height: $heightBtn; + vertical-align: middle; + //flex: 0 0 100%; +} + +.progress-item { + margin: 1px; + padding: 2px; + padding-top: 4px; + padding-bottom: 4px; + flex: 1; + flex-direction: column; + order: 1; +} + +.cpr-progrbar-item { + //height: 10px + padding-top: 7px; + height:15px; +} + +.cpr-percProgress { + padding-top: 3px; + color: #888; + vertical-align: middle; + text-align: center; + //line-height: $heightitem; +} diff --git a/src/components/CProgress/CProgress.ts b/src/components/CProgress/CProgress.ts new file mode 100644 index 0000000..cc4717f --- /dev/null +++ b/src/components/CProgress/CProgress.ts @@ -0,0 +1,36 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' + +import { tools } from '@src/store/Modules/tools' + +@Component({ + name: 'CProgress' +}) + +export default class CProgress extends Vue { + public cpr_colProgress: string = 'blue' + public cpr_percProgress: string = 'cpr-percProgress' + + @Watch('progressval') + public changeprogress() { + this.updateclasses() + } + + @Prop({ required: true }) public progressval: number + @Prop() public descr: string + + public updateclasses() { + this.cpr_colProgress = tools.getProgressColor(this.progressval) + } + + get getdescr(){ + if (!!this.descr) { + return this.descr + ' : ' + } + } + + public create() { + this.updateclasses() + } + +} diff --git a/src/components/CProgress/CProgress.vue b/src/components/CProgress/CProgress.vue new file mode 100644 index 0000000..4cf89f4 --- /dev/null +++ b/src/components/CProgress/CProgress.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/src/components/CProgress/index.ts b/src/components/CProgress/index.ts new file mode 100644 index 0000000..2fd959e --- /dev/null +++ b/src/components/CProgress/index.ts @@ -0,0 +1 @@ +export {default as CProgress} from './CProgress.vue' diff --git a/src/components/index.ts b/src/components/index.ts index d892c67..456faf1 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,3 +1,4 @@ export * from '../views/categories' export * from './todos' export * from './logo' +export * from './CProgress' diff --git a/src/components/projects/SingleProject/SingleProject.scss b/src/components/projects/SingleProject/SingleProject.scss index 366b792..628139c 100644 --- a/src/components/projects/SingleProject/SingleProject.scss +++ b/src/components/projects/SingleProject/SingleProject.scss @@ -9,8 +9,8 @@ $heightdescr: 20px; .flex-item{ // background-color: #d5e2eb; - padding: 0px; - margin: 1px; + padding: 2px; + margin: 2px; margin-left: 3px; margin-right: 3px; color: #000; @@ -195,16 +195,6 @@ $heightdescr: 20px; .colProgress { } -.lowperc { - color: red; -} -.medperc { - color: blue; -} -.highperc { - color: green; -} - .percompleted { color: $colcompleted } @@ -264,6 +254,7 @@ $heightdescr: 20px; .divdescrTot, .divdescrTot > div > div > div > div > textarea { font-size: 1rem; + cursor: pointer; } .divdescrTot { diff --git a/src/components/projects/SingleProject/SingleProject.ts b/src/components/projects/SingleProject/SingleProject.ts index 705fcb1..afdb1bc 100644 --- a/src/components/projects/SingleProject/SingleProject.ts +++ b/src/components/projects/SingleProject/SingleProject.ts @@ -54,6 +54,16 @@ export default class SingleProject extends Vue { this.precDescr = this.itemproject.descr } + @Watch('itemproject.longdescr') public valueChangedlongdescr() { + this.watchupdate('longdescr') + } + + @Watch('itemproject.hoursplanned') public valueChangedhoursplanned() { + this.watchupdate('hoursplanned') + } + @Watch('itemproject.hoursworked') public valueChangedhoursworked() { + this.watchupdate('hoursworked') + } @Watch('itemproject.progressCalc') public valueChanged6() { console.log('itemproject.progressCalc') this.updateClasses() @@ -106,18 +116,9 @@ export default class SingleProject extends Vue { this.percProgress = 'percProgress' - let mycolcl = '' - if (this.itemproject.progressCalc < 33) { - mycolcl = ' lowperc' - } else if (this.itemproject.progressCalc < 66) { - mycolcl = ' medperc' - } else { - mycolcl = ' highperc' - } + this.colProgress = tools.getProgressColor(this.itemproject.progressCalc) - this.colProgress = mycolcl - - this.percProgress += mycolcl + this.percProgress += ' ' + tools.getProgressClassColor(this.itemproject.progressCalc) this.clButtPopover = this.sel ? 'pos-item-popover comp_selected' : 'pos-item-popover' @@ -165,7 +166,7 @@ export default class SingleProject extends Vue { if (!this.sel) { if (!this.inEdit) { - this.attivaEdit = true + // this.attivaEdit = true this.$emit('deselectAllRows', this.itemproject, true) if (!this.sel) { @@ -209,10 +210,25 @@ export default class SingleProject extends Vue { } } - public clickRow() { + public clickProject() { + this.$emit('idsel', this.itemproject._id) this.clickRiga() } + public activeEdit(){ + console.log('Attiva Edit') + this.attivaEdit = true + this.editProject() + } + + get getrouteto(){ + return '/projects/' + this.itemproject._id + } + + public goIntoTheProject() { + this.$router.replace('/projects/' + this.itemproject._id) + } + public editProject() { console.log('INIZIO - editProject') if (this.attivaEdit) { @@ -269,7 +285,7 @@ export default class SingleProject extends Vue { this.deselectRiga() this.clickMenu(tools.MenuAction.DELETE) .then(() => { - this.faiFocus('insertTask', true) + this.faiFocus('insertProjectBottom', true) return }) } @@ -297,7 +313,7 @@ export default class SingleProject extends Vue { this.deselectRiga() this.clickMenu(tools.MenuAction.DELETE) .then(() => { - this.faiFocus('insertTask', true) + this.faiFocus('insertProjectBottom', true) return }) } @@ -310,14 +326,14 @@ export default class SingleProject extends Vue { } else { e.preventDefault() this.deselectRiga() - this.faiFocus('insertTask', false) + this.faiFocus('insertProjectBottom', false) } } // console.log('keyDownArea', e) if (e.key === 'Escape') { this.deselectRiga() - // this.faiFocus('insertTask', true) + // this.faiFocus('insertProject', true) console.log('LOAD this.precDescr', this.precDescr) this.precDescr = this.itemproject.descr } @@ -397,10 +413,8 @@ export default class SingleProject extends Vue { return await this.askConfirmDelete() } else if (action === tools.MenuAction.TOGGLE_EXPIRING) { return await this.enableExpiring() - } else if (action === tools.MenuAction.COMPLETED) { - return await this.setCompleted() - } else if (action === tools.MenuAction.PROGRESS_BAR) { - return await this.updatedata('progressCalc') + } else if (action === tools.MenuAction.EDIT) { + this.activeEdit() } else if (action === 0) { this.deselectAndExitEdit() } diff --git a/src/components/projects/SingleProject/SingleProject.vue b/src/components/projects/SingleProject/SingleProject.vue index 057ab9f..e335755 100644 --- a/src/components/projects/SingleProject/SingleProject.vue +++ b/src/components/projects/SingleProject/SingleProject.vue @@ -1,8 +1,11 @@