/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rjconsultores.ventaboletos.web.utilerias.render;

import com.rjconsultores.ventaboletos.entidad.PricingDia;
import java.text.SimpleDateFormat;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

/**
 * 
 * @author Rafius
 */
public class RenderPricingDia implements ListitemRenderer {

	public void render(Listitem lstm, Object o) throws Exception {
		PricingDia pc = (PricingDia) o;

		Listcell lc = new Listcell();

		SimpleDateFormat sf = new SimpleDateFormat("HH:mm");
		if (pc.getPricingdiaId() != null) {
			lc = new Listcell(sf.format(pc.getHorarioinicio()));
		} else {
			lc = new Listcell("-");
		}
		lc.setParent(lstm);

		if (pc.getPricingdiaId() != null) {
			lc = new Listcell(sf.format(pc.getHorariofin()));
		} else {
			lc = new Listcell("-");
		}
		lc.setParent(lstm);

		// Lunes
		Checkbox ckbLun = new Checkbox();
		if (pc.getIndlunes() == Boolean.TRUE) {
			ckbLun.setChecked(true);
		} else {
			ckbLun.setChecked(false);
		}
		ckbLun.setDisabled(true);
		lc = new Listcell();
		ckbLun.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbMar = new Checkbox();
		if (pc.getIndmartes() == Boolean.TRUE) {
			ckbMar.setChecked(true);
		} else {
			ckbMar.setChecked(false);
		}
		ckbMar.setDisabled(true);
		lc = new Listcell();
		ckbMar.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbMie = new Checkbox();
		if (pc.getIndmiercoles() == Boolean.TRUE) {
			ckbMie.setChecked(true);
		} else {
			ckbMie.setChecked(false);
		}
		ckbMie.setDisabled(true);
		lc = new Listcell();
		ckbMie.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbJue = new Checkbox();
		if (pc.getIndjueves() == Boolean.TRUE) {
			ckbJue.setChecked(true);
		} else {
			ckbJue.setChecked(false);
		}
		ckbJue.setDisabled(true);
		lc = new Listcell();
		ckbJue.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbVie = new Checkbox();
		if (pc.getIndviernes() == Boolean.TRUE) {
			ckbVie.setChecked(true);
		} else {
			ckbVie.setChecked(false);
		}
		ckbVie.setDisabled(true);
		lc = new Listcell();
		ckbVie.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbSab = new Checkbox();
		if (pc.getIndsabado() == Boolean.TRUE) {
			ckbSab.setChecked(true);
		} else {
			ckbSab.setChecked(false);
		}
		ckbSab.setDisabled(true);
		lc = new Listcell();
		ckbSab.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbDom = new Checkbox();
		if (pc.getInddomingo() == Boolean.TRUE) {
			ckbDom.setChecked(true);
		} else {
			ckbDom.setChecked(false);
		}
		ckbDom.setDisabled(true);
		lc = new Listcell();
		ckbDom.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbFecventa = new Checkbox();
		if (pc.getIndfecventa() == Boolean.TRUE) {
			ckbFecventa.setChecked(true);
		} else {
			ckbFecventa.setChecked(false);
		}
		ckbFecventa.setDisabled(true);
		lc = new Listcell();
		ckbFecventa.setParent(lc);
		lc.setParent(lstm);

		Checkbox ckbFecviaje = new Checkbox();
		if (pc.getIndfecviaje() == Boolean.TRUE) {
			ckbFecviaje.setChecked(true);
		} else {
			ckbFecviaje.setChecked(false);
		}
		ckbFecviaje.setDisabled(true);
		lc = new Listcell();
		ckbFecviaje.setParent(lc);
		lc.setParent(lstm);

		lstm.setAttribute("data", pc);
	}
}
