Search in sources :

Example 6 with CustomerStatusDetailDto

use of org.mifos.dto.screen.CustomerStatusDetailDto in project head by mifos.

the class CustSearchAction method loadMainSearch.

@TransactionDemarcate(saveToken = true)
public ActionForward loadMainSearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    String forward = null;
    CustSearchActionForm actionForm = (CustSearchActionForm) form;
    actionForm.setSearchString(null);
    actionForm.setOfficeId("0");
    cleanUpSearch(request);
    UserContext userContext = getUserContext(request);
    SessionUtils.setAttribute("isCenterHierarchyExists", ClientRules.getCenterHierarchyExists(), request);
    forward = loadMasterData(userContext.getId(), request, actionForm);
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
    SessionUtils.setMapAttribute("availibleCustomerStates", customerStates, request);
    List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
    SessionUtils.setCollectionAttribute("availibleClientGenders", availibleClientGenders, request);
    return mapping.findForward(forward);
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) CustSearchActionForm(org.mifos.customers.struts.actionforms.CustSearchActionForm) HashMap(java.util.HashMap) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) ValueListElement(org.mifos.dto.domain.ValueListElement) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with CustomerStatusDetailDto

use of org.mifos.dto.screen.CustomerStatusDetailDto in project head by mifos.

the class EditCustomerStatusAction method previewStatus.

@TransactionDemarcate(joinToken = true)
public ActionForward previewStatus(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In EditCustomerStatusAction:preview()");
    CustomerBO customerBO = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    EditCustomerStatusActionForm statusActionForm = (EditCustomerStatusActionForm) form;
    statusActionForm.setCommentDate(DateUtils.getCurrentDate(getUserContext(request).getPreferredLocale()));
    if (StringUtils.isNotBlank(statusActionForm.getNewStatusId())) {
        CustomerStatusDetailDto customerStatusDetail = this.centerServiceFacade.retrieveCustomerStatusDetails(statusActionForm.getNewStatusIdValue(), statusActionForm.getFlagIdValue(), customerBO.getLevel().getValue());
        SessionUtils.setAttribute(SavingsConstants.NEW_STATUS_NAME, customerStatusDetail.getStatusName(), request);
        SessionUtils.setAttribute(SavingsConstants.FLAG_NAME, customerStatusDetail.getFlagName(), request);
    } else {
        SessionUtils.setAttribute(SavingsConstants.NEW_STATUS_NAME, null, request);
        SessionUtils.setAttribute(SavingsConstants.FLAG_NAME, null, request);
    }
    Short newStatusId = statusActionForm.getNewStatusIdValue();
    Short customerLevelId = statusActionForm.getLevelIdValue();
    List<CustomerCheckListBO> checklist = new CustomerPersistence().getStatusChecklist(newStatusId, customerLevelId);
    SessionUtils.setCollectionAttribute(SavingsConstants.STATUS_CHECK_LIST, checklist, request);
    if (statusActionForm.getNewStatusIdValue().equals(CustomerStatus.CLIENT_CLOSED.getValue())) {
        return createClientQuestionnaire.fetchAppliedQuestions(mapping, statusActionForm, request, ActionForwards.previewStatus_success);
    }
    return mapping.findForward(ActionForwards.previewStatus_success.toString());
}
Also used : CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) EditCustomerStatusActionForm(org.mifos.customers.struts.actionforms.EditCustomerStatusActionForm) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 8 with CustomerStatusDetailDto

use of org.mifos.dto.screen.CustomerStatusDetailDto in project head by mifos.

the class HomePageController method showPopulatedForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("customerSearch")
public ModelAndView showPopulatedForm(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("customerSearch") CustomerSearchFormBean customerSearchFormBean) throws MifosException, PersistenceException {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "home", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    Short userId = (short) user.getUserId();
    UserDetailDto userDetails = this.centerServiceFacade.retrieveUsersDetails(userId);
    modelAndView.addObject("customerSearch", customerSearchFormBean);
    boolean isCenterHierarchyExists = configurationServiceFacade.getBooleanConfig("ClientRules.CenterHierarchyExists");
    modelAndView.addObject("isCenterHierarchyExists", isCenterHierarchyExists);
    if (sitePreferenceHelper.isMobile(request)) {
        List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
        modelAndView.addObject("availibleClientGenders", availibleClientGenders);
        HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
        customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
        modelAndView.addObject("availibleCustomerStates", customerStates);
    }
    if (userDetails.isLoanOfficer()) {
        loadLoanOfficerCustomersHierarchyForSelectedDay(userId, modelAndView, customerSearchFormBean);
        modelAndView.addObject("isLoanOfficer", true);
    } else {
        modelAndView.addObject("isLoanOfficer", false);
    }
    return modelAndView;
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) MifosUser(org.mifos.security.MifosUser) UserDetailDto(org.mifos.dto.domain.UserDetailDto) IncludePage(freemarker.ext.servlet.IncludePage) ValueListElement(org.mifos.dto.domain.ValueListElement) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with CustomerStatusDetailDto

use of org.mifos.dto.screen.CustomerStatusDetailDto in project head by mifos.

the class SearchResultController method getSearchResultAjaxData.

