Search in sources :

Example 16 with EntityForm

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

the class AdminTranslationController method showUpdateTranslation.

@RequestMapping(value = "/update", method = RequestMethod.GET)
public String showUpdateTranslation(HttpServletRequest request, HttpServletResponse response, Model model, @PathVariable Map<String, String> pathVars, @ModelAttribute(value = "form") TranslationForm form, BindingResult result) throws Exception {
    String sectionKey = getSectionKey(pathVars);
    String sectionClassName = getClassNameForSection(sectionKey);
    List<SectionCrumb> sectionCrumbs = new ArrayList<>();
    PersistencePackageRequest ppr = getSectionPersistencePackageRequest(sectionClassName, sectionCrumbs, pathVars);
    ClassMetadata cmd = service.getClassMetadata(ppr).getDynamicResultSet().getClassMetaData();
    adminRemoteSecurityService.securityCheck(form.getCeilingEntity(), EntityOperationType.FETCH);
    Translation t = translationService.findTranslationById(form.getTranslationId());
    form.setTranslatedValue(t.getTranslatedValue());
    EntityForm entityForm = formService.buildTranslationForm(cmd, form, TranslationFormAction.UPDATE);
    entityForm.setId(String.valueOf(form.getTranslationId()));
    model.addAttribute("entityForm", entityForm);
    model.addAttribute("viewType", "modal/translationAdd");
    model.addAttribute("currentUrl", request.getRequestURL().toString());
    model.addAttribute("modalHeaderType", ModalHeaderType.UPDATE_TRANSLATION.getType());
    return "modules/modalContainer";
}
Also used : SectionCrumb(org.broadleafcommerce.openadmin.dto.SectionCrumb) ClassMetadata(org.broadleafcommerce.openadmin.dto.ClassMetadata) EntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm) Translation(org.broadleafcommerce.common.i18n.domain.Translation) ArrayList(java.util.ArrayList) PersistencePackageRequest(org.broadleafcommerce.openadmin.server.domain.PersistencePackageRequest) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with EntityForm

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

the class FormBuilderServiceImpl method createEntityForm.

@Override
public EntityForm createEntityForm(ClassMetadata cmd, Entity entity, Map<String, DynamicResultSet> collectionRecords, List<SectionCrumb> sectionCrumbs) throws ServiceException {
    EntityForm ef = createStandardEntityForm();
    populateEntityForm(cmd, entity, collectionRecords, ef, sectionCrumbs);
    addAdditionalFormActions(ef);
    extensionManager.getProxy().addAdditionalFormActions(ef);
    return ef;
}
Also used : EntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm)

Example 18 with EntityForm

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

the class FormBuilderServiceImpl method createStandardAdornedEntityForm.

protected EntityForm createStandardAdornedEntityForm() {
    EntityForm ef = new EntityForm();
    ef.addAction(DefaultAdornedEntityFormActions.Add);
    return ef;
}
Also used : EntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm)

Example 19 with EntityForm

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

the class FormBuilderServiceImpl method createStandardEntityForm.

protected EntityForm createStandardEntityForm() {
    EntityForm ef = new EntityForm();
    ef.addAction(DefaultEntityFormActions.SAVE);
    return ef;
}
Also used : EntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm)

Example 20 with EntityForm

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

the class AdminOrderController method showViewUpdateCollection.

@Override
protected String showViewUpdateCollection(HttpServletRequest request, Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String modalHeaderType) throws ServiceException {
    String returnPath = super.showViewUpdateCollection(request, model, pathVars, id, collectionField, collectionItemId, modalHeaderType);
    if ("orderItems".equals(collectionField)) {
        EntityForm ef = (EntityForm) model.asMap().get("entityForm");
        ListGrid adjustmentsGrid = ef.findListGrid("orderItemAdjustments");
        if (adjustmentsGrid != null && CollectionUtils.isEmpty(adjustmentsGrid.getRecords())) {
            ef.removeListGrid("orderItemAdjustments");
        }
        ListGrid priceDetailsGrid = ef.findListGrid("orderItemPriceDetails");
        if (priceDetailsGrid != null && CollectionUtils.isEmpty(priceDetailsGrid.getRecords())) {
            ef.removeListGrid("orderItemPriceDetails");
        }
    }
    return returnPath;
}
Also used : EntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm) ListGrid(org.broadleafcommerce.openadmin.web.form.component.ListGrid)

Aggregations

EntityForm (org.broadleafcommerce.openadmin.web.form.entity.EntityForm)33 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 PersistencePackageRequest (org.broadleafcommerce.openadmin.server.domain.PersistencePackageRequest)12 ClassMetadata (org.broadleafcommerce.openadmin.dto.ClassMetadata)10 Field (org.broadleafcommerce.openadmin.web.form.entity.Field)10 SectionCrumb (org.broadleafcommerce.openadmin.dto.SectionCrumb)8 DynamicEntityFormInfo (org.broadleafcommerce.openadmin.web.form.entity.DynamicEntityFormInfo)7 ArrayList (java.util.ArrayList)6 Entity (org.broadleafcommerce.openadmin.dto.Entity)5 HashMap (java.util.HashMap)3 Map (java.util.Map)3 FieldMetadata (org.broadleafcommerce.openadmin.dto.FieldMetadata)3 Property (org.broadleafcommerce.openadmin.dto.Property)3 Page (org.broadleafcommerce.cms.page.domain.Page)2 Translation (org.broadleafcommerce.common.i18n.domain.Translation)2 BasicCollectionMetadata (org.broadleafcommerce.openadmin.dto.BasicCollectionMetadata)2 BasicFieldMetadata (org.broadleafcommerce.openadmin.dto.BasicFieldMetadata)2 DynamicResultSet (org.broadleafcommerce.openadmin.dto.DynamicResultSet)2 ListGrid (org.broadleafcommerce.openadmin.web.form.component.ListGrid)2 EntityFormAction (org.broadleafcommerce.openadmin.web.form.entity.EntityFormAction)2