Subversion Repositories SmartDukaan

Rev

Rev 35340 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.controller;

import com.spice.profitmandi.common.model.ProfitMandiConstants;
import com.spice.profitmandi.dao.entity.fofo.TrialForm;
import com.spice.profitmandi.dao.repository.trialOnboarding.TrialFormRepository;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.transaction.Transactional;
import java.util.List;

@Controller
@Transactional(rollbackOn = Throwable.class)
public class TrialController {

    private static final Logger LOGGER = LogManager.getLogger(TrialController.class);
    @Autowired
    TrialFormRepository trialFormRepository;

    @RequestMapping(value = "/trial/pending", method = RequestMethod.GET)
    public String getTrialPending(HttpServletRequest request, Model model) throws Exception {
        List<TrialForm> trialForms = trialFormRepository.selectAllByStatus(ProfitMandiConstants.Status.PENDING);
        LOGGER.info("trialForms {}", trialForms.size());
        model.addAttribute("trialForms", trialForms);
        return "trial-form";
    }

    @RequestMapping(value = "/trial/create/{trialFormId}", method = RequestMethod.GET)
    public String getTrialPending(HttpServletRequest request, Model model, @PathVariable int trialFormId) throws Exception {
        TrialForm trialForm = trialFormRepository.selectById(trialFormId);

        return "trial-form";
    }
}