<%@ page language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" autoeventwireup="true" inherits="Pages_Transport_VTSSubUserMapping, App_Web_qstd3kb0" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/Common/StudentSearch/StudentSearch.ascx" TagName="StudentSearch" TagPrefix="Std" %>
<%@ Register Src="~/UserControls/Common/Transport/TransportDetailBoxControl.ascx" TagName="TransportControl" TagPrefix="Transport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="HREmployeeMasterSearchUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div id="divContentPage" class="divcontentpagemargin">
                <Std:StudentSearch ID="StudentSearch" Visible="false" runat="server" />

                <div class="dashBoardLeftCont">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="106"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <Transport:TransportControl ID="TransportUserControl" runat="server" Visible="true" />
                    <div class="himssuHeader5WireBox card card-box">
                        <%-- <div class="himsBoxHeader note note1 box box-danger">
                                        <asp:Panel ID="SearchHeaderPanel" runat="server" meta:resourcekey="SearchHeaderPanelResource1">
                                            <div class="leftdiv">
                                            </div>
                                            <div class="himsBoxTitle">
                                                <div class="headerText">
                                                    <asp:Label ID="SearchHeaderLabel" runat="server" Text="Search"></asp:Label>
                                                </div>
                                            </div>
                                        </asp:Panel>
                                    </div>--%>
                        <asp:Panel ID="SearchDetailPanel" runat="server" meta:resourcekey="SearchDetailPanelResource1">
                            <div class="himsBoxContent card-body">
                                <div class="contentHolder">

                                    <div id="VTSSubUserMappintListGridDiv" runat="server" visible="false">



                                        <div class="himssuHeader1WireBox col-md-12">

                                            <div class="himsBoxHeader card-head inner" id="Div3" runat="server" style="display: none">
                                                <%-- <div class="gridHeaderText">
                                                                 <header>
                                                                      <asp:Label ID="Label6" runat="server" Text="VTS Sub User Mapping List"></asp:Label>
                                                                 </header>
                                                                </div>--%>
                                            </div>
                                            <div class="col-md-12 padd-0">
                                                <div class="alert alert-info mb-0">
                                                    <asp:Label ID="RemarkNoteLabel" runat="server" Text="Time Format 24 Hour (0 to 23) Example :- 17:00 (Means 05:00 PM)"></asp:Label>
                                                </div>
                                            </div>
                                            <div class="himsBoxContent card-body" style="width: 1065px; overflow-x: auto!important;">
                                                <asp:UpdatePanel ID="UpdatePanelgrid" runat="server" UpdateMode="Always">
                                                    <ContentTemplate>
                                                        <div class="table-responsive">
                                                            <asp:GridView runat="server" ID="VTSSubUserMappingGridView" AutoGenerateColumns="False"
                                                                EmptyDataText="No records available for the search criteria!" AllowPaging="false"
                                                                PageSize="10" DataKeyNames="Id,VTSSubUserName,VTSSubUserPassword"
                                                                CssClass="table table-striped table-bordered table-hover"
                                                                ShowHeader="True" meta:resourcekey="VTSSubUserMappingGridViewResource1">
                                                                <Columns>
                                                                    <asp:BoundField DataField="RouteCode" HeaderText="Code" ItemStyle-Width="10%"
                                                                        HeaderStyle-HorizontalAlign="Left" />
                                                                    <asp:BoundField DataField="RouteNumber" HeaderText="Number" ItemStyle-Width="10%" HeaderStyle-HorizontalAlign="Left" />
                                                                    <asp:BoundField DataField="Title" HeaderText="Route Name" ItemStyle-Width="10%" HeaderStyle-HorizontalAlign="Left" />

                                                                    <asp:TemplateField HeaderText="VTSSubUserName" ItemStyle-Width="10%" ItemStyle-Wrap="true"
                                                                        HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:UpdatePanel ID="UpdatePanelDRopPoint" runat="server" UpdateMode="Always">
                                                                                <ContentTemplate>
                                                                                    <asp:TextBox runat="server" ID="VTSSubUserNameTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" Text='<%# Bind("VTSSubUserName") %>'>
                                                                                    </asp:TextBox>
                                                                                </ContentTemplate>
                                                                            </asp:UpdatePanel>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>

                                                                    <asp:TemplateField HeaderText="VTSSubUserPassword" ItemStyle-Width="10%" ItemStyle-Wrap="true"
                                                                        HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:UpdatePanel ID="UpdatePanelPassword" runat="server" UpdateMode="Always">
                                                                                <ContentTemplate>
                                                                                    <asp:TextBox runat="server" ID="VTSSubUserPasswordTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" Text='<%# Bind("VTSSubUserPassword") %>'>
                                                                                    </asp:TextBox>
                                                                                </ContentTemplate>
                                                                            </asp:UpdatePanel>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>

                                                                    <asp:TemplateField HeaderText="Pick Up Start" ItemStyle-Width="10%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox runat="server" ID="PickUpStartTextBox" Text='<%# Bind("PickUpStart") %>'></asp:TextBox>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Pick Up End" ItemStyle-Width="10%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox runat="server" ID="PickUpEndTextBox" Text='<%# Bind("PickUpEnd") %>'></asp:TextBox>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Drop Start" ItemStyle-Width="10%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox runat="server" ID="DropStartTextBox" Text='<%# Bind("DropStart") %>'></asp:TextBox>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Drop End" ItemStyle-Width="10%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox runat="server" ID="DropEndTextBox" Text='<%# Bind("DropEnd") %>'></asp:TextBox>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>

                                                                    <asp:TemplateField HeaderText="TrackingURL" ItemStyle-Width="10%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox runat="server" ID="TrackingURLTextBox" Text='<%# Bind("TrackingURL") %>' onblur="validateURL(this)"></asp:TextBox>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                                <PagerSettings Visible="False" />
                                                            </asp:GridView>
                                                        </div>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </asp:Panel>

                    </div>
                </div>
                </tr>
                    </table>
            </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <%--<script data-main="../../JavaScript/rjs/encrypt/assign-organization-encrypt" src="../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/assign-organization")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script>
        function validateURL(item) {
            //mantisid: 0035054
            //var urlregex = new RegExp("^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*$");
            //var urlregex = new RegExp("^(http|https|ftp)://[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*\\.[a-zA-Z]{2,}(:(\\d{1,5}))?(/[\\w\\-\\./?%&=]*)?$");
            //mantisid : 0040953
            //var urlregex = new RegExp("^(http|https|ftp)://([a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*|([0-9]{1,3}\\.){3}[0-9]{1,3})(:(\\d{1,5}))?(/[\\w\\-\\./?%&=]*)?$");
            
            //changes for m mantis Id:0042254
            var originalVal = $(item).val();
            let encodestr = htmlEncode(originalVal);

            var urlregex = new RegExp(
                "^(https?|ftp):\\/\\/" +                                // protocol
                "(([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+|" +               // domain
                "((\\d{1,3}\\.){3}\\d{1,3}))" +                          // or IP address
                "(\\:\\d{1,5})?" +                                       // optional port
                "(\\/[^\\s]*)?$",                                        // path & query
                "i"
            );

            if (!urlregex.test(encodestr)) {
                $(item).val('');
            }
            
            return $(item).val(encodestr);;

        }

        function htmlEncode(str) {
            return str.replace("<", "%3C")
                      .replace(">", "%3E");
        }
    </script>
</asp:Content>
