<?php 
$data = $this->data->data;
?>
<table id="grid_<?php echo $data->id ?>">
	<thead>
		<?php if($data->nomor == true){ ?>
			<th width="20" align="center">No</th>
		<?php }
		foreach($data->attr as $r){
			if($r['type'] != 'hide'){
		?>
			<th width="<?php echo $r['size'] ?>" align="<?php echo $r['align'] ?>"><?php echo $r['label'] ?></th>
		<?php 
			}
		}
		?>
	</thead>
	<tbody>
		<?php
		for($i = 1; $i <= $data->max; $i++){
			$idRow = $i - 1;
			$db = $data->data[$idRow];
		?>
			<tr>
				<?php if($data->nomor == true){ ?>
					<td><?php echo $i ?></td>
				<?php } ?>
				<?php
				foreach($data->attr as $k => $r){
					if($r['type'] != 'hide'){
				?>
					<td>
				<?php
					}
					if(!empty($r['select'])){
				?>
						<select style="width: <?php echo ($r['size']-5) ?>px" name="<?php echo $k.'['.$data->id.']['.$i.']' ?>" id="<?php echo $k ?>_<?php echo $data->id.'_'.$i ?>" grid="<?php echo $data->id ?>" baris="<?php echo $i ?>"  class='<?php echo $r['class'] ?>'>
							<option value="">
							<?php 
							foreach($r['select'] as $k2 => $r2){ 
								$sel = '';
								if($k2 == $db->$k){
									$sel = 'selected';
								}
							?>
								<option value="<?php echo $k2 ?>" <?php echo $sel ?>><?php echo $r2 ?>
							<?php 
							} 
							?>
						</select>
				<?php 
					}elseif($r['type'] == 'checkbox'){
						$cek = '';
						if(!empty($db->$k)){
							$cek = 'checked';
						}
				?>
						<input type='checkbox' id="<?php echo $k ?>_<?php echo $data->id.'_'.$i ?>" name="<?php echo $k.'['.$data->id.']['.$i.']' ?>" value='<?php echo $r['value'] ?>' class='<?php echo $r['class'] ?>' grid="<?php echo $data->id ?>" baris="<?php echo $i ?>" <?php echo $cek ?>>
				<?php
					}else{
						$type = 'text';
						if($r['type'] == 'hide'){
							$type = 'hidden';
						}
					?>
						<input type='<?php echo $type ?>' <?php echo $r['read'] ?> id="<?php echo $k ?>_<?php echo $data->id.'_'.$i ?>" name="<?php echo $k.'['.$data->id.']['.$i.']' ?>" class='<?php echo $r['class'] ?>' grid="<?php echo $data->id ?>" baris="<?php echo $i ?>"  style="width: <?php echo ($r['size']-5) ?>px; border: 0px #fff; background-color: none" value="<?php echo $db->$k ?>">
					<?php
					}
					if($r['type'] != 'hide'){
				?>
					</td>
				<?php
					}
				}
				?>
			</tr>
		<?php 
		}
		?>
	</tbody>
</table>
<?php echo $data->after ?>
<script type='text/javascript'>
$(document).ready(function(){
	$('#grid_<?php echo $data->id ?>').flexigrid({
		width: <?php echo $data->width ?>,
		height: <?php echo $data->height ?>,
		title: '<?php echo $data->title ?>',
	});
	$('.tanggal').datepicker({
		changeMonth: true,
		changeYear: true,
		dateFormat: 'dd/mm/yy', 
		yearRange: '1900:2026',
	});		
	setDec();
})
</script>
			