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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>

    <style type="text/css">
        #ctl00_MainContent_dtAllTemplates a:link {
            padding: 5px;
            display: block;
            vertical-align: middle;
        }

        .tdPadding {
            padding: 10px;
        }

        .btn_ballcss {
            background-color: #B3AEAE; /* Gray */
            border: none;
            padding: 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
            border-radius: 50%;
        }

        .ShareDetailsContainer {
            display: none;
            border-radius: 10px;
            width: 710px;
            height: auto;
            position: absolute;
            box-shadow: 3px 3px 4px #666;
            border: solid 1px #ddd;
            border-collapse: collapse;
        }

            .ShareDetailsContainer table table {
            }

        .lblInfo_share {
            font: normal 14px/32px Verdana, Helvetica, sans-serif !important;
            color: #000;
            padding: 5px;
        }

        .DispToggle, .CollapseToggle {
            width: 20px !important;
            height: 20px !important;
            border: none 0px #FFF !important;
            color: #FFF !important;
            outline: 0 !important;
            background-color: #FFFFFF;
            background-repeat: no-repeat;
        }

        .DispToggle {
            background-image: url("../App_Resources/plus1.png");
        }

        .CollapseToggle {
            background-image: url("../App_Resources/minus_1.png");
        }

        .inputs {
            border: 1px;
            color: white;
        }

        .GridCSS {
            border-bottom: 1px solid #000;
            text-decoration: none;
            border-style: none;
            border: White;
        }

        #dvCode table {
            float: left;
            margin: 2px;
        }

        .lblHeader {
            font: normal 14px/14px Verdana, Helvetica, sans-serif !important;
            /*color: #000000 !important;*/
            margin: 0px !important;
        }

        .btn, .btn:hover {
            text-align: left !important;
            box-shadow: 0px 2px #ddd !important;
            outline: none !important;
        }

        .Grid, .grid {
            border: solid 1px #dddddd;
            border-collapse: collapse;
        }

         .hidden {
                    display: none;
                }

         
         .ui-widget.ui-widget-content {
        z-index: 9999999 !important;
        /*Arati Kulkarni CCS Changes 16-Jan-2019*/
        box-shadow: 0 0 10px #000000;
        padding: 0px;
        max-width: none !important;
        /*Arati Kulkarni CCS Changes 16-Jan-2019*/
    }

          /*Arati Kulkarni CCS Changes 16-Jan-2019*/
    .ui-widget-overlay {
        background: #000 !important;
        opacity: .3 !important;
    }
    .ui-dialog .ui-dialog-titlebar, .ui-dialog .ui-dialog-titlebar .ui-widget {
    background-image: none !important;
    background-color: #fff !important;
    color: #000000 !important;
        border: none;
}
    .ui-selectmenu-button, .ui-widget, .ui-state-default, .ui-corner-all {
    border-radius: 8px !important;
}

    .ui-dialog .ui-dialog-titlebar-close span {
        background-color: #fff !important;
        color: #000000 !important;
    }
    /*Arati Kulkarni CCS Changes 16-Jan-2019*/

    .snooker a, #ctl00_MainContent_dlQueues .tdPadding input , #ctl00_MainContent_dtAllTemplates .tdPadding input {
margin: 5px;
padding: 0px;
width: 4em;
height: 4em;
border-radius: 4em;
box-sizing: border-box;
border: solid 0px #FFF !important;
border-collapse: collapse;
background-image: url(../App_Resources/snooker2.png);
background-repeat: no-repeat;
background-size: 105%;
background-attachment: scroll;
background-position: center;
color: #FFF;
font: normal 14px/3em verdana;
text-align: center;
text-decoration: none;
display: block;
vertical-align: middle;
box-shadow: 0px 17px 10px -8px #757575;
text-shadow: 1px 1px 1px #000;
opacity: 0.85;

}

.snooker_larger {
    width: 4em !important;
height: 4em !important;
}
.snooker a:hover, #ctl00_MainContent_dlQueues .tdPadding input:hover, #ctl00_MainContent_dtAllTemplates .tdPadding input:hover {
   box-shadow: 0px 0px 20px 2px #808080;
   opacity:1;
}
.c1{
background-color: #f56b6b;
}
.c2{
background-color: #CC6600;
}
.c3{
background-color: #a34ebb;
}
.c4{
background-color: #5baf49;
}
.c5{
background-color: #1b8de6;
}
.c6{
background-color: #f1b709;
}

