Search in sources :

Example 56 with BootstrapFormGroup

use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project peppol-practical by phax.

the class PageSecureCRMSubscriber method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ICRMSubscriber aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
    final CRMGroupManager aCRMGroupMgr = PPMetaManager.getCRMGroupMgr();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    aForm.addChild(getUIHandler().createActionHeader(eFormAction.isEdit() ? "Edit CRM subscriber" : "Create new CRM subscriber"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Salutation").setCtrl(new HCSalutationSelect(new RequestField(FIELD_SALUTATION, aSelectedObject == null ? null : aSelectedObject.getSalutationID()), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_SALUTATION)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_NAME, aSelectedObject == null ? null : aSelectedObject.getName()))).setErrorList(aFormErrors.getListOfField(FIELD_NAME)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Email address").setCtrl(new HCEdit(new RequestField(FIELD_EMAIL_ADDRESS, aSelectedObject == null ? null : aSelectedObject.getEmailAddress()))).setErrorList(aFormErrors.getListOfField(FIELD_EMAIL_ADDRESS)));
    {
        final HCNodeList aGroups = new HCNodeList();
        for (final ICRMGroup aCRMGroup : aCRMGroupMgr.getAll().getSortedInline(IHasDisplayName.getComparatorCollating(aDisplayLocale))) {
            final String sCRMGroupID = aCRMGroup.getID();
            final RequestFieldBooleanMultiValue aRFB = new RequestFieldBooleanMultiValue(FIELD_GROUP, sCRMGroupID, aSelectedObject != null && aSelectedObject.isAssignedToGroup(aCRMGroup));
            aGroups.addChild(div(new HCCheckBox(aRFB).setValue(sCRMGroupID)).addChild(" " + aCRMGroup.getDisplayName()));
        }
        aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Assigned groups").setCtrl(aGroups).setErrorList(aFormErrors.getListOfField(FIELD_GROUP)));
    }
}
Also used : Locale(java.util.Locale) RequestFieldBooleanMultiValue(com.helger.photon.core.form.RequestFieldBooleanMultiValue) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCEdit(com.helger.html.hc.html.forms.HCEdit) PDTToString(com.helger.commons.datetime.PDTToString) HCCheckBox(com.helger.html.hc.html.forms.HCCheckBox) CRMGroupManager(com.helger.peppol.crm.CRMGroupManager) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) HCSalutationSelect(com.helger.photon.uicore.html.select.HCSalutationSelect) ICRMGroup(com.helger.peppol.crm.ICRMGroup) RequestField(com.helger.photon.core.form.RequestField)

Aggregations

BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)56 Locale (java.util.Locale)43 HCNodeList (com.helger.html.hc.impl.HCNodeList)41 RequestField (com.helger.photon.core.form.RequestField)37 HCEdit (com.helger.html.hc.html.forms.HCEdit)31 BootstrapForm (com.helger.photon.bootstrap4.form.BootstrapForm)25 BootstrapViewForm (com.helger.photon.bootstrap4.form.BootstrapViewForm)23 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)21 FormErrorList (com.helger.photon.core.form.FormErrorList)19 HCA (com.helger.html.hc.html.textlevel.HCA)14 PDTToString (com.helger.commons.datetime.PDTToString)13 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)13 HCCheckBox (com.helger.html.hc.html.forms.HCCheckBox)12 Nonnull (javax.annotation.Nonnull)11 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)10 RequestFieldBoolean (com.helger.photon.core.form.RequestFieldBoolean)10 HCTextArea (com.helger.html.hc.html.forms.HCTextArea)9 HCDiv (com.helger.html.hc.html.grouping.HCDiv)9 IHCNode (com.helger.html.hc.IHCNode)8 ICommonsList (com.helger.commons.collection.impl.ICommonsList)7