<%@ page language="C#" masterpagefile="~/MasterPages/Main.master" autoeventwireup="true" inherits="merchantMain, App_Web_wbvr1n5o" viewStateEncryptionMode="Always" maintainScrollPositionOnPostBack="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table class="body_MainTB" border="0" cellpadding="0" cellspacing="0">
        <tr align="center">
            <td valign="top">
                <!------------------------------------body St  ---------------------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" class="body_formTitle">
                    <tr>
                        <td>
                            Merchant Managment
                        </td>
                    </tr>
                </table>
                <br>
                <!------------------------------------body End1 ----------------------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" class="contTB">
                    <tr>
                        <td align="center">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="Frow">
                                <tr>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <asp:Label ID="lblError" runat="server" Text="" class="fieldError"></asp:Label>
                            
                            <asp:Panel ID="pnl_filters" runat="server" Width="100%">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <tr>
                                    <td class="tdNormal">
                                        Retailer ID
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtRetailerID" runat="server" class="fieldNormal" Width="250"></asp:TextBox>
                                    </td>
                                    <td class="tdNormal">
                                    </td>
                                    <td class="tdNormal">
                                    </td>
                                    <td class="tdNormal">
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="5" style="text-align: center">
                                        <asp:Button ID="Button1" runat="server" Text="Search" CssClass="Btn_L_Normal" OnClick="Button1_Click" />
                                    </td>
                                </tr>
                            </table>

                            </asp:Panel>

                            <asp:Panel ID="pnl_del_service_confirmation" runat="server" Width="100%">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td colspan="2" class="tdNormal" align="center">
                                            <asp:Label ID="Label1" runat="server" Text="Are you sure you want to delete this Service ?"></asp:Label>                                                       
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal">
                                            <asp:Button ID="btn_del_service_conf_ok" runat="server" Text="OK" 
                                                CssClass="Btn_L_Normal" onclick="btn_del_service_conf_ok_Click" />
                                        </td>

                                        <td class="tdNormal">
                                            <asp:Button ID="btn_del_service_conf_cancel" runat="server" Text="Cancel" 
                                                CssClass="Btn_L_Normal" onclick="btn_del_service_conf_cancel_Click"/>
                                        </td>
                                                        
                                    </tr>
                                </table>
                            </asp:Panel>

                            <asp:Panel ID="pnl_del_terminal_confirmation" runat="server" Width="100%">
                                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td colspan="2" class="tdNormal" align="center">
                                                       <asp:Label ID="Label2" runat="server" Text="Are you sure you want to delete this Terminal ?"></asp:Label>                                                       
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal">
                                                       <asp:Button ID="btn_del_terminal_conf_ok" runat="server" Text="OK" 
                                                            CssClass="Btn_L_Normal" onclick="btn_del_terminal_conf_ok_Click"/>
                                                    </td>

                                                    <td class="tdNormal">
                                                       <asp:Button ID="btn_del_terminal_conf_cancel" runat="server" Text="Cancel" 
                                                            CssClass="Btn_L_Normal" onclick="btn_del_terminal_conf_cancel_Click"/>
                                                    </td>
                                                        
                                                </tr>
                                            </table>
                                        </asp:Panel>

                            <asp:Panel ID="pnl_del_Merchant_confirmation" runat="server" Width="100%">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td colspan="2" class="tdNormal" align="center">
                                            <asp:Label ID="Label3" runat="server" 
                                                Text="Are you sure you want to delete this Merchant ?"></asp:Label>                                                       
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal">
                                            <asp:Button ID="btn_del_Merch_conf_ok" runat="server" Text="OK" 
                                                CssClass="Btn_L_Normal" onclick="btn_del_Merch_conf_ok_Click"  />
                                        </td>

                                        <td class="tdNormal">
                                            <asp:Button ID="btn_del_Merch_conf_cancel" runat="server" Text="Cancel" 
                                                CssClass="Btn_L_Normal" onclick="btn_del_Merch_conf_cancel_Click" />
                                        </td>
                                                        
                                    </tr>
                                </table>
                            </asp:Panel>

                            <br />
                            <asp:Panel ID="pnlResult" runat="server" Width="100%" Visible="true">
                                <fieldset id="addItem">
                                    <legend id="addItem">Merchants</legend>
                                </fieldset>
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            <asp:GridView ID="GridView1" CssClass="gridMaster" Width ="100%" runat="server" AutoGenerateColumns="False"
                                                DataKeyNames="client_number" AllowPaging="True" AllowSorting="True" CellPadding="4"
                                                ForeColor="#333333" GridLines="None" OnRowCommand="GridView1_RowCommand" EmptyDataText="There are no Results">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                                <Columns>
                                                    <asp:BoundField DataField="RETAILER_ID" HeaderText="Retailer ID" ItemStyle-VerticalAlign="Middle"  />
                                                    <asp:BoundField DataField="RETAILER_NAME" HeaderText="MERCHANT NAME" ItemStyle-VerticalAlign="Middle"/>
                                                    <asp:BoundField DataField="Acct_number" HeaderText="Account No" ItemStyle-VerticalAlign="Middle"/>
                                                    <asp:BoundField DataField="CLIENT_NUMBER" HeaderText="CLIENT No" ItemStyle-VerticalAlign="Middle"/>
                                                    <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="u" Text="Edit"
                                                        ImageUrl="~/Images/edit.jpg"></asp:ButtonField>
                                                    <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="vt" Text="View Terminals"
                                                        ImageUrl="~/Images/document_view.jpg"></asp:ButtonField>
                                                          <asp:ButtonField ButtonType="Image" CommandName="d" Text="Delete" ItemStyle-Width="30px"
                                                        ImageUrl="~/Images/delete.jpg">
                                                        <ItemStyle Width="30px" />
                                                    </asp:ButtonField>
                                                </Columns>
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="Black" />
                                                <EditRowStyle BackColor="#999999" />
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" HorizontalAlign="Right" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 20%">
                                            Go To Page:
                                            <asp:DropDownList ID="ddlPages" runat="server" class="fieldNormal" AutoPostBack="True"
                                                Width="50px" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgForm">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnAdd" runat="server" Text="     Add     " class="Btn_M_Normal"
                                                OnClick="btnAdd_Click" />
                                            &nbsp;&nbsp;
                                    </tr>
                                </table>
                            </asp:Panel>


                            <asp:Panel ID="pnlControls" runat="server" Width="80%" Visible="false">
                                <fieldset id="addItem">
                                    <legend id="addItem">Merchant Details</legend>
                                </fieldset>
                                <table border="0" width="80%" cellpadding="0" cellspacing="0" class="add_ItemTB1">
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Retailer ID
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:TextBox ID="txtRetailer" runat="server" class="fieldNormal" 
                                                MaxLength="12" ></asp:TextBox>
                                            <br />
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Merchant Name
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:TextBox ID="txtMerchantName" runat="server" class="fieldNormal"></asp:TextBox>
                                            <br />
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Account Number
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:TextBox ID="txtAccNo" runat="server" class="fieldNormal"></asp:TextBox>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                        </td>
                                    </tr>
                                    
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnCancel" runat="server" Text="   Cancel   " class="Btn_M_Normal"
                                                CausesValidation="False" OnClick="btnCancel_Click" />
                                            <asp:Button ID="btnSave" runat="server" Text="   Save   " class="Btn_M_Normal" OnClick="btnSave_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            

                            <asp:Panel ID="pnlTerminals" runat="server" Width="75%" Visible="false">
                                <fieldset id="addItem">
                                    <legend id="addItem">Terminals</legend>
                                </fieldset>
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            <asp:GridView ID="gvTerminals" CssClass="gridMaster" Width ="100%" runat="server" AutoGenerateColumns="False"
                                                DataKeyNames="term_id" AllowPaging="True" AllowSorting="True" CellPadding="4"
                                                ForeColor="#333333" GridLines="None" OnRowCommand="gvTerminals_RowCommand" EmptyDataText="There are no Results">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" 
                                                    VerticalAlign="Middle"  />
                                                <Columns>
                                                    <asp:BoundField DataField="term_id" HeaderText="Terminal ID" 
                                                        ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign ="Center"  >
                                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                    </asp:BoundField>
                                                    <asp:BoundField DataField="retailer_id" HeaderText="Retailer ID" 
                                                        ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign ="Center" >
                                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                    </asp:BoundField>
                                                    <asp:ButtonField ButtonType="Image" ItemStyle-Width="25px"  CommandName="d" 
                                                        Text="Delete" ImageUrl="~/Images/delete.jpg" ItemStyle-VerticalAlign="Middle" 
                                                        ItemStyle-HorizontalAlign ="Center" >
                                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="25px" />
                                                    </asp:ButtonField>
                                                    <asp:ButtonField ButtonType="Image" ItemStyle-Width="25px" CommandName="v" Text="View Services"
                                                        ImageUrl="~/Images/document_view.jpg">
                                                    <ItemStyle Width="25px" />
                                                    </asp:ButtonField>
                                                </Columns>
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="Black" />
                                                <EditRowStyle BackColor="#999999" />
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" HorizontalAlign="Center" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgForm">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnAddTerminal" runat="server" Text="     Add     " class="Btn_M_Normal"
                                                OnClick="btnAddTerminal_Click" />
                                                </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <asp:Panel ID="pnlControlTerminal" runat="server" Width="80%" Visible="false">
                                <fieldset id="addItem">
                                    <legend id="addItem">Terminal Details</legend>
                                </fieldset>
                                <table border="0" width="80%" cellpadding="0" cellspacing="0" class="add_ItemTB1">
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Terminal ID
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:TextBox ID="txtTerminalID" runat="server" class="fieldNormal" 
                                                MaxLength="16"></asp:TextBox>
                                            <br />
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnCancelTerminal" runat="server" Text="   Cancel   " class="Btn_M_Normal"
                                                CausesValidation="False" OnClick="btnCancelTerminal_Click" />
                                            <asp:Button ID="btnSaveTerminal" runat="server" Text="   Save   " class="Btn_M_Normal" OnClick="btnSaveTerminal_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <asp:Panel ID="pnlServices" runat="server" Width="75%" Visible="false">
                                <fieldset id="addItem">
                                    <legend id="addItem">Services</legend>
                                </fieldset>
                                <table border="0" align="center" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            <asp:GridView ID="gvServices" CssClass="gridMaster" Width ="100%" runat="server" AutoGenerateColumns="False"
                                                DataKeyNames="service_id" AllowPaging="True" AllowSorting="True" CellPadding="4"
                                                ForeColor="#333333" GridLines="None" OnRowCommand="gvServices_RowCommand" EmptyDataText="There are no Results">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
                                                <AlternatingRowStyle HorizontalAlign ="Center" />
                                                <Columns>
                                                    <asp:BoundField DataField="Service_name" HeaderText="Service Name"  />
                                                    <asp:BoundField DataField="ACCT_NUMBER" HeaderText="Account" />
                                                    <asp:BoundField DataField="fees" HeaderText="Merchant Fee" />
                                                    <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="d" Text="Delete" ImageUrl="~/Images/delete.jpg" />
                                                </Columns>
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="Black" />
                                                <EditRowStyle BackColor="#999999" />
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" HorizontalAlign="Right" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgForm">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnAddService" runat="server" Text="     Add     " class="Btn_M_Normal"
                                                OnClick="btnAddService_Click" />
                                                </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <asp:Panel ID="pnlControlServices" runat="server" Width="80%" Visible="false">
                                <fieldset id="addItem">
                                    <legend id="addItem">Terminal Details</legend>
                                </fieldset>
                                <table border="0" width="80%" cellpadding="0" cellspacing="0" class="add_ItemTB1">
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Service ID
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                           <asp:DropDownList ID="ddlServices" runat="server" DataTextField="service_name" DataValueField="Service_code"
                                                class="fieldNormal" AutoPostBack="False"></asp:DropDownList>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Account Number
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:TextBox ID="txtAccountNoService" runat="server" class="fieldNormal" ></asp:TextBox>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                        </td>
                                         <td class="tdNormal" style="width: 15%">
                                            Merchant Fee
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:TextBox ID="txtMerchantFee" runat="server" class="fieldNormal" ></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnCancelService" runat="server" Text="   Cancel   " class="Btn_M_Normal"
                                                CausesValidation="False" OnClick="btnCancelService_Click" />
                                            <asp:Button ID="btnSaveService" runat="server" Text="   Save   " class="Btn_M_Normal" OnClick="btnSaveService_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <br />
                            <br />
                        </td>
                    </tr>
                </table>
                <!------------------------------------body End2 ----------------------------------------------->
            </td>
        </tr>
    </table>
</asp:Content>
