<? echo $this->title('Grupo: '. $this->grupo->ds_nome_grupo_vistoria); ?>

<form class="formAjax" method="post" action="/sinistro/gruposvistoria/relacionarestados">
	<input type="hidden" name="id" value="<? echo $this->grupo->id; ?>" />
	
	<table width="100%">
		<tr>
			<? $i = 1; ?>
			<? if ($this->estados->count()): ?>
				<? foreach ($this->estados as $estado): ?>
					<? $checked = (in_array($estado->id, $this->grupo->estados()) ? 'checked' : ''); ?>
					<td>
						<table>
							<tr>
								<td><input <? echo $checked; ?> type="checkbox" name="id_estado[]" value="<? echo $estado->id; ?>" id="estado_<? echo $estado->id; ?>" /></td>
								<td><label for="estado_<? echo $estado->id; ?>"><? echo $estado->ds_nome_estado; ?></label></td>
							</tr>
						</table>
					</td>
					<? echo ($i % 4 == 0 ? '</tr><tr>' : ''); ?>
					<? $i++; ?>
				<? endforeach; ?>
			<? endif; ?>
		</tr>
	</table>
</form>