@RequestMapping(value = "/searchResultAjaxData", method = RequestMethod.GET)
public ModelAndView getSearchResultAjaxData(HttpServletResponse response, @ModelAttribute("customerSearch") CustomerSearchFormBean customerSearchFormBean, @RequestParam(required = false) String sEcho, @RequestParam Integer iDisplayStart, @RequestParam Integer iDisplayLength) throws PersistenceException {
    ModelAndView modelAndView = new ModelAndView("searchResultAjaxData");
    CustomerHierarchyDto customerHierarchyDto = new CustomerHierarchyDto();
    boolean isCenterHierarchyExists = configurationServiceFacade.getBooleanConfig("ClientRules.CenterHierarchyExists");
    modelAndView.addObject("isCenterHierarchyExists", isCenterHierarchyExists);
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
    modelAndView.addObject("availibleCustomerStates", customerStates);
    List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
    modelAndView.addObject("availibleClientGenders", availibleClientGenders);
    if (customerSearchFormBean.getSearchString() != null && !customerSearchFormBean.getSearchString().isEmpty()) {
        customerHierarchyDto = customerSearchServiceFacade.search(customerSearchFormBean.getSearchString(), customerSearchFormBean.getOfficeId(), iDisplayStart, iDisplayLength, customerSearchFormBean.getFilters());
    }
    if (sEcho != null) {
        modelAndView.addObject("sEcho", sEcho);
    }
    modelAndView.addObject("customerHierarchy", customerHierarchyDto);
    modelAndView.addObject("iDisplayStart", iDisplayStart);
    modelAndView.addObject("iDisplayLength", iDisplayLength);
    return modelAndView;
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) CustomerHierarchyDto(org.mifos.dto.screen.CustomerHierarchyDto) ArrayList(java.util.ArrayList) ValueListElement(org.mifos.dto.domain.ValueListElement) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with CustomerStatusDetailDto

use of org.mifos.dto.screen.CustomerStatusDetailDto in project head by mifos.

the class SearchResultController method legacyShowSearchResults.

@RequestMapping(value = "/legacySearchResult", method = { RequestMethod.POST, RequestMethod.GET })
public ModelAndView legacyShowSearchResults(HttpServletRequest request, @ModelAttribute("customerSearch") @Valid CustomerSearchFormBean customerSearchFormBean, BindingResult result) throws PersistenceException {
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "legacySearchResult", request);
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    CustomerHierarchyDto customerHierarchyDto = null;
    List<OfficeDto> officeDtoList = officeServiceFacade.retrieveActiveBranchesUnderUser((short) user.getUserId());
    Map<String, String> officesMap = new HashMap<String, String>();
    for (OfficeDto officeDto : officeDtoList) {
        officesMap.put(officeDto.getId().toString(), officeDto.getName());
    }
    customerSearchFormBean.setOffices(officesMap);
    boolean isCenterHierarchyExists = configurationServiceFacade.getBooleanConfig("ClientRules.CenterHierarchyExists");
    modelAndView.addObject("isCenterHierarchyExists", isCenterHierarchyExists);
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
    modelAndView.addObject("availibleCustomerStates", customerStates);
    List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
    modelAndView.addObject("availibleClientGenders", availibleClientGenders);
    if (result.hasErrors()) {
        return modelAndView;
    }
    int currentPage = 0;
    if (request.getParameter("currentPage") != null) {
        currentPage = new Integer(request.getParameter("currentPage")).intValue();
    }
    modelAndView.addObject("customerSearch", customerSearchFormBean);
    if (customerSearchFormBean.getFilters() == null) {
        customerSearchFormBean.setFilters(new SearchFiltersDto());
    }
    customerHierarchyDto = customerSearchServiceFacade.search(customerSearchFormBean.getSearchString(), customerSearchFormBean.getOfficeId(), currentPage * PAGE_SIZE, PAGE_SIZE, customerSearchFormBean.getFilters());
    boolean prevPageAvailable = false;
    if (currentPage > 0) {
        prevPageAvailable = true;
    }
    boolean nextPageAvailable = false;
    if (customerHierarchyDto.getSize() / PAGE_SIZE > 0 && customerHierarchyDto.getSize() / PAGE_SIZE >= currentPage + 1) {
        nextPageAvailable = true;
    }
    modelAndView.addObject("isPrevPageAvailable", prevPageAvailable);
    modelAndView.addObject("isNextPageAvailable", nextPageAvailable);
    modelAndView.addObject("currentPage", currentPage);
    modelAndView.addObject("pageSize", PAGE_SIZE);
    modelAndView.addObject("customerHierarchy", customerHierarchyDto);
    return modelAndView;
}
Also used : OfficeDto(org.mifos.dto.domain.OfficeDto) CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) MifosUser(org.mifos.security.MifosUser) SearchFiltersDto(org.mifos.dto.screen.SearchFiltersDto) CustomerHierarchyDto(org.mifos.dto.screen.CustomerHierarchyDto) ValueListElement(org.mifos.dto.domain.ValueListElement) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CustomerStatusDetailDto (org.mifos.dto.screen.CustomerStatusDetailDto)11 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 ValueListElement (org.mifos.dto.domain.ValueListElement)8 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)5 CustSearchActionForm (org.mifos.customers.struts.actionforms.CustSearchActionForm)4 UserContext (org.mifos.security.util.UserContext)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ModelAndView (org.springframework.web.servlet.ModelAndView)4 CustomerHierarchyDto (org.mifos.dto.screen.CustomerHierarchyDto)3 MifosUser (org.mifos.security.MifosUser)3 CustomerLevel (org.mifos.customers.api.CustomerLevel)2 CustomerPersistence (org.mifos.customers.persistence.CustomerPersistence)2 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)2 OfficeDto (org.mifos.dto.domain.OfficeDto)2 UserDetailDto (org.mifos.dto.domain.UserDetailDto)2 SearchFiltersDto (org.mifos.dto.screen.SearchFiltersDto)2 IncludePage (freemarker.ext.servlet.IncludePage)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 CustomerStatusEntity (org.mifos.customers.business.CustomerStatusEntity)1