`;
htmlres += UIBalance_WrapperfromArray(statsarray);
htmlres += UIBalance_Wrapper_WalletFooter_ARRAY(balancewrapper_item_array);
return htmlres;
}
function UIServices_Button(imgiconsrc, title = '', onclick = '', href = '', bgcolor8 = false) {
if (!bgcolor8) { bgcolor8 = '' } else { bgcolor8 = 'bg_color_8'; }
return `
${title} `;
}
function UIServices_Button_GOTOPAGE(imgiconsrc, title, pagename, pagedatastring = '') {
return UIServices_Button(imgiconsrc, title, `ButtonGo('${pagename}','${pagedatastring}');return false;`, '');
}
function UIServices_FullDIV_GOTOPAGE_Array(title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) {
return generateHTMLfromarray(`
', services_button_array, UIServices_Button_GOTOPAGE);
}
function UIServices_FullDIV_ONCLICK_Array(title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) {
return generateHTMLfromarray(`
', services_button_array, UIServices_Button);
}
function UISideText_DualColumnButton(text, pagename, pagedatastring = '', imgsrc = '', imgwidth = '', imgheight = '') {
if (!pagename || !text) { return false; }
if (!imgwidth) { imgwidth = 30; } if (!imgheight) { imgheight = 30; }
return `
${imgiconuserdefault(imgsrc, imgwidth, imgheight)}
${text}
`;
}
function UISideText_DualColumnButton_Array(sidetext_button_dualcolumn_array) {
return generateHTMLfromarray('
', sidetext_button_dualcolumn_array, UISideText_DualColumnButton);
}
function UICardSimple(title, text = '', id = '') {
return CreateCardSimple(title, text, id);
}
function UIRecentSearchBar(searchplaceholdertext, classtosearch, id, imgsrclefticon = '', imgsrcrighticon = '', imgwidth = '', imgheight = '') {
if (!imgwidth) { imgwidth = 30; }
if (!imgheight) { imgheight = 30; }
if (!classtosearch) { classtosearch = ''; }
if (!imgsrclefticon) { imgsrclefticon = '
'; } else {
imgsrclefticon = imgiconuserdefault(imgsrclefticon, imgwidth, imgheight);
}
if (!searchplaceholdertext) { searchplaceholdertext = 'Search'; }
let righticonhtml = '';
if (imgsrcrighticon) {
righticonhtml = imgiconuserdefault(imgsrcrighticon, imgwidth, imgheight, id + '-leftsearchicon');
} else {
righticonhtml = '';
}
return `
`;
}
function UIRecentSearchable_Button_GO(title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') {
if (!pagename) { return false; }
if (!imgwidth) { imgwidth = 30; }
if (!imgheight) { imgheight = 30; }
if (!classforsearch) { classforsearch = ''; }
return `
`;
}
function UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata = '', viewalltext = '') {
return generateHTMLfromarray(`
', recentssearchablebuttonarray, UIRecentSearchable_Button_GO);
}
function UIListArrowButton_GO(title, subtitle, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') {
if (!pagename) { return false; }
if (!imgwidth) { imgwidth = 30; }
if (!imgheight) { imgheight = 30; }
return `
${imgiconuserdefault(imgsrc, imgwidth, imgheight)}
`;
}
function UIListArrowButton_GO_ARRAY(UIListArrowButtonGOARRAY) {
return generateHTMLfromarray('', '', UIListArrowButtonGOARRAY, UIListArrowButton_GO);
}
function UISearchBox_with_BUTTONS_FULL(title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY = '', viewallpagetarget, viewallpagedata = '', viewalltext = '', classtosearch = '', searchid = '', searchplaceholdertext = '', searchlefticon = '', searchrighticon = '', imgwidth = '', imgheight = '') {
let htmlres = '';
if (classtosearch && searchid) {
htmlres += UIRecentSearchBar(searchplaceholdertext, classtosearch, searchid, searchlefticon, searchrighticon, imgwidth, imgheight);
}
htmlres += UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata, viewalltext);
if (UIListArrowButtonGOARRAY) {
htmlres += UIListArrowButton_GO_ARRAY(UIListArrowButtonGOARRAY);
}
return htmlres;
}
function UIinputgroupcore(innerhtml = '', label = '', inputgroupid = '') {
let htmllabel;
if (!label && !inputgroupid) { htmllabel = ''; }
else { htmllabel = `
${label} `; }
return `${htmllabel}
${innerhtml}
`;
}
//Input group
function UIInputGroup(placeholder, type, id, label = '', classinput = '', spanclass = '', imginsteadofspan = '', required = false, textvalue = '', datalist = '', imgwidth = '', imgheight = '', disabled = false) {
if (!required) { required = ''; } else { required = 'required'; }
if (!type) { return false; }
let span; let html; let inner; let labelid;
if (!type) { type = 'text'; }
if (!classinput) { classinput = 'form-control'; }
if (datalist) { datalist = ' list="' + datalist + '" '; } else { datalist = ''; }
span = `
`;
if (!imgwidth) { imgwidth = '40px'; } if (!imgheight) { imgheight = '40px'; }
if (imginsteadofspan) { span = imgiconuserdefault(imginsteadofspan, imgwidth, imgheight, 'imgspan' + id); }
if (!imginsteadofspan && !spanclass) { span = ''; } else {
/*
span =`
`;
*/
}
if (disabled) {
disabled = ' disabled ';
}
if (label) { }
inner = `
${span}`;
labelid = id + '-div-mb3';
html = UIinputgroupcore(inner, label, labelid);
return html;
}
function UIInputGroupFileUploadDropzone(id, label = '', url = '', inputgroupid = '', width = '100%', disabled = '') {
if (!url) { url = '/File/Upload/Unknown'; }
clearbuttonid = 'ClearUploadButton-' + id;
if (width) {
width = ' style="width: ' + width + ';" ';
} else {
width = '';
}
if (disabled) {
disabled = 'style=" pointer-events: none;"';
}
const clearuploadsbutton = ' ' + imgiconuserdefault('https://cdn.jsdelivr.net/gh/telemagnadon/obj-vault-3a@v2026.05.14-vendor-2/a/b6dc254166b4.bin', '', '', clearbuttonid, `LoadDataPageFunc.ClearUpload['${id}']();`);
return UIinputgroupcore('
', label + clearuploadsbutton, inputgroupid);
}
function DropZoneLOADDATAPAGEFUNC(url, dropzoneid, acceptedfiles = '', maxsizeMB = 100) {
if (!url) { url = '/File/Upload/Unknown'; }
const clearbuttonid = 'ClearUploadButton-' + dropzoneid;
$('#' + clearbuttonid).hide();
window.Target_Uploaded_Files = [];
if (!acceptedfiles) { acceptedfiles = DropZoneFunc.AcceptedFilesString.images; }
if (typeof window.currentDropzone === 'undefined') { window.currentDropzone = {}; }
// Initialize Dropzone
const dzInstance = DropZoneFunc.InitializeDropZone(
url,
(response) => {
if (response.success && response.hashkey) {
if (!Target_Uploaded_Files.includes(response.hashkey)) {
Target_Uploaded_Files.push(response.hashkey);
}
} else {
dzInstance.removeFile(dzInstance.files[dzInstance.files.length - 1]);
}
if (Target_Uploaded_Files.length > 0) {
$('#' + clearbuttonid).show();
} else {
$('#' + clearbuttonid).hide();
}
},
dropzoneid,
acceptedfiles,
'file',
maxsizeMB,
false,
(errorresponse) => {
// handle error if needed
}
);
// Store globally
window.currentDropzone[dropzoneid] = dzInstance;
//dzInstance.dropzoneobject = dzInstance;
dzInstance.functions = {};
dzInstance.functions.AddPreviouslyUploadedFiles = function (filesarray) {
return DropZoneFunc.AddPreviouslyUploadedFiles(dzInstance, filesarray);
};
dzInstance.functions.ReplaceDropzoneFiles = function (newFilesArray) {
return DropZoneFunc.ReplaceDropzoneFiles(dropzoneid, newFilesArray);
};
dzInstance.functions.ResetDropzoneUpload = function (url, obj = null, reqtype = 'POST', successfunc = false) {
return DropZoneFunc.ResetDropzoneUpload(url, obj, reqtype, successfunc);
};
dzInstance.functions.ClearDropzoneUpload = function () {
return DropZoneFunc.ClearDropzoneUpload(dropzoneid, dzInstance);
};
dzInstance.functions.hasOngoingUploads = function () {
return DropZoneFunc.hasOngoingUploads(dzInstance);
};
dzInstance.functions.RemoveLastUploadedDropzone = function () {
return DropZoneFunc.RemoveLastUploadedDropzone(dzInstance);
};
dzInstance.functions.AddFiles = function (dropzonemodal = 'Dropzone-Modal', errorcallback) {
return DropZoneFunc.AddFiles(url = '/File/Upload', errorcallback, filename = 'file', maxfilesize = 100, acceptedFiles, dropzoneid, dropzonemodal);
};
if (typeof LoadDataPageFunc.ClearUpload === 'undefined') {
LoadDataPageFunc.ClearUpload = {};
}
LoadDataPageFunc.ClearUpload[dropzoneid] = function () {
$('#' + clearbuttonid).hide();
DropZoneFunc.ClearDropzoneUpload(dropzoneid, dzInstance);
};
}
function InitializeLoadDataPageFuncDropZonePhotoUpload(url, dropzoneid, acceptedfiles = '', maxsizeMB = 100) {
if (typeof LoadDataPageFunc === 'undefined') { return false; }
// console.log('initializing photodropzone');
LoadDataPageFunc.InitializePhotoDropZone = function () { return DropZoneLOADDATAPAGEFUNC(url, dropzoneid, acceptedfiles, maxsizeMB); };
}
function SendPostDataURLData(url, data, sucessfunc, errorfunc = false, fromvarcache = false) {
if (!url || !data) { return false; }
let SendPostDataReqq = new RequestData(false);
SendPostDataReqq.url(url).type('POST').data(data)
.fromVarCache(fromvarcache)
.success((response) => {
if (typeof sucessfunc === 'function') { sucessfunc(response); }
}).error((response) => {
if (typeof errorfunc === 'function') { errorfunc(response); }
}).go();
}
function getInputAndTextareaValuesbyCSSClassName(className) {
const elements = document.getElementsByClassName(className);
const results = [];
elements.forEach(element => {
const id = element.id;
const value = element.value;
results.push({ id, value });
});
return results;
}
function getInputElementsValuesObjectbyCSSClassname(classname) {
const elements = document.getElementsByClassName(classname);
const results = {};
elements.forEach(element => {
const id = element.id;
const value = element.value;
results[id] = value;
});
return results;
}
// Helper function to extract hashkey from response (handles both string and JSON object responses)
function getHashkeyFromResponse(response) {
if (!response) return null;
// If response is already a string/hash key
if (typeof response === 'string') {
return response;
}
// If response is an object with hashkey property (JSON response from backend)
if (response && typeof response.hashkey === 'string') {
return response.hashkey;
}
return null;
}
// Helper function to extract hashkey and call callback with it
function getResponseHashkeyOrErrorMessage(response, successCallback, errorCallback) {
const hashkey = getHashkeyFromResponse(response);
if (hashkey) {
successCallback(hashkey);
} else {
// Check if response is an error object
if (response && typeof response === 'object' && !Array.isArray(response)) {
const errorMessage = response.message || response.error || 'Unknown error';
errorCallback(errorMessage);
} else {
errorCallback('Invalid response format');
}
}
}
function SendPostDataFormwithTARGETUPLOADEDFILES(url, forminputclass, successfunc, WithTarget_Uploaded_Files = true, errorfunc = false) {
if (!url || !forminputclass || !successfunc) { return false; }
let datatosend = getInputElementsValuesObjectbyCSSClassname(forminputclass);
if (isObjectEmpty(datatosend)) { return false; }
if (WithTarget_Uploaded_Files && typeof window.Target_Uploaded_Files !== 'undefined' && window.Target_Uploaded_Files.length > 0) {
datatosend['files'] = Target_Uploaded_Files;
}
let target;
let data = null;
if (typeof currenttarget === 'object') {
try {
target = currenttarget['target'];
} catch (error) {
target = currenttarget;
}
try {
data = currenttarget['data'];
} catch (error) {
data = null;
}
} else {
target = currenttarget;
data = null;
}
if (typeof datatosend.target === 'undefined') {
datatosend['target'] = target;
datatosend['data'] = data;
}
// Wrap successfunc to extract hashkey from JSON responses
const wrappedSuccessFunc = function(response) {
const hashkey = getHashkeyFromResponse(response);
if (hashkey) {
successfunc(hashkey);
} else {
// Pass original response for error handling
successfunc(response);
}
};
SendPostDataURLData(url, datatosend, wrappedSuccessFunc, errorfunc, fromvarcache = false);
}
function UIInputGroupTEXTAREA(label = '', textareaID = '', required = false, textareaCONTENT = '', textareaCLASS = '', inputgroupid = '', disabled = '') {
if (required) { required = ' required '; } else { required = ''; }
if (disabled) {
disabled = 'disabled'
}
const innerhtml = `
`;
return UIinputgroupcore(innerhtml, label, inputgroupid);
}
function UIInputGroupSelect(id = '', label = '', optionsarray = '', spanclass = '', imginsteadofspan = '', selectedvalue = '', imgwidth = '', imgheight = '', select_class = '', disabled = '') {
//optionsarray =[['value1','text1'],['value2','text2',selectedtrue] ]
let inner; let labelid; let htmlspan; let optionshtml = '';
if (!spanclass && !imginsteadofspan) { htmlspan = ''; }
if (!imgwidth) { imgwidth = '40px'; } if (!imgheight) { imgheight = '40px'; }
optionshtml = UIArraytoOptionforSelect(optionsarray, selectedvalue);
if (spanclass) {
htmlspan = `
`;
}
if (imginsteadofspan) {
htmlspan = imgiconuserdefault(imginsteadofspan, '10px', '10px');
}
if (!spanclass && !imginsteadofspan) {
htmlspan = '';
} else {
htmlspan = `
`;
}
if (disabled) {
disabled = 'disabled';
} else {
disabled = '';
}
inner = `
${optionshtml}
${htmlspan}`;
labelid = id + '-select-div-mb3';
html = UIinputgroupcore(inner, label, labelid);
return html;
}
function UIInputGroupDatePicker() {
}
function UIArraytoOptionforSelect(array, selectedvalue = '') {
if (!array) { return ''; } let optionshtml = '';
let val; let selected;
for (let i = 0; i < array.length; i++) {
val = array[i];
// selected = (val[2] !== undefined) ? val[2] : '';
selected = '';
if (selectedvalue !== '' && selectedvalue == val[0]) { selected = 'selected'; }
optionshtml += `
${val[1]} `;
}
return optionshtml;
}
function UIReplaceCurrentOptionsSelect(selectid, optionsarray, selectedvalue = '') {
if (!selectid || !optionsarray) { return false; }
let optionshtml = UIArraytoOptionforSelect(optionsarray, selectedvalue);
$('#' + selectid).html(optionshtml);
}
function UIInputGroupNumber(placeholder, id, label = '', classinput = '', min = '', max = '', spanclass = '', imginsteadofspan = '', required = false, val = 0, datalist = '', imgwidth = '', imgheight = '', disabled = false) {
let UI = UIInputGroup(placeholder, 'number', id, label, classinput, spanclass, imginsteadofspan, required, val, datalist, imgwidth, imgheight, disabled);
// console.log('placeholder ',placeholder,' label ', label);
UI = '
' + UI + '
';
UI = $(UI);
let input = UI.find('input');
input.attr('min', min);
input.attr('max', max);
input.val(val);
return UI.html();
}
function UIInputGroupButton(buttontext, buttonclass = '', buttonid = '', onclick = '', buttonstyle = '') {
if (!buttontext) { return false; }
if (!buttonclass) { buttonclass = 'btn-primary'; }
return `
${buttontext}
`;
}
function UIInputGroupCheckBox(input_id, label, checked = false, additional_input_class = '', additional_label_class = '') {
if (checked === true) { checked = 'checked'; } else {
checked = '';
}
return `
${label}
`
}
function UISetDarkMode() {
$('body').addClass('dark-mode'); $('.tf-balance-box').removeAttr('style');
$('.card').addClass('dark-mode');
$('.card-header').addClass('dark-mode');
$('.card-body').addClass('dark-mode');
$('.modal-content').addClass('dark-mode');
$('.btn').addClass('dark-mode');
$('input').addClass('dark-mode');
$('textarea').addClass('dark-mode');
$('select').addClass('dark-mode');
$('form').addClass('dark-mode');
}
function UIUpdateBodyHTML(html = '') {
$('#main-body').html(html);
}
function changeTopbarTitle(title) {
$('#topbar-title').html(title);
}
function setDefaultBackOnclickifNoHistory(functtoCall) {
if (!functtoCall) {
defaultBackOnclick = null;
}
if (historylist.length < 2) {
if (typeof functtoCall === 'function') {
defaultBackOnclick = functtoCall;
}
}
}
function setDefaultbackGotoPageifNoHistory(pageName, targetdata) {
const functiongoto = function () {
gotoPage(pageName, targetdata);
};
setDefaultBackOnclickifNoHistory(functiongoto);
}
function getcurrenttargetHash() {
const url = new URL(window.location.href);
const parts = url.pathname.split('/').filter(Boolean);
return parts.at(-1) || null;
}
function requestGetData(targetURL, functionsuccess, cachefirst = false) {
request.url(targetURL)
.success((response) => {
if (typeof functionsuccess === 'function') {
functionsuccess(response);
}
})
.data()
.fromVarCache(cachefirst)
.type("GET")
.go();
}
let ElementDOM = {};
function getUIElementsAndAttributes() {
const uiElements = document.querySelectorAll('UI');
const uiData = {};
uiElements.forEach(uiElement => {
const attributes = {};
attributes.innerHTML = uiElement.innerHTML;
let Elementname = uiElement.id;
if (!Elementname) {
Elementname = uiElement.attributes.name.value;
}
console.log(Elementname);
Array.from(uiElement.attributes).forEach(attr => {
attributes[attr.name] = attr.value;
});
uiData[Elementname] = attributes;
uiData[Elementname].id = uiElement.id;
uiData[Elementname].name = uiElement.attributes.name.value;
});
return uiData;
}
function CheckChangesVariableVSDOM(domID) {
if (!domID) { return null; }
const DOMElementData = getUIElementsAndAttributes()[domID] || false;
if (!DOMElementData) { return null; }
const VarElementData = ElementDOM[domID] || false;
}
function UIElementsUpdateCard(elementData) {
if (!elementData) { return false; }
}
const ReplaceMainViewORTargetDiv = function (html, targetDiv, append = '', removeDivID = '') {
if (!targetDiv) {
targetDiv = 'main-body';
}
if (typeof append === 'undefined' || !append) {
append = '';
}
let elem = document.getElementById(targetDiv);
if (targetDiv === 'main-body') {
const mainview = document.getElementById('MainView');
if (mainview) {
elem = mainview;
} else {
elem.innerHTML = '
' + elem.innerHTML;
}
}
if (removeDivID) {
let removeElem = document.getElementById(removeDivID);
if (removeElem) {
removeElem.remove();
logDev('Removed element with ID: ' + removeDivID);
} else {
logDev(`Element with ID: ${removeDivID} not found.`);
}
}
html += '
';
html += append || '';
document.getElementById(targetDiv).innerHTML = html;
// logDev(`Element with ID: ${targetDiv} replaced html with. ${html}`);
}
const processTopBarTitleAndDefaultBack = function (topbartitle, defaultback) {
if (typeof topbartitle !== 'undefined') {
changeTopbarTitle(topbartitle);
}
if (typeof defaultback !== 'undefined' && typeof defaultback.page !== 'undefined' && typeof defaultback.data !== 'undefined') {
setDefaultbackGotoPageifNoHistory(defaultback.page, defaultback.data || 0);
}
}
function setDynamicCSS(cssText) {
let styleTag = document.getElementById("dynamic-css");
if (!styleTag) {
styleTag = document.createElement("style");
styleTag.id = "dynamic-css";
document.head.appendChild(styleTag);
}
styleTag.innerHTML = cssText;
}
function resetDynamicCSS() {
setDynamicCSS('');
}
const FormBuilder = {
config: {},
dropzones: {},
build: function (options) {
this.config = options;
const { targetDiv, fields, formClass, append, topbartitle, defaultback, onFormGenerated } = options;
processTopBarTitleAndDefaultBack(topbartitle, defaultback);
// document.getElementById(targetDiv).innerHTML = '