This commit is contained in:
2019-11-08 21:37:56 +00:00
parent 4bc52914f4
commit e7e0c94c16
3 changed files with 59 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
import reportChooser from "../components/report-chooser.vue"; import reportChooser from "../components/report-chooser.vue";
/* Xeslint-disable */ /* Xeslint-disable */
var VM_LOCAL = null;
///////////////////////////////// /////////////////////////////////
// Dialog, toast, notification // Dialog, toast, notification
// utils and handlers // utils and handlers
@@ -65,29 +65,40 @@ TODO:
window.$gz.eventBus.$on("notify-success", function handleNotifyWarn(msg) { window.$gz.eventBus.$on("notify-success", function handleNotifyWarn(msg) {
vm.$root.$gznotify({ message: msg, type: "success", timeout: 2000 }); vm.$root.$gznotify({ message: msg, type: "success", timeout: 2000 });
}); });
VM_LOCAL = vm;
}, },
///////////////////////////////////// /////////////////////////////////////
// Are you sure you want to delete? // Are you sure you want to delete?
// //
confirmDelete(vm) { // confirmDelete(vm) {
//https://github.com/yariksav/vuetify-dialog#readme // //https://github.com/yariksav/vuetify-dialog#readme
return vm.$dialog.warning({ // return vm.$dialog.warning({
text: window.$gz.locale.get("DeletePrompt"), // text: window.$gz.locale.get("DeletePrompt"),
// title: window.$gz.locale.get("Delete"),
// icon: "fa-exclamation-triangle",
// actions: [
// {
// text: window.$gz.locale.get("Cancel"),
// key: false
// },
// {
// text: window.$gz.locale.get("Delete"),
// color: "red",
// key: true
// }
// ]
// });
// },
confirmDelete() {
return VM_LOCAL.$root.$gzconfirm({
title: window.$gz.locale.get("Delete"), title: window.$gz.locale.get("Delete"),
icon: "fa-exclamation-triangle", message: window.$gz.locale.get("DeletePrompt"),
actions: [ yesButtonText: window.$gz.locale.get("Delete"),
{ noButtonText: window.$gz.locale.get("Cancel")
text: window.$gz.locale.get("Cancel"),
key: false
},
{
text: window.$gz.locale.get("Delete"),
color: "red",
key: true
}
]
}); });
}, ///////////////////////////////////// },
/////////////////////////////////////
// Are you sure you want to delete? // Are you sure you want to delete?
// //
confirmLeaveUnsaved(vm) { confirmLeaveUnsaved(vm) {

View File

@@ -155,6 +155,15 @@ export default function initialize() {
); );
} }
// eslint-disable-next-line no-debugger
// debugger;
window.$gz.dialog.confirmDelete().then(dialogResult => {
window.$gz.eventBus.$emit(
"notify-info",
"You chose: " + dialogResult
);
});
//Store offset in locale data //Store offset in locale data
//TODO: also need the other locale settings such as number and date formats etc to be added at server //TODO: also need the other locale settings such as number and date formats etc to be added at server
window.$gz.store.commit("setLocale", { window.$gz.store.commit("setLocale", {

View File

@@ -28,26 +28,33 @@
:max-width="options.width" :max-width="options.width"
@keydown.esc="cancel" @keydown.esc="cancel"
> >
<v-card> <v-card elevation="24">
<v-card-title <v-card-title
v-if="options.title"
class="headline lighten-2" class="headline lighten-2"
v-bind:class="options.type"
primary-title primary-title
> >
{{ title }} {{ options.title }}
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
{{ message }} {{ options.message }}
</v-card-text> </v-card-text>
<v-divider></v-divider> <!-- <v-divider></v-divider> v-bind:class="options.type" -->
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="primary" text @click="isVisible = false"> <v-btn
I accept v-if="options.noButtonText"
</v-btn> color="primary darken-1"
text
@click.native="cancel"
>{{ options.noButtonText }}</v-btn
>
<v-btn color="primary darken-1" text @click.native="agree">{{
options.yesButtonText
}}</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
@@ -87,20 +94,20 @@ export default {
isVisible: false, isVisible: false,
resolve: null, resolve: null,
reject: null, reject: null,
message: null,
title: null,
options: { options: {
title: null,
message: null,
yesButtonText: null,
noButtonText: null,
type: "warning", //one of success, info, warning, and error, see v-alert docs for more info type: "warning", //one of success, info, warning, and error, see v-alert docs for more info
width: 290, width: 290,
zIndex: 200 zIndex: 200
} }
}), }),
methods: { methods: {
open(title, message, options) { open(options) {
this.isVisible = true;
this.title = title;
this.message = message;
this.options = Object.assign(this.options, options); this.options = Object.assign(this.options, options);
this.isVisible = true;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.resolve = resolve; this.resolve = resolve;
this.reject = reject; this.reject = reject;