++ hoursweeky_plannedtowork, endwork_estimate, totalphases , actualphase

This commit is contained in:
Paolo Arena
2019-04-07 21:24:10 +02:00
parent f60edc1c5b
commit 884d84e2df
14 changed files with 239 additions and 108 deletions

View File

@@ -182,3 +182,7 @@ $heightBtn: 100%;
text-align: center;
//line-height: $heightitem;
}
.endwork_estimate {
color: blue;
}

View File

@@ -13,7 +13,7 @@ import { UserStore } from '@store'
import { Getter } from 'vuex-class'
import { Screen } from 'quasar'
import { date, Screen } from 'quasar'
import { CProgress } from '../../../components/CProgress'
import { CDate } from '../../../components/CDate'
@@ -45,7 +45,7 @@ export default class ProjList extends Vue {
public splitterModel = 50 // start at 50%
public itemproj: IProject = null
public idsel: string = ''
public itemsel: IProject = Projects.getters.getRecordEmpty()
public itemselproj: IProject = Projects.getters.getRecordEmpty()
public itemtodosel: ITodo = Todos.getters.getRecordEmpty()
public whatisSel: number = 0
public colProgress: string = 'blue'
@@ -59,13 +59,35 @@ export default class ProjList extends Vue {
ctodo: CTodo
}
@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('itemselproj.progressCalc')
public changeprogress() {
this.updateclasses()
}
get getidProjParentAtt() {
return this.idProjParentAtt
}
public watchupdatetodo(field = '') {
console.log('watchupdatetodo', field)
this.$emit('eventupdate', {myitem: this.itemtodosel, field } )
// I use this because the statustodo will disappear from the UI, so it won't call the status changed...
// in this case I need to call manually the modify.
public modifyfieldtodo(field) {
console.log('modifyfieldtodo', field)
Todos.actions.modify({ myitem: this.itemtodosel, field })
}
get getrouteup() {
@@ -103,26 +125,6 @@ export default class ProjList extends Vue {
return Projects.getters.getDescrById(this.idProjAtt)
}
@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')
public changeprogress() {
this.updateclasses()
}
public showTask(field_value) {
return field_value === tools.MenuAction.SHOW_TASK
}
@@ -257,7 +259,7 @@ export default class ProjList extends Vue {
public setidsel(id: string) {
this.idsel = id
this.whatisSel = tools.WHAT_PROJECT
this.itemsel = Projects.getters.getRecordById(this.idsel)
this.itemselproj = Projects.getters.getRecordById(this.idsel)
}
public setitemsel(item: ITodo) {
this.whatisSel = tools.WHAT_TODO
@@ -331,13 +333,61 @@ export default class ProjList extends Vue {
}
public updateclasses() {
this.colProgress = tools.getProgressColor(this.itemsel.progressCalc)
this.colProgress = tools.getProgressColor(this.itemselproj.progressCalc)
}
public checkUpdate() {
ApiTables.waitAndcheckPendingMsg()
}
get getCalcHoursWorked() {
if (this.itemselproj.hoursplanned <= 0) {
return 0
}
return Math.round(this.itemselproj.hoursworked / this.itemselproj.hoursplanned * 100)
}
get calcprogressWeekly() {
if (this.itemselproj.hoursplanned <= 0) {
return 0
}
return Math.round(this.itemselproj.hoursworked / this.itemselproj.hoursplanned * 100)
}
get calcEndWork_Estimate() {
if (date.isValid(this.itemselproj.begin_development) && (this.itemselproj.hoursweeky_plannedtowork > 0)) {
const hoursw = this.itemselproj.hoursweeky_plannedtowork
try {
let orerimaste = this.itemselproj.hoursplanned - this.itemselproj.hoursworked
if (orerimaste < 0) {
orerimaste = 0
}
const weeks = orerimaste / hoursw
const days = Math.round(weeks * 7)
const mydate = this.itemselproj.begin_development
this.itemselproj.endwork_estimate = date.addToDate(mydate, { days })
console.log(' days', days, 'weeks', weeks, 'orerimaste', orerimaste, 'dateestimated', this.itemselproj.endwork_estimate)
return this.itemselproj.endwork_estimate
}catch (e) {
this.itemselproj.endwork_estimate = tools.getDateNull()
}
return tools.getDateNull()
} else {
return tools.getDateNull()
}
}
private getElementIndex(el: any) {
return [].slice.call(el.parentElement.children).indexOf(el)
}
@@ -346,16 +396,6 @@ export default class ProjList extends Vue {
return parseInt(el.attributes.index.value, 10)
}
get getCalcHoursWorked() {
if (this.itemsel.hoursplanned <= 0) {
return 0
}
const myperc = Math.round(this.itemsel.hoursworked / this.itemsel.hoursplanned * 100)
return myperc
}
get getCalcTodoHoursWorked() {
if (this.itemtodosel.hoursplanned <= 0) {
return 0

View File

@@ -105,12 +105,12 @@
</div>
</template>
<template v-if="(whatisSel === tools.WHAT_PROJECT) && (!!itemsel.descr)" v-slot:after>
<template v-if="(whatisSel === tools.WHAT_PROJECT) && (!!itemselproj.descr)" v-slot:after>
<div class="q-pa-xs clMain">
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="format_align_center"/>
<div class="flex-item projecttitle shadow-4">
{{itemsel.descr}}
{{itemselproj.descr}}
</div>
</div>
<div class="flex-container clMain">
@@ -118,10 +118,10 @@
<div class="flex-item itemdescr">
<q-input
ref="input"
v-model="itemsel.longdescr"
v-model="itemselproj.longdescr"
:label="$t('proj.longdescr')"
outlined
debounce="500"
debounce="1000"
autogrow
/>
@@ -133,7 +133,7 @@
<q-input
ref="input2"
readonly
v-model="itemsel.hoursworked"
v-model="itemselproj.hoursworked"
type="number"
rounded outlined
:label="$t('proj.hoursworked')"
@@ -146,31 +146,71 @@
ref="input3"
type="number"
readonly
v-model="itemsel.hoursplanned"
v-model="itemselproj.hoursplanned"
rounded outlined
:label="$t('proj.hoursplanned')"
debounce="500">
</q-input>
<CProgress :descr="$t('proj.progresstask')"
:progressval="itemsel.progressCalc"></CProgress>
:progressval="itemselproj.progressCalc"></CProgress>
</div>
</div>
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="developer_mode"/>
<div class="flex-item itemdata">
<CDate :mydate="itemsel.begin_development" @input="itemsel.begin_development = new Date(arguments[0])"
<CDate :mydate="itemselproj.begin_development"
@input="itemselproj.begin_development = new Date(arguments[0])"
:label="$t('proj.begin_development')">
</CDate>
</div>
<div style="margin: 10px;"></div>
<div class="flex-item itemdata">
<CDate :mydate="itemsel.begin_test" @input="itemsel.begin_test = new Date(arguments[0])"
<CDate :mydate="itemselproj.begin_test" @input="itemselproj.begin_test = new Date(arguments[0])"
:label="$t('proj.begin_test')">
</CDate>
</div>
</div>
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
<div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemselproj.actualphase" :options="selectPhase"
:label="$t('proj.actualphase')" emit-value map-options>
</q-select>
</div>
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
<div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemselproj.totalphases" :options="selectPhase"
:label="$t('proj.totalphases')" emit-value map-options>
</q-select>
</div>
</div>
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="watch_later"/>
<div class="flex-item itemdata content-center">
<q-input
ref="input3"
type="number"
v-model="itemselproj.hoursweeky_plannedtowork"
rounded outlined
maxlength="2"
:label="$t('proj.hoursweeky_plannedtowork')"
debounce="500">
</q-input>
<CProgress :progressval="calcprogressWeekly"></CProgress>
</div>
<q-icon class="flex-item flex-icon" name="developer_mode"/>
<div class="flex-item itemdata">
<CDate color="green-2" :mydate="calcEndWork_Estimate" :readonly="true"
:label="$t('proj.endwork_estimate')">
</CDate>
</div>
</div>
</div>
</template>
<template v-else-if="(whatisSel === tools.WHAT_TODO) && (!!itemtodosel.descr)" v-slot:after>
<div class="q-pa-xs clMain">
@@ -194,14 +234,13 @@
<div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemtodosel.statustodo" :options="selectStatus"
:label="$t('todo.status')" emit-value map-options
@input="watchupdatetodo('statustodo')">
@input="modifyfieldtodo('statustodo')">
</q-select>
</div>
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
<div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemtodosel.phase" :options="selectPhase"
:label="$t('todo.phase')" emit-value map-options
@input="watchupdatetodo('phase')">
:label="$t('todo.phase')" emit-value map-options>
</q-select>
</div>
</div>
@@ -233,13 +272,14 @@
<CProgress :descr="$t('proj.progresstask')"
:progressval="itemtodosel.progress"
:slider="true" @input="itemtodosel.progress = arguments[0]"></CProgress>
:slider="true" @input="itemtodosel.progress = arguments[0]"></CProgress>
</div>
</div>
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="developer_mode"/>
<div class="flex-item itemdata">
<CDate :mydate="itemtodosel.start_date" @input="itemtodosel.start_date = new Date(arguments[0])"
<CDate :mydate="itemtodosel.start_date"
@input="itemtodosel.start_date = new Date(arguments[0])"
:label="$t('todo.start_date')">
</CDate>
@@ -248,7 +288,8 @@
<q-icon class="flex-item flex-icon" name="event"/>
<div class="flex-item itemdata">
<CDate :readonly="itemtodosel.statustodo !== tools.Status.COMPLETED"
:mydate="itemtodosel.completed_at" @input="itemtodosel.completed_at = new Date(arguments[0])"
:mydate="itemtodosel.completed_at"
@input="itemtodosel.completed_at = new Date(arguments[0])"
:label="$t('todo.completed_at')">
</CDate>
</div>