.snooker{
list-style:none;
list-style-position:inside;
margin:0px;
padding:0px;
}
.snooker li{
float:left;
}
    </style>
    <asp:UpdatePanel ID="UpdatePanel_Verifier" runat="server" UpdateMode="Always">
        <ContentTemplate>
            <table class="Filter" style="border: none">
                <tr>
                    <td>
                        <asp:Label ID="lblFind_Verifier" runat="server" Text="Template Name :" CssClass="lbl"></asp:Label>
                        <asp:TextBox ID="txtFind" Width="300px" AutoPostBack="true" runat="server" Style="margin-left: 45px;" CssClass="txt" onkeydown="return txtTradeKeydown(event)"></asp:TextBox>
                        <asp:Button ID="btnSearch" Style="text-align: center !important; width: 90px; margin-right: 8px" Text="Find" runat="server" CssClass="btn" />
                        <asp:Button ID="btnHidden" Style="text-align: center !important; width: 90px; margin-right: 8px" Text="Find" runat="server" CssClass="hidden" />
                    </td>
                    <td>
                        <asp:Button ID="btnExpandAll_Verifier" Visible="true" Style="text-align: center !important; width: 90px; margin-right: 8px" Text="Expand All" runat="server" CssClass="btn" />
                        <asp:Button ID="btnCollapseAll_Verifier" Visible="true" Style="text-align: center !important; width: 90px; margin-right: 8px" Text="Collapse All" runat="server" CssClass="btn" />
                        <asp:Label ID="lblMessage_Verifier" runat="server" Visible="false" ForeColor="#4da6ff" Text="Template names in red color is/are not mapped to Deal Entry."></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Label ID="lblError_Verifier" runat="server" CssClass="lblerror"></asp:Label>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td>
                        <div id="divTemplates" style="display: inline-block;" runat="server" allowdrag="true" allowdrop="true">
                            <asp:DataList ID="dtAllTemplates" Style="border-bottom: 1px solid #DDDDDD !important;" runat="server" AllowDrag="True" AllowDrop="true" RepeatDirection="Horizontal" RepeatLayout="Table" RepeatColumns="1" >
                                <ItemTemplate>
                                    <br />
                                    <div style="border-bottom: 1px solid #DDDDDD !important; padding-top: 10px; display: inline-block; min-width: 100%;">
                                        <table style="width: 100%">
                                            <tr>
                                                <td>
                                                    <asp:Button runat="server" ID="btnDisp_Verifier" OnClick="btnDisp_Verifier_Click" CommandArgument='<%#Eval("WTM_Title")%>' CommandName="WorkflowEx" class="DispToggle" OnChange="NoPostback()" />
                                                </td>
                                                <td>
                                                    <asp:Button runat="server" ID="btncollapse_Verifier" Visible="false" OnClick="Collapse_exchange" CommandArgument='<%#Eval("WTM_Title")%>' class="CollapseToggle" OnChange="NoPostback()" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblProductName_Verifier" Style="display: none;" runat="server" Text='<%#Eval("WTM_Title")%>'></asp:Label>
                                                </td>
                                                <td style="width: 90%; white-space: nowrap; padding: 5px;">
                                                    <asp:Label ID="lblExchangLong_Verifier" CssClass="lblHeader" runat="server" Text='<%#Eval("WTM_Title")%>'></asp:Label>
                                                </td>
                                            </tr>

                                        </table>
                                    </div>
                                    <asp:DataList ID="dtWorkflowSetup" Style="margin-top: 5px !important; margin-bottom: 10px !important; margin-left: 5px !important;" runat="server" AllowDrag="true" AllowDrop="true" OnItemDataBound="dtWorkflowSetup_ItemDataBound">
                                        <ItemTemplate>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="LinkButton1_Verifier" runat="server" Style="padding-left: 0px" Text="Workflow Setup"></asp:Label>
                                                    </td>
                                                    <td class="tdPadding">
                                                        <asp:Button runat="server" ID="btn_Ball1" class="btn_ballcss" Text="WD" ToolTip="Workflow Designer" OnClick="btn_Ball1_Click" />
                                                    </td>
                                                    <td class="tdPadding">
                                                        <asp:Button runat="server" ID="Button1" class="btn_ballcss" Text="BM" ToolTip="Workflow Button Master" OnClick="Button1_Click" />
                                                    </td>
                                                    <td class="tdPadding">
                                                        <asp:Button runat="server" ID="Button2" class="btn_ballcss" Text="WM" ToolTip="Workflow Metadata" OnClick="Button2_Click" />
                                                    </td>
                                                    <td class="tdPadding">
                                                        <asp:Button runat="server" ID="Button3" class="btn_ballcss" Text="SM" ToolTip="Workflow Sequence Master" OnClick="Button3_Click" />
                                                    </td>
                                                    <td class="tdPadding">
                                                        <asp:Button runat="server" ID="Button4" class="btn_ballcss" Text="AC" ToolTip="Access Control" OnClick="Button4_Click" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                    </asp:DataList>
                                </ItemTemplate>
                            </asp:DataList>
                        </div>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    <script type="text/javascript">

        function DoPostBack() {
            __doPostBack("txtFind", "TextChanged");
        }

        function txtTradeKeydown(e) {
            if (e.keyCode == 13) {
                
                document.getElementById('<%=btnSearch.ClientID%>').click();
            }
        }

        function NoPostback() {
            event.returnValue = false;
        }

        $(document).ready(function () {
            $("#dtAllTemplates").click(function () {
                alert("Hello world!");
            });
            $(".draggable").draggable({ revert: 'invalid', helper: 'clone' });
            $(".droppable").droppable();
            $(".droppable").bind('drop', function (ev, ui) { itemInSpot(ui.draggable, this); });
        });
        function itemInSpot(drag_item, spot) {
            var oldSpotItem = $(spot).find('img');
            if (oldSpotItem.length > 0) {
                oldSpotItem.remove();
            }
            var item = $('<img />');
            item.attr('src', drag_item.attr('src')).attr('class', drag_item.attr('class')).appendTo(spot).draggable({ revert: 'invalid' });
        }

        function New_Order_Compact(lblcntrl) {
            var templateID = $("#ctl00_MainContent_dtAllTemplates_ctl00_dtWorkflowSetup" + lblcntrl + "_lblTemplateCode")
            alert(templateID);
            $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateCode=" + templateID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
        }

        function Embedded_PopUp_Open_AM(PageName, POPUPWidth, POPUPHeight, title) {
            
            console.log(PageName);
            $('body').find("#ModalBoxInside112").remove();
            $('body').append('<div id="ModalBoxInside112" title="' + title + '" style="top:0px; left:0px;width:' + POPUPWidth + 'px !important;height:' + POPUPHeight + 'px !important"><iframe id="ifrm11" frameborder="0" width="' + POPUPWidth + 'px " height="' + POPUPHeight + 'px " Src=' + PageName + '&Master_Popup=POPUP></iframe></div>')
            $('body').find("#ModalBoxInside112").dialog({
                modal: true,
                autoOpen: true,
                width: POPUPWidth,
                height: POPUPHeight,
                open: function (event, ui) {
                    
                    $("body").css({
                        overflow: 'hidden'
                    });
                    $(".ui-widget-overlay").css({
                        background: "rgb(50, 50, 50) !important",
                        opacity: ".50 !important",
                        filter: "Alpha(Opacity=50) !important",
                        //background: "#666666 !important",
                        //opacity: ".40 !important"
                    });
                    
                    wleft = Number(Math.abs($(window)[0].innerWidth - ($('.ui-dialog').width())) / 2).toFixed(0);
                    if (($(window)[0].innerHeight - 50) >= $('.ui-dialog').height()) {
                        wtop = Number(Math.abs($(window)[0].innerHeight - $('.ui-dialog').height()) / 2).toFixed(0);
                    } else {
                        wtop = Number($(window)[0].innerHeight / 4).toFixed(0);
                    }
                    console.log(wleft + ":" + wtop);
                    $('.ui-dialog').css({ "position": "fixed", "left": wleft + 'px', "top": wtop + 'px', "max-width": "max-content", "max-height": "max-content" });
                    $('.ui-dialog.ui-dialog-content').css({ "left": "0px", "top": "20px" });
                },
                beforeClose: function (event, ui) {
                    $("body").css({ overflow: 'inherit' })
                },
                close: function (event, ui) {
                    if ($('[id$="UpdateProgress1"]').css('display') == 'none') {
                    }
                    document.getElementById("<%=btnHidden.ClientID%>").click();
                }
            });
        }
    </script>
</asp:Content>
