Search in sources :

Example 1 with FieldGroup

use of org.broadleafcommerce.openadmin.web.form.entity.FieldGroup in project BroadleafCommerce by BroadleafCommerce.

the class AdminOfferControllerExtensionHandler method setAdditionalModelAttributes.

@Override
public ExtensionResultStatusType setAdditionalModelAttributes(Model model, String sectionKey) {
    if (AdminOfferController.SECTION_KEY.equals(sectionKey)) {
        EntityForm form = (EntityForm) model.asMap().get("entityForm");
        if (form != null) {
            // UX Meta-Data to display the Rule Builders on the Offer Screen
            FieldGroup ruleConfigGroup = form.findGroup(OfferAdminPresentation.GroupName.RuleConfiguration);
            if (ruleConfigGroup != null) {
                ruleConfigGroup.getGroupAttributes().put("additionalGroupClasses", "card");
            }
            // Qualifier and Target Item Builders
            Field qualField = form.findField("qualifyingItemCriteria");
            if (qualField != null) {
                qualField.setDisplayType(RuleBuilderDisplayType.NORMAL.name());
            }
            Field fgField = form.findField("offerMatchRules---FULFILLMENT_GROUP");
            if (fgField != null) {
                fgField.setDisplayType(RuleBuilderDisplayType.NORMAL.name());
            }
            Field tarField = form.findField("targetItemCriteria");
            if (tarField != null) {
                tarField.setDisplayType(RuleBuilderDisplayType.NORMAL.name());
            }
            // Activity Range Builder
            Field timeField = form.findField("offerMatchRules---TIME");
            if (timeField != null) {
                timeField.setDisplayType(RuleBuilderDisplayType.MODAL.name());
            }
            // Usage Builders
            Field custField = form.findField("offerMatchRules---CUSTOMER");
            if (custField != null) {
                custField.setDisplayType(RuleBuilderDisplayType.MODAL.name());
            }
            Field orderField = form.findField("offerMatchRules---ORDER");
            if (orderField != null) {
                orderField.setDisplayType(RuleBuilderDisplayType.MODAL.name());
            }
        }
    }
    return ExtensionResultStatusType.HANDLED_CONTINUE;
}
Also used : EntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm) Field(org.broadleafcommerce.openadmin.web.form.entity.Field) FieldGroup(org.broadleafcommerce.openadmin.web.form.entity.FieldGroup)

Example 2 with FieldGroup

use of org.broadleafcommerce.openadmin.web.form.entity.FieldGroup in project BroadleafCommerce by BroadleafCommerce.

the class AdminBasicEntityController method addAuditableDisplayField.

private void addAuditableDisplayField(EntityForm entityForm, Field userField) {
    Field displayField = buildAuditableDisplayField(userField);
    AdminUser user = adminUserDao.readAdminUserById(Long.parseLong(userField.getValue()));
    String userName = user == null ? null : user.getName();
    displayField.setValue(userName);
    FieldGroup auditGroup = entityForm.findGroup("AdminAuditable_Audit");
    if (auditGroup != null) {
        auditGroup.addField(displayField);
    }
}
Also used : Field(org.broadleafcommerce.openadmin.web.form.entity.Field) FieldGroup(org.broadleafcommerce.openadmin.web.form.entity.FieldGroup) AdminUser(org.broadleafcommerce.openadmin.server.security.domain.AdminUser)

Aggregations

Field (org.broadleafcommerce.openadmin.web.form.entity.Field)2 FieldGroup (org.broadleafcommerce.openadmin.web.form.entity.FieldGroup)2 AdminUser (org.broadleafcommerce.openadmin.server.security.domain.AdminUser)1 EntityForm (org.broadleafcommerce.openadmin.web.form.entity.EntityForm)1