{include file="header.tpl"}

{if $say eq 'processed'}
<div class="suceess">{if $batch eq ''}Withdrawal request has been successfully saved.{else} Withdrawal has been processed. Batch id: {$batch}{/if}</div>
{/if}

{if $fatals}
  {if $fatal == 'times_limit' || $fatals.times_limit}
  <div class="error">You can withdraw {$settings.limit_withdraw_period_times} per {$settings.limit_withdraw_period_date} only.</div>
  {/if}

{else}

{if $errors.ec_forbidden}<div class="error">Sorry, withdraw for this processing is temproary forbidden.</div>{/if}
{if $errors.on_hold}<div class="error">Sorry, this amount on hold now.</div>{/if}
{if $errors.zero}Sorry, you can't request a withdraw smaller than {$currency_sign}0.00 only</div>{/if}
{if $errors.less_min}<div class="error">Sorry, you can request not less than {$fees.amount_min|fiat}</div>{/if}
{if $errors.greater_max}<div class="error">Sorry, you can request not greater than {$fees.amount_max|fiat}</div>{/if}
{if $errors.daily_limit}<div class="error">Sorry, you have exceeded a daily limit</div>{/if}
{if $errors.not_enought}<div class="error">Sorry, you have requested the amount larger than the one on your balance.</div>{/if}
{if $errors.invalid_transaction_code}<div class="error">You have entered the invalid transaction code.</div>{/if}
{if $errors.invalid_tfa_code}<div class="error">You have entered invalid 2FA code.</div>{/if}
{if $errors.no_deposits}<div class="error">You have not done any deposits yet. Withdrawal function will be available after a deposit.</div>{/if}
{if $errors.no_active_deposits}<div class="error">You must have active deposit to withdraw.</div>{/if}
{if $errors.no_account}<div class="error">Please, provide your account to withdraw funds to first <a href="{"?a=edit_account"|encurl}">here</a>.</div>{/if}
{if $errors.demo}<div class="error">Withdraw is not available for demo account.</div>{/if}
{if $errors.turing_image}<div class="error">Invalid turing image</div>{/if}
{if $errors.account_suspended}<div class="error">Account is suspended</div>{/if}

{if $preview}
	<!-- Hor-Content -->
			<div class="hor-content main-content">
				<div class="container">

					<!--Page header-->
					<div class="page-header">

						<div class="page-leftheader">
							<ol class="breadcrumb">
								<li class="breadcrumb-item"><a href="/"><i class="fe fe-home mr-2 fs-14"></i>Home</a>
								</li>
								<li class="breadcrumb-item active" aria-current="page"><a href="#">Pay Portal</a>
								</li>
							</ol>
						</div>

						<div class="page-rightheader">
							<div class="btn btn-list">
								<a href="./#packages" class="btn btn-info"><i class="fe fe-settings mr-1"></i> Invest</a>
								<a href="withdraw.php" class="btn btn-danger"><i class="fe fe-printer mr-1"></i> Withdraw </a>
							</div>
						</div>

					</div>
					<!--End Page header-->

					<!-- Row-1 -->
					<div class="row">

                        <div class="col-md-6 col-lg-6">
                            <div class="card overflow-hidden">
                                <div class="card-body">
<h5 class="card-title mb-3"><u>Payment Details:</u></h5>
<form method=post>
<input type=hidden name=a value=withdraw>
<input type=hidden name=action value=withdraw>
<input type=hidden name=amount value={$amount}>
<input type=hidden name=ec value={$ec}>
<input type=hidden name=comment value="{$comment|escape:html}">

<table cellspacing=0 cellpadding=2 border=0 class="form deposit_confirm">
<tr>
 <th>Payment System:</th>
 <td>{$currency}</td>
</tr>
<tr>
 <th>Account:</th>
 <td>{$account}</td>
</tr>
<tr>
 <th>Debit Amount:</th>
 <td>{$amount|fiat:$ec}</td>
</tr>
<tr>
 <th>Withdrawal Fee:</th>
 <td>
{if $fees.fee > 0}
  {$fees.percent}% + {$fees.add_amount|fiat:$ec} (min. {$fees.fee_min|fiat:$ec} max. {if $fees.fee_max}{$fees.fee_max|fiat:$ec}{else}no{/if})
{else}
We have no fee for this operation.
{/if}
</td>
</tr>

{if $converted}
<tr>
 <th>Credit Amount:</th>
 <td>{$converted.amount|fiat:$ec}</td>
