<%@ Page Language="C#" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="true" CodeFile="AddMerchant.aspx.cs" Inherits="Business_AddMerchant"  %>
<%@ Register src="../UserControls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script language="javascript">
function validate()
{
    var message = "";
    if (document.getElementById("<%=txtAccNo.ClientID%>").value=="")
    {
        message += "Account Number can not be blank\n";
        document.getElementById("<%=txtAccNo.ClientID%>").style.backgroundColor="#c8d1e4";
    }
    
    var IndexValue = document.getElementById("<%=ddlClientLevel.ClientID %>").selectedIndex;
    var SelectedVal = document.getElementById("<%=ddlClientLevel.ClientID %>").options[IndexValue].value;
    if(SelectedVal == "003" && document.getElementById("<%=txtParent.ClientID%>").value=="")
    {
        message += "Parent retialer ID can not be blank\n";
        document.getElementById("<%=txtParent.ClientID%>").style.backgroundColor="#c8d1e4";
    }
    
    if(document.getElementById("<%=txtRetailName.ClientID%>").value=="")
    {
        message += "Merchant Name can not be blank\n";
        document.getElementById("<%=txtRetailName.ClientID%>").style.backgroundColor="#c8d1e4";
    }
    
    if(document.getElementById("<%=ddlCity.ClientID %>").selectedIndex ==0)
    {
        message += "City can not be blank\n";
        document.getElementById("<%=ddlCity.ClientID%>").style.backgroundColor="#c8d1e4";
    }
    
    if(document.getElementById("<%=ddlBusinessUnit.ClientID %>").selectedIndex ==0)
    {
        message += "Business Unit can not be blank\n";
        document.getElementById("<%=ddlBusinessUnit.ClientID%>").style.backgroundColor="#c8d1e4";
    }
    
    if(message.length >0)
    {
        message = "please notice the following requirments:\n\n" + message;
        alert(message);
        return false;
    }
      return true;
}

function validate1()
{
    var message = "";
    if(document.getElementById("<%=txtParent.ClientID%>").value=="")
    {
        message += "Parent retialer ID can not be blank\n";
        document.getElementById("<%=txtParent.ClientID%>").style.backgroundColor="#c8d1e4";
    }
    
    if(message.length >0)
    {
        message = "please notice the following requirments:\n\n" + message;
        alert(message);
        return false;
    }
      return true;
}

</script>

