<section class="content-header">
<h1>Affiliate Signup</h1>
</section>
<section class="content">
    <div class="box box-success" style="border-top-color:#acb5b1">
    <div class="box-body" style="margin:10px;">
	<form id="adv_form" action="<?php echo base_url() . (($this->session->userdata('ROLE') == 1) ? '/offer/affiliate' : '/publisher/affiliate'); ?>" method="post" data-toggle="validator" role="form">
        <!-- <form id="adv_form" action=<?php //if($this->session->userdata('ROLE')==1){ ?>"/offer/affiliate"<?php //}else{?>"/publisher/affiliate"<?php //}?> method="post" data-toggle="validator" role="form"> -->
       <div class="row">
            <div class="col-sm-6 col-md-6 col-lg-3">
                <div class="form-group field-advertiser-first_name required">
					<label class="control-label" for="afn">First Name</label>
					<input type="text" id="afn" class="form-control" name="afn" maxlength="50" required >

					<p class="help-block help-block-error"></p>
				</div>            
				</div>
            <div class="col-sm-6 col-md-6 col-lg-3">
                <div class="form-group field-advertiser-last_name required">
					<label class="control-label" for="aln">Last Name</label>
					<input type="text" id="aln" class="form-control" name="aln" maxlength="50" required>

					<p class="help-block help-block-error"></p>
				</div>            
			</div>
            <div class="col-sm-6 col-md-6 col-lg-3">
				<div class="form-group field-advertiser-email required">
					<label class="control-label" for="aemail">Email <i class="fa fa-question-circle" data-toggle="tooltip" data-html="true" title="Advertiser’s email address, which will also be used to received system notifications."></i></label>
					<input type="email" id="aemail" class="form-control" name="aemail" maxlength="50" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"  required>

					<p class="help-block help-block-error"></p>
				</div>
			</div>

            <div class="col-sm-6 col-md-6 col-lg-3">
                <div class="form-group field-advertiser-mobile">
					<label class="control-label" for="amobile">Mobile No.</label>
					<input type="text" id="amobile" class="form-control" name="amobile" pattern="[0-9][0-9]{9}" required>

					<p class="help-block help-block-error"></p>
				</div>           
			</div>
        </div>

        <div class="row">
            <div class="col-sm-6 col-md-6 col-lg-3">
                <div class="form-group field-advertiser-im_type">
					<label class="control-label" for="aim">IM</label>
					<select id="aim" class="form-control select2-hidden-accessible" name="aim" required>
					<option value="">IM</option>
					<option value="0">Other</option>
					<option value="1">Skype</option>
					<option value="2">GTalk</option>
					<option value="3">QQ</option>
					<option value="4">Yahoo</option>
					<option value="5">Facebook</option>
					<option value="6">WeChat</option>
					<option value="7">Twitter</option>
					</select>

					<p class="help-block help-block-error"></p>
				</div>            
			</div>
            <div class="col-sm-6 col-md-6 col-lg-3">
                <div class="form-group">
					<label class="control-label" for="aimid">IM Account</label>
					<input type="text" id="aimid" class="form-control" name="aimid" maxlength="50" required>

					<p class="help-block help-block-error"></p>
				</div>            
			</div>
            <div class="col-sm-6 col-md-6 col-lg-3">
                <div class="form-group">
					<label class="control-label" for="acountry">Country</label>
					<select id="acountry" class="form-control select2-hidden-accessible" name="acountry" required>
					<option value="">Country</option>
					<?php
					foreach($country_arr as $cvalue)
					{
						echo "<option value='$cvalue'>$cvalue</option>";
					}
					?>
					</select>

					<p class="help-block help-block-error"></p>
				</div>            
					
			</div>
			<?php if($this->session->userdata('ROLE')==1){ ?>
				

            <div class="col-sm-6 col-md-6 col-lg-3">
				<div class="form-group field-advertiser-manager_id required">
					<label class="control-label" for="amanager">Manager <i class="fa fa-question-circle" data-toggle="tooltip" data-html="true" title="Advertiser Manager who manages this advertiser account."></i></label>
					<select id="amanager" class="form-control select2-hidden-accessible" name="amanager" required>
					<option value="">Manager</option>
					<?php foreach($manager as $value){
						echo "<option value='$value'>$value</option>";
					}?>
					</select>

					<p class="help-block help-block-error"></p>
				</div>
			</div>        
		</div>
			<?php }?>
        <div class="row">
            <div class="col-sm-3 col-md-3 col-lg-3">
				<div class="form-group field-advertiser-company required">
				<label class="control-label" for="acompany">Company</label>
				<input type="text" id="acompany" class="form-control" name="acompany" maxlength="500" required>

				
				</div>            
			</div>
            <div class="col-sm-3 col-md-3 col-lg-3">
				<div class="form-group ">
				<label class="control-label" for="awebsite">Website</label>
				<input type="text" id="awebsite" class="form-control" name="awebsite" maxlength="255" value=""   required>
				
				</div>      				
		</div>
            <div class="col-sm-6 col-md-6 col-lg-6">
                                <div class="form-group field-advertiser-company required">
                                <label class="control-label" for="aaddress">Address</label>
                                <input type="text" id="aaddress" class="form-control" name="aaddress" maxlength="500" required>


                                </div>
                        </div>

    </div>
        
        <div class="row">
			 <?php if($this->session->userdata('ROLE')==1){ ?>
            <div class="col-sm-6 col-md-6 col-lg-2">
                <div class="form-group field-advertiser-status required">
					<label class="control-label" for="astatus">Status</label>
					<select id="astatus" class="form-control select2-hidden-accessible" name="astatus"  tabindex="-1" aria-hidden="true" required>
					<option value="">Status</option>
					<option value="1">Active</option>
					</select>

					<p class="help-block help-block-error"></p>
				</div>           
			</div><?php } ?>
            <div class="col-sm-6 col-md-6 col-lg-4">
                <div class="form-group field-advertiser-password required ">
					<label class="control-label" for="apassword">Password</label>
					<div class="kv-password"><table class="kv-strength-container"><tbody><tr>
					<td><div class="input-group">
					<input type="password" id="apassword" class="form-control" name="apassword" maxlength="60" value="" required>
					
					</div></td>
					</tr></tbody></table><input type="hidden" value="50"></div>

					<p class="help-block help-block-error"></p>
				</div>            
			</div>
            <div class="col-sm-6 col-md-6 col-lg-2">
                <div class="form-group field-advertiser-status required">
                                        <label class="control-label" for="arpassword">Repeat Password</label>
					<input type="text" id="arpassword" class="form-control" name="arpassword" maxlength="60" value="" required>
                                        <p class="help-block help-block-error"></p>
                                </div>
                        </div>
        </div>





        <div class="row">
	    <div class="col-sm-12">
                                    <div class="checkbox col-sm-12">
                <input type="checkbox" id="SignUp_agree" name="Signuptnc" class="i-checks" value="1" required/>

                                    <label>I agree with <a href="<?php echo base_url(); ?>/terms" target="_blank" class="underline">Terms and Conditions</a></label>
                            </div>

            <div class="checkbox col-sm-12">
                <div style="top: -30px; position: relative; display: inline-block;">
                    <input type="checkbox" id="SignUp_agree_use_info" name="Signup" class="i-checks" value="1" required/>
                </div>
                <label style="max-width: 650px">I hereby consent and allow the use of my and/or my company&#039;s information, including sharing with a third party, to assess, detect, prevent or otherwise enable detection and prevention of malicious, invalid or unlawful activity and/or general fraud prevention.</label>
            </div>
	    </div>
	</div>
	<div class="row">
            <div class="col-sm-2">
                <div class="form-group">
				<?php if(!empty($this->input->get('ref'))){?>
				<input type="hidden" id="ref" name="ref" value="<?php print $this->input->get('ref');?>"/>		
				<?php } ?>
					<button type="submit" class="btn btn-info btn-block" style="background-color:#007AFF">Submit</button>
					</div>
            </div>
	<?php if(!empty($error)){print $error;}?>
        </div>

        </form>
    </div>
</div>


    </section>
<script>
var password = document.getElementById("apassword");
var confirm_password = document.getElementById("arpassword");

function validatePassword(){
  if(password.value != confirm_password.value) {
    confirm_password.setCustomValidity("Passwords Don't Match");
  } else {
    confirm_password.setCustomValidity('');
  }
}

password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;
</script>	
