<!---- 
    Author 	: Fachri
    Tgl : 04/10/2016
-->

<div class="easyui-layout" data-options="fit:true,border:false">
    <form id="fm_sub_type" name="fm_sub_type" method="post" action="">
		<input type="hidden" name="detail" id="detail"/>
        <!-- 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 align="left" valign="middle">
                        	<a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-reload'" onclick="location.reload();">Refresh</a>
                        </td>							

                        <td height="25" align="right" valign="middle">								
                            <span class="form-title">Sub Type Master</span>
                        </td>
                    </tr>
                </table>		     	
            </div>			
        </div>
        <!-- end top view -->

        <!-- center view -->
        <div id="form-body" data-options="region:'center',border:false">
            <div id="form-wrapper" class="easyui-panel" style="padding:5px;" fit="true">
                <div class="easyui-layout" fit="true">					
                   		
                        <table id="source_coa" class="easyui-edatagrid" title="" iconCls="icon-edit" singleSelect="true" rowNumbers="true" fitColumns="true"  style="width:auto;height:560px" 
                            
                        >
                            <thead>
                                <tr>
                                	<th field="StatusSelected" width="40"  data-options="halign:'center',align:'center'" editor="{type:'checkbox',options:{on:'Yes',off:'No'}}">#</th>
                                    <th data-options="field:'AccountSubTypeID'" width="80" halign="center"><b>Sub Type ID</b></th>
                                    <th data-options="field:'AccountTypeName'" width="100" halign="center"><b>Sub Type Name</b></th>
                                    <th data-options="field:'AccountTypeDesc'" width="80" halign="center"><b>Account Type Desc</b></th>	
                                    <th data-options="field:'AccountAutoStatus'" width="80" halign="center"><b>Account Auto Status</b></th>									
                                </tr>
                            </thead>
                        </table>					
                    
                </div>						          
            </div>	

            
        </div>
        <!-- end center view -->	

       <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_data();">Save</a>					  
                        <a href="javascript:void(0)" class="easyui-linkbutton  form-button" iconCls="icon-cancel" onclick="parent.tab_close('tt')">Cancel</a>						
                    </td>
                </tr>
            </table>
        </div>
    </form>	
</div>

<div id="dlg_importfile" class="easyui-dialog" data-options="closed:true,width:'270',height:'140',modal:true" style="">
   <br />
   
   <center><img src='<?php echo base_url();?>assets/custom/img/c_loader.gif' id='loading_img' alt='loadingImg' /></center>
   <br />
   <center><span id='id_span'>Jangan menutup halaman ini selama proses perpindahan</span></center>
</div>

<script>
    function format_acc(val,row){
        return '<span style="padding-left:'+row.AccountLevel+'em;">'+val+'</span>';	
    }		
	
	$(function(){
		var source_coa = $('#source_coa').datagrid({remoteFilter:true,type:'post',url:'<?php echo base_url(); ?>setup/sub_type/sub_type_coa'});
		$('#source_coa').datagrid('enableFilter');
		
		$('#selected_coa').edatagrid({
            onBeginEdit:function(rowIndex,rowDatax){
                var editors = $('#selected_coa').datagrid('getEditors', rowIndex);
				
				StatusSelected   = $(editors[0].target); 
               
            },
			onEndEdit: function(){
                var selectedrow     = $('#selected_coa').datagrid('getSelected');
            }
        });
		
	});
	
    function save_data() {
		$('#source_coa').edatagrid('saveRow');
		
        var item    = $('#source_coa').datagrid('getRows');
		var detail  = JSON.stringify(item);

		$("#detail").val(detail);
		save_transaction('<?=$menu_link?>','#fm_sub_type');
    }
</script>