</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>
                                        Add Merchant</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="pnlBR" runat="server" Width="100%">
                                                <fieldset id="addItem">
                                                 <legend id="addItem">Merchant Details</legend>
                                                </fieldset>
                                                <table border="0" width="95%" cellpadding="0" cellspacing="0" class="add_ItemTB1">
                                                    <tr>
                                                        <td class="tdNormal" style="width:15%"> Account Number <span style="color:Red;">*</span> </td>
                                                        <td class="tdNormal" style="width:30%"> 
                                                            <asp:TextBox ID="txtAccNo" MaxLength="14" runat="server" class="fieldNormal"></asp:TextBox>
                                                        </td>
                                                        <td class="tdNormal" style="width:10%"> </td>
                                                        <td class="tdNormal" colspan=2 style="width:45%"> 
                                                            <asp:Button ID="btnMW" runat="server" Text="Verify Account" 
                                                                class="Btn_L_Normal1" onclick="btnMW_Click"/>
                                                        </td>
                                                    </tr>
                                                    <tr runat="server" id="rowParent">
                                                        <td class="tdNormal">Parent retailer ID</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtParent" runat="server" class="fieldNormal" MaxLength="10"></asp:TextBox></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal"><asp:Button ID="btnParentData" runat="server" 
                                                                Text="Get Parent Data" class="Btn_L_Normal1" onclick="btnParentData_Click" OnClientClick="return validate1()"/></td>
                                                        <td class="tdNormal"></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal" style="width:15%">Client level</td>
                                                        <td class="tdNormal" style="width:30%"><asp:DropDownList ID="ddlClientLevel" 
                                                                runat="server" DataTextField="cl_desc" 
                                                             DataValueField="cl_code" class="fieldNormal" AutoPostBack=true 
                                                                onselectedindexchanged="ddlClientLevel_SelectedIndexChanged"></asp:DropDownList></td>
                                                        <td class="tdNormal" style="width:10%"></td>
                                                        <td class="tdNormal" style="width:15%">
                                                            <asp:Label ID="lblMerchantName" runat="server" Text="Merchant Name"></asp:Label>
                                                        </td>
                                                        <td class="tdNormal" style="width:30%">
                                                        <asp:TextBox ID="txtRetailName" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal"><asp:Label ID="lblMerchantNameAr" runat="server" Text=" Arabic Merchant Name"></asp:Label></td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtRetailNameAr" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal"></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">legal form</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtLegalForm" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">language</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlLang" runat="server" DataTextField="language_name" 
                                                             DataValueField="lang_code" class="fieldNormal"></asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">business class</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlBusinessClass" runat="server" DataTextField="BUSINESS_TYPE" 
                                                             DataValueField="MCC" class="fieldNormal"></asp:DropDownList></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">city name</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlCity" runat="server" DataTextField="c_desc" 
                                                             DataValueField="c_code" class="fieldNormal"></asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">street</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtStreet" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">product type</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlProductType" runat="server" DataTextField="product_Type" 
                                                             DataValueField="pt_code" class="fieldNormal"></asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">posting method</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlPostingMethod" runat="server" DataTextField="method_name" 
                                                             DataValueField="pm_code" class="fieldNormal"></asp:DropDownList></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">settlement method</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlSettlMethod" runat="server" DataTextField="method_name" 
                                                             DataValueField="sm_code" class="fieldNormal"></asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal" style="width: 20%">
                                                            Rental Type
                                                        </td>
                                                        <td colspan="4">
                                                            <asp:RadioButton ID="rdDynamic" Text="Dynamic" GroupName="rd" 
                                                                runat="server" AutoPostBack="False" />
                                                            <asp:RadioButton ID="rdFixed" Text="Fixed"   GroupName="rd" 
                                                                runat="server" AutoPostBack="False" Checked=true />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">Dynamic Rental Group</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlDynamicG" runat="server" DataTextField="group_name" 
                                                             DataValueField="group_code" class="fieldNormal"></asp:DropDownList></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">Fixed Rental Group</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlFixedG" runat="server" DataTextField="group_name" 
                                                             DataValueField="group_code" class="fieldNormal"></asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">Business Unit</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlBusinessUnit" runat="server" DataTextField="description" 
                                                             DataValueField="bu_code" class="fieldNormal" AutoPostBack="True" 
                                                                onselectedindexchanged="ddlBusinessUnit_SelectedIndexChanged"></asp:DropDownList></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">Business Unit Account</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtBUAcc" ReadOnly=true runat="server" class="fieldNormal"></asp:TextBox></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">relationship officer</td>
                                                        <td class="tdNormal">
                                                        <asp:DropDownList ID="ddlRelationshipOfficer" runat="server" DataTextField="RSO_NAME" 
                                                             DataValueField="RSO_CODE" class="fieldNormal"></asp:DropDownList>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">Segment</td>
                                                        <td class="tdNormal"><asp:DropDownList ID="ddlIncomeRange" runat="server" DataTextField="income_range_desc" 
                                                             DataValueField="c_icode" class="fieldNormal"></asp:DropDownList>
                                                        <asp:TextBox ID="txtIncomeRange" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">manual application number</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtManualAppNo" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">merchant contact</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtMerchantContact" runat="server" class="fieldNormal"></asp:TextBox></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="tdNormal">registration date</td>
                                                        <td class="tdNormal"><uc1:datepicker id="dateRegDate" runat="server" width="250" /></td>
                                                        <td class="tdNormal"></td>
                                                        <td class="tdNormal">registration number</td>
                                                        <td class="tdNormal"><asp:TextBox ID="txtRegNo" 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="btnSave" runat="server" Text="   Save   "
                                                                class="Btn_M_Normal" onclick="btnSave_Click" OnClientClick="return validate()"/>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                        <!------------------------------------body End2 ----------------------------------------------->
                                        <br>
                                    </td>
                                </tr>
                            </table>
                            <!------------------------------------body End2 ----------------------------------------------->
                        </td>
                    </tr>
                </table>
</asp:Content>

