You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.4 KiB

4 years ago
4 years ago
  1. <template>
  2. <v-tooltip bottom>
  3. <template v-slot:activator="{ on }">
  4. <v-btn
  5. v-shortkey.once="['enter']"
  6. :disabled="disabled"
  7. class="text-capitalize ps-1 pe-1"
  8. min-width="36"
  9. icon
  10. v-on="on"
  11. @shortkey="approveNextPage"
  12. @click="approveDocument"
  13. >
  14. <v-icon v-if="approved">
  15. mdi-check
  16. </v-icon>
  17. <v-icon v-else>
  18. mdi-close
  19. </v-icon>
  20. </v-btn>
  21. </template>
  22. <span v-if="approved">{{ $t('annotation.checkedTooltip') }}</span>
  23. <span v-else>{{ $t('annotation.notCheckedTooltip') }}</span>
  24. </v-tooltip>
  25. </template>
  26. <script>
  27. import { mapActions } from 'vuex'
  28. export default {
  29. props: {
  30. approved: {
  31. type: Boolean,
  32. default: false,
  33. required: true
  34. },
  35. disabled: {
  36. type: Boolean,
  37. default: false
  38. },
  39. value: {
  40. type: Number,
  41. default: 1,
  42. required: true
  43. },
  44. length: {
  45. type: Number,
  46. default: 1,
  47. required: true
  48. }
  49. },
  50. methods: {
  51. ...mapActions('documents', ['approve']),
  52. approveDocument() {
  53. this.approve({
  54. projectId: this.$route.params.id
  55. })
  56. },
  57. /** Approves document and moves to the next page */
  58. approveNextPage() {
  59. const page = Math.min(this.value + 1, this.length)
  60. this.$emit('input', page)
  61. this.approveDocument()
  62. }
  63. }
  64. }
  65. </script>