You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
6.9 KiB
JavaScript

// Copyright (C) 2023 Robert J.A. Wagner; Am Kiefernwald 49b; D-64297 Darmstadt - All Rights Reserved
/*
FGM_FPos:\s*['"](L[0-9]+)?(M[0-9]+)?(R[0-9]+)?(cr)?['"]
FGM_Format: "dX#$1,W#$2,Vitem,N,x#R#$3,x#cr#"
FGM_FPos\\:\s*[\'\"]((cr)?)(L[0-9]+)?(M[0-9]+)?(R[0-9]+)?((cr)?)
defaultValue->SEautoValue
F60000332->GenericString
*/
//-- WatchOut:
//-- Check unique form-names by:
//-- find /i "setPageMemberQuick" *.mjs
export const hoNotUSER = `if (XRW.LOG_Role!="USER" && XRW.LOG_Role!="EDIT") ctx.item.ynSkip='Y'`;
export const hoNotCLERK = `if (XRW.LOG_Role!="CLERK" && XRW.LOG_Role!="EDIT") ctx.item.ynSkip='Y'`;
export const supply_Contact = (option) => {
/*
* Usage example:
oPage.setPageMemberQuick("Antragsteller",
supply_Contact({ ynfOptional, ynAddOn: 'Y', ynFull: 'N', ynPhoneMail: 'Y', html:"<h3>Antragsteller</h3>" }),
{ FE_Prefix: ... additional form elements
);
*/
let ynfOptional = option.ynfOptional || 'N';
let ynAddOn = option.ynAddOn || 'N';
let ynFull = option.ynFull || 'N';
let ynPhone = option.ynPhone || 'Y';
// let ynEMail = option.ynEMail || 'Y';
let ynRegisteredEMail = option.ynRegisteredEMail || 'Y';
let ynTitle = option.ynTitle || 'N';
let _ContactBase = [
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_LastName', FGM_Format: "dX1,W11,Vitem", FE_Title: 'Nachname', ynfOptional, SEautoValue: '$profile()' },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_FirstName', FGM_Format: "dX1,W11,Vitem,N,dY1", FE_Title: 'Vorname', ynfOptional, SEautoValue: '$profile()' },
];
if (XRW.is.string(option.html)) {
_ContactBase.unshift({ FE_Prefix: 'HTML', FGM_Format: "dX1,W23,Vitem,N", FE_Title: 'Überschrift', html: option.html });
}
if (ynTitle == 'Y') {
_ContactBase.unshift(
{ FE_Prefix: 'HTML', FGM_Format: "dX1,W23,p?L=0.5,Vitem,N,dY1", html: '<h3>Ihre Kontaktdaten</h3>', class:'w3-card-2', SEonBuild: hoNotUSER }, // , ynfHidden: hoNotUSER
{ FE_Prefix: 'HTML', FGM_Format: "dX1,W23,Vitem,N,dY1", html: '<h3>Kontaktdaten des Antragstellers</h3>', SEonBuild: hoNotCLERK }, // , ynfHidden: hoNotCLERK
)
}
let _Contact = _ContactBase;
if (ynAddOn == 'Y') _Contact = _Contact.concat([
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_NameAddOn1', FGM_Format: "dX1,W7,Vitem", FE_Title: 'Namenszusatz (Beispiel: Freifrau, Graf)', ynfOptional: 'Y', SEautoValue: '$profile()' },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_NameAddOn2', FGM_Format: "dX1,W7,Vitem,N", FE_Title: 'Vorsatzworte zum Namen (Beispiel: von, van, de)', ynfOptional: 'Y', SEautoValue: '$profile()' },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_Title', FGM_Format: "dX1,W7,Vitem,N", FE_Title: 'Titel (Beispiel: Prof. Dr. med.', ynfOptional: 'Y', SEautoValue: '$profile()' },
]);
if (ynFull == 'Y') _Contact = _Contact.concat([
{ FE_Prefix: 'GenericDate', FGM_Key: 'USR_DOB', FGM_Format: "dX1,W7,Vitem,N", FE_Title: 'Geburtsdatum', ynfOptional, SEautoValue: '$profile()' },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_Gender', FGM_Format: "dX1,W7,Vitem,N", ynfOptional, SEautoValue: '$profile()' },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_Nationality', FGM_Format: "dX1,W7,Vitem,N", ynfOptional, SEautoValue: '$profile()' },
]);
if (ynPhone == 'Y') _Contact = _Contact.concat([
{ FE_Prefix: 'GenericString', FE_Title: 'Telefonisch tagsüber zu erreichen (Angabe freiwillig)', FGM_Key: 'Telefon', FGM_Format: "dX1,W11,Vitem", ynfOptional: 'Y', SEautoValue: '$profile()' },
{ FE_Prefix: 'GenericString', FE_Title: 'Mobiltelefon (Angabe freiwillig)', FGM_Key: 'Mobiltelefon', FGM_Format: "dX1,W11,Vitem,N,dY1", ynfOptional: 'Y', SEautoValue: '$profile()' },
]);
if (ynRegisteredEMail == 'Y') _Contact = _Contact.concat([
// { FE_Prefix: 'GenericEMail', FGM_Key: 'USR_EMail', FGM_Format: "dX1,W23,Vitem,N", FE_Title: 'Registrierte E-Mail', ynPreserveValue: 'N', ynReadOnly: 'Y', ynfOptional: 'N', defaultReturn: 'XRW.USR_EMail', hint: `Diese E-Mail-Adresse ist mit Ihrem Konto verknüpft und kann nicht geändert werden` },
// { FE_Prefix: 'GenericWord', FGM_Key: 'USR_OU_Name', ynReadOnly: 'Y', defaultReturn: `XRW.OU_Name` },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_EMail', FGM_Format: "dX1,W23,Vitem,N", FE_Title: 'Registrierte E-Mail', ynPreserveValue: 'N', ynReadOnly: 'Y', ynfOptional: 'N', SEautoValue: 'XRW.USR_EMail', hint: `Diese E-Mail-Adresse ist mit Ihrem Konto verknüpft und kann nicht geändert werden` },
{ FE_Prefix: 'GenericString', FGM_Key: 'USR_OU_Name', ynReadOnly: 'Y', defaultReturn: `XRW.OU_Name` },
]);
return _Contact;
}
export const supply_DefaultContact = (option) => {
let html = `<br><b>Hinweis:</b><br><p>Überprüfen Sie Ihre Kontaktdaten.<br>Falls Sie dauerhafte Änderungen vornehmen möchten, bearbeiten Sie jetzt Ihr Profil und starten Sie den Antrag erneut.<br>Ansonsten können Sie Angaben auch hier überschreiben.</p>`
option ??= {};
option.ynTitle ??= 'Y';
option.ynTitle ??= 'Y';
return [
supply_Contact(option),
{ FE_Prefix: 'HTML', FGM_Format: "dX1,f8,W23,Vitem,N", html, SEonBuild: hoNotUSER },
];
}
export const supply_Street = (option) => {
let ynfOptional = (option && option.ynfOptional == 'Y')
? 'Y'
: 'N';
return [
{ FE_Prefix: 'GenericString', FGM_Key: 'Strasse', FE_Title: 'Straße', FGM_Format: "dX1,W15,Vitem,N", ynfOptional },
{ FE_Prefix: 'GenericString', FGM_Key: 'StrasseNr', FE_Title: 'Hausnummer', FGM_Format: "dX1,W3,Vitem,N", ynfOptional },
{ FE_Prefix: 'GenericString', FGM_Key: 'StrasseNrExt', FE_Title: 'Hausnummerzusatz', FGM_Format: "dX1,W3,Vitem,N", ynfOptional: 'Y' },
];
}
export const supply_City = (option) => {
let ynfOptional = (option && option.ynfOptional == 'Y')
? 'Y'
: 'N';
return [
{ FE_Prefix: 'GenericString', FGM_Key: 'PLZ', FE_Title: 'Postleitzahl', FGM_Format: "dX1,W5,Vitem,N", ynfOptional, pattern: '^[0-9]{5}$' },
{ FE_Prefix: 'GenericString', FGM_Key: 'Stadt', FE_Title: 'Ort', FGM_Format: "dX1,W17,Vitem,N", ynfOptional },
];
}
export const supply_Address = (option) => {
return supply_Street(option).concat(supply_City(option));
}
export const pageContact = (AppPage, name = "Contact") => {
oPage.setBPMNPage({ AppPage, FEG_Prefix: `${name}_Info1`, FEG_Title: "Contact", ynVolatile: 'Y', ynSkipPageBreak: 'Y' });
oPage.setBPMNPage({ AppPage, FEG_Prefix: name, FEG_Title: "Contact", ynSkipPageBreak: 'N' });
}
export const pageContactRef = (AppPage, name = "Contact") => {
oPage.setBPMNPage({ AppPage, FEG_Prefix: `${name}_Info2`, FEG_Title: "Contact", ynVolatile: 'Y', ynSkipPageBreak: 'Y' });
oPage.setBPMNPage({ AppPage, FEG_Prefix: name, FEG_Title: "Contact", ynRefAppPage: 'Y', ynSkipPageBreak: 'N' });
}