<?page title="${labels.AgendaServices}" contentType="text/html;charset=UTF-8"?>
<zk>
	<window
		id="selectItemsWnd"
		width="95%"
		height="95%"
		closable="true"
		border="normal"
		position="center"
		apply="org.zkoss.bind.BindComposer"
		viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.services.SelectServicesItems')">
		<caption
			src="/img/painting-032.png"
			zclass="form-caption"
			label="${labels.AgendaServices}" />
		<vlayout vflex="1">
			<toolbar>
				<toolbarbutton
					image="/img/funnel.png"
					tooltiptext="${labels.ToolbarRecFilter}"
					id="btnFilterService"
					onClick="@command('onFilterService')" />
			</toolbar>
			<listbox
				vflex="1"
				model="@load(vm.serviceItemList)"
				selectedItem="@bind(vm.selectedItem)">
				<listhead menupopup="auto">
					<listheader
						label="${labels.code}"
						sort="czech(code)"
						width="10%" />
					<listheader
						label="${labels.name}"
						sort="czech(name)"
						width="30%" />
					<listheader
						label="${labels.description}"
						sort="czech(description)"
						width="60%" />
				</listhead>
				<auxhead
					sclass="category-center"
					visible="@load(vm.activeFilterService)">
					<auxheader>
						<div sclass="find-grid-cell">
							<div sclass="find-grid-divtextbox">
								<textbox
									value="@bind(vm.filterTmpService.code)"
									instant="true"
									onChange="@command('doFilterService')"
									maxlength="@load(vm.lengthText)"
									sclass="find-grid-textbox" />
							</div>
							<div sclass="find-grid-img">
								<image src="/img/funnel.png" />
							</div>
						</div>
					</auxheader>
					<auxheader>
						<div sclass="find-grid-cell">
							<div sclass="find-grid-divtextbox">
								<textbox
									value="@bind(vm.filterTmpService.name)"
									instant="true"
									onChange="@command('doFilterService')"
									maxlength="@load(vm.lengthText)"
									sclass="find-grid-textbox" />
							</div>
							<div sclass="find-grid-img">
								<image src="/img/funnel.png" />
							</div>
						</div>
					</auxheader>
					<auxheader>
						<div sclass="find-grid-cell">
							<div sclass="find-grid-divtextbox">
								<textbox
									value="@bind(vm.filterTmpService.description)"
									instant="true"
									onChange="@command('doFilterService')"
									maxlength="@load(vm.lengthDescription)"
									sclass="find-grid-textbox" />
							</div>
							<div sclass="find-grid-img">
								<image src="/img/funnel.png" />
							</div>
						</div>
					</auxheader>
				</auxhead>
				<template name="model">
					<listitem>
						<listcell label="@load(each.code)" />
						<listcell label="@load(each.name)" />
						<listcell label="@load(each.description)" />
					</listitem>
				</template>
			</listbox>
		</vlayout>
		<vlayout>
			<div align="right">
				<button
					image="~./zul/img/misc/drag-disallow.png"
					label="${labels.ButtonStorno}"
					onClick="selectItemsWnd.detach()"
					sclass="nicebutton" />
				<button
					image="/img/item-add.png"
					label="${labels.AddItem}"
					onClick="@global-command('insertSelectedItem', selected=vm.selectedItem, window=selectItemsWnd)"
					disabled="@load(empty vm.selectedItem ? 'true' : 'false')"
					sclass="nicebutton" />
			</div>
		</vlayout>
	</window>
</zk>