<?php
class Zend_View_Helper_Lf026FormItensSegurados extends Zend_View_Helper_Abstract {

	public function Lf026FormItensSegurados($Form) {

    	$Model_ItensSegurados = new Seguro_Model_ItensSegurados();
		$ItemSegurado = $Model_ItensSegurados->getItemSeguradoById($Form->getValue('id_item_segurado'));
		$Row = $Model_ItensSegurados->getItemSegurado($Form->id_laudo_final_item_segurado->getValue());
		if ($Row) {
			$auditoria = $Row->auditoria();
		}
		?>
		
		<? if ($auditoria) { ?>
			<fieldset class="ctrl-nao-vistoriada">
				<legend>Informações do Usuário</legend>
				<table width="100%" class="grid" cellpadding="1" cellspacing="1">
					<thead>
						<tr>
							<th>Usuário de Criação</th>
							<th>Data de Criação</th>
							<th>Usuário de Alteração</th>
							<th>Data de Alteração</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td align="center"><?=$auditoria['usuario_criacao']?></td>
							<td align="center"><?=$auditoria['dt_criacao']?></td>
							<td align="center"><?=$auditoria['usuario_alteracao']?></td>
							<td align="center"><?=$auditoria['dt_alteracao']?></td>
						</tr>
					</tbody>
				</table>
			</fieldset>
		<? } ?>
		

		
		<?=$Form->id_proposta?>
	    <?=$Form->id_processo?>
	    <?=$Form->id_vistoria?>
	    <?=$Form->id_laudo_final?>
	    <?=$Form->id_item_segurado?>
	    <?=$Form->id_laudo_final_item_segurado?>
	    <?=$Form->id_cobertura?>
	    <?=$Form->fl_vistoria_preliminar?>
	    <?=$Form->fl_avalia_danos_anteriores?>

		<fieldset>
			<legend>Informações do Item Segurado</legend>
			<table width="100%" class="grid" cellpadding="1" cellspacing="1">
	            <thead>
	    			<tr>
	    				<th>Item</th>
	    				<th>Quadra</th>
	    				<th>Área (ha)</th>
	    				<th>Variedade/Cultivar</th>
	    				<th>Área Replantada (ha)</th>
	    				<th>Coord. Geo. da Quadra</th>
	    			</tr>
	            </thead><?//dump($ItemSegurado)?>
	            <tbody align="center">
	    			<tr>
	    				<td><?=$ItemSegurado['nr_item_segurado']?></td>
	    				<td><?=$ItemSegurado['ds_item_segurado']?></td>
	    				<td><?=$ItemSegurado['vl_area']?>
	    					<input type="hidden" name="vl_area" value="<?=$ItemSegurado['vl_area']?>">
	    				</td>
	    				<td><?=$ItemSegurado['ds_nome_variedade']?></td>
	    				<td><?=$Form->vl_ha_area_replantada?></td>
	    				<td><?=$Form->ds_coordenadas_geograficas?></td>
	    			</tr>
	            </tbody>
			</table>
		</fieldset>
		
		<?if (Agro_Util::checkPermission('sinistro:laudofinal:laudodigitalizado')):?> 
			<fieldset id="laudoDigitalizado">
				<legend>Laudo digitalizado</legend>
				<p>Favor incluir o laudo escaneado em PDF deste talhão.  Se o laudo corresponder a mais de um talhão, favor incluir uma cópia em cada talhão.  Obrigado</p>
				<div class="padding-10">
					<div class="row">
						<dl class="zend_form">
							<dd>
								<input name="MAX_FILE_SIZE" value="2097152" id="MAX_FILE_SIZE" type="hidden">
								<input name="ds_nome_laudo_fisico" id="ds_nome_laudo_fisico" size="50" type="file" />
							</dd>
						</dl>
					</div>
				</div>
				<?if($chocho){?>
					<?if ($Row->ds_nome_laudo_fisico_chocho):?>
						<div class="padding-10">
							<div class="row">
								<label>
									<input id="downloadArquivo" type="hidden" value="1">
									<a href="/laudos/<?=$Row->ds_nome_laudo_fisico_chocho?>" target="_blank">
										<img src="/resources/imagens/mini/download.png" border="0">
										Clique aqui para fazer o download do arquivo
									</a>
								</label>
							</div>
						</div>
					<?endif;?>
				<?}else if($Row->ds_nome_laudo_fisico){?>
						<div class="padding-10">
							<div class="row">
								<label>
									<input id="downloadArquivo" type="hidden" value="1">
									<a href="/laudos/<?=$Row->ds_nome_laudo_fisico?>" target="_blank">
										<img src="/resources/imagens/mini/download.png" border="0">
										Clique aqui para fazer o download do arquivo
									</a>
								</label>
							</div>
						</div>				
				<?}?>
			</fieldset>
		<?endif;?>
		 
		<?
    }
    
   
}