<form class="formDefault" id="formDefault" name="formDefault" method="post">
	<input type="hidden" name="idLaudoFinal" id="idLaudoFinal" value="<?=$this->idLaudoFinal?>" />
	<input type="hidden" name="idVistoria" id="idVistoria" value="<?=$this->idVistoria?>" />
	<input type="hidden" name="idRevistoria" id="idRevistoria" value="<?=$this->idRevistoria?>" />
	<input type="hidden" name="idProcesso" id="idProcesso" value="<?=$this->idProcesso?>" />
	<input type="hidden" name="idProposta" id="idProposta" value="<?=$this->idProposta?>" />
	<input type="hidden" name="idCobertura" id="idCobertura" value="<?=$this->idCobertura?>" />
	<input type="hidden" name="hasRevistoria" id="hasRevistoria" value="<?=$this->hasRevistoria?>" />
	<input type="hidden" name="userVistoriaMesmaEmpresa" id="userVistoriaMesmaEmpresa" value="<?=$this->userVistoriaMesmaEmpresa?>" />

	<div class="geral">
		<?=$this->getHeaderProposta($this->idProposta, $this->idProcesso)?>

		<? if ($this->idRevistoria) {?>
			<?=$this->getAvisosRevistoria($this->idRevistoria)?>
		<? } else {?>
			<?=$this->getAvisosVistoria($this->idVistoria)?>
		<? }?>		

		<? if ($this->idRevistoria) {?>
			<fieldset>
				<legend>Motivo da Revistoria</legend>
				<table width="100%" border="0" cellspacing="0">
					<tr>
						<td>
							<label><?=$this->ds_motivo?></label>
						</td>
					</tr>
				</table>
			</fieldset>				
			<fieldset>
				<table width="100%" border="0" cellspacing="0">
					<tr>
						<td width="15%">
							<label>Revistoria realizada?</label>
						</td>
						<td width="10%" align="center">
							<input type='radio' name='fl_realizada' id='fl_realizada-S' value='S' <?=$this->fl_realizada == 'S' ? 'checked' : ''?> />
							<label>Sim</label>
						</td>
						<td width="75%">
							<input type='radio' name='fl_realizada' id='fl_realizada-N' value='N' <?=$this->fl_realizada == 'N' ? 'checked' : ''?> />
							<label>Não</label>
						</td>
					</tr>
				</table>
			</fieldset>		
			<? 
				$display = '';
				if ($this->idRevistoria && $this->fl_realizada == 'S') {
					$display = 'none';					
				}
			?>		
			<div id="motivoNaoRealizada" style="display: <?=$display?>">
				<fieldset>
					<div class="row">
						<label>Motivo:</label>
						<textarea name="ds_motivo_nao_realizada" id="ds_motivo_nao_realizada" rows="4" cols="100"><?=$this->ds_motivo_nao_realizada?></textarea>
					</div>
				</fieldset>				
			</div>
		<? }?>		
		<? 
			$display = '';
			if ($this->idRevistoria && $this->fl_realizada == 'N') {
				$display = 'none';					
			}
		?>		
		<div id="dadosLaudo" style="display: <?=$display?>">
			<fieldset>
				<legend>Identificação do evento</legend>
				<input type="checkbox" <?=$this->fl_evento_nao_constatado ? 'checked' : ''?> id="fl_evento_nao_constatado" name="fl_evento_nao_constatado" value="true">
				<label>Não constatou-se a ocorrência do evento comunicado.</label>
				<table border='0' width="100%">
					<tr>
						<td width="18%">
							<label>Acompanhado de Vento:</label>
						</td>
						<td>
							<input type='radio' name='fl_acompanhado_vento' id='fl_acompanhado_vento-S' value='S' <?=$this->fl_acompanhado_vento == 'S' ? 'checked' : ''?> />
							<label>Sim</label>
						</td>
						<td>
							<input type='radio' name='fl_acompanhado_vento' id='fl_acompanhado_vento-N' value='N' <?=$this->fl_acompanhado_vento == 'N' ? 'checked' : ''?> />
							<label>Não</label>
						</td>
						<td width="10%">
						</td>
						<td align="right">
							<label>Direção do evento:</label>
						</td>
						<td>
							<input type="text" id="ds_direcao_evento" name="ds_direcao_evento" maxlength="30" size="30" value="<?=$this->ds_direcao_evento?>">
						</td>
					</tr>
					<tr>
						<td>
							<label>Acompanhado de Chuva:</label>
						</td>
						<td>
							<input type='radio' name='fl_acompanhado_chuva' id='fl_acompanhado_chuva-S' value='S' <?=$this->fl_acompanhado_chuva == 'S' ? 'checked' : ''?> />
							<label>Sim</label>
						</td>
						<td>
							<input type='radio' name='fl_acompanhado_chuva' id='fl_acompanhado_chuva-N' value='N' <?=$this->fl_acompanhado_chuva == 'N' ? 'checked' : ''?> />
							<label>Não</label>
						</td>
						<td>
						</td>
						<td align="right">
							<label>Diâmetro médio do granizo:</label>
						</td>
						<td>
							<input type="text" id="ds_diametro_medio_granizo" name="ds_diametro_medio_granizo" maxlength="30" size="30" value="<?=$this->ds_diametro_medio_granizo?>">
						</td>
					</tr>
                    <tr>
                        <td>
                            <label>Coordenadas Geográficas/Sede</label>
                        </td>
                        <td>
                            <input type="text" class="coordenadas" maxlength="5" id="ds_coordenadas_geograficas" name="ds_coordenadas_geograficas" value="<?=$this->ds_coordenadas_geograficas?>">
                        </td>
                        <td colspan="4" />
                    </tr>
				</table>
			</fieldset>		
	
			<fieldset>
				<legend>Situação da cultura</legend>
	
				<div class="row">
					<?=$this->form->ds_estadio_cultura?>
				</div>
	
				<div class="row">
					<?=$this->form->ds_aspectos_gerais_cultura?>
				</div>
				<table width="60%">
					<tr>
						<td>
							Houve danos:
						</td>
						<td>
							<input type='checkbox' name='fl_danos_folhas' id='fl_danos_folhas' value='true' <?=$this->fl_danos_folhas ? 'checked' : ''?> />
							<label>Folhas</label>
						</td>
						<td>
							<input type='checkbox' name='fl_danos_ramos' id='fl_danos_ramos' value='true' <?=$this->fl_danos_ramos ? 'checked' : ''?> />
							<label>Ramos</label>
						</td>
						<td>
							<input type='checkbox' name='fl_danos_flores' id='fl_danos_flores' value='true' <?=$this->fl_danos_flores ? 'checked' : ''?> />
							<label>Flores</label>
						</td>
						<td>
							<input type='checkbox' name='fl_danos_frutos' id='fl_danos_frutos' value='true' <?=$this->fl_danos_frutos ? 'checked' : ''?> />
							<label>Frutos</label>
						</td>
						<td>
							<input type='checkbox' name='fl_danos_vegetacao_adjacente' id='fl_danos_vegetacao_adjacente' value='true' <?=$this->fl_danos_vegetacao_adjacente ? 'checked' : ''?> />
							<label>Vegetação adjacente</label>
						</td>
					</tr>
				</table>
			</fieldset>		
			<fieldset>
				<legend>Área atingida</legend>
				<table>
					<tr>
						<td>
							<label>Área atingida: </label>
						</td>
						<td>
							<input type='radio' name='fl_area_atingida' id='fl_area_atingida-T' value='T' <?=$this->fl_area_atingida == 'T' ? 'checked' : ''?> />
							<label>Total</label>
						</td>
						<td>
							<input type='radio' name='fl_area_atingida' id='fl_area_atingida-P' value='P' <?=$this->fl_area_atingida == 'P' ? 'checked' : ''?> />
							<label>Parcial</label>
						</td>
						<td>
							<!--
							<input type="text" id="area_atingida_ha" name="area_atingida_ha" size="12" style="text-align: right" value="<?=$this->area_atingida_ha?>" readonly>
							<label>ha</label>
							-->
						</td>
					</tr>
				</table>
			</fieldset>		
			<fieldset id="fieldset-itens_segurados_parcial" class="hide"><legend>Itens Segurados</legend>
			
			</fieldset>
			
		<?
			if ($this->hasCoberturaFitossanitaria) {
		?>
				<fieldset>
					<legend>Proteção Fitossanitária Pós Granizo</legend>
					<table border='0'>
						<tr>
							<td>
								<label>Indenização pela cobertura fitossanitária Pós Granizo:</label>
							</td>
							<td>
								<input type='radio' name='fl_indenizacao_fitossanitaria' id='fl_indenizacao_fitossanitaria-S' value='S' <?=$this->fl_indenizacao_fitossanitaria ? 'checked' : ''?>/>
								<label>Sim</label>
							</td>
							<td>
								<input type='radio' name='fl_indenizacao_fitossanitaria' id='fl_indenizacao_fitossanitaria-N' value='N' <?=!$this->fl_indenizacao_fitossanitaria ? 'checked' : ''?>/>
								<label>Não</label>
							</td>
						</tr>
					</table>
				</fieldset>
		<?
			}		
		?>		
			<fieldset id="fieldset-itens_segurados" class="fieldset_laudo_final" id="" style="display: none;">
			</fieldset>
			<fieldset>
				<legend>Dados Adicionais</legend>
				<div class="row">
					<label>Observações:</label>
					<textarea name="ds_observacao" id="ds_observacao" rows="4" cols="100"><?=$this->ds_observacao?></textarea>
				</div>
                <div class="row assinatura" style="display: <?if(!$this->fl_evento_nao_constatado) echo 'none'?>;">
                    <?=$this->formAssinatura->fl_assinatura_regulador?>
                </div>
                <div class="row assinatura" style="display: <?if(!$this->fl_evento_nao_constatado) echo 'none'?>;">
                    <?=$this->formAssinatura->fl_assinatura_segurado?>
                </div>
			</fieldset>
		</div>
		<fieldset id="fieldset-buttons">
			<?
			$LaudosFinais = new Sinistro_Model_LaudosFinais();
			$Row = $LaudosFinais->find($this->idLaudoFinal)->current();
			?>
			
			<? if ($Row->countQuadras('safra13.laudos_finais_uva_granizo') && $LaudosFinais->getDsChaveStatus($this->idLaudoFinal) != 'ENVIADO'): ?>
				<button type="button" id="btnEnviarLaudo">Enviar</button>
			<? endif; ?>
            
            <?if($LaudosFinais->getDsChaveStatus($this->idLaudoFinal) == 'ENVIADO' && ($this->user->ds_nome_usuario == 'maria.cristina' || $this->user->ds_nome_usuario == 'fernando.nunes' || $this->user->ds_nome_usuario == 'randal.brandolt' || $this->user->ds_nome_usuario == 'marcio.pereira')):?>
                <button type="button" id="bntDevolverLaudo">Devolver</button>
            <?endif?>

			<?
			if ($Row->id_status == $LaudosFinais->getIdStatus('ENVIADO', 'LF')) {
				?>
				<script type="text/javascript">
				$(document).ready(function() {
					$('input, textarea, select').attr('disabled', true);
					$('#btnSalvarLaudo').css('display', 'none');
				});
				</script>
				<?
			}
			?>
			<button type="button" id="btnSalvarLaudo" name="btnSalvarLaudo">Salvar</button>
			<button type="button" id="voltar" onclick="location.href='/sinistro/processo/view/id/<?=$this->idProcesso?>'">Voltar</button>
		</fieldset>
	</div>

	<div class="jqmWindow" id="listQuadrasFitossanitarias">
		<?=$this->title('Selecione as quadras com direito à indenização')?>
		
		<div class="geral">
			<div style="overflow:auto; height: 200px;" id="div_quadras_fitossanitarias">
			</div>
			<div>
				<br>
				<button type="button" onClick="limpaDadosPopUpFitossanitaria()" >Fechar</button>
			</div>
		</div>
		<hr style="clear:both;" />
	</div>

	<div class="jqmWindow" id="listQuadrasAreaAtingida">
		<?=$this->title('Selecione as quadras atingidas')?>
		
		<div class="geral">
			<div style="overflow:auto; height: 200px;" id="div_area_atingida"></div>
			<div id="divFechar" style="display:block; float:right;">
				<br>
				<button type="button" id="fecharPopUpQuadrasAtingidas" >Fechar </button>
			</div>
		</div>
		<hr style="clear:both;" />
	</div>
</form>
<div class="jqmWindow" id="divJqm" style="overflow:auto; height: 90%; width: 90%"></div>