Updated Project calculation for hours and progress.

This commit is contained in:
Paolo Arena
2019-04-06 21:02:33 +02:00
parent ac3f6f0ba9
commit f632259c05
13 changed files with 117 additions and 85 deletions

View File

@@ -40,7 +40,7 @@ export default class ProjList extends Vue {
public service: any
public scrollable = true
public dragname: string = 'second'
public idProjAtt: string = tools.FIRST_PROJ
public idProjAtt: string = process.env.PROJECT_ID_MAIN
public idProjParentAtt: string = ''
public splitterModel = 50 // start at 50%
public itemproj: IProject = null
@@ -59,6 +59,10 @@ export default class ProjList extends Vue {
ctodo: CTodo
}
get getidProjParentAtt() {
return this.idProjParentAtt
}
public watchupdatetodo(field = '') {
console.log('watchupdate', field)
this.$emit('eventupdate', {myitem: this.itemtodosel, field } )
@@ -68,6 +72,12 @@ export default class ProjList extends Vue {
return '/projects/' + this.idProjParentAtt
}
public selproj() {
this.deselectAllRowsproj(null, false, false)
this.deselectAllRowstodo(null, false, false)
this.setidsel(this.idProjAtt)
}
get tools() {
return tools
}
@@ -89,25 +99,23 @@ export default class ProjList extends Vue {
return tools.listOptionShowTask[UserStore.state.lang]
}
get descrParent() {
return Projects.getters.getDescrById(this.idProjParentAtt)
}
get descrProject() {
return Projects.getters.getDescrById(this.idProjAtt)
}
// get ProjectsCount() {
// return Projects.getters.ProjectsCount(this.idProjParentAtt)
// }
@Getter('items_dacompletare', { namespace })
public items_dacompletare: (state: IProjectsState, id_parent: string) => IProject[]
@Watch('items_dacompletare')
public changeitems() {
this.idProjParentAtt = Projects.getters.getParentById(this.idProjAtt)
}
@Watch('$route.params.idProj')
public changeparent() {
this.idProjAtt = this.$route.params.idProj
this.idProjParentAtt = Projects.getters.getParentById(this.idProjAtt)
this.selproj()
}
@Watch('itemsel.progressCalc')
@@ -164,6 +172,8 @@ export default class ProjList extends Vue {
this.idProjAtt = this.$route.params.idProj
this.idProjParentAtt = Projects.getters.getParentById(this.idProjAtt)
console.log('this.idProjParentAtt', this.idProjParentAtt, 'idproj', this.idProjAtt, 'params' , this.$route.params)
tools.touchmove(this.scrollable)
}
@@ -346,4 +356,14 @@ export default class ProjList extends Vue {
}
get getCalcTodoHoursWorked() {
if (this.itemtodosel.hoursplanned <= 0) {
return 0
}
const myperc = Math.round(this.itemtodosel.hoursworked / this.itemtodosel.hoursplanned * 100)
return myperc
}
}

View File

@@ -11,9 +11,11 @@
<div>
<div class="divtitlecat clMain">
<div class="flex-container clMain">
<q-btn v-if="!!idProjParentAtt" size="sm" push color="secondary" round
<q-btn v-if="!!getidProjParentAtt" size="sm" push color="secondary" round
icon="arrow_back"
:to="getrouteup"/>
:to="getrouteup">
</q-btn>
<div class="flex-item categorytitle shadow-4">{{descrProject | capitalize}}</div>
<div class="flex-item">
<q-btn push
@@ -130,12 +132,12 @@
<div class="flex-item itemdescr">
<q-input
ref="input"
readonly
v-model="itemsel.hoursworked"
type="number"
rounded outlined
:label="$t('proj.hoursworked')"
debounce="500"
/>
debounce="500"></q-input>
<CProgress descr="" :progressval="getCalcHoursWorked"></CProgress>
</div>
<q-icon class="flex-item flex-icon" name="watch_later"/>
@@ -143,11 +145,13 @@
<q-input
ref="input"
type="number"
readonly
v-model="itemsel.hoursplanned"
rounded outlined
:label="$t('proj.hoursplanned')"
debounce="500"
/>
debounce="500">
</q-input>
<CProgress :descr="$t('proj.progresstask')"
:progressval="itemsel.progressCalc"></CProgress>
</div>
@@ -213,7 +217,7 @@
debounce="500">
</q-input>
<CProgress descr="" :progressval="getCalcHoursWorked"></CProgress>
<CProgress descr="" :progressval="getCalcTodoHoursWorked"></CProgress>
</div>
<q-icon class="flex-item flex-icon" name="watch_later"/>
<div class="flex-item itemdata content-center">
@@ -226,8 +230,10 @@
debounce="500">
</q-input>
<CProgress :descr="$t('proj.progresstask')"
:progressval="itemtodosel.progressCalc"></CProgress>
:progressval="itemtodosel.progress"
:slider="true" @input="itemtodosel.progress = arguments[0]"></CProgress>
</div>
</div>
<div class="flex-container clMain">