package com.rms.tfc.web;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.rms.tfc.entity.Pedido;
import com.rms.tfc.service.PedidoService;

@Controller
public class PedidosPendientesController {

	@Resource
	private PedidoService pedidoService;
	
	@RequestMapping("/PedidosPendientes.html")
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List<Pedido> listaPedidos = pedidoService.getAllPedidosPendientes();
		if (listaPedidos == null){
			listaPedidos = new ArrayList<Pedido>();
		}
		return new ModelAndView("pedidosPendientes", "objetoJSP", listaPedidos);
    }

	public void setPedidoService(PedidoService pedidoService) {
		this.pedidoService = pedidoService;
	}
}