package com.rjconsultores.ventaboletos.web.utilerias.render;

import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout;

public class RenderEmpresaEmpresaConfigLayout implements ListitemRenderer {

	@Override
	public void render(Listitem listItem, Object selected) throws Exception {
		
		Listcell lc = new Listcell();
		
		if (selected != null) {
			EmpresaConfigLayout empresaConfigLayout = (EmpresaConfigLayout) selected;
			
			lc = new Listcell(empresaConfigLayout.getTipoVenta() != null ? empresaConfigLayout.getTipoVenta().getDesctipoventa(): "");
			lc.setParent(listItem);
			
			lc = new Listcell(
					empresaConfigLayout.getImpresionlayoutconfigId() != null
							? empresaConfigLayout.getImpresionlayoutconfigId().getDescricao() + " - "
									+ empresaConfigLayout.getImpresionlayoutconfigId().getLinguagem().name()
							: "");
			lc.setParent(listItem);
			
			lc = new Listcell();
			boolean indEmail = empresaConfigLayout.getIndEmail() != null ? empresaConfigLayout.getIndEmail() : false;
			Checkbox chk = new Checkbox();
			chk.setDisabled(Boolean.TRUE);
			chk.setChecked(indEmail);
			lc.appendChild(chk);
			lc.setParent(listItem);
			
			listItem.setAttribute("data", empresaConfigLayout);
		}
	}
}