<!--
Author       : Tagor
Created Date : 2014/08/11
Revision     : 1) Ferry | 2014/10/30 | Perbaikan Filtering
               2) Hasan | 2015/02/25 | Design UI
               3) Fachri | 2015/03/26 | Perbaikan Trans Status
-->
	
	<?php
			//---------Untuk privellege jika dia ada tombol save----------
				if($group_user->AddPrivillage == 1){
					$cek_autority_add  = "";
				}
				else{
					$cek_autority_add 	= "disabled";
				}
				
				if($group_user->EditPrivillage == 1){
					$cek_autority_edit	 = "";
				}
				else{
					$cek_autority_edit 	= "disabled";
				}
				
				if($group_user->DeletePrivillage == 1){
					$cek_autority_delete  = "";
				}
				else{
					$cek_autority_delete 	= "disabled";
				}
				//-------------end----------------------------
	?>

<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'north',border:false" style="height:30px" id="button-top">
        
    </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">
        	<form class="form-filter">
                <table width="100%" cellpadding="0" cellspacing="0" id="tab_transstatus">
                <tr>
                    <td width="190" align="left" style="padding-bottom:8px;">
                        <b>Find</b>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <input id="txt_IDNumber" name="txt_IDNumber" placeholder="< Item Code >" style="margin:2px 0px 3px;width:172px;height:22px;border:1px solid #CCC;">
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <input id="txt_Description" name="txt_Description" placeholder="< Description >" style="margin:2px 0px 3px;width:172px;height:22px;border:1px solid #CCC;">
                    </td>
                </tr>
                <tr><td><div class="tr-divider"></div></td></tr>
                <tr>
                    <td style="padding-bottom:8px;">
                        <b>by Item Category</b>
                    </td>
                </tr>
				<tr>
                    <td>
                    	<select class="easyui-combogrid td_input" name="cmb_category" id="cmb_category" 
                            style="height:20px;width:175px;" 
                            data-options="
                                panelWidth: 231,
                                idField: 'ItemCategoryID',
                                textField: 'ItemCategoryName',
                                url: '<?php echo base_url(); ?>custom/get_data/itemcategory',
                                method: 'get',
                                columns: [[
                                {field:'ItemCategoryName',title:'Item Category Name',width:190}
                                ]],
                                fitColumns: true
                            " required editable="false"
                        >
                        </select>
                    </td>
                </tr>
                <tr><td><div class="tr-divider"></div></td></tr>
                <tr>
                    <td style="padding-bottom:8px;">
                        <b>by Item Type</b>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" name="chk_ItemType" value="1" checked /> Fixed Asset
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" name="chk_ItemType" value="2" checked  /> Inventory Part
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" name="chk_ItemType" value="3" checked  /> Non Inventory Part
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" name="chk_ItemType" value="4" checked  /> Service
                    </td>
                </tr>
                </table>
        	</form>
        </div>
    </div>
    
    <div data-options="region:'center',border:false,iconCls:'icon-ok'">
    	<table id="grid"
        	title="" iconCls="icon-edit" 
            singleSelect="true" rowNumbers="true" 
            pageSize="150" mode="remote"
            fitColumns="true" remoteSort="false" 
            url="<?=base_url($menu_link.'/ajax')?>" 
            style="width:auto;height:525px" 
            data-options = "border:false,view:scrollview,autoRowheight:false"
        > 
		
            <thead>
                <tr>
                    <th halign="center" field="TransNumber" width="80" sortable="true">Item Code</th>
                    <th halign="center" field="ItemDesc" width="250" sortable="true">Item Description</th>
                    <th halign="center" field="ItemCategoryName" width="110" align="left" sortable="true">Category</th>
                    <th halign="center" field="ItemTypeName" width="60" align="left" sortable="true">Type</th>
                    <th halign="center" field="unit" width="30" align="left" sortable="true">Unit</th>
                    <th halign="center" field="TransStatus" width="80" align="left" sortable="true" hidden>Status</th>
                </tr>
            </thead>
        </table>
    </div>
</div>

<script type="text/javascript">
$(document).ready(function(){
	
	var status_privelage_delete = '<?php echo $group_user->DeletePrivillage;?>';
    var status_privelage_edit 	= '<?php echo $group_user->EditPrivillage;?>';
    var status_privelage_add    = '<?php echo $group_user->AddPrivillage;?>';

    list_master_datagrid('ItemMaster','<?=$menu_link;?>','Item Master',status_privelage_edit,status_privelage_delete,status_privelage_add, 'Active');
});

/*
	jangan lupa ini ditaro dibawah di setaip list untuk search
	taro di luar documen ready jangan didalam doc ready
	jangan lupa hapus fungsi on key up di setiap find
	jangan lupa cek id gridnya
	created by : fachri 
*/
function searching_data(){
			var txt_IDNumber 			= $('#txt_IDNumber').val();
			var txt_Description 		= $('#txt_Description').val();
			var ItemCategoryName 		= $('#cmb_category').combobox('getValue');
			
			var chk_status = new Array();
			$.each($('input[name="chk_TransStatus"]:checked'),function(){
				chk_status.push($(this).val());
			});
			
			var chk_ItemType = new Array();
			$.each($('input[name="chk_ItemType"]:checked'),function(){
				chk_ItemType.push($(this).val());
			});
			
			$('#grid').datagrid('load',{
				ItemTypeID			: chk_ItemType,
				ItemCode		 	: txt_IDNumber,
				ItemDesc		 	: txt_Description,
				ItemCategoryName	: ItemCategoryName,
				TransStatus 		: chk_status
				
			});	
}
//------------------end--------------------------------------



</script>