package com.ejie.ad74a.control;

import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.support.ByteArrayMultipartFileEditor;

import com.ejie.ad74a.util.comun.UtilLiterales;
import com.ejie.x38.util.DateTimeManager;

/**
 * SolicitantesController generated by UDA, 10-feb-2023 12:13:21.
 * 
 * @author UDA
 */

@Controller
@RequestMapping(value = "/plantillasRtf")

public class PlantillasRtfController {

	private static final Logger logger = LoggerFactory.getLogger(PlantillasRtfController.class);

	@Autowired

	@javax.annotation.Resource
	private ReloadableResourceBundleMessageSource appMessageSource;

	@InitBinder
	protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws ServletException {
		binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
		binder.registerCustomEditor(Date.class,
				new CustomDateEditor(DateTimeManager.getDateTimeFormat(LocaleContextHolder.getLocale()), true));
	}

	/**
	 * Metodo de presentacion del RUP_TABLE.
	 * 
	 * @param model Model
	 * @return String
	 */
	@RequestMapping(value = "/maint", method = RequestMethod.GET)
	public String getFormEdit(Model model, HttpServletRequest request) {
		PlantillasRtfController.logger.info("[GET - View] : plantillasRtf");

		model.addAttribute("title", UtilLiterales.getLiteralMessage(appMessageSource, "Plantillas Rtf"));

		return "plantillasRtf";
	}

	/**
	 * Metodo de presentacion del RUP_TABLE.
	 * 
	 * @param model Model
	 * @return String
	 */
	@RequestMapping(value = "/submit", method = RequestMethod.GET)
	public String submit(Model model, HttpServletRequest request) {
		PlantillasRtfController.logger.info("[GET - View] : submit");

		return "plantillasRtf";
	}

}
