<?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>
					<tabs>
						<tab label="${labels.NewRequirement}"/>
						<tab label="${labels.AuthRequirement}"/>
						<tab label="${labels.ConfirmRequirement}"/>
						<tab label="${labels.ReqTripPassengers}"/>
						<tab label="${labels.ConfirmTripPassengers}"/>
					</tabs>
					<tabpanels>
						<tabpanel>
							<grid>
								<columns>
									<column hflex="min"/>
									<column/>
								</columns>
								<rows>
									<row>
										<label value="${labels.MailSubject}" />
										<textbox
											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(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}"/>
											<html 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('insertUrl', message=vm.settings.newReqTemplate)" 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(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
											<html 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('insertUrl', message=vm.settings.authReqTemplate)" 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(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
											<html 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(vm.settings.reqPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
											<html content="@load(vm.settings.confReqTemplate.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(vm.settings.confReqTripPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
											<html content="@load(vm.settings.confReqTemplate.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('insertField', field=each, message=vm.settings.newReqTemplate)"/>
					</template>	
				</menupopup>
				<menupopup id="fieldsAuth" children="@load(vm.requirementFields)">
					<template name="children">
						<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.authReqTemplate)"/>
					</template>	
				</menupopup>
				<menupopup id="fieldsConfirm" children="@load(vm.requirementFields)">
					<template name="children">
						<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
					</template>	
				</menupopup>
				<menupopup id="fieldsConfirmPass" children="@load(vm.requirementFields)">
					<template name="children">
						<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTripPassenger)"/>
					</template>
				</menupopup>
				<menupopup id="fieldsPassenger" children="@load(vm.requirementFields)">
					<template name="children">
						<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.reqPassenger)"/>
					</template>
				</menupopup>
</zk>