56 lines
1.1 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. Delete
  10. </v-btn>
  11. <v-dialog
  12. v-model="dialog"
  13. width="800"
  14. >
  15. <confirm-form
  16. :items="selected"
  17. title="Delete Document"
  18. message="Are you sure you want to delete these documents from this project?"
  19. item-key="text"
  20. @ok="deleteDocument($route.params.id);dialog=false"
  21. @cancel="dialog=false"
  22. />
  23. </v-dialog>
  24. </div>
  25. </template>
  26. <script>
  27. import { mapState, mapGetters, mapActions } from 'vuex'
  28. import ConfirmForm from '@/components/organisms/utils/ConfirmForm'
  29. export default {
  30. components: {
  31. ConfirmForm
  32. },
  33. data() {
  34. return {
  35. dialog: false
  36. }
  37. },
  38. computed: {
  39. ...mapState('documents', ['selected']),
  40. ...mapGetters('documents', ['isDocumentSelected'])
  41. },
  42. methods: {
  43. ...mapActions('documents', ['deleteDocument']),
  44. handleDeleteDocument() {
  45. const projectId = this.$route.params.id
  46. this.deleteDocument(projectId)
  47. }
  48. }
  49. }
  50. </script>