<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
    CodeBehind="PurchaseLocation.aspx.cs" Inherits="HRMS.Purchase.PurchaseLocation" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <div class="main-panel">
            <div class="row">
                <div class="col-md-12">
                    <section class="panel">

                        <header class="panel-heading">
                            Purchase Location
                            <div class="pull-right">
                                <asp:button text="Save" CssClass="btn btn-info" ID="btn_save" Width="120px"
                                    ValidationGroup="save" runat="server" onclick="btn_save_Click" />
                                <%--onclick="btn_save_Click"--%>
                                    <asp:button text="Back" CssClass="btn btn-info" ID="btn_cancel" 
                                        runat="server" onclick="btn_cancel_Click" />
                            </div>
                        </header>

                        <div class="panel-body">
                            <div class="span6">
                                <div id="divmessage" runat="server" visible="false"
                                    class="alert alert-info alert-dismissable">
                                    <asp:label text="" ID="lbl_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                            <div class="span6">
                                <div id="diverrmessage" runat="server" visible="false"
                                    class="alert alert-info alert-dismissable">
                                    <asp:label text="" id="lbl_err_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                            <div class="row" style="padding-top:10px">

                                <label class="control-label col-md-3"></label>
                                <div class="panel panel-default">
                                    <div class="col-md-7 panel-body">
                                        <div class="col-md-2 text-left form-check">
                                            <span class="radio">
                                                <input class="form-check-input" runat="server" type="radio"
                                                    name="flexRadioDefault" id="flexRadioDefault1" />
                                                <label class="form-check-label" for="flexRadioDefault1">
                                                    Global
                                                </label>
                                            </span>
                                        </div>
                                        <div class="col-md-2 text-left form-check">
                                            <span class="radio">
                                                <input class="form-check-input" runat="server" type="radio"
                                                    name="flexRadioDefault" id="flexRadioDefault2" />
                                                <label class="form-check-label" for="flexRadioDefault2">
                                                    Local
                                                </label>
                                            </span>
                                        </div>

                                    </div>
                                </div>
                            </div>

                            <div class="row" style="padding-top:10px">
                                <asp:HiddenField ID="hid_location" runat="server" />
                                <label class="control-label col-md-3">Name</label>
                                <div class="col-md-3">
                                    <asp:TextBox CssClass="form-control" ID="txt_name" runat="server">
                                        </asp:TextBox>
                                        <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                            runat="server" id="rname" controltovalidate="txt_name"
                                            errormessage="Name is Required!" />
                                </div>
                                <label class="col-md-2 control-label"></label>
                                <div class="col-md-3">
                                </div>
                            </div>

                            <div class="row" style="padding-top:10px">
                                <label class="col-md-3 control-label">Inactive Date</label>
                                <div class="col-md-3">
                                    <asp:TextBox CssClass="form-control datetime" ID="txt_active" runat="server">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                        runat="server" id="rdate" controltovalidate="txt_active"
                                        errormessage="Name is Required!" />
                                </div>

                                <%--<label class="col-md-1 control-label"></label>--%>
                                    <div class="col-md-3 text-left">
                                        <span class="checkbox"><input id="chkbox_legal" runat="server" type="checkbox"
                                                name="chkbox_legal" />
                                            <label class="col-md-1 control-label"></label>Legal Address</span>
                                    </div>
                            </div>

                            <div class="row" style="padding-top:10px">
                                <label class="control-label col-md-3">Decription</label>
                                <div class="col-md-5">
                                    <asp:TextBox CssClass="form-control" ID="txt_description" TextMode="MultiLine" runat="server"
                                        style="width:90% !important">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                        runat="server" id="rdescription" controltovalidate="txt_description"
                                        errormessage="Description is Required!" />
                                </div>

                                <label class="col-md-2 control-label"></label>
                                <div class="col-md-3 text-left">

                                </div>
                            </div>

                            <br />
                            <asp:HiddenField runat="server" ID="hidTAB" Value="0" />

                            <ul class="nav nav-tabs" id="myTabs">
                                <li class="active"><a data-toggle="tab" id="address_click" href="#Address"
                                        aria-expanded="true">Address Detail</a></li>
                                <li class="inactive"><a data-toggle="tab" id="shiping_click" href="#Shiping"
                                        aria-expanded="false">Shiping Detail</a></li>
                                <li class="inactive"><a data-toggle="tab" id="other_click" href="#Other"
                                        aria-expanded="false">Other Detail</a></li>
                            </ul>

                            <div class="tab-content">
                                <div id="Address" class="tab-pane fade active in">
                                    <br />
                                    <div class="row" style="padding-top:10px">
                                        <label class="col-md-3 control-label">Address Style</label>
                                        <div class="col-md-3">
                                            <div class="input-group">
                                                <asp:HiddenField ID="hid_country" runat="server" />
                                                <asp:TextBox CssClass="form-control" ID="txt_country" runat="server">
                                                </asp:TextBox>
                                                <asp:RequiredFieldValidator SetFocusOnError="true"
                                                    ValidationGroup="save" runat="server" id="rcountry"
                                                    controltovalidate="txt_country"
                                                    errormessage="Country is Required!" />
                                                <span class="input-group-btn">
                                                    <button id="btn_lov_country" type="button" runat="server"
                                                        class="btn btn-white" onserverclick="btn_lov_country_Click">
                                                        <%--onserverclick="btn_lov_country_Click"--%>
                                                            <i class="fa fa-search"></i>
                                                    </button>
                                                </span>
                                            </div>
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <asp:HiddenField ID="hid_address" runat="server" />
                                        <asp:HiddenField ID="hid_address1" runat="server" />
                                        <asp:HiddenField ID="hid_address2" runat="server" />
                                        <asp:HiddenField ID="hid_address3" runat="server" />
                                        <asp:HiddenField ID="hid_town" runat="server" />
                                        <asp:HiddenField ID="hid_country1" runat="server" />
                                        <asp:HiddenField ID="hid_postcode" runat="server" />
                                        <asp:HiddenField ID="hid_telephone1" runat="server" />
                                        <asp:HiddenField ID="hid_telephone2" runat="server" />
                                        <asp:HiddenField ID="hid_country2" runat="server" />
                                        <asp:HiddenField ID="hid_fax" runat="server" />   
                                        <asp:HiddenField ID="hid_region" runat="server" />
                                        <asp:HiddenField ID="hid_enterby" runat="server" />
                                        <label class="col-md-3 control-label">Address</label>
                                        <div class="col-md-3">
                                            <div class="input-group">
                                                <asp:TextBox CssClass="form-control" ID="txt_address" runat="server">
                                                </asp:TextBox>
                                                <asp:RequiredFieldValidator SetFocusOnError="true"
                                                    ValidationGroup="save" runat="server" id="raddress"
                                                    controltovalidate="txt_address" errormessage="Address is Required!" />
                                                <span class="input-group-btn">
                                                    <button id="btn_lov_address" type="button" runat="server"
                                                        class="btn btn-white" onserverclick="btn_lov_address_Click">
                                                        <%--onserverclick="btn_lov_city_Click"--%>
                                                            <i class="fa fa-search"></i>
                                                    </button>
                                                </span>
                                            </div>
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <asp:HiddenField ID="hid_timezone" runat="server" />
                                        <label class="col-md-3 control-label">Time Zone</label>
                                        <div class="col-md-3">
                                            <div class="input-group">
                                                <asp:TextBox CssClass="form-control" ID="txt_timezone" runat="server">
                                                </asp:TextBox>
                                                <asp:RequiredFieldValidator SetFocusOnError="true"
                                                    ValidationGroup="save" runat="server" id="rtimezone"
                                                    controltovalidate="txt_timezone"
                                                    errormessage="Time Zone is Required!" />
                                                <span class="input-group-btn">
                                                    <button id="btn_lov_timezone" type="button" runat="server"
                                                        class="btn btn-white" onserverclick="btn_lov_timezone_Click">
                                                        <%--onserverclick="btn_lov_timezone_Click"--%>
                                                            <i class="fa fa-search"></i>
                                                    </button>
                                                </span>
                                            </div>
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>
                                </div>

                                <div id="Shiping" class="tab-pane fade">
                                    <br />
                                    <div class="row" style="padding-top:10px">
                                        <asp:HiddenField ID="hid_contact" runat="server" />
                                        <label class="col-md-3 control-label">Contact</label>
                                        <div class="col-md-3">
                                            <div class="input-group">
                                                <asp:TextBox CssClass="form-control" ID="txt_contact" runat="server">
                                                </asp:TextBox>
                                                <asp:RequiredFieldValidator SetFocusOnError="true"
                                                    ValidationGroup="save" runat="server" id="rtxtcontact"
                                                    controltovalidate="txt_contact"
                                                    errormessage="Contact is Required!" />
                                                <span class="input-group-btn">
                                                    <button id="btn_lov_contact" type="button" runat="server"
                                                        class="btn btn-white" onserverclick="btn_lov_contact_Click">
                                                        <%--onserverclick="btn_lov_contact_Click"--%>
                                                            <i class="fa fa-search"></i>
                                                    </button>
                                                </span>
                                            </div>
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <asp:HiddenField ID="hid_shiptoloc" runat="server" />
                                        <label class="col-md-3 control-label">Ship To Location</label>
                                        <div class="col-md-3">
                                             <div class="input-group">
                                                <asp:TextBox CssClass="form-control" ID="txt_shiptoloc" runat="server">
                                                </asp:TextBox>
                                                <asp:RequiredFieldValidator SetFocusOnError="true"
                                                    ValidationGroup="save" runat="server" id="rtxtshiptoloc"
                                                    controltovalidate="txt_shiptoloc"
                                                    errormessage="Ship To Location is Required!" />
                                                <span class="input-group-btn">
                                                    <button id="btn_lov_shiptoloc" type="button" runat="server"
                                                        class="btn btn-white" onserverclick="btn_lov_shiptoloc_Click">
                                                        <%--onserverclick="btn_lov_shiptoloc_Click"--%>
                                                            <i class="fa fa-search"></i>
                                                    </button>
                                                </span>
                                            </div>
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <label class="col-md-3 control-label"></label>
                                        <div class="col-md-2 text-left">
                                            <span class="checkbox"><input id="chk_shiptosite" runat="server"
                                                    type="checkbox" name="chk_shiptosite" />
                                                <label class="col-md-1 control-label"></label>Ship To Site</span>
                                        </div>
                                        <%--<label class="col-md-1 control-label"></label>--%>
                                            <div class="col-md-2 text-left">
                                                <span class="checkbox"><input id="chk_billtosite" runat="server"
                                                        type="checkbox" name="chk_billtosite" />
                                                    <label class="col-md-1 control-label"></label>Bill To Site</span>
                                            </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <label class="col-md-3 control-label"></label>
                                        <div class="col-md-2 text-left">
                                            <span class="checkbox"><input id="chk_rectosite" runat="server"
                                                    type="checkbox" name="chk_rectosite" disabled="disabled" />
                                                <label class="col-md-1 control-label"></label>Receiving Site</span>
                                        </div>
                                        <%--<label class="col-md-1 control-label"></label>--%>
                                            <div class="col-md-2 text-left">
                                                <span class="checkbox"><input id="chk_internalsite" runat="server"
                                                        type="checkbox" name="chk_internalsite" />
                                                    <label class="col-md-1 control-label"></label>Internal Site</span>
                                            </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <label class="col-md-3 control-label"></label>
                                        <div class="col-md-2 text-left">
                                            <span class="checkbox"><input id="chk_officesite" runat="server"
                                                    type="checkbox" name="chk_officesite" />
                                                <label class="col-md-1 control-label"></label>Office Site</span>
                                        </div>
                                        <%--<label class="col-md-1 control-label"></label>--%>
                                            <div class="col-md-2 text-left">
                                            </div>
                                    </div>

                                </div>

                                <div id="Other" class="tab-pane fade">
                                    <br />
                                    <div class="row" style="padding-top:10px">
                                        <asp:HiddenField ID="hid_invertoryorg" runat="server" />
                                        <label class="col-md-3 control-label">Inventory Organization</label>
                                        <div class="col-md-3">
                                            <div class="input-group">
                                                <asp:TextBox CssClass="form-control" ID="txt_invertoryorg"
                                                    runat="server">
                                                </asp:TextBox>
                                                <asp:RequiredFieldValidator SetFocusOnError="true"
                                                    ValidationGroup="save" runat="server" id="rtxtinvertoryorg"
                                                    controltovalidate="txt_invertoryorg"
                                                    errormessage="Inventory Organization is Required!" />
                                                <span class="input-group-btn">
                                                    <button id="btn_lov_invertoryorg" type="button" runat="server"
                                                        class="btn btn-white" onserverclick="btn_lov_invertoryorg_Click">
                                                        <%--onserverclick="btn_lov_invertoryorg_Click"--%>
                                                            <i class="fa fa-search"></i>
                                                    </button>
                                                </span>
                                            </div>
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>

                                    <div class="row" style="padding-top:10px">
                                        <label class="col-md-3 control-label">EDI Location</label>
                                        <div class="col-md-3">
                                            <asp:TextBox CssClass="form-control" ID="txt_ediloc" runat="server">
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                                runat="server" id="rtxtediloc" controltovalidate="txt_ediloc"
                                                errormessage="Name is Required!" />
                                        </div>

                                        <label class="col-md-2 control-label"></label>
                                        <div class="col-md-3 text-left">
                                        </div>
                                    </div>
                                </div>

                            </div>

                            <div class="row">
                                <asp:Label CssClass="control-label col-md-offset-2" ID="lbl_due" runat="server">
                                </asp:Label>
                            </div>

                        </div>
                    </section>
                </div>
            </div>
        </div>

        <script src="../../ThemeScrips/jquery.min.js"></script>
        <link href="../../ThemeScrips/select2.min.css" rel="stylesheet" />
        <script src="../../ThemeScrips/select2.min.js"></script>
        <script src="Scripts/jquery-2.1.3.min.js"></script> 
        <script src="Scripts/bootstrap.js"></script> 

        <script>

        $(document).ready(function () {

            var tabId = document.getElementById('<%= hidTAB.ClientID%>').value;            
            if (tabId == "3") {
                $('#myTabs a[href="#Other"]').tab('show');
                //$('.nav-tabs a[href="#Location"]').tab('show');
            } else if (tabId == "2") {
                $('#myTabs a[href="#Shiping"]').tab('show');
                //$('.nav-tabs a[href="#Skill"]').tab('show');
            } else {
                $('#myTabs a[href="#Address"]').tab('show');
            }

        });     

            $("#address_click").click(function () {
                document.getElementById('<%= hidTAB.ClientID%>').value = "1";
        });

            $("#shiping_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "2";
        });

            $("#other_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "3";
        });


        </script>
    </asp:Content>