<?page title="${labels.AgendaUsers}" 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.users.UsersList')" 
		vflex="1">
		<caption zclass="form-caption" label="${labels.AgendaUsers}" />
		<include src="/app/toolbar.zul" />

		<hbox width="100%" vflex="1">
			<listbox model="@load(vm.dataList)" 
				selectedItem="@bind(vm.dataBean)" 
				width="650px" 
				vflex="1">
				<listhead menupopup="auto">
					<listheader label="${labels.UsersGridColumnLogin}" sort="czech(username)" />
					<listheader label="${labels.UsersGridColumnPersonalID}" sort="czech(personalNumber)" />
					<listheader label="${labels.UsersGridColumnFirstName}" sort="czech(firstName)" />
					<listheader label="${labels.UsersGridColumnSureName}" sort="czech(lastName)" />
				</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.username)"
									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.personalNumber)"
									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.firstName)"
									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.lastName)"
									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>
				</auxhead>

				<template name="model">
					<listitem>
						<listcell label="@load(each.username)" />
						<listcell label="@load(each.personalNumber)" />
						<listcell label="@load(each.firstName)" />
						<listcell label="@load(each.lastName)" />
					</listitem>
				</template>
			</listbox>
			<panel hflex="1" vflex="1" width="70%">
				<panelchildren style="overflow:auto;">
					<label value="Efektivní práva:" style="font-weight: bold;" />
					<vbox children="@load(vm.modules)" hflex="1">
						<template name="children" var="module">
							<groupbox closable="false" mold="3d" hflex="1">
								<caption label="@load(module.name)" />
								<hbox children="@load(vm.permissions)">
									<template name="children" var="perm">
										<label value="@load(perm.description.concat(', '))" visible="@load(module.id eq perm.module)" />
									</template>
								</hbox>
							</groupbox>
						</template>
					</vbox>
				</panelchildren>

			</panel>

		</hbox>

	</window>
</zk>