Initial commit.
This commit is contained in:
29
static/js/lib/business_objects/business_objects.js
Normal file
29
static/js/lib/business_objects/business_objects.js
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
import Utils from '../utils.js';
|
||||
|
||||
export default class BusinessObjects {
|
||||
static getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected = null) {
|
||||
return {
|
||||
text: objectJson[keyText],
|
||||
value: objectJson[keyValue],
|
||||
selected: (objectJson[keyValue] == valueSelected),
|
||||
};
|
||||
}
|
||||
static getOptionJsonFromObjectJson(objectJson, valueSelected = null) {
|
||||
let keyText = objectJson[flagNameAttrOptionText];
|
||||
let keyValue = objectJson[flagNameAttrOptionValue];
|
||||
Utils.consoleLogIfNotProductionEnvironment({objectJson, keyText, keyValue});
|
||||
return BusinessObjects.getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected);
|
||||
}
|
||||
static getObjectText(objectJson) {
|
||||
return objectJson == null ? '' : objectJson[objectJson[flagNameAttrOptionText]];
|
||||
}
|
||||
static getListObjectsFromIdDictAndCsv(idDict, idCsv) {
|
||||
let listObjects = [];
|
||||
let ids = idCsv.split(',');
|
||||
for (let id of ids) {
|
||||
listObjects.push(idDict[id]);
|
||||
}
|
||||
return listObjects;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user