diff --git a/ayanova/src/api/gzdialog.js b/ayanova/src/api/gzdialog.js index 87047fcf..e099e1c7 100644 --- a/ayanova/src/api/gzdialog.js +++ b/ayanova/src/api/gzdialog.js @@ -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) { diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index b3c3451f..76db770d 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -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", { diff --git a/ayanova/src/components/gzconfirm.vue b/ayanova/src/components/gzconfirm.vue index 85a0971a..bed778af 100644 --- a/ayanova/src/components/gzconfirm.vue +++ b/ayanova/src/components/gzconfirm.vue @@ -28,26 +28,33 @@ :max-width="options.width" @keydown.esc="cancel" > - + - {{ title }} + {{ options.title }} - {{ message }} + {{ options.message }} - + - - I accept - + {{ options.noButtonText }} + {{ + options.yesButtonText + }} @@ -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;