// Copyright (C) 2024 Robert J.A. Wagner; Am Kiefernwald 49b; D-64297 Darmstadt - All Rights Reserved import { supply_DefaultContact, hoNotUSER, hoNotCLERK } from "./lib/contact.mjs"; export default class toApp { formContact() { let formContact = XRW.mkForm({ FID: 'formContact', ynCreateFolder: 'N', folder: this.folder, ynCreateRender: 'Y', renderType: 'Form', pageX: 25, anchor: 'grForm' }); formContact.setFEG("User", supply_DefaultContact()); formContact.setSection("S1", { FEG_Prefix: "User", FEG_Title: "Kontakt", ynVolatile: 'Y' }, ); return formContact; } formMyFormDemo() { let formMyFormDemo = XRW.mkForm({ FID: 'formMyFormDemo', ynCreateFolder: 'N', folder: this.folder, ynCreateRender: 'Y', renderType: 'PDF', pageX: 25, minPixelPerPoint: 20, anchor: 'grForm' }); formMyFormDemo.setFEG('MyFormDemo', { FE_Prefix: 'HTML', FE_Title: '__Key_HTML_0', FGM_Format: 'dX1,W23,Vitem,N', html: '

Your Form here!

', ynSkipSave: 'Y', ynfOptional: 'Y' }, { FE_Prefix: 'GenericCheck', FGM_Key: 'ynIMakeItSo', FGM_Format: 'dX1,f20,W10,Vitem,N', FE_Title: 'Challenge accepted', ynfOptional: 'Y' }, ); formMyFormDemo.setSection("S1", { FEG_Prefix: "MyFormDemo", FEG_Title: "Demo", ynVolatile: 'Y' }); return formMyFormDemo; } async nextForm() { if (this.nState >= this.pState.length) return XRW.panic(`Form-index(${this.nState}) overflow`); XRW.mForm = new Map(); let state = this.pState[this.nState]; if (!state in this) return XRW.panic(`Form("${state}) not found`); // if (state.startsWith("sub")){} this.form = this[state](); this.nState++; if (this.nState < this.pState.length) { this.form.setFEG("Continue", { FE_Prefix: 'GenericButton', FGM_Format: "dY1,f10,dX1,W6,Vitem", FE_Title: 'Mit der Berarbeitung fortfahren', caption: "Weiter", ynClearCaption: 'N', icon: 'arrowRight', iconColor: 'blue', iconSize_px: 16, SEonClick: `#A;await oApp.nextForm();` }, ); this.form.setSection("S1", { FEG_Prefix: "Continue", FEG_Title: "Weiter", ynVolatile: 'Y' }, ); } else { this.form.setFEG("Send", { FE_Prefix: 'GenericButton', FGM_Format: "dY1,f12,cFill?color=magenta,dX1,W8,Vitem", FE_Title: 'Antrag absenden', caption: "Senden", ynClearCaption: 'N', icon: 'send', iconColor: 'blue', iconSize_px: 42, SEonClick: `#A;await oApp.sendForm();` }, ); this.form.setSection("S1", { FEG_Prefix: "Send", FEG_Title: "Antrag einreichen", ynVolatile: 'Y' }, ); } await XRW.windowResizeCallBack(); } async sendForm() { this.nState = 0; await this.nextForm(); } async Start() { this.pState = ['formContact', 'formMyFormDemo']; this.nState = 0; this.folder = XRW.mkFolder(); await this.nextForm(); } } globalThis.oApp = new toApp();