<%@ page language="C#" autoeventwireup="true" inherits="Forms_VendorRouteAssignment, App_Web_5q3yf04y" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/New_Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/New_Footer.ascx" TagName="Footer" TagPrefix="uc2" %>

<%--<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2" Namespace="DevExpress.Web.ASPxEditors"
    TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2.Export, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1" Namespace="DevExpress.Web.ASPxGridView.Export"
    TagPrefix="exp" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>--%>

<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxw" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>tSense-IoT Vendor Assignment</title>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0)" />
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0)" />
    <link href="../css/reset.css" rel="stylesheet" type="text/css" />
    <link href="../css/stylesheet2.css" rel="stylesheet" type="text/css" />
    <link href="../css/dropdown.css" rel="stylesheet" type="text/css" />
    <link rel="SHORTCUT ICON" href="../images/favicon.ico" />
    <script src="../js/wow.min.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="updGrid" runat="server">
            <ContentTemplate>
                <div id="container">
                    <!-- Header Starts Here -->
                    <uc1:Header ID="ucHeader" runat="server" />
                    <!-- Nav Ends Here -->
                    <!-- Content Starts Here -->
                    <div id="outer">
                        <div id="inner">
                            <div id="float-wrap">
                                <!-- Main Content Starts Here -->
                                <!-- Main Content Starts Here -->
                                <div id="content">
                                    <div class="content-wrap">
                                        <div id="top-content">
                                            <div id="heading">
                                                <img class="icon" src="../images/configuration-icon.jpg" alt="" />
                                                <h1>Configuration</h1>
                                                <a href="Dashboard.aspx">Home</a><span>&gt;</span><span><a href="ConfigurationSetup.aspx">Vendor</a></span><span>&gt;</span><span><a
                                                    href="VendorRouteAssignment.aspx">Assignment</a></span>
                                            </div>
                                            <div id="control-box" align="right">
                                                <table border="0" cellpadding="0" cellspacing="0" id="control-tbl" align="right">
                                                    <tr>
                                                        <td height="15px">&nbsp;&nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:ImageButton ID="lbtnManageVehicle" runat="server" PostBackUrl="~/Forms/VehicleInfo.aspx" ImageUrl="~/images/CSC/btn-manage-vehicles.jpg" />
                                                            <%-- <asp:LinkButton ID="lbtnManageVehicle" runat="server" Text="Manage Vehicles" PostBackUrl="~/Forms/VehicleInfo.aspx"></asp:LinkButton>--%>
                                                        </td>
                                                        <td>&nbsp;&nbsp;
                                                        </td>
                                                        <td>
                                                            <asp:ImageButton ID="lbtnManageVendor" runat="server" PostBackUrl="~/Forms/VendorMaster.aspx" ImageUrl="~/images/CSC/btn-add-vendors.jpg" />
                                                            <%--<asp:LinkButton ID="lbtnManageVendor" runat="server" Text="Manage Vendors" PostBackUrl="~/Forms/VendorMaster.aspx"></asp:LinkButton>--%>
                                                        </td>
                                                        <td>&nbsp;&nbsp;
                                                        </td>
                                                        <td>
                                                            <asp:ImageButton ID="ibtBackToConfig" runat="server" ImageUrl="~/images/btn-back-to-configuration.jpg"
                                                                PostBackUrl="~/Forms/ConfigurationSetup.aspx" />
                                                        </td>
                                                        <td>&nbsp;&nbsp;&nbsp;&nbsp;
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="clear clearfix">
                                            </div>
                                        </div>
                                        <asp:Panel ID="pnlUsrGroupSelection" runat="server" CssClass="ControlShow">
                                            <div class="form-box">
                                                <h1>
                                                    <span class="icon">
                                                        <img src="../images/CSC/icn-route-assignment.gif" alt="" /></span> Route Assignment</h1>
                                                <table width="100%" border="0" cellspacing="7" cellpadding="0" class="form-tbl">
                                                    <tr>
                                                        <td width="2%"></td>
                                                        <td width="10%">
                                                            <img src="../images/CSC/icn-vendor-name.gif" alt="" />
                                                            <asp:Label ID="lblVendors" runat="server" Font-Bold="true" Text="Vendors"></asp:Label>
                                                        </td>
                                                        <td>
                                                            <asp:DropDownList ID="ddlVendors" runat="server" AutoPostBack="true" TabIndex="1"
                                                                AppendDataBoundItems="true" OnSelectedIndexChanged="ddlVendors_SelectedIndexChanged">
                                                            </asp:DropDownList>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </asp:Panel>
                                        <div class="clear clearfix">
                                        </div>
                                        <asp:Panel ID="pnlUnAssignedRouteList" runat="server" CssClass="ControlHide">
                                            <div id="grid-dsply">
                                                <div id="top">
                                                    <div class="left-col">
                                                        <span class="icon">
                                                            <img src="../images/CSC/icn-unassign-routes.gif" alt="" /></span> <span class="txt">Unassigned Routes</span>
                                                    </div>
                                                </div>
                                                <asp:HiddenField ID="hdnUsersToBeAssigned" runat="server" />
                                                <asp:HiddenField ID="hdnAssignedGroupUser" runat="server" />
                                                <dxw:ASPxGridView ID="gvUnAssignedRoutes" runat="server" Width="100%" EnableTheming="true" Theme="Office2003Blue"
                                                    KeyFieldName="RouteId" CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css"
                                                    CssPostfix="Office2003_Blue">
                                                    <ClientSideEvents SelectionChanged="function(s, e) { OnGridSelectionChangedGroupAssign(1); }" />
                                                    <%--<Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
                                                    <CollapsedButton Height="12px" Url="~/App_Themes/Office2  003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <ExpandedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                    <DetailCollapsedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <DetailExpandedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                </Images>--%>
                                                    <Styles CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" AlternatingRow-Enabled="True"
                                                        CssPostfix="Office2003_Blue">
                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                        </Header>
                                                        <LoadingPanel ImageSpacing="10px">
                                                        </LoadingPanel>
                                                        <PagerBottomPanel CssClass="PageFooter">
                                                        </PagerBottomPanel>
                                                        <PagerTopPanel CssClass="PageFooter">
                                                        </PagerTopPanel>
                                                    </Styles>
                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003 Blue/GridView/pPrev.gif"
                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003 Blue/GridView/pPrevDisabled.gif"
                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003 Blue/GridView/pNextDisabled.gif"
                                                        NextPageButton-Image-Url="../App_Themes/Office2003 Blue/GridView/pNext.gif" AlwaysShowPager="true">
                                                    </SettingsPager>
                                                    <Columns>
                                                        <dxw:GridViewDataColumn FieldName="RouteId" Caption="AutoID" VisibleIndex="0" Visible="false">
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="1" Width="5%">
                                                            <HeaderTemplate>
                                                                <input type="checkbox" onclick="gvUnAssignedRoutes.SelectAllRowsOnPage(this.checked);"
                                                                    style="vertical-align: middle;" title="Select/Unselect all rows on the page"
                                                                    tabindex="1"></input>
                                                            </HeaderTemplate>
                                                            <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" HorizontalAlign="Center" />
                                                        </dxw:GridViewCommandColumn>
                                                        <dxw:GridViewDataColumn FieldName="RouteName" Caption="RouteName" Width="15%">
                                                            <HeaderCaptionTemplate>
                                                                <span>
                                                                    <img src="../images/CSC/icn-route-name.gif" alt="" align="top" />&nbsp; Route Name</span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="NoOfLocalities" Caption="NoOfLocalities" Width="10%">
                                                            <HeaderCaptionTemplate>
                                                                <span>
                                                                    <img src="../images/CSC/icn-numberof-localities.gif" alt="" align="middle" />&nbsp; Number of 
                                                            Localities</span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="VendorName" Caption="VendorName" Width="10%">
                                                            <HeaderCaptionTemplate>
                                                                <span>
                                                                    <img src="../images/CSC/icn-vendor-name.gif" alt="" align="middle" />&nbsp; Vendor 
                                                            Name</span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                    </Columns>
                                                    <SettingsText EmptyDataRow="No Unassigned Routes found" />
                                                    <Settings ShowFilterRow="true" ShowFilterRowMenu="True" />
                                                </dxw:ASPxGridView>
                                                <div class="form-box">
                                                    <table width="100%" class="form-tbl">
                                                        <tr>
                                                            <td></td>
                                                            <td width="10%" valign="bottom" style="padding-left: 20px">
                                                                <asp:LinkButton ID="btnAssignRoutes" runat="server" class="btn" TabIndex="4" OnClick="AssignRoutes"
                                                                    Width="64px"><span class="icon"><img src="../images/CSC/icn-assign-routes.gif" alt="" /></span><span>Assign</span></asp:LinkButton>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </asp:Panel>
                                        <div class="clear clearfix">
                                        </div>
                                        <asp:Panel ID="pnlAssignedRouteList" runat="server" CssClass="ControlHide">
                                            <div id="grid-dsply">
                                                <div id="top">
                                                    <div class="left-col">
                                                        <span class="icon">
                                                            <img src="../images/CSC/icn-assign-routes.gif" alt="" /></span> <span class="txt">Assigned Routes</span>
                                                    </div>
                                                </div>
                                                <asp:HiddenField ID="hdnUsersToBeUnassinged" runat="server" />
                                                <dxw:ASPxGridView ID="gvAssignedRoutes" runat="server" Width="100%" EnableTheming="true" Theme="Office2003Blue"
                                                    KeyFieldName="RouteId" CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css"
                                                    CssPostfix="Office2003_Blue">
                                                    <ClientSideEvents SelectionChanged="function(s, e) { OnGridSelectionChangedGroupAssign(2); }" />
                                                    <%--<Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
                                                    <CollapsedButton Height="12px" Url="~/App_Themes/Office2  003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <ExpandedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                    <DetailCollapsedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <DetailExpandedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                </Images>--%>
                                                    <Styles CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" AlternatingRow-Enabled="True"
                                                        CssPostfix="Office2003_Blue">
                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                        </Header>
                                                        <LoadingPanel ImageSpacing="10px">
                                                        </LoadingPanel>
                                                        <PagerBottomPanel CssClass="PageFooter">
                                                        </PagerBottomPanel>
                                                        <PagerTopPanel CssClass="PageFooter">
                                                        </PagerTopPanel>
                                                    </Styles>
                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003 Blue/GridView/pPrev.gif"
                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003 Blue/GridView/pPrevDisabled.gif"
                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003 Blue/GridView/pNextDisabled.gif"
                                                        NextPageButton-Image-Url="../App_Themes/Office2003 Blue/GridView/pNext.gif" AlwaysShowPager="true">
                                                    </SettingsPager>
                                                    <Columns>
                                                        <dxw:GridViewDataColumn FieldName="RouteId" Caption="AutoID" VisibleIndex="0" Visible="false">
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="1" Width="5%">
                                                            <HeaderTemplate>
                                                                <input type="checkbox" onclick="gvAssignedRoutes.SelectAllRowsOnPage(this.checked);"
                                                                    style="vertical-align: middle;" title="Select/Unselect all rows on the page"
                                                                    tabindex="5"></input>
                                                            </HeaderTemplate>
                                                            <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" HorizontalAlign="Center" />
                                                        </dxw:GridViewCommandColumn>
                                                        <dxw:GridViewDataColumn FieldName="RouteName" Caption="RouteName" Width="15%">
                                                            <HeaderCaptionTemplate>
                                                                <span>
                                                                    <img src="../images/CSC/icn-route-name.gif" alt="" align="top" />&nbsp; Route Name</span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="NoOfLocalities" Caption="NoOfLocalities" Width="10%">
                                                            <HeaderCaptionTemplate>
                                                                <span>
                                                                    <img src="../images/CSC/icn-numberof-localities.gif" alt="" align="middle" />&nbsp; Number of 
                                                            Localities</span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="VendorName" Caption="VendorName" Width="10%">
                                                            <HeaderCaptionTemplate>
                                                                <span>
                                                                    <img src="../images/CSC/icn-vendor-name.gif" alt="" align="middle" />&nbsp; Vendor 
                                                            Name</span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                    </Columns>
                                                    <Settings ShowFilterRow="true" ShowFilterRowMenu="True" />
                                                    <SettingsText EmptyDataRow=" No Assigned Routes found" />
                                                </dxw:ASPxGridView>
                                                <div class="form-box">
                                                    <table width="100%" class="form-tbl">
                                                        <tr>
                                                            <td></td>
                                                            <td width="10%" valign="bottom" style="padding-left: 20px">
                                                                <asp:LinkButton ID="btnUnassignRoutes" runat="server" class="btn" OnClick="UnAssignRoutes"
                                                                    TabIndex="7" Width="75px"><span class="icon"><img src="../images/CSC/icn-unassign-routes.gif" alt="" /></span><span>Unassign</span></asp:LinkButton>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </asp:Panel>
                                    </div>
                                </div>
                                <!-- Main Content Ends Here -->
                                <div id="left">
                                </div>
                                <div class="clear clearfix">
                                </div>
                            </div>
                            <div id="right">
                            </div>
                            <div class="clear clearfix">
                            </div>
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <!-- Content Ends Here -->
        <uc2:Footer ID="ucFooter" runat="server" />

        <script type="text/javascript" language="javascript">

            function OnGridSelectionChangedGroupAssign(Type) {
                if (Type == 1) {
                    gvUnAssignedRoutes.GetSelectedFieldValues('RouteId', OnGridSelectionCompleteUnAssUsr);
                }
                if (Type == 2) {
                    gvAssignedRoutes.GetSelectedFieldValues('RouteId', OnGridSelectionCompleteAssUsr);
                }
            }

            function OnGridSelectionCompleteUnAssUsr(values) {
                var counter = document.getElementById("hdnUsersToBeAssigned");
                counter.value = '';
                for (var i = 0; i < values.length; i++) {
                    counter.value = counter.value + values[i] + ',';
                }
            }

            function OnGridSelectionCompleteAssUsr(values) {
                var counter = document.getElementById("hdnUsersToBeUnassinged");
                counter.value = '';
                for (var i = 0; i < values.length; i++) {
                    counter.value = counter.value + values[i] + ',';
                }
            }
        </script>

        <script type="text/javascript" language="javascript" src="../js/FormValidations.js"></script>
        <asp:HiddenField ID="hdnLogout" runat="server" />
    </form>
</body>
</html>
