<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="FinIQ_IconAssignment.aspx.vb" Inherits="FinIQWebApp.FinIQ_IconAssignment" MasterPageFile="~/FiniqAppMasterPage.Master"  ValidateRequest="false"%>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<style type="text/css">
      .UCPGrid > td, .UCPGrid > td, .UCPGrid > td, .UCPGrid > td, .UCPGrid > td {
        padding: 6.5px !important;
    }

      .DisableDragDrop {
        }


       .fieldSetBorder {
        border: 1px solid #dcdcdc;
       

    }
    .fieldsetlegend {
         font-size:14px;
       color:red;
    }
    

 .GridHeader {
        border: solid 0px #dddddd !important;
        background-color: #ededed !important;
        border-collapse: collapse;
        box-sizing: border-box;
        height:max-content;
    }

    .wtm {
               word-wrap:normal;
    }

    .topright {
        top:0px;
        right:50px
    }

    .lbl {
        white-space:normal !important;
    }

       .notify {
            float:left;
            left: 0px;
            top:90px;
            position:absolute;
            background-color:#F7F7F7;
            /* border:solid 0.1em #DDD; */
            height: 10px;
            width:90%;
            /* text-indent:5px; */
            color:#000;
            margin:10px;
            padding:2px;
            z-index:1000;
            FILTER: progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#DDDDDD,strength=3);
            font-size: 11px;
             border:none!IMPORTANT;
        }
         
            .notify span {
                margin-left: 3px;
                float: left;
                width: 95%;
                height: 20px;
                font: normal 11px/20px verdana;
                border-left: solid 0px #aaa;
            }

            .notify .icon {
                width: 24px;
                height: 20px;
                display: none;
                float: left;
                margin-top: 0px;
            }

            .notify .close {
                width: 24px;
                height: 20px;
                font: bold 11px/11px verdana;
                color: #fff;
                float: right;
                cursor: pointer;
            }
			  
			     .info{
            background-color: #fff;
            color: steelblue;
            }
 </style>
    <script type="text/javascript" >
        function dragdropFunction() {


            var minX = 0; // farthest to left it can go
            var maxX = 1300; // farthest to right it can go
            var yPosition = 0; // set to your y position
            var yMax = 3000;
            //ctl00_MainContent_oUCPLayout_GridFindColumn
            //"#ctl00_MainContent_Tabs_TabLayoutDesign_


           $(document).ready(function () {
            
                $("#ctl00_MainContent_GridFindColumn.Grid .GridItem img,  .Grid .GridItem td:nth-child(2) img, .ui-draggable").draggable({
                    connectToSortable: ".Grid .GridItem td:nth-child(2)",
                    helper: "clone",
                    revert: "invalid",
                    
                    drag: function (event, ui) { console.log(event.target);  }
                              

                });

                $(".GridLayout  .Grid .GridItem  td:nth-child(2)").sortable({
                    revert: true,
                     connectWith: '#ctl00_MainContent_GridFindColumn.Grid .GridItem',
                    handle: '.widget-header-holder',
                    cursor: 'move'
                }); 
                

                $(".GridLayout  .Grid .GridItem  td:nth-child(2) ").droppable({
                    
                    drop: function (event, ui) {                        
                        if ($(event.target).find('img').length > 2) {
                            $(event.target).find('img')[0].remove();
                            //Added by shraddha
                            var row = $(this).closest("tr");
                            //var message = "Row Index: " + (row[0].rowIndex - 1);
                            //alert(message);
                            
                            document.getElementById('<%=rowIndex.ClientID%>').value = row[0].rowIndex - 1;
                          
                            var alt = $(event.target).find('img').attr("alt");
                            document.getElementById('<%=imgalt.ClientID%>').value = alt;
                         
                            $("#ctl00_MainContent_btnMap").click();
                          

                            
                        }
                       
                        $(event.target).find('img').draggable({
                            connectToSortable: ".Grid .GridItem td:nth-child(2)",
                          
                            revert: "invalid",
                            drag: function (event, ui) { console.log(event.target); }
                        });
                    }
                });
               
             

               $(".GridLayout  .Grid .GridItem  td:nth-child(2) ").mouseover(function () {
                   
                  // $("#<%=gvmapping.ClientID%> tr").each(function () {
                      
                       if (event.target.lastElementChild.attributes.src.value != "") {
                           event.target.firstElementChild.firstElementChild.style.display = "block";

                       }
                      
                  // });

                   
						
               });
                
                   $(".GridLayout  .Grid .GridItem  td:nth-child(2) ").mouseout(function () {
                   
                 
						event.target.firstElementChild.firstElementChild.style.display = "none";
               });

           

            });

 
            var parameter = Sys.WebForms.PageRequestManager.getInstance();

            parameter.add_endRequest(function () {

         
            });

            //Bhavya
            //$(".gridEVTHeader").find(".ui-droppable").find("img").not("img[src='']")[0].alt
 

            function clearDuplicate(txt) {
                // alert(txt);
                $(".GridLayout").find(".GridItem").find("td").each(function () {
                    if ($(this).html() == txt) {
                        //  alert(txt + " is duplicate field.");
                        $(this).html('');
                    }
                });
            }
        }


        function EnterEvent(e) {
            if (e.keyCode == 13) {
                document.getElementById('<%=imgsearch.ClientID%>').click();
               
            }
    }
        function EnterEvente(e) {
            if (e.keyCode == 13) {
             
                document.getElementById('<%=imgmappingsearch.ClientID%>').click();
            }
        }


       


        
    </script>
       <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                 <tr>
                                     <td >
                                            <asp:Label ID="lblerror" runat="server" Visible="false" CssClass="lblError" Style="margin-left: 25px;"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="lblmsg" runat="server" CssClass="lblInfo"></asp:Label>
                                    </td>
                                </tr>
            </table>
            <div>
                <table>
                      <asp:HiddenField runat="server" ID="rowIndex" Value="" />
                    <asp:HiddenField runat="server" ID="imgalt" Value="" />
                    
                    <tr>
                        <td>
                            <asp:Label runat="server" ID="lblFields" Text="Type" CssClass="lbl" Width="60px"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlFields" CssClass="ddl" Width="130px" AutoPostBack="true">
                                <asp:ListItem>Workflows</asp:ListItem>
                                <asp:ListItem>Templates</asp:ListItem>
                                <asp:ListItem>Queues</asp:ListItem>
                              
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:Button runat="server" ID="btnLoad" CssClass="btn" Text="Load" width="100px" Visible="false"/>
                        </td>
                        
                   
                        <td>
                            <asp:Label runat="server" ID="lblWkflow" Text="Workflow" CssClass="lbl" Width="60px" Visible="false"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlWkflow" CssClass="ddl" Width="190px"  Visible="false" AutoPostBack="true" aut></asp:DropDownList>
                        </td>
                         <td>
                            <asp:Button runat="server" ID="btnMap" CssClass="btn" Text="Map" width="100px" style="display:none"/>
                        </td>
                    </tr>
                </table>


                <table>
                    <tr>
                        <td style="vertical-align: top;">
                            <table >
                            
                                <tr>
                                    <td style="vertical-align: top; height: 90px;">
                                         <fieldset class="fieldSetBorder" style="min-height:588px;width:400px;">
                                            <legend class="fieldsetlegend">Field Position Map</legend>
                                            
                                             <table style="padding-top:10px!important">
                                                 <tr>
                                                      <td>
                                                    <asp:TextBox ID="txtmappingsearch" runat="server" Width="217px" onkeydown="return EnterEvente(event)" Style="margin-left:5px;"></asp:TextBox>
                                                    <asp:ImageButton ID="imgmappingsearch" runat="server" ImageUrl="~/App_Resources/Search_20x20.png"  OnClick="imgmappingsearch_Click"/>
                                                  <%--  <asp:Button ID="btnFind" runat="server" CssClass="btn" Text="Find" Width="120px" />--%>
                                                </td>
                                                 </tr>
                                                 <tr>
                                                     <td>
                                                          <asp:UpdatePanel ID="updatePnlLayout" UpdateMode="Conditional" runat="server">
                                                            <ContentTemplate>
                                                                  <table>
                                                                     <tr>
                                                                        <td>
                                                                             <div style="height: auto;" class="GridLayout" id="divGridLayout">
                                                                                 <table>
                                                                                     <tr>
                                                                                         <td>
                                                                                        
                                                                                             <asp:GridView ID="gvmapping" runat="server"  AutoGenerateColumns="false" EnableViewState="true" CssClass="Grid gridEVTHeader" PageSize="10" AllowPaging="true" Width="100%" Height="100%">
                                                                            
                                                                                               <SelectedRowStyle CssClass="GridItemSelect" />
                                                                                               <RowStyle CssClass="GridItem" />
                                                                                               <HeaderStyle HorizontalAlign="Center" CssClass="GridHeader" VerticalAlign="Middle" />
                                                                                               <FooterStyle CssClass="GridFooter" />
                                                                                               <PagerStyle CssClass="GridPager" />

                                                                                                 <Columns>
                                                                                                       <asp:TemplateField Visible="false">
                                                                                                    <ItemTemplate>                                                                                    
                                                                                                     <asp:Label runat="server" ID="lblIM_ID" CssClass="lbl"  Text='<%# Eval("IM_ID")%>' ></asp:Label>
                                                                                                    </ItemTemplate>
                                                                                                      </asp:TemplateField>

                                                                                                     <asp:TemplateField Visible="false">
                                                                                                            <ItemTemplate>                                                                                    
                                                                                                     <asp:Label runat="server" ID="lblMapType" CssClass="lbl"  Text='<%# Eval("Mapping_Type")%>' ></asp:Label>
                                                                                                    </ItemTemplate>
                                                                                                     </asp:TemplateField>

                                                                                                      <asp:TemplateField Visible="false" >
                                                                                                    <ItemTemplate>                                                                                    
                                                                                                     <asp:Label runat="server" ID="lblMapping_ID" CssClass="lbl"  Text='<%# Eval("Mapping_ID")%>'></asp:Label>
                                                                                                    </ItemTemplate>
                                                                                                      </asp:TemplateField>

                                                                                                     <asp:TemplateField HeaderText="Name">
                                                                                                      <HeaderStyle  Width="100px"></HeaderStyle>
                                                                                                     <ItemStyle  Width="150px" Height="40px" Wrap="true" />
                                                                                                    <ItemTemplate>   
                                                                                                        <div class="wtm">                                                                                 
                                                                                                     <asp:Label runat="server" ID="lblName" CssClass="lbl"  Text='<%# Eval("Name")%>' Enabled="false" ></asp:Label>
                                                                                                    </div>
                                                                                                       </ItemTemplate>
                                                                                                      </asp:TemplateField>

                                                                                                     <asp:TemplateField Visible="false">
                                                                                                    <ItemTemplate>                                                                                    
                                                                                                     <asp:Label runat="server" ID="lblIcon_ID" CssClass="lbl"  Text='<%# Eval("Icon_ID")%>'></asp:Label>
                                                                                                    </ItemTemplate>
                                                                                                      </asp:TemplateField>

                                                                                                       <asp:TemplateField HeaderText="Icon">
                                                                                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="140px"></HeaderStyle>
                                                                                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="40px"/>
                                                                                                           <ItemTemplate >
                                                                                                             <div style="vertical-align:top !important;">    
                                                                                                                                            
																													<asp:ImageButton ID="imgdelete" runat="server" ImageUrl="~/App_Resources/DELETE.BMP" Width="10px" Style="float:right;display:none" CommandName="DeleteMapping" CommandArgument="<%# Container.DataItemIndex %>" />	
                                                                                                               </div>
                                                                                                               
                                                                                                               <asp:Image ID="imgiicon" runat="server" />
                                                                                                              
                                                                                                           </ItemTemplate>
                                                                                                       </asp:TemplateField>


                                                                                                    <%--   <asp:TemplateField HeaderText="">
                                                                                                            <HeaderStyle  Width="30px"></HeaderStyle>
                                                                                                            <ItemStyle  Height="40px"/>
                                                                                                           <ItemTemplate >
                                                                                                               <asp:ImageButton ID="imgdel" runat="server" ImageUrl="~/App_Resources/DELETE.BMP" Width="10px" Style="float:right;display:block" OnClick="imgdelete_Click" CommandName="DeleteMapping" CommandArgument="<%# Container.DataItemIndex %>" />	
                                                                                                               </ItemTemplate>
                                                                                                           </asp:TemplateField>--%>
                                                                                                     </Columns>

                                                                                                 </asp:GridView>

                                                                                         </td>
                                                                                     </tr>
                                                                                 </table>
                                                                              </div>
                                                                        </td>
                                                                       </tr>
                                                                    </table>
                                                            </ContentTemplate>
                                                              </asp:UpdatePanel>
                                                     </td>
                                                 </tr>
                                             </table>
                                             </fieldset>
                                    </td>
                                </tr>
                            </table>
                        </td>

                        <td style="vertical-align: top;  ">
                            <table>
                               
                                <tr>
                                    <td style="vertical-align: top; height: 90px;">
                                        <asp:UpdatePanel ID="updatepnlMetadata" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                             <fieldset class="fieldSetBorder" style="min-height:588px;width:400px">
                                            <legend class="fieldsetlegend" >Icon Details</legend>
                                                  <table id="tblFindUDFColumns" runat="server" style="padding-top:9px!important"  >

                                            <tr>
                                                <td>
                                                    <asp:TextBox ID="txtSearch" runat="server" Width="217px" onkeydown="return EnterEvent(event)"></asp:TextBox>
                                                    <asp:ImageButton ID="imgsearch" runat="server" ImageUrl="~/App_Resources/Search_20x20.png" OnClick="imgsearch_Click"/>
                                                  <%--  <asp:Button ID="btnFind" runat="server" CssClass="btn" Text="Find" Width="120px" />--%>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td id="SideGrid" style="padding-top:6px">
                                                      <asp:GridView ID="GridFindColumn" runat="server" AutoGenerateColumns="False" CssClass="Grid" AllowPaging="True" PageSize="10" HeaderStyle-Wrap="true">
                                                        <SelectedRowStyle CssClass="GridItemSelect UCPGrid"></SelectedRowStyle>
                                                        <HeaderStyle HorizontalAlign="Center" CssClass="GridHeader UCPGrid" VerticalAlign="Middle"></HeaderStyle>
                                                        <FooterStyle CssClass="GridFooter UCPGrid"></FooterStyle>
                                                        <RowStyle CssClass="GridItem UCPGrid" Wrap="true" />
                                                        <PagerStyle CssClass="GridPager" />
                                                        <Columns>

                                                             <asp:BoundField DataField="IconName" HeaderText="Icon Name" ItemStyle-Wrap="true" ControlStyle-CssClass="DisableDragDrop" ItemStyle-Width="100px" ItemStyle-CssClass="wtm"/>
                                                              <asp:BoundField DataField="SrNo" HeaderText="Sr No." Visible="false" />
                                                                 <asp:TemplateField HeaderText="Icon">
                                                                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px"></HeaderStyle>
                                                                      <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" Height="40px"/>
                                                                     <ItemTemplate >
                                                                         
                                                                         <asp:Image ID="imgicon" runat="server" draggable="true"/>
                                                                     </ItemTemplate>
                                                                 </asp:TemplateField>
                                                            </Columns>
                                                        </asp:GridView>
                                                </td>
                                            </tr>
                                            </table>
                                                 </fieldset>
                                            </ContentTemplate>
                                            </asp:UpdatePanel>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>

            </ContentTemplate>
            
  <%--   <Triggers>
        <asp:PostBackTrigger ControlID = "btnmap" /> 
    </Triggers>--%>
           </asp:UpdatePanel>
    </asp:Content>