{include file="header.tpl"}
<section class="content">
	<div class="container">
		<section class="content">
			<div class="container">
				<style>
				.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
					width: 100%;
				}
				</style>
				<div class="row clearfix">
					<div class="col-lg-12">
						<div class="card" style="margin-top: 30px">
							<div class="body block-header">
								<div class="row">
									<div class="col-lg-6 col-md-8 col-sm-12">
										<h2>Welcome, Kulbov</h2>
										<ul class="breadcrumb p-l-0 p-b-0 ">
											<li class="breadcrumb-item"><a href="/?a=account"><i class="fas fa-home"></i></a></li>
											<li class="breadcrumb-item"><a href="/?a=account">Dashboard</a></li>
											<li class="breadcrumb-item active">Withdraw funds</li>
										</ul>
									</div>
									<div class="col-lg-6 col-md-4 col-sm-12 text-right">
										<a href="/?a=deposit">
											<button class="btn btn-primary btn-round btn-simple float-right hidden-xs m-l-10 btn-warning waves-effect">Make an investment</button>
										</a>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				{if $say eq 'processed'}
<div class="alert alert-success">{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="alert alert-danger">You can withdraw {$settings.limit_withdraw_period_times} per {$settings.limit_withdraw_period_date} only.</div>
  {/if}

{else}

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

                <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}">
            
                <div class="row clearfix">
                    <div class="col-xl-4 col-lg-12 col-md-12">
                        <div class="card" style="background: #1f242a">
                            <div class="header">
                                <h2>Withdraw <strong>Funds</strong></h2>
                            </div>
                            <div class="body">
                                <h2 class="card-inside-title">Payment processor</h2>
                                <select name="ec" class="form-control">
                                    {foreach from=$ps item=p}
                                        <option value="{$p.id}">{$p.name|escape:html}</option>
                                    {/foreach}
                                </select>
                                <h2 class="card-inside-title">Withdrawal amount</h2>
                                <input type="text" name="amount" value="10.00" class="calculate-amount form-control" style="font-size: 14px;padding: 10px 22px; width: 100%">
                                <br>
                                <button class="btn btn-warning btn-round btn-lg">Withdraw funds</button>
                            </div>
                        </div>
                        
                        </form>
            
                        <div class="card">
                            <div class="header">
                                <h2><strong>Quick </strong> Info</h2>
                            </div>
                            <div class="body">
                                <table class="table table-hover m-b-0">
                                    <tbody>
                                        <tr>
                                            <td>Min withdrawal - Crypto</td>
                                            <th>$5</th>
                                        </tr>
                                        <tr>
                                            <td>Min withdrawal - USD</td>
                                            <th>$1</th>
                                        </tr>
                                        <tr class="hide-xs">
                                            <td>Withdrawal time</td>
                                            <th>Within 48 hours</th>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
            
                    <div class="col-xl-8 col-lg-12 col-md-12">
                        <div class="card">
                            <div class="header">
                                <h2><strong>Available</strong> Balance</h2>
                            </div>
                            <div class="body">
                                <div class="row">
                                    <div class="col-md-12">
                                        <h2 class="m-b-0">{$currency_sign}{$ab_formated.total}</h2>
                                        <p>Account balance</p>
                                    </div>
                                </div>
                                <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="table-responsive">
                                    <table class="table table-hover m-b-0">
                                        <thead>
                                            <tr>
                                                <th></th>
                                                <th></th>
                                                <th>Processor</th>
                                                <th>Available</th>
                                                <th>Pending</th>
                                                <th>Wallet</th>
                                                <th></th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            {assign var="wfch" value=1}
                                            {foreach from=$ps item=p}
                                                <tr>
                                                    <td>{if $p.available > 0}<input type="radio" name="ec" value="{$p.id}" {if $frm.ec == $p.id || $wfch}{assign var="wfch" value=0}checked{/if}>{/if}</td>
                                                    <td style="max-width: 30px"><img src="images/{$p.id}.gif" style="width: 20px;min-width: 15px"></td>
                                                    <td>{$p.name|escape:html}</td>
                                                    <td class="text-left"><span>{$p.available|fiat:$p.ec}</span></td>
                                                    <td><span>{$p.pending|fiat:$p.ec}</span></td>
                                                    <td>
                                                        {if $p.account neq ''}
                                                            {$p.account|escape:html}
                                                        {else}
                                                            <a href="{"?a=edit_account"|encurl}"><i>not set</i></a>
                                                        {/if}
                                                    </td>
                                                    <td style="width: 20px"></td>
                                                </tr>
                                            {/foreach}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            {/if}
		<div class="row clearfix"></div>
		<div class="row clearfix">
			<div class="col-md-12 col-lg-12">
				<div class="card active-bg">
					<div class="body">
						<p class="copyright m-b-0 text-dark">Copyright 2024 {$settings.site_name}.</p>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
{include file="footer.tpl"}
