2021-01-04 16:41:13 -09:00
|
|
|
<template>
|
2021-01-04 23:10:14 -06:00
|
|
|
<v-dialog
|
|
|
|
|
v-model="dialog"
|
|
|
|
|
:max-width="options.width"
|
|
|
|
|
:style="{ zIndex: options.zIndex }"
|
|
|
|
|
@click:outside="cancel"
|
|
|
|
|
@keydown.esc="cancel"
|
|
|
|
|
>
|
|
|
|
|
<v-card>
|
|
|
|
|
<v-toolbar v-if="Boolean(title)" :color="options.color" dense flat>
|
|
|
|
|
<v-icon v-if="Boolean(options.icon)" left> {{ options.icon }}</v-icon>
|
|
|
|
|
<v-toolbar-title v-text="title" />
|
|
|
|
|
</v-toolbar>
|
2021-01-04 16:41:13 -09:00
|
|
|
|
2021-01-04 23:10:14 -06:00
|
|
|
<v-card-text
|
|
|
|
|
v-show="!!message"
|
|
|
|
|
class="pa-4 text--primary"
|
|
|
|
|
v-html="message"
|
|
|
|
|
/>
|
2021-01-04 16:41:13 -09:00
|
|
|
|
|
|
|
|
<v-card-actions>
|
|
|
|
|
<v-spacer></v-spacer>
|
2021-01-04 23:10:14 -06:00
|
|
|
<v-btn color="grey" text @click="cancel"> Cancel </v-btn>
|
|
|
|
|
<v-btn :color="options.color" text @click="confirm"> Confirm </v-btn>
|
2021-01-04 16:41:13 -09:00
|
|
|
</v-card-actions>
|
|
|
|
|
</v-card>
|
|
|
|
|
</v-dialog>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
2021-01-04 23:10:14 -06:00
|
|
|
name: "Confirmation",
|
|
|
|
|
data: () => ({
|
|
|
|
|
dialog: false, // Wether to show or not
|
|
|
|
|
resolve: null,
|
|
|
|
|
reject: null,
|
|
|
|
|
message: null,
|
|
|
|
|
title: null,
|
|
|
|
|
options: {
|
|
|
|
|
color: "error",
|
|
|
|
|
icon: "mdi-alert-circle",
|
|
|
|
|
width: 400,
|
|
|
|
|
zIndex: 200,
|
|
|
|
|
noconfirm: false,
|
|
|
|
|
},
|
|
|
|
|
}),
|
2021-01-04 16:41:13 -09:00
|
|
|
methods: {
|
2021-01-04 23:10:14 -06:00
|
|
|
open(title, message, options) {
|
|
|
|
|
this.dialog = true;
|
|
|
|
|
this.title = title;
|
|
|
|
|
this.message = message;
|
|
|
|
|
this.options = Object.assign(this.options, options);
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
this.resolve = resolve;
|
|
|
|
|
this.reject = reject;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
|
this.resolve(false);
|
|
|
|
|
this.dialog = false;
|
|
|
|
|
},
|
|
|
|
|
|
2021-01-04 16:41:13 -09:00
|
|
|
confirm() {
|
2021-01-04 23:10:14 -06:00
|
|
|
this.resolve(true);
|
|
|
|
|
this.dialog = false;
|
2021-01-04 16:41:13 -09:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
</style>
|