<!---- 
    Author 	: Tagor / 12-08-2014	
    Revisi 	: Ferry / 06-01-2014
-->
<?php
//---------Untuk privellege jika dia ada tombol save----------
	if($group_user->SavePrivillage == 1){
		$cek_autority_save  = "";
	}
	else{
		$cek_autority_save 	= "disabled";
	}
//-------------end----------------------------
?>
<div class="easyui-layout" data-options="fit:true,border:false">
    <!-- top view-->
    <div id="form-header" data-options="region:'north',border:false" >
        <div id="form-header-wrapper">
            <table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0">
                <tr>
                    <td height="26" align="left" valign="middle">
                        <a href="#" class="easyui-linkbutton" iconCls="icon-document" plain="true" onclick="parent.tab_add('New Departement','<?=$menu_link?>','icon-add','add')">New</a>
                    </td>
                    <td align="right" valign="middle">								
                        <span class="form-title">
                            <?php echo $menu_label; ?>
                        </span>
                    </td>
                </tr>
            </table>		     	
        </div>			
    </div>
    <!-- end top view -->

	<!-- center view -->
    <div id="form-body-grey" data-options="region:'center',border:false">
        <div id="form-wrapper" class="easyui-panel" style="width:auto;padding:5px;height:524px;" fit='true'>
        	<form id="fm_departement" name="fm_departement" method="post">
            	<table class="form-detail" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td><b>Department Code</b></td>
                        <td width="850" style="padding:1px 0px 2px;">
                            <input type="text" name="txt_deptartement_code" class="easyui-validatebox disabled" required="true" id="txt_deptartement_code" value="<?=$DepartmentCode?>" style="width:850px;text-transform:uppercase;" readonly />
                    		<!--<input type="checkbox" name="chk_sub_departement" class="easyui-validatebox" id="chk_sub_departement" onClick="show_cmb()" />Sub Dept.-->
                            <span id="subdep" style="display:none;">
                                Of <input type="text" name="txt_subdep" class="easyui-validatebox" id="txt_subdep" style="width:100px;" />
                                <a href="javascript:void(0)" class="easyui-linkbutton" onClick="popup_department()" style="height:18px">..</a>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td><b>Department Name</b></td>
                        <td width="850" style="padding:1px 0px 2px;">
                            <input type="text" name="txt_deptartement_name" class="easyui-validatebox" required="true" id="txt_deptartement_name" style="width:850px;text-transform:uppercase;" />
                    	</td>
                    </tr>
                    <tr>
                        <td valign="top" style="padding-top:4px;"><b>Description</b></td>
                        <td width="850" style="padding:1px 0px 2px;">
                            <textarea name="txt_deptartement_description" id="txt_deptartement_description" style="resize:none;width:846px;white-space:normal;" rows="4"></textarea>
                    	</td>
                    </tr>
				</table>
            </form>
        </div>
    </div>
    <div id="form-footer" data-options="region:'south',border:false">
    	<table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td align="right">
                    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-help" onclick="" plain="true">Help</a>			
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-save" onclick="save_transaction('list/departement', '#fm_departement');" <?php echo $cek_autority_save;?>>Save</a> 								
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="$('#fm_departement').form('clear');">Cancel</a>	
                </td>
            </tr>
        </table>
    </div>
</div>

<script type="text/javascript">
function show_cmb(){
	if($("#chk_sub_departement").checked = true){			
		$('#subdep').show();
	} 
}

function popup_department(){
	modal_open('Department','dialog-dept');
	$('#form_dept').form('clear');
}

$('#tt').datagrid({
	onDblClickRow:function(){
		var str = $('#tt').datagrid('getSelected').DepartmentNo;
		$("#txt_subdep").val(str);
		$('#dialog-dept').dialog('close');
	}
});
</script>