ViewPunishment.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div>
  3. <modal title="View Punishment">
  4. <div slot="body">
  5. <article class="message">
  6. <div class="message-body">
  7. <strong>Type:</strong>
  8. {{ punishment.type }}
  9. <br />
  10. <strong>Value:</strong>
  11. {{ punishment.value }}
  12. <br />
  13. <strong>Reason:</strong>
  14. {{ punishment.reason }}
  15. <br />
  16. <strong>Active:</strong>
  17. {{ punishment.active }}
  18. <br />
  19. <strong>Expires at:</strong>
  20. {{
  21. format(
  22. parseISO(punishment.expiresAt),
  23. "MMMM do yyyy, h:mm:ss a"
  24. )
  25. }}
  26. ({{
  27. formatDistance(
  28. parseISO(punishment.expiresAt),
  29. new Date(),
  30. { addSuffix: true }
  31. )
  32. }})
  33. <br />
  34. <strong>Punished at:</strong>
  35. {{
  36. format(
  37. parseISO(punishment.punishedAt),
  38. "MMMM do yyyy, h:mm:ss a"
  39. )
  40. }}
  41. ({{
  42. formatDistance(
  43. parseISO(punishment.punishedAt),
  44. new Date(),
  45. { addSuffix: true }
  46. )
  47. }})
  48. <br />
  49. <strong>Punished by:</strong>
  50. {{ punishment.punishedBy }}
  51. <br />
  52. </div>
  53. </article>
  54. </div>
  55. <div slot="footer">
  56. <button
  57. class="button is-danger"
  58. @click="
  59. closeModal({
  60. sector: 'admin',
  61. modal: 'viewPunishment'
  62. })
  63. "
  64. >
  65. <span>&nbsp;Close</span>
  66. </button>
  67. </div>
  68. </modal>
  69. </div>
  70. </template>
  71. <script>
  72. import { mapState, mapActions } from "vuex";
  73. import { format, formatDistance, parseISO } from "date-fns"; // eslint-disable-line no-unused-vars
  74. import io from "../../io";
  75. import Modal from "./Modal.vue";
  76. export default {
  77. components: { Modal },
  78. data() {
  79. return {
  80. ban: {}
  81. };
  82. },
  83. computed: {
  84. ...mapState("admin/punishments", {
  85. punishment: state => state.punishment
  86. })
  87. },
  88. mounted() {
  89. io.getSocket(socket => {
  90. this.socket = socket;
  91. return socket;
  92. });
  93. },
  94. methods: {
  95. ...mapActions("modals", ["closeModal"]),
  96. format,
  97. formatDistance,
  98. parseISO
  99. }
  100. };
  101. </script>