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.

58 lines
1.2 KiB

4 years ago
4 years ago
  1. <template>
  2. <div>
  3. <v-btn
  4. :disabled="!isDocumentSelected"
  5. class="text-capitalize"
  6. outlined
  7. @click="dialog=true"
  8. >
  9. {{ $t('generic.delete') }}
  10. </v-btn>
  11. <v-dialog
  12. v-model="dialog"
  13. width="800"
  14. >
  15. <confirm-form
  16. :items="selected"
  17. :title="$t('dataset.deleteDocumentsTitle')"
  18. :message="$t('dataset.deleteDocumentsMessage')"
  19. :button-true-text="$t('generic.yes')"
  20. :button-false-text="$t('generic.cancel')"
  21. item-key="text"
  22. @ok="deleteDocument($route.params.id);dialog=false"
  23. @cancel="dialog=false"
  24. />
  25. </v-dialog>
  26. </div>
  27. </template>
  28. <script>
  29. import { mapState, mapGetters, mapActions } from 'vuex'
  30. import ConfirmForm from '@/components/organisms/utils/ConfirmForm'
  31. export default {
  32. components: {
  33. ConfirmForm
  34. },
  35. data() {
  36. return {
  37. dialog: false
  38. }
  39. },
  40. computed: {
  41. ...mapState('documents', ['selected']),
  42. ...mapGetters('documents', ['isDocumentSelected'])
  43. },
  44. methods: {
  45. ...mapActions('documents', ['deleteDocument']),
  46. handleDeleteDocument() {
  47. const projectId = this.$route.params.id
  48. this.deleteDocument(projectId)
  49. }
  50. }
  51. }
  52. </script>