
{% include 'header.twig' %}


 <div class="paddingbody"></div>
	<div class="container-fluid container-fluid-spacious">
		<div class="row">
		    
		    	{% if error %}
					<div class="alert alert-dismissible alert-danger">
						{{ errorText }}
					</div>
					<br>
				{% endif %}

				{% if success %}
					<div class="alert alert-dismissible alert-success">
						{{ successText }}
					</div>
					<br>
				{% endif %}
		    
			<div class="col-md-12">
				<div class="well well-float table-responsive">
					<table class="table ">
						<thead>
							<tr>
								<th>Referral link</th>
								<th>Commission rate</th>
								<th>Minimum payout</th>
							</tr>
						</thead>
						<tbody>
						<tr class="affiliates-table-border-none">
<tr>
                                    <td data-label="Referral link" nowrap>
                                        <span id="link-1" class="mr-1">{{ site["url"] }}/affiliates?ref={{ user['ref_code'] }}</span>
                                        <a>
                                            <span
                                                data-clip="true"
                                                title="Link copied"
                                                data-clipboard-action="copy"
                                                data-clipboard-target="#link-1"
                                                class="fas fa-clone"></span>
                                        </a>
                                    </td>
                                    <td data-label="Commission rate">{{settings["referral_commision"]}}%</td>
                                    <td data-label="Minimum payout">{{ currency['symbol']}} {{ (settings["referral_payout"]*currency["value"]) }}</td>
                                </tr>
						</tbody>
					</table>
				</div>
				<div class="well well-float table-responsive">
					<table class="table ">
						<thead>
							<tr>
								<th>Total visits</th>
								<th>Unpaid referrals</th>
								<th>Paid referrals</th>
								<th>Conversion rate</th>
								<th>Total earnings</th>
								<th>Unpaid earnings</th>
							</tr>
						</thead>
						<tbody>
						<tr class="affiliates-table-border-none">
<tr>
                                   

	{% for ref in ref_content %}																
<td>{{ ref['referral_clicks'] }}</td>
<td>{{ ref['referral_sign_up'] }}</td>
<td>{{ ( ref['referral_sign_up'] / ref['referral_clicks']) * 100 }}%</td>
<td>{{ currency['symbol'] }}{{ ref['referral_total_commision']*currency["value"] }}</td>
<td>{{ currency['symbol'] }}{{ ref['referral_earned_commision']*currency["value"] }}</td>
<td>{{ currency['symbol'] }}{{ (ref['referral_total_commision'] - (ref['referral_earned_commision']  +  ref['referral_requested_commision'] +  ref['referral_rejected_commision'])) *currency["value"] }}</td>
<!-- <td>{{ currency['symbol'] }}{{ ref['referral_rejected_commision']*currency["value"] }}</td> -->
<td><form method="post" action="">

																				<input type="hidden" name="ref_code" value="{{ user['ref_code'] }}">
																				<input type="hidden" name="ref_amt" value="{{ ref['referral_total_commision'] - (ref['referral_earned_commision'] + ref['referral_requested_commision'] ) }}">
																				<a href="javascript:void(0)">
																				{% if (ref['referral_total_commision'] - (ref['referral_earned_commision'] + ref['referral_requested_commision'] + ref['referral_rejected_commision'] )) >= settings["referral_payout"] %} <button type="submit" style="margin-left:2px;" class="btn btn-actions">Request Paid Out</button>
															 {% endif %} 						</a>

																			</form>
																		</td>
																	</tr>
																</td>
															</tbody>
													
													{% endfor %}
	</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	

    
{% include 'footer.twig' %}


