This commit is contained in:
2020-12-24 19:09:32 +00:00
parent 081d21ff98
commit 74b97a3ed0
3 changed files with 43 additions and 53 deletions

View File

@@ -13,7 +13,6 @@ todo: NEXT DEPLOY TO DEVOPS attach a photo from phone, no error just does nothin
todo: v8 MIGRATE do not export empty strings, do null instead
confirm whatever method I use works for certain
todo: if the Name field could be in the page title then bookmarking a customer for example would show the customer name in the bookmark
todo: dumb idea: have all date fields in grid display a color based on their relative age
unless already a color column
@@ -21,6 +20,7 @@ todo: dumb idea: have all date fields in grid display a color based on their rel
future = shades of blue or something to a max value beyond a year are all violet or something, under a year future are shades of blue?
Or even just past dates one color future dates another color
or within a month one shade and mooe than a month another shade?
Negative numbers red?
just a subtle visual cue
todo: investigate if a picklist control can implement a feature to select *all* items it returns

View File

@@ -306,6 +306,17 @@ export default {
return ret;
},
///////////////////////////////
// Is negative number
//
//
isNegative: function(v) {
//null or empty then zero
if (!v || v == 0 || v == NaN) {
return false;
}
return parseFloat(v) < 0;
},
///////////////////////////////
// Splice a string
//changes the content of a string by removing a range of
// characters and/or adding new characters.

View File

@@ -580,17 +580,21 @@ export default {
window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i });
},
cellStyle(c) {
// :style="'style=background-color:#FFFFE0;color:black;border:1px solid #BDB76B;' + c.clr + ';'"
if (c.clr && c.clr.length > 3) {
if (c.clr[0] != "#") {
c.clr = "#" + c.clr;
//does it have additional styling?
//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 = {};
if (c.clr) {
if (c.clr[0] != "#") {
c.clr = "#" + c.clr;
}
clrBit["border-left"] = `5px solid ${c.clr}`; //warning: don't put a semicolon after any of these styles, it will then ignore the whole bit
}
return {
"border-left": `5px solid ${c.clr}`
// , "border-top": `4px solid ${c.clr}`
};
return { ...c.cst, ...clrBit };
} else {
return null;
}
return null;
},
async getDataFromApi(deSelectAll) {
let vm = this;
@@ -733,7 +737,7 @@ function buildRecords(listData, columndefinitions) {
let dataType = columndefinitions[iColumn].dt;
let display = column.v;
//let openableAyaType = null;
let cstStyle = null; //custom additional styling here in grid e.g. negative numbers etc
/*
public enum UiFieldDataType : int
@@ -789,8 +793,17 @@ function buildRecords(listData, columndefinitions) {
display = display.substring(0, MAX_TEXT_COLUMN_LENGTH) + "...";
}
break;
case 5: //Integer
//display is already set, just some styling to do
if (window.$gz.util.isNegative(column.v)) {
cstStyle = { color: "#FF0000" }; //warning, don't put a semicolon after the style or it will not work
}
break;
case 7: //decimal
display = window.$gz.locale.decimalLocalized(display, languageName);
if (window.$gz.util.isNegative(column.v)) {
cstStyle = { color: "#FF0000" }; //warning, don't put a semicolon after the style or it will not work
}
break;
case 8: //currency
display = window.$gz.locale.currencyLocalized(
@@ -798,6 +811,9 @@ function buildRecords(listData, columndefinitions) {
languageName,
currencyName
);
if (window.$gz.util.isNegative(column.v)) {
cstStyle = { color: "#FF0000" }; //warning, don't put a semicolon after the style or it will not work
}
break;
case 9: //tags
if (display && display.length > 0) {
@@ -812,34 +828,6 @@ function buildRecords(listData, columndefinitions) {
columndefinitions[iColumn].et,
display
);
//DEPRECATED WITH ot column value from server see below
// //is it an AyaType openable type column like in the EventDataList AyaType column?
// if (
// columndefinitions[iColumn].et == "AyaType" &&
// column.i != null &&
// column.i != 0 &&
// column.ot == undefined
// ) {
// //yes so provide the ot (openable type) info needed for the grid to make this openable
// // console.log("Openable type:", column);
// switch (column.v) {
// //Not openable types
// case 18: //DataListView
// break;
// default:
// openableAyaType = column.v;
// break;
// }
// }
//---------
// console.log("gz-data-table:buildRecords:enumtype column is ", column);
// //v contains the type number and i contains the id of the record if it's an aytype enum openable
// console.log(
// "gz-data-table:buildRecords:enumtype column devfinition is ",
// columndefinitions[iColumn]
// );
break;
case 14: //MemorySize (file size)
display = window.$gz.locale.humanFileSize(
@@ -886,13 +874,6 @@ function buildRecords(listData, columndefinitions) {
columnObject["i"] = column.i;
}
//DEPRECATED in favor of ot system below
// //is the source column a special AyaType enum with an id signifying to be openable directly?
// if (openableAyaType) {
// //signal to grid to make it an openable link
// columnObject["ot"] = openableAyaType;
// }
//Is there an overriding openable type already defined?
//(this is used by dynamic columns with different object type and id's that are openable like attachments and event logs and Review list etc)
if (column.ot) {
@@ -904,14 +885,12 @@ function buildRecords(listData, columndefinitions) {
columnObject["clr"] = column.clr;
}
//additional styling
if (cstStyle) {
columnObject["cst"] = cstStyle;
}
o.columns["c" + iColumn.toString()] = columnObject;
//Is:
//Headers: [ { "text": "Name", "value": "c1" }, { "text": "Serial #", "value": "c2" },
//Records: [ { "id": 1, "c1": "Incredible Metal Fish 76", "c2": 1, "c3": "$877.8", "c4": "AuthorizationRoles.65536", "c5": "2020-01-30 01:53:57 AM", "c6": "Yup", "c7": "Virgil Strosin 74" }, { "id": 2, "c1": "Practical Plastic Bike 77", "c2": 2, "
//CHANGE TO:
//Headers: [ { "text": "Name", "value": "c1.v" }, { "text": "Serial #", "value": "c2" },
//Records: [ { "id": 1,columns: {"c1": {v:"Incredible Metal Fish 76",t:THETYPE,key:ROWID-COLUMNID e.g. 1-1,1-2,2-1 etc}, "c2": 1, "c3": "$877.8", "c4": "AuthorizationRoles.65536", "c5": "2020-01-30 01:53:57 AM", "c6": "Yup", "c7": "Virgil Strosin 74" }, { "id": 2, "c1": "Practical Plastic Bike 77", "c2": 2, "
//THis way can have v-if for each column vm changes based on type and then has it's shit figured out
}
ret.push(o);
}