use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class EditOfficeInformationController method populateForm.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView populateForm(HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView();
Short officeId = officeServiceFacade.retrieveOfficeById(Short.parseShort(request.getParameter("officeLevelId"))).getLevelId();
OfficeDto officeDto = officeServiceFacade.retrieveOfficeById(Short.parseShort(request.getParameter("officeLevelId")));
OfficeFormBean formBean = new OfficeFormBean();
if (officeDto.getAddress() != null) {
formBean.setCity(officeDto.getAddress().getCity());
formBean.setCountry(officeDto.getAddress().getCountry());
formBean.setLine1(officeDto.getAddress().getLine1());
formBean.setLine2(officeDto.getAddress().getLine2());
formBean.setLine3(officeDto.getAddress().getLine3());
formBean.setZip(officeDto.getAddress().getZip());
formBean.setPhoneNumber(officeDto.getAddress().getPhoneNumber());
formBean.setState(officeDto.getAddress().getState());
}
if (officeDto.getCustomFields() != null) {
formBean.setCustomFields(officeDto.getCustomFields());
}
formBean.setGlobalNum(officeDto.getGlobalNum());
formBean.setId(officeDto.getId());
formBean.setLevelId(officeDto.getLevelId().toString());
formBean.setLookupNameKey(officeDto.getLookupNameKey());
formBean.setName(officeDto.getName());
formBean.setOfficeLevelName(officeDto.getOfficeLevelName());
formBean.setOfficeShortName(officeDto.getOfficeShortName());
formBean.setOfficeStatusName(officeDto.getOfficeStatusName());
if (officeDto.getLevelId() != 1) {
formBean.setParentId(officeDto.getParentId().toString());
formBean.setParentOfficeName(officeDto.getParentOfficeName());
}
formBean.setSearchId(officeDto.getSearchId());
formBean.setStatusId(officeDto.getStatusId().toString());
formBean.setVersionNum(officeDto.getVersionNum());
modelAndView.addObject("officeFormBean", formBean);
modelAndView.addObject("parentOffices", getParentDetails(officeId.toString()));
modelAndView.addObject("view", "disable");
modelAndView.addObject("officeTypes", getOfficeTypes(officeDto.getLevelId().toString()));
modelAndView.addObject("showError", "false");
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class EditPenaltyController method showForm.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showForm(@RequestParam Integer penaltyId) {
ModelAndView modelAndView = new ModelAndView("editPenalty");
PenaltyDto dto = this.penaltyServiceFacade.getPenalty(penaltyId);
parametersDto = this.penaltyServiceFacade.getPenaltyParameters();
configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
PenaltyFormBean bean = new PenaltyFormBean(dto);
modelAndView.addObject("formBean", bean);
modelAndView.addObject("param", parametersDto);
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class EditProductCategoryController method processFormSubmit.
@edu.umd.cs.findbugs.annotations.SuppressWarnings
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") @Valid ProductCategoryFormBean formBean, BindingResult result) {
ModelAndView modelAndView = new ModelAndView();
if (StringUtils.isNotBlank(cancel)) {
modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN);
} else if (result.hasErrors()) {
modelAndView.setViewName("editCategoryInformation");
modelAndView.addObject("formBean", formBean);
} else {
modelAndView.setViewName("categoryPreview");
modelAndView.addObject("formBean", formBean);
}
modelAndView.addObject("breadcrumbs", new AdminBreadcrumbBuilder().withLink("admin.viewproductcategories", "viewProductCategories.ftl").withLink(formBean.getProductCategoryName(), "").build());
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class EditSavingsProductsFormController method processFormSubmit.
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("savingsProduct") @Valid SavingsProductFormBean savingsProductFormBean, BindingResult result, SessionStatus status) {
ModelAndView modelAndView = new ModelAndView("redirect:/previewSavingsProducts.ftl?editFormview=editSavingsProduct");
configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
if (StringUtils.isNotBlank(cancel)) {
modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN);
status.setComplete();
} else if (result.hasErrors()) {
new SavingsProductValidator().validateGroup(savingsProductFormBean, result);
modelAndView.setViewName("editSavingsProduct");
} else {
new SavingsProductValidator().validateGroup(savingsProductFormBean, result);
if (result.hasErrors()) {
modelAndView.setViewName("editSavingsProduct");
}
}
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class SavingsAccountController method showSavingsAccountDetails.
@RequestMapping(value = "/viewSavingsAccountDetails", method = RequestMethod.GET)
public ModelAndView showSavingsAccountDetails(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountDetails", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
boolean containsQGForCloseSavings = false;
containsQGForCloseSavings = questionnaireServiceFacade.getQuestionGroupInstances(savingsAccountDetailDto.getAccountId(), "Close", "Savings").size() > 0;
modelAndView.addObject("containsQGForCloseSavings", containsQGForCloseSavings);
modelAndView.addObject("backPageUrl", UrlHelper.constructCurrentPageUrl(request));
savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
// for mifostabletag
request.getSession().setAttribute("recentActivityForDetailPage", savingsAccountDetailDto.getRecentActivity());
return modelAndView;
}
Aggregations