|
@@ -9,19 +9,19 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { mapState, mapGetters, mapActions } from "vuex";
|
|
|
|
|
|
+import { mapGetters, mapActions } from "vuex";
|
|
import { format, formatDistance, parseISO } from "date-fns";
|
|
import { format, formatDistance, parseISO } from "date-fns";
|
|
|
|
|
|
import Toast from "toasters";
|
|
import Toast from "toasters";
|
|
import ws from "@/ws";
|
|
import ws from "@/ws";
|
|
|
|
+import { mapModalState, mapModalActions } from "@/vuex_helpers";
|
|
|
|
|
|
import PunishmentItem from "../PunishmentItem.vue";
|
|
import PunishmentItem from "../PunishmentItem.vue";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: { PunishmentItem },
|
|
components: { PunishmentItem },
|
|
props: {
|
|
props: {
|
|
- punishmentId: { type: String, default: "" },
|
|
|
|
- sector: { type: String, default: "admin" }
|
|
|
|
|
|
+ modalUuid: { type: String, default: "" }
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -29,7 +29,8 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState("modals/viewPunishment", {
|
|
|
|
|
|
+ ...mapModalState("modals/viewPunishment/MODAL_UUID", {
|
|
|
|
+ punishmentId: state => state.punishmentId,
|
|
punishment: state => state.punishment
|
|
punishment: state => state.punishment
|
|
}),
|
|
}),
|
|
...mapGetters({
|
|
...mapGetters({
|
|
@@ -39,6 +40,14 @@ export default {
|
|
mounted() {
|
|
mounted() {
|
|
ws.onConnect(this.init);
|
|
ws.onConnect(this.init);
|
|
},
|
|
},
|
|
|
|
+ beforeUnmount() {
|
|
|
|
+ // Delete the VueX module that was created for this modal, after all other cleanup tasks are performed
|
|
|
|
+ this.$store.unregisterModule([
|
|
|
|
+ "modals",
|
|
|
|
+ "viewPunishment",
|
|
|
|
+ this.modalUuid
|
|
|
|
+ ]);
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
init() {
|
|
init() {
|
|
this.socket.dispatch(
|
|
this.socket.dispatch(
|
|
@@ -56,7 +65,9 @@ export default {
|
|
);
|
|
);
|
|
},
|
|
},
|
|
...mapActions("modalVisibility", ["closeModal"]),
|
|
...mapActions("modalVisibility", ["closeModal"]),
|
|
- ...mapActions("modals/viewPunishment", ["viewPunishment"]),
|
|
|
|
|
|
+ ...mapModalActions("modals/viewPunishment/MODAL_UUID", [
|
|
|
|
+ "viewPunishment"
|
|
|
|
+ ]),
|
|
format,
|
|
format,
|
|
formatDistance,
|
|
formatDistance,
|
|
parseISO
|
|
parseISO
|