This commit is contained in:
@@ -74,6 +74,17 @@ export default {
|
||||
delete: false
|
||||
};
|
||||
},
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Get a default FULL rights object for forms that don't really need
|
||||
// to check rights but fits into system for forms in place (e.g. change password)
|
||||
//
|
||||
fullRightsObject() {
|
||||
return {
|
||||
change: true,
|
||||
read: true,
|
||||
delete: true
|
||||
};
|
||||
},
|
||||
/////////////////////////////////
|
||||
// oType is the name of the object type as defined in ayatype.js
|
||||
//
|
||||
|
||||
@@ -17,88 +17,67 @@
|
||||
>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="obj.emailAddress"
|
||||
v-model="obj.loginName"
|
||||
:readonly="formState.readOnly"
|
||||
clearable
|
||||
@click:clear="onChange('emailAddress')"
|
||||
:label="lt('UserEmailAddress')"
|
||||
:error-messages="form().serverErrors(this, 'emailAddress')"
|
||||
ref="emailAddress"
|
||||
@change="onChange('emailAddress')"
|
||||
prepend-icon="fa-user"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
v-focus
|
||||
:label="lt('UserLogin')"
|
||||
:error-messages="form().serverErrors(this, 'loginName')"
|
||||
ref="loginName"
|
||||
@change="onChange('loginName')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="obj.languageOverride"
|
||||
:placeholder="locale().getBrowserFirstLanguage()"
|
||||
v-model="obj.oldPassword"
|
||||
:readonly="formState.readOnly"
|
||||
clearable
|
||||
@click:clear="onChange('languageOverride')"
|
||||
:label="lt('LanguageCode')"
|
||||
:error-messages="form().serverErrors(this, 'languageOverride')"
|
||||
ref="languageOverride"
|
||||
@change="onChange('languageOverride')"
|
||||
:append-outer-icon="reveal ? 'fa-eye' : 'fa-eye-slash'"
|
||||
prepend-icon="fa-key"
|
||||
:label="lt('OldPassword')"
|
||||
:type="reveal ? 'text' : 'password'"
|
||||
:error-messages="form().serverErrors(this, 'oldPassword')"
|
||||
ref="oldPassword"
|
||||
@change="onChange('oldPassword')"
|
||||
@click:append-outer="reveal = !reveal"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="obj.currencyName"
|
||||
hint="e.g. USD, EUR, GBP, AUD, CAD etc"
|
||||
v-model="obj.newPassword"
|
||||
:readonly="formState.readOnly"
|
||||
clearable
|
||||
@click:clear="onChange('currencyName')"
|
||||
:label="lt('CurrencyCode')"
|
||||
:rules="[form().required(this, 'currencyName')]"
|
||||
:error-messages="form().serverErrors(this, 'currencyName')"
|
||||
ref="currencyName"
|
||||
@change="onChange('currencyName')"
|
||||
:append-outer-icon="reveal ? 'fa-eye' : 'fa-eye-slash'"
|
||||
prepend-icon="fa-key"
|
||||
:label="lt('NewPassword')"
|
||||
:type="reveal ? 'text' : 'password'"
|
||||
:error-messages="form().serverErrors(this, 'newPassword')"
|
||||
ref="newPassword"
|
||||
@change="onChange('newPassword')"
|
||||
@click:append-outer="reveal = !reveal"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="obj.timeZoneOverride"
|
||||
:placeholder="locale().getTimeZoneName()"
|
||||
v-model="obj.confirmPassword"
|
||||
:readonly="formState.readOnly"
|
||||
clearable
|
||||
@click:clear="onChange('timeZoneOverride')"
|
||||
:label="lt('TimeZone')"
|
||||
:error-messages="form().serverErrors(this, 'timeZoneOverride')"
|
||||
ref="timeZoneOverride"
|
||||
@change="onChange('timeZoneOverride')"
|
||||
:append-outer-icon="reveal ? 'fa-eye' : 'fa-eye-slash'"
|
||||
prepend-icon="fa-key"
|
||||
:label="lt('ConfirmPassword')"
|
||||
:type="reveal ? 'text' : 'password'"
|
||||
:error-messages="form().serverErrors(this, 'confirmPassword')"
|
||||
ref="confirmPassword"
|
||||
@change="onChange('confirmPassword')"
|
||||
@click:append-outer="reveal = !reveal"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<!-- https://vuetifyjs.com/en/components/color-pickers -->
|
||||
<span class="v-label v-label--active theme--light">
|
||||
{{ lt("UserColor") }}
|
||||
</span>
|
||||
<v-color-picker
|
||||
v-model="obj.uiColor"
|
||||
:readonly="formState.readOnly"
|
||||
hide-mode-switch
|
||||
mode="hexa"
|
||||
:error-messages="form().serverErrors(this, 'uiColor')"
|
||||
ref="uiColor"
|
||||
@input="onChange('uiColor')"
|
||||
></v-color-picker>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-checkbox
|
||||
v-model="obj.hour12"
|
||||
:readonly="formState.readOnly"
|
||||
:label="lt('Hour12')"
|
||||
ref="hour12"
|
||||
:error-messages="form().serverErrors(this, 'hour12')"
|
||||
@change="onChange('hour12')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-col>
|
||||
@@ -111,26 +90,18 @@
|
||||
/* Xeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const FORM_KEY = "home-user-settings";
|
||||
const API_BASE_URL = "Useroptions/";
|
||||
const FORM_CUSTOM_TEMPLATE_KEY = "Useroptions";
|
||||
const FORM_KEY = "home-password";
|
||||
const API_BASE_URL = "Auth/";
|
||||
|
||||
export default {
|
||||
created() {
|
||||
var vm = this;
|
||||
initForm(vm)
|
||||
.then(() => {
|
||||
vm.rights = window.$gz.role.getRights(window.$gz.type.UserOptions);
|
||||
vm.rights = window.$gz.role.fullRightsObject();
|
||||
generateMenu(vm);
|
||||
vm.formState.ready = true;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
//UserOptions never creates a new one so this code is a little different than other forms
|
||||
//NOTE: FOR NOW GOING TO ASSUME THIS FORM WILL ONLY EVER BE USED TO EDIT *CURRENT* USER'S USEROPTIONS
|
||||
//SO NOT FOR EDITING OTHER USERS, WILL ASSUME THE USER EDITOR FORM FOR MANAGEMENT WILL HAVE A COMPACT VERSION
|
||||
//OF THESE SAME FIELDS FOR THAT PURPOSE
|
||||
//SO ALWAYS USER CURRENT LOGGED IN USER ID FOR THIS
|
||||
//id 0 means create a new record don't load one but thats not applicable here
|
||||
|
||||
vm.getDataFromApi();
|
||||
})
|
||||
.catch(err => {
|
||||
vm.formState.ready = true;
|
||||
@@ -156,20 +127,13 @@ export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
||||
// pickLists: {
|
||||
// usertypes: []
|
||||
// },
|
||||
obj: {
|
||||
id: 0,
|
||||
concurrencyToken: 0,
|
||||
emailAddress: null,
|
||||
uiColor: null,
|
||||
languageOverride: null,
|
||||
timeZoneOverride: null,
|
||||
currencyName: null,
|
||||
hour12: null
|
||||
loginName: null,
|
||||
oldPassword: null,
|
||||
newPassword: null,
|
||||
confirmPassword: null
|
||||
},
|
||||
reveal: false,
|
||||
formState: {
|
||||
ready: false,
|
||||
dirty: false,
|
||||
@@ -180,7 +144,7 @@ export default {
|
||||
appError: null,
|
||||
serverError: {}
|
||||
},
|
||||
rights: window.$gz.role.defaultRightsObject()
|
||||
rights: window.$gz.role.fullRightsObject()
|
||||
};
|
||||
},
|
||||
//WATCHERS
|
||||
@@ -223,54 +187,54 @@ export default {
|
||||
window.$gz.form.onChange(this, ref);
|
||||
}
|
||||
},
|
||||
getDataFromApi() {
|
||||
var vm = this;
|
||||
vm.formState.loading = true;
|
||||
//always fetch on this form for the current logged in user id
|
||||
var url = API_BASE_URL + vm.$store.state.userId;
|
||||
// getDataFromApi() {
|
||||
// var vm = this;
|
||||
// vm.formState.loading = true;
|
||||
// //always fetch on this form for the current logged in user id
|
||||
// var url = API_BASE_URL + vm.$store.state.userId;
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
// window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
|
||||
window.$gz.api
|
||||
.get(url)
|
||||
.then(res => {
|
||||
if (res.error != undefined) {
|
||||
//Not found?
|
||||
if (res.error.code == "2010") {
|
||||
//notify not found error then navigate backwards
|
||||
window.$gz.dialog
|
||||
.displayLTErrorMessage("ErrorAPI2010")
|
||||
.then(() => {
|
||||
// navigate backwards
|
||||
vm.$router.go(-1);
|
||||
});
|
||||
}
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.obj = res.data;
|
||||
// window.$gz.api
|
||||
// .get(url)
|
||||
// .then(res => {
|
||||
// if (res.error != undefined) {
|
||||
// //Not found?
|
||||
// if (res.error.code == "2010") {
|
||||
// //notify not found error then navigate backwards
|
||||
// window.$gz.dialog
|
||||
// .displayLTErrorMessage("ErrorAPI2010")
|
||||
// .then(() => {
|
||||
// // navigate backwards
|
||||
// vm.$router.go(-1);
|
||||
// });
|
||||
// }
|
||||
// vm.formState.serverError = res.error;
|
||||
// window.$gz.form.setErrorBoxErrors(vm);
|
||||
// } else {
|
||||
// vm.obj = res.data;
|
||||
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false,
|
||||
readOnly: res.readOnly ? true : false
|
||||
});
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm, res.readOnly);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
loading: false
|
||||
});
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
});
|
||||
},
|
||||
// //Update the form status
|
||||
// window.$gz.form.setFormState({
|
||||
// vm: vm,
|
||||
// dirty: false,
|
||||
// valid: true,
|
||||
// loading: false,
|
||||
// readOnly: res.readOnly ? true : false
|
||||
// });
|
||||
// //modify the menu as necessary
|
||||
// generateMenu(vm);
|
||||
// }
|
||||
// })
|
||||
// .catch(function handleGetDataFromAPIError(error) {
|
||||
// //Update the form status
|
||||
// window.$gz.form.setFormState({
|
||||
// vm: vm,
|
||||
// loading: false
|
||||
// });
|
||||
// window.$gz.errorHandler.handleFormError(error, vm);
|
||||
// });
|
||||
// },
|
||||
submit() {
|
||||
var vm = this;
|
||||
if (vm.canSave) {
|
||||
@@ -340,17 +304,9 @@ function generateMenu(vm) {
|
||||
icon: "key",
|
||||
title: window.$gz.locale.get("SetLoginPassword"),
|
||||
helpUrl: "form-home-password",
|
||||
formData: {
|
||||
ayaType: window.$gz.type.UserOptions
|
||||
},
|
||||
menuItems: []
|
||||
};
|
||||
|
||||
/* isMain: true,
|
||||
icon: "key",
|
||||
title: window.$gz.locale.get("SetLoginPassword"),
|
||||
helpUrl: "form-home-password" */
|
||||
|
||||
if (vm.rights.change) {
|
||||
menuOptions.menuItems.push({
|
||||
title: window.$gz.locale.get("Save"),
|
||||
@@ -361,14 +317,6 @@ function generateMenu(vm) {
|
||||
});
|
||||
}
|
||||
|
||||
//change password and login
|
||||
menuOptions.menuItems.push({
|
||||
title: window.$gz.locale.get("SetLoginPassword"),
|
||||
icon: "key",
|
||||
data: "home-password",
|
||||
key: "app:nav"
|
||||
});
|
||||
|
||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||
}
|
||||
|
||||
@@ -380,8 +328,6 @@ function initForm(vm) {
|
||||
(async function() {
|
||||
try {
|
||||
await fetchUILocalizedText(vm);
|
||||
// await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY);
|
||||
// await populatePickLists(vm);
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
@@ -396,25 +342,10 @@ function initForm(vm) {
|
||||
//
|
||||
function fetchUILocalizedText(vm) {
|
||||
return window.$gz.locale.fetch([
|
||||
"CurrencyCode",
|
||||
"LanguageCode",
|
||||
"TimeZone",
|
||||
"UserEmailAddress",
|
||||
"Hour12",
|
||||
"UserColor",
|
||||
"BrowserDefault"
|
||||
"UserLogin",
|
||||
"OldPassword",
|
||||
"NewPassword",
|
||||
"ConfirmPassword"
|
||||
]);
|
||||
}
|
||||
|
||||
// //////////////////////
|
||||
// //
|
||||
// //
|
||||
// function populatePickLists(vm) {
|
||||
// //ensure the pick lists required are pre-fetched
|
||||
// return window.$gz.enums.fetchEnumList("usertype").then(() => {
|
||||
// vm.pickLists.usertypes = window.$gz.enums.getPickList("usertype");
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
||||
@@ -259,7 +259,7 @@ export default {
|
||||
readOnly: res.readOnly ? true : false
|
||||
});
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm, res.readOnly);
|
||||
generateMenu(vm);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
@@ -396,8 +396,7 @@ function fetchUILocalizedText(vm) {
|
||||
"TimeZone",
|
||||
"UserEmailAddress",
|
||||
"Hour12",
|
||||
"UserColor",
|
||||
"BrowserDefault"
|
||||
"UserColor"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ export default {
|
||||
readOnly: res.readOnly ? true : false
|
||||
});
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm, res.readOnly);
|
||||
generateMenu(vm);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
|
||||
Reference in New Issue
Block a user