mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
* WIP(groups): quickish wins * WIP(groups): two quick wins 1. Don't show task creation button if user is not leader or manager 2. Don't require JS confirm() for approving tasks * fix(group-plans): allow delete from options button * fix(group-plans): update tasksOrder when task deleted * fix(group-tasks): dismiss notification when user takes action * refactor(tasks): DRY out create button styling * fix(group-tasks): sync after claiming/unclaiming
50 lines
1.4 KiB
Vue
50 lines
1.4 KiB
Vue
<template lang="pug">
|
|
b-modal#approval-modal(:title="$t('approveTask')", size='md', :hide-footer="true")
|
|
.modal-body
|
|
.row.approval(v-for='(approval, index) in task.approvals')
|
|
.col-8
|
|
strong {{approval.userId.profile.name}}
|
|
.col-2
|
|
button.btn.btn-primary(@click='approve(index)') {{ $t('approve') }}
|
|
.col-2
|
|
button.btn.btn-secondary(@click='needsWork(index)') {{ $t('needsWork') }}
|
|
.modal-footer
|
|
button.btn.btn-secondary(@click='close()') {{$t('close')}}
|
|
</template>
|
|
|
|
<style scoped>
|
|
.row.approval {
|
|
padding-top: 1em;
|
|
padding-bottom: 1em;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
export default {
|
|
props: ['task'],
|
|
methods: {
|
|
approve (index) {
|
|
let userIdToApprove = this.task.group.assignedUsers[index];
|
|
this.$store.dispatch('tasks:approve', {
|
|
taskId: this.task._id,
|
|
userId: userIdToApprove,
|
|
});
|
|
this.task.group.assignedUsers.splice(index, 1);
|
|
this.task.approvals.splice(index, 1);
|
|
},
|
|
needsWork (index) {
|
|
if (!confirm(this.$t('confirmNeedsWork'))) return;
|
|
let userIdNeedsMoreWork = this.task.group.assignedUsers[index];
|
|
this.$store.dispatch('tasks:needsWork', {
|
|
taskId: this.task._id,
|
|
userId: userIdNeedsMoreWork,
|
|
});
|
|
this.task.approvals.splice(index, 1);
|
|
},
|
|
close () {
|
|
this.$root.$emit('bv::hide::modal', 'approval-modal');
|
|
},
|
|
},
|
|
};
|
|
</script>
|