package info.bukova.isspst.ui.main.orders.material;

import info.bukova.isspst.data.RequirementSubject;
import info.bukova.isspst.services.reqsubjects.MaterialService;
import info.bukova.isspst.ui.main.orders.requirements.RequirementForm;
import info.bukova.isspst.ui.main.orders.services.ReqServicesForm;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;

public class ReqMaterialForm extends RequirementForm
{
	@SuppressWarnings("unused")
	private final static Logger log = LoggerFactory.getLogger(ReqServicesForm.class.getName());

	@WireVariable
	private MaterialService materialService;

	@SuppressWarnings("unchecked")
	@Init(superclass = true)
	public void initReqMaterialForm()
	{
		// Získat seznam všech skupin materiálu pro výběr z comba
		this.setRequirementGroups((List<RequirementSubject>) (List<?>) materialService.getAll());
	}

	@Command
	public void addSelectedItem()
	{
		Window window = (Window) Executions.createComponents("/main/orders/material/selectMaterial.zul", null, null);
		window.doModal();
	}
}
