<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winEditarContrato"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>

<zk xmlns="http://www.zkoss.org/2005/zul">
	<window id="winEditarContrato" border="normal"
		apply="${editarContratoController}" height="500px" width="600px"
		contentStyle="overflow:auto"
		title="${c:l('editarContratoController.window.title')}">
		
		<toolbar>
			<hbox spacing="5px" style="padding:1px" align="right">
				<button id="btnApagar" height="20"
					image="/gui/img/remove.png" width="35px"
					tooltiptext="${c:l('tooltiptext.btnApagar')}" />
				<button id="btnSalvar" height="20"
					image="/gui/img/save.png" width="35px" 
					tooltiptext="${c:l('tooltiptext.btnSalvar')}" />
				<button id="btnCerrar"
					onClick="winEditarContrato.detach()" image="/gui/img/exit.png"
					width="35px"
					tooltiptext="${c:l('tooltiptext.btnFechar')}" />
			</hbox>
		</toolbar>
		
		<tabbox vflex="1" hflex="1">
			<tabs>					
				<tab label="${c:l('editarContratoController.tab.contrato')}" />
				<tab label="${c:l('editarContratoController.tab.config')}" />	
				<tab label="${c:l('editarContratoController.tab.cliente')}" />
				<tab label="${c:l('editarContratoController.tab.desconto')}" />
				<tab label="${c:l('editarContratoController.tab.adicao')}" id="tabAdicao" visible="false"/>
			</tabs>
			
			<tabpanels style="overflow: auto">
			
				<!-- Contrato -->
				<tabpanel id="tbContrato" >
					<grid fixedLayout="true">
						<columns>
							<column width="30%" />
							<column width="70%" />
						</columns>
						<rows>							
							<row >
								<label value="${c:l('label.grupoContrato')}" />
								<combobox id="cmbGrupo" 
									buttonVisible="true"
									use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
									model="@{winEditarContrato$composer.lsGrupo}"
									mold="rounded" width="95%" />
							</row>
							<row>
				                <label value="${c:l('label.empresa')}" />
								<combobox id="cmbEmpresa"
									use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa"
									mold="rounded" width="95%" />
							</row>
							<row>
								<label id="lbDataInicial" value="${c:l('label.dataInicial')}" />
								<datebox id="datInicial" width="100px"
									format="dd/MM/yyyy" maxlength="10"
									value="@{winEditarContrato$composer.contrato.dataInicial}" />
							</row>
							<row>
								<label id="lbDataFinal" value="${c:l('label.dataFinal')}" />
								<datebox id="datFinal" width="100px"
									format="dd/MM/yyyy" maxlength="10"
									value="@{winEditarContrato$composer.contrato.dataFinal}" />
							</row>
							<row>
								<label id="lbNumContrato" value="${c:l('label.numContrato')}" />
								<longbox id="txtNumContrato"
									constraint="no negative" maxlength="9" width="100px" 
									value="@{winEditarContrato$composer.contrato.numContrato}" />
							</row>
							<row>
								<label id="lbValor" value="${c:l('label.valorContrato')}" />
								<decimalbox id="txtValor" maxlength="12" format="0.00"
									constraint="no negative" width="100px" 
									value="@{winEditarContrato$composer.contrato.valorContrato}" />
							</row>	
							<row>
								<label id="lbPercentual" value="${c:l('label.percentualVoucher')}" />
								<decimalbox id="txtBonus" maxlength="6" format="0.00"
									constraint="no negative" width="100px" 
									value="@{winEditarContrato$composer.contrato.percentualBonus}" />
							</row>
							<row>
								<label value="${c:l('label.divisao')}" />
								<textbox id="txtDivisao" maxlength="255" width="95%" 
									value="@{winEditarContrato$composer.contrato.divisao}" />
							</row>
							<row >
								<label value="${c:l('label.representante')}" />
								<combobox id="cmbRepresentante" 
									buttonVisible="true" 
									use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxUsuario"
									mold="rounded" width="95%" />
							</row>
							<row>
								<label value="${c:l('label.observacao')}" />
								<textbox id="txtObservacao" maxlength="255" width="95%" 
									value="@{winEditarContrato$composer.contrato.observacao}" />
							</row>
							<row>
								<label id="lbValVoucher" value="${c:l('label.validadeVoucher')}" />
								<longbox id="txtValVoucher"
									constraint="no negative" maxlength="7" width="100px" 
									value="@{winEditarContrato$composer.contrato.validadeVoucher}" />
							</row>
							<row>
								<label id="lbValAberto" value="${c:l('label.validadeAberto')}" />
								<longbox id="txtValAberto"
									constraint="no negative" maxlength="7" width="100px" 
									value="@{winEditarContrato$composer.contrato.validadeAberto}" />
							</row>
							<row>
								<label id="lbValExpresso" value="${c:l('label.validadeExpresso')}" />
								<longbox id="txtValExpresso"
									constraint="no negative" maxlength="7" width="100px" 
									value="@{winEditarContrato$composer.contrato.validadeExpresso}" />
							</row>
							<row >
								<label value="${c:l('label.tipoCalculo')}" />
								<radiogroup id="rdgTipoCalculo" >
									<radio id="rdgRotativo" label="${c:l('label.tipoCalculo.contrato')}" value="1"/>
									<radio id="rdgContrato" label="${c:l('label.tipoCalculo.rotativo')}" value="0" style="padding: 20px; "/>
								</radiogroup>
							</row>
							<row >
								<label value="${c:l('label.tipoTarifa')}" />
								<radiogroup id="rdgTipoTarifa" >
									<radio id="rdgVariaval" label="${c:l('label.tipoTarifa.variavel')}" value="0"/>
									<radio id="rdgFixa" label="${c:l('label.tipoTarifa.fixa')}" value="1" style="padding: 46px; "/>
								</radiogroup>
							</row>
							<row >
								<label value="${c:l('label.tipoContrato')}" />
								<radiogroup id="rdgTipoContrato" >
									<radio id="rdgAberto" label="${c:l('label.tipoContrato.aberto')}" value="0"/>
									<radio id="rdgFechado" label="${c:l('label.tipoContrato.fechado')}" value="1" style="padding: 52px; "/>
									<radio id="rdgGrupo" label="${c:l('label.tipoContrato.grupo')}" value="2" style="padding: 10px; "/>
								</radiogroup>
							</row>
							<row >
								<label value="${c:l('label.status')}" />
								<radiogroup id="rdgStatus" >
									<radio id="rdgAtivo" label="${c:l('label.status.ativo')}" value="1"/>
									<radio id="rdgDigitado" label="${c:l('label.status.digitado')}" value="2" style="padding: 60px; "/>
									<radio id="rdgInativo" label="${c:l('label.status.inativo')}" value="0" style="padding: 5px; "/>
								</radiogroup>
							</row>
							
						</rows>
					</grid>
				</tabpanel>
				
				<!-- Configuracoes -->
				<tabpanel id="tbConfig" >
					<grid fixedLayout="true">
						<columns>
							<column width="50%" />
							<column width="50%" />
						</columns>
						<rows>
							<row >
								<groupbox >									
									<checkbox id="chkBilheteAberto"  label="${c:l('label.bilheteAberto')}" />
								</groupbox>
								<groupbox >
									<checkbox id="chkBilhetesConfirmados" label="${c:l('label.bilhetesConfirmados')}" />
								</groupbox>
							</row>
							<row >
								<groupbox >
									<checkbox id="chkReservaBilhete" label="${c:l('label.reservaBilhete')}" />
								</groupbox>
								<groupbox >
									<checkbox id="chkManipulaBonus" label="${c:l('label.manipulaBonus')}" />
								</groupbox>
							</row>
							<row >
								<groupbox >
									<checkbox id="chkExigeExcedente" label="${c:l('label.exigeExcedente')}" />
								</groupbox>											
							</row>
						</rows>
					</grid>
				</tabpanel>	
			
				<!-- Cliente -->
				<tabpanel id="tbClienteContrato" >
					<grid fixedLayout="true">
						<columns>
							<column width="25%" />
							<column width="75%" />
						</columns>
						<rows>
							<row >
								<label value="${c:l('label.clienteCorporativo')}" />
								<combobox id="cmbCliente" 
									buttonVisible="true" 
									use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxClienteCorporativo"
									mold="rounded" width="95%" />
							</row>
							<row>
								<label value="${c:l('label.email')}" />
								<label id="lblClienteEmail" />
							</row>
							<row>
								<label value="${c:l('label.telefone')}" />
								<label id="lblClienteTelefone" />
							</row>
							<row>
								<label value="${c:l('label.logradouro')}" />
								<label id="lblClienteLogradouro" />
							</row>
							<row>
								<label value="${c:l('label.numero')}" />
								<label id="lblClienteNumero"  />
							</row>
							<row>
								<label value="${c:l('label.cep')}" />
								<label id="lblClienteCEP"  />
							</row>
							<row>
								<label value="${c:l('label.complemento')}" />
								<label id="lblClienteComplemento" />
							</row>							
							<row>
								<label value="${c:l('label.bairro')}" />
								<label id="lblClienteBairro" />
							</row>
						</rows>
					
					</grid>
				</tabpanel>
				
				<!-- Desconto -->
				<tabpanel id="tbDesconto" >
					<grid fixedLayout="true">
						<columns>
							<column width="25%" />
							<column width="75%" />
						</columns>
						<rows>
							<row>
								<label id="lbDataInicialDesconto" value="${c:l('label.dataInicial')}" />
								<datebox id="datInicialDesconto" width="100px"
									format="dd/MM/yyyy" maxlength="10" />
							</row>
							
							<row>
								<label id="lbDataFinalDesconto" value="${c:l('label.dataFinal')}" />
								<datebox id="datFinalDesconto" width="100px"
									format="dd/MM/yyyy" maxlength="10" />
							</row>
						 	
							<row>
								<label id="lbValorDesconto" value="${c:l('label.porcentagem')}" />
								<decimalbox id="txtPorcDesconto" maxlength="6" format="0.00"
									constraint="no negative" width="100px" />
							</row>	
							
							<row >
								<label value="${c:l('label.operacao')}" />
								<radiogroup id="rdgOperacao" >									
									<radio id="rdgDesconto" label="${c:l('label.desconto')}" value="true" style="padding: 20px; "/>
									<radio id="rdgAcrescimo" label="${c:l('label.acrescimo')}" value="false" style="padding: 20px; "/>
								</radiogroup>
							</row>
							<row id="rowIncluir" spans="2" align="middle">
								<hbox >
									<button id="btnAdicionarDesconto"
										height="20" image="/gui/img/add.png" width="35px"
										tooltiptext="${c:l('tooltiptext.btnIncluir')}" />

									<button id="btnRemoverDesconto"
										height="20" image="/gui/img/remove.png" width="35px"
										tooltiptext="${c:l('tooltiptext.btnRemover')}" />									
								</hbox>
							</row>
						</rows>
					</grid>
					<paging id="pagingDesconto" pageSize="20" />
					<listbox id="descontoList"
						use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
						multiple="false">
						<listhead sizable="true">
							<listheader id="lhDataInicial" image="/gui/img/create_doc.gif"
								label="${c:l('label.dataInicial')}"
								sort="auto(dataInicial)" />
							<listheader id="lhDataFinal" image="/gui/img/create_doc.gif"
								label="${c:l('label.dataFinal')}"
								sort="auto(dataFinal)" />							
							<listheader id="lhValorDesconto" image="/gui/img/create_doc.gif"
								label="${c:l('label.tarifa')}"
								sort="auto(porcentagem)" />
							<listheader id="lhOperacao" image="/gui/img/create_doc.gif"
								label="${c:l('label.operacao')}"
								sort="auto(indDesconto)" />																		
						</listhead>
					</listbox>
				</tabpanel>
			
				<!-- Adiçao -->
				<tabpanel id="tbAdicao" >
					<grid fixedLayout="true">
						<columns>
							<column width="25%" />
							<column width="75%" />
						</columns>
						<rows>
							<row>
								<label id="lbValorAdicao" value="${c:l('label.valor')}" />
								<decimalbox id="txtValorAdicao" maxlength="15" format="0.00"
									constraint="no negative, no zero" width="100px" />
							</row>
								
							<row>
								<label value="${c:l('label.observacao')}" />
								<textbox id="txtObservacaoAdicao" maxlength="255" width="95%" />
							</row>
							
							<row >
								<label value="${c:l('label.operacao')}" />
								<radiogroup id="rdgOperacaoAdicao" >
									<radio id="rdgAdicao" label="${c:l('label.acrescimo')}" value="0" style="padding: 20px; "/>
									<radio id="rdgReducao" label="${c:l('label.reducao')}" value="1" style="padding: 20px; "/>									
								</radiogroup>
							</row>
							<row id="rowIncluirAdicao" spans="2" align="middle">
								<hbox >
									<button id="btnAdicao"
										height="20" image="/gui/img/add.png" width="35px"
										tooltiptext="${c:l('tooltiptext.btnIncluir')}" />									
								</hbox>
							</row>
						</rows>
					</grid>
					<paging id="pagingAdicao" pageSize="20" />
					<listbox id="caixaList"
						use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
						multiple="false">
						<listhead sizable="true">
							<listheader id="lhDataAdicao" image="/gui/img/create_doc.gif"
								label="${c:l('label.dataOperacao')}"
								sort="auto(dataAdicao)" />							
							<listheader id="lhValorAdicao" image="/gui/img/create_doc.gif"
								label="${c:l('label.tarifa')}"
								sort="auto(valorAdicao)" />
							<listheader id="lhOperacaoAdicao" image="/gui/img/create_doc.gif"
								label="${c:l('label.operacao')}"
								sort="auto(indAdicao)" />																		
						</listhead>
					</listbox>
				</tabpanel>
			
			</tabpanels>
		</tabbox>
	</window>
</zk>