End "project and Todos": what could modify or readonly.

This commit is contained in:
Paolo Arena
2019-04-22 01:43:53 +02:00
parent 18acf720db
commit 08e2ece604
18 changed files with 214 additions and 1051 deletions

View File

@@ -44,6 +44,10 @@ export default class SingleProject extends Vue {
return !Projects.getters.getifCanISeeProj(this.itemproject)
}
get CanIModifyProject() {
return Projects.getters.CanIModifyPanelPrivacy(this.itemproject)
}
@Prop({ required: true }) public itemproject: IProject
@Watch('itemproject.enableExpiring') public valueChanged4() {
@@ -248,12 +252,16 @@ export default class SingleProject extends Vue {
this.editProject()
}
get isMyProject() {
return this.itemproject.userId === UserStore.state.userId
}
get getrouteto() {
return '/projects/' + this.itemproject._id
return tools.getUrlByTipoProj(this.isMyProject) + this.itemproject._id
}
public goIntoTheProject() {
this.$router.replace('/projects/' + this.itemproject._id)
this.$router.replace(tools.getUrlByTipoProj(this.isMyProject) + this.itemproject._id)
}
public editProject() {
@@ -290,7 +298,7 @@ export default class SingleProject extends Vue {
}
// console.log('focus()')
}, 300)
}, 500)
}
public getFocus(e) {

View File

@@ -45,6 +45,8 @@
<div v-if="isProject()" class="flex-item pos-item " @mousedown="clickRiga">
<q-btn flat
:class="clButtPopover"
:readonly="!CanIModifyProject"
:disable="!CanIModifyProject"
icon="menu">
<q-menu ref="popmenu" self="top right">
<SubMenusProj :menuPopupProj="menuPopupProj" :itemproject="itemproject" @clickMenu="clickMenu"

View File

@@ -82,6 +82,7 @@ export default class CTodo extends Vue {
}
public async onEndtodo(itemdragend) {
console.log('onEndtodo...')
await Todos.actions.swapElems(itemdragend)
}
@@ -90,14 +91,15 @@ export default class CTodo extends Vue {
tools.dragula_option($service, this.dragname)
$service.eventBus.$on('dragend', (args) => {
const itemdragend: IDrag = {
category: this.categoryAtt,
newIndex: this.getElementIndex(args.el),
oldIndex: this.getElementOldIndex(args.el)
// console.log('args', args)
if (args.name === this.dragname) {
const itemdragend: IDrag = {
category: this.categoryAtt,
newIndex: this.getElementIndex(args.el),
oldIndex: this.getElementOldIndex(args.el)
}
this.onEndtodo(itemdragend)
}
this.onEndtodo(itemdragend)
})
$service.eventBus.$on('drag', (el, source) => {

View File

@@ -61,6 +61,8 @@
</template>
</q-input>
<!--categoryAtt: {{categoryAtt}}<br>-->
<div style="display: none">{{ prior = 0, priorcomplet = false }}</div>
<div>
<!--<q-infinite-scroll :handler="loadMoreTodo" :offset="7">-->
@@ -75,7 +77,9 @@
</div>
<SingleTodo ref="single" @deleteItemtodo="mydeleteitemtodo(mytodo._id)" @eventupdate="updateitemtodo"
@setitemsel="setitemsel" @deselectAllRowstodo="deselectAllRowstodo" @deselectAllRowsproj="deselectAllRowsproj" @onEnd="onEndtodo"
:itemtodo='mytodo'/>
:itemtodo='mytodo' :CanIModifyTodo="CanIModifyTodo">
</SingleTodo>
<!--<div :nametranslate="`REF${index}`" class="divdrag non-draggato"></div>-->
@@ -107,7 +111,7 @@
</div>
<!--</q-infinite-scroll>-->
</div>
CanIModifyTodo : {{CanIModifyTodo}}
<!--CanIModifyTodo : {{CanIModifyTodo}}-->
<q-input v-if="(TodosCount > 0 || !viewtaskTop) && CanIModifyTodo" ref="insertTaskBottom" v-model="todobottom"
style="margin-left: 6px;"

View File

@@ -25,6 +25,7 @@ export default class SingleTodo extends Vue {
public classDescrEdit: string = ''
public classExpiring: string = 'flex-item data-item shadow-1 hide-if-small'
public classExpiringEx: string = ''
public classMenuBtn: string = 'flex-item pos-item'
public iconPriority: string = ''
public popover: boolean = false
public popover_menu: boolean = false // Serve
@@ -48,6 +49,7 @@ export default class SingleTodo extends Vue {
}
@Prop({ required: true }) public itemtodo: ITodo
@Prop({ required: false, default: true }) public CanIModifyTodo: boolean
@Watch('itemtodo.enableExpiring') public valueChanged4() {
this.watchupdate('enableExpiring')
@@ -140,6 +142,10 @@ export default class SingleTodo extends Vue {
this.itemtodo.progress = 100
this.classExpiring = 'flex-item data-item shadow-1 hide-if-small'
this.classMenuBtn = 'flex-item pos-item'
if (!this.CanIModifyTodo)
this.classMenuBtn += ' donotdrag'
this.classExpiringEx = ''
if (this.itemtodo.statustodo === tools.Status.COMPLETED) {
this.percentageProgress = 100
@@ -171,7 +177,9 @@ export default class SingleTodo extends Vue {
this.clButtPopover = this.sel ? 'pos-item-popover comp_selected' : 'pos-item-popover'
if (this.itemtodo.statustodo !== tools.Status.COMPLETED) {
this.clButtPopover += ' pos-item-popover_cursor'
if (this.CanIModifyTodo) {
this.clButtPopover += ' pos-item-popover_cursor'
}
}
if (this.isTodo()) {
@@ -389,6 +397,9 @@ export default class SingleTodo extends Vue {
}
public setCompleted() {
if (!this.CanIModifyTodo)
return false
// console.log('setCompleted')
if (this.itemtodo.statustodo === tools.Status.COMPLETED) {
this.itemtodo.statustodo = tools.Status.OPENED

View File

@@ -4,6 +4,8 @@
<q-btn push flat
:class="classCompleted"
:icon="iconCompleted"
:readonly="!CanIModifyTodo"
:disable="!CanIModifyTodo"
@click="setCompleted">
</q-btn>
</div>
@@ -13,9 +15,10 @@
v-model.trim="precDescr"
autogrow
borderless
:readonly="!CanIModifyTodo"
dense
:class="classDescrEdit" :max-height="100"
@keydown="keyDownArea" v-on:keydown.esc="exitEdit" @blur="exitEdit(true)" @click="editTodo()"/>
@keydown="keyDownArea" v-on:keydown.esc="exitEdit" @blur="exitEdit(true)" @click="editTodo()"></q-input>
<div v-else :class="classDescr"
@keydown="keyDownRow">{{itemtodo.descr}}
@@ -37,6 +40,7 @@
<q-linear-progress
stripe
rounded
:readonly="!CanIModifyTodo"
:value="percentageProgress / 100"
class="progrbar-item"
:color="colProgress"
@@ -44,8 +48,9 @@
</q-linear-progress>
<div :class="percProgress">
{{percentageProgress}}%
<q-popup-edit v-model="percentageProgress" title="Progress" buttons class="editProgress"
<q-popup-edit v-if="CanIModifyTodo" v-model="percentageProgress" title="Progress" buttons class="editProgress"
@change="val => { model = val }"
:readonly="!CanIModifyTodo"
@save="aggiornaProgress"
>
<q-input dense autofocus type="number" v-model="percentageProgress" :max="100" :min="0"/>
@@ -57,14 +62,15 @@
<div v-if="itemtodo.enableExpiring" :class="classExpiring">
<CDate :mydate="itemtodo.expiring_at" @input="itemtodo.expiring_at = new Date(arguments[0])"
data_class="data_string">
data_class="data_string" :readonly="!CanIModifyTodo">
</CDate>
</div>
<div v-if="isTodo()" class="flex-item pos-item " @mousedown="clickRiga">
<div v-if="isTodo()" :class="classMenuBtn" @mousedown="clickRiga">
<q-btn flat
:class="clButtPopover"
:readonly="!CanIModifyTodo"
icon="menu">
<q-menu ref="popmenu" self="top right">
<q-menu v-if="CanIModifyTodo" ref="popmenu" self="top right">
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu"
@setPriority="setPriority"></SubMenus>
</q-menu>