This commit is contained in:
@@ -76,12 +76,8 @@ DONE: For form initialization modify widget edit make an simple init call for on
|
||||
DONE: Turn widget edit ROLES into a static select populated from server
|
||||
- Use the enumpicklist route to get a list of roles and use it for the widget UI
|
||||
DONE: Widget - NOTES FIELD
|
||||
TODO: TAGS!!!
|
||||
- COMPONENTIZE
|
||||
|
||||
- Also it seems to keep the default blank entry in the list that was intended to be nothing to avoid showing the default no data found text WTF?
|
||||
- Adding a new tag doesn't trigger isDirty anymore as it's out of the form so need to figure out why that's happening (onChange in form not getting called?? maybe need to emit another event like "change" or something??)
|
||||
- Could auto-insert tags in suggestion list like the current year or month or year/month/day or user name or ??
|
||||
TODO: TAGS!!!
|
||||
- Implement and componentize
|
||||
|
||||
TODO: Custom fields
|
||||
- Componentize
|
||||
@@ -93,6 +89,8 @@ TODO: WIKI
|
||||
- componentize
|
||||
TODO: Attached documents
|
||||
- componentize
|
||||
TODO: save and new button in edit form like v7? Or only from main?
|
||||
- will the menu be too crowded?
|
||||
|
||||
RETEST HERE ON ALL DEVICES
|
||||
|
||||
|
||||
@@ -76,14 +76,9 @@ export default {
|
||||
vm.$gzHandleFormError(err);
|
||||
});
|
||||
},
|
||||
value(val) {
|
||||
// var hasChanged = false;
|
||||
// if (this.oldDate != null && this.date != this.oldDate) {
|
||||
// hasChanged = true;
|
||||
// }
|
||||
// this.oldDate = this.date;
|
||||
// if (hasChanged) {
|
||||
this.$emit("input", val); //always in UTC
|
||||
value(val) {
|
||||
//this ensures the parent form gets the onchange event
|
||||
this.$emit("input", val);
|
||||
this.$emit("change", val); //always in UTC
|
||||
// }
|
||||
// this.localValue = this.value;
|
||||
|
||||
@@ -160,47 +160,11 @@
|
||||
:error-messages="this.$gzform.serverErrors(this, 'tags')"
|
||||
@change="onChange('tags')"
|
||||
></gz-tag-picker>
|
||||
<!-- <v-autocomplete
|
||||
v-model="obj.tags"
|
||||
:readonly="this.formState.readOnly"
|
||||
:label="this.$gzlocale.get('Tags')"
|
||||
:error-messages="this.$gzform.serverErrors(this, 'tags')"
|
||||
ref="tags"
|
||||
@change="onChange('tags')"
|
||||
:items="pickLists.tags"
|
||||
:loading="tagSearchUnderway"
|
||||
:search-input.sync="tagSearchEntry"
|
||||
hide-selected
|
||||
multiple
|
||||
chips
|
||||
clearable
|
||||
deletable-chips
|
||||
cache-items
|
||||
>
|
||||
<template slot="no-data" v-if="tagSearchEntry">
|
||||
<v-container>
|
||||
<v-layout row>
|
||||
<v-layout justify-center>
|
||||
<v-chip
|
||||
color="primary"
|
||||
text-color="white"
|
||||
class="display-1"
|
||||
>
|
||||
{{ this.$gzutil.normalizeTag(tagSearchEntry) }}</v-chip
|
||||
>
|
||||
<v-btn large icon @click="addTag()">
|
||||
<v-icon large color="success">fa-plus-circle</v-icon>
|
||||
</v-btn>
|
||||
</v-layout>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</template>
|
||||
</v-autocomplete> -->
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout align-left justify-center row wrap mt-5>
|
||||
<!-- <v-layout align-left justify-center row wrap mt-5>
|
||||
<v-flex xs6 sm4> FORMtags: {{ obj.tags }} </v-flex>
|
||||
</v-layout>
|
||||
</v-layout> -->
|
||||
<!-- <v-layout align-left justify-center row wrap mt-5>
|
||||
<v-flex xs6 sm4>
|
||||
READY: {{ formState.ready }}
|
||||
@@ -222,7 +186,7 @@
|
||||
|
||||
<script>
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* eslint-disable */
|
||||
/* Xeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const FORM_KEY = "inventory-widget-edit";
|
||||
@@ -242,8 +206,6 @@ export default {
|
||||
});
|
||||
},
|
||||
created() {
|
||||
// console.log("CREATED: TOP");
|
||||
// console.log("CREATED: setting rights");
|
||||
this.rights = this.$gzrole.getRights(this, this.$gztype.Widget);
|
||||
|
||||
this.$gzevent.$on("menu-click", clickHandler);
|
||||
@@ -251,10 +213,6 @@ export default {
|
||||
if (this.$route.params.id != 0) {
|
||||
this.getDataFromApi(this.$route.params.id);
|
||||
} else {
|
||||
// console.log("CREATED: setting up for new record");
|
||||
// console.log("CREATED: Rights are:");
|
||||
// console.log(this.rights);
|
||||
|
||||
//setup for new record
|
||||
var readOnly = !this.rights.change;
|
||||
//Update the form status
|
||||
@@ -266,8 +224,6 @@ export default {
|
||||
readOnly: readOnly
|
||||
});
|
||||
|
||||
// console.log("CREATED: Read only is: " + readOnly);
|
||||
// console.log("CREATED:formstate is: " + this.formState);
|
||||
//it's a new record so it can't be deleted so...
|
||||
this.rights.delete = false;
|
||||
|
||||
@@ -362,28 +318,6 @@ export default {
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
// tagSearchEntry(val) {
|
||||
// var vm = this;
|
||||
// if (vm.tagSearchUnderway) {
|
||||
// return;
|
||||
// }
|
||||
// vm.tagSearchUnderway = true;
|
||||
// vm.$gzapi
|
||||
// .get("TagList/picklist?query=" + val) //roles
|
||||
// .then(res => {
|
||||
// if (res.error) {
|
||||
// throw res.error;
|
||||
// }
|
||||
// //adding this to the property will automatically have it cached by the autocomplete component
|
||||
// //as cache-items has been set so this just needs to be set here once and all is well in future
|
||||
// //Any search will be kept for later so this is very efficient
|
||||
// vm.pickLists.tags = res.data;
|
||||
// vm.tagSearchUnderway = false;
|
||||
// })
|
||||
// .catch(err => {
|
||||
// vm.$gzHandleFormError(err);
|
||||
// });
|
||||
// }
|
||||
},
|
||||
computed: {
|
||||
canSave: function() {
|
||||
@@ -396,7 +330,6 @@ export default {
|
||||
methods: {
|
||||
onChange(ref) {
|
||||
if (!this.formState.loading && !this.formState.readOnly) {
|
||||
if(ref=="tags") console.log("TAGS CHANGED");
|
||||
this.$gzform.onChange(this, ref);
|
||||
}
|
||||
},
|
||||
@@ -427,9 +360,6 @@ export default {
|
||||
vm.$gzform.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.obj = res.data;
|
||||
//Populate tags pick list, this is required to cache it at least once and display it when form opens
|
||||
// vm.pickLists.tags = res.data.tags;
|
||||
|
||||
//Update the form status
|
||||
vm.$gzform.setFormState({
|
||||
vm: vm,
|
||||
@@ -438,7 +368,6 @@ export default {
|
||||
loading: false,
|
||||
readOnly: res.readOnly ? true : false
|
||||
});
|
||||
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm, res.readOnly);
|
||||
}
|
||||
@@ -463,7 +392,6 @@ export default {
|
||||
this.$gzapi
|
||||
.upsert(url, this.obj)
|
||||
.then(res => {
|
||||
// debugger;
|
||||
vm.formState.loading = false;
|
||||
if (res.error != undefined) {
|
||||
vm.formState.serverError = res.error;
|
||||
@@ -505,32 +433,39 @@ export default {
|
||||
if (dialogResult == true) {
|
||||
//do the delete
|
||||
vm.formState.loading = true;
|
||||
//No need to delete a new record, just abandon it...
|
||||
if (this.$route.params.id != 0) {
|
||||
//this should not get offered for delet but to be safe and clear just in case:
|
||||
JUST_DELETED = true;
|
||||
// navigate backwards
|
||||
vm.$router.go(-1);
|
||||
} else {
|
||||
var url = FORM_BASE_URL + vm.$route.params.id;
|
||||
|
||||
var url = FORM_BASE_URL + vm.$route.params.id;
|
||||
//TODO: check if it's a new record (no ID) or one from server (has id)
|
||||
vm.$gzform.deleteAllErrorBoxErrors(vm);
|
||||
vm.$gzapi
|
||||
.remove(url)
|
||||
.then(res => {
|
||||
if (res.error != undefined) {
|
||||
vm.formState.serverError = res.error;
|
||||
vm.$gzform.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
//workaround to prevent warning about leaving dirty record
|
||||
//For some reason I couldn't just reset isdirty in formstate
|
||||
JUST_DELETED = true;
|
||||
// navigate backwards
|
||||
vm.$router.go(-1);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
//Update the form status
|
||||
vm.$gzform.setFormState({
|
||||
vm: vm,
|
||||
loading: false
|
||||
vm.$gzform.deleteAllErrorBoxErrors(vm);
|
||||
vm.$gzapi
|
||||
.remove(url)
|
||||
.then(res => {
|
||||
if (res.error != undefined) {
|
||||
vm.formState.serverError = res.error;
|
||||
vm.$gzform.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
//workaround to prevent warning about leaving dirty record
|
||||
//For some reason I couldn't just reset isdirty in formstate
|
||||
JUST_DELETED = true;
|
||||
// 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);
|
||||
});
|
||||
vm.$gzHandleFormError(error, vm);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -552,7 +487,6 @@ export default {
|
||||
vm.$gzform.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
//Navigate to new record
|
||||
|
||||
vm.$router.push(
|
||||
vm.$gzapi.replaceAfterLastSlash(vm.$route.fullPath, res.data.id)
|
||||
);
|
||||
@@ -564,19 +498,6 @@ export default {
|
||||
});
|
||||
}
|
||||
}
|
||||
// ,
|
||||
// addTag() {
|
||||
// var theTag = this.tagSearchEntry;
|
||||
// theTag = this.$gzutil.normalizeTag(theTag);
|
||||
// //make sure there are no existing of the same tag?
|
||||
// this.pickLists.tags.push(theTag);
|
||||
// this.obj.tags.push(theTag);
|
||||
// this.tagSearchEntry = "";
|
||||
// this.$gzform.setFormState({
|
||||
// vm: this,
|
||||
// dirty: true
|
||||
// });
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -623,15 +544,10 @@ function clickHandler(menuItem) {
|
||||
}
|
||||
}
|
||||
|
||||
//#region Some funcs
|
||||
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
// console.log("Generating menu");
|
||||
// console.log("GENERATE MENU: Rights currently are:");
|
||||
// console.log(vm.rights);
|
||||
var menuOptions = {
|
||||
isMain: false,
|
||||
icon: "fa-splotch",
|
||||
@@ -640,7 +556,6 @@ function generateMenu(vm) {
|
||||
menuItems: []
|
||||
};
|
||||
|
||||
//TODO: save and new? Or only from main?
|
||||
if (vm.rights.change) {
|
||||
menuOptions.menuItems.push({
|
||||
title: vm.$gzlocale.get("Save"),
|
||||
@@ -740,7 +655,6 @@ function fetchLocaleText(vm) {
|
||||
|
||||
return vm.$gzlocale.fetch(ltKeysRequired);
|
||||
}
|
||||
//#endregion
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
||||
Reference in New Issue
Block a user