This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
<template>
|
||||
<v-container fluid>
|
||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
||||
<h2 class="red--text" v-if="$ay.dev">
|
||||
todo: revisit after add customer, ho, to support usertypes
|
||||
customer,headoffice TEST SAVE for both types and make sure wont' allow
|
||||
without customer / ho chosen and make sure if not error is clear
|
||||
</h2>
|
||||
|
||||
<v-row v-if="formState.ready">
|
||||
<v-col>
|
||||
<v-form ref="form">
|
||||
@@ -22,9 +18,10 @@
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().Customer"
|
||||
:showEditIcon="true"
|
||||
:includeInactive="true"
|
||||
v-model="obj.customerId"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:readonly="true"
|
||||
:disabled="true"
|
||||
:label="$ay.t('Customer')"
|
||||
ref="customerId"
|
||||
data-cy="customerId"
|
||||
@@ -43,9 +40,10 @@
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().HeadOffice"
|
||||
:showEditIcon="true"
|
||||
:includeInactive="true"
|
||||
v-model="obj.headOfficeId"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:readonly="true"
|
||||
:disabled="true"
|
||||
:label="$ay.t('HeadOffice')"
|
||||
ref="headOfficeId"
|
||||
data-cy="headOfficeId"
|
||||
@@ -101,29 +99,6 @@
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UserType')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-select
|
||||
v-model="obj.userType"
|
||||
:items="selectLists.usertypes"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserType')"
|
||||
ref="usertype"
|
||||
data-cy="usertype"
|
||||
:rules="[form().integerValid(this, 'usertype')]"
|
||||
:error-messages="form().serverErrors(this, 'usertype')"
|
||||
@input="fieldValueChanged('usertype')"
|
||||
></v-select>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
name="username"
|
||||
@@ -277,6 +252,15 @@ export default {
|
||||
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
||||
}
|
||||
} else {
|
||||
/* Customer = 3,
|
||||
HeadOffice = 4, */
|
||||
if (vm.$route.params.customerid != 0) {
|
||||
vm.obj.customerId = vm.$route.params.customerid;
|
||||
vm.obj.userType = 3;
|
||||
} else if (vm.$route.params.headofficeid != 0) {
|
||||
vm.obj.headOfficeId = vm.$route.params.headofficeid;
|
||||
vm.obj.userType = 4;
|
||||
}
|
||||
vm.formState.loading = false; //here we handle it immediately
|
||||
}
|
||||
//set initial form status
|
||||
@@ -653,7 +637,7 @@ function generateMenu(vm) {
|
||||
let menuOptions = {
|
||||
isMain: false,
|
||||
icon: "$ayiUser",
|
||||
title: "User",
|
||||
title: "Contact",
|
||||
helpUrl: "form-adm-user",
|
||||
formData: {
|
||||
ayaType: window.$gz.type.User,
|
||||
@@ -739,7 +723,7 @@ let JUST_DELETED = false;
|
||||
async function initForm(vm) {
|
||||
await fetchTranslatedText(vm);
|
||||
await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY);
|
||||
await populateSelectionLists(vm);
|
||||
//await populateSelectionLists(vm);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
@@ -748,7 +732,7 @@ async function initForm(vm) {
|
||||
//
|
||||
async function fetchTranslatedText(vm) {
|
||||
await window.$gz.translation.cacheTranslations([
|
||||
"User",
|
||||
"Contact",
|
||||
"Name",
|
||||
"Customer",
|
||||
"HeadOffice",
|
||||
@@ -777,14 +761,14 @@ async function fetchTranslatedText(vm) {
|
||||
]);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
async function populateSelectionLists(vm) {
|
||||
//ensure the pick lists required are pre-fetched
|
||||
await window.$gz.enums.fetchEnumList("outsideusertype");
|
||||
vm.selectLists.usertypes = window.$gz.enums.getSelectionList(
|
||||
"outsideusertype"
|
||||
);
|
||||
}
|
||||
// //////////////////////
|
||||
// //
|
||||
// //
|
||||
// async function populateSelectionLists(vm) {
|
||||
// //ensure the pick lists required are pre-fetched
|
||||
// await window.$gz.enums.fetchEnumList("outsideusertype");
|
||||
// vm.selectLists.usertypes = window.$gz.enums.getSelectionList(
|
||||
// "outsideusertype"
|
||||
// );
|
||||
// }
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user