<?page title="${labels.AgendaActRequirements}" contentType="text/html;charset=UTF-8"?>
<zk>
	<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
	<window
		border="normal"
		apply="org.zkoss.bind.BindComposer"
		viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.TripRequirementList')">
		<caption
			zclass="form-caption"
			label="${labels.AgendaActRequirements}" />
		
		<tabbox>
			<tabs>
				<tab label="${labels.RequirementsGridMy}"/>
				<tab label="${labels.RequirementsGridMyCentres}" disabled="@load(not vm.showCentre)"/>
				<tab label="${labels.RequirementsGridMyWorkgroups}" disabled="@load(not vm.showWorkgroup)"/>
				<tab label="${labels.RequirementsGridAll}" disabled="@load(not vm.showAll)"/>
			</tabs>
			
			<tabpanels>
				<tabpanel>
					<include src="/app/toolbar.zul" />
					<listbox
						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)"
								 />
							<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')"
											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)"
										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')"
											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"
											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>		
				</tabpanel>
				
				<tabpanel apply="org.zkoss.bind.BindComposer" 
					viewModel="@id('vmSub') @init('info.bukova.isspst.ui.requirement.TripRequirementListCentre')">
					<include src="/requirements/toolbar.zul"/>
				
					<hbox width="100%">					
					<listbox
						model="@load(vmSub.dataList)"
						selectedItem="@bind(vmSub.dataBean)"
						hflex="7"
						onAfterRender="@command('afterRender')"
						selectedIndex="@bind(vmSub.selIndex)">
						<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)"
								width="10%" />
							<listheader
								label="${labels.RequirementsGridFrom}"
								sort="auto(from)"
								width="40%" />
							<listheader
								label="${labels.RequirementsGridTo}"
								sort="czech(to)"
								width="40%" />
							<listheader
								label="${labels.RequirementsGridOwnedBy}"
								sort="auto(ownedBy)"
								width="20%" />
						</listhead>
						<auxhead
							sclass="category-center"
							visible="@load(vmSub.filter)">
							<auxheader>
								<div sclass="find-grid-cell">
									<div sclass="find-grid-divtextbox">
										<textbox
											value="@bind(vmSub.filterTemplate.numser)"
											instant="true"
											onChange="@command('doFilter')"
											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(vmSub.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(vmSub.filterTemplate.centre)"
										model="@load(vmSub.myCentres)"
										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(vmSub.filterTemplate.from)"
											instant="true"
											onChange="@command('doFilter')"
											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(vmSub.filterTemplate.to)"
											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">
									<div sclass="find-grid-divtextbox">
										<textbox
											value="@bind(vmSub.filterTemplate.ownedBy.lastName)"
											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>
						</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)"/>
								<listcell label="@load(each.ownedBy)"/>
							</listitem>
						</template>
					</listbox>
					
					<div hflex="3">
						<include src="/requirements/approveStatus.zul"/>
					</div>
					
					</hbox>
				</tabpanel>
				
				<tabpanel apply="org.zkoss.bind.BindComposer"
					viewModel="@id('vmSub') @init('info.bukova.isspst.ui.requirement.TripRequirementListWorkgroup')">
					<include src="/requirements/toolbar.zul"/>
					<hbox width="100%">
					<listbox
						model="@load(vmSub.dataList)"
						selectedItem="@bind(vmSub.dataBean)"
						hflex="7"
						onAfterRender="@command('afterRender')"
						selectedIndex="@bind(vmSub.selIndex)">
						<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)"
								width="10%" />
							<listheader
								label="${labels.RequirementsGridWorkgroup}"
								sort="auto(workgroup)"
								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)"
								width="20%" />
						</listhead>
						<auxhead
							sclass="category-center"
							visible="@load(vmSub.filter)">
							<auxheader>
								<div sclass="find-grid-cell">
									<div sclass="find-grid-divtextbox">
										<textbox
											value="@bind(vmSub.filterTemplate.numser)"
											instant="true"
											onChange="@command('doFilter')"
											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(vmSub.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(vmSub.filterTemplate.centre)"
										model="@load(vmSub.myCentres)"
										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(vmSub.filterTemplate.workgroup)"
										model="@load(vmSub.myWorkgroups)"
										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(vmSub.filterTemplate.from)"
											instant="true"
											onChange="@command('doFilter')"
											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(vmSub.filterTemplate.to)"
											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">
									<div sclass="find-grid-divtextbox">
										<textbox
											value="@bind(vmSub.filterTemplate.ownedBy.lastName)"
											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>
						</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="/requirements/approveStatus.zul"/>
					</div>
					
					</hbox>
				</tabpanel>
				
				<tabpanel apply="org.zkoss.bind.BindComposer"
					viewModel="@id('vmSub') @init('info.bukova.isspst.ui.requirement.TripRequirementListAll')">
					<include src="/requirements/toolbar.zul"/>
					<hbox width="100%">
					<listbox
						model="@load(vmSub.dataList)"
						selectedItem="@bind(vmSub.dataBean)"
						hflex="7"
						onAfterRender="@command('afterRender')"
						selectedIndex="@bind(vmSub.selIndex)">
						<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)"
								width="10%" />
							<listheader
								label="${labels.RequirementsGridWorkgroup}"
								sort="auto(workgroup)"
								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)"
								width="20%" />
						</listhead>
						<auxhead
							sclass="category-center"
							visible="@load(vmSub.filter)">
							<auxheader>
								<div sclass="find-grid-cell">
									<div sclass="find-grid-divtextbox">
										<textbox
											value="@bind(vmSub.filterTemplate.numser)"
											instant="true"
											onChange="@command('doFilter')"
											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(vmSub.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(vmSub.filterTemplate.centre)"
										model="@load(vmSub.allCentres)"
										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(vmSub.filterTemplate.workgroup)"
										model="@load(vmSub.allWorkgroups)"
										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(vmSub.filterTemplate.from)"
											instant="true"
											onChange="@command('doFilter')"
											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(vmSub.filterTemplate.to)"
											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">
									<div sclass="find-grid-divtextbox">
										<textbox
											value="@bind(vmSub.filterTemplate.ownedBy.lastName)"
											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>
						</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="/requirements/approveStatus.zul"/>
					</div>
					
					</hbox>
				</tabpanel>
			</tabpanels>
		</tabbox>
		
		
		
	</window>
</zk>