2021-06-25 09:55:49 -04:00
|
|
|
<template>
|
2021-07-27 13:47:13 -04:00
|
|
|
<div ref="modal" class="modal fade" tabindex="-1">
|
2021-06-25 09:55:49 -04:00
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2021-07-27 13:47:13 -04:00
|
|
|
<h5 id="exampleModalLabel" class="modal-title">
|
2021-08-24 06:26:44 -04:00
|
|
|
{{ $t("Confirm") }}
|
2021-07-27 13:47:13 -04:00
|
|
|
</h5>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
|
2021-06-25 09:55:49 -04:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2021-07-27 13:47:13 -04:00
|
|
|
<slot />
|
2021-06-25 09:55:49 -04:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2021-07-27 13:47:13 -04:00
|
|
|
<button type="button" class="btn" :class="btnStyle" data-bs-dismiss="modal" @click="yes">
|
2021-07-31 06:58:12 -04:00
|
|
|
{{ yesText }}
|
2021-07-27 13:47:13 -04:00
|
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
|
2021-07-31 06:58:12 -04:00
|
|
|
{{ noText }}
|
2021-07-27 13:47:13 -04:00
|
|
|
</button>
|
2021-06-25 09:55:49 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-04-13 12:30:32 -04:00
|
|
|
import { Modal } from "bootstrap";
|
2021-06-25 09:55:49 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
2022-06-01 19:32:05 -04:00
|
|
|
/** Style of button */
|
2021-06-25 09:55:49 -04:00
|
|
|
btnStyle: {
|
|
|
|
type: String,
|
2021-07-27 13:47:13 -04:00
|
|
|
default: "btn-primary",
|
|
|
|
},
|
2022-06-01 19:32:05 -04:00
|
|
|
/** Text to use as yes */
|
2021-07-31 06:58:12 -04:00
|
|
|
yesText: {
|
|
|
|
type: String,
|
2021-08-24 06:26:44 -04:00
|
|
|
default: "Yes", // TODO: No idea what to translate this
|
2021-07-31 06:58:12 -04:00
|
|
|
},
|
2022-06-01 19:32:05 -04:00
|
|
|
/** Text to use as no */
|
2021-07-31 06:58:12 -04:00
|
|
|
noText: {
|
|
|
|
type: String,
|
|
|
|
default: "No",
|
|
|
|
},
|
2021-06-25 09:55:49 -04:00
|
|
|
},
|
2022-04-17 03:27:35 -04:00
|
|
|
emits: [ "yes" ],
|
2021-06-25 09:55:49 -04:00
|
|
|
data: () => ({
|
2021-07-27 13:47:13 -04:00
|
|
|
modal: null,
|
2021-06-25 09:55:49 -04:00
|
|
|
}),
|
|
|
|
mounted() {
|
2022-04-13 12:30:32 -04:00
|
|
|
this.modal = new Modal(this.$refs.modal);
|
2021-06-25 09:55:49 -04:00
|
|
|
},
|
|
|
|
methods: {
|
2022-06-01 19:32:05 -04:00
|
|
|
/** Show the confirm dialog */
|
2021-06-25 09:55:49 -04:00
|
|
|
show() {
|
2022-04-13 12:30:32 -04:00
|
|
|
this.modal.show();
|
2021-06-25 09:55:49 -04:00
|
|
|
},
|
2022-06-01 19:32:05 -04:00
|
|
|
/**
|
2022-06-02 10:15:21 -04:00
|
|
|
* @emits string "yes" Notify the parent when Yes is pressed
|
2022-06-01 19:32:05 -04:00
|
|
|
*/
|
2021-06-25 09:55:49 -04:00
|
|
|
yes() {
|
2021-07-27 13:47:13 -04:00
|
|
|
this.$emit("yes");
|
|
|
|
},
|
|
|
|
},
|
2022-04-13 12:30:32 -04:00
|
|
|
};
|
2021-06-25 09:55:49 -04:00
|
|
|
</script>
|