Updated Project calculation for hours and progress.

This commit is contained in:
Paolo Arena
2019-04-06 21:52:27 +02:00
parent f632259c05
commit f60edc1c5b
11 changed files with 42 additions and 50 deletions

View File

@@ -43,10 +43,6 @@ export default class SingleProject extends Vue {
@Prop({ required: true }) public itemproject: IProject
// @Watch('itemproject.completed') valueChanged() {
// this.watchupdate('status')
// }
@Watch('itemproject.enableExpiring') public valueChanged4() {
this.watchupdate('enableExpiring')
}
@@ -108,7 +104,7 @@ export default class SingleProject extends Vue {
}
public watchupdate(field = '') {
console.log('watchupdate', field)
console.log('watchupdate PROJ', field)
this.$emit('eventupdateproj', {myitem: this.itemproject, field } )
this.updateicon()
}
@@ -138,7 +134,7 @@ export default class SingleProject extends Vue {
this.clButtPopover = this.sel ? 'pos-item-popover comp_selected' : 'pos-item-popover'
if (this.itemproject.status !== tools.Status.COMPLETED) {
if (this.itemproject.statusproj !== tools.Status.COMPLETED) {
this.clButtPopover += ' pos-item-popover_cursor'
}
@@ -386,16 +382,14 @@ export default class SingleProject extends Vue {
public setCompleted() {
// console.log('setCompleted')
if (this.itemproject.status === tools.Status.COMPLETED) {
this.itemproject.status = tools.Status.OPENED
if (this.itemproject.statusproj === tools.Status.COMPLETED) {
this.itemproject.statusproj = tools.Status.OPENED
} else {
this.itemproject.status = tools.Status.COMPLETED
this.itemproject.statusproj = tools.Status.COMPLETED
}
this.updateicon()
this.updatedata('status')
this.deselectAndExitEdit()
}

View File

@@ -69,7 +69,7 @@
v-for="(mytodo, index) in items_dacompletare(categoryAtt)"
:key="mytodo._id" class="myitemdrag">
<div v-if="(prior !== mytodo.priority) && mytodo.status !== tools.Status.COMPLETED"
<div v-if="(prior !== mytodo.priority) && mytodo.statustodo !== tools.Status.COMPLETED"
:class="tools.getTitlePriority(mytodo.priority)">
<label>{{tools.getPriorityByInd(mytodo.priority)}}</label>
</div>
@@ -79,7 +79,7 @@
<!--<div :nametranslate="`REF${index}`" class="divdrag non-draggato"></div>-->
<div style="display: none">{{ prior = mytodo.priority, priorcomplet = (mytodo.status === tools.Status.COMPLETED) }}
<div style="display: none">{{ prior = mytodo.priority, priorcomplet = (mytodo.statustodo === tools.Status.COMPLETED) }}
</div>
</div>
</div>
@@ -101,7 +101,7 @@
<!--<div :nametranslate="`REF${index}`" class="divdrag non-draggato"></div>-->
<div style="display: none">{{ prior = mytodo.priority, priorcomplet = (mytodo.status === tools.Status.COMPLETED) }}
<div style="display: none">{{ prior = mytodo.priority, priorcomplet = (mytodo.statustodo === tools.Status.COMPLETED) }}
</div>
</div>
</div>

View File

@@ -49,10 +49,6 @@ export default class SingleTodo extends Vue {
@Prop({ required: true }) public itemtodo: ITodo
// @Watch('itemtodo.completed') valueChanged() {
// this.watchupdate('status')
// }
@Watch('itemtodo.enableExpiring') public valueChanged4() {
this.watchupdate('enableExpiring')
}
@@ -74,9 +70,10 @@ export default class SingleTodo extends Vue {
console.log('itemtodo.hoursplanned', this.itemtodo.hoursplanned)
this.watchupdate('hoursplanned')
}
@Watch('itemtodo.status') public valueChangedstatus() {
console.log('itemtodo.status', this.itemtodo.status)
this.watchupdate('status')
// ++TODO: FIX! STATUSTODO WILL NOT UPDATE IF I DON'T PUT { immediate: true } parameter. ! WHY???
@Watch('itemtodo.statustodo', {immediate: true}) public valueChangedstatus() {
console.log('itemtodo.statustodo', this.itemtodo.statustodo)
this.watchupdate('statustodo')
}
@Watch('itemtodo.completed_at') public valueChangedcompleted_at() {
console.log('itemtodo.completed_at', this.itemtodo.completed_at)
@@ -145,7 +142,7 @@ export default class SingleTodo extends Vue {
this.classExpiring = 'flex-item data-item shadow-1 hide-if-small'
this.classExpiringEx = ''
if (this.itemtodo.status === tools.Status.COMPLETED) {
if (this.itemtodo.statustodo === tools.Status.COMPLETED) {
this.percentageProgress = 100
this.classCompleted += ' icon_completed'
this.classDescr += ' status_completed'
@@ -162,7 +159,7 @@ export default class SingleTodo extends Vue {
let mycolcl = ' ' + tools.getProgressClassColor(this.itemtodo.progress)
this.colProgress = tools.getProgressColor(this.itemtodo.progress)
if (this.itemtodo.status === tools.Status.COMPLETED) {
if (this.itemtodo.statustodo === tools.Status.COMPLETED) {
mycolcl = ' percompleted'
this.colProgress = 'gray'
}
@@ -174,7 +171,7 @@ export default class SingleTodo extends Vue {
this.clButtPopover = this.sel ? 'pos-item-popover comp_selected' : 'pos-item-popover'
if (this.itemtodo.status !== tools.Status.COMPLETED) {
if (this.itemtodo.statustodo !== tools.Status.COMPLETED) {
this.clButtPopover += ' pos-item-popover_cursor'
}
@@ -271,7 +268,7 @@ export default class SingleTodo extends Vue {
}
public editTodo() {
if (this.itemtodo.status !== tools.Status.COMPLETED) {
if (this.itemtodo.statustodo !== tools.Status.COMPLETED) {
// console.log('INIZIO - editTodo')
this.$emit('click')
this.precDescr = this.itemtodo.descr
@@ -407,11 +404,12 @@ export default class SingleTodo extends Vue {
public setCompleted() {
// console.log('setCompleted')
if (this.itemtodo.status === tools.Status.COMPLETED) {
this.itemtodo.status = tools.Status.OPENED
if (this.itemtodo.statustodo === tools.Status.COMPLETED) {
this.itemtodo.statustodo = tools.Status.OPENED
} else {
this.itemtodo.status = tools.Status.COMPLETED
this.itemtodo.statustodo = tools.Status.COMPLETED
}
this.watchupdate('statustodo')
this.deselectAndExitEdit()
}
@@ -424,7 +422,7 @@ export default class SingleTodo extends Vue {
public updateicon() {
// console.log('updateicon')
if (this.itemtodo.status === tools.Status.COMPLETED) {
if (this.itemtodo.statustodo === tools.Status.COMPLETED) {
this.iconCompleted = 'check_circle'
}
else {

View File

@@ -4,12 +4,12 @@
<q-btn push flat
:class="classCompleted"
:icon="iconCompleted"
@click.native="setCompleted">
@click="setCompleted">
</q-btn>
</div>
<div class="flex-item donotdrag divdescrTot">
<q-input v-if="sel && itemtodo.status !== tools.Status.COMPLETED" hide-underline type="textarea" ref="inputdescr"
<q-input v-if="sel && itemtodo.statustodo !== tools.Status.COMPLETED" hide-underline type="textarea" ref="inputdescr"
v-model.trim="precDescr"
autogrow
borderless

View File

@@ -15,7 +15,7 @@
<q-checkbox v-model="itemtodo.enableExpiring"/>
</q-item-section>
<q-item-section side v-if="field.value === 110">
<q-checkbox v-model="itemtodo.status"/>
<q-checkbox v-model="itemtodo.statustodo"/>
</q-item-section>
</q-item>
<q-item clickable v-if="(field.value === 120)" :icon="field.icon"

View File

@@ -12,7 +12,7 @@ export interface IProject {
hoursplanned?: number
hoursworked?: number
priority?: number
status?: number
statusproj?: number
created_at?: Date
modify_at?: Date
completed_at?: Date

View File

@@ -4,7 +4,7 @@ export interface ITodo {
category?: string
descr?: string,
priority?: number,
status?: number,
statustodo?: number,
created_at?: Date,
modify_at?: Date,
completed_at?: Date,

View File

@@ -20,7 +20,7 @@ const stateglob: IProjectsState = {
visuLastCompleted: 10
}
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'status', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'live_url', 'test_url', 'begin_development', 'begin_test']
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'statusproj', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'live_url', 'test_url', 'begin_development', 'begin_test']
const b = storeBuilder.module<IProjectsState>('Projects', stateglob)
const stateGetter = b.state()
@@ -50,7 +50,7 @@ namespace Getters {
longdescr: '',
id_parent: '',
priority: tools.Priority.PRIORITY_NORMAL,
status: tools.Status.OPENED,
statusproj: tools.Status.OPENED,
created_at: tools.getDateNow(),
modify_at: tools.getDateNow(),
completed_at: tools.getDateNull(),

View File

@@ -27,7 +27,7 @@ const state: ITodosState = {
visuLastCompleted: 10
}
const listFieldsToChange: string [] = ['descr', 'status', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at']
const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at']
const b = storeBuilder.module<ITodosState>('Todos', state)
const stateGetter = b.state()
@@ -65,7 +65,7 @@ namespace Getters {
userId: UserStore.state.userId,
descr: '',
priority: tools.Priority.PRIORITY_NORMAL,
status: tools.Status.OPENED,
statustodo: tools.Status.OPENED,
created_at: tools.getDateNow(),
modify_at: tools.getDateNow(),
completed_at: tools.getDateNull(),
@@ -89,7 +89,7 @@ namespace Getters {
const items_dacompletare = b.read((state: ITodosState) => (cat: string): ITodo[] => {
const indcat = getindexbycategory(cat)
if (state.todos[indcat]) {
return state.todos[indcat].filter((todo) => todo.status !== tools.Status.COMPLETED)
return state.todos[indcat].filter((todo) => todo.statustodo !== tools.Status.COMPLETED)
} else {
return []
}
@@ -99,13 +99,13 @@ namespace Getters {
const indcat = getindexbycategory(cat)
if (state.todos[indcat]) {
if (state.showtype === costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED) { // Show only the first N completed
return state.todos[indcat].filter((todo) => todo.status === tools.Status.COMPLETED).slice(0, state.visuLastCompleted)
return state.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED).slice(0, state.visuLastCompleted)
}
else if (state.showtype === costanti.ShowTypeTask.SHOW_ONLY_TOCOMPLETE) {
return []
}
else if (state.showtype === costanti.ShowTypeTask.SHOW_ALL) {
return state.todos[indcat].filter((todo) => todo.status === tools.Status.COMPLETED)
return state.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED)
}
else {
return []

View File

@@ -64,7 +64,7 @@ export default class ProjList extends Vue {
}
public watchupdatetodo(field = '') {
console.log('watchupdate', field)
console.log('watchupdatetodo', field)
this.$emit('eventupdate', {myitem: this.itemtodosel, field } )
}

View File

@@ -131,7 +131,7 @@
<q-icon class="flex-item flex-icon" name="work_outline"/>
<div class="flex-item itemdescr">
<q-input
ref="input"
ref="input2"
readonly
v-model="itemsel.hoursworked"
type="number"
@@ -143,7 +143,7 @@
<q-icon class="flex-item flex-icon" name="watch_later"/>
<div class="flex-item itemdata content-center">
<q-input
ref="input"
ref="input3"
type="number"
readonly
v-model="itemsel.hoursplanned"
@@ -178,7 +178,7 @@
<q-icon class="flex-item flex-icon" name="border_color"/>
<div class="flex-item itemdescr">
<q-input
ref="input"
ref="input4"
v-model="itemtodosel.descr"
:label="$t('proj.longdescr')"
outlined
@@ -192,9 +192,9 @@
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="done_outline"/>
<div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemtodosel.status" :options="selectStatus"
<q-select rounded outlined v-model="itemtodosel.statustodo" :options="selectStatus"
:label="$t('todo.status')" emit-value map-options
@input="watchupdatetodo('status')">
@input="watchupdatetodo('statustodo')">
</q-select>
</div>
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
@@ -209,7 +209,7 @@
<q-icon class="flex-item flex-icon" name="work_outline"/>
<div class="flex-item itemdescr">
<q-input
ref="input"
ref="input5"
v-model="itemtodosel.hoursworked"
type="number"
rounded outlined
@@ -222,7 +222,7 @@
<q-icon class="flex-item flex-icon" name="watch_later"/>
<div class="flex-item itemdata content-center">
<q-input
ref="input"
ref="input6"
type="number"
v-model="itemtodosel.hoursplanned"
rounded outlined
@@ -247,7 +247,7 @@
<div style="margin: 10px;"></div>
<q-icon class="flex-item flex-icon" name="event"/>
<div class="flex-item itemdata">
<CDate :readonly="itemtodosel.status !== tools.Status.COMPLETED"
<CDate :readonly="itemtodosel.statustodo !== tools.Status.COMPLETED"
:mydate="itemtodosel.completed_at" @input="itemtodosel.completed_at = new Date(arguments[0])"
:label="$t('todo.completed_at')">
</CDate>