<!---- 
    Author 	: Ladur / 12-08-2014	
    Revisi 	: Ferry / 17-12-2014 / Show all of department by company code
-->

	<?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 Employee','<?=$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" fit="true" style="padding:5px;">
            <form id="fm_employee" name="fm_employee" method="post">
            	<table class="form-detail" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td><b>Employee Code</b></td>
                        <td width="850" style="padding:1px 0px 2px;">
                            <input type="text" name="txt_employeeno" class="easyui-validatebox" style="width:850px;text-transform:uppercase" required autocomplete="off" />
                    	</td>
                    </tr>

                    <tr>
                        <td><b>Employee Name</b></td>
                        <td style="padding:1px 0px 2px;">
							<input type="text" name="txt_employeename" class="easyui-validatebox" style="width:850px;text-transform:uppercase" autocomplete="off" />
                        </td>
                    </tr>

                    <tr>
                        <td><b>Department</b></td>
                        <td style="padding:1px 0px 2px;">
                            <select class="combo-grid td_input" name="cmb_departement" required editable="true" style="width:852px;height:20px" 
                                data-options="
                                    panelWidth: 852,
                                    idField: 'DepartmentCode',
                                    textField: 'DepartmentName',
                                    url: '<?php echo base_url(); ?>custom/get_data/department',
                                    method: 'get',
                                    columns: [[
                                        {field:'DepartmentCode',title:'Departement Code',width:110},
                                        {field:'DepartmentName',title:'Departement Name',width:190}
                                    ]],
                                    fitColumns: true
                                ">
                            </select>
                        </td>
                    </tr>
 
                    <tr>
                        <td><b>Job Title</b></td>
                        <td style="padding:1px 0px 2px;">
                            <select class="combo-grid td_input" name="cmb_jobtitle" required editable="true" style="width:852px;height:20px" 
                                data-options="
                                    panelWidth: 852,
                                    idField: 'JobTitleCode',
                                    textField: 'JobTitleName',
                                    url: '<?php echo base_url(); ?>custom/get_data/jobtitle',
                                    method: 'get',
                                    columns: [[
                                        {field:'JobTitleCode',title:'Job Title Code',width:110},
                                        {field:'JobTitleName',title:'Job Title Name',width:190}
                                    ]],
                                    fitColumns: true
                                ">
                            </select>
                        </td>
                    </tr>
                    
                    <tr>
                        <td valign="top" style="padding-top:4px;"><b>Address</b></td>
                        <td style="padding:1px 0px 2px;">
                            <textarea name="txt_address" rows="4" style="width:846px;resize:none;"></textarea>
                        </td>
                    </tr>
                    
                    <tr>
                        <td><b>City/State/Country</b></td>
                        <td style="padding:1px 0px 2px;">
                            <select name="cmb_city" id="cmb_city" class="combo-grid" style="width:282px;height:20px" required="true" editable="true"
                                data-options="
                                    idField:'CityCode',
                                    textField:'CityName',
                                    url:'<?php echo base_url(); ?>custom/get_data/city',
                                    method: 'get',
                                    columns: [[
                                        {field:'CityCode',title:'City Code',width:100,halign:'center',align:'left'},
                                        {field:'CityName',title:'City Name',width:161,halign:'center',align:'left'}
                                    ]],
                                ">
                            </select>
                            
                            <select name="cmb_state" id="cmb_state" class="easyui-combogrid" style="width:282px;height:20px" required="true" editable="false" readonly
                                data-options="
                                    idField:'StateCode',
                                    textField:'StateName',
                                    url:'<?php echo base_url(); ?>custom/get_data/state',
                                    method: 'get',
                                    columns: [[
                                        {field:'StateCode',title:'State Code',width:100,halign:'center',align:'left'},
                                        {field:'StateName',title:'State Name',width:161,halign:'center',align:'left'}
                                    ]],
                                ">
                            </select>
                            
                            <select name="cmb_country" id="cmb_country" class="easyui-combogrid" style="width:280px;height:20px" required="true" editable="false" readonly
                                data-options="
                                    idField:'CountryCode',
                                    textField:'CountryName',
                                    url:'<?php echo base_url(); ?>custom/get_data/country',
                                    method: 'get',
                                    columns: [[
                                        {field:'CountryCode',title:'Country Code',width:100,halign:'center',align:'left'},
                                        {field:'CountryName',title:'Country Name',width:161,halign:'center',align:'left'}
                                    ]],
                                ">
                            </select>
                        </td>
                    </tr>
                    
                    <tr>
                        <td><b>Hire Date</b></td>
                        <td style="padding:1px 0px 2px;">
                            <input type="text" class="easyui-datebox" name="txt_hire_date" style="width:100px;" />
                        </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_data('<?php echo $menu_link?>','#fm_employee', 1);" <?php echo $cek_autority_save;?>>Save</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="">Cancel</a>
                </td>
            </tr>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $('#cmb_city').combogrid({
            onSelect:function(rowIndex, rowData){
                $('#cmb_state').combogrid('setValue', rowData.StateCode);
            }
        });

        $('#cmb_state').combogrid({
            onSelect:function(rowIndex, rowData){
                $('#cmb_country').combogrid('setValue', rowData.CountryCode);
            }
        });
    });
</script>