<!---- 
Author 	: Herpan
Tanggal : 12-08-2014	
Revisi 	: dhidhik,11-12-2015 (test bootstap integrate to easyui)
-->

<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 align="left" valign="middle">
                        <a href="#" class="easyui-linkbutton" id="refresh-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">
                            <?= $menu_label ?>
                        </span>
                    </td>
                </tr>
            </table>		     	
        </div>			
    </div>
    <!-- end top view -->	
    <!-- center view -->
    <div id="form-body-grey" data-options="region:'center',border:false" style=" margin-bottom: 34px;">
        <div class="easyui-panel" style="width:auto;padding:5px;height:500px;" fit="true">
            <?php foreach ($detail as $row) : ?>
                <form id="frm_companyinfo" name="frm_companyinfo" method="post">
                    <div class="easyui-tabs">
                       
                        
                        <!-- General Tax -->
                        <div id="tab_general" title="General" style="padding:10px;">
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td><b>Company Code</b></td>
                                    <td width="850" style="padding:1px 0px 2px;">
                                        <input type="text" id="txt_company_code" name="txt_company_code" class="easyui-validatebox td_generaltaxinput" data-options="required:true" value="<?= $row->CompanyCode ?>" style="width:850px;" readonly />
                                    </td>
                                </tr>
                                <tr>
                                    <td><b>Company Name</b></td>
                                    <td width="850" style="padding:1px 0px 2px;">
                                        <input type="text" id="txt_companyname" name="txt_companyname" class="easyui-validatebox td_generaltaxinput" data-options="required:true" value="<?= $row->CompanyName ?>"  style="width:850px;text-transform:uppercase" readonly/>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top"><b>Company Address</b></td>
                                    <td width="850" ><textarea name="txt_address" class="easyui-validatebox" style="width:845px; height:80px; text-transform:uppercase;" data-options="required:true"><?= $row->CompanyAddress ?></textarea></td>
                                </tr>
                                <tr>
                                    <td height="29"><b>City</b></td>
                                    <td width="850">
                                        <select name="cmb_city" id="cmb_city" class="combo-grid" style="width:850px;" required="true" editable="true"
                                                data-options="
                                                value:'<?= $row->CompanyCity ?>',
                                                idField:'CityCode',
                                                textField:'CityName',
                                                url:'<?php echo base_url(); ?>custom/get_data/city',
                                                method: 'get',
                                                columns: [[
                                                {field:'CityCode',title:'City Code',width:420,halign:'center',align:'left'},
                                                {field:'CityName',title:'City Name',width:430,halign:'center',align:'left'}
                                                ]],
                                                ">
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="25"><b>State</b></td>
                                    <td width="850" >
                                        <select name="cmb_state" id="cmb_state" class="easyui-combogrid" style="width:850px;" required="true" editable="false" readonly
                                                data-options="
                                                value:'<?= $row->CompanyState ?>',
                                                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>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="28"><b>Country</b></td>
                                    <td width="850" style="padding:1px 0px 2px;">
                                        <select name="cmb_country" id="cmb_country" class="easyui-combogrid" style="width:850px;" required="true" editable="false" readonly
                                                data-options="
                                                value:'<?= $row->CompanyCountry ?>',
                                                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>Zip Code</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input class="easyui-numberbox" type="text" name="txt_zipcode" value="<?= $row->CompanyPostalCode ?>" style="width:852px;" /></td>
                                </tr>
                                <tr>
                                    <td><b>Phone No.</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_phone_left" class="easyui-numberbox" value="<?= $row->InitialPhone ?>" style="width:30px;" /> - <input type="text" name="txt_phoneno" class="easyui-numberbox" value="<?= $row->PhoneNumber ?>" style="width:809px;" /></td>
                                </tr>
                                <tr>
                                    <td><b>Fax No.</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_fax_left" class="easyui-numberbox" value="<?= $row->InitialFax ?>" style="width:30px;" /> - <input type="text" name="txt_faxno" class="easyui-numberbox" value="<?= $row->FacsimileNumber ?>" style="width:809px;" /></td>
                                </tr>							
                            </table>
                        </div>
                        <!-- End of general tax -->
                        
                        <div id="tab_tax" title="Tax" style="padding:10px;">
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td valign="top"><b>Tax Address</b></td>
                                    <td width="850" ><textarea name="txt_taxaddress" class="easyui-validatebox" style="width:845px; height:80px; text-transform:uppercase;" data-options="required:true"><?= $row->CompanyTaxAddress ?></textarea></td>
                                </tr>
                                <tr>
                                    <td><b>Form Serial Number</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_taxformserialnumber" value="<?= $row->CompTaxSNForm ?>" style="width:850px;" /></td>
                                </tr>
                                <tr>
                                    <td><b>Tax Registration Number</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_taxregistnumber" value="<?= $row->CompTaxRegNumber ?>" style="width:850px;" /></td>
                                </tr>
                                <tr>
                                    <td><b>Taxable Company's No.</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_taxablecompanysno" value="<?= $row->CompTaxNumber ?>" style="width:850px;" /></td>
                                </tr>
                                <tr>
                                    <td><b>Taxable Company's Date</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_taxablecompanysdate" class="easyui-datebox" value="<?= convert_to_dmy($row->CompTaxDate) ?>" style="width:180px" editable="false" /></td>
                                </tr>
                                <tr>
                                    <td><b>Tax Type</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_taxtype" value="<?= $row->CompTaxType ?>" style="width:850px;" /></td>
                                </tr>
                                <tr>
                                    <td><b>KLU</b></td>
                                    <td width="850" style="padding:1px 0px 2px;"><input type="text" name="txt_taxklu" value="<?= $row->CompTaxKLU ?>" style="width:850px;" /></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </form>	
            <?php endforeach ?>
        </div>

    </div>
    <div class=" clearfix"></div>
    <div id="form-footer" data-options="region:'south',border:false">
    <!--<div style="bottom: 24px; position:absolute; width:100%;">-->
        <!--<div class="col-md-12 text-right" style="padding:2px; background: #ccccff;">-->
        <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>
                    <?php
                    //---------Untuk privellege jika dia ada tombol save----------
                    if ($group_user->SavePrivillage == 1) {
                        $cek_autority = "";
                    } else {
                        $cek_autority = "disabled";
                    }
                    //-------------end----------------------------
                    ?>			 
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-save" onclick="save_data('setup/company_info', '#frm_companyinfo', 1);" <?php echo $cek_autority; ?>>Save</a> 								
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="parent.tab_close('tt');" <?php echo $cek_autority; ?>>Cancel</a>	
                </td>
            </tr>
        </table>
        <!--</div>-->
    </div> 
</div>

<script>
    $(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>