<?page title="${labels.AgendaRights}" 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.PermissionsList')" 
	vflex="1">
	<caption zclass="form-caption" label="${labels.AgendaRights}" />
	<toolbar>
		<toolbarbutton image="/img/edit.png" tooltiptext="${labels.ToolbarRecEdit}" id="btnEdit" onClick="@command('edit')" disabled="@load(empty vm.dataBean ? 'true' : 'false')"/>
	</toolbar>
	
	<hbox width="100%" vflex="1">	
	<listbox model="@load(vm.dataList)" 
		selectedItem="@bind(vm.dataBean)" 
		width="300px">
		<listhead>
			<listheader label="${labels.RightsGridRole}" />
		</listhead>
		<template name="model">
			<listitem>
				<listcell label="@load(each.description)"/>
			</listitem>
		</template>
	</listbox>
	<panel hflex="1" vflex="1">
		<panelchildren style="overflow:auto;">
			<label value="${labels.RightsGridModules}:" 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.dataBean.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>