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

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

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 ReqServicesForm extends RequirementForm
{
	@SuppressWarnings("unused")
	private final static Logger log = LoggerFactory.getLogger(ReqServicesForm.class.getName());

	@WireVariable
	private ServiceItemService serviceItemService;

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

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