// 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 {
    formMyFormDemo() {
    let formMyFormDemo = XRW.mkForm({ FID: 'formMyFormDemo', ynCreateFolder: 'N', folder: this.folder, ynCreateRender: 'Y', renderType: 'Form', pageX: 25, minPixelPerPoint: 20, anchor: 'grForm' });
        formMyFormDemo.setFEG('MyFormDemo',
            { FE_Prefix: 'GenericCheck', FGM_Key: 'ynIMakeItSo', FGM_Format: 'dX1,f20,W4,Vitem,N', FE_Title: 'Challenge accepted', ynfOptional: 'Y' },
        );
        formMyFormDemo.setFEG('PDF_Invoice',
            { FE_Prefix: 'GenericString', FGM_Key: 'Stadt', FE_Title: 'String', FGM_Format: 'dX2,W15,Vitem', ynTableStyle:'Y', defaultValue: 'Gemeinde Sulzbach (Taunus)' },
            { FE_Prefix: 'GenericString', FGM_Key: 'DocDate', FE_Title: 'String', FGM_Format: 'dX1,W6,Vitem,dY2', ynTableStyle:'Y', SEautoValue: 'XRW.dt.dt2DDMMYYYY()' },
            { FE_Prefix: 'GenericString', FGM_Key: 'Verantwortlich', FE_Title: 'String', FGM_Format: 'dX18,W6,Vitem,N', ynTableStyle:'Y', defaultValue: 'Ferienspiele 2024' },
            { FE_Prefix: 'GenericString', FGM_Key: 'Adresse1', FE_Title: 'String', FGM_Format: 'dX18,W6,Vitem,N', ynTableStyle:'Y', defaultValue: 'Hauptstraße 11' },
            { FE_Prefix: 'GenericString', FGM_Key: 'Adresse2', FE_Title: 'String', FGM_Format: 'dX18,W6,Vitem,N', ynTableStyle:'Y', defaultValue: '65843 Sulzbach (Taunus)' },
            { FE_Prefix: 'GenericString', FGM_Key: 'Public_Mail', FE_Title: 'String', FGM_Format: 'dX18,W6,Vitem,N', ynTableStyle:'Y', defaultValue: 'info@sulzbach-taunus.de' },
            { FE_Prefix: 'GenericString', FGM_Key: 'Public_Phone', FE_Title: 'String', FGM_Format: 'dX18,W6,Vitem,N', ynTableStyle:'Y', defaultValue: 'Tel: 06196 / 7021 - 0' },
            { FE_Prefix: 'GenericString', FGM_Key: 'Webseite', FE_Title: 'String', FGM_Format: 'dX18,W6,Vitem,N', ynTableStyle:'Y', defaultValue: 'www.sulzbach-taunus.de' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY2,dX2,W10,Vitem', ynTableStyle:'Y', defaultValue: 'Ihr Buchungszeichen:' },
            // { FE_Prefix: 'GenericString', FGM_Key: 'RBB_Buchungszeichen', FE_Title: 'String', FGM_Format: 'W6,Vitem,N', SEautoValue: `"FS-" + $folder.FD.toString().padStart(5, '0') + "-2024"` },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX2,W10,Vitem,N', ynTableStyle:'Y', defaultValue: '(Bei Zahlungen und Rückfragen bitte angeben)' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY2,dX2,W22,Vitem,N', SEautoValue: `'Sehr geehrte(r) ' + $arg("Kontakt").USR_FirstName + ' ' + $arg("Kontakt").USR_LastName + ','` },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY2,dX2,W22,Vitem,dY2', SEautoValue: `'bitte bezahlen Sie für die Betreuung Ihres Kindes ' + $arg("Kind_A1").CHLD_FirstName + ' ' + $arg("Kind_A1").CHLD_LastName` },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX2,W2,Vitem', ynTableStyle:'Y', defaultValue: 'Pos.' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W6,Vitem', ynTableStyle:'Y', defaultValue: 'Bezeichnung' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem', ynTableStyle:'Y', defaultValue: 'Anzahl' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W4,Vitem', ynTableStyle:'Y', defaultValue: 'Einzelpreis' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem,N', ynTableStyle:'Y', defaultValue: 'Summe' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY1,dX2,W2,Vitem', ynTableStyle:'Y', defaultValue: 1 },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W6,Vitem', ynTableStyle:'Y', defaultValue: 'Tagesbetreuung' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem', SEautoValue: '$arg("InvoiceData").nWeek' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W4,Vitem', SEautoValue: '$arg("InvoiceData").costWeek+",00 €"' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem,N', SEautoValue: '($arg("InvoiceData").costWeek*$arg("InvoiceData").nWeek) +",00 €"' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX2,W2,Vitem', ynTableStyle:'Y', defaultValue: 2 },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W6,Vitem', ynTableStyle:'Y', defaultValue: 'Frühbetreuung' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem', SEautoValue: '$arg("InvoiceData").nWeekFS' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W4,Vitem', SEautoValue: "'10,00 €'" },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem,N', SEautoValue: '(10*$arg("InvoiceData").nWeekFS) +",00 €"' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX2,W2,Vitem', ynTableStyle:'Y', defaultValue: 3 },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W6,Vitem', ynTableStyle:'Y', defaultValue: 'Essen' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem', SEautoValue: '$arg("InvoiceData").nWeek' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W4,Vitem', SEautoValue: "'15,00 €'" },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem,N', SEautoValue: '(15*$arg("InvoiceData").nWeek) +",00 €"' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY1,dX15,W4,Vitem', ynTableStyle:'Y', defaultValue: 'Gesamtbetrag' },
            // { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W2,Vitem,N', SEautoValue: '((15+$arg("InvoiceData").costWeek)*$arg("InvoiceData").nWeek + 10*$arg("InvoiceData").nWeekFS) +",00 €"' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY1,dX2,W22,Vitem,N', ynTableStyle:'Y', defaultValue: 'Bitte überweisen Sie fällige Beträge rechtzeitig.' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dY2,dX2,W22,Vitem,dY2', ynTableStyle:'Y', defaultValue: 'Bankverbindung' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX4,W6,Vitem', ynTableStyle:'Y', defaultValue: 'Bank:' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W10,Vitem,N', ynTableStyle:'Y', defaultValue: 'Nassauische Sparkasse Sulzbach' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX4,W6,Vitem', ynTableStyle:'Y', defaultValue: 'IBAN:' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W10,Vitem,N', ynTableStyle:'Y', defaultValue: 'DE79 5105 0015 0198 0000 00' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX4,W6,Vitem', ynTableStyle:'Y', defaultValue: 'BIC:' },
            { FE_Prefix: 'GenericString', FE_Title: 'String', FGM_Format: 'dX1,W10,Vitem,N', ynTableStyle:'Y', defaultValue: 'NASSDE55XXX' },
        );
        formMyFormDemo.setSection("S1", 
            { FEG_Prefix: "PDF_Invoice", FEG_Title: "Rechnung", ynVolatile: 'Y' },
            { FEG_Prefix: "MyFormDemo", FEG_Title: "Demo", ynVolatile: 'Y' });
        return formMyFormDemo;
    }

    async Start() {
        this.folder = XRW.mkFolder();
        this.formMyFormDemo();
        await XRW.windowResizeCallBack();
    }
}
globalThis.oApp = new toApp();
