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.

55 lines
1.1 KiB

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