<div class="wo_settings_page wow_content">
	<div class="avatar-holder">
		<img src="<?php echo $wo['setting']['avatar']?>" alt="<?php echo $wo['setting']['name']?> Profile Picture" class="avatar">
		<div class="infoz">
			<h5 title="<?php echo $wo['setting']['name']?>"><a href="<?php echo Wo_SeoLink('index.php?link1=timeline&u=' . $wo['setting']['username'] . '');?>" data-ajax="?link1=timeline&u=<?php echo $wo['setting']['username'] ?>"><?php echo $wo['setting']['name']?></a></h5>
			<p><?php echo $wo['lang']['my_balance'] ?> <?php echo Wo_GetCurrency($wo['config']['ads_currency']) . $wo['setting']['balance'];?></p>
		</div>
	</div>
	<hr>
  
	<?php if ($wo['setting']['balance'] < $wo['config']['m_withdrawal']): ?>
	<div class="alert alert-danger">
		<?php 
			$your_balance = str_replace('{balance}',  $wo['setting']['balance'], $wo['lang']['your_balance']); 
			$your_balance = str_replace('{m_withdrawal}',  $wo['config']['m_withdrawal'], $your_balance); 
			$your_balance = str_replace('$', Wo_GetCurrency($wo['config']['ads_currency']), $your_balance);
			
		?>
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-triangle"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12" y2="17"></line></svg> <?php echo $your_balance;?>
	</div>
	<?php endif ?>
  
	<form class="setting-general-form form-horizontal" method="post">
		<div class="setting-general-alert setting-update-alert"></div>
		
		<div class="row">
			<?php if ($wo['config']['bank_withdrawal_system'] == 1) { ?>
				<div class="col-md-12">
					<div class="wow_form_fields">
						<label for="withdraw_method"><?php echo $wo['lang']['withdraw_method']; ?></label>  
						<select id="withdraw_method" name="withdraw_method" class="form-control" onchange="Wo_ShowWithdrawMethod(this)">
							<option value="paypal"><?php echo $wo['lang']['paypal']; ?></option>
							<option value="bank"><?php  echo $wo['lang']['bank']; ?></option>
						</select>
					</div>
				</div>
			<?php } ?>
			<div class="paypal_withdrawal">
				<div class="col-md-6">
					<div class="wow_form_fields">
						<label for="paypal_email"><?php echo $wo['lang']['paypal_email']; ?></label>  
						<input id="paypal_email" name="paypal_email" type="text" class="form-control input-md" value="<?php echo $wo['setting']['email']?>" autocomplete="off">
						<span class="help-block checking"></span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="wow_form_fields">
					<label for="amount"><?php echo $wo['lang']['amount']; ?></label>  
					<input name="amount" id="amount" type="text" class="form-control input-md" value="<?php echo $wo['setting']['balance'];?>">
				</div>
			</div>
			<?php if ($wo['config']['bank_withdrawal_system'] == 1) { ?>
				<div class="bank_withdrawal" style="display: none;">
					<div class="col-md-6">
						<div class="wow_form_fields">
							<label for="iban"><?php echo $wo['lang']['iban']; ?></label>  
							<input name="iban" id="iban" type="text" class="form-control input-md">
						</div>
					</div>
					<div class="col-md-6">
						<div class="wow_form_fields">
							<label for="country"><?php echo $wo['lang']['country']; ?></label>  
							<input name="country" id="country" type="text" class="form-control input-md">
						</div>
					</div>
					<div class="col-md-6">
						<div class="wow_form_fields">
							<label for="full_name"><?php echo $wo['lang']['full_name']; ?></label>  
							<input name="full_name" id="full_name" type="text" class="form-control input-md">
						</div>
					</div>
					<div class="col-md-6">
						<div class="wow_form_fields">
							<label for="swift_code"><?php echo $wo['lang']['swift_code']; ?></label>  
							<input name="swift_code" id="swift_code" type="text" class="form-control input-md">
						</div>
					</div>
					<div class="col-md-12">
						<div class="wow_form_fields">
							<label for="address"><?php echo $wo['lang']['address']; ?></label>  
							<textarea name="address" id="address" type="text" class="form-control input-md"></textarea>
						</div>
					</div>
				</div>
			<?php } ?>
		</div>
		<div class="text-center">
			<button type="submit" class="btn btn-main btn-mat btn-mat-raised add_wow_loader"><?php echo $wo['lang']['request_withdrawal']; ?></button>
		</div>
		<input type="hidden" name="user_id" value="<?php echo $wo['setting']['user_id'];?>">
		<input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
	</form>
</div>

<div class="wow_content page-margin">
	<div class="wo_page_hdng pag_neg_padd pag_alone">
		<div class="wo_page_hdng_innr">
			<span><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3"></path></svg></span> <?php echo $wo['lang']['payment_history']; ?>
		</div>
	</div>
	<div class="table-responsive">
		<table class="table table-condensed setting-table wow_pymnt_table">
			<thead>
				<tr>
					<th>#</th>
					<th><?php echo $wo['lang']['amount']; ?></th>
					<th><?php echo $wo['lang']['requested']; ?></th>
					<th><?php echo $wo['lang']['status']; ?></th>
				</tr>
			</thead>
			<tbody>
				<?php
					$get_payment = Wo_GetPaymentsHistory($wo['setting']['user_id']);
					if (count($get_payment) > 0) {
						foreach ($get_payment as $wo['key'] => $wo['payment']) {
							$wo['key'] = ($wo['key'] + 1);
							$wo['html_class'] = 'label-warning';
							$wo['html_text'] = $wo['lang']['pending'];
							if ($wo['payment']['status'] == 1) {
								$wo['html_class'] = 'label-success';
								$wo['html_text'] = $wo['lang']['approved'];
							} else if ($wo['payment']['status'] == 2) {
								$wo['html_class'] = 'label-danger';
								$wo['html_text'] = $wo['lang']['declined'];
							}
							echo Wo_LoadPage('setting/payment-history');
						}
					}
				?>
			</tbody>
		</table>
	</div>
</div>

<script type="text/javascript">
function Wo_ShowWithdrawMethod(self) {
	if ($(self).val() == 'bank') {
		$('.paypal_withdrawal').slideUp();
		$('.bank_withdrawal').slideDown();
	}
	else{
		$('.bank_withdrawal').slideUp();
		$('.paypal_withdrawal').slideDown();
	}
}
$(function() {
  $('form.setting-general-form').ajaxForm({
    url: Wo_Ajax_Requests_File() + '?f=request_payment',
    beforeSend: function() {
      $('.wo_settings_page').find('.add_wow_loader').addClass('btn-loading');
    },
    success: function(data) {
      scrollToTop();
      if (data.status == 200) {
        $('.setting-general-alert').html('<div class="alert alert-success">' + data.message + '</div>');
        $('.alert-success').fadeIn('fast');
      } else if (data.errors) {
          var errors = data.errors.join("<br>");
          $('.setting-general-alert').html('<div class="alert alert-danger">' + errors + '</div>');
          $('.alert-danger').fadeIn(300);
      }
      $('.wo_settings_page').find('.add_wow_loader').removeClass('btn-loading');
    }
  });
});
</script>