Viewing file: v_add_club_position.php (5.08 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
<script language="javascript" >
$(document).ready(function(){
var seq = $("#pos_seq").attr('value');
if (seq =='') {
var number = parseInt($("#table_show tr:last").children("td:first-child").text())+1 ;
if(isNaN(number)){ number=1; }
$("#pos_seq").attr('value',number);
}
});
</script>
<script language="javascript">
function doSubmit(){
for (var i=0; i < 2; i++)
{
if (document.myform.pos_status[i].checked)
{
var pos_status = document.myform.pos_status[i].value;
}
}
document.myform.pos_status.value = pos_status;
document.myform.submit();
}
</script>
<?php
$_image_reply = array(
'src' => 'images/edit.png',
'width' => '15',
'height' => '15',
'border' => '0',
'title' => 'แก้ไขข้อมูล',
'onmouseover' => "this.style.cursor='pointer'"
);
$_image_del = array(
'src' => 'images/delete.png',
'width' => '15',
'height' => '15',
'border' => '0',
'title' => 'ลบข้อมูล',
'onmouseover' => "this.style.cursor='pointer'"
);
?>
<table width="60%" border="0" align="center">
<tr>
<td align="center"><h3>ข้อมูลตำแหน่งในชมรม</h3></td>
</tr>
<tr ><td align="center">
<?php echo form_open('esa/base_data/add_club_pos', array("name" => "myform", "id" => "myform"));?>
<table class='szone2' width="100%" border="0" align="center">
<tr >
<th width="20%" >ลำดับ</th>
<td width="" >
<input type="text" name="pos_seq" id="pos_seq" value="<?php echo getval('pos_seq', $pos);?>" size="8" /> <font color='red'>*</font>
<?php echo form_error('pos_seq'); ?>
<?php echo isset($error_seq)? $error_seq : "" ?>
<input type="hidden" name="pos_id" value="<?php echo getval('pos_id', $pos);?>" />
<input type="hidden" name="pos_type" value="2"/>
</td>
</tr>
<tr >
<th >ชื่อตำแหน่ง</th>
<td >
<input type="text" name="pos_name" id="pos_name" value="<?php echo getval('pos_name', $pos);?>" size="20" /> <font color='red'>*</font>
<?php echo form_error('pos_name'); ?>
<?php echo isset($error_name)? $error_name : "" ?>
</td>
</tr>
<tr >
<th >จำนวน</th>
<td >
<input type="radio" name="pos_num" value="1" <?php echo (getval('pos_num',$pos)=='1')?'checked':((getval('pos_num',$pos)=='M') ? '' : 'checked'); ?>/> 1 คน
<input type="radio" name="pos_num" value="M" <?php echo (set_value('pos_num',getval('pos_num',$pos))=='M')?'checked':''; ?>/> มากกว่า 1 คน
<?php echo form_error('pos_num'); ?>
</td>
</tr>
<tr >
<th >สถานะ</th>
<td>
<input type="radio" name="pos_status" value="Y" <?php echo (getval('pos_status',$pos)=='Y')?'checked':((getval('pos_status',$pos)=='N') ? '' : 'checked'); ?>/> ใช้
<input type="radio" name="pos_status" value="N" <?php echo (getval('pos_status',$pos)=='N')?'checked':''; ?>/> ไม่ใช้
<?php echo form_error('pos_status'); ?>
</td>
</tr>
<tr >
<td colspan="2" align="center"><?php echo form_error('error_name'); ?>
<input type="submit" name="add" value="บันทึก" /></td>
</tr>
</table><?php echo form_close();?>
</td>
</tr>
</table>
<br />
<table id="table_show" class='tb_1' width="70%" border="0">
<tr>
<th width="10%">ลำดับที่</th>
<th >ชื่อตำแหน่ง</th>
<th width="10%">จำนวน</th>
<th width="10%">สถานะ</th>
<th width="10%">แก้ไข</th>
<th width="5%">ลบ</th>
</tr>
<?php
if ($rs_pos->num_rows > 0) {
$index=1;
foreach ($rs_pos->result() as $row) {
?>
<tr >
<td align="center"><?php echo $row->pos_seq;?></td>
<td align="left"><?php echo $row->pos_name;?></td>
<td align="center"><?php echo ($row->pos_num=='M')?'มากกว่า 1' : $row->pos_num;?></td>
<td align="center"><?php echo ($row->pos_status=='Y')?'ใช้':'ไม่ใช้';?><b></font></td>
<td align="center"><span class="hand" onClick="sendPost('myform', {'pos_id':<?php echo $row->pos_id;?>}, 'club_pos')"><?php echo img($this->config->item('sa_image_reply'));?></span></td>
<td align="center"><span class="hand" onClick="if (confirm('ต้องการลบใช่หรือไม่')) { sendPost('hidform', {'pos_id':<?php echo $row->pos_id;?>,'pos_type':<?php echo $row->pos_type?>}, 'del_pos'); }"><?php echo img($this->config->item('sa_image_del'));?></td>
</tr>
<?php
$index++;
}
} else {
?>
<tr class="notfound">
<td colspan="6">ไม่พบชื่อตำแหน่ง</td>
</tr>
<?php
}
?>
</table>
|