ViewPunishment.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. punishment.expiresAt,
  23. "MMMM Do YYYY, h:mm:ss a"
  24. )
  25. }}
  26. ({{ formatDistance(punishment.expiresAt, new Date()) }})
  27. <br />
  28. <strong>Punished at:</strong>
  29. {{
  30. format(
  31. punishment.punishedAt,
  32. "MMMM Do YYYY, h:mm:ss a"
  33. )
  34. }}
  35. ({{
  36. formatDistance(punishment.punishedAt, new Date())
  37. }})
  38. <br />
  39. <strong>Punished by:</strong>
  40. {{ punishment.punishedBy }}
  41. <br />
  42. </div>
  43. </article>
  44. </div>
  45. <div slot="footer">
  46. <button
  47. class="button is-danger"
  48. @click="
  49. closeModal({
  50. sector: 'admin',
  51. modal: 'viewPunishment'
  52. })
  53. "
  54. >
  55. <span>&nbsp;Close</span>
  56. </button>
  57. </div>
  58. </modal>
  59. </div>
  60. </template>
  61. <script>
  62. import { mapState, mapActions } from "vuex";
  63. import { format, formatDistance } from "date-fns"; // eslint-disable-line no-unused-vars
  64. import io from "../../io";
  65. import Modal from "./Modal.vue";
  66. export default {
  67. components: { Modal },
  68. data() {
  69. return {
  70. ban: {}
  71. };
  72. },
  73. computed: {
  74. ...mapState("admin/punishments", {
  75. punishment: state => state.punishment
  76. })
  77. },
  78. mounted() {
  79. io.getSocket(socket => {
  80. this.socket = socket;
  81. return socket;
  82. });
  83. },
  84. methods: {
  85. ...mapActions("modals", ["closeModal"])
  86. }
  87. };
  88. </script>