HUGE REFACTOR / CLEANUP

if there is a issue it's probably something in here that was changed
This commit is contained in:
2021-09-28 20:19:44 +00:00
parent 51eddfede9
commit d0afdd9855
238 changed files with 3127 additions and 8614 deletions

View File

@@ -29,7 +29,8 @@
//..........
Customer work order form / view / open???
Customer CSR form has a bunch of todo in the template, WTF?
Dashboard / widgets
Just enough an no more, this could be endless, come up with a top 5 or something and limit it to that
(this is also a very juicy v.next feature thing too)
@@ -94,6 +95,16 @@ Coded by importance
\_____|______|_____|______|_| \_| |_|
- 1 refactoring let to const
remove all these:
- 1 BUG BUG: attempt to delete a customer with a linked unit (so it can't be deleted) and get error properly but overlay stays on form
whatever this is needs to be fixed everywhere

View File

@@ -2,7 +2,6 @@
<v-app>
<gznotify ref="gznotify"></gznotify>
<gzconfirm ref="gzconfirm"></gzconfirm>
<!-- <gzreportselector ref="gzreportselector"></gzreportselector> -->
<!-- Width of nav drawer set to allow widest translated text menu item to show which is spanish client service requests item
and also leave a tiny space to click on outside of nav for galaxy 9 phone (narrowest width supported device)
@@ -137,7 +136,6 @@
</div>
</template>
</v-navigation-drawer>
<!-- :color="appBar.isMain ? 'primary' : 'secondary'" style="width: 300px" -->
<v-app-bar v-if="isAuthenticated" :color="appBar.color" dark fixed app>
<v-app-bar-nav-icon
@click.stop="drawer = !drawer"
@@ -236,16 +234,12 @@
</v-main>
</v-app>
</template>
<script>
/* Xeslint-disable */
import gzconfirm from "./components/gzconfirm";
import gznotify from "./components/gznotify";
import openObjectHandler from "./api/open-object-handler";
import notifyPoll from "./api/notifypoll";
import { processLogout } from "./api/authutil";
export default {
components: {
gzconfirm,
@@ -300,14 +294,10 @@ export default {
window.$gz.eventBus.$off();
},
mounted() {
let vm = this;
const vm = this;
vm.$vuetify.theme.dark = vm.$store.state.darkMode;
vm.$root.$gzconfirm = vm.$refs.gzconfirm.open;
vm.$root.$gznotify = vm.$refs.gznotify.addNotification;
//weird bastardization thing
//basically I want to access $gz in vue components where I can't access Window
//this smells bad but it works
vm.$root.$gz = window.$gz;
//direct open path?
@@ -323,7 +313,7 @@ export default {
toPath = undefined;
}
let isReset = toPath && toPath.includes("home-reset");
const isReset = toPath && toPath.includes("home-reset");
if (isReset && vm.$store.state.authenticated) {
processLogout();
}
@@ -411,7 +401,7 @@ export default {
}
//User is logged in offer to update in a dialog with translated text
let dialogResult = await window.$gz.dialog.confirmGeneric(
const dialogResult = await window.$gz.dialog.confirmGeneric(
"UpdateAvailable"
);
if (dialogResult == false) {

View File

@@ -1,5 +1,3 @@
/* xeslint-disable */
import bizrolerights from "./biz-role-rights";
export default {
@@ -118,15 +116,9 @@ export default {
//DELETE = SAME AS CHANGE FOR NOW (There is no specific delete right for now though it's checked for by routes in Authorized.cs in case we want to add it in future as a separate right from create.)
//NOTE: biz rules can supersede this, this is just for general rights purposes, if an object has restrictive business rules they will take precedence every time.
let ret = this.defaultRightsObject();
const ret = this.defaultRightsObject();
//Get the type name from the type enum value
//de-lodash
// let typeName = window.$gz. _.findKey(window.$gz.type, function(o) {
// return o == aType;
// });
//my _.findKey replacement:
let typeName = undefined;
for (const [key, value] of Object.entries(window.$gz.type)) {
if (value == aType) {
@@ -136,7 +128,7 @@ export default {
}
//Get the AyaNova stock REQUIRED role rights for that object
let objectRoleRights = this.ROLE_RIGHTS[typeName];
const objectRoleRights = this.ROLE_RIGHTS[typeName];
if (!objectRoleRights) {
throw new Error(
`authorizationroles::getRights type ${aType} not found in roles collection`
@@ -144,11 +136,11 @@ export default {
}
//get the logged in user's role
let userRole = window.$gz.store.state.roles;
const userRole = window.$gz.store.state.roles;
//calculate the effective rights
//a non zero result of the bitwise calculation means true and zero means false so using !! to force it into a boolean value
//(contrary to some style guides that say !! is obscure but I say it saves a lot of typing)
let canChange = !!(userRole & objectRoleRights.Change);
const canChange = !!(userRole & objectRoleRights.Change);
//sometimes rights to read are false if change is true since change trumps read anyway so accordingly:
let canReadFullRecord = canChange;
if (!canReadFullRecord) {
@@ -167,7 +159,7 @@ export default {
// (i.e. grids, history etc, initialization of main menu etc)
//
canOpen(aType) {
let r = this.getRights(aType);
const r = this.getRights(aType);
//convention is change might be defined but not read so canOpen is true eitehr way
return r.change == true || r.read == true;
},
@@ -176,46 +168,7 @@ export default {
// (i.e. grids, history etc, initialization of main menu etc)
//
canChange(aType) {
let r = this.getRights(aType);
const r = this.getRights(aType);
return r.change == true;
}
};
/*
USING BITWISE OPERATORS CHEAT SHEET
//https://codeburst.io/using-javascript-bitwise-operators-in-real-life-f551a731ff5
// Test whether your bit number has a single attribute. '&' ensures
// an intersection between them.
if (myBitNumber & HAS_FOO1) {
// False, in this example
}
if (myBitNumber & HAS_FOO2) {
// True!
}
// Test whether your bit number has ANY of the specified attributes
if (myBitNumber & (HAS_FOO1 | HAS_FOO2)) {
// True!
}
if (myBitNumber & (HAS_FOO1 | HAS_FOO3)) {
// False
}
// Test whether your bit number contains ONLY the specified attributes
if (myBitNumber == (HAS_FOO2 | HAS_FOO4)) {
// True
}
if (myBitNumber == (HAS_FOO2 | HAS_FOO3 | HAS_FOO4)) {
// False
}
// Test whether your bit number contains ALL of the given
// attributes. This is slightly tricky: the union of ATTRIBUTES
// can't supersede `myBitNumber` alone, otherwise it contains a bit
// that `myBitNumber` doesn't.
if (myBitNumber == (myBitNumber | (HAS_FOO2 | HAS_FOO4))) {
// True
}
if (myBitNumber == (myBitNumber | (HAS_FOO2 | HAS_FOO3 | HAS_FOO4))) {
// False
}
*/

View File

@@ -1,5 +1,3 @@
/* xeslint-disable */
//import decode from "jwt-decode";
import jwt_decode from "jwt-decode";
import initialize from "./initialize";
import notifypoll from "./notifypoll";
@@ -69,11 +67,11 @@ export function processLogin(authResponse, loggedInWithKnownPassword) {
// );
//Get global settings
let gsets = await window.$gz.api.get("global-biz-setting/client");
const gsets = await window.$gz.api.get("global-biz-setting/client");
if (gsets.error) {
//In a form this would trigger a bunch of validation or error display code but for here and now:
//convert error to human readable string for display and popup a notification to user
let msg = window.$gz.api.apiErrorToHumanString(gsets.error);
const msg = window.$gz.api.apiErrorToHumanString(gsets.error);
window.$gz.eventBus.$emit("notify-error", msg);
} else {
//Check if overrides and use them here
@@ -99,7 +97,6 @@ export function processLogout() {
}
export function isLoggedIn() {
//const token = getToken();
return (
!!window.$gz.store.state.apiToken &&
!isTokenExpired(window.$gz.store.state.apiToken)

View File

@@ -1,5 +1,5 @@
import authorizationroles from "./authorizationroles";
let role = authorizationroles.AUTHORIZATION_ROLES;
const role = authorizationroles.AUTHORIZATION_ROLES;
export default {
registry: [
{
@@ -48,9 +48,9 @@ export default {
}
],
availableItems() {
let ret = [];
const ret = [];
for (let i = 0; i < this.registry.length; i++) {
let item = this.registry[i];
const item = this.registry[i];
if (authorizationroles.hasRole(item.roles)) {
ret.push({ id: item.id, title: item.title, type: item.type });
}

View File

@@ -1,5 +1,3 @@
/* ZZeslint-disable */
export default {
get(enumKey, enumValue) {
enumKey = enumKey.toLowerCase();
@@ -11,13 +9,13 @@ export default {
}
return window.$gz.store.state.enums[enumKey][enumValue];
} else {
let ret = [];
const ret = [];
if (enumValue == null || enumValue == 0) {
return "";
}
let availableRoles = this.getSelectionList("AuthorizationRoles");
const availableRoles = this.getSelectionList("AuthorizationRoles");
for (let i = 0; i < availableRoles.length; i++) {
let role = availableRoles[i];
const role = availableRoles[i];
if (!!(enumValue & role.id)) {
ret.push(role.name);
}
@@ -32,7 +30,7 @@ export default {
//
getSelectionList(enumKey, noSort) {
enumKey = enumKey.toLowerCase();
let e = window.$gz.store.state.enums[enumKey];
const e = window.$gz.store.state.enums[enumKey];
if (!e) {
throw new Error(
"ERROR enums::getSelectionList -> enumKey " +
@@ -40,7 +38,7 @@ export default {
" is missing from store"
);
}
let ret = [];
const ret = [];
//turn it into an array suitable for selection lists
for (const [key, value] of Object.entries(e)) {
@@ -65,19 +63,19 @@ export default {
for (let i = 0; i < enumKey.length; i++) {
//check if list
//if not then fetch it and store it
let k = enumKey[i].toLowerCase();
const k = enumKey[i].toLowerCase();
//de-lodash
// if (!window.$gz. _.has(window.$gz.store.state.enums, k)) {
//enums is an object this is checking if that object has a key with the name in k
if (!window.$gz.util.has(window.$gz.store.state.enums, k)) {
let that = this;
const that = this;
// eslint-disable-next-line
let dat = await that.fetchEnumKey(k);
const dat = await that.fetchEnumKey(k);
//massage the data as necessary
let e = { enumKey: k, items: {} };
const e = { enumKey: k, items: {} };
for (let i = 0; i < dat.length; i++) {
let o = dat[i];
const o = dat[i];
e.items[o.id] = o.name;
}
//stuff the data into the store
@@ -87,7 +85,7 @@ export default {
},
async fetchEnumKey(enumKey) {
// eslint-disable-next-line
let res = await window.$gz.api.get("enum-list/list/" + enumKey);
const res = await window.$gz.api.get("enum-list/list/" + enumKey);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);

View File

@@ -1,4 +1,3 @@
/* xeslint-disable */
let lastMessageHash = 0;
let lastMessageTimeStamp = new Date();
@@ -9,9 +8,9 @@ let lastMessageTimeStamp = new Date();
async function dealWithError(msg, vm) {
//Check if this is the same message again as last time within a short time span to avoid endless looping errors of same message
//but still allow for user to repeat operation that causes error so they can view it
let newHash = window.$gz.util.quickHash(msg);
const newHash = window.$gz.util.quickHash(msg);
if (newHash == lastMessageHash) {
let tsnow = new Date();
const tsnow = new Date();
//don't show the same exact message if it was just shown less than 1 second ago
if (tsnow - lastMessageTimeStamp < 1000) return;
}
@@ -29,7 +28,7 @@ async function dealWithError(msg, vm) {
}
window.$gz.store.commit("logItem", msg);
if (window.$gz.dev) {
let errMsg = "DEV MODE errorHandler.js:: Unexpected error: \r\n" + msg;
const errMsg = "DEV MODE errorHandler.js:: Unexpected error: \r\n" + msg;
// eslint-disable-next-line no-console
console.error(errMsg);
@@ -41,7 +40,6 @@ async function dealWithError(msg, vm) {
if (!vm || vm.formState == undefined) {
//popup if no place to display it elsewise
window.$gz.eventBus.$emit("notify-error", msg);
//debugger;
return;
}
@@ -98,7 +96,7 @@ function decodeError(e, vm) {
//API error object?
if (e.error) {
let err = e.error;
const err = e.error;
// {
// "code": "2002",
// "message": "See server log for details",

View File

@@ -1,5 +1,3 @@
/*Xeslint-disable */
///Add data key names which make the custom fields control work more easily
///Since the names can be inferred from the data that comes from the server it saves bandwidth to do it here at the client
function addDataKeyNames(obj) {
@@ -27,7 +25,7 @@ export default {
!window.$gz.util.has(window.$gz.store.state.formCustomTemplate, formKey)
) {
//fetch and populate the store
let res = await window.$gz.api.get("form-custom/" + formKey);
const res = await window.$gz.api.get("form-custom/" + formKey);
if (res.error) {
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
}
@@ -55,7 +53,7 @@ export default {
);
}
let template = window.$gz.store.state.formCustomTemplate[formKey];
const template = window.$gz.store.state.formCustomTemplate[formKey];
if (template === undefined) {
throw new Error(
"ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
@@ -66,12 +64,10 @@ export default {
//Note that not every field being requested will exist so it's valid to return undefined
//template is an array of objects that contain a key called "fld"
//de-lodash
//let templateItem = window.$gz. _.find(template, ["fld", fieldKey]);
return template.find(z => z.fld == fieldKey);
},
getTemplateConcurrencyToken(formKey) {
let tok =
const tok =
window.$gz.store.state.formCustomTemplate[formKey + "_concurrencyToken"];
if (tok === undefined) {
throw new Error(

View File

@@ -1,4 +1,3 @@
/* Xeslint-disable */
import router from "../router";
function stringifyPrimitive(v) {
@@ -22,7 +21,7 @@ function stringifyPrimitive(v) {
// return true if handled or false if not
//
function handleError(action, error, route) {
let errorMessage =
const errorMessage =
"API error: " + action + " route =" + route + ", message =" + error.message;
window.$gz.store.commit("logItem", errorMessage);
@@ -80,7 +79,6 @@ function handleError(action, error, route) {
//Ideally this should never get called because any issue should be addressed above
window.$gz.errorHandler.handleFormError(error);
// devShowUnknownError(error);
}
export default {
@@ -166,7 +164,7 @@ export default {
//no content, nothing to process
return response;
}
let contentType = response.headers.get("content-type");
const contentType = response.headers.get("content-type");
if (!contentType) {
return response;
@@ -188,7 +186,7 @@ export default {
//no content, nothing to process
return response;
}
let contentType = response.headers.get("content-type");
const contentType = response.headers.get("content-type");
if (!contentType) {
return response;
}
@@ -210,7 +208,6 @@ export default {
},
patchAuthorizedHeaders() {
return {
//Accept: "application/json, text/plain, */*",
Accept: "application/json",
"Content-Type": "application/json-patch+json",
Authorization: "Bearer " + window.$gz.store.state.apiToken
@@ -308,10 +305,7 @@ export default {
//
genericDownloadUrl(route) {
//http://localhost:7575/api/v8/backup/download/100?t=sssss
let url = route + "?t=" + window.$gz.store.state.downloadToken;
return this.APIUrl(url);
return this.APIUrl(route + "?t=" + window.$gz.store.state.downloadToken);
},
/////////////////////////////
// report file download URL
@@ -319,13 +313,12 @@ export default {
reportDownloadUrl(fileName) {
//http://localhost:7575/api/v8/report/download/filename.pdf?t=sssss
let url =
return this.APIUrl(
"report/download/" +
fileName +
"?t=" +
window.$gz.store.state.downloadToken;
return this.APIUrl(url);
fileName +
"?t=" +
window.$gz.store.state.downloadToken
);
},
/////////////////////////////
// backup file download URL
@@ -333,13 +326,12 @@ export default {
backupDownloadUrl(fileName) {
//http://localhost:7575/api/v8/backup/download/100?t=sssss
let url =
return this.APIUrl(
"backup/download/" +
fileName +
"?t=" +
window.$gz.store.state.downloadToken;
return this.APIUrl(url);
fileName +
"?t=" +
window.$gz.store.state.downloadToken
);
},
/////////////////////////////
// attachment download URL
@@ -366,9 +358,7 @@ export default {
// (size= 'small', 'medium', 'large')
logoUrl(size) {
//http://localhost:7575/api/v8/logo/small
let url = "logo/" + size;
return this.APIUrl(url);
return this.APIUrl("logo/" + size);
},
/////////////////////////////
// REPLACE END OF URL
@@ -389,7 +379,7 @@ export default {
if (typeof obj === "object") {
return Object.keys(obj)
.map(function(k) {
let ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
const ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
if (Array.isArray(obj[k])) {
return obj[k]
.map(function(v) {
@@ -416,7 +406,7 @@ export default {
//
async get(route) {
try {
let that = this;
const that = this;
let r = await fetch(that.APIUrl(route), that.fetchGetOptions());
that.statusEx(r);
r = await that.extractBodyEx(r);
@@ -441,7 +431,7 @@ export default {
//
async upsert(route, data, isLogin = false) {
try {
let that = this;
const that = this;
//determine if this is a new or existing record
let fetchOptions = undefined;
//put?
@@ -451,7 +441,6 @@ export default {
//post
//ensure the route doesn't end in /0 which will happen if it's a new record
//since the edit forms just send the url here with the ID regardless
//note: de-lodash was using lodash here endswith method
if (route.endsWith("/0")) {
route = route.slice(0, -2);
}
@@ -471,7 +460,6 @@ export default {
handleError("UPSERT", error, route);
} else {
//specifically this is for the login page
// throw new Error(error);
throw new Error(window.$gz.errorHandler.errorToString(error));
}
}
@@ -480,13 +468,12 @@ export default {
// DELETE DATA FROM API SERVER
//
async remove(route) {
let that = this;
const that = this;
try {
let r = await fetch(that.APIUrl(route), that.fetchRemoveOptions());
that.statusEx(r);
//delete will return a body if there is an error of some kind with the request
r = await that.extractBodyEx(r);
return r;
} catch (error) {
//fundamental error, can't proceed with this call
@@ -498,7 +485,7 @@ export default {
// (used for puts that can't have a concurrency token like above)
async put(route, data) {
try {
let that = this;
const that = this;
let r = await fetch(that.APIUrl(route), that.fetchPutOptions(data));
that.statusEx(r);
r = await that.extractBodyEx(r);
@@ -512,7 +499,7 @@ export default {
// (used for post only routes not needing upserts)
async post(route, data) {
try {
let that = this;
const that = this;
let r = await fetch(that.APIUrl(route), that.fetchPostOptions(data));
that.statusEx(r);
r = await that.extractBodyEx(r);
@@ -526,7 +513,7 @@ export default {
// @param {ayaId:objectid, ayaType:aType, files:[array of files]}
//
async uploadAttachment(at) {
let that = this;
const that = this;
try {
var files = at.files;
var data = new FormData();
@@ -541,7 +528,7 @@ export default {
//-----------------
let fetchOptions = {
const fetchOptions = {
method: "post",
mode: "cors",
headers: {
@@ -565,7 +552,7 @@ export default {
//
//
async upload(route, at) {
let that = this;
const that = this;
try {
var files = at.files;
var data = new FormData();
@@ -585,7 +572,7 @@ export default {
//-----------------
let fetchOptions = {
const fetchOptions = {
method: "post",
mode: "cors",
headers: {
@@ -608,14 +595,14 @@ export default {
//
//
async uploadLogo(fileData, size) {
let that = this;
const that = this;
try {
let data = new FormData();
const data = new FormData();
data.append(fileData.name, fileData);
//-----------------
let fetchOptions = {
const fetchOptions = {
method: "post",
mode: "cors",
headers: {
@@ -654,13 +641,13 @@ export default {
//
//
async renderReport(objectid, reportid, redirectNotPopup) {
let reportDataOptions = {
const reportDataOptions = {
ReportId: reportid,
SelectedRowIds: [objectid],
ClientMeta: this.reportClientMetaData()
};
let res = await window.$gz.api.upsert("report/render", reportDataOptions);
const res = await window.$gz.api.upsert("report/render", reportDataOptions);
if (res.error) {
if (redirectNotPopup) {
return res;
@@ -668,7 +655,7 @@ export default {
throw new Error(window.$gz.errorHandler.errorToString(res));
}
} else {
let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
const reportUrl = window.$gz.api.reportDownloadUrl(res.data);
if (redirectNotPopup) {
//used for direct report open from direct report view url
window.location.replace(reportUrl);
@@ -686,10 +673,7 @@ export default {
//
//
async fetchBizObjectName(ayaType, objectId) {
//todo: this is a good candidate for a light weight cache
//maybe one hour or something to invalidate and volatile on refresh
let res = await this.get(`name/${ayaType}/${objectId}`);
const res = await this.get(`name/${ayaType}/${objectId}`);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);

View File

@@ -1,4 +1,3 @@
/* Xeslint-disable */
let VM_LOCAL = null;
//Calculate a reasonable time to show the alert based on the size of the message and some sane bounds

View File

@@ -1,4 +1,3 @@
/* xeslint-disable */
///////////////////////////////
// gzform
//
@@ -31,7 +30,6 @@ function isInt(value) {
return false;
}
x = parseFloat(value);
// console.log("isInt:", x);
return (x | 0) === x;
}
@@ -47,27 +45,14 @@ function isNumber(n) {
// Get control from ref
//
function getControl(vm, ref) {
let ctrl = vm.$refs[ref];
// if (vm.$ay.dev) {
// // //NOTE: Due to automatic code formatting some refs will come here with newlines in them resulting in no matches
// // console.log("ref before is", ref);
// // let tref = ref.replace(/\s/g, "");
// // console.log("gzform::getcontrol, ref is ", { tref: tref, ref: ref });
// if (ctrl == null) {
// console.log(`gzform::getControl ref ${ref} not found on form`);
// } else {
// console.log(`gzform::getControl ref ${ref} *WAS* found on form!`);
// }
// }
return ctrl;
return vm.$refs[ref];
}
////////////////////////////////////
// Get value from control
//
function getControlValue(ctrl) {
let value = ctrl.value;
return value;
return ctrl.value;
}
////////////////////////////////////
@@ -149,23 +134,23 @@ export default {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (!isEmpty(value)) {
return true;
}
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
let err = vm.$ay.t("ErrorRequiredFieldEmpty");
let fieldName = getControlLabel(ctrl);
const fieldName = getControlLabel(ctrl);
err = err.replace("{0}", fieldName);
//replace only replaces first instance so need to do it twice
err = err.replace("{0}", fieldName);
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -180,12 +165,12 @@ export default {
if (vm.formState.loading) {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
@@ -194,10 +179,10 @@ export default {
//get the translated rule text
// "ErrorFieldLengthExceeded": "{0} can not exceed {1} characters.",
let err = vm.$ay.t("ErrorFieldLengthExceeded");
let fieldName = getControlLabel(ctrl);
const fieldName = getControlLabel(ctrl);
err = err.replace("{0}", fieldName);
err = err.replace("{1}", max);
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -224,12 +209,12 @@ export default {
if (vm.formState.loading) {
return true;
}
let ctrlStart = getControl(vm, refStart);
const ctrlStart = getControl(vm, refStart);
if (typeof ctrlStart == "undefined") {
return true;
}
let ctrlEnd = getControl(vm, refEnd);
const ctrlEnd = getControl(vm, refEnd);
if (typeof ctrlEnd == "undefined") {
return true;
}
@@ -255,8 +240,8 @@ export default {
if (valueStart > valueEnd) {
// "ErrorStartDateAfterEndDate": "Start date must be earlier than stop / end date",
let err = vm.$ay.t("ErrorStartDateAfterEndDate");
//Update the form status
const err = vm.$ay.t("ErrorStartDateAfterEndDate");
this.setFormState({
vm: vm,
valid: false
@@ -274,21 +259,21 @@ export default {
if (vm.formState.loading) {
return true;
}
let ctrlFirst = getControl(vm, refFirst);
const ctrlFirst = getControl(vm, refFirst);
if (typeof ctrlFirst == "undefined") {
return true;
}
let ctrlSecond = getControl(vm, refSecond);
const ctrlSecond = getControl(vm, refSecond);
if (typeof ctrlSecond == "undefined") {
return true;
}
let valueFirst = getControlValue(ctrlFirst);
let valueSecond = getControlValue(ctrlSecond);
const valueFirst = getControlValue(ctrlFirst);
const valueSecond = getControlValue(ctrlSecond);
if (valueFirst != valueSecond) {
let err = vm.$ay.t("ErrorNoMatch");
//Update the form status
const err = vm.$ay.t("ErrorNoMatch");
this.setFormState({
vm: vm,
valid: false
@@ -305,27 +290,15 @@ export default {
if (vm.formState.loading) {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
//this block doesn't work and shouldn't be here afaict
//if you type a letter for example it presents as empty, I guess because it's set to a numeric input type
//in any case, empty isn't a valid integer so it should show as a broken rule when a letter or empty is entered
// if (isEmpty(value)) {
// return true;
// }
const value = getControlValue(ctrl);
if (isInt(value)) {
return true;
}
// "ErrorFieldValueNotInteger": "Value must be an integer"
let err = vm.$ay.t("ErrorFieldValueNotInteger");
//Update the form status
const err = vm.$ay.t("ErrorFieldValueNotInteger");
this.setFormState({
vm: vm,
valid: false
@@ -343,15 +316,12 @@ export default {
//TODO: Handle commas and spaces in numbers
//as per window.$gz.translation rules for numbers
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
//DEBUG
//logControl("decimalValid", ctrl, ref);
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
@@ -360,9 +330,7 @@ export default {
return true;
}
// "ErrorFieldValueNotDecimal": "Value must be a number"
let err = vm.$ay.t("ErrorFieldValueNotDecimal");
//Update the form status
const err = vm.$ay.t("ErrorFieldValueNotDecimal");
this.setFormState({
vm: vm,
valid: false
@@ -380,12 +348,12 @@ export default {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
@@ -399,11 +367,10 @@ export default {
return true;
}
// "ErrorFieldValueNumberGreaterThanMax": "Value must be less than XX"
let err = `${vm.$ay
const err = `${vm.$ay
.t("ErrorFieldValueNumberGreaterThanMax")
.replace("{0}", maxValue)} ${maxValue}`;
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -421,12 +388,12 @@ export default {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
@@ -441,11 +408,10 @@ export default {
return true;
}
// "ErrorFieldValueNumberLessThanMin": "Value must be more than XX"
let err = `${vm.$ay
const err = `${vm.$ay
.t("ErrorFieldValueNumberLessThanMin")
.replace("{0}", minValue)} ${minValue}`;
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -459,15 +425,12 @@ export default {
if (vm.formState.loading) {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
//DEBUG
//logControl("emailValid", ctrl, ref);
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
@@ -476,8 +439,8 @@ export default {
return true;
}
let err = vm.$ay.t("ErrorAPI2203"); //"Invalid value"
//Update the form status
const err = vm.$ay.t("ErrorAPI2203"); //"Invalid value"
this.setFormState({
vm: vm,
valid: false
@@ -492,7 +455,7 @@ export default {
return true;
}
let template =
const template =
window.$gz.store.state.formCustomTemplate[vm.formCustomTemplateKey];
if (template === undefined) {
return true;
@@ -500,36 +463,31 @@ export default {
//See if control formCustomTemplateFieldName is in server required fields collection
//this is a collection of both custom field definitions and standard form fields that are required
//since all names are unique can just filter out the one we need by name which will inherently ignore custom fields by default
//de-lodash
// let templateItem = window.$gz. _.find(template, [
// "fld",
// formCustomTemplateFieldName
// ]);
let templateItem = template.find(z => z.fld == formCustomTemplateFieldName);
const templateItem = template.find(
z => z.fld == formCustomTemplateFieldName
);
//templateItem.required
if (templateItem === undefined || templateItem.required !== true) {
return true;
}
let ctrl = getControl(vm, ref);
const ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
const value = getControlValue(ctrl);
if (!isEmpty(value)) {
return true;
}
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
let err = vm.$ay.t("ErrorRequiredFieldEmpty");
let fieldName = getControlLabel(ctrl);
const fieldName = getControlLabel(ctrl);
err = err.replace("{0}", fieldName);
//replace only replaces first instance so need to do it twice
err = err.replace("{0}", fieldName);
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -549,18 +507,17 @@ export default {
return true;
}
let value = subvm.GetValueForField(templateItem.dataKey);
const value = subvm.GetValueForField(templateItem.dataKey);
if (!isEmpty(value)) {
return true;
}
//It's empty and it's required so return error
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
let err = vm.$ay.t("ErrorRequiredFieldEmpty");
err = err.replace("{0}", fieldName);
//replace only replaces first instance so need to do it twice
err = err.replace("{0}", fieldName);
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -577,14 +534,12 @@ export default {
// errors in the UI by Vuetify
//
serverErrors(vm, ref) {
let ret = [];
const ret = [];
//check for errors if we have any errors
if (!window.$gz.util.objectIsEmpty(vm.formState.serverError)) {
//de-lodash
//First let's get the top level error code
let apiErrorCode = parseInt(vm.formState.serverError.code);
const apiErrorCode = parseInt(vm.formState.serverError.code);
//Not all server errors mean the form is invalid, exceptions here
let formValid = false;
@@ -616,7 +571,6 @@ export default {
err = err + "\r\n" + vm.formState.serverError.message;
}
//Update the form status
this.setFormState({
vm: vm,
valid: formValid
@@ -629,14 +583,14 @@ export default {
//Specific field validation errors are in an array in "details" key
if (!window.$gz.util.objectIsEmpty(vm.formState.serverError.details)) {
//See if this key is in the details array
let errorsForField = getErrorsForField(vm, ref);
const errorsForField = getErrorsForField(vm, ref);
if (errorsForField.length > 0) {
//iterate the errorsForField object and add each to return array of errors
//de-lodash
//window.$gz. _.each(errorsForField, function(ve) {
errorsForField.forEach(function(ve) {
let fldErr = "";
let fldErrorCode = parseInt(ve.error);
const fldErrorCode = parseInt(ve.error);
fldErr =
vm.$ay.t("ErrorAPI" + fldErrorCode.toString()) +
" [" +
@@ -657,7 +611,6 @@ export default {
}
});
//Update the form status
this.setFormState({
vm: vm,
valid: false
@@ -772,7 +725,7 @@ export default {
vm.formState.appError = null;
//clear out actual message box display
vm.formState.errorBoxMessage = null;
//Update the form status
this.setFormState({
vm: vm,
valid: true
@@ -783,8 +736,8 @@ export default {
// Gather server errors and set the appropriate keys
//
setErrorBoxErrors(vm) {
let errs = this.serverErrors(vm, "generalerror");
let ret = getErrorBoxErrors(vm, errs);
const errs = this.serverErrors(vm, "generalerror");
const ret = getErrorBoxErrors(vm, errs);
vm.formState.errorBoxMessage = ret;
},
///////////////////////////////
@@ -796,7 +749,7 @@ export default {
//
//
fieldValueChanged(vm, ref, formReference) {
let that = this;
const that = this;
let formControl = null;
if (formReference == undefined) {
formControl = vm.$refs.form;
@@ -806,9 +759,6 @@ export default {
formControl = vm.$refs[formReference];
}
//NOTE: Due to automatic code formatting some refs may come here with newlines in them resulting in no matches
// ref = ref.replace(/\s/g, "");
//dev error on form?
if (formControl == null) {
if (vm.$ay.dev) {
@@ -829,7 +779,7 @@ export default {
}
//# REMOVE SERVER ERRORS FOR THIS FIELD REF
let targetRef = ref.toLowerCase();
const targetRef = ref.toLowerCase();
//NOTE: This block of code is meant to remove all detailed server errors where the Target matches the current referenced control
//Then it checks to see if there is anything left in details as this might have been all there was and if so removes that whole thing
@@ -876,7 +826,7 @@ export default {
if (targetFieldHasServerError) {
triggeringChange = true;
let val = vm.obj[ref];
const val = vm.obj[ref];
vm.obj[ref] = null;
vm.obj[ref] = val;
triggeringChange = false;
@@ -927,12 +877,10 @@ export default {
// and temporary ones are stored in session storage and don't persist a refresh
//
getFormSettings(formKey) {
let formSettings = {
return {
temp: JSON.parse(sessionStorage.getItem(formKey)),
saved: window.$gz.store.state.formSettings[formKey]
};
return formSettings;
},
////////////////////////////////////
// Set form settings
@@ -940,14 +888,6 @@ export default {
// requires object with one or both keys {temp:{...tempformsettings...},saved:{...persistedformsettings...}}
//
setFormSettings(formKey, formSettings) {
// if (window.$gz.dev) {
// if (!formSettings.saved && !formSettings.temp) {
// throw new Error(
// "gzform:setFormSettings - saved AND temp keys are both missing from form data!"
// );
// }
// }
if (formSettings.saved) {
window.$gz.store.commit("setFormSettings", {
formKey: formKey,
@@ -962,7 +902,7 @@ export default {
// Get last report used from form settings
//
getLastReport(formKey) {
let fs = window.$gz.store.state.formSettings[formKey];
const fs = window.$gz.store.state.formSettings[formKey];
if (fs == null || fs.lastReport == null) {
return null;
}
@@ -971,12 +911,7 @@ export default {
// Set last report used in form settings
//
setLastReport(formKey, reportSelected) {
// console.log("setLastReport called", {
// formKey: formKey,
// reportSelected: reportSelected
// });
let fs = window.$gz.store.state.formSettings[formKey];
//console.log("setlast report retrieved formsettings is:",fs)
if (fs == null) {
fs = {};
}
@@ -1010,8 +945,6 @@ export default {
// Get validity of referenced control
//
controlIsValid(vm, ref) {
// //NOTE: Due to automatic code formatting some refs will come here with newlines in them resulting in no matches
// ref = ref.replace(/\s/g, "");
if (vm.$refs[ref]) {
return vm.$refs[ref].valid;
}
@@ -1023,7 +956,7 @@ export default {
controlsAreAllValid(vm, refs) {
//if any are not valid return false
for (let i = 0; i < refs.length; i++) {
let item = refs[i];
const item = refs[i];
if (vm.$refs[item]) {
if (!vm.$refs[item].valid) {
return false;
@@ -1037,7 +970,7 @@ export default {
//
handleObjectNotFound(vm) {
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("ErrorAPI2010"));
// navigate backwards after small delay to show error
//after small delay to show error
//(the navigate removes the toast notification immediately)
setTimeout(function() {
vm.$router.go(-1);

View File

@@ -1,7 +1,3 @@
/* xxxeslint-disable */
// import { VMain } from "vuetify/lib";
/////////////////////////////////
// Menu utils and handlers
//
@@ -10,10 +6,10 @@ export default {
// TECH SUPPORT / CONTACT FORUM URL
//
contactSupportUrl() {
let dbId = encodeURIComponent(
const dbId = encodeURIComponent(
window.$gz.store.state.globalSettings.serverDbId
);
let company = encodeURIComponent(
const company = encodeURIComponent(
window.$gz.store.state.globalSettings.company
);
return `https://contact.ayanova.com/contact?dbid=${dbId}&company=${company}`;
@@ -24,7 +20,7 @@ export default {
// Deal with a menu change request
// called from App.vue
handleMenuChange(vm, ctx) {
let UTILITY_TYPES = [
const UTILITY_TYPES = [
window.$gz.type.NoType,
window.$gz.type.Global,
window.$gz.type.NoType,
@@ -62,7 +58,7 @@ export default {
if (ctx && ctx.formData && ctx.formData.recordName) {
recordName = ctx.formData.recordName;
}
let hasRecordName = recordName != "";
const hasRecordName = recordName != "";
if (ctx.title) {
//it has a title translation key
if (hasRecordName) {
@@ -101,7 +97,7 @@ export default {
}
//flag for if it's wikiable, reviewable, attachable, searchable, historical
let isCoreBizObject = formAyaType != 0 && formRecordId != 0;
const isCoreBizObject = formAyaType != 0 && formRecordId != 0;
//set the help url if presented or default to the User section intro
vm.appBar.helpUrl = ctx.helpUrl ? ctx.helpUrl : "user-intro";
@@ -169,15 +165,6 @@ export default {
//GLOBAL BOTTOM PORTION
//Global sub-heading
//Likely won't want this but here anyway to see
//that.appBar.menuItems.push({ header: "GLOBAL" });
//global menu items
//divider
//vm.appBar.menuItems.push({ divider: true, inset: false });
//SEARCH
//all forms except the search form
if (!ctx.hideSearch && !UTILITY_TYPES.includes(formAyaType)) {
@@ -240,7 +227,7 @@ export default {
//Find the menu item and set it to disabled and recolor it to disabled color and return
for (let i = 0; i < vm.appBar.menuItems.length; i++) {
let menuItem = vm.appBar.menuItems[i];
const menuItem = vm.appBar.menuItems[i];
if (menuItem.key == key) {
vm.$set(vm.appBar.menuItems[i], "disabled", disabled);
//menuItem.disabled = disabled;
@@ -261,7 +248,7 @@ export default {
//Find the menu item and change it's icon
for (let i = 0; i < vm.appBar.menuItems.length; i++) {
let menuItem = vm.appBar.menuItems[i];
const menuItem = vm.appBar.menuItems[i];
if (menuItem.key == key) {
vm.$set(vm.appBar.menuItems[i], "icon", newIcon);
return;
@@ -281,12 +268,11 @@ export default {
//each part is separated by a colon
//Handle different items
let item = this.parseMenuItem(menuItem);
const item = this.parseMenuItem(menuItem);
if (!item.disabled && item.owner == "app") {
switch (item.key) {
case "help":
let helpurl = vm.$store.state.helpUrl + item.data;
window.open(helpurl, "_blank");
window.open(vm.$store.state.helpUrl + item.data, "_blank");
break;
case "search":
vm.$router.push({
@@ -294,19 +280,9 @@ export default {
params: { ayatype: item.data }
});
break;
// case "attachments":
// vm.$router.push({
// name: "ay-attachments",
// params: { ayatype: item.data.ayaType, recordid: item.data.recordId }
// });
// break;
// case "plugin":
// alert("STUB: plugin / more");
// break;
case "review":
//go to list
// path: "/home-reviews/:aType?/:objectId?",
vm.$router.push({
name: "home-reviews",
params: {
@@ -350,8 +326,8 @@ export default {
parseMenuItem(menuItem) {
//format is "AREA:KEY:UNIQUEID"
//and data is in data portion
let keyparts = menuItem.key.split(":");
let ret = {
const keyparts = menuItem.key.split(":");
const ret = {
owner: keyparts[0],
key: keyparts[1],
data: menuItem.data,
@@ -369,38 +345,38 @@ export default {
// called once from app.vue only
//
wireUpEventHandlers(vm) {
let self = this;
const that = this;
window.$gz.eventBus.$on("menu-change", function handleMenuChange(ctx) {
self.handleMenuChange(vm, ctx);
that.handleMenuChange(vm, ctx);
});
window.$gz.eventBus.$on("menu-replace-item", function handleReplaceMenuItem(
newItem
) {
self.handleReplaceMenuItem(vm, newItem);
that.handleReplaceMenuItem(vm, newItem);
});
window.$gz.eventBus.$on("menu-disable-item", function handleDisableMenuItem(
key
) {
self.handleDisableMenuItem(vm, key, true);
that.handleDisableMenuItem(vm, key, true);
});
window.$gz.eventBus.$on("menu-enable-item", function handleDisableMenuItem(
key
) {
self.handleDisableMenuItem(vm, key, false);
that.handleDisableMenuItem(vm, key, false);
});
window.$gz.eventBus.$on(
"menu-change-item-icon",
function handleChangeMenuItemIcon(key, newIcon) {
self.handleChangeMenuItemIcon(vm, key, newIcon);
that.handleChangeMenuItemIcon(vm, key, newIcon);
}
);
window.$gz.eventBus.$on("menu-click", function handleMenuClick(menuitem) {
self.handleAppClick(vm, menuitem);
that.handleAppClick(vm, menuitem);
});
}
//new functions above here

View File

@@ -1,5 +1,3 @@
/* Xeslint-disable */
/////////////////////////////////
// General utility library
//
@@ -206,7 +204,7 @@ export default {
if (!number || number == 0 || number == NaN) {
return number;
}
let wasNegative = number < 0;
const wasNegative = number < 0;
if (wasNegative) {
number = Math.abs(number); //make sure it's positive because rounding negative numbers is weird in JS
}
@@ -223,29 +221,6 @@ export default {
// Clean up a tag with same rules as server
//
normalizeTag: function(tagName) {
/*
SERVER VERSION
public static string NormalizeTag(string inObj)
{
if (string.IsNullOrWhiteSpace(inObj)) return null;
//Must be lowercase per rules
//This may be naive when we get international cust omers but for now supporting utf-8 and it appears it's safe to do this with unicode
inObj = inObj.ToLowerInvariant();
//No spaces in tags, replace with dashes
inObj = inObj.Replace(" ", "-");
//Remove multiple dash sequences
inObj = System.Text.RegularExpressions.Regex.Replace(inObj, "-+", "-");
//Ensure doesn't start or end with a dash
inObj = inObj.Trim('-');
//No longer than 255 characters
inObj = StringUtil.MaxLength(inObj, 255);
return inObj;
}
*/
//de-lodash
//kebab case takes care of all the things we need for tags in one go
// tagName = window.$gz. _.kebabCase(tagName);
if (!tagName || tagName == "") {
return null;
}
@@ -271,9 +246,9 @@ export default {
// https://stackoverflow.com/a/7616484/8939
//
quickHash: function(theString) {
let hash = 0,
i,
chr;
let hash = 0;
let i;
let chr;
if (theString.length === 0) return hash;
for (i = 0; i < theString.length; i++) {
chr = theString.charCodeAt(i);
@@ -289,10 +264,9 @@ export default {
// using 32 character (128 bit) as default
//
getRandomPassword: function() {
let length = 32,
wishlist = "0123456789abcdefghijkmnopqrstuvwxyz";
const wishlist = "0123456789abcdefghijkmnopqrstuvwxyz";
return Array.from(crypto.getRandomValues(new Uint32Array(length)))
return Array.from(crypto.getRandomValues(new Uint32Array(32)))
.map(x => wishlist[x % wishlist.length])
.join("");
},
@@ -337,7 +311,7 @@ export default {
return 0;
}
let ret = parseFloat(string.replace(/[^\d.-]/g, ""));
const ret = parseFloat(string.replace(/[^\d.-]/g, ""));
if (ret == NaN) {
return 0;
}
@@ -582,8 +556,8 @@ export default {
}
mimeType = mimeType.toLowerCase();
let iconFromExtension = extensions[extension];
let iconFromMIME = mimeTypes[mimeType];
const iconFromExtension = extensions[extension];
const iconFromMIME = mimeTypes[mimeType];
if (iconFromMIME) {
return iconFromMIME;
@@ -643,8 +617,8 @@ export default {
// https://stackoverflow.com/a/55292366/8939
//
trimSpecific: function trim(str, ch) {
var start = 0,
end = str.length;
var start = 0;
var end = str.length;
while (start < end && str[start] === ch) ++start;
while (end > start && str[end - 1] === ch) --end;
return start > 0 || end < str.length ? str.substring(start, end) : str;
@@ -661,23 +635,6 @@ export default {
// is string replacement for lodash
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isString
//
// isString: function(str) {
// //modified from above, due to bug (I think)
// //posted case here: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore/issues/304
// if (str == null) {
// return false;
// }
// if (str == "") {//another bug, if numeric this is true?! Using recommended method below
// return true;
// }
// let temp = str.valueOf();
// if (typeof temp === "string") {
// return true;
// } else {
// return false;
// }
// },
isString: function(str) {
return str != null && typeof str.valueOf() === "string";
},
@@ -790,25 +747,13 @@ export default {
//
//
viewGeoLocation: function(obj) {
/*
{
latitude: m.vm.obj.latitude,
longitude: m.vm.obj.longitude,
address: m.vm.obj.address || m.vm.obj.postAddress,
city: m.vm.obj.city || m.vm.obj.postCity,
region: m.vm.obj.region || m.vm.obj.postRegion,
country: m.vm.obj.country || m.vm.obj.postCountry,
postCode: m.vm.obj.postCode
}
*/
let hasGeo =
const hasGeo =
obj.latitude != null &&
obj.latitude != 0 &&
obj.longitude != null &&
obj.longitude != 0;
let hasAddress =
const hasAddress =
!this.stringIsNullOrEmpty(obj.address) &&
!this.stringIsNullOrEmpty(obj.city) &&
!this.stringIsNullOrEmpty(obj.region) &&
@@ -857,7 +802,7 @@ export default {
//order street to country seems to be standard
//note, if google need plus symbol delimiter, if bing, need comma delimiter
//but both might accept one big string space delimited and url encoded so test that on all first
let delimiter = " ";
const delimiter = " ";
let q = "";
if (obj.address) {
q += obj.address + delimiter;
@@ -949,15 +894,6 @@ export default {
//
//
calendarViewToAyaNovaEnum: function(view) {
/*
public enum ScheduleView : int
{
Day = 1,
Week = 2,
Month = 3,
Day4 = 4
}
*/
switch (view) {
case "day":
return 1;

View File

@@ -1,11 +1,9 @@
/* Xeslint-disable */
function addNavItem(title, icon, route, navItems, key, testid, color = null) {
if (!testid) {
testid = route;
}
let o = {
const o = {
title,
icon,
route,
@@ -23,11 +21,8 @@ function addNavItem(title, icon, route, navItems, key, testid, color = null) {
function initNavPanel() {
let key = 0;
let sub = [];
// let t = window.$gz.translation.get;
// let role = window.$gz.role.AUTHORIZATION_ROLES;
let licenseState = window.$gz.store.state.globalSettings.licenseStatus;
let useInventory = window.$gz.store.state.globalSettings.useInventory;
const licenseState = window.$gz.store.state.globalSettings.licenseStatus;
const useInventory = window.$gz.store.state.globalSettings.useInventory;
/*Service = 1,
NotService = 2,
Customer = 3,
@@ -109,7 +104,6 @@ function initNavPanel() {
}
//###### SUBCONTRACTORS ######
//console.log(window.$gz.store.getters.isSubContractorUser);
if (window.$gz.store.getters.isSubContractorUser == true) {
//clear sublevel array
sub = [];
@@ -748,14 +742,14 @@ function initNavPanel() {
async function getUserOptions() {
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"user-option/" + window.$gz.store.state.userId
);
if (res.error) {
//In a form this would trigger a bunch of validation or error display code but for here and now:
//convert error to human readable string for display and popup a notification to user
let msg = window.$gz.api.apiErrorToHumanString(res.error);
const msg = window.$gz.api.apiErrorToHumanString(res.error);
window.$gz.store.commit(
"logItem",
"Initialize::() fetch useroptions -> error" + msg
@@ -765,7 +759,7 @@ async function getUserOptions() {
//Check if overrides and use them here
//or else use browser defaults
let l = {
const l = {
languageOverride: null,
timeZoneOverride: null,
currencyName: null,
@@ -775,16 +769,6 @@ async function getUserOptions() {
mapUrlTemplate: null
};
//removed this block, locale already attempts this fully and this should really only set the user persisted value, not guess it here
//get language to use, try user set override first, if empty then browser set, if empty then default to en-us
// l.languageOverride =
// res.data.languageOverride || window.navigator.languages[0] || "en-US";
// l.timeZoneOverride =
// res.data.timeZoneOverride ||
// window.$gz.locale.getResolvedTimeZoneName() ||
// "America/New_York";
l.languageOverride = res.data.languageOverride;
l.timeZoneOverride = res.data.timeZoneOverride;

View File

@@ -1,8 +1,4 @@
/* ZZeslint-disable */
//Browser Locale conversion utilities
// import { faYinYang } from "@fortawesome/free-solid-svg-icons";
//dates,numbers currency etc
export default {
////////////////////////////////////////////////////////
@@ -62,7 +58,7 @@ export default {
//https://en.wikipedia.org/wiki/ISO_4217
//default to USD if nothing specified
getCurrencyName() {
let cur = window.$gz.store.state.userOptions.currencyName;
const cur = window.$gz.store.state.userOptions.currencyName;
if (!window.$gz.util.stringIsNullOrEmpty(cur)) {
return cur;
} else {
@@ -165,7 +161,7 @@ export default {
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
let parsedDate = new Date(value);
const parsedDate = new Date(value);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
@@ -194,7 +190,7 @@ export default {
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
let parsedDate = new Date(value);
const parsedDate = new Date(value);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
@@ -225,7 +221,7 @@ export default {
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
let parsedDate = new Date(value);
const parsedDate = new Date(value);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
@@ -252,7 +248,7 @@ export default {
let theSeconds = 0;
let ret = "";
let work = value.split(":");
const work = value.split(":");
//has days?
if (work[0].includes(".")) {
let dh = work[0].split(".");
@@ -340,7 +336,7 @@ export default {
if (!timeZoneName) {
timeZoneName = this.getResolvedTimeZoneName();
}
let ret = window.$gz.DateTime.local()
const ret = window.$gz.DateTime.local()
.setZone(timeZoneName)
.toUTC()
.toString();
@@ -406,7 +402,7 @@ export default {
if (!timeZoneName) {
timeZoneName = this.getResolvedTimeZoneName();
}
let ret = window.$gz.DateTime.local()
const ret = window.$gz.DateTime.local()
.setZone(timeZoneName)
.toString();
return ret;

View File

@@ -1,4 +1,3 @@
/* xxxeslint-disable */
import ayatype from "./ayatype";
export default {
///////////////////////////////
@@ -19,7 +18,7 @@ export default {
}
if (tid.type && tid.id != null) {
let isCustomerTypeUser =
const isCustomerTypeUser =
window.$gz.store.state.userType == 3 ||
window.$gz.store.state.userType == 4;
//if these come from route parameters they may well be strings
@@ -68,7 +67,7 @@ export default {
case ayatype.WorkOrderItemUnit:
(async () => {
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`search/ancestor/${tid.type}/${tid.id}`
);
@@ -112,7 +111,7 @@ export default {
case ayatype.QuoteItemUnit:
(async () => {
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`search/ancestor/${tid.type}/${tid.id}`
);
@@ -157,7 +156,7 @@ export default {
case ayatype.PMItemUnit:
(async () => {
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`search/ancestor/${tid.type}/${tid.id}`
);
@@ -233,11 +232,10 @@ export default {
tid.inside = true;
}
if (tid.inside == undefined) {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"user/inside-type/" + tid.id
);
if (res.error) {
//throw new Error(res.error);
throw new Error(
window.$gz.errorHandler.errorToString(res, vm)
);
@@ -276,7 +274,7 @@ export default {
(async () => {
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"attachment/parent/" + tid.id
);
@@ -326,12 +324,11 @@ export default {
//all we have is the id, but need the formkey to open it
(async () => {
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"form-custom/form-key/" + tid.id
);
if (res.error) {
//throw new Error(res.error);
throw new Error(
window.$gz.errorHandler.errorToString(res, vm)
);
@@ -506,12 +503,12 @@ export default {
// called once from app.vue only
//
wireUpEventHandlers(vm) {
let self = this;
const that = this;
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
window.$gz.eventBus.$on("openobject", function handleOpenObjectClickHandler(
tid
) {
self.handleOpenObjectClick(vm, tid);
that.handleOpenObjectClick(vm, tid);
});
}
//new functions above here

View File

@@ -22,7 +22,7 @@ export default {
soft_gray: "#d2d7db"
},
getBoldPaletteArray(size) {
let palette = [
const palette = [
this.color.blue,
this.color.red,
this.color.green,
@@ -32,15 +32,15 @@ export default {
this.color.teal,
this.color.black
];
let paletteLength = palette.length;
let ret = [];
const paletteLength = palette.length;
const ret = [];
for (let i = 0; i < size; i++) {
ret.push(palette[i % paletteLength]);
}
return ret;
},
getSoftPaletteArray(size) {
let palette = [
const palette = [
this.color.soft_sand,
this.color.soft_pale_blue,
this.color.soft_gray,
@@ -50,8 +50,8 @@ export default {
this.color.soft_sand_taupe,
this.color.soft_brown_darker
];
let paletteLength = palette.length;
let ret = [];
const paletteLength = palette.length;
const ret = [];
for (let i = 0; i < size; i++) {
ret.push(palette[i % paletteLength]);
}

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////
@@ -24,9 +24,13 @@ export default {
//NOTE: it's valid for one of the two ret values might be undefined as it's valid to have a single date for
//Past or Future
let ret = { after: undefined, before: undefined };
let dtNow = window.$gz.DateTime.local();
let dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day);
const ret = { after: undefined, before: undefined };
const dtNow = window.$gz.DateTime.local();
const dtToday = window.$gz.DateTime.local(
dtNow.year,
dtNow.month,
dtNow.day
);
let dtAfter = null;
let dtBefore = null;
@@ -613,403 +617,4 @@ export default {
return ret;
}
/*
{ name: vm.$ay.t("DateRangeJanuary"), id: "*january*" },
{ name: vm.$ay.t("DateRangeFebruary"), id: "*february*" },
{ name: vm.$ay.t("DateRangeMarch"), id: "*march*" },
{ name: vm.$ay.t("DateRangeApril"), id: "*april*" },
{ name: vm.$ay.t("DateRangeMay"), id: "*may*" },
{ name: vm.$ay.t("DateRangeJune"), id: "*june*" },
{ name: vm.$ay.t("DateRangeJuly"), id: "*july*" },
{ name: vm.$ay.t("DateRangeAugust"), id: "*august*" },
{ name: vm.$ay.t("DateRangeSeptember"), id: "*september*" },
{ name: vm.$ay.t("DateRangeOctober"), id: "*october*" },
{ name: vm.$ay.t("DateRangeNovember"), id: "*november*" },
{ name: vm.$ay.t("DateRangeDecember"), id: "*december*" },
{
name: vm.$ay.t("DateRangePreviousYearThisMonth"),
id: "*lastyearthismonth*"
},
{
name: vm.$ay.t("DateRangePreviousYearLastMonth"),
id: "*lastyearlastmonth*"
},
{
name: vm.$ay.t("DateRangePreviousYearNextMonth"),
id: "*lastyearnextmonth*"
}
*/
//new functions above here
};
//LUXON MATH: https://moment.github.io/luxon/docs/manual/zones.html#math-across-dsts
//https://moment.github.io/luxon/docs/manual/math.html
//luxon api ref: https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html
// //############################################################### OLD SERVER FILTERING CODE ##########################
// //HOWEVER, if it's a relative date filter TOKEN like "nextMonth" then the users time zone offset will be taken into consideration
// //So this is the core date time to work off of
// DateTime RelativeToday = DateTime.Today;
// DateTime RelativeNow = DateTime.Now;
// // ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FilterSqlCriteriaBuilder::DataFilterToColumnCriteria");
// // log.LogInformation("RelativeToday (before adjustment):");
// // log.LogInformation(RelativeToday.ToString());
// // log.LogInformation("RelativeNow (before adjustment):");
// // log.LogInformation(RelativeNow.ToString());
// if (sValue.StartsWith("{[") && sValue.EndsWith("]}"))
// {
// //Need to adjust RelativeToday to users time frame
// //Fetch useroptions object and relative time offset
// //See servers spec doc core-locale-currency-numbers-time-and-dates.txt for details about why this is necessary to be done this way
// AyaNova.Models.AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext;
// let u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { tz = m.UserOptions.TimeZoneOffset }).First();
// //Add this value to any time's hours to convert to user local time
// Double TimeZoneAdjustment = ((double)u.tz) * -1;
// //Stock times used for many of the tokens:
// RelativeToday = RelativeToday.AddHours(TimeZoneAdjustment);//flip the sign to adjust towards UTC
// RelativeNow = RelativeNow.AddHours(TimeZoneAdjustment);//flip the sign to adjust towards UTC
// //TESTING:
// //LOG THE CRIT AND QUERY
// // ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FilterSqlCriteriaBuilder::DataFilterToColumnCriteria");
// // log.LogInformation("RelativeToday (adjusted):");
// // log.LogInformation(RelativeToday.ToString());
// // log.LogInformation("RelativeNow (adjusted):");
// // log.LogInformation(RelativeNow.ToString());
// // log.LogInformation("Offset used:");
// // log.LogInformation(u.tz.ToString());
// #region Build criteria for date RANGE TOKEN specified
// //Used as the basis point
// System.DateTime dtAfter;
// System.DateTime dtBefore;
// switch (sValue)
// {
// //Case 402
// case DataListFilterSpecialToken.Yesterday:
// //Between Day before yesterday at midnight and yesterday at midnight
// dtAfter = RelativeToday.AddDays(-1);
// dtAfter = dtAfter.AddSeconds(-1);
// dtBefore = RelativeToday;//.AddDays(-1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.Today:
// //Between yesterday at midnight and tommorow at midnight
// dtAfter = RelativeToday.AddSeconds(-1);
// dtBefore = RelativeToday.AddDays(1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.Tomorrow:
// //Between Tonight at midnight and day after tommorow at midnight
// dtAfter = RelativeToday.AddDays(1);
// dtAfter = dtAfter.AddSeconds(-1);
// dtBefore = RelativeToday.AddDays(2);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// //Case 402
// case DataListFilterSpecialToken.LastWeek:
// //Between two Sundays ago at midnight and last sunday at midnight
// dtAfter = RelativeToday;
// //go back a week
// dtAfter = dtAfter.AddDays(-7);
// //go backwards to Sunday
// while (dtAfter.DayOfWeek != DayOfWeek.Sunday)
// dtAfter = dtAfter.AddDays(-1);
// //go to very start of eighth dayahead
// dtBefore = dtAfter.AddDays(8);
// dtAfter = dtAfter.AddSeconds(-1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.ThisWeek:
// //Between Sunday at midnight and Next sunday at midnight
// dtAfter = RelativeToday;
// //go backwards to monday
// while (dtAfter.DayOfWeek != DayOfWeek.Monday)
// dtAfter = dtAfter.AddDays(-1);
// //Now go back to sunday last second
// dtAfter = dtAfter.AddSeconds(-1);
// dtBefore = RelativeToday;
// //go forwards to monday
// if (RelativeToday.DayOfWeek == DayOfWeek.Monday)
// {
// //Monday today? then go to next monday
// dtBefore = dtBefore.AddDays(7);
// }
// else
// {
// while (dtBefore.DayOfWeek != DayOfWeek.Monday)
// dtBefore = dtBefore.AddDays(1);
// }
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.NextWeek:
// //Between Next Sunday at midnight and Next Next sunday at midnight
// dtAfter = RelativeToday;
// //If today is monday skip over it first
// if (dtAfter.DayOfWeek == DayOfWeek.Monday)
// dtAfter = dtAfter.AddDays(1);
// //go forwards to next monday
// while (dtAfter.DayOfWeek != DayOfWeek.Monday)
// dtAfter = dtAfter.AddDays(1);
// //Now go back to sunday last second
// dtAfter = dtAfter.AddDays(-1);
// //go seven days ahead
// dtBefore = dtAfter.AddDays(7);
// //case 1155
// dtAfter = dtAfter.AddSeconds(-1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.LastMonth:
// //start with the first day of this month
// dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, RelativeToday.Hour, RelativeToday.Minute, 00);
// //subtract a Month
// dtAfter = dtAfter.AddMonths(-1);
// //Add one month to dtAfter to get end date
// dtBefore = dtAfter.AddMonths(1);
// //case 1155
// dtAfter = dtAfter.AddSeconds(-1);
// // 'yyyy-mm-ddTHH:MM:SS'
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.ThisMonth:
// //start with the first day of this month
// dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, RelativeToday.Hour, RelativeToday.Minute, 00);
// //Add one month to dtAfter to get end date
// dtBefore = dtAfter.AddMonths(1);
// //case 1155
// dtAfter = dtAfter.AddSeconds(-1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.NextMonth:
// //start with the first day of this month
// dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, RelativeToday.Hour, RelativeToday.Minute, 00);
// //Add a Month
// dtAfter = dtAfter.AddMonths(1);
// //Add one month to dtAfter to get end date
// dtBefore = dtAfter.AddMonths(1);
// //case 1155
// dtAfter = dtAfter.AddSeconds(-1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.FourteenDayWindow:
// //start with today zero hour
// dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, RelativeToday.Day, RelativeToday.Hour, RelativeToday.Minute, 00);
// dtAfter = dtAfter.AddDays(-7);
// //Add 15 days to get end date (zero hour so not really 15 full days)
// dtBefore = dtAfter.AddDays(15);
// //case 1155
// dtAfter = dtAfter.AddSeconds(-1);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// //case 2067 ADDITIONAL DATE RANGES ************
// case DataListFilterSpecialToken.Past:
// //Forever up to Now
// dtAfter = new DateTime(1753, 1, 2, 00, 00, 00);
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.Future:
// //From Now to forever (999 years from now)
// dtAfter = DateTime.UtcNow;
// dtBefore = DateTime.UtcNow.AddYears(999);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.LastYear:
// //From zero hour january 1 a year ago
// dtAfter = new DateTime(RelativeNow.AddYears(-1).Year, 1, 1, 0, 0, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// //To zero hour January 1 this year
// dtBefore = new DateTime(RelativeNow.Year, 1, 1, 0, 0, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.ThisYear:
// //From zero hour january 1 this year
// dtAfter = new DateTime(RelativeNow.Year, 1, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// //To zero hour Jan 1 next year
// dtBefore = new DateTime(RelativeNow.AddYears(1).Year, 1, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.InTheLast3Months:
// //From Now minus 3 months
// dtAfter = DateTime.UtcNow.AddMonths(-3);
// //To Now
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.InTheLast6Months:
// //From Now minus 6 months
// dtAfter = DateTime.UtcNow.AddMonths(-6);
// //To Now
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.InTheLastYear:
// //From Now minus 365 days
// dtAfter = DateTime.UtcNow.AddDays(-365);
// //To Now
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// //=======================
// //NEW ONES FOR RAVEN
// case DataListFilterSpecialToken.YearToDate:
// //From zero hour january 1 this year
// dtAfter = new DateTime(RelativeNow.Year, 1, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment); ;
// //To now
// dtBefore = RelativeNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.Past90Days:
// //From Now minus 90 days
// dtAfter = DateTime.UtcNow.AddDays(-90);
// //To Now
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.Past30Days:
// //From Now minus 30 days
// dtAfter = DateTime.UtcNow.AddDays(-30);
// //To Now
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.Past24Hours:
// //From Now minus 24 hours
// dtAfter = DateTime.UtcNow.AddHours(-24);
// //To Now
// dtBefore = DateTime.UtcNow;
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.January:
// //From zero hour january 1 this year
// dtAfter = new DateTime(RelativeNow.Year, 1, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// //To zero hour feb 1 this year
// dtBefore = new DateTime(RelativeNow.Year, 2, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.February:
// dtAfter = new DateTime(RelativeNow.Year, 2, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 3, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.March:
// dtAfter = new DateTime(RelativeNow.Year, 3, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 4, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.April:
// dtAfter = new DateTime(RelativeNow.Year, 4, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 5, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.May:
// dtAfter = new DateTime(RelativeNow.Year, 5, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 6, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.June:
// dtAfter = new DateTime(RelativeNow.Year, 6, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 7, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.July:
// dtAfter = new DateTime(RelativeNow.Year, 7, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 8, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.August:
// dtAfter = new DateTime(RelativeNow.Year, 8, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 9, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.September:
// dtAfter = new DateTime(RelativeNow.Year, 9, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 10, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.October:
// dtAfter = new DateTime(RelativeNow.Year, 10, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 11, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.November:
// dtAfter = new DateTime(RelativeNow.Year, 11, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// dtBefore = new DateTime(RelativeNow.Year, 12, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
// case DataListFilterSpecialToken.December:
// //From zero hour dec 1 this year
// dtAfter = new DateTime(RelativeNow.Year, 12, 1, 00, 00, 00).AddSeconds(-1).AddHours(TimeZoneAdjustment);
// //To zero hour Jan 1 next year
// dtBefore = new DateTime(RelativeNow.AddYears(1).Year, 1, 1, 00, 00, 00).AddHours(TimeZoneAdjustment);
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
// break;
//
// //-----
// }
// #endregion
// }
// else
// {

View File

@@ -1,5 +1,3 @@
/* ZZeslint-disable */
//AyaNova Translation related utilities
export default {
////////////////////////////////
// Update the local cache
@@ -12,32 +10,12 @@ export default {
if (editedTranslation) {
//iterate the keys that are cached and set them from whatever is in editedTranslation for that key
//de-lodash
// window.$gz. _.forOwn(window.$gz.store.state.translationText, function(
// cacheval,
// cachekey
// ) {
// //find match
// //de-lodash
// // let display = window.$gz. _.find(editedTranslation.translationItems, {
// // key: cachekey
// // }).display;
// let display = editedTranslation.translationItems.find(
// z => z.key == cachekey
// ).display;
// window.$gz.store.commit("setTranslationText", {
// key: cachekey,
// value: display
// });
// });
for (const [key, value] of Object.entries(
window.$gz.store.state.translationText
)) {
let display = editedTranslation.translationItems.find(z => z.key == key)
.display;
const display = editedTranslation.translationItems.find(
z => z.key == key
).display;
window.$gz.store.commit("setTranslationText", {
key: key,
@@ -46,22 +24,15 @@ export default {
}
} else {
//gather up the keys that are cached and fetch the latest and then replace them
let needIt = [];
//de-lodash
// window.$gz. _.forOwn(window.$gz.store.state.translationText, function(
// cacheval,
// cachekey
// ) {
// needIt.push(cachekey);
// });
const needIt = [];
Object.keys(window.$gz.store.state.translationText).forEach(z => {
needIt.push(z);
});
//fetch these keys
let transData = await window.$gz.api.upsert("translation/subset", needIt);
const transData = await window.$gz.api.upsert(
"translation/subset",
needIt
);
transData.data.forEach(function commitFetchedTranslationItemToStore(
item
) {
@@ -89,7 +60,7 @@ export default {
//step 1: build an array of keys that we don't have already
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
//for example datatables have dynamic column names so they need to fetch on demand
let needIt = [];
const needIt = [];
for (let i = 0; i < keys.length; i++) {
if (
!window.$gz.util.has(window.$gz.store.state.translationText, keys[i])
@@ -323,21 +294,19 @@ export default {
// (fetch and cache any missing strings)
async translateStringWithMultipleKeysAsync(s) {
let ret = s;
let found = s.match(/LT:[\w]*/gm);
const found = s.match(/LT:[\w]*/gm);
if (found == null) {
return ret;
}
//clean up the keys for fetching
let keysToCache = found.map(z => z.replace("LT:", ""));
const keysToCache = found.map(z => z.replace("LT:", ""));
//cache / fetch any that are not already present
//(async () => {
await this.cacheTranslations(keysToCache);
// })();
//replace
found.forEach(z => {
let translated = this.get(z.replace("LT:", ""));
const translated = this.get(z.replace("LT:", ""));
//replace all
ret = ret.split(z).join(translated);
});
@@ -352,13 +321,13 @@ export default {
//this is the sync version to be used in non async capable code
translateStringWithMultipleKeys(s) {
let ret = s;
let found = s.match(/LT:[\w]*/gm);
const found = s.match(/LT:[\w]*/gm);
if (found == null) {
return ret;
}
//replace
found.forEach(z => {
let translated = this.get(z.replace("LT:", ""));
const translated = this.get(z.replace("LT:", ""));
//replace all
ret = ret.split(z).join(translated);
});

View File

@@ -5,7 +5,7 @@
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {

View File

@@ -207,13 +207,13 @@ export default {
},
async upload() {
//similar code in wiki-control
let vm = this;
let fileData = [];
const vm = this;
const fileData = [];
for (let i = 0; i < vm.uploadFiles.length; i++) {
let f = vm.uploadFiles[i];
fileData.push({ name: f.name, lastModified: f.lastModified });
}
let at = {
const at = {
ayaId: vm.ayaId,
ayaType: vm.ayaType,
files: vm.uploadFiles,
@@ -221,7 +221,7 @@ export default {
notes: vm.notes ? vm.notes : ""
};
try {
let res = await window.$gz.api.uploadAttachment(at);
const res = await window.$gz.api.uploadAttachment(at);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error);
} else {
@@ -233,13 +233,13 @@ export default {
}
},
async remove() {
let vm = this;
const vm = this;
try {
if ((await window.$gz.dialog.confirmDelete()) !== true) {
return;
}
let res = await window.$gz.api.remove("attachment/" + vm.editId);
const res = await window.$gz.api.remove("attachment/" + vm.editId);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error);
} else {
@@ -254,9 +254,9 @@ export default {
}
},
async getList() {
let vm = this;
const vm = this;
try {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"attachment/list?ayatype=" + vm.ayaType + "&ayaid=" + vm.ayaId
);
if (res.error) {
@@ -274,12 +274,12 @@ export default {
data = [];
}
let timeZoneName = window.$gz.locale.getResolvedTimeZoneName();
let languageName = window.$gz.locale.getResolvedLanguage();
let hour12 = window.$gz.store.state.userOptions.hour12;
let ret = [];
const timeZoneName = window.$gz.locale.getResolvedTimeZoneName();
const languageName = window.$gz.locale.getResolvedLanguage();
const hour12 = window.$gz.store.state.userOptions.hour12;
const ret = [];
for (let i = 0; i < data.length; i++) {
let o = data[i];
const o = data[i];
//http://localhost:7575/api/v8/attachment/download/100?t=sssss
ret.push({
id: o.id,
@@ -312,12 +312,11 @@ export default {
});
},
async saveEdit() {
let vm = this;
const vm = this;
if (!vm.editName) {
//todo: some error here, name is required..
return;
}
//check if they differ first
let o = null;
let i = 0;
for (i = 0; i < vm.displayList.length; i++) {
@@ -326,26 +325,18 @@ export default {
break;
}
}
//any changes?
if (o.name == vm.editName && o.notes == vm.editNotes) {
return;
}
//post to server
/*
public uint Concurrency { get; set; }
[Required]
public string DisplayFileName { get; set; }
public string Notes { get; set; }
*/
let p = {
const p = {
concurrency: o.concurrency,
displayFileName: vm.editName,
notes: vm.editNotes
};
try {
let res = await window.$gz.api.upsert("attachment/" + vm.editId, p);
const res = await window.$gz.api.upsert("attachment/" + vm.editId, p);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error);

View File

@@ -62,9 +62,9 @@ export default {
this.initializing = false;
return;
}
let val = this.$refs.textField.$refs.input.value;
const val = this.$refs.textField.$refs.input.value;
let parsedValue = parseCurrency(val, {
const parsedValue = parseCurrency(val, {
currency: this.currencyName,
locale: this.languageName
});

View File

@@ -189,10 +189,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
data() {
return {};
@@ -226,20 +222,6 @@ export default {
window.$gz.form.fieldValueChanged(this.parentVM, ref);
}
},
// templateHasVisibleCustomFields() {
// let template = this.$store.state.formCustomTemplate[this.formKey];
// console.log(
// "custom-fields-control templateHasVisibleCustomFields template=",
// template
// );
// if (template == undefined) {
// return false;
// }
// //iterate template and see if it has any custom fields set to display
// //de-lodash
// //return window.$gz. _.find(template, "type") != undefined;
// return template.find(z => z.type != undefined);
// },
GetValueForField: function(dataKey) {
let cData = {};
//get the data out of the JSON string value
@@ -254,15 +236,7 @@ export default {
// - CURRENT TIME, DATE, DATETIME are pretty specific but all use a datetime string so any value not datetime like should be nulled
// - CURRENT NUMBER, CURRENCY are also pretty specific but easy to identify if not fully numeric and then sb nulled or attempt to convert then null if not
//Get the field data type
//https://lodash.com/docs#find
//de-lodash
// let ctrlType = window.$gz. _.find(
// this.$store.state.formCustomTemplate[this.formKey],
// ["dataKey", dataKey]
// ).type;
let ctrlType = this.$store.state.formCustomTemplate[this.formKey].find(
const ctrlType = this.$store.state.formCustomTemplate[this.formKey].find(
z => z.dataKey == dataKey
).type;
@@ -307,12 +281,10 @@ export default {
ret = window.$gz.util.stringToBoolean(ret);
break;
}
//The number 1?
if (ret === 1) {
ret = true;
break;
}
//The number 0?
if (ret === 0) {
ret = false;
break;
@@ -352,18 +324,14 @@ export default {
cData[dataKey] = newValue.toString();
}
//emit the new data so it syncs with the parent source
let ret = JSON.stringify(cData);
this.$emit("input", ret);
this.$emit("input", JSON.stringify(cData));
}
},
computed: {
availableCustomFields() {
//item.type only exists for custom fields so they are the ones to return
//In addition if there is a keyStartWith then there are multiple custom field controls on same form so that's a different route to take
let template = this.$store.state.formCustomTemplate[this.formKey];
// // debugger;
// console.log("Template is: ", template);
const template = this.$store.state.formCustomTemplate[this.formKey];
if (template != undefined) {
if (this.keyStartWith != "") {

View File

@@ -36,13 +36,7 @@
</template>
</template>
<v-toolbar-title> {{ translatedTitle }} </v-toolbar-title>
<v-spacer></v-spacer>
<!-- <v-btn icon>
<v-icon>mdi-heart</v-icon>
</v-btn> -->
<v-menu bottom left>
<template v-slot:activator="{ on, attrs }">
<v-btn icon v-bind="attrs" v-on="on">

View File

@@ -85,18 +85,15 @@ export default {
},
clicked: function(c, i) {
if (i.length == 0) return; //Clicked outside any bar.
let e = i[0]; //get index of bar clicked on
// console.log(e._index);
const e = i[0]; //get index of bar clicked on
//this gets the label
//let x_value = this.obj.labels[e._index];
//this gets the value
//let y_value = this.obj.datasets[0].data[e._index];
//this gets my custom id stuff
//https://stackoverflow.com/a/42635435/8939
let dataKeyValue = this.obj.datakeys[e._index];
// console.log(x_value);
// console.log(y_value);
//console.log(dataKeyValue);
const dataKeyValue = this.obj.datakeys[e._index];
alert(`STUB: OPEN ITEM (data: ${JSON.stringify(dataKeyValue)})`);
//clickOnChart(lastHoveredIndex);

View File

@@ -43,11 +43,11 @@ export default {
computed: {},
methods: {
loadData: function() {
let events = [];
let now = new Date();
let yy = now.getFullYear();
let mm = now.getMonth() + 1;
let dd = now.getDate();
const events = [];
const now = new Date();
const yy = now.getFullYear();
const mm = now.getMonth() + 1;
const dd = now.getDate();
events.push({
id: 45,
type: 34,

View File

@@ -54,7 +54,7 @@ export default {
moreClick() {
const LIST_FORM_KEY = "widget-list";
//get current settings for the form
let formSettings = window.$gz.form.getFormSettings(LIST_FORM_KEY);
const formSettings = window.$gz.form.getFormSettings(LIST_FORM_KEY);
//switch to an unsaved listview and substitute this dash widgets list view criteria
formSettings.temp.page = 0;
@@ -70,9 +70,9 @@ export default {
});
},
async getDataFromApi() {
let lv = LIST_VIEW;
const lv = LIST_VIEW;
lv.limit = this.maxListItems;
let res = await window.$gz.api.post("data-list", lv);
const res = await window.$gz.api.post("data-list", lv);
if (!res.error) {
this.obj = res.data;
} else {

View File

@@ -278,16 +278,6 @@
:clearable="!formState.readOnly"
:readonly="formState.readOnly"
></gz-duration-picker>
<!-- <v-text-field
v-if="
editItem.tempFilterOperator != null &&
editItem.tempFilterOperator != '*NOVALUE*' &&
editItem.tempFilterOperator != '*HASVALUE*'
"
v-model="editItem.tempFilterValue"
:clearable="!formState.readOnly"
type="number"
></v-text-field> -->
<v-btn
large
block
@@ -401,17 +391,17 @@ export default {
methods: {
async saveAndExit() {
//turn activeFilter into object json.parse
let af = JSON.parse(this.activeFilter.filter);
const af = JSON.parse(this.activeFilter.filter);
//remove column filter if it is already there to replace
if (af.length != 0) {
let index = af.findIndex(z => z.column == this.tableColumnData.fk);
const index = af.findIndex(z => z.column == this.tableColumnData.fk);
if (index > -1) {
af.splice(index, 1);
}
}
let newColumnFilter = {
const newColumnFilter = {
column: this.tableColumnData.fk,
any: this.editItem.filter.any,
items: []
@@ -438,9 +428,11 @@ export default {
this.activeFilter.filter = JSON.stringify(af);
//SAVE
let res = await window.$gz.api.put("data-list-filter", this.activeFilter);
const res = await window.$gz.api.put(
"data-list-filter",
this.activeFilter
);
if (res.error) {
//throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
} else {
this.close({ refresh: true });
@@ -451,7 +443,7 @@ export default {
},
addFilterCondition(editItem) {
// filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}],
let filterItem = { op: null, value: null, display: null };
const filterItem = { op: null, value: null, display: null };
let filterItemSet = false;
//DATE relative token?
@@ -593,18 +585,17 @@ async function populateFieldDefinitions(vm) {
//get the field defs from cache or store them
//they are unchanging in a session so no need to fetch each time
//only a server update would modify them from last value
let storageKey = `dataListFields:${vm.dataListKey}`;
const storageKey = `dataListFields:${vm.dataListKey}`;
let ss = sessionStorage.getItem(storageKey);
const ss = sessionStorage.getItem(storageKey);
if (ss) {
vm.fieldDefinitions = JSON.parse(ss);
return;
} else {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"data-list/listfields?DataListKey=" + vm.dataListKey
);
if (res.error) {
//throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
} else {
vm.fieldDefinitions = res.data;
@@ -617,9 +608,8 @@ async function populateFieldDefinitions(vm) {
//
async function fetchActiveFilter(vm) {
///api/v8/data-list-filter/{id}
let res = await window.$gz.api.get(`data-list-filter/${vm.activeFilterId}`);
const res = await window.$gz.api.get(`data-list-filter/${vm.activeFilterId}`);
if (res.error) {
//throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
} else {
vm.activeFilter = res.data;
@@ -898,8 +888,10 @@ function initEditItem(vm) {
);
}
let fld = vm.fieldDefinitions.find(z => z.fieldKey == vm.tableColumnData.fk);
let o = {
const fld = vm.fieldDefinitions.find(
z => z.fieldKey == vm.tableColumnData.fk
);
const o = {
key: fld.fieldKey,
isFilterable: fld.isFilterable,
enumType: fld.enumType,
@@ -913,9 +905,9 @@ function initEditItem(vm) {
//re-hydrate the filter if already defined for this column
//turn activeFilter into object json.parse
let allActiveFilters = JSON.parse(vm.activeFilter.filter);
const allActiveFilters = JSON.parse(vm.activeFilter.filter);
let af = allActiveFilters.find(z => z.column == vm.tableColumnData.fk);
const af = allActiveFilters.find(z => z.column == vm.tableColumnData.fk);
if (af) {
o.filter.any = af.any;
o.filter.items = af.items;
@@ -934,7 +926,7 @@ function initEditItem(vm) {
//Add display text for filter item (same as in addFilterCondition)
for (let j = 0; j < o.filter.items.length; j++) {
let fi = o.filter.items[j];
const fi = o.filter.items[j];
fi.display = getDisplayForFilter(
vm,
o.uiFieldDataType,
@@ -974,7 +966,7 @@ function getDisplayForFilter(
//DATE RELATIVE TOKEN FILTER
if (uiFieldDataType === 1 && filterValue[0] == "*") {
let valueDisplay = vm.selectLists.dateFilterTokens.find(
const valueDisplay = vm.selectLists.dateFilterTokens.find(
z => z.id == filterValue
).name;
@@ -1001,7 +993,7 @@ function getDisplayForFilter(
valueDisplay = window.$gz.locale.decimalLocalized(filterValue);
break;
case 6: //BOOL translate
let tKey = filterValue ? "True" : "False";
const tKey = filterValue ? "True" : "False";
valueDisplay = vm.$ay.t(tKey);
break;
case 10: //ENUM translate
@@ -1016,7 +1008,7 @@ function getDisplayForFilter(
}
//Operator
let opDisplay = vm.selectLists.stringFilterOperators.find(
const opDisplay = vm.selectLists.stringFilterOperators.find(
z => z.id == filterOperator
).name;

View File

@@ -10,10 +10,7 @@
<v-card-subtitle class="mt-1"
>{{ activeFilterNameAtOpen }} {{ activeFilterCreator }}</v-card-subtitle
>
<!-- activefilter:{ "id": 2, "concurrency": 5029609, "userId": 1, "name": "-",
"public": false, "defaultFilter": true, "listKey": "CustomerDataList", "filter": "[]" } -->
<v-card-text>
<!-- <div>activefilter:{{ activeFilter }}</div> -->
<v-text-field
:readonly="formState.readOnly"
v-model="activeFilter.name"
@@ -95,13 +92,13 @@ export default {
async deleteFilter() {
//prompt if a true delete and not a default filter "reset"
if (!this.activeFilter.defaultFilter) {
let dialogResult = await window.$gz.dialog.confirmDelete();
const dialogResult = await window.$gz.dialog.confirmDelete();
if (dialogResult != true) {
return;
}
}
let res = await window.$gz.api.remove(
const res = await window.$gz.api.remove(
`data-list-filter/${this.activeFilter.id}`
);
if (res.error) {
@@ -113,7 +110,6 @@ export default {
async saveAndExit(saveAs) {
if (saveAs) {
//SAVE AS
//strip ID
delete this.activeFilter.id;
delete this.activeFilter.concurrency;
@@ -128,24 +124,22 @@ export default {
this.activeFilter.name += " [" + this.$ay.t("Copy") + "]";
}
this.activeFilter.userId = window.$gz.store.state.userId;
let res = await window.$gz.api.post(
const res = await window.$gz.api.post(
"data-list-filter",
this.activeFilter
);
if (res.error) {
//throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, this));
} else {
this.close({ refresh: true, newFilterId: res.data.id });
}
} else {
//SAVE
let res = await window.$gz.api.put(
const res = await window.$gz.api.put(
"data-list-filter",
this.activeFilter
);
if (res.error) {
//throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, this));
} else {
this.close({ refresh: true });
@@ -162,7 +156,7 @@ export default {
//Get owner name
if (!this.isSelfOwned) {
let res = await window.$gz.api.post("pick-list/list", {
const res = await window.$gz.api.post("pick-list/list", {
ayaType: window.$gz.type.User,
inactive: true,
preselectedIds: [this.activeFilter.userId]
@@ -200,9 +194,8 @@ async function initForm(vm) {
//
async function fetchActiveFilter(vm) {
///api/v8/data-list-filter/{id}
let res = await window.$gz.api.get(`data-list-filter/${vm.activeFilterId}`);
const res = await window.$gz.api.get(`data-list-filter/${vm.activeFilterId}`);
if (res.error) {
//throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
} else {
vm.activeFilter = res.data;

View File

@@ -148,7 +148,6 @@
<template v-if="c.t == 1">
<!-- DATETIME -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -163,7 +162,6 @@
<template v-else-if="c.t == 2">
<!-- DATE -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -178,7 +176,6 @@
<template v-else-if="c.t == 3">
<!-- TIME -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -193,7 +190,6 @@
<template v-else-if="c.t == 4">
<!-- TEXT (also maybe openable)-->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -208,7 +204,6 @@
<template v-else-if="c.t == 5">
<!-- INTEGER -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -232,7 +227,6 @@
<template v-else-if="c.t == 7">
<!-- DECIMAL -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -255,7 +249,6 @@
<template v-else-if="c.t == 10">
<!-- ENUM (translated to text on getdata) ALSO MAYBE OPENABLE -->
<template v-if="c.i && c.ot">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -363,7 +356,6 @@
<template v-if="c.t == 1">
<!-- DATETIME -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -378,7 +370,6 @@
<template v-else-if="c.t == 2">
<!-- DATE -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -393,7 +384,6 @@
<template v-else-if="c.t == 3">
<!-- TIME -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -408,7 +398,6 @@
<template v-else-if="c.t == 4">
<!-- TEXT (also maybe openable)-->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -423,7 +412,6 @@
<template v-else-if="c.t == 5">
<!-- INTEGER -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -450,7 +438,6 @@
<template v-else-if="c.t == 7">
<!-- DECIMAL -->
<template v-if="c.i && c.i != 0 && !c.nopen">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -473,7 +460,6 @@
<template v-else-if="c.t == 10">
<!-- ENUM (translated to text on getdata) ALSO MAYBE OPENABLE -->
<template v-if="c.i && c.ot">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i, c.ot)"
@@ -527,7 +513,6 @@
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//NOTE: if get duplicate keys detected error here it's because whatever is the rowid column
//has duplicate values in it and should be unique in every row
@@ -572,7 +557,6 @@ export default {
default: undefined
},
preFilterMode: {
//{icon:null,viz:null,ayatype:null,id:null,clearable:false}
type: Object,
default: null
},
@@ -596,13 +580,12 @@ export default {
watch: {
dataTablePagingOptions: {
async handler() {
//{ "page": 1, "itemsPerPage": 10, "sortBy": [], "sortDesc": [], "groupBy": [], "groupDesc": [], "mustSort": false, "multiSort": false }
//this code works around some weird bug that causes visible items to be selected in grid (only, not in actual selected array, just a visual thing)
// when breakpoint is switched between wide and narrow either way. No idea why it happens but this fixes that issue and also ensures that there are no
//spurious fetches happening just because the view has changed
//See what has changed and record it for processing
let sortHasChanged = !(
const sortHasChanged = !(
window.$gz.util.isEqualArraysOfPrimitives(
this.dataTablePagingOptions.sortBy,
this.lastDataTablePagingOptions.sortBy
@@ -613,7 +596,7 @@ export default {
)
);
let pagingHaschanged = !(
const pagingHaschanged = !(
this.lastDataTablePagingOptions.page ==
this.dataTablePagingOptions.page &&
this.lastDataTablePagingOptions.itemsPerPage ==
@@ -682,15 +665,15 @@ export default {
//Used by narrow view to get the "header" text for a column based on the column key
getHeaderText(key) {
//key format is row-column e.g."500-2"
let columnIndex = key.split("-")[1];
let header = this.headers[columnIndex];
const columnIndex = key.split("-")[1];
const header = this.headers[columnIndex];
if (header && header.text) {
return header.text;
}
return "";
},
async filter(item) {
let res = await this.$refs.dataTableFilter.open(item);
const res = await this.$refs.dataTableFilter.open(item);
if (res && res.refresh == true) {
this.getDataFromApi();
}
@@ -707,7 +690,7 @@ export default {
setActiveFilter(this); //will not trigger refresh yet
//Call api method to clear this filter
let res = await window.$gz.api.remove(
const res = await window.$gz.api.remove(
`data-list-filter/${this.activeFilterId}`
);
if (res.error) {
@@ -727,7 +710,7 @@ export default {
return null;
},
async editFilter() {
let res = await this.$refs.dataTableFilterManager.open();
const res = await this.$refs.dataTableFilterManager.open();
if (res && res.refresh == true) {
if (res.newFilterId) {
//save as new filter, select it
@@ -739,7 +722,7 @@ export default {
}
},
async mobileColumnFilterSelect() {
let resHeaderItem = await this.$refs.dataTableMobileFilterColumnSelector.open(
const resHeaderItem = await this.$refs.dataTableMobileFilterColumnSelector.open(
this.headers,
this.filterColor
);
@@ -749,24 +732,24 @@ export default {
},
keyArrayFromSortByArray(sortBy) {
return sortBy.map(sortItem => {
let val = this.headers.find(z => z.value == sortItem);
const val = this.headers.find(z => z.value == sortItem);
if (val) {
return val.fk;
}
});
},
setSortIndicatorsFromDataListResponse(rsort) {
let sortBy = [];
let sortDesc = [];
const sortBy = [];
const sortDesc = [];
if (rsort != null) {
Object.keys(rsort).forEach((key, index) => {
//Pull column header name "value" from "fk"matching "key" here from this.headers columns.c0 etc here from this.headers see above method
let found = this.headers.find(z => z.fk == key);
const found = this.headers.find(z => z.fk == key);
if (found != null) {
sortBy.push(found.value);
//if not null then push into the sortBy array
let sort = rsort[key];
const sort = rsort[key];
if (sort == "-") {
sortDesc.push(true);
} else {
@@ -783,7 +766,7 @@ export default {
this.getDataFromApi();
},
getDataListSelection(ayaType) {
let vm = this;
const vm = this;
//called when parent form needs the selected id's or the list view options needed to rehydrate the entire list of id's in the same order and filter
//i.e. for reporting, batch operations etc
@@ -828,9 +811,6 @@ export default {
params: {
dataListKey: this.dataListKey,
hiddenAffectiveColumns: this.hiddenAffectiveColumns
// ,
// formKey: this.formKey,
// activeFilterId: this.activeFilterId
}
});
},
@@ -856,7 +836,7 @@ export default {
//c.cst is styling added here by data builder in the form of an object with props set for compatibility with Vue
//c.clr is a specific color coming from the server for items that support colors (reminders etc)
if (c.cst || c.clr) {
let clrBit = {};
const clrBit = {};
if (c.clr) {
if (c.clr[0] != "#") {
c.clr = "#" + c.clr;
@@ -869,13 +849,13 @@ export default {
}
},
async getDataFromApi(deSelectAll) {
let vm = this;
const vm = this;
if (vm.loading) {
return;
}
//start with defaults
let listOptions = {
const listOptions = {
DataListKey: vm.dataListKey,
Limit: 5,
Offset: 0
@@ -911,7 +891,7 @@ export default {
}
try {
let res = await window.$gz.api.post("data-list", {
const res = await window.$gz.api.post("data-list", {
offset: listOptions.Offset,
limit: listOptions.Limit,
dataListKey: vm.dataListKey,
@@ -973,7 +953,7 @@ export default {
},
async created() {
//get pick lists
let vm = this;
const vm = this;
await initForm(vm);
vm.loading = false;
vm.getDataFromApi();
@@ -986,11 +966,11 @@ function buildHeaders(columnData) {
if (!columnData) {
return [];
}
let ret = [];
const ret = [];
//iterate the columns
for (let i = 0; i < columnData.length; i++) {
let cm = columnData[i];
let h = {};
const cm = columnData[i];
const h = {};
h.text = window.$gz.translation.get(cm.cm);
h.fk = cm.fk;
h.value = "columns.c" + i.toString(); //+".v";
@@ -1020,38 +1000,38 @@ function buildHeaders(columnData) {
async function buildRecords(listData, columndefinitions, ridColumnOpenable) {
//iterate data, build each object keyed with index name and display set to correct translated filter and then return
let ret = [];
const ret = [];
if (!listData) {
return ret;
}
//cache display format stuff
let timeZoneName = window.$gz.locale.getResolvedTimeZoneName();
let languageName = window.$gz.locale.getResolvedLanguage();
let hour12 = window.$gz.store.state.userOptions.hour12;
let currencyName = window.$gz.locale.getCurrencyName();
const timeZoneName = window.$gz.locale.getResolvedTimeZoneName();
const languageName = window.$gz.locale.getResolvedLanguage();
const hour12 = window.$gz.store.state.userOptions.hour12;
const currencyName = window.$gz.locale.getCurrencyName();
//this will cache the first time it's required (if required)
let availableRoles = null;
//comes as an array of arrays, needs to leave as an array of objects representing each row
for (let iRow = 0; iRow < listData.length; iRow++) {
let row = listData[iRow];
const row = listData[iRow];
//iterate row and build object representing row data keyed to index
//container object for row
//id will be set later when code below encounters the id column which could be in any position (or not at all) but is identified by it's rid property
let o = { id: undefined, columns: {} };
const o = { id: undefined, columns: {} };
for (let iColumn = 0; iColumn < row.length; iColumn++) {
let column = row[iColumn];
const column = row[iColumn];
//rowId?
if (column.rid) {
o.id = column.i;
}
let dataType = columndefinitions[iColumn].dt;
const dataType = columndefinitions[iColumn].dt;
let display = column.v;
let cstStyle = null; //custom additional styling here in grid e.g. negative numbers etc
@@ -1175,12 +1155,12 @@ async function buildRecords(listData, columndefinitions, ridColumnOpenable) {
"AuthorizationRoles"
);
}
let roles = display;
let roleNames = [];
const roles = display;
const roleNames = [];
if (roles != null && roles != 0) {
for (let i = 0; i < availableRoles.length; i++) {
let role = availableRoles[i];
const role = availableRoles[i];
if (!!(roles & role.id)) {
roleNames.push(role.name);
}
@@ -1194,7 +1174,7 @@ async function buildRecords(listData, columndefinitions, ridColumnOpenable) {
}
}
//build the row column object vm will be used by the datatable
let columnObject = {
const columnObject = {
v: display,
t: dataType,
key: iRow + "-" + iColumn
@@ -1244,9 +1224,9 @@ async function fetchTranslatedHeaderNames(columnData) {
if (!columnData) {
return;
}
let headerKeys = [];
const headerKeys = [];
for (let i = 0; i < columnData.length; i++) {
let cm = columnData[i];
const cm = columnData[i];
headerKeys.push(cm.cm);
}
//Now fetch all the keys
@@ -1261,9 +1241,9 @@ async function fetchEnums(columnData) {
if (!columnData) {
return;
}
let headerKeys = [];
for (let i = 0; i < columnData.length; i++) {
let cm = columnData[i];
const cm = columnData[i];
if (cm.et) {
await window.$gz.enums.fetchEnumList(cm.et);
}
@@ -1287,7 +1267,7 @@ async function initForm(vm) {
////////////////////
//
async function fetchSavedFilterList(vm) {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"data-list-filter/list?ListKey=" + vm.dataListKey
);
if (res.error) {
@@ -1303,7 +1283,7 @@ async function fetchSavedFilterList(vm) {
////////////////////
//
function saveFormSettings(vm) {
let newFormSettings = {
const newFormSettings = {
temp: { page: vm.dataTablePagingOptions.page },
saved: {
itemsPerPage: vm.dataTablePagingOptions.itemsPerPage,
@@ -1315,7 +1295,7 @@ function saveFormSettings(vm) {
//preserve anything not directly related to datatable
//for now it's just the last report so nothing fancy here
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
const formSettings = window.$gz.form.getFormSettings(vm.formKey);
if (formSettings != null && formSettings.saved != null) {
if (formSettings.saved.lastReport != null) {
@@ -1340,7 +1320,7 @@ function setActiveFilter(vm, desiredId) {
}
//no specific id so attempt to set to default
let dflt = vm.selectLists.savedFilters.find(z => z.default == true);
const dflt = vm.selectLists.savedFilters.find(z => z.default == true);
if (dflt) {
vm.activeFilterId = dflt.id;
return;
@@ -1352,7 +1332,7 @@ function setActiveFilter(vm, desiredId) {
////////////////////
//
function loadFormSettings(vm) {
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
const formSettings = window.$gz.form.getFormSettings(vm.formKey);
//process SAVED formsettings
if (formSettings.saved) {

View File

@@ -58,15 +58,12 @@
</div>
</template>
<script>
/* Xeslint-disable */
//******************************** NOTE: this control also captures the TIME even though it's DATE only, this is an intentional design decision to support field change to date or date AND time and is considered a display issue */
export default {
data: () => ({
dlgdate: false,
//cache display format stuff
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage()
// defaultLocale: window.$gz.locale.get BrowserFirstLanguage().split("-", 1)[0]
}),
props: {
label: { type: String, default: null },
@@ -96,7 +93,7 @@ export default {
},
methods: {
setToday() {
let v = window.$gz.locale
const v = window.$gz.locale
.nowUTC8601String(this.timeZoneName)
.split("T")[0];
this.updateDateValue(v);
@@ -122,11 +119,11 @@ export default {
this.dlgdate = false;
},
updateValue(theDate, theTime) {
let vm = this;
const vm = this;
if (!theDate) {
let v = new Date();
let fullYear = v.getFullYear();
const v = new Date();
const fullYear = v.getFullYear();
let fullMonth = v.getMonth() + 1;
if (fullMonth < 10) {
fullMonth = "0" + fullMonth.toString();
@@ -142,7 +139,7 @@ export default {
theTime = "00:00:00";
}
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
const ret = window.$gz.locale.localTimeDateStringToUTC8601String(
theDate + "T" + theTime,
vm.timeZoneName
);

View File

@@ -24,7 +24,6 @@
</div>
</template>
<script>
/* Xeslint-disable */
export default {
data() {
return {
@@ -58,11 +57,11 @@ export default {
);
},
updateValue() {
let vm = this;
const vm = this;
let dateValue = vm.$refs.dateField.$refs.input.value;
if (!dateValue) {
let v = new Date();
let fullYear = v.getFullYear();
const v = new Date();
const fullYear = v.getFullYear();
let fullMonth = v.getMonth() + 1;
if (fullMonth < 10) {
fullMonth = "0" + fullMonth.toString();
@@ -82,7 +81,7 @@ export default {
timeValue = "00:00:00";
}
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
const ret = window.$gz.locale.localTimeDateStringToUTC8601String(
dateValue + "T" + timeValue,
vm.timeZoneName
);

View File

@@ -95,16 +95,13 @@
</div>
</template>
<script>
/* Xeslint-disable */
export default {
data: () => ({
dlgdate: false,
dlgtime: false,
//cache display format stuff
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12()
//defaultLocale: window.$gz.locale.ge tBrowserFirstLanguage().split("-", 1)[0]
}),
props: {
label: { type: String, default: null },
@@ -134,14 +131,14 @@ export default {
},
methods: {
setToday() {
let v = window.$gz.locale
const v = window.$gz.locale
.nowUTC8601String(this.timeZoneName)
.split("T")[0];
this.updateDateValue(v);
this.dlgdate = false;
},
setNow() {
let v = window.$gz.locale.nowUTC8601String().split("T")[1];
const v = window.$gz.locale.nowUTC8601String().split("T")[1];
this.updateTimeValue(v);
this.dlgtime = false;
},
@@ -177,10 +174,10 @@ export default {
this.dlgdate = false;
},
updateValue(theDate, theTime) {
let vm = this;
const vm = this;
if (!theDate) {
let v = new Date();
let fullYear = v.getFullYear();
const v = new Date();
const fullYear = v.getFullYear();
let fullMonth = v.getMonth() + 1;
if (fullMonth < 10) {
fullMonth = "0" + fullMonth.toString();
@@ -196,7 +193,7 @@ export default {
theTime = "00:00:00";
}
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
const ret = window.$gz.locale.localTimeDateStringToUTC8601String(
theDate + "T" + theTime,
vm.timeZoneName
);

View File

@@ -48,7 +48,7 @@ export default {
props: {
label: { type: String, default: null },
rules: { type: Array, default: undefined},
rules: { type: Array, default: undefined },
errorMessages: { type: Array, default: null },
value: { type: String, default: null },
readonly: { type: Boolean, default: false },
@@ -79,11 +79,11 @@ export default {
);
},
updateValue() {
let vm = this;
const vm = this;
let dateValue = vm.$refs.dateField.$refs.input.value;
if (!dateValue) {
let v = new Date();
let fullYear = v.getFullYear();
const v = new Date();
const fullYear = v.getFullYear();
let fullMonth = v.getMonth() + 1;
if (fullMonth < 10) {
fullMonth = "0" + fullMonth.toString();
@@ -100,7 +100,7 @@ export default {
timeValue = "00:00:00";
}
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
const ret = window.$gz.locale.localTimeDateStringToUTC8601String(
dateValue + "T" + timeValue,
vm.timeZoneName
);

View File

@@ -17,7 +17,6 @@
></v-select>
</template>
<script>
/* Xeslint-disable */
//bitwise selection of days of week
//https://stackoverflow.com/a/24174625/8939
@@ -43,10 +42,10 @@ export default {
},
computed: {
selectedValue() {
let ret = [];
const ret = [];
if (this.value != null && this.value != 0) {
for (let i = 0; i < this.daysOfWeek.length; i++) {
let day = this.daysOfWeek[i];
const day = this.daysOfWeek[i];
if (!!(this.value & day.id)) {
ret.push(day.id);
}
@@ -60,7 +59,7 @@ export default {
let newValue = 0;
if (value != null && value != [] && value.length > 0) {
for (let i = 0; i < value.length; i++) {
let day = value[i];
const day = value[i];
newValue = newValue | day;
}
}

View File

@@ -18,7 +18,6 @@
</div>
</template>
<script>
/* Xeslint-disable */
//### NOTE: THIS IS A DUPLICATE OF CURRENCYCONTROL AND THE ONLY DIFFERENCE IS THE "currency:" VALUE IS SET TO NULL IN THE TEMPLATE AND IN THE updateValue METHOD
//https://dm4t2.github.io/vue-currency-input/guide/#introduction :value="formattedValue"
//https://codesandbox.io/s/vue-template-kd7d1?fontsize=14&module=%2Fsrc%2FApp.vue
@@ -47,8 +46,8 @@ export default {
},
methods: {
updateValue() {
let val = this.$refs.textField.$refs.input.value;
let parsedValue = parseCurrency(val, {
const val = this.$refs.textField.$refs.input.value;
const parsedValue = parseCurrency(val, {
currency: null,
locale: this.languageName
});

View File

@@ -69,20 +69,6 @@
</div>
</template>
<script>
/* Xeslint-disable */
/*https://alligator.io/vuejs/add-v-model-support/
"TimeSpanDays": "days",
"TimeSpanHours": "hours",
"TimeSpanMinutes": "minutes",
"TimeSpanSeconds": "seconds", */
//example serialized json TimeSpans
//seems to be DD.HH:MM:SS.ms at it's most characters
//two colons always with an optional period at each end to separate days and ms
//we don't support or need MS and can safely ignore them
//so just look for a period at the top and the rest is split by colons
//maybe split by colon first then subsplit first and last elements into days and MS
//{"data":{"testTSDaysWMS":"22.10:15:22.0330000","testTSHMS":"05:16:33","testTS_DHMS":"5.10:15:33","testTS_MS":"00:15:33","testTS_S":"00:00:33","testTS_D":"22.00:00:00"}}
export default {
props: {
label: { type: String, default: null },
@@ -100,7 +86,7 @@ export default {
return this.errorMessages != null && this.errorMessages.length > 0;
},
splitSpan() {
let vm = this;
const vm = this;
let theDays = 0;
let theHours = 0;
let theMinutes = 0;
@@ -112,10 +98,10 @@ export default {
theMinutes = 0;
theSeconds = 0;
} else {
let work = vm.value.split(":");
const work = vm.value.split(":");
//has days?
if (work[0].includes(".")) {
let dh = work[0].split(".");
const dh = work[0].split(".");
theDays = Number(dh[0]);
theHours = Number(dh[1]);
} else {
@@ -124,7 +110,7 @@ export default {
theMinutes = Number(work[1]);
//has milliseconds? (ignore them)
if (work[2].includes(".")) {
let dh = work[2].split(".");
const dh = work[2].split(".");
theSeconds = Number(dh[0]);
} else {
theSeconds = Number(work[2]);
@@ -149,16 +135,14 @@ export default {
return ret;
},
updateSpan() {
//{"data":{"testTSDaysWMS":"22.10:15:22.0330000","testTSHMS":"05:16:33","testTS_DHMS":"5.10:15:33","testTS_MS":"00:15:33","testTS_S":"00:00:33","testTS_D":"22.00:00:00"}}
// DD.HH:MM:SS.ms
let ret = "";
//NOTE: even though a user may type a text value into the input, because it's set to "Number"
//it always has a value of zero if it's not a digit even though the user typed Q for example (firefox at least)
//so no parsing here to handle weird entries is required AFAICT
let daysValue = this.$refs.daysPicker.$refs.input.value || 0;
let hoursValue = this.$refs.hoursPicker.$refs.input.value || 0;
let minutesValue = this.$refs.minutesPicker.$refs.input.value || 0;
let secondsValue = this.$refs.secondsPicker.$refs.input.value || 0;
const daysValue = this.$refs.daysPicker.$refs.input.value || 0;
const hoursValue = this.$refs.hoursPicker.$refs.input.value || 0;
const minutesValue = this.$refs.minutesPicker.$refs.input.value || 0;
const secondsValue = this.$refs.secondsPicker.$refs.input.value || 0;
if (daysValue > 0) {
ret = `${daysValue}.`;

View File

@@ -25,7 +25,7 @@
<script>
export default {
async created() {
let vm = this;
const vm = this;
await fetchTranslatedText(vm);
//NOTE: if extension doesn't support a particular object add it here to the NoType default
if (
@@ -49,8 +49,8 @@ export default {
return true;
},
async doAction() {
let vm = this;
let dialogResult = await window.$gz.dialog.confirmGeneric(
const vm = this;
const dialogResult = await window.$gz.dialog.confirmGeneric(
"EraseMultipleObjectsWarning",
"error"
);
@@ -61,33 +61,20 @@ export default {
vm.$emit("ext-show-job-log", "clear");
//do the batch action
let url = "job-operations/batch-delete";
let body = this.dataListSelection;
const url = "job-operations/batch-delete";
const body = this.dataListSelection;
try {
//call api route
let jobId = await window.$gz.api.upsert(url, body);
if (jobId.error) {
//throw new Error(jobId.error);
throw new Error(window.$gz.errorHandler.errorToString(jobId, vm));
}
jobId = jobId.jobId; //it's in a sub key
//indicate loading by setting on button
vm.jobActive = true;
/* /// <summary>
/// Job status for opsjobs
/// </summary>
public enum JobStatus : int
{
Absent=0,
Sleeping = 1,
Running = 2,
Completed = 3,
Failed = 4
} */
let jobStatus = 1;
//get status
while (vm.jobActive == true) {
await window.$gz.util.sleepAsync(1000);
@@ -117,8 +104,6 @@ export default {
vm.$emit("ext-close-refresh");
} catch (error) {
vm.jobActive = false;
//window.$gz.errorHandler.handleFormError(error, vm);
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed"));
}
}

View File

@@ -36,20 +36,16 @@ export default {
},
async doAction() {
//do the export and trigger download
let vm = this;
let url = `export/render/${vm.exportFormat}`;
let body = this.dataListSelection;
try {
//call api route
let res = await window.$gz.api.upsert(url, body);
const res = await window.$gz.api.upsert(
`export/render/${this.exportFormat}`,
this.dataListSelection
);
if (res.error) {
//Error object constructor must be a string
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
throw new Error(window.$gz.errorHandler.errorToString(res, this));
}
let href = window.$gz.api.genericDownloadUrl(
const href = window.$gz.api.genericDownloadUrl(
"export/download/" + res.data
);
if (window.open(href, "DownloadExport") == null) {
@@ -58,8 +54,8 @@ export default {
);
}
} catch (error) {
window.$gz.errorHandler.handleFormError(error, vm);
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed"));
window.$gz.errorHandler.handleFormError(error, this);
window.$gz.eventBus.$emit("notify-error", this.$ay.t("JobFailed"));
}
}
},

View File

@@ -43,7 +43,7 @@
<script>
export default {
created() {
let vm = this;
const vm = this;
if (
vm.dataListSelection.AType != 0 &&
@@ -66,7 +66,7 @@ export default {
window.open(this.$store.state.helpUrl + "ay-ex-tags", "_blank");
},
canDoAction() {
let vm = this;
const vm = this;
if (vm.action == "Replace" && !vm.replace) {
return false;
}
@@ -76,57 +76,36 @@ export default {
return false;
},
async doAction() {
//do the batch action
let vm = this;
let url = "tag-list/";
let body = this.dataListSelection;
switch (vm.action) {
switch (this.action) {
case "Add":
url += `batch-add/${vm.tag}`;
url += `batch-add/${this.tag}`;
break;
case "Remove":
url += `batch-remove/${vm.tag}`;
url += `batch-remove/${this.tag}`;
break;
case "Replace":
url += `batch-replace/${vm.tag}?toTag=${vm.replace}`;
url += `batch-replace/${this.tag}?toTag=${this.replace}`;
break;
}
try {
//call api route
let jobId = await window.$gz.api.upsert(url, body);
let jobId = await window.$gz.api.upsert(url, this.dataListSelection);
if (jobId.error) {
//throw new Error(jobId.error);
throw new Error(window.$gz.errorHandler.errorToString(jobId, vm));
throw new Error(window.$gz.errorHandler.errorToString(jobId, this));
}
jobId = jobId.jobId; //it's in a sub key
//indicate loading by setting on button
vm.jobActive = true;
jobId = jobId.jobId;
this.jobActive = true;
/* /// <summary>
/// Job status for opsjobs
/// </summary>
public enum JobStatus : int
{
Absent=0,
Sleeping = 1,
Running = 2,
Completed = 3,
Failed = 4
} */
let jobStatus = 1;
//get status
while (vm.jobActive == true) {
while (this.jobActive == true) {
await window.$gz.util.sleepAsync(1000);
//check if done
jobStatus = await window.$gz.api.get(
`job-operations/status/${jobId}`
);
if (jobStatus.error) {
//throw new Error(jobStatus.error);
throw new Error(
window.$gz.errorHandler.errorToString(jobStatus, vm)
window.$gz.errorHandler.errorToString(jobStatus, this)
);
}
jobStatus = jobStatus.data;
@@ -134,36 +113,29 @@ export default {
throw new Error("Job failed");
}
if (jobStatus == 3) {
vm.jobActive = false;
this.jobActive = false;
}
}
//Here if it's completed successfully
window.$gz.eventBus.$emit("notify-success", vm.$ay.t("JobCompleted"));
window.$gz.eventBus.$emit("notify-success", this.$ay.t("JobCompleted"));
} catch (error) {
vm.jobActive = false;
window.$gz.errorHandler.handleFormError(error, vm);
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed"));
this.jobActive = false;
window.$gz.errorHandler.handleFormError(error, this);
window.$gz.eventBus.$emit("notify-error", this.$ay.t("JobFailed"));
}
},
normalize(value) {
if (!value) {
return null;
}
//Must be lowercase per rules
//This may be naive when we get international cust omers but for now supporting utf-8 and it appears it's safe to do this with unicode
//This may be naive when we get international customers but for now supporting utf-8 and it appears it's safe to do this with unicode
value = value.toLowerCase();
//No spaces in tags, replace with dashes
value = value.split(" ").join("-");
//Remove multiple dash sequences
value = value.replace(/-+/g, "-");
//Ensure doesn't start or end with a dash
value = value.replace(/^\-+-\-+$/g, "");
// inObj = inObj.Trim("-");
//No longer than 255 characters
// inObj = StringUtil.MaxLength(inObj, 255);
return value;
},
normalizeTag(value) {

View File

@@ -64,7 +64,6 @@ export default {
},
headers: [],
errorObj: [],
//cache display format stuff
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12()
@@ -79,22 +78,20 @@ export default {
}`;
},
async handleError(jobId) {
let vm = this;
if (!jobId || jobId == "00000000-0000-0000-0000-000000000000") {
throw "Error: extension triggered handleError with empty jobId";
}
if (jobId == "clear") {
vm.errorObj = [];
this.errorObj = [];
return;
}
let res = await window.$gz.api.get(`job-operations/logs/${jobId}`);
const res = await window.$gz.api.get(`job-operations/logs/${jobId}`);
if (res.data) {
let ret = [];
const ret = [];
for (let i = 0; i < res.data.length; i++) {
let o = res.data[i];
const o = res.data[i];
ret.push({
id: i,
created: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
@@ -111,9 +108,9 @@ export default {
});
}
vm.errorObj = ret;
this.errorObj = ret;
} else {
vm.errorObj = [];
this.errorObj = [];
}
},
open(dls) {

View File

@@ -87,7 +87,7 @@ export default {
}
this.options = Object.assign(this.options, options);
this.maxWidth = Math.floor(window.innerWidth * 0.9);
let calculatedWidth = Math.floor(window.innerWidth * 0.5);
const calculatedWidth = Math.floor(window.innerWidth * 0.5);
if (calculatedWidth < 290) {
this.width = 290;
} else if (calculatedWidth > 800) {

View File

@@ -1,5 +1,4 @@
<template>
<!-- <v-scale-transition> -->
<v-snackbar
data-cy="gznotify"
:value="isVisible"
@@ -19,13 +18,9 @@
{{ this.$root.$gz.translation.get("More") }}
</v-btn>
</v-snackbar>
<!-- </v-scale-transition> -->
</template>
<script>
/* XXXeslint-disable */
const DEFAULT_NOTIFY_OPTIONS = { type: "info", timeout: 3000 };
export default {
data: () => ({
isVisible: false,
@@ -43,16 +38,13 @@ export default {
if (!options.message) {
return;
}
if (!options.type) {
options.type = DEFAULT_NOTIFY_OPTIONS.type;
}
if (!options.timeout) {
options.timeout = DEFAULT_NOTIFY_OPTIONS.timeout;
}
//add it to the queue
this.notificationQueue.push(options);
//trigger the notification queue handler if it isn't already in action
if (!this.processing) {
this.handleNotifications();
@@ -64,12 +56,10 @@ export default {
if (this.notificationQueue.length > 0) {
//Move the next item into the current slot
this.currentNotification = this.notificationQueue.shift();
//If don't use nextTick then don't get all visible when multiple in sequence
this.$nextTick(() => {
this.isVisible = true;
});
//Show it for the designated time before moving on to the next
setTimeout(() => {
this.isVisible = false;

View File

@@ -19,7 +19,6 @@
</div>
</template>
<script>
/* Xeslint-disable */
//### NOTE: THIS IS A DUPLICATE OF CURRENCYCONTROL AND THE ONLY DIFFERENCE IS THE "currency:" VALUE IS SET TO NULL IN THE TEMPLATE AND IN THE updateValue METHOD
//https://dm4t2.github.io/vue-currency-input/guide/#introduction :value="formattedValue"
//https://codesandbox.io/s/vue-template-kd7d1?fontsize=14&module=%2Fsrc%2FApp.vue
@@ -48,8 +47,8 @@ export default {
},
methods: {
updateValue() {
let val = this.$refs.textField.$refs.input.value;
let parsedValue = parseCurrency(val, {
const val = this.$refs.textField.$refs.input.value;
const parsedValue = parseCurrency(val, {
currency: null,
locale: this.languageName
});

View File

@@ -39,10 +39,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.fetchValueIfNotPresent();
@@ -113,24 +109,21 @@ export default {
this.fetchValueIfNotPresent();
},
searchEntry(val, oldVal) {
let vm = this;
//clear any local entryError
vm.clearErrors();
this.clearErrors();
//if the search entry is in the results list then it's a drop down selection not a typed search so bail
for (let i = 0; i < vm.searchResults.length; i++) {
if (vm.searchResults[i].name == val) {
for (let i = 0; i < this.searchResults.length; i++) {
if (this.searchResults[i].name == val) {
return;
}
}
if (!val || vm.fetching || !vm.initialized) {
if (!vm.initialized) {
vm.$nextTick(() => {
vm.initialized = true;
if (!val || this.fetching || !this.initialized) {
if (!this.initialized) {
this.$nextTick(() => {
this.initialized = true;
});
}
return;
}
this.doSearch(val);
},
entryError(val) {
@@ -183,9 +176,7 @@ export default {
//simulate empty selection:
e = window.$gz.form.getNoSelectionItem(true);
}
this.lastSelection = e;
//this is required for the control to update and parent form to detect it
this.$emit("input", e.id);
//this is sometimes required for forms that need more than the ID (contract etc)
@@ -194,63 +185,55 @@ export default {
},
fetchValueIfNotPresent() {
//is there a value that might require fetching?
let vm = this;
let val = vm.value;
const val = this.value;
if (val == null) {
return;
}
//check if it's in the list of items we have here
for (let i = 0; i < vm.searchResults.length; i++) {
if (vm.searchResults[i].id == val) {
for (let i = 0; i < this.searchResults.length; i++) {
if (this.searchResults[i].id == val) {
return;
}
}
//is it the no selection item?
if (val == null) {
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
window.$gz.form.addNoSelectionItem(this.searchResults, true);
} else {
//Not here, better get it
let pickListParams = {
ayaType: vm.ayaType,
preselectedIds: [vm.value]
const pickListParams = {
ayaType: this.ayaType,
preselectedIds: [this.value]
};
if (vm.variant != null) {
pickListParams["listVariant"] = vm.variant;
if (this.variant != null) {
pickListParams["listVariant"] = this.variant;
}
if (vm.template != null) {
pickListParams["template"] = vm.template;
if (this.template != null) {
pickListParams["template"] = this.template;
}
vm.getList(pickListParams);
this.getList(pickListParams);
}
},
replaceLastSelection() {
let vm = this;
//check if searchResults has last selection, if not then add it back in again
if (vm.lastSelection == null) {
if (this.lastSelection == null) {
//it might be initializing
for (let i = 0; i < vm.searchResults.length; i++) {
if (vm.searchResults[i].id == vm.value) {
vm.lastSelection = vm.searchResults[i];
for (let i = 0; i < this.searchResults.length; i++) {
if (this.searchResults[i].id == this.value) {
this.lastSelection = this.searchResults[i];
return;
}
}
return;
}
for (let i = 0; i < vm.searchResults.length; i++) {
if (vm.searchResults[i].id == vm.lastSelection.id) {
for (let i = 0; i < this.searchResults.length; i++) {
if (this.searchResults[i].id == this.lastSelection.id) {
return; //already there
}
}
//Not there so insert it
vm.searchResults.push(vm.lastSelection);
this.searchResults.push(this.lastSelection);
},
dropdown(e) {
let vm = this;
const vm = this;
//check if we have only the initial loaded item and no selection item
if (vm.searchResults.length < 3) {
//get the default list
@@ -272,72 +255,48 @@ export default {
//need to do a case insensitive filter and hopefully it mirrors postgres at the backend
return item.name.toLowerCase().indexOf(queryText.toLowerCase()) > -1;
}
//split out just the text search part
// let searchText = queryText;
// if (queryText.includes(" ")) {
// //get the non tag part of query if possible
// //ignore bad condition of too many terms
// let searchTerms = queryText.split(" ");
// if (searchTerms[0].includes("..")) {
// searchText = searchTerms[1];
// } else {
// searchText = searchTerms[0];
// }
// }
},
getList: async function(pickListParams) {
/*
public AyaType AyaType { get; set; }
public string Query { get; set; }
public bool Inactive { get; set; }
public List<long> PreselectedIds { get; set; }
public string ListVariant { get; set; }
//"{\"ayaType\":8,\"preselectedIds\":[1,3,5,7]}"
}
*/
let vm = this;
if (vm.fetching) {
if (this.fetching) {
return;
}
vm.fetching = true;
this.fetching = true;
//default params for when called on init
if (!pickListParams) {
pickListParams = {
ayaType: vm.ayaType
ayaType: this.ayaType
};
if (vm.value != null) {
pickListParams["preselectedIds"] = [vm.value];
if (this.value != null) {
pickListParams["preselectedIds"] = [this.value];
}
if (vm.includeInactive) {
if (this.includeInactive) {
pickListParams["inactive"] = true;
}
if (vm.variant != null) {
pickListParams["listVariant"] = vm.variant;
if (this.variant != null) {
pickListParams["listVariant"] = this.variant;
}
if (vm.template != null) {
pickListParams["template"] = vm.template;
if (this.template != null) {
pickListParams["template"] = this.template;
}
}
try {
let res = await window.$gz.api.upsert("pick-list/list", pickListParams);
const res = await window.$gz.api.upsert(
"pick-list/list",
pickListParams
);
vm.fetching = false;
//We never expect there to be no data here
this.fetching = false;
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
}
vm.searchResults = res.data;
if (vm.allowNoSelection) {
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
this.searchResults = res.data;
if (this.allowNoSelection) {
window.$gz.form.addNoSelectionItem(this.searchResults, true);
}
vm.replaceLastSelection();
this.replaceLastSelection();
} catch (err) {
window.$gz.errorHandler.handleFormError(err);
vm.fetching = false;
this.fetching = false;
}
},
doSearch: debounce(function(searchFor) {
@@ -345,7 +304,7 @@ export default {
//https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
//-----------------
let vm = this;
const vm = this;
let isATwoTermQuery = false;
let queryTerms = [];
//NOTE: empty query is valid; it means get the top 100 ordered by template order
@@ -354,9 +313,7 @@ export default {
emptyQuery = true;
} else {
//Pre-process the query to validate and send conditionally
//get the discrete search terms and verify there are max two
if (searchFor.includes(" ")) {
queryTerms = searchFor.split(" ");
if (queryTerms.length > 2) {
@@ -412,20 +369,17 @@ export default {
}
//build parameter
let pickListParams = { ayaType: vm.ayaType };
//let urlParams = "?ayaType=" + vm.ayaType;
const pickListParams = { ayaType: vm.ayaType };
if (!emptyQuery) {
let query = queryTerms[0];
if (queryTerms[1] != "[?]") {
query += " " + queryTerms[1];
}
//urlParams += "&query=" + query;
pickListParams["query"] = query;
}
if (vm.includeInactive) {
pickListParams["inactive"] = true;
//urlParams += "&inactive=true";
}
if (vm.variant != null) {
pickListParams["listVariant"] = vm.variant;

View File

@@ -461,10 +461,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzWoAddress from "./work-order-address.vue";
import GZDaysOfWeek from "./days-of-week-control.vue";
export default {

View File

@@ -437,10 +437,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -506,7 +502,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].expenses.length;
const newIndex = this.value.items[this.activeWoItemIndex].expenses.length;
//#################################### IMPORTANT ##################################################
//NOTE: default values are critical and must match server validation ExpenseValidateAsync for restricted users
@@ -532,7 +528,7 @@ export default {
chargeToCustomer: false,
isDirty: true,
pmItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now() //used for error tracking / display
uid: Date.now()
});
this.$emit("change");
this.selectedRow = [{ index: newIndex }];
@@ -586,11 +582,6 @@ export default {
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
// //set viz if applicable
// if(ref==""){
// let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
// }
}
},
itemRowClasses: function(item) {
@@ -637,7 +628,7 @@ export default {
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemExpenseName")) {
headers.push({

View File

@@ -439,10 +439,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -526,7 +522,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].labors.length;
const newIndex = this.value.items[this.activeWoItemIndex].labors.length;
this.value.items[this.activeWoItemIndex].labors.push({
id: 0,
@@ -702,7 +698,6 @@ export default {
}
return ret;
}
//---
},
computed: {
isDeleted: function() {
@@ -723,11 +718,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemLaborServiceStartDate")) {
headers.push({
@@ -992,7 +983,6 @@ export default {
canDeleteAll: function() {
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----
}
};
</script>

View File

@@ -409,10 +409,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -484,7 +480,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].loans.length;
const newIndex = this.value.items[this.activeWoItemIndex].loans.length;
this.value.items[this.activeWoItemIndex].loans.push({
id: 0,
@@ -606,11 +602,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemLoanUnit")) {
headers.push({
@@ -878,8 +870,6 @@ export default {
canDeleteAll: function() {
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----
}
};
</script>

View File

@@ -591,10 +591,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -669,7 +665,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].outsideServices
const newIndex = this.value.items[this.activeWoItemIndex].outsideServices
.length;
this.value.items[this.activeWoItemIndex].outsideServices.push({
@@ -801,11 +797,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemOutsideServiceUnit")) {
headers.push({

View File

@@ -465,10 +465,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -561,7 +557,7 @@ export default {
if (!partId || partId == 0) {
return;
}
let res = await window.$gz.api.get(`part/serials/${partId}`);
const res = await window.$gz.api.get(`part/serials/${partId}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
@@ -598,7 +594,7 @@ export default {
this.$emit("change");
},
async addPartAssembly() {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`part-assembly/${this.selectedPartAssembly}`
);
if (res.data && res.data.items) {
@@ -713,7 +709,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].parts.length;
const newIndex = this.value.items[this.activeWoItemIndex].parts.length;
this.value.items[this.activeWoItemIndex].parts.push({
id: 0,
@@ -861,11 +857,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemPartPartID")) {
headers.push({

View File

@@ -303,10 +303,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -407,7 +403,7 @@ export default {
].serviceRateViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
const newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
.length;
this.value.items[this.activeWoItemIndex].scheduledUsers.push({
@@ -600,11 +596,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemScheduledUserStartDate")) {
headers.push({

View File

@@ -311,10 +311,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -371,7 +367,7 @@ export default {
},
methods: {
async addTaskGroup() {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
@@ -391,7 +387,7 @@ export default {
}
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
const incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete
).name;
res.data.items.forEach(z => {
@@ -443,7 +439,7 @@ export default {
}
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
const newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
this.value.items[this.activeWoItemIndex].tasks.push({
id: 0,
concurrency: 0,
@@ -557,11 +553,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemTaskSequence")) {
headers.push({

View File

@@ -470,10 +470,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -543,7 +539,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].travels.length;
const newIndex = this.value.items[this.activeWoItemIndex].travels.length;
this.value.items[this.activeWoItemIndex].travels.push({
id: 0,
@@ -741,11 +737,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemTravelStartDate")) {
headers.push({

View File

@@ -338,10 +338,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -412,7 +408,7 @@ export default {
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/active-contract/${id}`);
const res = await window.$gz.api.get(`unit/active-contract/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
@@ -434,7 +430,7 @@ export default {
.t("ApplyUnitContract")
.replace("{0}", res.data.name);
let dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
const dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
prompt,
"question"
);
@@ -457,27 +453,13 @@ export default {
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/service-warranty-info/${id}`);
const res = await window.$gz.api.get(`unit/service-warranty-info/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
window.$gz.errorHandler.errorToString(res, this)
);
} else {
/* {
"recentWorkOrders":[{"serial":10,"id":10,"serviceDate":"2021-01-19T22:00:00Z"},{"serial":8,"id":8,"serviceDate":"2021-04-08T22:00:00Z"},{"serial":7,"id":7,"serviceDate":"2021-04-18T20:00:00Z"}],
"purchaseDate":"2019-03-12T09:37:52.930923Z",
"purchasedFromVendor":null,
"purchaseFromVendorId":null,
"purchaseReceiptNumber":"139736",
"lifeTimeWarranty":false,
"warrantyExpiryDate":"2019-04-12T09:37:52.930923Z",
"warrantyTerms":"Shipping parts and service"}
"UnitPurchasedDate": "Purchased Date",
"UnitPurchaseFromID": "Purchased From",
"UnitReceipt": "Receipt Number",
*/
const r = res.data;
let WarrantyInfo = `${this.$ay.t("Warranty")}: `;
@@ -511,7 +493,7 @@ export default {
this.pvm.hour12
);
}
let PurchaseInfo = `${this.$ay.t(
const PurchaseInfo = `${this.$ay.t(
"UnitPurchaseFromID"
)}: ${PurchasedFrom}<br/>${this.$ay.t(
"UnitPurchasedDate"
@@ -536,11 +518,11 @@ export default {
RecentWorkOrderList = "-";
}
let RecentWorkOrderInfo = `${this.$ay.t(
const RecentWorkOrderInfo = `${this.$ay.t(
"RecentWorkOrders"
)}:${RecentWorkOrderList}`;
let d = `<div>${WarrantyInfo}<br/>${PurchaseInfo}<br/>${RecentWorkOrderInfo}</div>`;
const d = `<div>${WarrantyInfo}<br/>${PurchaseInfo}<br/>${RecentWorkOrderInfo}</div>`;
this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex
@@ -561,7 +543,7 @@ export default {
this.selectedBulkUnits.splice(0);
this.availableBulkUnits.splice(0);
let res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
const res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
tags: this.selectedBulkUnitTags,
restrictToCustomerId: this.selectedBulkUnitCustomer
});
@@ -610,21 +592,7 @@ export default {
await this.updateContractIfApplicable();
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].units.length;
// {
// "0": {
// "id": 53,
// "concurrency": 9586762,
// "notes": "Aut modi molestias molestiae ipsa id.",
// "wiki": null,
// "customFields": null,
// "tags": [],
// "unitId": 4,
// "unitViz": "83429560",
// "pmItemId": 22
// }
// }
const newIndex = this.value.items[this.activeWoItemIndex].units.length;
this.value.items[this.activeWoItemIndex].units.push({
id: 0,
concurrency: 0,
@@ -699,11 +667,6 @@ export default {
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
// //set viz if applicable
// if(ref==""){
// let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
// }
}
},
itemRowClasses: function(item) {
@@ -745,11 +708,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemUnit")) {
headers.push({

View File

@@ -1,7 +1,6 @@
<template>
<div v-if="value != null" class="mt-8">
<v-row>
<!-- Title and menu -->
<v-col cols="12">
<v-menu offset-y max-width="600px">
<template v-slot:activator="{ on, attrs }">
@@ -613,10 +612,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzPMItemUnits from "../components/pm-item-units.vue";
import GzPMItemScheduledUsers from "../components/pm-item-scheduled-users.vue";
import GzPMItemLabors from "../components/pm-item-labors.vue";
@@ -674,7 +669,7 @@ export default {
watch: {
goto(val, oldVal) {
if (val != oldVal) {
let navto = { woitemindex: null, childindex: null };
const navto = { woitemindex: null, childindex: null };
//find the item in question then trigger the nav
let keepgoing = true;
this.value.items.forEach((z, itemindex) => {
@@ -822,7 +817,7 @@ export default {
},
methods: {
newItem() {
let newIndex = this.value.items.length;
const newIndex = this.value.items.length;
this.value.items.push({
id: 0,
@@ -861,7 +856,7 @@ export default {
},
newSubItem(atype) {
//new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto)
let newId = -Math.abs(Date.now());
const newId = -Math.abs(Date.now());
switch (atype) {
case window.$gz.type.WorkOrderItemOutsideService:
this.gotoOutsideServiceIndex = newId;
@@ -968,7 +963,7 @@ export default {
return this.value.items[this.activeItemIndex].deleted === true;
},
headerList: function() {
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemSequence")) {
headers.push({

View File

@@ -473,9 +473,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzQuoteState from "./quote-state.vue";
import GzWoAddress from "./work-order-address.vue";
export default {

View File

@@ -437,10 +437,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -506,7 +502,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].expenses.length;
const newIndex = this.value.items[this.activeWoItemIndex].expenses.length;
//#################################### IMPORTANT ##################################################
//NOTE: default values are critical and must match server validation ExpenseValidateAsync for restricted users
@@ -586,11 +582,6 @@ export default {
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
// //set viz if applicable
// if(ref==""){
// let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
// }
}
},
itemRowClasses: function(item) {
@@ -633,11 +624,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemExpenseName")) {
headers.push({

View File

@@ -439,10 +439,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -526,7 +522,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].labors.length;
const newIndex = this.value.items[this.activeWoItemIndex].labors.length;
this.value.items[this.activeWoItemIndex].labors.push({
id: 0,
@@ -723,11 +719,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemLaborServiceStartDate")) {
headers.push({

View File

@@ -409,10 +409,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -484,7 +480,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].loans.length;
const newIndex = this.value.items[this.activeWoItemIndex].loans.length;
this.value.items[this.activeWoItemIndex].loans.push({
id: 0,
@@ -606,11 +602,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemLoanUnit")) {
headers.push({

View File

@@ -591,10 +591,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -669,7 +665,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].outsideServices
const newIndex = this.value.items[this.activeWoItemIndex].outsideServices
.length;
this.value.items[this.activeWoItemIndex].outsideServices.push({
@@ -801,11 +797,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemOutsideServiceUnit")) {
headers.push({

View File

@@ -465,10 +465,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -561,7 +557,7 @@ export default {
if (!partId || partId == 0) {
return;
}
let res = await window.$gz.api.get(`part/serials/${partId}`);
const res = await window.$gz.api.get(`part/serials/${partId}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
@@ -598,7 +594,7 @@ export default {
this.$emit("change");
},
async addPartAssembly() {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`part-assembly/${this.selectedPartAssembly}`
);
if (res.data && res.data.items) {
@@ -713,7 +709,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].parts.length;
const newIndex = this.value.items[this.activeWoItemIndex].parts.length;
this.value.items[this.activeWoItemIndex].parts.push({
id: 0,
@@ -861,11 +857,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemPartPartID")) {
headers.push({

View File

@@ -303,10 +303,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -407,7 +403,7 @@ export default {
].serviceRateViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
const newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
.length;
this.value.items[this.activeWoItemIndex].scheduledUsers.push({
@@ -600,11 +596,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemScheduledUserStartDate")) {
headers.push({

View File

@@ -311,10 +311,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -371,7 +367,7 @@ export default {
},
methods: {
async addTaskGroup() {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
@@ -390,7 +386,7 @@ export default {
this.value.items[this.activeWoItemIndex].tasks.splice(0, 1);
}
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
const incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete
).name;
res.data.items.forEach(z => {
@@ -442,7 +438,7 @@ export default {
}
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
const newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
this.value.items[this.activeWoItemIndex].tasks.push({
id: 0,
concurrency: 0,
@@ -556,11 +552,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemTaskSequence")) {
headers.push({

View File

@@ -470,10 +470,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -543,7 +539,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].travels.length;
const newIndex = this.value.items[this.activeWoItemIndex].travels.length;
this.value.items[this.activeWoItemIndex].travels.push({
id: 0,
@@ -741,11 +737,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemTravelStartDate")) {
headers.push({

View File

@@ -338,10 +338,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -412,7 +408,7 @@ export default {
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/active-contract/${id}`);
const res = await window.$gz.api.get(`unit/active-contract/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
@@ -434,7 +430,7 @@ export default {
.t("ApplyUnitContract")
.replace("{0}", res.data.name);
let dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
const dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
prompt,
"question"
);
@@ -457,27 +453,13 @@ export default {
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/service-warranty-info/${id}`);
const res = await window.$gz.api.get(`unit/service-warranty-info/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
window.$gz.errorHandler.errorToString(res, this)
);
} else {
/* {
"recentWorkOrders":[{"serial":10,"id":10,"serviceDate":"2021-01-19T22:00:00Z"},{"serial":8,"id":8,"serviceDate":"2021-04-08T22:00:00Z"},{"serial":7,"id":7,"serviceDate":"2021-04-18T20:00:00Z"}],
"purchaseDate":"2019-03-12T09:37:52.930923Z",
"purchasedFromVendor":null,
"purchaseFromVendorId":null,
"purchaseReceiptNumber":"139736",
"lifeTimeWarranty":false,
"warrantyExpiryDate":"2019-04-12T09:37:52.930923Z",
"warrantyTerms":"Shipping parts and service"}
"UnitPurchasedDate": "Purchased Date",
"UnitPurchaseFromID": "Purchased From",
"UnitReceipt": "Receipt Number",
*/
const r = res.data;
let WarrantyInfo = `${this.$ay.t("Warranty")}: `;
@@ -511,7 +493,7 @@ export default {
this.pvm.hour12
);
}
let PurchaseInfo = `${this.$ay.t(
const PurchaseInfo = `${this.$ay.t(
"UnitPurchaseFromID"
)}: ${PurchasedFrom}<br/>${this.$ay.t(
"UnitPurchasedDate"
@@ -536,11 +518,11 @@ export default {
RecentWorkOrderList = "-";
}
let RecentWorkOrderInfo = `${this.$ay.t(
const RecentWorkOrderInfo = `${this.$ay.t(
"RecentWorkOrders"
)}:${RecentWorkOrderList}`;
let d = `<div>${WarrantyInfo}<br/>${PurchaseInfo}<br/>${RecentWorkOrderInfo}</div>`;
const d = `<div>${WarrantyInfo}<br/>${PurchaseInfo}<br/>${RecentWorkOrderInfo}</div>`;
this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex
@@ -561,7 +543,7 @@ export default {
this.selectedBulkUnits.splice(0);
this.availableBulkUnits.splice(0);
let res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
const res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
tags: this.selectedBulkUnitTags,
restrictToCustomerId: this.selectedBulkUnitCustomer
});
@@ -610,20 +592,7 @@ export default {
await this.updateContractIfApplicable();
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].units.length;
// {
// "0": {
// "id": 53,
// "concurrency": 9586762,
// "notes": "Aut modi molestias molestiae ipsa id.",
// "wiki": null,
// "customFields": null,
// "tags": [],
// "unitId": 4,
// "unitViz": "83429560",
// "quoteItemId": 22
// }
// }
const newIndex = this.value.items[this.activeWoItemIndex].units.length;
this.value.items[this.activeWoItemIndex].units.push({
id: 0,
@@ -699,11 +668,6 @@ export default {
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
// //set viz if applicable
// if(ref==""){
// let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
// }
}
},
itemRowClasses: function(item) {
@@ -745,11 +709,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemUnit")) {
headers.push({

View File

@@ -613,10 +613,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzQuoteItemUnits from "../components/quote-item-units.vue";
import GzQuoteItemScheduledUsers from "../components/quote-item-scheduled-users.vue";
import GzQuoteItemLabors from "../components/quote-item-labors.vue";
@@ -674,7 +670,7 @@ export default {
watch: {
goto(val, oldVal) {
if (val != oldVal) {
let navto = { woitemindex: null, childindex: null };
const navto = { woitemindex: null, childindex: null };
//find the item in question then trigger the nav
let keepgoing = true;
this.value.items.forEach((z, itemindex) => {
@@ -822,7 +818,7 @@ export default {
},
methods: {
newItem() {
let newIndex = this.value.items.length;
const newIndex = this.value.items.length;
this.value.items.push({
id: 0,
@@ -861,7 +857,7 @@ export default {
},
newSubItem(atype) {
//new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto)
let newId = -Math.abs(Date.now());
const newId = -Math.abs(Date.now());
switch (atype) {
case window.$gz.type.WorkOrderItemOutsideService:
this.gotoOutsideServiceIndex = newId;
@@ -968,7 +964,7 @@ export default {
return this.value.items[this.activeItemIndex].deleted === true;
},
headerList: function() {
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemSequence")) {
headers.push({

View File

@@ -136,10 +136,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
data() {
return {
@@ -197,7 +193,7 @@ export default {
}
},
getStateForDisplay(state) {
let ret = {
const ret = {
id: Date.now,
name: "??",
color: "#ffffff",
@@ -259,7 +255,7 @@ export default {
return this.value.states != null && this.value.states.length > 0;
},
stateDisplayList() {
let ret = [];
const ret = [];
this.value.states.forEach(z => {
ret.push(this.getStateForDisplay(z));
});
@@ -281,7 +277,7 @@ export default {
//ok, only thing left to check is if the current user can unlock this
//get remove roles required for current state
let cs = this.pvm.currentState;
const cs = this.pvm.currentState;
if (cs.removeRoles == null || cs.removeRoles == 0) {
//no state set yet
return true;

View File

@@ -88,27 +88,28 @@ export default {
});
},
async renderReport(reportId, reportName) {
let vm = this;
if (vm.$route.params.recordid == 0) {
if (this.$route.params.recordid == 0) {
return;
}
let reportDataOptions = vm.reportDataOptions;
const reportDataOptions = this.reportDataOptions;
if (!reportDataOptions) {
this.reject("Missing report data unable to render report");
}
reportDataOptions.ReportId = reportId;
//Meta data from client for use by report script
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
vm.rendering = true;
let url = "report/render";
this.rendering = true;
let res = await window.$gz.api.upsert(url, reportDataOptions);
vm.rendering = false;
const res = await window.$gz.api.upsert(
"report/render",
reportDataOptions
);
this.rendering = false;
if (res.error) {
this.reject(res);
} else {
let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
const reportUrl = window.$gz.api.reportDownloadUrl(res.data);
if (window.open(reportUrl, "Report") == null) {
this.reject(
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
@@ -123,7 +124,7 @@ export default {
}
},
async open(reportDataOptions, preSelectReportId) {
let vm = this;
const vm = this;
if (reportDataOptions == null) {
throw new Error("report-selector:Open missing reportDataOptions");
}
@@ -135,7 +136,7 @@ export default {
this.preSelectReportId = preSelectReportId;
if (!preSelectReportId) {
//get report list from server
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`report/list/${reportDataOptions.AType}`
);
if (res.error) {

View File

@@ -17,11 +17,10 @@
></v-select>
</template>
<script>
/* Xeslint-disable */
export default {
async created() {
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
let rawRoles = window.$gz.enums.getSelectionList("AuthorizationRoles");
const rawRoles = window.$gz.enums.getSelectionList("AuthorizationRoles");
if (this.limitSelectionTo == null) {
this.availableRoles = rawRoles;
} else {
@@ -55,10 +54,10 @@ export default {
},
computed: {
selectedValue() {
let ret = [];
const ret = [];
if (this.value != null && this.value != 0) {
for (let i = 0; i < this.availableRoles.length; i++) {
let role = this.availableRoles[i];
const role = this.availableRoles[i];
if (!!(this.value & role.id)) {
ret.push(role.id);
}
@@ -72,7 +71,7 @@ export default {
let newValue = 0;
if (value != null && value != [] && value.length > 0) {
for (let i = 0; i < value.length; i++) {
let role = value[i];
const role = value[i];
newValue = newValue | role;
}
}

View File

@@ -32,26 +32,10 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
//this was the original code that was working for months, even years then suddenly stopped working after a vue update
// beforeUpdate() {
// console.log("TAG-PICKER: beforeupdate called");
// //Set the initial list items based on the record items, this only needs to be called once at init
// if (!this.initialized && this.value != null && this.value.length > 0) {
// console.log("TAG-PICKER: beforeupdate init in if statement");
// this.sourcetags = this.value;
// this.initialized = true;
// }
// },
created() {
//Set the initial list items based on the record items, this only needs to be called once at init
if (!this.initialized && this.value != null && this.value.length > 0) {
this.sourcetags = this.value;
this.initialized = true;
}
@@ -66,25 +50,29 @@ export default {
},
props: {
value: {
default: [],
default() {
return [];
},
type: Array
},
// value: Array,
label: String,
label: {
type: String,
default() {
return null;
}
},
readonly: { type: Boolean, default: false },
rules: { type: Array, default: undefined },
errorMessages: { type: Array, default: null }
},
watch: {
async tagSearchEntry(val) {
let vm = this;
if (!val || vm.tagSearchUnderway) {
if (!val || this.tagSearchUnderway) {
return;
}
vm.tagSearchUnderway = true;
this.tagSearchUnderway = true;
try {
let res = await window.$gz.api.get("tag-list/list?query=" + val); //roles
const res = await window.$gz.api.get("tag-list/list?query=" + val);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
throw new Error(res);
@@ -92,8 +80,8 @@ export default {
//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.sourcetags = res.data;
vm.tagSearchUnderway = false;
this.sourcetags = res.data;
this.tagSearchUnderway = false;
} catch (err) {
window.$gz.errorHandler.handleFormError(err);
}
@@ -112,8 +100,8 @@ export default {
if (this.tagSearchEntry == null || this.tagSearchEntry == "") {
return false;
}
let searchTag = this.normalizeTag(this.tagSearchEntry);
if (this.value.some((z) => z == searchTag)) return false;
const searchTag = this.normalizeTag(this.tagSearchEntry);
if (this.value.some(z => z == searchTag)) return false;
return true;
},
input(e) {

View File

@@ -57,17 +57,14 @@
</div>
</template>
<script>
/* Xeslint-disable */
//NOTE: this control also captures the date even though it's time only
//this is an intentional design decision to support field change to date or date AND time and is considered a display issue
export default {
data: () => ({
dlgtime: false,
//cache display format stuff
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12()
// defaultLocale: window.$gz.locale.g etBrowserFirstLanguage().split("-", 1)[0]
}),
props: {
label: { type: String, default: null },
@@ -97,7 +94,7 @@ export default {
},
methods: {
setNow() {
let v = window.$gz.locale
const v = window.$gz.locale
.nowUTC8601String(this.timeZoneName)
.split("T")[1];
this.updateTimeValue(v);
@@ -123,11 +120,11 @@ export default {
this.updateValue(this.dateValue, v);
},
updateValue(theDate, theTime) {
let vm = this;
const vm = this;
if (!theDate) {
let v = new Date();
let fullYear = v.getFullYear();
const v = new Date();
const fullYear = v.getFullYear();
let fullMonth = v.getMonth() + 1;
if (fullMonth < 10) {
fullMonth = "0" + fullMonth.toString();
@@ -138,12 +135,10 @@ export default {
}
theDate = fullYear + "-" + fullMonth + "-" + fullDay;
}
if (!theTime) {
theTime = "00:00:00";
}
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
const ret = window.$gz.locale.localTimeDateStringToUTC8601String(
theDate + "T" + theTime,
vm.timeZoneName
);

View File

@@ -23,20 +23,16 @@
</template>
</div>
</template>
<script>
//==========================================
//==========================================
export default {
data() {
return {
timeZoneName: window.$gz.locale.getResolvedTimeZoneName()
};
},
props: {
label: { type: String, default: null },
rules: { type: Array, default: undefined},
rules: { type: Array, default: undefined },
errorMessages: { type: Array, default: null },
value: { type: String, default: null },
readonly: { type: Boolean, default: false },
@@ -61,14 +57,13 @@ export default {
);
},
updateValue() {
let vm = this;
let dateValue = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
vm.value,
vm.timeZoneName
this.value,
this.timeZoneName
);
if (!dateValue) {
let v = new Date();
let fullYear = v.getFullYear();
const v = new Date();
const fullYear = v.getFullYear();
let fullMonth = v.getMonth() + 1;
if (fullMonth < 10) {
fullMonth = "0" + fullMonth.toString();
@@ -79,17 +74,15 @@ export default {
}
dateValue = fullYear + "-" + fullMonth + "-" + fullDay;
}
let timeValue = vm.$refs.timeField.$refs.input.value;
let timeValue = this.$refs.timeField.$refs.input.value;
if (!timeValue) {
timeValue = "00:00:00";
}
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
const ret = window.$gz.locale.localTimeDateStringToUTC8601String(
dateValue + "T" + timeValue,
vm.timeZoneName
this.timeZoneName
);
vm.$emit("input", ret);
this.$emit("input", ret);
}
}
};

View File

@@ -333,7 +333,6 @@
<script>
import marked from "marked";
import DOMPurify from "dompurify";
export default {
created() {
// Add a hook to make all links open a new window
@@ -355,7 +354,6 @@ export default {
});
},
beforeDestroy() {
//cleanup
DOMPurify.removeAllHooks();
},
data() {
@@ -420,14 +418,16 @@ export default {
return "";
}
//replace attachment urls with tokenized local urls
let src = this.localVal.replace(/\[ATTACH:(.*)\]/g, function(match, p1) {
const src = this.localVal.replace(/\[ATTACH:(.*)\]/g, function(
match,
p1
) {
return window.$gz.api.attachmentDownloadUrl(p1);
});
return DOMPurify.sanitize(marked(src, { breaks: true }));
},
onResize() {
// this.editAreaHeight = window.innerHeight / 2;
this.editAreaHeight = window.innerHeight * 0.8;
},
toggleReveal() {
@@ -451,10 +451,9 @@ export default {
}
},
getSelectedRange(forceBlock) {
let bodyTextArea = this.$refs.editArea.$el.querySelector("textarea");
const bodyTextArea = this.$refs.editArea.$el.querySelector("textarea");
this.selection.start = bodyTextArea.selectionStart;
this.selection.end = bodyTextArea.selectionEnd;
//some edits only work on a block so if user is just clicked on a line then add make a selection
if (forceBlock) {
//add a character to selection forward if possible but if not then go backward one
@@ -474,7 +473,7 @@ export default {
this.selection.startOfBlock = this.selection.start;
if (this.selection.start > 0) {
//find linefeed prior to current start
let indexOfLineFeed = this.localVal.lastIndexOf(
const indexOfLineFeed = this.localVal.lastIndexOf(
"\n",
this.selection.start
);
@@ -491,14 +490,14 @@ export default {
this.selection.endOfBlock = this.selection.end;
if (this.selection.end > 0) {
//find linefeed prior to current start
let indexOfLineFeed = this.localVal.indexOf("\n", this.selection.end);
const indexOfLineFeed = this.localVal.indexOf("\n", this.selection.end);
if (indexOfLineFeed != -1) {
this.selection.endOfBlock = indexOfLineFeed;
}
}
},
setSelectedRange(start, end) {
let bodyTextArea = this.$refs.editArea.$el.querySelector("textarea");
const bodyTextArea = this.$refs.editArea.$el.querySelector("textarea");
bodyTextArea.setSelectionRange(start, end);
},
getSelectedText() {
@@ -545,9 +544,9 @@ export default {
//the purpose of this is only to change the selection if it's got an extra space to the right
//because double clicking on a word with another word after it causes the space to be included
this.getSelectedRange();
let temp = this.getSelectedText();
let tempTrimmed = temp.trimEnd();
let diff = temp.length - tempTrimmed.length;
const temp = this.getSelectedText();
const tempTrimmed = temp.trimEnd();
const diff = temp.length - tempTrimmed.length;
if (diff != 0) {
//there were some spaces so update the selection range
//force selection to be shorter by diff
@@ -568,7 +567,6 @@ export default {
} else {
return "$ayiEyeSlash";
}
return;
}
switch (this.currentView) {
@@ -646,7 +644,7 @@ export default {
case "heading":
{
this.getSelectedRange(true); //special forces
let prepend = "#".repeat(ex) + " ";
const prepend = "#".repeat(ex) + " ";
let s = this.getSelectedBlock();
s = s.replace(/\n/gi, "\n" + prepend);
if (s.length > 0 && s[0] != "\n") {
@@ -688,7 +686,7 @@ export default {
case "ol":
{
if (this.selection.hasSelection) {
let s = this.getSelectedBlock();
const s = this.getSelectedBlock();
let ret = "\n1. ";
let listItem = 1;
for (let i = 0; i < s.length; i++) {
@@ -769,7 +767,7 @@ export default {
if (!url.includes(":")) {
url = "https://" + url;
}
let t = "[" + this.linkText + "](" + url + ")";
const t = "[" + this.linkText + "](" + url + ")";
// [MY Awesome LINK](www.ayanova.com)
this.replaceSelectedText(t);
}
@@ -801,7 +799,7 @@ export default {
return;
}
let txt = this.imageText;
const txt = this.imageText;
//force it to a full url so it doesn't attempt to open it as a SPA window
if (!url.includes(":")) {
url = "https://" + url;
@@ -819,11 +817,7 @@ export default {
break;
default:
throw new Error(`wiki-control: ${editType} NOT IMPLEMENTED`);
break;
}
// //emit input event to parent form for dirty tracking
// this.handleInput(this.localVal);
},
openLinkMenu(e) {
e.preventDefault();
@@ -848,18 +842,18 @@ export default {
});
},
async getAttachments() {
let vm = this;
const vm = this;
try {
vm.attachments = [];
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"attachment/list?ayatype=" + vm.ayaType + "&ayaid=" + vm.ayaId
);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error);
} else {
let ret = [];
const ret = [];
for (let i = 0; i < res.data.length; i++) {
let o = res.data[i];
const o = res.data[i];
if (
window.$gz.util.isImageAttachment(
@@ -884,22 +878,22 @@ export default {
},
async upload() {
//similar code in attachment-control upload
let vm = this;
let at = {
const vm = this;
const at = {
ayaId: vm.ayaId,
ayaType: vm.ayaType,
files: vm.uploadFiles,
notes: ""
};
try {
let res = await window.$gz.api.uploadAttachment(at);
const res = await window.$gz.api.uploadAttachment(at);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error);
} else {
let ret = [];
const ret = [];
for (let i = 0; i < res.data.length; i++) {
let o = res.data[i];
const o = res.data[i];
//let them attach any file type to the wiki since it supports it anyway
ret.push({
@@ -914,9 +908,9 @@ export default {
//NOW iterate upload files list and insert into wiki based on attachments
//insert into wiki
for (let i = 0; i < vm.uploadFiles.length; i++) {
let upFile = vm.uploadFiles[i];
const upFile = vm.uploadFiles[i];
for (let j = 0; j < vm.attachments.length; j++) {
let atFile = vm.attachments[j];
const atFile = vm.attachments[j];
if (upFile.name == atFile.name) {
//found it
this.insertUrl(atFile.url, atFile.name);
@@ -944,7 +938,7 @@ export default {
//if an image then put it directly in viewable, if not an image then make a link and keep as an attach
} else {
//maybe an url?
let url = ev.dataTransfer.getData("text");
const url = ev.dataTransfer.getData("text");
this.insertUrl(url);
}
},
@@ -956,7 +950,7 @@ export default {
//it's an attachment url so fixup accordingly
//i paramter added by gzapi::attachmentDownloadUrl function
isImageUrl = url.includes("&i=");
let m = url.match(/attachment\/download\/(.*)\?t=/);
const m = url.match(/attachment\/download\/(.*)\?t=/);
if (m.length > 1) {
url = "[ATTACH:" + m[1] + "]";
} else {
@@ -993,12 +987,8 @@ export default {
}
}
}
//handle accordingly
}
}
//----------end methods----------
}
};
</script>

View File

@@ -351,20 +351,15 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
data() {
return {
openDialog: false,
openSelectDialog: false,
selectType: 1, //1==service / physical, 2==billing / postal
alternateAddresses: [] //{objectName:"NAME-Type",addressViz:"summary",addressFields:{address:aaa,city:aaa,region:aaa,country:ccc, code:ccc, lat:lll, long:lll}}
selectType: 1,
alternateAddresses: []
};
},
props: {
value: {
default: null,
@@ -374,7 +369,6 @@ export default {
default: null,
type: Object
},
formKey: { type: String, default: "" }, //used to grab template from store
readonly: Boolean,
disabled: Boolean
@@ -471,17 +465,17 @@ export default {
window.$gz.util.copyToClipboard(ret);
/* todo maybe down the road if asked for?
if(mAddressType==AddressTypes.Physical)
{
if(mLatitude!=0 || mLongitude!=0)
{
sb.Append(" \r\n");
sb.Append(LongitudeToString(mLongitude));
sb.Append(" ");
sb.Append(LatitudeToString(mLatitude));
sb.Append(" \r\n");
}
} */
if(mAddressType==AddressTypes.Physical)
{
if(mLatitude!=0 || mLongitude!=0)
{
sb.Append(" \r\n");
sb.Append(LongitudeToString(mLongitude));
sb.Append(" ");
sb.Append(LatitudeToString(mLatitude));
sb.Append(" \r\n");
}
} */
},
AddressCopyPostalToClipBoard() {
let ret = "";
@@ -512,14 +506,13 @@ export default {
},
async GeoCapture() {
try {
//window.$gz.form.deleteAllErrorBoxErrors(vm);
let loc = await window.$gz.util.getGeoLocation();
const loc = await window.$gz.util.getGeoLocation();
this.value.latitude = loc.latitude;
this.fieldValueChanged("latitude");
this.value.longitude = loc.longitude;
this.fieldValueChanged("longitude");
} catch (ex) {
//window.$gz.errorHandler.handleFormError(ex, vm);
//could fail on some platforms
}
}
},
@@ -547,7 +540,7 @@ async function populateAlternateAddresses(vm) {
const ispostal = vm.selectType == 2;
const wo = vm.value;
if (wo.customerId != null) {
let res = await window.$gz.api.get(`customer/address/${wo.customerId}`);
const res = await window.$gz.api.get(`customer/address/${wo.customerId}`);
if (res.data) {
//customer first
if (ispostal) {
@@ -579,13 +572,13 @@ async function populateAlternateAddresses(vm) {
//Unit addresses
//Units only have physical addresses
if (!ispostal) {
let unitIdList = [];
const unitIdList = [];
vm.value.items.forEach(i => {
i.units.forEach(async u => {
if (u.unitId != null && !unitIdList.includes(u.unitId)) {
unitIdList.push(u.unitId);
//get address
let res = await window.$gz.api.get(`unit/address/${u.unitId}`);
const res = await window.$gz.api.get(`unit/address/${u.unitId}`);
if (res.data) {
vm.alternateAddresses.push({
name: res.data.unit.name,
@@ -605,7 +598,7 @@ async function populateAlternateAddresses(vm) {
//
function formatAddress(o) {
//Format address(es) as compact as possible
let ret = { physical: "", postal: "" };
const ret = { physical: "", postal: "" };
//Physical
if (!window.$gz.util.stringIsNullOrEmpty(o.address)) {

View File

@@ -447,9 +447,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzWoState from "./work-order-state.vue";
import GzWoAddress from "./work-order-address.vue";
import GzWoSignature from "./work-order-signature.vue";
@@ -477,14 +474,12 @@ export default {
type: Object
}
},
methods: {
form() {
return window.$gz.form;
},
async fieldValueChanged(ref) {
if (!this.formState.loading && !this.formState.readonly) {
//flag this record dirty so it gets picked up by save
this.value.isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
}

View File

@@ -437,10 +437,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -506,7 +502,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].expenses.length;
const newIndex = this.value.items[this.activeWoItemIndex].expenses.length;
//#################################### IMPORTANT ##################################################
//NOTE: default values are critical and must match server validation ExpenseValidateAsync for restricted users
@@ -586,11 +582,6 @@ export default {
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
// //set viz if applicable
// if(ref==""){
// let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
// }
}
},
itemRowClasses: function(item) {
@@ -633,11 +624,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemExpenseName")) {
headers.push({

View File

@@ -439,10 +439,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -526,7 +522,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].labors.length;
const newIndex = this.value.items[this.activeWoItemIndex].labors.length;
this.value.items[this.activeWoItemIndex].labors.push({
id: 0,
@@ -723,11 +719,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemLaborServiceStartDate")) {
headers.push({

View File

@@ -413,10 +413,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -488,7 +484,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].loans.length;
const newIndex = this.value.items[this.activeWoItemIndex].loans.length;
this.value.items[this.activeWoItemIndex].loans.push({
id: 0,
@@ -610,11 +606,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemLoanUnit")) {
headers.push({

View File

@@ -591,10 +591,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -669,7 +665,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].outsideServices
const newIndex = this.value.items[this.activeWoItemIndex].outsideServices
.length;
this.value.items[this.activeWoItemIndex].outsideServices.push({
@@ -801,11 +797,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemOutsideServiceUnit")) {
headers.push({

View File

@@ -89,10 +89,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -190,15 +186,6 @@ export default {
form() {
return window.$gz.form;
},
// fieldValueChanged(ref) {
// if (!this.formState.loading && !this.formState.readonly) {
// //flag this record dirty so it gets picked up by save
// this.value.items[this.activeWoItemIndex].partRequests[
// this.activeItemIndex
// ].isDirty = true;
// window.$gz.form.fieldValueChanged(this.pvm, ref);
// }
// },
itemRowClasses: function(item) {
let ret = "";
const isDeleted =
@@ -241,11 +228,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemPartRequestPartID")) {
headers.push({

View File

@@ -465,10 +465,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -561,7 +557,7 @@ export default {
if (!partId || partId == 0) {
return;
}
let res = await window.$gz.api.get(`part/serials/${partId}`);
const res = await window.$gz.api.get(`part/serials/${partId}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
@@ -598,7 +594,7 @@ export default {
this.$emit("change");
},
async addPartAssembly() {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`part-assembly/${this.selectedPartAssembly}`
);
if (res.data && res.data.items) {
@@ -696,7 +692,6 @@ export default {
].quantity`);
}
},
warehouseChange(newName) {
this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
@@ -713,8 +708,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].parts.length;
const newIndex = this.value.items[this.activeWoItemIndex].parts.length;
this.value.items[this.activeWoItemIndex].parts.push({
id: 0,
concurrency: 0,
@@ -861,11 +855,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemPartPartID")) {
headers.push({

View File

@@ -303,10 +303,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -407,7 +403,7 @@ export default {
].serviceRateViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
const newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
.length;
this.value.items[this.activeWoItemIndex].scheduledUsers.push({
@@ -600,11 +596,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemScheduledUserStartDate")) {
headers.push({

View File

@@ -311,10 +311,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -371,7 +367,7 @@ export default {
},
methods: {
async addTaskGroup() {
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
@@ -391,7 +387,7 @@ export default {
}
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
const incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete
).name;
res.data.items.forEach(z => {
@@ -443,7 +439,7 @@ export default {
}
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
const newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
this.value.items[this.activeWoItemIndex].tasks.push({
id: 0,
concurrency: 0,
@@ -557,11 +553,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemTaskSequence")) {
headers.push({

View File

@@ -472,10 +472,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -545,7 +541,7 @@ export default {
].taxCodeViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].travels.length;
const newIndex = this.value.items[this.activeWoItemIndex].travels.length;
this.value.items[this.activeWoItemIndex].travels.push({
id: 0,
@@ -743,11 +739,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemTravelStartDate")) {
headers.push({

View File

@@ -344,10 +344,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
this.setDefaultView();
@@ -444,7 +440,7 @@ export default {
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/work-order-info/${id}`);
const res = await window.$gz.api.get(`unit/work-order-info/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
@@ -469,7 +465,7 @@ export default {
.t("ApplyUnitContract")
.replace("{0}", res.data.name);
let dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
const dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
prompt,
"question"
);
@@ -493,27 +489,13 @@ export default {
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/service-warranty-info/${id}`);
const res = await window.$gz.api.get(`unit/service-warranty-info/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
window.$gz.errorHandler.errorToString(res, this)
);
} else {
/* {
"recentWorkOrders":[{"serial":10,"id":10,"serviceDate":"2021-01-19T22:00:00Z"},{"serial":8,"id":8,"serviceDate":"2021-04-08T22:00:00Z"},{"serial":7,"id":7,"serviceDate":"2021-04-18T20:00:00Z"}],
"purchaseDate":"2019-03-12T09:37:52.930923Z",
"purchasedFromVendor":null,
"purchaseFromVendorId":null,
"purchaseReceiptNumber":"139736",
"lifeTimeWarranty":false,
"warrantyExpiryDate":"2019-04-12T09:37:52.930923Z",
"warrantyTerms":"Shipping parts and service"}
"UnitPurchasedDate": "Purchased Date",
"UnitPurchaseFromID": "Purchased From",
"UnitReceipt": "Receipt Number",
*/
const r = res.data;
let WarrantyInfo = `${this.$ay.t("Warranty")}: `;
@@ -547,7 +529,7 @@ export default {
this.pvm.hour12
);
}
let PurchaseInfo = `${this.$ay.t(
const PurchaseInfo = `${this.$ay.t(
"UnitPurchaseFromID"
)}: ${PurchasedFrom}<br/>${this.$ay.t(
"UnitPurchasedDate"
@@ -572,11 +554,11 @@ export default {
RecentWorkOrderList = "-";
}
let RecentWorkOrderInfo = `${this.$ay.t(
const RecentWorkOrderInfo = `${this.$ay.t(
"RecentWorkOrders"
)}:${RecentWorkOrderList}`;
let d = `<div>${WarrantyInfo}<br/>${PurchaseInfo}<br/>${RecentWorkOrderInfo}</div>`;
const d = `<div>${WarrantyInfo}<br/>${PurchaseInfo}<br/>${RecentWorkOrderInfo}</div>`;
this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex
@@ -597,7 +579,7 @@ export default {
this.selectedBulkUnits.splice(0);
this.availableBulkUnits.splice(0);
let res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
const res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
tags: this.selectedBulkUnitTags,
restrictToCustomerId: this.selectedBulkUnitCustomer
});
@@ -646,21 +628,7 @@ export default {
await this.handleUnitChange();
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].units.length;
// {
// "0": {
// "id": 53,
// "concurrency": 9586762,
// "notes": "Aut modi molestias molestiae ipsa id.",
// "wiki": null,
// "customFields": null,
// "tags": [],
// "unitId": 4,
// "unitViz": "83429560",
// "workOrderItemId": 22
// }
// }
const newIndex = this.value.items[this.activeWoItemIndex].units.length;
this.value.items[this.activeWoItemIndex].units.push({
id: 0,
concurrency: 0,
@@ -735,11 +703,6 @@ export default {
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
// //set viz if applicable
// if(ref==""){
// let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
// }
}
},
itemRowClasses: function(item) {
@@ -781,11 +744,7 @@ export default {
},
headerList: function() {
/*
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemUnit")) {
headers.push({

View File

@@ -1,25 +1,6 @@
<template>
<div v-if="value != null" class="mt-8">
<!-- {{
{
isRestrictedType: value.userIsRestrictedType,
isTechRestricted: value.userIsTechRestricted,
subfull: value.userIsSubContractorFull,
subRestricted: value.userIsSubContractorRestricted,
showLabors: showLabors,
showTravels: showTravels,
showExpenses: showExpenses,
showLoans: showLoans,
showOutsideServices: showOutsideServices,
showParts: showParts,
showPartRequests: showPartRequests,
showScheduledUsers: showScheduledUsers,
showTasks: showTasks,
showUnits: showUnits
}
}} -->
<v-row>
<!-- Title and menu -->
<v-col cols="12">
<v-menu offset-y max-width="600px">
<template v-slot:activator="{ on, attrs }">
@@ -708,10 +689,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzWoItemUnits from "../components/work-order-item-units.vue";
import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-users.vue";
import GzWoItemLabors from "../components/work-order-item-labors.vue";
@@ -774,7 +751,7 @@ export default {
watch: {
goto(val, oldVal) {
if (val != oldVal) {
let navto = { woitemindex: null, childindex: null };
const navto = { woitemindex: null, childindex: null };
//find the item in question then trigger the nav
let keepgoing = true;
this.value.items.forEach((z, itemindex) => {
@@ -945,9 +922,9 @@ export default {
//Self copy to current workorder??
if (this.copyItemWoNumber == this.value.serial) {
let newIndex = this.value.items.length;
const newIndex = this.value.items.length;
let wi = JSON.parse(
const wi = JSON.parse(
JSON.stringify(this.value.items[this.activeItemIndex])
);
@@ -965,7 +942,7 @@ export default {
}
}
//get id from number then push open
let res = await window.$gz.api.get(
const res = await window.$gz.api.get(
"workorder/id-from-number/" + this.copyItemWoNumber
);
if (res.error) {
@@ -986,7 +963,7 @@ export default {
this.copyItemDialog = false;
},
newItem() {
let newIndex = this.value.items.length;
const newIndex = this.value.items.length;
this.value.items.push({
id: 0,
@@ -1027,7 +1004,7 @@ export default {
},
newSubItem(atype) {
//new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto)
let newId = -Math.abs(Date.now());
const newId = -Math.abs(Date.now());
switch (atype) {
case window.$gz.type.WorkOrderItemOutsideService:
this.gotoOutsideServiceIndex = newId;
@@ -1134,32 +1111,7 @@ export default {
return this.value.items[this.activeItemIndex].deleted === true;
},
headerList: function() {
/*
public uint Concurrency { get; set; }
public string Notes { get; set; }//Was Summary
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; } = new List<string>();
[Required]
public long WorkOrderId { get; set; }
public string TechNotes { get; set; }
public long? WorkOrderItemStatusId { get; set; }
public long? WorkOrderItemPriorityId { get; set; }
public DateTime RequestDate { get; set; }
public bool WarrantyService { get; set; } = false;
IN ORDER: notes, status, date, priority, warranty, tags
except they will not prefill at server but will be set here since the wo differs from the po in that there is no instant update with new viz fields to populate from server
and it's probably not a big list to fill anyway
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
const headers = [];
if (this.form().showMe(this, "WorkOrderItemSequence")) {
headers.push({
@@ -1229,9 +1181,6 @@ and it's probably not a big list to fill anyway
value: "tags"
});
}
// headers.push({ text: "", value: "actions" });
return headers;
},
itemList: function() {
@@ -1365,7 +1314,6 @@ and it's probably not a big list to fill anyway
!this.value.userIsSubContractorRestricted
);
},
canAddLabor: function() {
return this.form().showMe(this, "WorkOrderItemLaborList");
},

View File

@@ -109,15 +109,11 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import vueSignature from "vue-signature";
export default {
components: {
vueSignature
},
data() {
return {
selectedStatus: null,
@@ -131,7 +127,6 @@ export default {
tempName: null
};
},
props: {
value: {
default: null,
@@ -149,7 +144,6 @@ export default {
readonly: Boolean,
disabled: Boolean
},
methods: {
showSign() {
if (this.readonly) return;
@@ -164,16 +158,13 @@ export default {
save() {
let svg = this.$refs.sigCtrl.save("image/svg+xml");
if (this.$refs.sigCtrl.isEmpty()) {
//console.log("IS EMPTY");
svg = null;
}
this.setSig(svg);
this.setCaptured(window.$gz.locale.nowUTC8601String());
this.setName(this.tempName);
//console.log("SVG size IS ", svg == null ? 0 : svg.length);
this.value.isDirty = true;
this.pvm.formState.dirty = true;
this.$emit("change");
this.openDialog = false;
},

View File

@@ -3,7 +3,6 @@
<div class="mb-n2 ml-10">
<span class="text-caption">{{ $ay.t("WorkOrderStatus") }}</span>
</div>
<template>
<div class="mb-6 mb-sm-0">
<v-btn icon class="ml-n1 mr-2" @click="openDialog = true">
@@ -22,7 +21,6 @@
>
</div>
</template>
<v-row justify="center">
<v-dialog v-model="openDialog" max-width="600px">
<v-card>
@@ -68,8 +66,6 @@
</div>
</div>
</template>
<!-- append-outer-icon="$ayiPlus"
@click:append-outer="addState()" -->
<template v-if="canAdd">
<div class="mt-8">
<v-autocomplete
@@ -136,10 +132,6 @@
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
data() {
return {
@@ -177,12 +169,10 @@ export default {
this.value.states = this.value.states.filter(
z => z.concurrency != null
);
//is it a different state?
if (this.selectedStatus == this.pvm.currentState.id) {
return;
}
//push in new state
this.value.states.push({
workOrderId: this.value.id,
@@ -197,7 +187,7 @@ export default {
}
},
getStateForDisplay(state) {
let ret = {
const ret = {
id: Date.now,
name: "??",
color: "#ffffff",
@@ -259,7 +249,7 @@ export default {
return this.value.states != null && this.value.states.length > 0;
},
stateDisplayList() {
let ret = [];
const ret = [];
this.value.states.forEach(z => {
ret.push(this.getStateForDisplay(z));
});
@@ -270,28 +260,23 @@ export default {
if (!this.pvm.rights.change) {
return false;
}
//not currently locked, user has rights to do it so allow it
if (!this.value.isLockedAtServer) {
return true;
}
//locked, confirm if user can change it
//if any role then no problem
//ok, only thing left to check is if the current user can unlock this
//only thing left to check is if the current user can unlock this
//get remove roles required for current state
let cs = this.pvm.currentState;
const cs = this.pvm.currentState;
if (cs.removeRoles == null || cs.removeRoles == 0) {
//no state set yet
return true;
}
//ok, need to check the role here against current user roles to see if this is valid
//need to check the role here against current user roles to see if this is valid
if (window.$gz.role.hasRole(cs.removeRoles)) {
return true;
}
return false;
}
}

View File

@@ -127,24 +127,24 @@ Vue.config.productionTip = false;
//
// Store a copy of the fetch function
let _oldFetch = fetch;
const _oldFetch = fetch;
// Create our new version of the fetch function
window.fetch = function() {
// Create hooks
let fetchStart = new Event("fetchStart", {
const fetchStart = new Event("fetchStart", {
view: document,
bubbles: true,
cancelable: false
});
let fetchEnd = new Event("fetchEnd", {
const fetchEnd = new Event("fetchEnd", {
view: document,
bubbles: true,
cancelable: false
});
// Pass the supplied arguments to the real fetch function
let fetchCall = _oldFetch.apply(this, arguments);
const fetchCall = _oldFetch.apply(this, arguments);
// Trigger the fetchStart event
document.dispatchEvent(fetchStart);
@@ -170,21 +170,9 @@ document.addEventListener("fetchEnd", function() {
NProgress.done();
});
/////////////////////////////////////////////////////////////////
// FILTERS
//
//example filter kept for just in case
// Vue.filter("capitalize", function vueFilterCapitalize(value) {
// if (!value) return "";
// value = value.toString();
// return value.charAt(0).toUpperCase() + value.slice(1);
// });
/////////////////////////////////////////////////////////////
//GZ COMPONENTS
//
Vue.component("gz-date-time-picker", dateTimeControl);
Vue.component("gz-date-picker", dateControl);
Vue.component("gz-time-picker", timeControl);
@@ -216,7 +204,6 @@ Vue.component("gz-chart-line", chartLineControl);
Vue.component("gz-chart-pie", chartPieControl);
Vue.component("gz-chart-bar", chartBarControl);
Vue.component("gz-chart-bar-horizontal", chartBarHorizontalControl);
//3rd party components
Vue.use(VueCurrencyInput);
/////////////////////////////////////////////////////////////

View File

@@ -1,5 +1,3 @@
/* xeslint-disable */
import Vue from "vue";
import Vuetify from "vuetify/lib";
@@ -11,6 +9,7 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; //https://github.com/FortAwesome/vue-fontawesome
/*
NOTES: in case need to get fancy
https://github.com/FortAwesome/vue-fontawesome#advanced
import {
FontAwesomeIcon,
@@ -1511,20 +1510,19 @@ export default new Vuetify({
theme: {
themes: {
light: {
primary: "#00205B", //Canucks dark blue
secondary: "#00843D", //canucks green
accent: "#db7022", //lighter orangey red, more friendly looking though not as much clarity it seems
error: "#ff5252", //lighter red, have to see if it's good for all screens and sizes as it's a bit light but it stands out as an error condition better
primary: "#00205B", //dark blue
secondary: "#00843D", //green
accent: "#db7022", //lighter orangey red, more friendly looking
error: "#ff5252", //lighter red
disabled: "#c7c7c7",
readonlybanner: "#808080"
},
dark: {
//here you will define primary secondary stuff for dark theme
//color adjuster tool: https://www.hexcolortool.com/#00205c
primary: "#7F9FDA", //Canucks dark blue LIGHTENED 50%
secondary: "#006B24", //canucks green DARKENED 10%
accent: "#db7022", //lighter orangey red, more friendly looking though not as much clarity it seems
error: "#ff5252", //lighter red, have to see if it's good for all screens and sizes as it's a bit light but it stands out as an error condition better
primary: "#7F9FDA", //dark blue LIGHTENED 50%
secondary: "#006B24", //green DARKENED 10%
accent: "#db7022", //lighter orangey red, more friendly looking
error: "#ff5252", //lighter red
disabled: "#c7c7c7",
readonlybanner: "#808080"
}

View File

@@ -2,7 +2,6 @@ import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
/* Xeslint-disable */
// scrollBehavior:
// - only available in html5 history mode
@@ -154,14 +153,6 @@ export default new Router({
/* webpackChunkName: "ay-common" */ "./views/home-notifications.vue"
)
},
// {
// path: "/home-notify-direct/:userIdList?",
// name: "home-notify-direct",
// component: () =>
// import(
// /* webpackChunkName: "ay-common" */ "./views/home-notify-direct.vue"
// )
// },
{
path: "/home-notify-direct",
name: "home-notify-direct",
@@ -1065,13 +1056,13 @@ export default new Router({
path: "/viewreport",
beforeEnter: async (to, from, next) => {
//open report links have a query string /viewreport?oid=[objectid]&rid=[reportid]
let objectId = parseInt(to.query.oid);
let reportId = parseInt(to.query.rid);
const objectId = parseInt(to.query.oid);
const reportId = parseInt(to.query.rid);
let res = await window.$gz.api.renderReport(objectId, reportId, true);
const res = await window.$gz.api.renderReport(objectId, reportId, true);
if (res.error) {
//log the error and do a popup for it
let msg = `/viewReport, query ${JSON.stringify(
const msg = `/viewReport, query ${JSON.stringify(
to.query
)}, server error: ${JSON.stringify(res.error)}`;
window.$gz.eventBus.$emit("notify-error", msg);

View File

@@ -2,7 +2,6 @@ import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";
/* Xeslint-disable */
const MaxLogLength = 100;
Vue.use(Vuex);
@@ -163,7 +162,7 @@ export default new Vuex.Store({
state.globalSettings = data;
},
setEnum(state, data) {
state.enums[data.enumKey] = data.items; //{enumKey:"AuthorizationRoles",items:[{0:"no role"},{1:"Restricted role"}]}
state.enums[data.enumKey] = data.items;
},
setAPIURL(state, data) {
state.apiUrl = data;

View File

@@ -96,35 +96,25 @@
</v-overlay>
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
const FORM_KEY = "service-bank-edit";
const API_BASE_URL = "service-bank/";
const FORM_CUSTOM_TEMPLATE_KEY = "ServiceBank"; //<-- Should always be CoreBizObject AyaType name here where possible
const FORM_CUSTOM_TEMPLATE_KEY = "ServiceBank";
export default {
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(window.$gz.type.ServiceBank);
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
//NOTE: THIS FORM IS CREATE ONLY NO OPEN OLD ONES SO...
//id 0 means create or duplicate to new
if (vm.$route.params.recordid != 0) {
//Ok, we're here to *view* an existing record
//so we must fetch the deets now
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
await vm.getDataFromApi(vm.$route.params.recordid);
} else {
//New record so there has to be a object type and objectId in route
// path: "/home-service-banks/:recordid/:aType?/:objectId?",
@@ -183,29 +173,18 @@ export default {
data() {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
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, ACTIVE
//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
/*
{"data":{"id":1,"concurrency":1387706,"name":"Prepaid for $500 labor","entryDate":"2005-11-27T19:04:00Z","lastEntryDate":null,"objectId":1,"aType":8,
"sourceId":0,"sourceType":55,"incidents":0.0000,"incidentsBalance":0.0000,"lastIncidentsBalance":null,
"currency":500.0000,"currencyBalance":500.0000,"lastCurrencyBalance":null,
"hours":0.0000,"hoursBalance":0.0000,"lastHoursBalance":null}}
*/
//THIS FORM IS ONLY USED TO CREATE ENTRIES SO DEFAULTS TO THOSE REQUIREMENTS
{
id: 0,
concurrency: 0,
name: null,
objectId: null,
aType: null,
sourceId: 0, //default for manual entries
sourceType: window.$gz.type.ServiceBank,
incidents: 0,
currency: 0,
hours: 0
},
obj: {
id: 0,
concurrency: 0,
name: null,
objectId: null,
aType: null,
sourceId: 0, //default for manual entries
sourceType: window.$gz.type.ServiceBank,
incidents: 0,
currency: 0,
hours: 0
},
formState: {
ready: false,
dirty: false,
@@ -220,23 +199,19 @@ export default {
name: null
};
},
//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",
@@ -283,28 +258,23 @@ export default {
}
},
async submit() {
let vm = this;
const 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);
const res = await window.$gz.api.upsert(API_BASE_URL, vm.obj);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
JUST_SAVED = true;
//success, back to list, nothing to see here
vm.$router.go(-1);
}
} catch (ex) {
@@ -317,7 +287,7 @@ export default {
}
},
async getDataFromApi(recordId) {
let vm = this;
const vm = this;
window.$gz.form.setFormState({
vm: vm,
loading: true
@@ -325,14 +295,10 @@ export default {
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);
const res = await window.$gz.api.get(API_BASE_URL + recordId);
if (res.error) {
//Not found?
if (res.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
}
@@ -340,14 +306,12 @@ export default {
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,
readOnly: true, //service banks are always read only after they are saved
readOnly: true,
loading: false
});
}
@@ -360,8 +324,6 @@ export default {
});
}
}
//end methods
}
};
@@ -372,7 +334,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
@@ -380,7 +342,7 @@ async function clickHandler(menuItem) {
break;
case "report":
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
{
AType: window.$gz.type.ServiceBank,
selectedRowIds: [m.vm.obj.id]
@@ -407,7 +369,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: false,
readOnly: vm.formState.readOnly,
icon: "$ayiCarBattery",

View File

@@ -1,11 +1,5 @@
<template>
<div>
<!-- <div v-if="aType && objectId" class="mb-6">
<v-icon data-cy="clickThru" @click="navToTarget()" large>{{
iconForType()
}}</v-icon
><span @click="navToTarget()" class="text-h5"> {{ name }}</span>
</div> -->
<gz-report-selector ref="reportSelector"></gz-report-selector>
<gz-extensions
:aya-type="$ay.ayt().ServiceBank"
@@ -34,7 +28,7 @@
const FORM_KEY = "service-bank-list";
export default {
async created() {
let vm = this;
const vm = this;
vm.rights = window.$gz.role.getRights(window.$gz.type.ServiceBank);
window.$gz.eventBus.$on("menu-click", clickHandler);
@@ -74,18 +68,9 @@ export default {
},
methods: {
// navToTarget: function() {
// window.$gz.eventBus.$emit("openobject", {
// type: this.aType,
// id: this.objectId
// });
// },
handleSelected(selected) {
this.selectedItems = selected;
},
// iconForType() {
// return window.$gz.util.iconForType(this.aType, 10);
// },
clearPreFilter() {
this.clientCriteria = null;
this.preFilterMode = null;
@@ -101,7 +86,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "new":
@@ -116,7 +101,7 @@ async function clickHandler(menuItem) {
});
break;
case "extensions":
let res = await m.vm.$refs.extensions.open(
const res = await m.vm.$refs.extensions.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.ServiceBank
)
@@ -127,7 +112,7 @@ async function clickHandler(menuItem) {
break;
case "report":
{
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.ServiceBank
),
@@ -137,7 +122,7 @@ async function clickHandler(menuItem) {
return;
}
window.$gz.form.setLastReport(FORM_KEY, res);
generateMenu(m.vm); //refresh the menu with the new report
generateMenu(m.vm);
}
break;
default:
@@ -153,7 +138,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: true,
icon: "$ayiCarBattery",
title: "ServiceBankList",
@@ -176,8 +161,6 @@ function generateMenu(vm) {
}
}
//REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -185,8 +168,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,

View File

@@ -180,20 +180,14 @@
</v-overlay>
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
const FORM_KEY = "service-rate-edit";
const API_BASE_URL = "service-rate/";
const FORM_CUSTOM_TEMPLATE_KEY = "ServiceRate"; //<-- Should always be CoreBizObject AyaType name here where possible
const FORM_CUSTOM_TEMPLATE_KEY = "ServiceRate";
export default {
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
@@ -202,8 +196,6 @@ export default {
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
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?
@@ -211,7 +203,7 @@ export default {
//yes, no need to fetch it
this.obj = this.$route.params.obj;
} else {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
await vm.getDataFromApi(vm.$route.params.recordid);
}
} else {
//Might be a duplicate and contain another record
@@ -230,7 +222,7 @@ export default {
vm: vm,
loading: false,
dirty: setDirty,
valid: setValid
valid: true
});
generateMenu(vm);
} catch (error) {
@@ -256,25 +248,21 @@ export default {
data() {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
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, ACTIVE
//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,
active: true,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
cost: 0,
charge: 0,
unit: null,
accountNumber: null,
contractOnly: false
},
obj: {
id: 0,
concurrency: 0,
name: null,
active: true,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
cost: 0,
charge: 0,
unit: null,
accountNumber: null,
contractOnly: false
},
formState: {
ready: false,
dirty: false,
@@ -292,23 +280,19 @@ export default {
}
};
},
//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",
@@ -349,7 +333,7 @@ export default {
}
},
async getDataFromApi(recordId) {
let vm = this;
const vm = this;
window.$gz.form.setFormState({
vm: vm,
loading: true
@@ -357,14 +341,13 @@ export default {
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);
const res = await window.$gz.api.get(API_BASE_URL + recordId);
if (res.error) {
//Not found?
if (res.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
}
@@ -372,9 +355,9 @@ export default {
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,
@@ -392,7 +375,7 @@ export default {
}
},
async submit() {
let vm = this;
const vm = this;
if (vm.canSave == false) {
return;
}
@@ -402,36 +385,31 @@ export default {
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);
let res = await window.$gz.api.upsert(API_BASE_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
//POST
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: "service-rate-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
obj: res.data
}
});
} 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)
//PUT
vm.obj.concurrency = res.data.concurrency;
}
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
@@ -448,42 +426,37 @@ export default {
}
},
async remove() {
let vm = this;
const vm = this;
try {
let dialogResult = await window.$gz.dialog.confirmDelete();
const 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);
const res = await window.$gz.api.remove(
API_BASE_URL + vm.$route.params.recordid
);
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
@@ -492,7 +465,6 @@ export default {
}
},
duplicate() {
//Navigate to new record
this.$router.push({
name: "service-rate-edit",
params: {
@@ -501,8 +473,6 @@ export default {
}
});
}
//end methods
}
};
@@ -513,7 +483,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
@@ -533,7 +503,7 @@ async function clickHandler(menuItem) {
break;
case "report":
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
{
AType: window.$gz.type.ServiceRate,
selectedRowIds: [m.vm.obj.id]
@@ -560,7 +530,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: false,
readOnly: vm.formState.readOnly,
icon: "$ayiCalculator",
@@ -595,8 +565,6 @@ function generateMenu(vm) {
});
}
//REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -604,8 +572,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,
@@ -687,7 +654,7 @@ async function fetchTranslatedText(vm) {
//
//
async function populateSelectionLists(vm) {
let res = await window.$gz.api.get("service-rate/prior-unit-list");
const res = await window.$gz.api.get("service-rate/prior-unit-list");
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);

View File

@@ -19,7 +19,6 @@
</gz-data-table>
</div>
</template>
<script>
const FORM_KEY = "service-rate-list";
export default {
@@ -53,7 +52,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "new":
@@ -63,7 +62,7 @@ async function clickHandler(menuItem) {
});
break;
case "extensions":
let res = await m.vm.$refs.extensions.open(
const res = await m.vm.$refs.extensions.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.ServiceRate
)
@@ -74,7 +73,7 @@ async function clickHandler(menuItem) {
break;
case "report":
{
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.ServiceRate
),
@@ -84,7 +83,7 @@ async function clickHandler(menuItem) {
return;
}
window.$gz.form.setLastReport(FORM_KEY, res);
generateMenu(m.vm); //refresh the menu with the new report
generateMenu(m.vm);
}
break;
default:
@@ -100,7 +99,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: true,
icon: "$ayiCalculator",
title: "ServiceRateList",
@@ -121,8 +120,6 @@ function generateMenu(vm) {
});
}
//REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -130,8 +127,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,

View File

@@ -154,30 +154,20 @@
</v-overlay>
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
const FORM_KEY = "tax-code-edit";
const API_BASE_URL = "tax-code/";
const FORM_CUSTOM_TEMPLATE_KEY = "TaxCode"; //<-- Should always be CoreBizObject AyaType name here where possible
const FORM_CUSTOM_TEMPLATE_KEY = "TaxCode";
export default {
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(window.$gz.type.TaxCode);
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
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?
@@ -185,7 +175,7 @@ export default {
//yes, no need to fetch it
this.obj = this.$route.params.obj;
} else {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
await vm.getDataFromApi(vm.$route.params.recordid);
}
} else {
//Might be a duplicate and contain another record
@@ -204,7 +194,7 @@ export default {
vm: vm,
loading: false,
dirty: setDirty,
valid: setValid
valid: true
});
generateMenu(vm);
@@ -231,23 +221,19 @@ export default {
data() {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
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, ACTIVE
//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,
active: true,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
taxAPct: 0,
taxBPct: 0,
taxOnTax: false
},
obj: {
id: 0,
concurrency: 0,
name: null,
active: true,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
taxAPct: 0,
taxBPct: 0,
taxOnTax: false
},
formState: {
ready: false,
dirty: false,
@@ -262,23 +248,19 @@ export default {
ayaType: window.$gz.type.TaxCode
};
},
//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",
@@ -319,7 +301,7 @@ export default {
}
},
async getDataFromApi(recordId) {
let vm = this;
const vm = this;
window.$gz.form.setFormState({
vm: vm,
loading: true
@@ -327,14 +309,10 @@ export default {
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);
const res = await window.$gz.api.get(API_BASE_URL + recordId);
if (res.error) {
//Not found?
if (res.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
}
@@ -342,9 +320,9 @@ export default {
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,
@@ -362,46 +340,38 @@ export default {
}
},
async submit() {
let vm = this;
const 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);
const res = await window.$gz.api.upsert(API_BASE_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
//POST
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: "tax-code-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
obj: res.data
}
});
} 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)
//PUT
vm.obj.concurrency = res.data.concurrency;
}
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
@@ -418,42 +388,39 @@ export default {
}
},
async remove() {
let vm = this;
const vm = this;
try {
let dialogResult = await window.$gz.dialog.confirmDelete();
const 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;
const url = API_BASE_URL + vm.$route.params.recordid;
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.remove(url);
const 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
@@ -462,7 +429,6 @@ export default {
}
},
duplicate() {
//Navigate to new record
this.$router.push({
name: "tax-code-edit",
params: {
@@ -471,8 +437,6 @@ export default {
}
});
}
//end methods
}
};
@@ -483,7 +447,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
@@ -502,7 +466,7 @@ async function clickHandler(menuItem) {
m.vm.duplicate();
break;
case "report":
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
{
AType: window.$gz.type.TaxCode,
selectedRowIds: [m.vm.obj.id]
@@ -529,7 +493,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: false,
readOnly: vm.formState.readOnly,
icon: "$ayiPercent",
@@ -564,8 +528,6 @@ function generateMenu(vm) {
});
}
//REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -573,8 +535,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,

View File

@@ -19,7 +19,6 @@
</gz-data-table>
</div>
</template>
<script>
const FORM_KEY = "tax-code-list";
export default {
@@ -53,7 +52,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "new":
@@ -63,7 +62,7 @@ async function clickHandler(menuItem) {
});
break;
case "extensions":
let res = await m.vm.$refs.extensions.open(
const res = await m.vm.$refs.extensions.open(
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.TaxCode)
);
if (res && res.refresh == true) {
@@ -72,7 +71,7 @@ async function clickHandler(menuItem) {
break;
case "report":
{
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.TaxCode
),
@@ -82,7 +81,7 @@ async function clickHandler(menuItem) {
return;
}
window.$gz.form.setLastReport(FORM_KEY, res);
generateMenu(m.vm); //refresh the menu with the new report
generateMenu(m.vm);
}
break;
default:
@@ -98,7 +97,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: true,
icon: "$ayiPercent",
title: "TaxCodeList",
@@ -119,8 +118,6 @@ function generateMenu(vm) {
});
}
//REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -128,8 +125,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,

View File

@@ -178,30 +178,20 @@
</v-overlay>
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
const FORM_KEY = "travel-rate-edit";
const API_BASE_URL = "travel-rate/";
const FORM_CUSTOM_TEMPLATE_KEY = "TravelRate"; //<-- Should always be CoreBizObject AyaType name here where possible
const FORM_CUSTOM_TEMPLATE_KEY = "TravelRate";
export default {
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(window.$gz.type.TravelRate);
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
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?
@@ -209,7 +199,7 @@ export default {
//yes, no need to fetch it
this.obj = this.$route.params.obj;
} else {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
await vm.getDataFromApi(vm.$route.params.recordid);
}
} else {
//Might be a duplicate and contain another record
@@ -223,12 +213,11 @@ export default {
setDirty = true;
}
}
window.$gz.form.setFormState({
vm: vm,
loading: false,
dirty: setDirty,
valid: setValid
valid: true
});
generateMenu(vm);
} catch (error) {
@@ -254,25 +243,21 @@ export default {
data() {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
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, ACTIVE
//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,
active: true,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
cost: 0,
charge: 0,
unit: null,
accountNumber: null,
contractOnly: false
},
obj: {
id: 0,
concurrency: 0,
name: null,
active: true,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
cost: 0,
charge: 0,
unit: null,
accountNumber: null,
contractOnly: false
},
formState: {
ready: false,
dirty: false,
@@ -290,23 +275,17 @@ export default {
}
};
},
//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",
@@ -347,7 +326,7 @@ export default {
}
},
async getDataFromApi(recordId) {
let vm = this;
const vm = this;
window.$gz.form.setFormState({
vm: vm,
loading: true
@@ -355,14 +334,13 @@ export default {
if (!recordId) {
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
}
let url = API_BASE_URL + recordId;
const url = API_BASE_URL + recordId;
try {
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.get(url);
const res = await window.$gz.api.get(url);
if (res.error) {
//Not found?
if (res.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
}
@@ -370,9 +348,9 @@ export default {
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,
@@ -390,7 +368,7 @@ export default {
}
},
async submit() {
let vm = this;
const vm = this;
if (vm.canSave == false) {
return;
}
@@ -400,36 +378,26 @@ export default {
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);
const res = await window.$gz.api.upsert(API_BASE_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
//POST
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: "travel-rate-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
obj: res.data
}
});
} 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)
//PUT
vm.obj.concurrency = res.data.concurrency;
}
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
@@ -446,42 +414,36 @@ export default {
}
},
async remove() {
let vm = this;
const vm = this;
try {
let dialogResult = await window.$gz.dialog.confirmDelete();
const 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);
const res = await window.$gz.api.remove(
API_BASE_URL + vm.$route.params.recordid
);
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
@@ -490,7 +452,6 @@ export default {
}
},
duplicate() {
//Navigate to new record
this.$router.push({
name: "travel-rate-edit",
params: {
@@ -499,8 +460,6 @@ export default {
}
});
}
//end methods
}
};
@@ -511,7 +470,7 @@ async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
@@ -530,7 +489,7 @@ async function clickHandler(menuItem) {
m.vm.duplicate();
break;
case "report":
let res = await m.vm.$refs.reportSelector.open(
const res = await m.vm.$refs.reportSelector.open(
{
AType: window.$gz.type.TravelRate,
selectedRowIds: [m.vm.obj.id]
@@ -556,7 +515,7 @@ async function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: false,
readOnly: vm.formState.readOnly,
icon: "$ayiCalculator",
@@ -591,8 +550,6 @@ function generateMenu(vm) {
});
}
//REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -600,8 +557,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,
@@ -683,7 +639,7 @@ async function fetchTranslatedText(vm) {
//
//
async function populateSelectionLists(vm) {
let res = await window.$gz.api.get("travel-rate/prior-unit-list");
const res = await window.$gz.api.get("travel-rate/prior-unit-list");
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);

Some files were not shown because too many files have changed in this diff Show More