<?page title="${labels.BuildingsFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
	<window
		id="editWin"
		closable="true"
		border="normal"
		position="center"
		apply="org.zkoss.bind.BindComposer"
		viewModel="@id('vm') @init('info.bukova.isspst.ui.buildings.BuildingForm')"
		width="750px">
		<caption
			image="/img/house-032.png"
			zclass="form-caption"
			label="${labels.BuildingsFormTitle}" />
		<vlayout>
			<grid hflex="min">
				<columns>
					<column
						align="right"
						hflex="min" />
					<column />
				</columns>
				<rows>
					<row>
						<cell sclass="row-title">${labels.BuildingsFormCode} :</cell>
						<cell>
							<textbox
								id="code"
								constraint="@load(vm.constriant)"
								width="200px"
								maxlength="@load(vm.lengthText)"
								value="@bind(vm.dataBean.code)" />
						</cell>
					</row>
					<row>
						<cell sclass="row-title">${labels.BuildingsFormName} :</cell>
						<cell>
							<textbox
								id="name"
								width="200px"
								maxlength="@load(vm.lengthText)"
								value="@bind(vm.dataBean.name)" />
						</cell>
					</row>
					<row>
						<cell sclass="row-title">${labels.BuildingsFormDescription} :</cell>
						<cell>
							<textbox
								id="description"
								width="300px"
								maxlength="@load(vm.lengthDescription)"
								value="@bind(vm.dataBean.description)" />
						</cell>
					</row>
				</rows>
			</grid>
			<button
				image="/img/item-add.png"
				label="${labels.BuildingsFormAddRoom}"
				onClick="@command('addRoom')" />
			<listbox model="@load(vm.dataBean.rooms)">
				<listhead>
					<listheader label="${labels.code}" />
					<listheader label="${labels.name}" />
					<listheader label="${labels.shortcut}" />
					<listheader label="${labels.number}" />
					<listheader label="${labels.floor}" />
					<listheader />
				</listhead>
				<template name="model">
					<listitem>
						<listcell>
							<textbox
								inplace="true"
								maxlength="@load(vm.lengthText)"
								value="@bind(each.code)" />
						</listcell>
						<listcell>
							<textbox
								inplace="true"
								maxlength="@load(vm.lengthText)"
								value="@bind(each.name)" />
						</listcell>
						<listcell>
							<textbox
								inplace="true"
								maxlength="@load(vm.lengthText)"
								value="@bind(each.shortcut)" />
						</listcell>
						<listcell>
							<textbox
								inplace="true"
								maxlength="@load(vm.lengthText)"
								value="@bind(each.number)" />
						</listcell>
						<listcell>
							<textbox
								inplace="true"
								maxlength="@load(vm.lengthText)"
								value="@bind(each.floor)" />
						</listcell>
						<listcell>
							<button
								image="/img/item-remove.png"
								label="${labels.BuildingsFormRemove}"
								onClick="@command('removeRoom', room=each)" />
						</listcell>
					</listitem>
				</template>
			</listbox>
			<include src="/app/formButtons.zul" />
		</vlayout>
	</window>
</zk>