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";
/* Xeslint-disable */
var VM_LOCAL = null;
/////////////////////////////////
// Dialog, toast, notification
// utils and handlers
@@ -65,29 +65,40 @@ TODO:
window.$gz.eventBus.$on("notify-success", function handleNotifyWarn(msg) {
vm.$root.$gznotify({ message: msg, type: "success", timeout: 2000 });
});
VM_LOCAL = vm;
},
/////////////////////////////////////
// Are you sure you want to delete?
//
confirmDelete(vm) {
//https://github.com/yariksav/vuetify-dialog#readme
return vm.$dialog.warning({
text: window.$gz.locale.get("DeletePrompt"),
// confirmDelete(vm) {
// //https://github.com/yariksav/vuetify-dialog#readme
// return vm.$dialog.warning({
// 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"),
icon: "fa-exclamation-triangle",
actions: [
{
text: window.$gz.locale.get("Cancel"),
key: false
},
{
text: window.$gz.locale.get("Delete"),
color: "red",
key: true
}
]
message: window.$gz.locale.get("DeletePrompt"),
yesButtonText: window.$gz.locale.get("Delete"),
noButtonText: window.$gz.locale.get("Cancel")
});
}, /////////////////////////////////////
},
/////////////////////////////////////
// Are you sure you want to delete?
//
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
//TODO: also need the other locale settings such as number and date formats etc to be added at server
window.$gz.store.commit("setLocale", {

View File

@@ -28,26 +28,33 @@
:max-width="options.width"
@keydown.esc="cancel"
>
<v-card>
<v-card elevation="24">
<v-card-title
v-if="options.title"
class="headline lighten-2"
v-bind:class="options.type"
primary-title
>
{{ title }}
{{ options.title }}
</v-card-title>
<v-card-text>
{{ message }}
{{ options.message }}
</v-card-text>
<v-divider></v-divider>
<!-- <v-divider></v-divider> v-bind:class="options.type" -->
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" text @click="isVisible = false">
I accept
</v-btn>
<v-btn
v-if="options.noButtonText"
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>
</v-dialog>
@@ -87,20 +94,20 @@ export default {
isVisible: false,
resolve: null,
reject: null,
message: null,
title: null,
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
width: 290,
zIndex: 200
}
}),
methods: {
open(title, message, options) {
this.isVisible = true;
this.title = title;
this.message = message;
open(options) {
this.options = Object.assign(this.options, options);
this.isVisible = true;
return new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;