This commit is contained in:
2019-05-01 23:28:57 +00:00
parent b87d43b70d
commit 7ad284cf77
8 changed files with 192 additions and 91 deletions

View File

@@ -157,7 +157,7 @@
</template>
<script>
/* xeslint-disable */
/* eslint-disable */
/////////////////////////////
//
@@ -401,16 +401,69 @@ export default {
}
},
remove() {
//check rights
//Prompt:
//do the delete
alert("STUB: DELETE");
this.formState.loading = true;
var url = "Widget/" + this.$route.params.id;
//TODO: check if it's a new record (no ID) or one from server (has id)
var vm = this;
this.$gzform.deleteAllErrorBoxErrors(this);
this.$gzapi
.remove(url)
.then(res => {
if (res.error) {
vm.formState.serverError = res.error;
vm.$gzform.setErrorBoxErrors(vm);
} else {
//success, navigate backwards
vm.$router.go(-1);
}
})
.catch(function handleGetDataFromAPIError(error) {
//Update the form status
vm.$gzform.setFormState({
vm: vm,
loading: false
});
vm.$gzHandleFormError(error, vm);
});
},
duplicate() {
//this.$gzrole.getRights(this, this.$gztype.Widget, this.obj.ownerId);
this.$gzevent.$emit(
"popup-message",
"This is a test popup message\r\nDUPLICATE ALL THE THINGS!"
);
console.log("About to dialog");
this.$dialog.confirm({
text: "Do you really want to exit?",
title: "Warning"
}).then(res => {
console.log("The dialog result is:");
console.log(res);
});
//console.log(this.$gzform.confirm(this));
// this.$dialog.error({
// text: "Cannot delete this item",
// title: "Error"
// });
console.log("Done dialog");
// this.$dialog.notify.info("Test notification", {
// position: "top-right",
// timeout: 5000
// });
// this.$dialog.message.info("Test", {
// position: "top-left"
// });
// this.$gzevent.$emit(
// "popup-message",
// "This is a test popup message\r\nDUPLICATE ALL THE THINGS!"
// );
//only if not dirty
//check rights
//duplicate