Search in sources :

Example 1 with ProductTypeDto

use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.

the class ProductMixAssembler method createFormBean.

public ProductMixFormBean createFormBean(List<ProductTypeDto> productTypes) {
    ProductMixFormBean formBean = new ProductMixFormBean();
    Map<String, String> productTypeOptions = new LinkedHashMap<String, String>();
    for (ProductTypeDto productTypeDto : productTypes) {
        productTypeOptions.put(productTypeDto.getProductTypeId().toString(), productTypeDto.getProductTypeKey());
    }
    formBean.setProductTypeOptions(productTypeOptions);
    return formBean;
}
Also used : ProductTypeDto(org.mifos.dto.domain.ProductTypeDto) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with ProductTypeDto

use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.

the class DefineProductMixController method processFormSubmit.

@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String canceBtn, @RequestParam(value = PREVIEW_PARAM, required = false) String previewBtn, @ModelAttribute("formBean") ProductMixFormBean formBean, BindingResult result, SessionStatus status) {
    ModelAndView mav = new ModelAndView("defineProductMix");
    ProductMixFormValidator formValidator = new ProductMixFormValidator();
    if (StringUtils.isNotBlank(canceBtn)) {
        mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN);
        status.setComplete();
    }
    if (StringUtils.isBlank(formBean.getProductTypeId())) {
        List<ProductTypeDto> productTypes = this.adminServiceFacade.retrieveProductTypesApplicableToProductMix();
        mav.addObject("formBean", productMixAssembler.createFormBean(productTypes));
        validateForPreview(formValidator, formBean, result, previewBtn);
    } else if (StringUtils.isNotBlank(formBean.getProductTypeId()) && StringUtils.isBlank(formBean.getProductId())) {
        populateProductNameOptions(formBean);
        validateForPreview(formValidator, formBean, result, previewBtn);
    } else if (StringUtils.isNotBlank(formBean.getProductTypeId()) && StringUtils.isNotBlank(formBean.getProductId()) && (formBean.getAllowed() == null && formBean.getNotAllowed() == null)) {
        populateAllowedNotAllowedOptions(formBean);
        validateForPreview(formValidator, formBean, result, previewBtn);
    } else {
        checkAndFixFormStringArrys(formBean);
        validateForPreview(formValidator, formBean, result, previewBtn);
        ProductMixPreviewDto preview = this.productMixAssembler.createProductMixPreview(formBean);
        mav = new ModelAndView("previewProductMix");
        mav.addObject("ref", preview);
        mav.addObject("formView", "defineProductMix");
    }
    return mav;
}
Also used : ProductTypeDto(org.mifos.dto.domain.ProductTypeDto) ProductMixPreviewDto(org.mifos.dto.screen.ProductMixPreviewDto) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with ProductTypeDto

use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveProductTypesApplicableToProductMix.

@Override
public List<ProductTypeDto> retrieveProductTypesApplicableToProductMix() {
    List<ProductTypeDto> productTypes = new ArrayList<ProductTypeDto>();
    productTypes.add(new ProductTypeDto(ProductType.LOAN.getValue().intValue(), "manageProduct.viewProductMix.loan"));
    return productTypes;
}
Also used : ProductTypeDto(org.mifos.dto.domain.ProductTypeDto) ArrayList(java.util.ArrayList)

Example 4 with ProductTypeDto

use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.

the class EditProductMixController method showEditForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("formBean")
public ProductMixFormBean showEditForm(@RequestParam(value = "productId", required = true) Integer productId) {
    List<ProductTypeDto> productTypes = this.adminServiceFacade.retrieveProductTypesApplicableToProductMix();
    ProductMixFormBean formBean = productMixAssembler.createFormBean(productTypes);
    formBean.setProductId(productId.toString());
    formBean.setProductTypeId("1");
    ProductMixDetailsDto productMixDetails = adminServiceFacade.retrieveProductMixDetails(productId.shortValue(), formBean.getProductTypeId());
    Map<String, String> productNameOptions = new LinkedHashMap<String, String>();
    productNameOptions.put(productMixDetails.getPrdOfferingId().toString(), productMixDetails.getPrdOfferingName());
    formBean.setProductNameOptions(productNameOptions);
    populateAllowedNotAllowedOptions(formBean, productMixDetails);
    return formBean;
}
Also used : ProductTypeDto(org.mifos.dto.domain.ProductTypeDto) ProductMixDetailsDto(org.mifos.dto.screen.ProductMixDetailsDto) LinkedHashMap(java.util.LinkedHashMap) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ProductTypeDto (org.mifos.dto.domain.ProductTypeDto)4 LinkedHashMap (java.util.LinkedHashMap)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ArrayList (java.util.ArrayList)1 ProductMixDetailsDto (org.mifos.dto.screen.ProductMixDetailsDto)1 ProductMixPreviewDto (org.mifos.dto.screen.ProductMixPreviewDto)1 ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1