<vn>
<vn-group>
	<vn-param id="address"/>
	<vn-hash-param key="address" param="address"/>
	<db-form id="iter" on-status-changed="onStatusChange">
		<db-model
		 	id="model"
			property="model"
			updatable="true"
			mode="ON_DEMAND"
			on-operations-done="onOperationsDone">
			SELECT a.id, a.street, a.nickname, a.city,
					a.postalCode, a.provinceFk, c.id countryFk
				FROM myAddress a
					LEFT JOIN vn.province p ON p.id = a.provinceFk
					JOIN vn.country c ON c.id = p.countryFk
				WHERE a.id = #address
			<sql-batch property="batch">
				<custom>
					<item name="address" param="address"/>
				</custom>
			</sql-batch>
		</db-model>
	</db-form>
</vn-group>
<div id="title">
	<h1><t>AddEditAddress</t></h1>
</div>
<div id="actions">
	<htk-bar-button
		icon="ok"
		tip="_Accept"
		on-click="onAcceptClick"/>
	<htk-bar-button
		icon="close"
		tip="_Return"
		on-click="onReturnClick"/>
</div>
<div id="form" class="address">
	<div class="box">
		<div class="form">
			<div class="form-group">
				<label><t>Name</t></label>
				<htk-entry column="nickname" form="iter"/>
			</div>
			<div class="form-group">
				<label><t>Address</t></label>
				<htk-entry column="street" form="iter"/>
			</div>
			<div class="form-group">
				<label><t>City</t></label>
				<htk-entry column="city" form="iter"/>
			</div>
			<div class="form-group">
				<label><t>ZipCode</t></label>
				<htk-entry column="postalCode" form="iter"/>
			</div>
			<div class="form-group">
				<label><t>Country</t></label>
				<htk-combo>
					<db-param
						id="country"
						property="param"
						form="iter"
						column="countryFk"
						one-way="true"/>
					<db-model property="model">
						SELECT id, country FROM vn.country
							ORDER BY country
					</db-model>
				</htk-combo>
			</div>
			<div class="form-group">
				<label><t>Province</t></label>
				<htk-combo column="provinceFk" form="iter">
					<db-model property="model">
						SELECT id, name FROM vn.province
							WHERE countryFk = #country
							ORDER BY name
						<sql-batch property="batch">
							<custom>
								<item name="country" param="country"/>
							</custom>
						</sql-batch>
					</db-model>
				</htk-combo>
			</div>
		</div>
	</div>
</div>
</vn>
