// Copyright (C) 2024 Robert J.A. Wagner; Am Kiefernwald 49b; D-64297 Darmstadt - All Rights Reserved export default class toApp { async Start() { if (false) { Object.assign(XRW, XRW.key.url2json("?OU_Name=EGOVC&LOG_Role=ADMIN&USR_EMail=robert.wagner@egovc.de&USR_Pass=Welcome1")); let res = await XRW.api.login(); if (!res) return XRW.panic(`User-Admin: login failed`); console.log(XRW.SID); } let formFrame = XRW.mkForm({ FID: 'formFrame', ynCreateFolder: 'Y', ynCreateRender: 'Y', renderType: 'Form', pageX: 1630, pageY: 1010, anchor: 'grForm' }); formFrame.setFEG("Frame", { FE_Prefix: 'Render', FGM_Format: "dY10,dX10,O?x=auto&y=auto,W800,H1000,Vitem", class: "w3-card-4", id: "grLeft" }, { FE_Prefix: 'Render', FGM_Format: "dX10,O?x=auto&y=auto,W800,H1000,Vitem,N", class: "w3-card-4", id: "grRight" }, ); formFrame.setSection("S1", { FEG_Prefix: "Frame", FEG_Title: "Anzeigen", ynVolatile: 'Y' }, ); let formMenu = XRW.mkForm({ FID: 'formMenu', ynCreateFolder: 'Y', ynCreateRender: 'Y', renderType: 'Form', pageX: 360, pageY: 1000, minPixelPerPoint: 2, anchor: 'grLeft' }); formMenu.setFEG("Menu", { FE_Prefix: 'Icon', FGM_Format: "f20,Acenter,cFill?hex=#288829,cText?hex=#eeeeee,W20,Vitem", icon: 'user', SEonClick: `XRW.message("Icon");` }, { FE_Prefix: 'Render', FGM_Format: "cFill?hex=#06AC74,cText?color=white,W340,f20,p?L=5,Vitem?uri=Userlist,N" }, { FE_Prefix: 'GenericButton', FGM_Format: "f12,W40,Vitem", FE_Title: 'Gerät hinzufügen', caption: "Test", ynClearCaption: 'N', icon: 'add', iconColor: 'blue', iconSize_px: 16, SEonClick: `$newForm("phone_numbers", "formGroup");XRW.message("Form created");` }, { FE_Prefix: 'GenericButton', FGM_Format: "f12,W40,Vitem", FE_Title: 'Gerät hinzufügen', caption: "Test", ynClearCaption: 'N', icon: 'add', iconColor: 'blue', iconSize_px: 16, SEonClick: `XRW.message("Hallo")` }, { FE_Prefix: 'GenericButton', FGM_Format: "f12,W40,Vitem,N", FE_Title: 'Gerät hinzufügen', caption: "Test", ynClearCaption: 'N', icon: 'add', iconColor: 'blue', iconSize_px: 16, SEonClick: `XRW.message("Hallo")` }, // { FE_Prefix: 'Render', FGM_Format: "W90,B2,Vitem,N" }, { FE_Prefix: 'Render', FGM_Format: "dY10,f12,W360,H297,Vitem,N", id: "grBoxTable" }, ); formMenu.setSection("S1", { FEG_Prefix: "Menu", FEG_Title: "Anzeigen", ynVolatile: 'Y' }, ); let formGroup = XRW.mkForm({ FID: 'formGroup', ynCreateFolder: 'Y', ynCreateRender: 'Y', renderType: 'Form', pageX: 360, pageY: 1000, minPixelPerPoint: 2, anchor: 'grBoxTable' }); formGroup.setFEG("phone_numbers", { FE_Prefix: 'Render', FGM_Format: "dY10,dX10,f12,Sbold,W80,Vitem?uri=Typ,W80,Vitem?uri=Nummer,W80,Vitem?uri=Test,N", SEonBuild: `if (ctx.arg._FIX!=1) ctx.item.ynSkip='Y'` }, // { FE_Prefix: 'GenericFixSelect', FGM_Key: 'type', FGM_Format: "dX5,W80,B32,Vitem", select: ["home", "office", "mobile"], FE_Title: `Typ`, ynTableStyle: 'Y', ynReadOnly: 'Y' }, { FE_Prefix: 'GenericString', FGM_Key: 'type', FGM_Format: "dX5,W80,B32,Vitem", select: ["home", "office", "mobile"], FE_Title: `Typ`, ynTableStyle: 'Y', ynReadOnly: 'Y' }, { FE_Prefix: 'GenericString', FGM_Key: 'number', FGM_Format: "W80,B32,Vitem", FE_Title: `Rufnummer`, ynTableStyle: 'Y', ynReadOnly: 'Y' }, { FE_Prefix: 'GenericString', FGM_Key: 'test', FGM_Format: "W80,B32,Vitem", FE_Title: `Exceltest`, ynTableStyle: 'Y', ynNotAssignNullValue: 'Y', SEautoValue: `#E;let x=Number($value("?relX=-1"));return isNaN(x)?null:x+1;`, defaultValue: 0 }, { FE_Prefix: 'Icon', FGM_Format: "f12,Acenter,cText?hex=#0000ff,W10,Vitem", class: "w3-rw-hover", FE_Title: 'Eintrag bearbeiten', ynClearCaption: 'Y', icon: 'edit', SEonClick: `$copyFormRef("formEdit", {ynDeleteOther: 'Y'})` }, { FE_Prefix: 'Icon', FGM_Format: "f12,Acenter,cText?hex=#ff0000,W10,Vitem,N", class: "w3-rw-hover", FE_Title: 'Eintrag löschen', ynClearCaption: 'Y', icon: 'delete', SEonClick: `$deleteForm()` }, // { FE_Prefix: 'GenericString', FGM_Key: 'Icon', FGM_Format: "f7,Sbold,W20,Vitem,N", FE_Title: `Icon` }, ); formGroup.setSection("S1", { FEG_Prefix: "phone_numbers", FEG_Title: "Anzeigen", ynVolatile: 'Y', ynAllowEmptyArg: 'Y' }, ); formGroup.folder.setArg('WikiExample', XRW.samples.jsonWiki); let formEdit = XRW.mkForm({ FID: 'formEdit', ynCreateFolder: 'Y', ynCreateRender: 'Y', renderType: 'Form', pageX: 360, pageY: 1000, minPixelPerPoint: 2, anchor: 'grRight' }); formEdit.setFEG("phone_numbers", { FE_Prefix: 'GenericFixSelect', FGM_Key: 'type', FGM_Format: "dY20,dX10,W80,B32,Vitem,N", select: ["home", "office", "mobile"], FE_Title: `Typ`, ynTableStyle: 'N' }, // { FE_Prefix: 'GenericString', FGM_Key: 'type', FGM_Format: "dY20,dX10,W80,B32,Vitem,N", select: ["home", "office", "mobile"], FE_Title: `Typ`, ynTableStyle: 'N' }, { FE_Prefix: 'GenericString', FGM_Key: 'number', FGM_Format: "dX10,W80,B32,Vitem,N", FE_Title: `Rufnummer`, ynTableStyle: 'N' }, ); formEdit.setSection("S1", { FEG_Prefix: "phone_numbers", FEG_Title: "Telefon", ynVolatile: 'Y', ynAllowEmptyArg: 'Y' }, ); formEdit.folder.setArg('WikiExample', XRW.samples.jsonWiki); if (false) { res = await XRW.api.sendPostAsync('/dbp', { dispatch: "pGetAllUserFunction", param: { mode: 'group' } }); console.log(res); formGroup.folder.setArg('Main', { Group: res.result }); } // formGroup.folder.debug(); // await formGroup.renderPageSection("S1"); // await formMenu.renderPageSection("S1"); if (false) { form.callBack_onChange((control, item) => { form.folder.debug(); }); console.log(form); } } } globalThis.oApp = new toApp();