<? if (!$this->error): ?>

	<table class='grid' cellspacing='2' cellpadding='2' border='0' id='tablePagination'>
		<? 
		$link = '/seguro/vistoriaprevia/list/0/';

		if ($this->orderby) {
			$arr[$this->orderby] = ($this->orderDirection == 'asc' ? 
				'<img src="/resources/imagens/asc.gif" border=\'0\'>' :
				'<img src=\'/resources/imagens/desc.gif\' border=\'0\'>');
		}

		$options = array(
			array(
				'nowrap'	=> 'nowrap',
				'descricao'	=> '<input type=\'checkbox\' id=\'marcarTodos\'>'
			),

			array(
				'id'		=> 'id',
				'nowrap'	=> 'nowrap',
				'link'		=> $link . 'id/s/' . ($this->orderby == 'id' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'Doc.' . $arr['id'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'ds_nome_proponente',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'ds_nome_proponente/s/' . ($this->orderby == 'ds_nome_proponente' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'Segurado '  . $arr['ds_nome_proponente'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'ds_nome_produto',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'ds_nome_produto/s/' . ($this->orderby == 'ds_nome_produto' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'Produto '  . $arr['ds_nome_produto'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'data_semeadura',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'data_semeadura/s/' . ($this->orderby == 'data_semeadura' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'Plantio '  . $arr['data_semeadura'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'lmga_total',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'lmga_total/s/' . ($this->orderby == 'lmga_total' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'LMGA '  . $arr['lmga_total'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'ds_sigla',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'ds_sigla/s/' . ($this->orderby == 'ds_sigla' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'UF '  . $arr['ds_sigla'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'ds_nome_municipio',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'ds_nome_municipio/s/' . ($this->orderby == 'ds_nome_municipio' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'Município '  . $arr['ds_nome_municipio'],
				'image'     => '/resources/imagens/'
			),

			array(
				'id'        => 'ds_nome_usuario',
				'nowrap'    => 'nowrap',
				'link'      => $link . 'ds_nome_usuario/s/' . ($this->orderby == 'ds_nome_usuario' ? ($this->orderDirection == 'asc' ? 'desc' : 'asc') : 'asc'),
				'descricao' => 'Digitador '  . $arr['ds_nome_usuario'],
				'image'     => '/resources/imagens/'
			),

			array(
				'nowrap'    => 'nowrap',
				'descricao' => 'Ações'
			)
		); ?>

		<?=$this->listHeader($options, $this->order, $this->orderType)?>

		<tbody>
			<? $i=0;

			foreach ($this->paginator as $item):

				if ($i % 2 == 0) {
					$class = '';
				} else {
					$class = 'highlight';
				} ?>

				<tr class='<?=$class?>'>
					<td align='center'><input type='checkbox' name='id_proposta[]' class='id_proposta_id' value='<?= $item['id']; ?>'></td>
					<td width="1%"  align="center" nowrap><?=$this->escape(($item['id'] ? str_pad($item['id'], 6, 0, STR_PAD_LEFT) : ' '))?></td>
					<td><?=$this->escape(($item['ds_nome_proponente'] ? $item['ds_nome_proponente'] : ' '))?></td>
					<td><?=$this->escape(($item['ds_nome_abreviado'] ? $item['ds_nome_abreviado'] : ' '))?></td>
					<td><?=$this->escape(($item['data_semeadura'] ? Agro_Util::formatDate($item['data_semeadura'], Zend_Date::DATES) : ''))?></td>
					<td><?=$this->escape(($item['lmga_total'] ? $item['lmga_total'] : ' '))?></td>
					<td><?=$this->escape(($item['ds_sigla'] ? $item['ds_sigla'] : '&nbsp;'))?></td>
					<td><?=$this->escape(($item['ds_nome_municipio'] ? $item['ds_nome_municipio'] : '&nbsp;'))?></td>
					<td><?=$this->escape(($item['ds_nome_usuario'] ? $item['ds_nome_usuario']: ' '))?></td>
					<td align='center' width='1%' nowrap='nowrap'>
						<a class="popup" href="/seguro/proposta/view/id/<?=$item['id_proposta_endosso']?>">
						<img src="/resources/imagens/mini/view.png" alt="view.png" title="Visualizar" border="0"></a>
						<input type="hidden" name="id_propostas_endossos[]" id="id_propostas_endossos_id" value="<?=$item['id_proposta_endosso']?>">
					</td>
				</tr>
				<? $i++;
			endforeach; ?>
		</tbody>
	</table>
<? else: ?>
	<?=$this->showListError($this->error); ?>
<? endif; ?>