<? if (!$this->error): ?>
	<? if(count($this->paginator)): ?>
		<script type="text/javascript">
		$().ready(function () {
			$(".td_tooltip img[title]").tooltip();
		});
		</script>
		<?php
				$label = "Renovação";
				$Session = new Zend_Session_Namespace('agrupamento');
				
				if (!empty($Session->taxa["id_produto"])) {
					$ProdutosAtributos = new Produto_Model_ProdutosAtributos();
					$produtoAtributos = $ProdutosAtributos->getAtributosFromProduto($Session->taxa["id_produto"], true, 'p', true, true);
					
					if (array_key_exists(Produto_Model_Atributos::DS_CHAVE_PROD_VALIDAR_RENOVACAO_SEM_SINISTRO, $produtoAtributos) && 
						$produtoAtributos[Produto_Model_Atributos::DS_CHAVE_PROD_VALIDAR_RENOVACAO_SEM_SINISTRO] == 1)
					{
						$label = "Renovação s/ sinistro";
					}
				}
		?>
		<table class='grid' cellspacing='1' cellpadding='0' border='0' id='tablePagination'>
			<thead>
				<tr>
					<th nowrap="nowrap">Nome</th>
					<th nowrap="nowrap" width="1%">Franquia/NC</th>
					<th nowrap="nowrap" width="1%">Taxa</th>
					<th nowrap="nowrap" width="1%"><?=$label?></th>
					<th nowrap="nowrap" width="1%">Inadimplente</th>
					<th nowrap="nowrap" width="1%">Reduzida</th>
					<th nowrap="nowrap" width="1%">Subvenção Federal</th>
					<th nowrap="nowrap" width="1%">Relacionada a</th>
					<th nowrap="nowrap" width="1%">Ativo</th>
					<th nowrap="nowrap" width="1%">Ações</th>
				</tr>
			</thead>
			<tbody>
				<?
				$i = 0;

				foreach ($this->paginator as $item):
					if ($i % 2 == 0) {
						$class = '';
					} else {
						$class = "highlight";
					}

					$imgActive = ($item['fl_ativo'] ? 'active.png' : 'inactive.png');

					?>
					<tr class="<?=$class?>">
						<td nowrap='nowrap'><?=($item['ds_nome_cobertura'] ? $item['ds_nome_cobertura'] : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap'><?=($item['vl_franquia'] ? $item['vl_franquia'].'%' : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap'><?=($item['vl_taxa'] ? $item['vl_taxa'].'%' : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap'><?=($item['vl_taxa_renovacao'] ? $item['vl_taxa_renovacao'].'%' : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap'><?=($item['vl_taxa_inadimplente'] ? $item['vl_taxa_inadimplente'].'%' : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap'><?=($item['vl_taxa_reduzida'] ? $item['vl_taxa_reduzida'].'%' : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap'><?=($item['vl_percentual_subvencao_federal'] ? $item['vl_percentual_subvencao_federal'].'%' : '&nbsp;'); ?></td>
						<td align="center" nowrap='nowrap' class="td_tooltip">
							<?
							if ($item['relacionado_com']) {
								?><img src="/resources/imagens/mini/existe.png" border="0" title="<?=$this->taxasRelacionadas($item['id'])?>" /><?
							} else {
								echo '&nbsp;';
							}
							?>
						</td>
						<td align="center">
							<? if ($item['fl_ativo']): ?>
									<img title="Ativo" src="/resources/imagens/mini/active.png" border="0">
							<? else: ?>
									<img title="Inativo" src="/resources/imagens/mini/inactive.png" border="0">
							<? endif; ?>
						</td>
						<td align='center' width='1%' nowrap='nowrap'>
							<?=$this->iconEdit("comercializacao", "taxavalor", $item)?>
							<?=$this->iconDelete("comercializacao", "taxavalor", $item)?>
						</td>
					</tr>
					<?
					$i++;
				endforeach;
				?>
			</tbody>
		</table>
		<?=$this->paginationControl($this->paginator, 'Sliding'); ?>
	<? endif; ?>
<? else: ?>
	<?= $this->showListError($this->error); ?>
<? endif; ?>
