- add fields: typeproj and id_main_project
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Watch } from 'vue-property-decorator'
|
||||
|
||||
import { IDrag, IProject, IProjectsState, ITodo } from '../../../model/index'
|
||||
import { IDrag, IProject, IProjectsState, ITodo, Privacy, TypeProj } from '../../../model/index'
|
||||
import { SingleProject } from '../../../components/projects/SingleProject/index'
|
||||
import { CTodo } from '../../../components/todos/CTodo'
|
||||
|
||||
@@ -41,7 +41,6 @@ export default class ProjList extends Vue {
|
||||
public scrollable = true
|
||||
public dragname: string = 'second'
|
||||
public idProjAtt: string = process.env.PROJECT_ID_MAIN
|
||||
public idProjParentAtt: string = ''
|
||||
public splitterModel = 50 // start at 50%
|
||||
public itemproj: IProject = null
|
||||
public idsel: string = ''
|
||||
@@ -53,6 +52,7 @@ export default class ProjList extends Vue {
|
||||
|
||||
public selectStatus: [] = tools.selectStatus[UserStore.state.lang]
|
||||
public selectPhase: [] = tools.selectPhase[UserStore.state.lang]
|
||||
public selectPrivacy: [] = tools.selectPrivacy[UserStore.state.lang]
|
||||
|
||||
public $refs: {
|
||||
singleproject: SingleProject[],
|
||||
@@ -64,13 +64,13 @@ export default class ProjList extends Vue {
|
||||
|
||||
@Watch('items_dacompletare')
|
||||
public changeitems() {
|
||||
this.idProjParentAtt = Projects.getters.getParentById(this.idProjAtt)
|
||||
this.updateindexProj()
|
||||
}
|
||||
|
||||
@Watch('$route.params.idProj')
|
||||
public changeparent() {
|
||||
this.idProjAtt = this.$route.params.idProj
|
||||
this.idProjParentAtt = Projects.getters.getParentById(this.idProjAtt)
|
||||
this.updateindexProj()
|
||||
this.selproj()
|
||||
}
|
||||
|
||||
@@ -79,8 +79,31 @@ export default class ProjList extends Vue {
|
||||
this.updateclasses()
|
||||
}
|
||||
|
||||
get getidProjParentAtt() {
|
||||
return this.idProjParentAtt
|
||||
private updateindexProj() {
|
||||
console.log('idProjAtt', this.idProjAtt)
|
||||
this.itemproj = Projects.getters.getRecordById(this.idProjAtt)
|
||||
console.log('this.itemproj', this.itemproj)
|
||||
// console.log('idproj', this.idProjAtt, 'params' , this.$route.params)
|
||||
}
|
||||
|
||||
get readonly_PanelPrivacy() {
|
||||
return !this.CanIModifyPanelPrivacy
|
||||
}
|
||||
|
||||
get CanISeeProject() {
|
||||
|
||||
if (UserStore.state.userId === this.itemselproj.userId) // If it's the owner
|
||||
return true
|
||||
|
||||
return (this.itemselproj.privacyread === Privacy.all) ||
|
||||
(this.itemselproj.privacyread === Privacy.friends) && (UserStore.getters.IsMyFriend(this.itemselproj.userId))
|
||||
|| ((this.itemselproj.privacyread === Privacy.mygroup) && (UserStore.getters.IsMyGroup(this.itemselproj.userId)))
|
||||
}
|
||||
|
||||
get CanIModifyPanelPrivacy() {
|
||||
|
||||
if (UserStore.state.userId === this.itemselproj.userId) // If it's the owner
|
||||
return true
|
||||
}
|
||||
|
||||
// I use this because the statustodo will disappear from the UI, so it won't call the status changed...
|
||||
@@ -91,7 +114,7 @@ export default class ProjList extends Vue {
|
||||
}
|
||||
|
||||
get getrouteup() {
|
||||
return '/projects/' + this.idProjParentAtt
|
||||
return '/projects/' + this.itemproj.id_parent
|
||||
}
|
||||
|
||||
public selproj() {
|
||||
@@ -113,8 +136,26 @@ export default class ProjList extends Vue {
|
||||
GlobalStore.mutations.setShowType(value)
|
||||
}
|
||||
|
||||
get isRootProject() {
|
||||
return this.idProjAtt === process.env.PROJECT_ID_MAIN
|
||||
}
|
||||
|
||||
get getIdParent() {
|
||||
if (!!this.itemproj)
|
||||
return this.itemproj.id_parent
|
||||
else
|
||||
return ''
|
||||
}
|
||||
|
||||
get isMainProject() {
|
||||
return tools.isMainProject(this.idProjAtt)
|
||||
}
|
||||
|
||||
get menuPopupConfigProject() {
|
||||
return tools.menuPopupConfigProject[UserStore.state.lang]
|
||||
if (this.isMainProject)
|
||||
return tools.menuPopupConfigMAINProject[UserStore.state.lang]
|
||||
else
|
||||
return tools.menuPopupConfigProject[UserStore.state.lang]
|
||||
}
|
||||
|
||||
get listOptionShowTask() {
|
||||
@@ -125,6 +166,70 @@ export default class ProjList extends Vue {
|
||||
return Projects.getters.getDescrById(this.idProjAtt)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
let mydate = this.itemselproj.begin_development
|
||||
const datenow = tools.getDateNow()
|
||||
// if begin is in the past, take the day now
|
||||
if (date.getDateDiff(mydate, datenow) < 0) {
|
||||
mydate = datenow
|
||||
}
|
||||
console.log('mydate', mydate)
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
get getCalcTodoHoursWorked() {
|
||||
if (this.itemtodosel.hoursplanned <= 0) {
|
||||
return 0
|
||||
}
|
||||
const myperc = Math.round(this.itemtodosel.hoursworked / this.itemtodosel.hoursplanned * 100)
|
||||
|
||||
return myperc
|
||||
|
||||
}
|
||||
|
||||
public showTask(field_value) {
|
||||
return field_value === tools.MenuAction.SHOW_TASK
|
||||
}
|
||||
@@ -172,9 +277,7 @@ export default class ProjList extends Vue {
|
||||
this.splitterModel = 50
|
||||
}
|
||||
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)
|
||||
this.updateindexProj()
|
||||
|
||||
tools.touchmove(this.scrollable)
|
||||
}
|
||||
@@ -183,12 +286,9 @@ export default class ProjList extends Vue {
|
||||
console.log('LOAD PROJECTS....')
|
||||
if (!!this.$route.params.idProj) {
|
||||
this.idProjAtt = this.$route.params.idProj
|
||||
this.idProjParentAtt = Projects.getters.getParentById(this.idProjAtt)
|
||||
this.itemproj = Projects.getters.getRecordById(this.idProjAtt)
|
||||
this.updateindexProj()
|
||||
}
|
||||
|
||||
// console.log('this.idProjAtt', this.idProjAtt, this.idProjParentAtt)
|
||||
|
||||
// Set last category selected
|
||||
// localStorage.setItem(tools.localStorage.categorySel, this.categoryAtt)
|
||||
|
||||
@@ -206,8 +306,8 @@ export default class ProjList extends Vue {
|
||||
clearInterval(this.polling)
|
||||
}
|
||||
|
||||
public mydeleteitemproj(idobj: string) {
|
||||
// console.log('mydeleteitemtodo', idobj)
|
||||
public static mydeleteitemproj(idobj: string) {
|
||||
console.log('mydeleteitemtodo', idobj)
|
||||
return Projects.actions.deleteItem({ idobj })
|
||||
}
|
||||
|
||||
@@ -249,6 +349,14 @@ export default class ProjList extends Vue {
|
||||
id_parent: this.idProjAtt
|
||||
}
|
||||
|
||||
if (this.isRootProject) {
|
||||
myobj.typeproj = TypeProj.TYPE_PROJECT
|
||||
myobj.id_main_project = this.idProjAtt
|
||||
} else {
|
||||
myobj.typeproj = TypeProj.TYPE_SUBDIR
|
||||
myobj.id_main_project = this.itemproj.id_main_project
|
||||
}
|
||||
|
||||
if (!tools.checkIfUserExist(this)) {
|
||||
return
|
||||
}
|
||||
@@ -340,54 +448,6 @@ export default class ProjList extends Vue {
|
||||
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)
|
||||
}
|
||||
@@ -396,14 +456,5 @@ export default class ProjList extends Vue {
|
||||
return parseInt(el.attributes.index.value, 10)
|
||||
}
|
||||
|
||||
get getCalcTodoHoursWorked() {
|
||||
if (this.itemtodosel.hoursplanned <= 0) {
|
||||
return 0
|
||||
}
|
||||
const myperc = Math.round(this.itemtodosel.hoursworked / this.itemtodosel.hoursplanned * 100)
|
||||
|
||||
return myperc
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div>
|
||||
<div class="divtitlecat clMain">
|
||||
<div class="flex-container clMain">
|
||||
<q-btn v-if="!!getidProjParentAtt" size="sm" push color="secondary" round
|
||||
<q-btn v-if="!!getIdParent && CanISeeProject" size="sm" push color="secondary" round
|
||||
icon="arrow_back"
|
||||
:to="getrouteup">
|
||||
|
||||
@@ -122,95 +122,112 @@
|
||||
:label="$t('proj.longdescr')"
|
||||
outlined
|
||||
debounce="1000"
|
||||
autogrow
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container clMain">
|
||||
<q-icon class="flex-item flex-icon" name="work_outline"/>
|
||||
<div class="flex-item itemdescr">
|
||||
<q-input
|
||||
ref="input2"
|
||||
readonly
|
||||
v-model="itemselproj.hoursworked"
|
||||
type="number"
|
||||
rounded outlined
|
||||
:label="$t('proj.hoursworked')"
|
||||
debounce="500"></q-input>
|
||||
<CProgress descr="" :progressval="getCalcHoursWorked"></CProgress>
|
||||
</div>
|
||||
<q-icon class="flex-item flex-icon" name="watch_later"/>
|
||||
<div class="flex-item itemdata content-center">
|
||||
<q-input
|
||||
ref="input3"
|
||||
type="number"
|
||||
readonly
|
||||
v-model="itemselproj.hoursplanned"
|
||||
rounded outlined
|
||||
:label="$t('proj.hoursplanned')"
|
||||
debounce="500">
|
||||
|
||||
autogrow>
|
||||
</q-input>
|
||||
<CProgress :descr="$t('proj.progresstask')"
|
||||
: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="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="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 v-if="isMainProject" class="flex-container clMain">
|
||||
<q-icon class="flex-item flex-icon" name="lock"/>
|
||||
<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 :readonly="readonly_PanelPrivacy"
|
||||
rounded outlined v-model="itemselproj.privacyread" :options="selectPrivacy"
|
||||
:label="$t('proj.privacyread')" emit-value map-options>
|
||||
</q-select>
|
||||
</div>
|
||||
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
|
||||
<q-icon class="flex-item flex-icon" name="edit"/>
|
||||
<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 :readonly="readonly_PanelPrivacy" rounded outlined
|
||||
v-model="itemselproj.privacywrite" :options="selectPrivacy"
|
||||
:label="$t('proj.privacywrite')" emit-value map-options>
|
||||
</q-select>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="CanISeeProject">
|
||||
<div class="flex-container clMain">
|
||||
<q-icon class="flex-item flex-icon" name="work_outline"/>
|
||||
<div class="flex-item itemdescr">
|
||||
<q-input
|
||||
ref="input2"
|
||||
readonly
|
||||
v-model="itemselproj.hoursworked"
|
||||
type="number"
|
||||
rounded outlined
|
||||
:label="$t('proj.hoursworked')"
|
||||
debounce="500"></q-input>
|
||||
<CProgress descr="" :progressval="getCalcHoursWorked"></CProgress>
|
||||
</div>
|
||||
<q-icon class="flex-item flex-icon" name="watch_later"/>
|
||||
<div class="flex-item itemdata content-center">
|
||||
<q-input
|
||||
ref="input3"
|
||||
type="number"
|
||||
readonly
|
||||
v-model="itemselproj.hoursplanned"
|
||||
rounded outlined
|
||||
:label="$t('proj.hoursplanned')"
|
||||
debounce="500">
|
||||
|
||||
<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>
|
||||
</q-input>
|
||||
<CProgress :descr="$t('proj.progresstask')"
|
||||
:progressval="itemselproj.progressCalc"></CProgress>
|
||||
</div>
|
||||
</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 class="flex-container clMain">
|
||||
<q-icon class="flex-item flex-icon" name="developer_mode"/>
|
||||
<div class="flex-item itemdata">
|
||||
<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="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>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<template v-else-if="(whatisSel === tools.WHAT_TODO) && (!!itemtodosel.descr)" v-slot:after>
|
||||
<div class="q-pa-xs clMain">
|
||||
|
||||
Reference in New Issue
Block a user