/*  id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  creation_date DATE,
  modified_date DATE,
  /create_user_id int ( 11 ),
  /mod_user_id int ( 11 ),
  /resident_id int ( 11 ),
  /description VARCHAR ( 255 ),
  /status VARCHAR ( 15 ),
  /remarks VARCHAR ( 255 ),
  /deadline DATE*/
$formdate = new FormDate();
$formdate->year['start'] = 2010;
$formdate->year['end'] = 2010 + 10;
//TODO: auto increment based on system time
//$formdate->month['values'] = 'numbers';
$form_element = array('<div class="desc">Encoder</div><div class="info">' . $encoder_name . '</div>', '<div class="desc">Resident</div><div class="info">' . $resident_name . '</div>', form_label($description['desc'], $description['id']) . form_textarea($description), form_label($has_deadline['desc'], $has_deadline['id']) . form_checkbox($has_deadline), '<label>Deadine</label>' . $formdate->selectMonth() . $formdate->selectDay() . $formdate->selectYear(), form_fieldset('Status') . form_radio($status_1) . form_label($status_1['desc'], $status_1['id']) . form_radio($status_2) . form_label($status_2['desc'], $status_2['id']) . form_radio($status_3) . form_label($status_3['desc'], $status_3['id']) . form_radio($status_4) . form_label($status_4['desc'], $status_4['id']) . form_fieldset_close(), form_label($remarks['desc'], $remarks['id']) . form_textarea($remarks));
?>
  
<?php 
foreach ($form_element as $item) {
    ?>
  <li><?php 
    echo $item;
    ?>
</li>
<?php 
}
?>

<?php 
echo form_reset('reset', 'Reset');
    $barangay = array('name' => 'barangay', 'id' => 'barangay', 'maxlength' => '100', 'size' => '100', 'desc' => 'Barangay', 'value' => $result->barangay);
    $type_1 = array('name' => 'type', 'id' => 'type1', 'desc' => array_get('CATEGORY', 1), 'value' => '1', 'checked' => $result->category == 1);
    $type_2 = array('name' => 'type', 'id' => 'type2', 'desc' => array_get('CATEGORY', 2), 'value' => '2', 'checked' => $result->category == 2);
    $type_3 = array('name' => 'type', 'id' => 'type3', 'desc' => array_get('CATEGORY', 3), 'value' => '3', 'checked' => $result->category == 3);
    $type_4 = array('name' => 'type', 'id' => 'type4', 'desc' => array_get('CATEGORY', 4), 'value' => '4', 'checked' => $result->category == 4);
    $remarks = array('name' => 'remarks', 'id' => 'remarks', 'maxlength' => '255', 'rows' => '3', 'cols' => '100', 'desc' => 'Remarks', 'value' => $result->remarks);
    $formdate = new FormDate();
    $formdate->year['start'] = 1950;
    $formdate->year['end'] = 2010;
    //TODO: auto increment based on system time
    //set the birthday value
    $fulldate = explode('-', $result->birthday);
    $formdate->year['selected'] = $fulldate[0];
    $formdate->month['selected'] = $fulldate[1];
    $formdate->day['selected'] = $fulldate[2];
    $form_element = array(form_label($first_name['desc'], $first_name['id']) . form_input($first_name), form_label($last_name['desc'], $last_name['id']) . form_input($last_name), form_label($address['desc'], $address['id']) . form_textarea($address), form_fieldset('Sex') . form_radio($sex_m) . form_label($sex_m['desc'], $sex_m['id']) . form_radio($sex_f) . form_label($sex_f['desc'], $sex_f['id']) . form_fieldset_close(), form_fieldset('Civil status') . form_radio($status_s) . form_label($status_s['desc'], $status_s['id']) . form_radio($status_m) . form_label($status_m['desc'], $status_m['id']) . form_radio($status_l) . form_label($status_l['desc'], $status_l['id']) . form_radio($status_w) . form_label($status_w['desc'], $status_w['id']) . form_fieldset_close(), form_label($precinct['desc'], $precinct['id']) . form_input($precinct), form_label($barangay['desc'], $barangay['id']) . form_input($barangay), '<label>Birthday</label>' . $formdate->selectMonth() . $formdate->selectDay() . $formdate->selectYear(), form_fieldset('Category') . form_radio($type_1) . form_label($type_1['desc'], $type_1['id']) . form_radio($type_2) . form_label($type_2['desc'], $type_2['id']) . form_radio($type_3) . form_label($type_3['desc'], $type_3['id']) . form_radio($type_4) . form_label($type_4['desc'], $type_4['id']) . form_fieldset_close(), form_label($remarks['desc'], $remarks['id']) . form_textarea($remarks));
    ?>
    
  <?php 
    foreach ($form_element as $item) {
        ?>
      <li><?php 
        echo $item;
        ?>
</li>
  <?php 
    }
    ?>
      
  <?php 
    echo form_reset('reset', 'Reset');