Viewing file: _v_add_military.php (7.43 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<link rel="stylesheet" href="<?=base_url();?>/js/textboxlist_proto/textboxlist.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" />
<script src="<?=base_url();?>/js/textboxlist_proto/protoculous-effects-shrinkvars.js" type="text/javascript" charset="utf-8"></script>
<script src="<?=base_url();?>/js/textboxlist_proto/textboxlist.js" type="text/javascript" charset="utf-8"></script>
<script src="<?=base_url();?>/js/textboxlist_proto/textboxlistauto.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
document.observe('dom:loaded', function() {
// init
tlist1 = new FacebookList('wk11_co', 'wk11_auto');
var get_user_list_url = "<?php echo site_url($this->config->item('sa_folder').'search/get_mstd_list')?>";
// fetch and feed
new Ajax.Request(get_user_list_url, {
onSuccess: function(transport) {
transport.responseText.evalJSON(true).each(function(t){tlist1.autoFeed(t)});
}
});
});
Element.addMethods({
onBoxDispose: function(item,obj) { obj.autoFeed(item.retrieveData('text')); },
onInputFocus: function(el,obj) { obj.autoShow(); },
onInputBlur: function(el,obj) {
obj.lastinput = el;
obj.blurhide = obj.autoHide.bind(obj).delay(0.1);
},
filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;}
});
function do_submit(){
tlist1.update();
document.getElementById('persons').value = $F('wk11_co');
document.myform.submit();
}
jQuery(document).ready(function(){
change_rt();
});
function change_rt(){
var rt_id = jQuery("#mil_rt_id").val();
if (rt_id == 2) {
jQuery("#mil_ecp_id").attr('disabled','');
jQuery("#mil_served_as").attr('disabled','disabled').val('');
jQuery("#mil_fr_year").attr('disabled','disabled').val('');
jQuery("#mil_to_year").attr('disabled','disabled').val('');
} else if (rt_id == 3) {
jQuery("#mil_ecp_id").attr('disabled','disabled').val('');
jQuery("#mil_served_as").attr('disabled','');
jQuery("#mil_fr_year").attr('disabled','');
jQuery("#mil_to_year").attr('disabled','');
} else {
jQuery("#mil_ecp_id").attr('disabled','disabled').val('');
jQuery("#mil_served_as").attr('disabled','disabled').val('');
jQuery("#mil_fr_year").attr('disabled','disabled').val('');
jQuery("#mil_to_year").attr('disabled','disabled').val('');
}
}
</script>
<?php
$row_mil = isset($qu_mil) ? $qu_mil->row() : NULL;
$attributes = array('id' => 'myform', 'name' => 'myform');
echo form_open($this->config->item('sa_folder').'military/mil_insert_update', $attributes);
?>
<table class="tb_1" width="60%" border="0">
<tbody>
<tr>
<th colspan="2" align="center">บันทึกงานการทหาร/นักศึกษาวิชาทหาร</th>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<?php
if (isset($qu_mil)) {
?>
<tr class="light1">
<td align="left">รหัส/ชื่อนักศึกษา</td>
<td><?php echo getval('stdCode', $row_mil).': '.getval('stdName', $row_mil).' '.getval('stdSurname', $row_mil);?>
<input type="hidden" id="std" name="std" value="<?php echo getval('stdCode', $row_mil).': '.getval('stdName', $row_mil).' '.getval('stdSurname', $row_mil).'###';?>" /></td>
</tr>
<?php
} else {
?>
<tr class="light1">
<td align="left">รหัส/ชื่อนักศึกษา</td>
<td><input type="text" id="wk11_co" name="wk11_co" value="" />
<div id="wk11_auto">
<div class="default">กรุณากรอกรหัส/ชื่อนักศึกษา</div>
<ul class="feed"></ul>
</div>
<?php echo form_error('wk11_co');?></td>
</tr>
<?php
}
?>
<tr class="light">
<td align="left">สถานภาพทางทหาร</td>
<td align="left">
<?php
$js = "id=\"mil_rt_id\" onChange=\"change_rt()\"";
echo form_dropdown('mil_rt_id', $rs_rt, getval('mil_rt_id', $row_mil), $js);
?>
<font color="red">* <?php echo form_error('mil_rt_id');?></font></td>
</tr>
<tr class="light1">
<td align="left">ได้รับการยกเว้น เนื่องจาก</td>
<td align="left">
<?php
$js = "id=\"mil_ecp_id\" disabled";
echo form_dropdown('mil_ecp_id', $rs_ecp, getval('mil_ecp_id', $row_mil), $js);
?>
<font color="red">* <?php echo form_error('mil_ecp_id');?></font></td>
</tr>
<tr class="light">
<td align="left">ผ่านการเกณฑ์ทหาร ได้เป็น</td>
<td align="left"><input type="text" id="mil_served_as" name="mil_served_as" value="<?php echo getval('mil_served_as', $row_mil);?>" disabled />
<font color="red">* <?php echo form_error('mil_served_as');?></font></td>
</tr>
<tr class="light1">
<td align="left">ตั้งแต่ พ.ศ.</td>
<td align="left"><input type="text" id="mil_fr_year" name="mil_fr_year" value="<?php echo getval('mil_fr_year', $row_mil, set_value('mil_fr_year'));?>" size="4" maxlength="4" class="required-int" disabled />
<font color="red">* <?php echo form_error('mil_fr_year');?></font></td>
</tr>
<tr class="light">
<td align="left">ถึง พ.ศ.</td>
<td align="left"><input type="text" id="mil_to_year" name="mil_to_year" value="<?php echo getval('mil_to_year', $row_mil);?>" size="4" maxlength="4" class="required-int" disabled />
<font color="red">* <?php echo form_error('mil_to_year');?></font></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" id="btnSubmit" name="btnSubmit" value="บันทึก" onClick="javascript:do_submit();" />
<input type="hidden" id="mil_id" name="mil_id" value="<?php echo getval('mil_id', $row_mil);?>" /></td>
</tr>
</tbody>
</table>
<?php echo form_close();?>
<table class="tb_1">
<thead>
<tr>
<th>ลำดับ</th>
<th>รหัสนักศึกษา</th>
<th>ชื่อ-สกุลนักศึกษา</th>
<th>สถานภาพทางทหาร</th>
<th>ร.ด.</th>
<th>แก้ไข</th>
<th>ลบ</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
if (isset($rs_mil)) {
foreach ($rs_mil->result() as $row_mil) {
?>
<tr>
<td align="center"><?php echo $i;?></td>
<td align="center"><?php echo $row_mil->stdCode;?></td>
<td><?php echo $row_mil->prefixName.$row_mil->stdName.' '.$row_mil->stdSurname;?></td>
<td><?php echo $row_mil->rtName;?>
<?php echo ($row_mil->mil_rt_id == 2) ? 'เนื่องจาก'.$row_mil->ecp_name : '';?>
<?php echo ($row_mil->mil_rt_id == 3) ? 'ได้เป็น'.$row_mil->mil_served_as : '';?>
<?php echo ($row_mil->mil_rt_id == 3) ? 'ตั้งแต่ พ.ศ.'.$row_mil->mil_fr_year.' ถึง พ.ศ.'.$row_mil->mil_to_year : '';?></td>
<td><span class="hand" onClick="sendPost('myform', {'mil_id':<?php echo $row_mil->mil_id;?>}, 'rd_input')">ร.ด.</span></td>
<td align="center"><span class="hand" onClick="sendPost('myform', {'mil_id':<?php echo $row_mil->mil_id;?>}, 'mil_input')"><?php echo img($this->config->item('sa_image_reply'));?></span></td>
<td align="center"><span class="hand" onClick="if (confirm('ต้องการลบใช่หรือไม่')) { sendPost('hidform', {'mil_id':<?php echo $row_mil->mil_id;?>}, 'mil_delete'); }"><?php echo img($this->config->item('sa_image_del'));?></span></td>
</tr>
<?php
$i++;
}
}
?>
</tbody>
</table>
|