This commit is contained in:
2023-01-06 23:24:26 +00:00
parent 96e7809650
commit 8ff7956a0f
3 changed files with 188 additions and 126 deletions

View File

@@ -242,6 +242,13 @@ export default {
});
break;
case socktype.License:
vm.$router.push({
name: "license-edit",
params: { recordid: tid.id }
});
break;
case socktype.TrialLicenseRequest:
vm.$router.push({
name: "trial-request-edit",

View File

@@ -6,139 +6,176 @@
<v-form ref="form">
<v-row dense>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="companyName"
v-model="obj.companyName"
<v-select
ref="pGroup"
v-model="obj.pGroup"
dense
:items="selectLists.pGroups"
item-text="name"
item-value="id"
:readonly="formState.readOnly"
:label="$sock.t('TrialLicenseRequestCompanyName')"
:rules="[form().required(this, 'companyName')]"
:error-messages="form().serverErrors(this, 'companyName')"
data-cy="companyName"
@input="fieldValueChanged('companyName')"
></v-text-field>
:label="$sock.t('ProductGroup')"
data-cy="pGroup"
:rules="[form().integerValid(this, 'pGroup')]"
:error-messages="form().serverErrors(this, 'pGroup')"
@input="fieldValueChanged('pGroup')"
></v-select>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="contactName"
v-model="obj.contactName"
dense
<gz-date-time-picker
ref="created"
v-model="obj.created"
:label="$sock.t('Created')"
:rules="[form().required(this, 'created')]"
:readonly="formState.readOnly"
:label="$sock.t('TrialLicenseRequestContactName')"
:rules="[form().required(this, 'contactName')]"
:error-messages="form().serverErrors(this, 'contactName')"
data-cy="contactName"
@input="fieldValueChanged('contactName')"
></v-text-field>
:error-messages="form().serverErrors(this, 'created')"
data-cy="created"
@input="fieldValueChanged('created')"
></gz-date-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-pick-list
ref="customerId"
v-model="obj.customerId"
:aya-type="sockTypes().Customer"
show-edit-icon
:readonly="formState.readOnly"
:label="$sock.t('Customer')"
:error-messages="form().serverErrors(this, 'customerId')"
@input="fieldValueChanged('customerId')"
></gz-pick-list>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="dbId"
v-model="obj.dbId"
ref="regTo"
v-model="obj.regTo"
dense
:readonly="formState.readOnly"
:label="$sock.t('DatabaseID')"
:rules="[form().required(this, 'dbId')]"
:error-messages="form().serverErrors(this, 'dbId')"
data-cy="dbId"
@input="fieldValueChanged('dbId')"
:label="$sock.t('LicenseRegTo')"
:rules="[form().required(this, 'regTo')]"
:error-messages="form().serverErrors(this, 'regTo')"
data-cy="regTo"
@input="fieldValueChanged('regTo')"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-email
ref="email"
v-model="obj.email"
ref="fetchEmail"
v-model="obj.fetchEmail"
:readonly="formState.readOnly"
:label="$sock.t('TrialLicenseRequestEmail')"
data-cy="email"
:error-messages="form().serverErrors(this, 'email')"
@input="fieldValueChanged('email')"
:label="$sock.t('LicenseFetchEmail')"
data-cy="fetchEmail"
:error-messages="form().serverErrors(this, 'fetchEmail')"
@input="fieldValueChanged('fetchEmail')"
></gz-email>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
ref="licenseExpire"
v-model="obj.licenseExpire"
:label="$sock.t('LicenseExpiration')"
:readonly="formState.readOnly"
:error-messages="form().serverErrors(this, 'licenseExpire')"
data-cy="licenseExpire"
@input="fieldValueChanged('licenseExpire')"
></gz-date-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
ref="maintenanceExpire"
v-model="obj.maintenanceExpire"
:label="$sock.t('LicenseMaintenanceExpire')"
:rules="[form().required(this, 'maintenanceExpire')]"
:readonly="formState.readOnly"
:error-messages="form().serverErrors(this, 'maintenanceExpire')"
data-cy="maintenanceExpire"
@input="fieldValueChanged('maintenanceExpire')"
></gz-date-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
ref="emailValidated"
v-model="obj.emailValidated"
ref="active"
v-model="obj.active"
dense
readonly
:label="$sock.t('TrialLicenseRequestEmailValidated')"
data-cy="emailValidated"
:error-messages="form().serverErrors(this, 'emailValidated')"
@change="fieldValueChanged('emailValidated')"
:readonly="formState.readOnly"
:label="$sock.t('Active')"
data-cy="active"
:error-messages="form().serverErrors(this, 'active')"
@change="fieldValueChanged('active')"
></v-checkbox>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
ref="requested"
v-model="obj.requested"
:label="$sock.t('TrialLicenseRequestRequested')"
readonly
></gz-date-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
ref="processed"
v-model="obj.processed"
:label="$sock.t('TrialLicenseRequestProcessed')"
readonly
></gz-date-time-picker>
</v-col>
<template v-if="obj.pGroup == 0">
<v-col cols="12">
<div class="text-h1 error--text">
DO NOT USE, NOT A VALID PRODUCT GROUP
</div>
</v-col>
</template>
<template v-if="obj.pGroup == 1">
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="fetchCode"
v-model="obj.fetchCode"
dense
:readonly="formState.readOnly"
:label="$sock.t('LicenseFetchCode')"
:rules="[form().required(this, 'fetchCode')]"
:error-messages="form().serverErrors(this, 'fetchCode')"
data-cy="fetchCode"
@input="fieldValueChanged('fetchCode')"
></v-text-field>
</v-col>
</template>
<template v-if="obj.pGroup == 2">
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="dbId"
v-model="obj.dbId"
dense
:readonly="formState.readOnly"
:label="$sock.t('DatabaseID')"
:rules="[form().required(this, 'dbId')]"
:error-messages="form().serverErrors(this, 'dbId')"
data-cy="dbId"
@input="fieldValueChanged('dbId')"
></v-text-field>
</v-col>
</template>
<template v-if="obj.pGroup == 3">
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="dbId"
v-model="obj.dbId"
dense
:readonly="formState.readOnly"
:label="$sock.t('DatabaseID')"
:rules="[form().required(this, 'dbId')]"
:error-messages="form().serverErrors(this, 'dbId')"
data-cy="dbId"
@input="fieldValueChanged('dbId')"
></v-text-field>
</v-col>
</template>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
ref="fetchedOn"
v-model="obj.fetchedOn"
:label="$sock.t('TrialLicenseRequestFetchedOn')"
:rules="[form().required(this, 'fetchedOn')]"
:readonly="formState.readOnly"
:label="$sock.t('LicenseFetchedOn')"
:error-messages="form().serverErrors(this, 'fetchedOn')"
data-cy="fetchedOn"
@input="fieldValueChanged('fetchedOn')"
></gz-date-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-select
ref="status"
v-model="obj.status"
dense
:items="selectLists.trailRequestStatus"
item-text="name"
item-value="id"
readonly
:label="$sock.t('TrialLicenseRequestStatus')"
data-cy="status"
></v-select>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
ref="perpetual"
v-model="obj.perpetual"
dense
readonly
:label="$sock.t('TrialLicenseRequestPerpetual')"
></v-checkbox>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="rejectReason"
v-model="obj.rejectReason"
dense
:readonly="formState.readOnly"
:label="$sock.t('TrialLicenseRequestRejectReason')"
:error-messages="form().serverErrors(this, 'rejectReason')"
data-cy="rejectReason"
@input="fieldValueChanged('rejectReason')"
></v-text-field>
</v-col>
<v-col v-if="form().showMe(this, 'SubServerNotes')" cols="12">
<v-col cols="12">
<v-textarea
ref="key"
v-model="obj.key"
@@ -148,7 +185,6 @@
auto-grow
></v-textarea>
</v-col>
<!-- --------------------------------- -->
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
@@ -161,6 +197,17 @@
@input="fieldValueChanged('tags')"
></gz-tag-picker>
</v-col>
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
<gz-wiki
ref="wiki"
v-model="obj.wiki"
:aya-type="sockType"
:aya-id="obj.id"
:readonly="formState.readOnly"
@input="fieldValueChanged('wiki')"
></gz-wiki
></v-col>
</v-row>
</v-form>
</div>
@@ -170,9 +217,9 @@
</div>
</template>
<script>
const FORM_KEY = "trial-license-request-edit";
const API_BASE_URL = "trial-license-request/";
const FORM_CUSTOM_TEMPLATE_KEY = "TrialLicenseRequest";
const FORM_KEY = "license-edit";
const API_BASE_URL = "license/";
const FORM_CUSTOM_TEMPLATE_KEY = "License";
export default {
data() {
return {
@@ -180,23 +227,23 @@ export default {
obj: {
id: 0,
concurrency: 0,
dbId: null,
companyName: null,
contactName: null,
email: null,
emailConfirmCode: null,
emailValidated: false,
requested: null,
processed: null,
status: 0,
rejectReason: null,
created: window.$gz.locale.nowUTC8601String(),
active: false, //here, active means it's ready for pickup
customerId: null,
pGroup: 1, //default v7 since manually probably most common
regTo: null,
key: null,
fetchedOn: null,
perpetual: true,
fetchCode: null,
fetchEmail: null,
fetchedOn: null, //here, non null fetchedOn is read only
dbId: null,
licenseExpire: null,
maintenanceExpire: null,
wiki: null,
tags: []
},
selectLists: {
trailRequestStatus: []
pGroups: []
},
formState: {
ready: false,
@@ -209,7 +256,7 @@ export default {
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(),
sockType: window.$gz.type.TrialLicenseRequest
sockType: window.$gz.type.License
};
},
watch: {
@@ -246,9 +293,7 @@ export default {
const vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(
window.$gz.type.TrialLicenseRequest
);
vm.rights = window.$gz.role.getRights(window.$gz.type.License);
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
//---------------------------------
@@ -280,6 +325,9 @@ export default {
dirty: setDirty,
valid: true
});
if (this.obj.fetchedOn != null) {
this.formState.readOnly = true;
}
//----------------------------
generateMenu(vm);
} catch (error) {
@@ -316,6 +364,15 @@ export default {
return window.$gz.form;
},
fieldValueChanged(ref) {
if (ref == "fetchedOn") {
console.log("FETCHED ON CHANGED", this.obj.fetchedOn);
window.$gz.form.setFormState({
vm: this,
readOnly: this.obj.fetchedOn != null
});
console.log("formstate is now ", this.formState);
}
if (
this.formState.ready &&
!this.formState.loading &&
@@ -381,7 +438,7 @@ export default {
//POST
vm.obj = res.data;
this.$router.replace({
name: "trial-request-edit",
name: "license-edit",
params: {
recordid: res.data.id,
obj: res.data
@@ -445,7 +502,7 @@ export default {
},
duplicate() {
this.$router.push({
name: "trial-request-edit",
name: "license-edit",
params: {
recordid: 0,
obj: this.obj
@@ -473,7 +530,7 @@ async function clickHandler(menuItem) {
{
const res = await m.vm.$refs.reportSelector.open(
{
AType: window.$gz.type.TrialLicenseRequest,
AType: window.$gz.type.License,
selectedRowIds: [m.vm.obj.id]
},
m.id
@@ -502,9 +559,9 @@ function generateMenu(vm) {
isMain: false,
readOnly: vm.formState.readOnly,
icon: "$sockiHandHoldingWater",
title: "TrialLicenseRequest",
title: "License",
formData: {
sockType: window.$gz.type.TrialLicenseRequest,
sockType: window.$gz.type.License,
recordId: vm.$route.params.recordid,
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
recordName: vm.obj.name
@@ -601,10 +658,8 @@ async function fetchTranslatedText() {
//
async function populateSelectionLists(vm) {
//ensure the pick lists required are pre-fetched
await window.$gz.enums.fetchEnumList("trialrequeststatus");
vm.selectLists.trailRequestStatus = window.$gz.enums.getSelectionList(
"trialrequeststatus"
);
await window.$gz.enums.fetchEnumList("productgroup");
vm.selectLists.pGroups = window.$gz.enums.getSelectionList("productgroup");
}
/*
"CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMPTZ NOT NULL, active BOOL NOT NULL DEFAULT false, "

View File

@@ -138,7 +138,7 @@
@input="fieldValueChanged('rejectReason')"
></v-text-field>
</v-col>
<v-col v-if="form().showMe(this, 'SubServerNotes')" cols="12">
<v-col cols="12">
<v-textarea
ref="key"
v-model="obj.key"