<?page title="${labels.ApprovedRequirementItems}" contentType="text/html;charset=UTF-8"?>
<?taglib uri="/WEB-INF/security.tld" prefix="sec"?>
<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.main.approved.ApprovedList')">
		<caption
			image="/img/hammer-032.png"
			zclass="form-caption"
			label="${labels.ApprovedRequirementItems}" />
		<toolbar>
			<toolbarbutton
				image="/img/funnel.png"
				tooltiptext="${labels.ToolbarRecFilter}"
				id="btnFilter"
				onClick="@command('filter')" />
			<toolbarbutton
				image="/img/print.png"
				tooltiptext="${labels.ToolbarPrint}"
				id="btnPrint"
				onClick="@command('onPrint')" />
		</toolbar>
		<listbox
			multiple="true"
			checkmark="true"
			vflex="1"
			selectedItems="@bind(vm.selectedItems)"
			model="@load(vm.dataList)">
			<listhead menupopup="auto">
				<listheader width="27" />
				<listheader
					hflex="7"
					sort="czech(code)"
					label="${labels.RequirementItemCode}" />
				<listheader
					hflex="15"
					sort="czech(name)"
					label="${labels.RequirementItemName}" />
				<listheader
					hflex="20"
					sort="czech(textItem)"
					label="${labels.RequirementItemText}" />
				<listheader
					hflex="5"
					sort="auto(quantity)"
					align="right"
					label="${labels.RequirementItemQuantity}" />
				<listheader
					hflex="5"
					sort="auto(munit.name)"
					label="${labels.RequirementItemMUnit}" />
				<listheader
					hflex="7"
					align="right"
					sort="auto(unitPrice)"
					label="${labels.RequirementItemUnitPrice}" />
				<listheader
					hflex="7"
					align="right"
					sort="auto(total)"
					label="${labels.RequirementItemTotal}" />
				<listheader
					hflex="7"
					sort="auto(workgroup.fullName)"
					label="${labels.RequirementsGridWorkgroup}" />
				<listheader
					hflex="7"
					sort="auto(centre.fullName)"
					label="${labels.RequirementsGridCenter}" />
				<listheader
					hflex="7"
					sort="auto(ownedBy.fullName)"
					label="${labels.Owner}" />
				<listheader
					hflex="15"
					sort="czech(description)"
					label="${labels.RequirementItemDescription}" />
			</listhead>
			<auxhead visible="@load(vm.filter)">
				<auxheader />
				<auxheader>
					<div sclass="find-grid-cell">
						<div sclass="find-grid-divtextbox">
							<textbox
								value="@bind(vm.filterTemplate.code)"
								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.name)"
								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.textItem)"
								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-img-left">
						<image src="/img/funnel.png" />
						</div>
						<div sclass="find-grid-divtextbox">
						<textbox
						value="@bind(vm.filterTemplate.quantity)"
						instant="true"
						onChange="@command('doFilter')"
						maxlength="@load(vm.lengthText)"
						sclass="find-grid-textbox-right" />
						</div>
						</div-->
				</auxheader>
				<auxheader>
					<div sclass="find-grid-cell">
						<div sclass="find-grid-divtextbox">
							<textbox
								value="@bind(vm.filterTemplate.munit.name)"
								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-img-left">
						<image src="/img/funnel.png" />
						</div>
						<div sclass="find-grid-divtextbox">
						<textbox
						value="@bind(vm.filterTemplate.unitPrice)"
						instant="true"
						onChange="@command('doFilter')"
						maxlength="@load(vm.lengthText)"
						sclass="find-grid-textbox-right" />
						</div>
						</div-->
				</auxheader>
				<auxheader>
					<!-- div sclass="find-grid-cell">
						<div sclass="find-grid-img-left">
						<image src="/img/funnel.png" />
						</div>
						<div sclass="find-grid-divtextbox">
						<textbox
						value="@bind(vm.filterTemplate.total)"
						instant="true"
						onChange="@command('doFilter')"
						maxlength="@load(vm.lengthText)"
						sclass="find-grid-textbox-right" />
						</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.workgroup)"
								model="@load(vm.workgroups)"
								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>
				<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.centre)"
								model="@load(vm.centers)"
								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>
				<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.users)"
								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>
				<auxheader>
					<div sclass="find-grid-cell">
						<div sclass="find-grid-divtextbox">
							<textbox
								value="@bind(vm.filterTemplate.description)"
								instant="true"
								onChange="@command('doFilter')"
								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 context="popupMenu">
					<listcell />
					<listcell label="@load(each.code)" />
					<listcell label="@load(each.name)" />
					<listcell label="@load(each.textItem)" />
					<listcell label="@load(each.quantity) @converter(vm.bigDecimalConverter)" />
					<listcell label="@load(each.munit.name)" />
					<listcell label="@load(each.unitPrice) @converter(vm.bigDecimalConverter)" />
					<listcell label="@load(each.total) @converter(vm.bigDecimalConverter)" />
					<listcell label="@load(each.workgroup.fullName)" />
					<listcell label="@load(each.centre.fullName)" />
					<listcell label="@load(each.ownedBy.fullName)" />
					<listcell label="@load(each.description)" />
				</listitem>
			</template>
		</listbox>
		<menupopup id="popupMenu">
			<menuitem
				image="/img/autotruck-016.png"
				label="${labels.CreateOrder}..."
				onClick="@command('onCreateOrder')"
				disabled="${not sec:isAllGranted('PERM_READ_ORDER')}" />
		</menupopup>
	</window>
</zk>