Privacy about Project: what to see, what you can modify...

This commit is contained in:
Paolo Arena
2019-04-20 13:58:58 +02:00
parent 3c05d2d9c7
commit 18acf720db
14 changed files with 1053 additions and 257 deletions

View File

@@ -43,6 +43,7 @@ export default class ProjList extends Vue {
public idProjAtt: string = process.env.PROJECT_ID_MAIN
public splitterModel = 50 // start at 50%
public itemproj: IProject = null
public itemprojparent: IProject = null
public idsel: string = ''
public itemselproj: IProject = Projects.getters.getRecordEmpty()
public itemtodosel: ITodo = Todos.getters.getRecordEmpty()
@@ -82,6 +83,7 @@ export default class ProjList extends Vue {
private updateindexProj() {
console.log('idProjAtt', this.idProjAtt)
this.itemproj = Projects.getters.getRecordById(this.idProjAtt)
this.itemprojparent = Projects.getters.getRecordById(this.itemproj.id_parent)
console.log('this.itemproj', this.itemproj)
// console.log('idproj', this.idProjAtt, 'params' , this.$route.params)
}
@@ -90,39 +92,34 @@ export default class ProjList extends Vue {
return !this.CanIModifyPanelPrivacy
}
get readonly_PanelPrivacySel() {
return !this.CanIModifyPanelPrivacySel
}
get CanISeeProject() {
return Projects.getters.getifCanISeeProj(this.itemproj)
}
if (UserStore.state.userId === this.itemselproj.userId) // If it's the owner
return true
get CanISeeProjectParent() {
return Projects.getters.getifCanISeeProj(this.itemprojparent)
}
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 CanISeeProjectSel() {
return Projects.getters.getifCanISeeProj(this.itemselproj)
}
get CanIModifyPanelPrivacy() {
if ((UserStore.state.userId === this.itemselproj.userId) || (this.itemselproj.privacywrite === Privacy.all)) // If it's the owner
return true
return Projects.getters.CanIModifyPanelPrivacy(this.itemproj)
}
// 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 CanIModifyPanelPrivacySel() {
return Projects.getters.CanIModifyPanelPrivacy(this.itemselproj)
}
get getrouteup() {
return '/projects/' + this.itemproj.id_parent
}
public selproj() {
this.deselectAllRowsproj(null, false, false)
this.deselectAllRowstodo(null, false, false)
this.setidsel(this.idProjAtt)
}
get tools() {
return tools
}
@@ -230,6 +227,19 @@ export default class ProjList extends Vue {
}
// 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 })
}
public selproj() {
this.deselectAllRowsproj(null, false, false)
this.deselectAllRowstodo(null, false, false)
this.setidsel(this.idProjAtt)
}
public showTask(field_value) {
return field_value === tools.MenuAction.SHOW_TASK
}

View File

@@ -11,7 +11,7 @@
<div>
<div class="divtitlecat clMain">
<div class="flex-container clMain">
<q-btn v-if="!!getIdParent && CanISeeProject" size="sm" push color="secondary" round
<q-btn v-if="!!getIdParent && CanISeeProjectParent" size="sm" push color="secondary" round
icon="arrow_back"
:to="getrouteup">
@@ -97,15 +97,22 @@
</div>
<q-separator></q-separator>
CanIModifyPanelPrivacy = {{CanIModifyPanelPrivacy}}<br>
CanIModifyPanelPrivacySel = {{CanIModifyPanelPrivacySel}}<br>
CanISeeProject = {{CanISeeProject}}<br>
CanISeeProjectSel = {{CanISeeProjectSel}}
<CTodo ref="ctodo" @setitemsel="setitemsel" :categoryAtt="idProjAtt" title="" backcolor="white"
forecolor="black" :viewtaskTop="false" @deselectAllRowsproj="deselectAllRowsproj"
@deselectAllRowstodo="deselectAllRowstodo"
:CanIModifyTodo="CanIModifyPanelPrivacy"
>
</CTodo>
</div>
</template>
<template v-if="(whatisSel === tools.WHAT_PROJECT) && (!!itemselproj.descr)" v-slot:after>
ID = {{itemselproj._id}}
<div class="q-pa-xs clMain">
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="format_align_center"/>
@@ -127,23 +134,23 @@
</div>
</div>
<div v-if="isMainProject" class="flex-container clMain">
<div v-if="isMainProject || true" class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="lock"/>
<div class="flex-item itemstatus">
<q-select :readonly="readonly_PanelPrivacy"
<q-select :readonly="readonly_PanelPrivacySel"
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="edit"/>
<div class="flex-item itemstatus">
<q-select :readonly="readonly_PanelPrivacy" rounded outlined
<q-select :readonly="readonly_PanelPrivacySel" 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 v-if="CanISeeProjectSel">
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="work_outline"/>
<div class="flex-item itemdescr">
@@ -176,14 +183,14 @@
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="developer_mode"/>
<div class="flex-item itemdata">
<CDate :readonly="readonly_PanelPrivacy" :mydate="itemselproj.begin_development"
<CDate :readonly="readonly_PanelPrivacySel" :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 :readonly="readonly_PanelPrivacy" :mydate="itemselproj.begin_test"
<CDate :readonly="readonly_PanelPrivacySel" :mydate="itemselproj.begin_test"
@input="itemselproj.begin_test = new Date(arguments[0])"
:label="$t('proj.begin_test')">
</CDate>
@@ -192,13 +199,13 @@
<div class="flex-container clMain">
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
<div class="flex-item itemstatus">
<q-select :readonly="readonly_PanelPrivacy" rounded outlined v-model="itemselproj.actualphase" :options="selectPhase"
<q-select :readonly="readonly_PanelPrivacySel" 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 :readonly="readonly_PanelPrivacy" rounded outlined v-model="itemselproj.totalphases" :options="selectPhase"
<q-select :readonly="readonly_PanelPrivacySel" rounded outlined v-model="itemselproj.totalphases" :options="selectPhase"
:label="$t('proj.totalphases')" emit-value map-options>
</q-select>
</div>
@@ -208,7 +215,7 @@
<q-icon class="flex-item flex-icon" name="watch_later"/>
<div class="flex-item itemdata content-center">
<q-input
:readonly="readonly_PanelPrivacy"
:readonly="readonly_PanelPrivacySel"
ref="input3"
type="number"
v-model="itemselproj.hoursweeky_plannedtowork"