Files
habitica/website/client/components/tasks/approvalModal.vue
Sabe Jones 76ae41875d Group Plans quick wins (#11107)
* 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
2019-04-15 10:48:27 -05:00

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>