</tr>
<tr>
 <th>{$converted.fiat} Amount:</th>
 <td>{$to_withdraw}</td>
</tr>
{else}
<tr>
 <th>Credit Amount:</th>
 <td>{$to_withdraw|fiat:$ec}</td>
</tr>
{/if}

{if $comment}
<tr>
 <th>Note:</th>
 <td>{$comment|escape:html}</td>
</tr>
{/if}
{if $settings.use_transaction_code && $userinfo.transaction_code}
<tr>
 <th>Transaction Code:</th>
 <td><input type="password" name="transaction_code" class=inpts size=15></td>
</tr>
{/if}
{include file="captcha.tpl" action="withdrawal"}
{if $userinfo.tfa_settings.withdraw}
<tr>
 <th>2FA Code:</th>
 <td><input type="text" name="tfa_code" class=inpts size=15> <input type="hidden" name="tfa_time" id="tfa_time"></td>
</tr>
{literal}
<script language=javascript>
document.getElementById('tfa_time').value = (new Date()).getTime();
</script>
{/literal}
{/if}
<tr>
 <td colspan=2><input type=submit value="Confirm" class="btn btn-primary"></td>
</tr></table></div>
                            </div>
                        </div>
                       
</form>
	</div>
					<!-- End Row-1 -->

				</div>
			</div>
			<!-- End hor-content-->
		</div>

{else}

	<!-- Hor-Content -->
			<div class="hor-content main-content">
				<div class="container">

					<!--Page header-->
					<div class="page-header">

						<div class="page-leftheader">
							<ol class="breadcrumb">
								<li class="breadcrumb-item"><a href="/"><i class="fe fe-home mr-2 fs-14"></i>Home</a>
								</li>
								<li class="breadcrumb-item active" aria-current="page"><a href="#">Withdraw Portal</a>
								</li>
							</ol>
						</div>

						<div class="page-rightheader">
							<div class="btn btn-list">
								<a href="?a=deposit" class="btn btn-info"><i class="fe fe-settings mr-1"></i> Invest</a>
								<a href="?a=withdraw" class="btn btn-danger"><i class="fe fe-printer mr-1"></i> Withdraw </a>
							</div>
						</div>

					</div>
					<!--End Page header-->
{if $have_available}
					<!-- Row-1 -->
					<div class="row">


                        <div class="col-md-6 col-lg-4">
                            <div class="card overflow-hidden">
                                <div class="card-body">
<h5 class="card-title mb-3"><u>Withdrawal Details:</u></h5>
<p class="class-text"><b>Step 1:</b> <br> Enter the withdrawal amount</p>
<p class="class-text"><b>Step 2:</b> <br> Click the confirm withdraw button to proceed</p>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6 col-lg-8">
                            <div class="card overflow-hidden">
<div class="card-body">
<h5 class="card-title mb-3">wallet address</h5>
<form method=post>
<input type=hidden name=a value=withdraw>
<input type=hidden name=action value=preview>
<input type=hidden name=say value="">
<div class="row">
<div class="col-lg">
<input class="form-control" placeholder="Enter amount" type="text" name="amount" value="{$frm.amount|amount_format|default:"10.00"}">
<br>
{foreach from=$ps item=p}
<p>{$p.name|escape:html} - {if $p.account != ''}{$p.account|escape:html}{else}<a href="{"?a=edit_account"|encurl}"><i>not set</i></a>{/if}</p>
{/foreach}
<br>
<select class="form-control" name="ec">
{assign var="wfch" value=1}
{foreach from=$ps item=p}
{if $p.available > 0}<option value="{$p.id}" {if $frm.ec == $p.id || $wfch}{assign var="wfch" value=0}checked{/if}>
{$p.name|escape:html} - {$p.available|fiat:$p.ec} &nbsp; ({if $p.account != ''}{$p.account|escape:html}{else}<a href="{"?a=edit_account"|encurl}"><i>not set</i></a>{/if})
</option>{/if}
{/foreach}
</select>
<br>
<button type="submit" class="btn btn-primary">Confirm Withdraw</button>
</div>
</div>
{else}
<br><br>
You have no funds to withdraw.
{/if}
</form>
 </div>

                            </div>
                        </div>

					</div>
					<!-- End Row-1 -->

				</div>
			</div>
			<!-- End hor-content-->
		</div>
{/if}

{/if}
{include file="footer.tpl"}
