Final (?) de-widgetification
This commit is contained in:
@@ -22,7 +22,7 @@ Test protocol for latest build:
|
|||||||
- RESULTS: I would say leave all in as they each will display somethign useful on different platforms.
|
- RESULTS: I would say leave all in as they each will display somethign useful on different platforms.
|
||||||
|
|
||||||
- TIME INPUT UTC HONOURED? Date time input fucked:
|
- TIME INPUT UTC HONOURED? Date time input fucked:
|
||||||
- Selected 420 in the widget edit form but it shows as 11:20 on the main list, translation time issue
|
- Selected 420 in the customer edit form but it shows as 11:20 on the main list, translation time issue
|
||||||
- Retest on desktop, probably a general date time conversion bug
|
- Retest on desktop, probably a general date time conversion bug
|
||||||
|
|
||||||
- 404 WORKS ON ALL DEVICES DISPLAYS PROPERLY
|
- 404 WORKS ON ALL DEVICES DISPLAYS PROPERLY
|
||||||
@@ -63,13 +63,13 @@ EDGE desktop
|
|||||||
- Broken rules work
|
- Broken rules work
|
||||||
- Navigate via menu then press back goes back to last form properly?
|
- Navigate via menu then press back goes back to last form properly?
|
||||||
- About then back to form or main inventory home etc
|
- About then back to form or main inventory home etc
|
||||||
- Widget form
|
- customer form
|
||||||
- translation showing properly on form
|
- translation showing properly on form
|
||||||
- Numeric inputs show numeric keyboard on mobile
|
- Numeric inputs show numeric keyboard on mobile
|
||||||
- Calendar selects date and time or is that still fucky on some platforms?
|
- Calendar selects date and time or is that still fucky on some platforms?
|
||||||
- Rights work properly
|
- Rights work properly
|
||||||
- Test as manager
|
- Test as manager
|
||||||
- Test widget form under full, edit own and readonly and no rights, confirm it works
|
- Test customer form under full, edit own and readonly and no rights, confirm it works
|
||||||
- Roles: Change = AuthorizationRoles.BizAdmin | AuthorizationRoles.Inventory, EditOwn = AuthorizationRoles.Tech, ReadRecord = AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.InventoryRestricted
|
- Roles: Change = AuthorizationRoles.BizAdmin | AuthorizationRoles.Inventory, EditOwn = AuthorizationRoles.Tech, ReadRecord = AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.InventoryRestricted
|
||||||
- 401 redirect to login
|
- 401 redirect to login
|
||||||
- 403 should redirect to prior form (no rights SubContractorRestricted)
|
- 403 should redirect to prior form (no rights SubContractorRestricted)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ todo:1 grid position not preserved when open a record then track back
|
|||||||
this is very important that it work correctly
|
this is very important that it work correctly
|
||||||
I *did* code this so it should actually be working, not sure why it isn't but the code is probably all there.
|
I *did* code this so it should actually be working, not sure why it isn't but the code is probably all there.
|
||||||
|
|
||||||
|
todo: test bulk ops on wo/quote/pm tagging or something, had widget code in it that I just switched to wo/quote/pm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export default {
|
|||||||
NoType: 0,
|
NoType: 0,
|
||||||
Global: 1,
|
Global: 1,
|
||||||
//corebizobject
|
//corebizobject
|
||||||
Widget: 2,
|
UNUSED_2: 2,
|
||||||
//corebizobject
|
//corebizobject
|
||||||
User: 3,
|
User: 3,
|
||||||
ServerState: 4,
|
ServerState: 4,
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ export default {
|
|||||||
GlobalOps: { Change: 16384, ReadFullRecord: 8192, Select: 0 },
|
GlobalOps: { Change: 16384, ReadFullRecord: 8192, Select: 0 },
|
||||||
User: { Change: 2, ReadFullRecord: 1, Select: 131071 },
|
User: { Change: 2, ReadFullRecord: 1, Select: 131071 },
|
||||||
UserOptions: { Change: 2, ReadFullRecord: 1, Select: 0 },
|
UserOptions: { Change: 2, ReadFullRecord: 1, Select: 0 },
|
||||||
Widget: { Change: 34, ReadFullRecord: 17, Select: 131071 },
|
|
||||||
ServerState: { Change: 16384, ReadFullRecord: 131071, Select: 0 },
|
ServerState: { Change: 16384, ReadFullRecord: 131071, Select: 0 },
|
||||||
License: { Change: 2, ReadFullRecord: 1, Select: 0 },
|
License: { Change: 2, ReadFullRecord: 1, Select: 0 },
|
||||||
TrialSeeder: { Change: 16386, ReadFullRecord: 8193, Select: 0 },
|
TrialSeeder: { Change: 16386, ReadFullRecord: 8193, Select: 0 },
|
||||||
|
|||||||
@@ -487,7 +487,6 @@ export default {
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// USER REQUIRED FIELDS
|
// USER REQUIRED FIELDS
|
||||||
// (Fields defined by AyaNova users as required on form that are not stock required already)
|
// (Fields defined by AyaNova users as required on form that are not stock required already)
|
||||||
// (was using this in testing on widget form notes field but not sure where else it's applicable)
|
|
||||||
userRequiredFields(vm, ref, formCustomTemplateFieldName) {
|
userRequiredFields(vm, ref, formCustomTemplateFieldName) {
|
||||||
if (vm.formState.loading) {
|
if (vm.formState.loading) {
|
||||||
return true;
|
return true;
|
||||||
@@ -542,14 +541,6 @@ export default {
|
|||||||
// For now the only rule is that they can be required or not
|
// For now the only rule is that they can be required or not
|
||||||
//
|
//
|
||||||
customFieldsCheck(vm, templateItem, subvm, fieldName) {
|
customFieldsCheck(vm, templateItem, subvm, fieldName) {
|
||||||
//templateItem sample
|
|
||||||
// dataKey: "c2"
|
|
||||||
// fld: "WidgetCustom2"
|
|
||||||
// hide: "false"
|
|
||||||
// required: true
|
|
||||||
// type: "text"
|
|
||||||
// debugger;
|
|
||||||
|
|
||||||
if (vm.formState.loading) {
|
if (vm.formState.loading) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,8 +419,6 @@ export default {
|
|||||||
return "$ayiGenderless";
|
return "$ayiGenderless";
|
||||||
case window.$gz.type.Global:
|
case window.$gz.type.Global:
|
||||||
return "$ayiGlobe";
|
return "$ayiGlobe";
|
||||||
case window.$gz.type.Widget:
|
|
||||||
return "$ayiVial";
|
|
||||||
case window.$gz.type.User:
|
case window.$gz.type.User:
|
||||||
return "$ayiUser";
|
return "$ayiUser";
|
||||||
case window.$gz.type.ServerState:
|
case window.$gz.type.ServerState:
|
||||||
|
|||||||
@@ -727,11 +727,6 @@ function initNavPanel() {
|
|||||||
addNavItem("Operations", "$ayiServer", undefined, sub, key++, "operations");
|
addNavItem("Operations", "$ayiServer", undefined, sub, key++, "operations");
|
||||||
}
|
}
|
||||||
|
|
||||||
// //############ WIDGETS (TOP GROUP)
|
|
||||||
// if (window.$gz.role.canOpen(window.$gz.type.Widget)) {
|
|
||||||
// addNavItem("WidgetList", "$ayiVial", "/widgets", [], key++, "widgets");
|
|
||||||
// }
|
|
||||||
|
|
||||||
//*** EVALUATION active trial license should always go to evaluation as home page
|
//*** EVALUATION active trial license should always go to evaluation as home page
|
||||||
//as long as they are a normal User type and not a subcontractor type
|
//as long as they are a normal User type and not a subcontractor type
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -219,12 +219,7 @@ export default {
|
|||||||
params: { recordid: tid.id }
|
params: { recordid: tid.id }
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ayatype.Widget:
|
|
||||||
vm.$router.push({
|
|
||||||
name: "widget-edit",
|
|
||||||
params: { recordid: tid.id }
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case ayatype.User:
|
case ayatype.User:
|
||||||
//Is it an "Inside" user (staff or subcontractor)
|
//Is it an "Inside" user (staff or subcontractor)
|
||||||
//or an "outside" user (customer or headoffice)
|
//or an "outside" user (customer or headoffice)
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ export default {
|
|||||||
"PartInventoryTransactionList",
|
"PartInventoryTransactionList",
|
||||||
"PartWarehouseList",
|
"PartWarehouseList",
|
||||||
"PurchaseOrderUIRestockList",
|
"PurchaseOrderUIRestockList",
|
||||||
"WidgetList",
|
|
||||||
"VendorList",
|
"VendorList",
|
||||||
"AdministrationGlobalSettings",
|
"AdministrationGlobalSettings",
|
||||||
"HelpLicense",
|
"HelpLicense",
|
||||||
|
|||||||
@@ -600,7 +600,6 @@ async function populateFieldDefinitions(vm) {
|
|||||||
vm.fieldDefinitions = JSON.parse(ss);
|
vm.fieldDefinitions = JSON.parse(ss);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//http://localhost:7575/api/v8/data-list/listfields?DataListKey=TestWidgetDataList
|
|
||||||
let res = await window.$gz.api.get(
|
let res = await window.$gz.api.get(
|
||||||
"data-list/listfields?DataListKey=" + vm.dataListKey
|
"data-list/listfields?DataListKey=" + vm.dataListKey
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1272,7 +1272,6 @@ async function initForm(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
async function fetchSavedFilterList(vm) {
|
async function fetchSavedFilterList(vm) {
|
||||||
//http://localhost:7575/api/v8/data-list-filter/list?ListKey=TestWidgetDataList
|
|
||||||
let res = await window.$gz.api.get(
|
let res = await window.$gz.api.get(
|
||||||
"data-list-filter/list?ListKey=" + vm.dataListKey
|
"data-list-filter/list?ListKey=" + vm.dataListKey
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1083,22 +1083,6 @@ export default new Router({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//TEST TEST TEST TEST TEST
|
|
||||||
// {
|
|
||||||
// //NEW TEST GZ DATA TABLE
|
|
||||||
// path: "/widgets",
|
|
||||||
// name: "widget-list",
|
|
||||||
// component: () =>
|
|
||||||
// import(/* webpackChunkName: "widget" */ "./views/widgets.vue")
|
|
||||||
// },
|
|
||||||
|
|
||||||
// {
|
|
||||||
// //TEST WIDGET EDIT FORM
|
|
||||||
// path: "/widgets/:recordid",
|
|
||||||
// name: "widget-edit",
|
|
||||||
// component: () =>
|
|
||||||
// import(/* webpackChunkName: "widget" */ "./views/widget.vue")
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: "/ay-evaluate",
|
path: "/ay-evaluate",
|
||||||
name: "ay-evaluate",
|
name: "ay-evaluate",
|
||||||
|
|||||||
@@ -384,7 +384,6 @@ async function fetchTranslatedText(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
async function populateFieldDefinitions(vm) {
|
async function populateFieldDefinitions(vm) {
|
||||||
//http://localhost:7575/api/v8/data-list/listfields?DataListKey=TestWidgetDataList
|
|
||||||
let res = await window.$gz.api.get(
|
let res = await window.$gz.api.get(
|
||||||
"data-list/listfields?DataListKey=" + vm.dataListKey
|
"data-list/listfields?DataListKey=" + vm.dataListKey
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//"[{\"fld\": \"widgetname\",\"filter\": {\"any\":false,\"items\": [{\"op\": \"%-\",\"value\": \"Awesome\"}]}},{\"fld\":\"widgetserial\"},{\"fld\":\"widgetdollaramount\"},{\"fld\":\"widgetusertype\"},{\"fld\":\"widgetstartdate\"},{\"fld\":\"widgetactive\"},{\"fld\":\"username\"},{\"fld\":\"widgettags\"},{\"fld\":\"widgetcustom1\"},{\"fld\":\"widgetcustom2\"}]"
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,798 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
|
||||||
|
|
||||||
<v-row v-if="formState.ready">
|
|
||||||
<v-col>
|
|
||||||
<v-form ref="form">
|
|
||||||
<v-row>
|
|
||||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
||||||
<v-text-field
|
|
||||||
v-model="obj.name"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:label="$ay.t('WidgetName')"
|
|
||||||
:rules="[form().required(this, 'name')]"
|
|
||||||
:error-messages="form().serverErrors(this, 'name')"
|
|
||||||
ref="name"
|
|
||||||
data-cy="name"
|
|
||||||
@input="fieldValueChanged('name')"
|
|
||||||
></v-text-field>
|
|
||||||
</v-col>
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'Serial')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<v-text-field
|
|
||||||
v-model="obj.serial"
|
|
||||||
:readonly="true"
|
|
||||||
:label="$ay.t('WidgetSerial')"
|
|
||||||
data-cy="serial"
|
|
||||||
></v-text-field>
|
|
||||||
</v-col>
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'Count')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<v-text-field
|
|
||||||
v-model="obj.count"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:clearable="!formState.readOnly"
|
|
||||||
@click:clear="fieldValueChanged('count')"
|
|
||||||
:counter="10"
|
|
||||||
:label="$ay.t('WidgetCount')"
|
|
||||||
ref="count"
|
|
||||||
data-cy="count"
|
|
||||||
:rules="[form().integerValid(this, 'count')]"
|
|
||||||
:error-messages="form().serverErrors(this, 'count')"
|
|
||||||
@input="fieldValueChanged('count')"
|
|
||||||
type="number"
|
|
||||||
></v-text-field>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'DollarAmount')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<gz-currency
|
|
||||||
v-model="obj.dollarAmount"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:label="$ay.t('WidgetDollarAmount')"
|
|
||||||
ref="dollarAmount"
|
|
||||||
data-cy="dollarAmount"
|
|
||||||
:rules="[
|
|
||||||
form().decimalValid(this, 'dollarAmount'),
|
|
||||||
form().required(this, 'dollarAmount')
|
|
||||||
]"
|
|
||||||
:error-messages="form().serverErrors(this, 'dollarAmount')"
|
|
||||||
@input="fieldValueChanged('dollarAmount')"
|
|
||||||
></gz-currency>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
||||||
<gz-date-time-picker
|
|
||||||
:label="$ay.t('WidgetStartDate')"
|
|
||||||
v-model="obj.startDate"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
ref="startDate"
|
|
||||||
data-cy="startDate"
|
|
||||||
:error-messages="form().serverErrors(this, 'startDate')"
|
|
||||||
@input="fieldValueChanged('startDate')"
|
|
||||||
></gz-date-time-picker>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
||||||
<gz-date-time-picker
|
|
||||||
:label="$ay.t('WidgetEndDate')"
|
|
||||||
:rules="[form().datePrecedence(this, 'startDate', 'endDate')]"
|
|
||||||
:error-messages="form().serverErrors(this, 'endDate')"
|
|
||||||
v-model="obj.endDate"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
ref="endDate"
|
|
||||||
data-cy="endDate"
|
|
||||||
@input="fieldValueChanged('endDate')"
|
|
||||||
></gz-date-time-picker>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'UserId')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<gz-pick-list
|
|
||||||
:aya-type="ayaTypes().User"
|
|
||||||
show-edit-icon
|
|
||||||
v-model="obj.userId"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:label="$ay.t('User')"
|
|
||||||
ref="userid"
|
|
||||||
data-cy="userid"
|
|
||||||
:error-messages="form().serverErrors(this, 'userid')"
|
|
||||||
@input="fieldValueChanged('userid')"
|
|
||||||
></gz-pick-list>
|
|
||||||
</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"
|
|
||||||
: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-checkbox
|
|
||||||
v-model="obj.active"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:label="$ay.t('Active')"
|
|
||||||
ref="active"
|
|
||||||
data-cy="active"
|
|
||||||
:error-messages="form().serverErrors(this, 'active')"
|
|
||||||
@change="fieldValueChanged('active')"
|
|
||||||
></v-checkbox>
|
|
||||||
</v-col>
|
|
||||||
<!-- ------------------------------------- -->
|
|
||||||
<v-col v-if="form().showMe(this, 'Notes')" cols="12">
|
|
||||||
<v-textarea
|
|
||||||
v-model="obj.notes"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:label="$ay.t('WidgetNotes')"
|
|
||||||
:error-messages="form().serverErrors(this, 'notes')"
|
|
||||||
ref="notes"
|
|
||||||
data-cy="notes"
|
|
||||||
@input="fieldValueChanged('notes')"
|
|
||||||
auto-grow
|
|
||||||
:clearable="!formState.readOnly"
|
|
||||||
></v-textarea>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
|
|
||||||
<gz-tag-picker
|
|
||||||
v-model="obj.tags"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
ref="tags"
|
|
||||||
data-cy="tags"
|
|
||||||
:error-messages="form().serverErrors(this, 'tags')"
|
|
||||||
@input="fieldValueChanged('tags')"
|
|
||||||
></gz-tag-picker>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<gz-custom-fields
|
|
||||||
v-model="obj.customFields"
|
|
||||||
:form-key="formCustomTemplateKey"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:parent-v-m="this"
|
|
||||||
ref="customFields"
|
|
||||||
data-cy="customFields"
|
|
||||||
:error-messages="form().serverErrors(this, 'customFields')"
|
|
||||||
@input="fieldValueChanged('customFields')"
|
|
||||||
></gz-custom-fields>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
|
|
||||||
<gz-wiki
|
|
||||||
:aya-type="ayaType"
|
|
||||||
:aya-id="obj.id"
|
|
||||||
ref="wiki"
|
|
||||||
v-model="obj.wiki"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
@input="fieldValueChanged('wiki')"
|
|
||||||
></gz-wiki
|
|
||||||
></v-col>
|
|
||||||
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'Attachments') && obj.id"
|
|
||||||
cols="12"
|
|
||||||
>
|
|
||||||
<gz-attachments
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:aya-type="ayaType"
|
|
||||||
:aya-id="obj.id"
|
|
||||||
></gz-attachments
|
|
||||||
></v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-form>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-overlay :value="!formState.ready || formState.loading">
|
|
||||||
<v-progress-circular indeterminate :size="64" />
|
|
||||||
</v-overlay>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/* Xeslint-disable */
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
const FORM_KEY = "widget-edit";
|
|
||||||
const API_BASE_URL = "widget/";
|
|
||||||
const FORM_CUSTOM_TEMPLATE_KEY = "Widget"; //<-- Should always be CoreBizObject AyaType name here where possible
|
|
||||||
|
|
||||||
export default {
|
|
||||||
async created() {
|
|
||||||
let vm = this;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await initForm(vm);
|
|
||||||
|
|
||||||
vm.rights = window.$gz.role.getRights(window.$gz.type.Widget);
|
|
||||||
vm.formState.readOnly = !vm.rights.change;
|
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
|
||||||
|
|
||||||
// //id 0 means create or duplicate to new
|
|
||||||
// if (vm.$route.params.recordid != 0) {
|
|
||||||
// //is there already an obj from a prior operation?
|
|
||||||
// if (this.$route.params.obj) {
|
|
||||||
// //yes, no need to fetch it
|
|
||||||
// this.obj = this.$route.params.obj;
|
|
||||||
// window.$gz.form.setFormState({
|
|
||||||
// vm: vm,
|
|
||||||
// loading: false
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// //----------------------------------------------------------
|
|
||||||
// //NEW OBJECT DEFAULTS
|
|
||||||
// let defaultDates = window.$gz.locale.defaultStartDateTime(
|
|
||||||
// window.$gz.type.Widget
|
|
||||||
// );
|
|
||||||
// vm.obj.startDate = defaultDates.start;
|
|
||||||
// vm.obj.endDate = defaultDates.end;
|
|
||||||
// //----------------------------------------------------------
|
|
||||||
// window.$gz.form.setFormState({
|
|
||||||
// vm: vm,
|
|
||||||
// loading: false
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// window.$gz.form.setFormState({
|
|
||||||
// vm: vm,
|
|
||||||
// dirty: false,
|
|
||||||
// valid: true
|
|
||||||
// });
|
|
||||||
|
|
||||||
let setDirty = false;
|
|
||||||
let setValid = true;
|
|
||||||
|
|
||||||
//id 0 means create or duplicate to new
|
|
||||||
if (vm.$route.params.recordid != 0) {
|
|
||||||
//is there already an obj from a prior operation?
|
|
||||||
if (this.$route.params.obj) {
|
|
||||||
//yes, no need to fetch it
|
|
||||||
this.obj = this.$route.params.obj;
|
|
||||||
} else {
|
|
||||||
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//Might be a duplicate and contain another record
|
|
||||||
if (this.$route.params.obj) {
|
|
||||||
this.obj = this.$route.params.obj;
|
|
||||||
this.obj.concurrency = undefined;
|
|
||||||
this.obj.id = 0;
|
|
||||||
this.obj.name = `${this.obj.name} - ${window.$gz.translation.get(
|
|
||||||
"Copy"
|
|
||||||
)}`;
|
|
||||||
setDirty = true;
|
|
||||||
} else {
|
|
||||||
//----------------------------------------------------------
|
|
||||||
//NEW OBJECT DEFAULTS
|
|
||||||
let defaultDates = window.$gz.locale.defaultStartDateTime(
|
|
||||||
window.$gz.type.Widget
|
|
||||||
);
|
|
||||||
vm.obj.startDate = defaultDates.start;
|
|
||||||
vm.obj.endDate = defaultDates.end;
|
|
||||||
//----------------------------------------------------------
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: false,
|
|
||||||
dirty: setDirty,
|
|
||||||
valid: setValid
|
|
||||||
});
|
|
||||||
|
|
||||||
generateMenu(vm);
|
|
||||||
} catch (error) {
|
|
||||||
window.$gz.errorHandler.handleFormError(error, vm);
|
|
||||||
} finally {
|
|
||||||
vm.formState.ready = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async beforeRouteLeave(to, from, next) {
|
|
||||||
if (!this.formState.dirty || JUST_DELETED) {
|
|
||||||
next();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((await window.$gz.dialog.confirmLeaveUnsaved()) === true) {
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
next(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
|
||||||
selectLists: {
|
|
||||||
usertypes: []
|
|
||||||
},
|
|
||||||
obj: {
|
|
||||||
//IMPORTANT NOTE: Fields that are NON NULLABLE in the schema for the table but *are* hideable **MUST** have a default value set here or else there will be no way to save the record
|
|
||||||
//I.E. Serial, usertype fields
|
|
||||||
//Also, if it's a non-nullable Enum backed field then it should have a valid selection i.e. not zero if there is no zero
|
|
||||||
id: 0,
|
|
||||||
concurrency: 0,
|
|
||||||
name: null,
|
|
||||||
serial: 0,
|
|
||||||
dollarAmount: null,
|
|
||||||
active: true,
|
|
||||||
userType: 2, //defaulted here to something valid
|
|
||||||
startDate: null,
|
|
||||||
endDate: null,
|
|
||||||
notes: null,
|
|
||||||
count: null,
|
|
||||||
wiki: null,
|
|
||||||
customFields: "{}",
|
|
||||||
tags: [],
|
|
||||||
userId: null
|
|
||||||
},
|
|
||||||
formState: {
|
|
||||||
ready: false,
|
|
||||||
dirty: false,
|
|
||||||
valid: true,
|
|
||||||
readOnly: false,
|
|
||||||
loading: true,
|
|
||||||
errorBoxMessage: null,
|
|
||||||
appError: null,
|
|
||||||
serverError: {}
|
|
||||||
},
|
|
||||||
rights: window.$gz.role.defaultRightsObject(),
|
|
||||||
ayaType: window.$gz.type.Widget
|
|
||||||
};
|
|
||||||
},
|
|
||||||
//WATCHERS
|
|
||||||
watch: {
|
|
||||||
formState: {
|
|
||||||
handler: function(val) {
|
|
||||||
//,oldval is available here too if necessary
|
|
||||||
if (this.formState.loading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//enable / disable save button
|
|
||||||
if (val.dirty && val.valid && !val.readOnly) {
|
|
||||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
|
|
||||||
} else {
|
|
||||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
|
|
||||||
}
|
|
||||||
|
|
||||||
//enable / disable duplicate / new button
|
|
||||||
if (!val.dirty && val.valid && !val.readOnly) {
|
|
||||||
window.$gz.eventBus.$emit(
|
|
||||||
"menu-enable-item",
|
|
||||||
FORM_KEY + ":duplicate"
|
|
||||||
);
|
|
||||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
|
|
||||||
} else {
|
|
||||||
window.$gz.eventBus.$emit(
|
|
||||||
"menu-disable-item",
|
|
||||||
FORM_KEY + ":duplicate"
|
|
||||||
);
|
|
||||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
canSave: function() {
|
|
||||||
return this.formState.valid && this.formState.dirty;
|
|
||||||
},
|
|
||||||
canDuplicate: function() {
|
|
||||||
return this.formState.valid && !this.formState.dirty;
|
|
||||||
},
|
|
||||||
ayaTypes: function() {
|
|
||||||
return window.$gz.type;
|
|
||||||
},
|
|
||||||
form() {
|
|
||||||
return window.$gz.form;
|
|
||||||
},
|
|
||||||
fieldValueChanged(ref) {
|
|
||||||
if (
|
|
||||||
this.formState.ready &&
|
|
||||||
!this.formState.loading &&
|
|
||||||
!this.formState.readOnly
|
|
||||||
) {
|
|
||||||
window.$gz.form.fieldValueChanged(this, ref);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async getDataFromApi(recordId) {
|
|
||||||
let vm = this;
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
if (!recordId) {
|
|
||||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
|
||||||
}
|
|
||||||
let url = API_BASE_URL + recordId;
|
|
||||||
try {
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
|
||||||
|
|
||||||
let res = await window.$gz.api.get(url);
|
|
||||||
|
|
||||||
if (res.error) {
|
|
||||||
//Not found?
|
|
||||||
if (res.error.code == "2010") {
|
|
||||||
window.$gz.form.handleObjectNotFound(vm);
|
|
||||||
}
|
|
||||||
vm.formState.serverError = res.error;
|
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
|
||||||
} else {
|
|
||||||
vm.obj = res.data;
|
|
||||||
//modify the menu as necessary
|
|
||||||
generateMenu(vm);
|
|
||||||
//Update the form status
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
dirty: false,
|
|
||||||
valid: true,
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
window.$gz.errorHandler.handleFormError(error, vm);
|
|
||||||
} finally {
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async submit() {
|
|
||||||
let vm = this;
|
|
||||||
if (vm.canSave == false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
let url = API_BASE_URL; // + vm.$route.params.recordid;
|
|
||||||
//clear any errors vm might be around from previous submit
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
|
||||||
|
|
||||||
let res = await window.$gz.api.upsert(url, vm.obj);
|
|
||||||
|
|
||||||
if (res.error) {
|
|
||||||
vm.formState.serverError = res.error;
|
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
|
||||||
} else {
|
|
||||||
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
|
|
||||||
if (res.data.id) {
|
|
||||||
//POST - whole new object returned
|
|
||||||
vm.obj = res.data;
|
|
||||||
//Change URL to new record
|
|
||||||
//NOTE: will not cause a page re-render, almost nothing does unless forced with a KEY property or using router.GO()
|
|
||||||
|
|
||||||
this.$router.replace({
|
|
||||||
name: "widget-edit",
|
|
||||||
params: {
|
|
||||||
recordid: res.data.id,
|
|
||||||
obj: res.data // Pass data object to new form
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
//PUT - only concurrency token is returned (**warning, if server changes object other fields then this needs to act more like POST above but is more efficient this way**)
|
|
||||||
//Handle "put" of an existing record (UPDATE)
|
|
||||||
vm.obj.concurrency = res.data.concurrency;
|
|
||||||
}
|
|
||||||
//Update the form status
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
dirty: false,
|
|
||||||
valid: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
|
||||||
} finally {
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async remove() {
|
|
||||||
let vm = this;
|
|
||||||
try {
|
|
||||||
let dialogResult = await window.$gz.dialog.confirmDelete();
|
|
||||||
if (dialogResult != true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//do the delete
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
//No need to delete a new record, just abandon it...
|
|
||||||
if (vm.$route.params.recordid == 0) {
|
|
||||||
//this should not get offered for delete but to be safe and clear just in case:
|
|
||||||
JUST_DELETED = true;
|
|
||||||
// navigate backwards
|
|
||||||
vm.$router.go(-1);
|
|
||||||
} else {
|
|
||||||
let url = API_BASE_URL + vm.$route.params.recordid;
|
|
||||||
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
|
||||||
let res = await window.$gz.api.remove(url);
|
|
||||||
if (res.error) {
|
|
||||||
vm.formState.serverError = res.error;
|
|
||||||
window.$gz.form.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 (error) {
|
|
||||||
//Update the form status
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
window.$gz.errorHandler.handleFormError(error, vm);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
duplicate() {
|
|
||||||
//Navigate to new record
|
|
||||||
this.$router.push({
|
|
||||||
name: "widget-edit",
|
|
||||||
params: {
|
|
||||||
recordid: 0,
|
|
||||||
obj: this.obj
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function clickHandler(menuItem) {
|
|
||||||
if (!menuItem) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let m = window.$gz.menu.parseMenuItem(menuItem);
|
|
||||||
if (m.owner == FORM_KEY && !m.disabled) {
|
|
||||||
switch (m.key) {
|
|
||||||
case "save":
|
|
||||||
m.vm.submit();
|
|
||||||
break;
|
|
||||||
case "delete":
|
|
||||||
m.vm.remove();
|
|
||||||
break;
|
|
||||||
case "new":
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "widget-edit",
|
|
||||||
params: { recordid: 0 }
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "duplicate":
|
|
||||||
m.vm.duplicate();
|
|
||||||
break;
|
|
||||||
case "report":
|
|
||||||
if (m.id != null) {
|
|
||||||
//last report selected is in m.id
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "ay-report",
|
|
||||||
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
//general report selector chosen
|
|
||||||
|
|
||||||
let res = await m.vm.$refs.reportSelector.open({
|
|
||||||
AType: window.$gz.type.Widget,
|
|
||||||
selectedRowIds: [m.vm.obj.id]
|
|
||||||
});
|
|
||||||
|
|
||||||
//if null for no selection
|
|
||||||
//just bail out
|
|
||||||
if (res == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//persist last report selected
|
|
||||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
|
||||||
|
|
||||||
//Now open the report viewer...
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "ay-report",
|
|
||||||
params: { recordid: res.id, ayatype: window.$gz.type.Widget }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
window.$gz.eventBus.$emit(
|
|
||||||
"notify-warning",
|
|
||||||
FORM_KEY + "::context click: [" + m.key + "]"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
function generateMenu(vm) {
|
|
||||||
let menuOptions = {
|
|
||||||
isMain: false,
|
|
||||||
readOnly: vm.formState.readOnly,
|
|
||||||
icon: "$ayiSplotch",
|
|
||||||
title: "Widget",
|
|
||||||
helpUrl: "widgets",
|
|
||||||
formData: {
|
|
||||||
ayaType: window.$gz.type.Widget,
|
|
||||||
recordId: vm.$route.params.recordid,
|
|
||||||
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
|
||||||
recordName: vm.obj.name
|
|
||||||
},
|
|
||||||
menuItems: []
|
|
||||||
};
|
|
||||||
|
|
||||||
if (vm.rights.change) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Save",
|
|
||||||
icon: "$ayiSave",
|
|
||||||
surface: true,
|
|
||||||
key: FORM_KEY + ":save",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vm.rights.delete && vm.$route.params.recordid != 0) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Delete",
|
|
||||||
icon: "$ayiTrashAlt",
|
|
||||||
surface: false,
|
|
||||||
key: FORM_KEY + ":delete",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//REPORTS
|
|
||||||
//Report not Print, print is a further option
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Report",
|
|
||||||
icon: "$ayiFileAlt",
|
|
||||||
key: FORM_KEY + ":report",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
|
|
||||||
//get last report selected
|
|
||||||
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
|
||||||
if (lastReport != null) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: lastReport.name,
|
|
||||||
icon: "$ayiFileAlt",
|
|
||||||
key: FORM_KEY + ":report:" + lastReport.id,
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vm.rights.change) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "New",
|
|
||||||
icon: "$ayiPlus",
|
|
||||||
key: FORM_KEY + ":new",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vm.rights.change && vm.$route.params.recordid != 0) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Duplicate",
|
|
||||||
icon: "$ayiClone",
|
|
||||||
key: FORM_KEY + ":duplicate",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
menuOptions.menuItems.push({ divider: true, inset: false });
|
|
||||||
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
let JUST_DELETED = false;
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function initForm(vm) {
|
|
||||||
await fetchTranslatedText(vm);
|
|
||||||
await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY, vm);
|
|
||||||
await populateSelectionLists(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Ensures UI translated text is available
|
|
||||||
//
|
|
||||||
async function fetchTranslatedText(vm) {
|
|
||||||
await window.$gz.translation.cacheTranslations([
|
|
||||||
"Widget",
|
|
||||||
"WidgetName",
|
|
||||||
"WidgetSerial",
|
|
||||||
"WidgetDollarAmount",
|
|
||||||
"WidgetCount",
|
|
||||||
"User",
|
|
||||||
"UserType",
|
|
||||||
"WidgetStartDate",
|
|
||||||
"WidgetEndDate",
|
|
||||||
"WidgetNotes",
|
|
||||||
"WidgetCustom1",
|
|
||||||
"WidgetCustom2",
|
|
||||||
"WidgetCustom3",
|
|
||||||
"WidgetCustom4",
|
|
||||||
"WidgetCustom5",
|
|
||||||
"WidgetCustom6",
|
|
||||||
"WidgetCustom7",
|
|
||||||
"WidgetCustom8",
|
|
||||||
"WidgetCustom9",
|
|
||||||
"WidgetCustom10",
|
|
||||||
"WidgetCustom11",
|
|
||||||
"WidgetCustom12",
|
|
||||||
"WidgetCustom13",
|
|
||||||
"WidgetCustom14",
|
|
||||||
"WidgetCustom15",
|
|
||||||
"WidgetCustom16"
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function populateSelectionLists(vm) {
|
|
||||||
//ensure the pick lists required are pre-fetched
|
|
||||||
await window.$gz.enums.fetchEnumList("usertype");
|
|
||||||
vm.selectLists.usertypes = window.$gz.enums.getSelectionList("usertype");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style></style>
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
|
||||||
<gz-extensions
|
|
||||||
:aya-type="aType"
|
|
||||||
:selected-items="selectedItems"
|
|
||||||
ref="extensions"
|
|
||||||
>
|
|
||||||
</gz-extensions>
|
|
||||||
<gz-data-table
|
|
||||||
ref="gzdatatable"
|
|
||||||
form-key="widget-list"
|
|
||||||
data-list-key="TestWidgetDataList"
|
|
||||||
:show-select="rights.read"
|
|
||||||
:reload="reload"
|
|
||||||
@selection-change="handleSelected"
|
|
||||||
data-cy="widgetsTable"
|
|
||||||
>
|
|
||||||
</gz-data-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const FORM_KEY = "widget-list";
|
|
||||||
export default {
|
|
||||||
created() {
|
|
||||||
this.rights = window.$gz.role.getRights(window.$gz.type.Widget);
|
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
|
||||||
generateMenu(this);
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
rights: window.$gz.role.defaultRightsObject(),
|
|
||||||
aType: window.$gz.type.Widget,
|
|
||||||
selectedItems: [],
|
|
||||||
reload: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleSelected(selected) {
|
|
||||||
this.selectedItems = selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function clickHandler(menuItem) {
|
|
||||||
if (!menuItem) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let m = window.$gz.menu.parseMenuItem(menuItem);
|
|
||||||
if (m.owner == FORM_KEY && !m.disabled) {
|
|
||||||
switch (m.key) {
|
|
||||||
case "new":
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "widget-edit",
|
|
||||||
params: { recordid: 0 }
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "extensions":
|
|
||||||
let res = await m.vm.$refs.extensions.open(
|
|
||||||
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.Widget)
|
|
||||||
);
|
|
||||||
if (res && res.refresh == true) {
|
|
||||||
m.vm.reload = !m.vm.reload;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "report":
|
|
||||||
if (m.id != null) {
|
|
||||||
//last report selected is in m.id
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "ay-report",
|
|
||||||
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
//general report selector chosen
|
|
||||||
|
|
||||||
let res = await m.vm.$refs.reportSelector.open(
|
|
||||||
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.Widget)
|
|
||||||
);
|
|
||||||
|
|
||||||
//if null for no selection
|
|
||||||
//just bail out
|
|
||||||
if (res == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//persist last report selected
|
|
||||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
|
||||||
|
|
||||||
//Now open the report viewer...
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "ay-report",
|
|
||||||
params: { recordid: res.id, ayatype: window.$gz.type.Widget }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
window.$gz.eventBus.$emit(
|
|
||||||
"notify-warning",
|
|
||||||
FORM_KEY + "::context click: [" + m.key + "]"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
function generateMenu(vm) {
|
|
||||||
let menuOptions = {
|
|
||||||
isMain: true,
|
|
||||||
icon: "$ayiVial",
|
|
||||||
title: "WidgetList",
|
|
||||||
helpUrl: "widgets",
|
|
||||||
menuItems: [],
|
|
||||||
formData: {
|
|
||||||
ayaType: window.$gz.type.Widget
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (vm.rights.change) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "New",
|
|
||||||
icon: "$ayiPlus",
|
|
||||||
surface: true,
|
|
||||||
key: FORM_KEY + ":new",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//REPORTS
|
|
||||||
//Report not Print, print is a further option
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Report",
|
|
||||||
icon: "$ayiFileAlt",
|
|
||||||
key: FORM_KEY + ":report",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
|
|
||||||
//get last report selected
|
|
||||||
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
|
||||||
if (lastReport != null) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: lastReport.name,
|
|
||||||
icon: "$ayiFileAlt",
|
|
||||||
key: FORM_KEY + ":report:" + lastReport.id,
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Extensions",
|
|
||||||
icon: "$ayiPuzzlePiece",
|
|
||||||
key: FORM_KEY + ":extensions",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -16,25 +16,25 @@
|
|||||||
// .clear()
|
// .clear()
|
||||||
// .type(`${Cypress.env("adminpassword")}{enter}`);
|
// .type(`${Cypress.env("adminpassword")}{enter}`);
|
||||||
|
|
||||||
// cy.visit("/widgets/1");
|
// cy.visit("/customers/1");
|
||||||
// cy.url().should("include", "/widgets/1");
|
// cy.url().should("include", "/customers/1");
|
||||||
// //check serial field is present, then hide it and check it's gone then re-show it again
|
// //check serial field is present, then hide it and check it's gone then re-show it again
|
||||||
// cy.get("[data-cy=serial]").should("exist");
|
// cy.get("[data-cy=serial]").should("exist");
|
||||||
// cy.get("[data-cy=WidgetCustom8]").should("not.exist");
|
// cy.get("[data-cy=customerCustom8]").should("not.exist");
|
||||||
|
|
||||||
// cy.wait(100);
|
// cy.wait(100);
|
||||||
// cy.get("[data-cy=contextmenu]").click();
|
// cy.get("[data-cy=contextmenu]").click();
|
||||||
// cy.get('[data-cy="app:customize"]').click();
|
// cy.get('[data-cy="app:customize"]').click();
|
||||||
// cy.url().should("include", "/customize/Widget");
|
// cy.url().should("include", "/customize/customer");
|
||||||
|
|
||||||
// //hide serial
|
// //hide serial
|
||||||
// cy.get("[data-cy=SerialVisible]").uncheck({ force: true });
|
// cy.get("[data-cy=SerialVisible]").uncheck({ force: true });
|
||||||
// cy.wait(10);
|
// cy.wait(10);
|
||||||
|
|
||||||
// //show widget 8 and set it to a type
|
// //show customer 8 and set it to a type
|
||||||
// cy.get("[data-cy=WidgetCustom8]").scrollIntoView();
|
// cy.get("[data-cy=customerCustom8]").scrollIntoView();
|
||||||
// cy.get("[data-cy=WidgetCustom8Visible]").check({ force: true });
|
// cy.get("[data-cy=customerCustom8Visible]").check({ force: true });
|
||||||
// cy.get("[data-cy=WidgetCustom8SelectType]").type("tr{enter}", {
|
// cy.get("[data-cy=customerCustom8SelectType]").type("tr{enter}", {
|
||||||
// force: true
|
// force: true
|
||||||
// });
|
// });
|
||||||
|
|
||||||
@@ -43,22 +43,22 @@
|
|||||||
// cy.go("back");
|
// cy.go("back");
|
||||||
// //check customize worked
|
// //check customize worked
|
||||||
// cy.get("[data-cy=serial]").should("not.exist");
|
// cy.get("[data-cy=serial]").should("not.exist");
|
||||||
// cy.get("[data-cy=WidgetCustom8]").should("exist");
|
// cy.get("[data-cy=customerCustom8]").should("exist");
|
||||||
|
|
||||||
// //reverse
|
// //reverse
|
||||||
// cy.wait(100);
|
// cy.wait(100);
|
||||||
// cy.get("[data-cy=contextmenu]").click();
|
// cy.get("[data-cy=contextmenu]").click();
|
||||||
// cy.get('[data-cy="app:customize"]').click();
|
// cy.get('[data-cy="app:customize"]').click();
|
||||||
// cy.url().should("include", "/customize/Widget");
|
// cy.url().should("include", "/customize/customer");
|
||||||
// cy.get("[data-cy=SerialVisible]").check({ force: true });
|
// cy.get("[data-cy=SerialVisible]").check({ force: true });
|
||||||
// cy.get("[data-cy=WidgetCustom8Visible]").uncheck({ force: true });
|
// cy.get("[data-cy=customerCustom8Visible]").uncheck({ force: true });
|
||||||
// cy.get("[data-cy=WidgetCustom8SelectType]").type("te{enter}", {
|
// cy.get("[data-cy=customerCustom8SelectType]").type("te{enter}", {
|
||||||
// force: true
|
// force: true
|
||||||
// });
|
// });
|
||||||
// cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click();
|
// cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click();
|
||||||
// cy.go("back");
|
// cy.go("back");
|
||||||
// cy.get("[data-cy=serial]").should("exist");
|
// cy.get("[data-cy=serial]").should("exist");
|
||||||
// cy.get("[data-cy=WidgetCustom8]").should("not.exist");
|
// cy.get("[data-cy=customerCustom8]").should("not.exist");
|
||||||
// //-----
|
// //-----
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ describe("GZ-DATA-TABLE", () => {
|
|||||||
.clear()
|
.clear()
|
||||||
.type("BizAdmin{enter}");
|
.type("BizAdmin{enter}");
|
||||||
//cy.url().should("include", "/home-dashboard");
|
//cy.url().should("include", "/home-dashboard");
|
||||||
cy.visit("/widgets");
|
cy.visit("/customers");
|
||||||
cy.url().should("include", "/widgets");
|
cy.url().should("include", "/customers");
|
||||||
|
|
||||||
cy.contains("Rows per page");
|
cy.contains("Rows per page");
|
||||||
//select default widget list view
|
//select default customer list view
|
||||||
cy.get("[data-cy=selectlistview]").type("-{enter}", { force: true });
|
cy.get("[data-cy=selectlistview]").type("-{enter}", { force: true });
|
||||||
//confirm we see the data expected
|
//confirm we see the data expected
|
||||||
cy.contains("Name");
|
cy.contains("Name");
|
||||||
@@ -24,7 +24,7 @@ describe("GZ-DATA-TABLE", () => {
|
|||||||
//refresh
|
//refresh
|
||||||
cy.get("[data-cy=refresh]").click();
|
cy.get("[data-cy=refresh]").click();
|
||||||
|
|
||||||
//confirm the first column is the widget name
|
//confirm the first column is the customer name
|
||||||
cy.get("thead > tr > th:nth-child(1) > span").contains("Name");
|
cy.get("thead > tr > th:nth-child(1) > span").contains("Name");
|
||||||
|
|
||||||
// cy.get('[aria-label="Next page"] > .v-btn__content > .v-icon').click();
|
// cy.get('[aria-label="Next page"] > .v-btn__content > .v-icon').click();
|
||||||
@@ -53,7 +53,7 @@ describe("GZ-DATA-TABLE", () => {
|
|||||||
'[data-cy="columncard:username"] > .v-card__text > .d-flex > :nth-child(1) > .v-btn__content > [data-cy=movestart]'
|
'[data-cy="columncard:username"] > .v-card__text > .d-flex > :nth-child(1) > .v-btn__content > [data-cy=movestart]'
|
||||||
).click();
|
).click();
|
||||||
|
|
||||||
//go back to widgetlist
|
//go back to customerlist
|
||||||
cy.go("back");
|
cy.go("back");
|
||||||
|
|
||||||
//confirm the first column is now the username
|
//confirm the first column is now the username
|
||||||
@@ -62,20 +62,20 @@ describe("GZ-DATA-TABLE", () => {
|
|||||||
//switch back to default filter
|
//switch back to default filter
|
||||||
cy.get("[data-cy=selectlistview]").type("-{enter}{esc}", { force: true });
|
cy.get("[data-cy=selectlistview]").type("-{enter}{esc}", { force: true });
|
||||||
|
|
||||||
//open a widget record
|
//open a customer record
|
||||||
cy.wait(100);
|
cy.wait(100);
|
||||||
cy.get("tbody > :nth-child(1) > :nth-child(1)").click();
|
cy.get("tbody > :nth-child(1) > :nth-child(1)").click();
|
||||||
//cy.get(":nth-child(1) > :nth-child(1) > .subtitle-1 > a").click();
|
//cy.get(":nth-child(1) > :nth-child(1) > .subtitle-1 > a").click();
|
||||||
|
|
||||||
//confirm on widget edit form
|
//confirm on customer edit form
|
||||||
cy.get('[data-cy="widget-edit:delete"]');
|
cy.get('[data-cy="customer-edit:delete"]');
|
||||||
|
|
||||||
//go back to widgetlist
|
//go back to customerlist
|
||||||
cy.go("back");
|
cy.go("back");
|
||||||
|
|
||||||
//new
|
//new
|
||||||
cy.get("[data-cy='widget-list:new']").click();
|
cy.get("[data-cy='customer-list:new']").click();
|
||||||
cy.url().should("include", "/widgets/0");
|
cy.url().should("include", "/customers/0");
|
||||||
|
|
||||||
//cy.get("thead > tr > th:nth-child(1)").contains("User");
|
//cy.get("thead > tr > th:nth-child(1)").contains("User");
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ describe("PICK LIST TEMPLATE", () => {
|
|||||||
cy.get(
|
cy.get(
|
||||||
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
|
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
|
||||||
).click({ force: true });
|
).click({ force: true });
|
||||||
cy.visit("/widgets/0");
|
cy.visit("/customers/0");
|
||||||
cy.url().should("include", "/widgets/0");
|
cy.url().should("include", "/customers/0");
|
||||||
//select a user with a zone set
|
//select a user with a zone set
|
||||||
cy.get("[data-cy=userid] > .v-input")
|
cy.get("[data-cy=userid] > .v-input")
|
||||||
.type("..zone")
|
.type("..zone")
|
||||||
@@ -50,8 +50,8 @@ describe("PICK LIST TEMPLATE", () => {
|
|||||||
cy.get(
|
cy.get(
|
||||||
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
|
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
|
||||||
).click({ force: true });
|
).click({ force: true });
|
||||||
cy.visit("/widgets/0");
|
cy.visit("/customers/0");
|
||||||
cy.url().should("include", "/widgets/0");
|
cy.url().should("include", "/customers/0");
|
||||||
//select a user with a zone set
|
//select a user with a zone set
|
||||||
cy.get("[data-cy=userid] > .v-input")
|
cy.get("[data-cy=userid] > .v-input")
|
||||||
.type("..zone")
|
.type("..zone")
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ describe("SEARCH", () => {
|
|||||||
sub = t;
|
sub = t;
|
||||||
//nave to first result form
|
//nave to first result form
|
||||||
cy.get("[data-cy=btnopenitem1]").click();
|
cy.get("[data-cy=btnopenitem1]").click();
|
||||||
cy.url().should("include", "/widget");
|
cy.url().should("include", "/customer");
|
||||||
//name field should contain whatever was shown in search results list
|
//name field should contain whatever was shown in search results list
|
||||||
cy.contains(sub).should("exist");
|
cy.contains(sub).should("exist");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -430,18 +430,6 @@ describe("SMOKE", () => {
|
|||||||
cy.url({ timeout: 10000 }).should("include", "/cust-customers/1");
|
cy.url({ timeout: 10000 }).should("include", "/cust-customers/1");
|
||||||
cy.get("[data-cy=name]");
|
cy.get("[data-cy=name]");
|
||||||
|
|
||||||
// cy.visit("/viewreport?oid=1&rid=1");
|
|
||||||
// cy.url({ timeout: 10000 }).should("include", "/cust-customers/1");
|
|
||||||
// cy.get("[data-cy=name]");
|
|
||||||
|
|
||||||
// cy.visit("/widgets");
|
|
||||||
// cy.url({ timeout: 10000 }).should("include", "/widgets");
|
|
||||||
// cy.get("[data-cy=widgetsTable]");
|
|
||||||
|
|
||||||
// cy.visit("/widgets/0");
|
|
||||||
// cy.url({ timeout: 10000 }).should("include", "/widgets/0");
|
|
||||||
// cy.get("[data-cy=name]");
|
|
||||||
|
|
||||||
cy.visit("/NOTFOUND");
|
cy.visit("/NOTFOUND");
|
||||||
cy.contains("404");
|
cy.contains("404");
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// const { WatchIgnorePlugin } = require("webpack");
|
// const { WatchIgnorePlugin } = require("webpack");
|
||||||
|
|
||||||
//https://docs.cypress.io/guides/references/assertions.html#BDD-Assertions
|
//https://docs.cypress.io/guides/references/assertions.html#BDD-Assertions
|
||||||
describe("WIDGET FORM", () => {
|
describe("customer FORM", () => {
|
||||||
it("Performs all crud ops on widget successfully", () => {
|
it("Performs all crud ops on customer successfully", () => {
|
||||||
let unique = new Date().getTime();
|
let unique = new Date().getTime();
|
||||||
cy.visit("/login");
|
cy.visit("/login");
|
||||||
cy.get("input[name=username]")
|
cy.get("input[name=username]")
|
||||||
@@ -19,8 +19,8 @@ describe("WIDGET FORM", () => {
|
|||||||
cy.url().should("include", "/ay-evaluate");
|
cy.url().should("include", "/ay-evaluate");
|
||||||
|
|
||||||
//POST
|
//POST
|
||||||
cy.visit("/widgets/0");
|
cy.visit("/customers/0");
|
||||||
cy.url().should("include", "/widgets/0");
|
cy.url().should("include", "/customers/0");
|
||||||
//cy.wait(5000);
|
//cy.wait(5000);
|
||||||
|
|
||||||
//save the start url for later
|
//save the start url for later
|
||||||
@@ -69,20 +69,20 @@ describe("WIDGET FORM", () => {
|
|||||||
force: true
|
force: true
|
||||||
}); //esc necessary to close tags control
|
}); //esc necessary to close tags control
|
||||||
cy.get(
|
cy.get(
|
||||||
"[data-cy=WidgetCustom2]"
|
"[data-cy=customerCustom2]"
|
||||||
).type("Custom text field testing a...b...c...{enter}EOT", { force: true });
|
).type("Custom text field testing a...b...c...{enter}EOT", { force: true });
|
||||||
|
|
||||||
//GET ROUTE
|
//GET ROUTE
|
||||||
//SAve the record and ensure it's different
|
//SAve the record and ensure it's different
|
||||||
cy.get('[data-cy="widget-edit:save"]').click();
|
cy.get('[data-cy="customer-edit:save"]').click();
|
||||||
cy.url().should("include", "/widgets");
|
cy.url().should("include", "/customers");
|
||||||
|
|
||||||
cy.get("[data-cy=serial]").should("not.have.value", 0); //server sets new value on save
|
cy.get("[data-cy=serial]").should("not.have.value", 0); //server sets new value on save
|
||||||
|
|
||||||
//PUT
|
//PUT
|
||||||
cy.get("[data-cy=count]").type("321", { force: true });
|
cy.get("[data-cy=count]").type("321", { force: true });
|
||||||
|
|
||||||
cy.get('[data-cy="widget-edit:save"]').click({ force: true });
|
cy.get('[data-cy="customer-edit:save"]').click({ force: true });
|
||||||
|
|
||||||
//now get it back again and confirm settings
|
//now get it back again and confirm settings
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ describe("WIDGET FORM", () => {
|
|||||||
|
|
||||||
//delete the record
|
//delete the record
|
||||||
cy.get("[data-cy=contextmenu]").click();
|
cy.get("[data-cy=contextmenu]").click();
|
||||||
cy.get('[data-cy="widget-edit:delete"]').click();
|
cy.get('[data-cy="customer-edit:delete"]').click();
|
||||||
cy.get('[data-cy="gzconfirm:yesbutton"]').click();
|
cy.get('[data-cy="gzconfirm:yesbutton"]').click();
|
||||||
|
|
||||||
// //LOGOUT
|
// //LOGOUT
|
||||||
|
|||||||
Reference in New Issue
Block a user