<zk>
	<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
	<window
		vflex="1"
		border="normal"
		apply="org.zkoss.bind.BindComposer"
		viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.TripRequirementList')">
		<include src="/app/toolbar.zul" />
		<listbox
			vflex="1"
			model="@load(vm.dataList)"
			selectedItem="@bind(vm.dataBean)"
			onAfterRender="@command('afterRender')"
			selectedIndex="@bind(vm.selIndex)">
			<listhead
				menupopup="auto"
				sizable="true">
				<listheader
					label="${labels.RequirementsGridNumberSerie}"
					sort="czech(numser)"
					width="180px" />
				<listheader
					label="${labels.RequirementsGridReqDate}"
					sort="auto(reqDate)"
					width="200px" />
				<listheader
					label="${labels.RequirementsGridCenter}"
					sort="auto(centre.fullName)" />
				<listheader
					label="${labels.RequirementsGridFrom}"
					sort="czech(from)" />
				<listheader
					label="${labels.RequirementsGridTo}"
					sort="czech(to)" />
			</listhead>
			<auxhead
				sclass="category-center"
				visible="@load(vm.filter)">
				<auxheader>
					<div sclass="find-grid-cell">
						<div sclass="find-grid-divtextbox">
							<textbox
								value="@bind(vm.filterTemplate.numser)"
								instant="true"
								onChange="@command('doFilter')"
								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">
							<datebox
								value="@bind(vm.filterTemplate.reqDate)"
								format="${labels.DateFormat}"
								instant="true"
								onChange="@command('doFilter')"
								sclass="find-grid-textbox"
								width="100%" />
						</div>
						<div sclass="find-grid-img">
							<image src="/img/funnel.png" />
						</div>
					</div>
				</auxheader>
				<auxheader>
					<div sclass="find-grid-cell">
						<combobox
							readonly="true"
							width="100%"
							selectedItem="@bind(vm.filterTemplate.centre)"
							model="@load(vm.myCentres)"
							ctrlKeys="${labels.HandleComboKeyFilter}"
							onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
							onChange="@command('doFilter')">
							<template name="model">
								<comboitem label="@load(each.fullName)" />
							</template>
						</combobox>
						<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.filterTemplate.from)"
								instant="true"
								onChange="@command('doFilter')"
								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.filterTemplate.to)"
								instant="true"
								onChange="@command('doFilter')"
								sclass="find-grid-textbox"
								maxlength="@load(vm.lengthText)"
								width="100%" />
						</div>
						<div sclass="find-grid-img">
							<image src="/img/funnel.png" />
						</div>
					</div>
				</auxheader>
			</auxhead>
			<template name="model">
				<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
					<listcell label="@load(each.numser)" />
					<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
					<listcell label="@load(each.centre.fullName)" />
					<listcell label="@load(each.from)" />
					<listcell label="@load(each.to)" />
				</listitem>
			</template>
		</listbox>
	</window>
</zk>