<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.TripRequirementListWorkgroup')">
		<include src="/main/toolbar.zul" />
		<hbox vflex="1">
			<listbox
				model="@load(vm.dataList)"
				selectedItem="@bind(vm.dataBean)"
				hflex="7"
				onAfterRender="@command('afterRender')"
				selectedIndex="@bind(vm.selIndex)"
				vflex="1">
				<listhead menupopup="auto">
					<listheader
						label="${labels.RequirementsGridNumberSerie}"
						sort="czech(numser)"
						width="10%" />
					<listheader
						label="${labels.RequirementsGridReqDate}"
						sort="auto(reqDate)"
						width="13%" />
					<listheader
						label="${labels.RequirementsGridCenter}"
						sort="auto(centre.fullName)"
						width="10%" />
					<listheader
						label="${labels.RequirementsGridWorkgroup}"
						sort="auto(workgroup.fullName)"
						width="10%" />
					<listheader
						label="${labels.RequirementsGridFrom}"
						sort="czech(from)"
						width="30%" />
					<listheader
						label="${labels.RequirementsGridTo}"
						sort="czech(to)"
						width="30%" />
					<listheader
						label="${labels.RequirementsGridOwnedBy}"
						sort="auto(ownedBy.fullName)"
						width="20%" />
				</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">
							<combobox
								readonly="true"
								width="100%"
								selectedItem="@bind(vm.filterTemplate.workgroup)"
								model="@load(vm.myWorkgroups)"
								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>
					<auxheader>
						<div zclass="find-grid-cell">
							<div sclass="find-grid-divtextbox">
								<combobox
									ctrlKeys="${labels.HandleComboKeyFilter}"
									onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
									onChange="@command('doFilter')"
									width="100%"
									selectedItem="@bind(vm.filterTemplate.ownedBy)"
									model="@load(vm.allUsers)"
									readonly="true">
									<template name="model">
										<comboitem label="@load(each.fullName)" />
									</template>
								</combobox>
							</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.workgroup.fullName)" />
						<listcell label="@load(each.from)" />
						<listcell label="@load(each.to)" />
						<listcell label="@load(each.ownedBy)" />
					</listitem>
				</template>
			</listbox>
			<div hflex="3">
				<include src="/main/approveStatus.zul" />
			</div>
		</hbox>
	</window>
</zk>