<?page title="email" contentType="text/html;charset=UTF-8"?>
<zk
	xmlns="http://www.zkoss.org/2005/zul"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
	<tabbox id="idTabBoxEmails">
		<tabs>
			<tab
				id="idTabEmailsNewRequirement"
				label="${labels.NewRequirement}" />
			<tab
				id="idTabEmailsAuthRequirement"
				label="${labels.AuthRequirement}" />
			<tab
				id="idTabEmailsConfirmRequirement"
				label="${labels.ConfirmRequirement}" />
			<tab
				id="idTabEmailsReqTripPassengers"
				label="${labels.ReqTripPassengers}" />
			<tab
				id="idTabEmailsConfirmTripPassengers"
				label="${labels.ConfirmTripPassengers}" />
		</tabs>
		<tabpanels>
			<tabpanel>
				<grid>
					<columns>
						<column hflex="min" />
						<column />
					</columns>
					<rows>
						<row>
							<label value="${labels.MailSubject}" />
							<textbox
								id="idEmailNewReqTemplateSubject"
								instant="true"
								value="@bind(vm.settings.newReqTemplate.subject)"
								width="100%"
								maxlength="@load(vm.lengthText)"
								readonly="@load(not vm.canSave)" />
						</row>
						<row spans="2">
							<vbox>
								<ckeditor
									toolbar="Basic"
									value="@bind(fx.newReqTemplate.text)"
									width="460px"
									height="180px"
									if="${vm.canSave}" />
								<html
									id="idEmailNewReqTemplateText"
									content="@load(vm.settings.newReqTemplate.text)"
									width="460px"
									height="180px"
									if="${not vm.canSave}" />
								<hbox>
									<button
										label="${labels.InsertField}"
										popup="fieldsNew, position=after_start"
										disabled="@load(not vm.canSave)" />
									<button
										label="${labels.GlobalSettingsInsertUrl}"
										onClick="@command('insertUrl2Fx', form=fx, property='newReqTemplate.text')"
										disabled="@load(not vm.canSave)" />
								</hbox>
							</vbox>
						</row>
					</rows>
				</grid>
			</tabpanel>
			<tabpanel>
				<grid>
					<columns>
						<column hflex="min" />
						<column />
					</columns>
					<rows>
						<row>
							<label value="${labels.MailSubject}" />
							<textbox
								value="@bind(vm.settings.authReqTemplate.subject)"
								width="100%"
								maxlength="@load(vm.lengthText)"
								readonly="@load(not vm.canSave)" />
						</row>
						<row spans="2">
							<vbox>
								<ckeditor
									toolbar="Basic"
									value="@bind(fx.authReqTemplate.text)"
									width="460px"
									height="180px"
									if="${vm.canSave}" />
								<html
									id="idEmailAuthReqTemplateText"
									content="@load(vm.settings.authReqTemplate.text)"
									width="460px"
									height="180px"
									if="${not vm.canSave}" />
								<hbox>
									<button
										label="${labels.InsertField}"
										popup="fieldsAuth, position=after_start"
										disabled="@load(not vm.canSave)" />
									<button
										label="${labels.GlobalSettingsInsertUrl}"
										onClick="@command('insertUrl2Fx', form=fx, property='authReqTemplate.text')"
										disabled="@load(not vm.canSave)" />
								</hbox>
							</vbox>
						</row>
					</rows>
				</grid>
			</tabpanel>
			<tabpanel>
				<grid>
					<columns>
						<column hflex="min" />
						<column />
					</columns>
					<rows>
						<row>
							<label value="${labels.MailSubject}" />
							<textbox
								value="@bind(vm.settings.confReqTemplate.subject)"
								width="100%"
								maxlength="@load(vm.lengthText)"
								readonly="@load(not vm.canSave)" />
						</row>
						<row spans="2">
							<vbox>
								<ckeditor
									toolbar="Basic"
									value="@bind(fx.confReqTemplate.text)"
									width="460px"
									height="180px"
									if="${vm.canSave}" />
								<html
									id="idEmailConfReqTemplateText"
									content="@load(vm.settings.confReqTemplate.text)"
									width="460px"
									height="180px"
									if="${not vm.canSave}" />
								<button
									label="${labels.InsertField}"
									popup="fieldsConfirm, position=after_start"
									disabled="@load(not vm.canSave)" />
							</vbox>
						</row>
					</rows>
				</grid>
			</tabpanel>
			<tabpanel>
				<grid>
					<columns>
						<column hflex="min" />
						<column />
					</columns>
					<rows>
						<row>
							<label value="${labels.MailSubject}" />
							<textbox
								value="@bind(vm.settings.reqPassenger.subject)"
								width="100%"
								maxlength="@load(vm.lengthText)"
								readonly="@load(not vm.canSave)" />
						</row>
						<row spans="2">
							<vbox>
								<ckeditor
									toolbar="Basic"
									value="@bind(fx.reqPassenger.text)"
									width="460px"
									height="180px"
									if="${vm.canSave}" />
								<html
									id="idEmailReqPassengerTemplateText"
									content="@load(vm.settings.reqPassenger.text)"
									width="460px"
									height="180px"
									if="${not vm.canSave}" />
								<button
									label="${labels.InsertField}"
									popup="fieldsPassenger, position=after_start"
									disabled="@load(not vm.canSave)" />
							</vbox>
						</row>
					</rows>
				</grid>
			</tabpanel>
			<tabpanel>
				<grid>
					<columns>
						<column hflex="min" />
						<column />
					</columns>
					<rows>
						<row>
							<label value="${labels.MailSubject}" />
							<textbox
								value="@bind(vm.settings.confReqTripPassenger.subject)"
								width="100%"
								maxlength="@load(vm.lengthText)"
								readonly="@load(not vm.canSave)" />
						</row>
						<row spans="2">
							<vbox>
								<ckeditor
									toolbar="Basic"
									value="@bind(fx.confReqTripPassenger.text)"
									width="460px"
									height="180px"
									if="${vm.canSave}" />
								<html
									id="idEmailConfReqTripPassengerTemplateText"
									content="@load(vm.settings.confReqTripPassenger.text)"
									width="460px"
									height="180px"
									if="${not vm.canSave}" />
								<button
									label="${labels.InsertField}"
									popup="fieldsConfirmPass, position=after_start"
									disabled="@load(not vm.canSave)" />
							</vbox>
						</row>
					</rows>
				</grid>
			</tabpanel>
		</tabpanels>
	</tabbox>
	<menupopup
		id="fieldsNew"
		children="@load(vm.requirementFields)">
		<template name="children">
			<menuitem
				label="@load(each) @converter(vm.locConverter)"
				onClick="@command('insertField2Fx', form=fx, property='newReqTemplate.text', field=each)" />
		</template>
	</menupopup>
	<menupopup
		id="fieldsAuth"
		children="@load(vm.requirementFields)">
		<template name="children">
			<menuitem
				label="@load(each) @converter(vm.locConverter)"
				onClick="@command('insertField2Fx', form=fx, property='authReqTemplate.text', field=each)" />
		</template>
	</menupopup>
	<menupopup
		id="fieldsConfirm"
		children="@load(vm.requirementFields)">
		<template name="children">
			<menuitem
				label="@load(each) @converter(vm.locConverter)"
				onClick="@command('insertField2Fx', form=fx, property='confReqTemplate.text', field=each)" />
		</template>
	</menupopup>
	<menupopup
		id="fieldsConfirmPass"
		children="@load(vm.requirementFields)">
		<template name="children">
			<menuitem
				label="@load(each) @converter(vm.locConverter)"
				onClick="@command('insertField2Fx', form=fx, property='confReqTripPassenger.text', field=each)" />
		</template>
	</menupopup>
	<menupopup
		id="fieldsPassenger"
		children="@load(vm.requirementFields)">
		<template name="children">
			<menuitem
				label="@load(each) @converter(vm.locConverter)"
				onClick="@command('insertField2Fx', form=fx, property='reqPassenger.text', field=each)" />
		</template>
	</menupopup>
</zk>