<!--
Author 		 : Wahyu
Created Date : 02-09-2014	
Revision 	 : 1) Hasan | 11/02/2015 | Design UI
-->

<?php
//$disable_add	= '';
//$disable_edit	= '';
//$disable_delete	= '';
// -Later use
//if(strpos($available_action, 'A') === false)
//	$disable_add	= 'disabled';
//if(strpos($available_action, 'E') === false)
//	$disable_edit	= 'disabled';
//if(strpos($available_action, 'D') === false)
//	$disable_delete	= 'disabled';
?>

<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'north',border:false" style="height:30px">
        <div style="padding:2px">
            <a href="#" class="easyui-linkbutton" id="new-linkbutton" data-options="plain:true,iconCls:'icon-add'" onClick="parent.tab_add('New Warehouse Type','<?php echo $menu_link; ?>','icon-add','add');">New</a>
            <a href="#" class="easyui-linkbutton" id="edit-linkbutton" data-options="plain:true,iconCls:'icon-edit'" onclick="parent.tab_edit('Edit Warehouse Type', '<?php echo $menu_link; ?>', 'icon-edit', 'edit', $('#tt').datagrid('getSelected').WHTypeID)">Edit</a>
            <a href="#" class="easyui-linkbutton" id="suspend-linkbutton" data-options="plain:true,iconCls:'icon-remove'" onclick="suspend_data_new('L',1,'<?php echo $menu_link; ?>', $('#tt').datagrid('getSelected').WHTypeID,'#tt')">Suspend</a>
            <a href="#" class="easyui-linkbutton" id="refresh-linkbutton" data-options="plain:true,iconCls:'icon-reload'" onclick="tab_reload();">Refresh</a>
            <a href="#" class="easyui-linkbutton" id="preview-linkbutton" data-options="plain:true,iconCls:'icon-print'" onclick="parent.tab_add('Print Warehouse Type', '<?php echo $menu_link; ?>', 'preview', 'to_preview')">Print Preview</a>
        </div>
    </div>
    
    <div id="west-panel" data-options="region:'west',split:true,border:true" title="Filter" style="width:190px;background-color:#CCCCFF;">
        <div style="padding:5px">
            <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td width="283" align="left" colspan="2" style="padding-bottom:8px;">
                    <b>Find</b>
                </td>
            </tr>
            <tr>
                <td width="283" align="left" colspan="2">
                	<input id="txt_no" name="txt_no" placeholder="< Warehouse Type >" style="margin:2px 0px 3px;width:172px;height:20px;border:1px solid #CCC" onKeyup="search_master()">
                </td>
            </tr>
            <tr>
                <td width="283" align="left" colspan="2">
                	<input id="txt_desc" name="txt_desc" placeholder="< Description >" style="margin:2px 0px 3px;width:172px;height:20px;border:1px solid #CCC" onKeyup="search_master()">
                </td>
            </tr>
            <tr><td colspan="2"><div class="tr-divider"></div></td></tr>
            <tr>
                <td width="283" align="left" colspan="2" style="padding-bottom:8px;">
                    <b>Status</b>
                </td>
            </tr>
            <tr>
                <td width="283" align="left" colspan="2">
                	<input type="checkbox" name="TransStatus" value="0" onClick="search_master()" checked/> Active
                </td>
            </tr>
            <tr>
                <td width="283" align="left" colspan="2">
                	<input type="checkbox" name="TransStatus" value="3" onClick="search_master()" checked/> Suspended
                </td>
            </tr>
            </table>
        </div>
    </div>
    
    <div data-options="region:'center',border:false,iconCls:'icon-ok'">
        <table id="tt" class="easyui-datagrid" 
        	rowNumbers="true" fitColumns="true" 
            singleSelect="true" pagination="true" 
            pageSize="20" remoteSort="false" 
        	url="<?php  echo site_url($menu_link.'/ajax');?>" 
            style="width:auto;height:560%"
        >
			<thead>
            <tr>
            	<th field="WHTypeID" width="200" halign="center" align="left" sortable="true" hidden="true">Warehouse Type Code</th>
                <th field="WHTypeName" width="200" halign="center" align="left" sortable="true">Warehouse Type</th>
                <th field="WHTypeDesc" width="600" halign="center" align="left">Description</th>
                <th field="Status" width="125" halign="center" align="left" sortable="true">Status</th>
            </tr>
			</thead>
		</table>
    </div>
</div>

<script type="text/javascript">
$(document).ready(function(){
	$('#tt').datagrid({
            onDblClickRow:function(){
                parent.tab_edit('Edit Taxes', '<?php echo $menu_link; ?>', 'icon-edit', 'edit', $('#tt').datagrid('getSelected').WHTypeID);
            },
            onClickRow:function(index,value){
                if(value.Status=='Suspended'){
                    $('#suspend-linkbutton').linkbutton('disable');
                    $('#edit-linkbutton').linkbutton('disable');
                }
                else{
                    $('#suspend-linkbutton').linkbutton('enable');
                    $('#edit-linkbutton').linkbutton('enable');
                }
            }
	});
});
</script>