<!DOCTYPE html>
<html lang="ru">

{include file="account_header.tpl"}

{assign var='first_element' value=null}
{foreach from=$ps item=p}
{if $first_element eq null}
{assign var='first_element' value=$p}
{/if}
{/foreach}

{if $first_element neq null}
{assign var='p_name_default' value=$first_element.name}
{assign var='p_id_default' value=$first_element.id}
{assign var='p_available_default' value=$first_element.available}
{assign var='p_wallet' value=$first_element.account}
{/if}

<style>
    #confirmButton:disabled {
        -webkit-filter: brightness(0.4);
        filter: brightness(0.4);
    }

</style>



{if $preview}

<body style="position: relative; min-height: 100%; top: 0px; overflow: hidden;">
    {elseif $say eq 'processed'}

    <body style="position: relative; min-height: 100%; top: 0px; overflow: hidden;">
        {else}

        <body>
            {/if}

            <div class="flex page-lk-balance">
                <div class="menu-lk">
                    <div class="lk-burger">
                        <div class="icon--lk-burger"></div>
                    </div>
                    <div class="menu-lk-inner">
                        <a class="btn-link" href="/">
                            <div class="logo">
                                <img src="styles/assets/img/logo.svg">
                            </div>
                        </a>
                        <div class="flex">
                            <a class="btn-link" href="/">
                                <div class="btn-link__icon icon--lk-home"></div>
                                <div class="btn-link__text">Main</div>
                            </a>
                            {include file="multilang.tpl"}
                        </div>
                        {include file="token_price.tpl"}
                        <div class="caption-wrapper">
                            <div class="caption">Menu</div>
                            <div class="caption-decor"></div>
                        </div>
                        {include file="account_menu.tpl"}
                        <div class="caption-wrapper">
                            <div class="caption">Social media</div>
                            <div class="caption-decor"></div>
                        </div>
                        {include file="social_account.tpl"}
                    </div>
                </div>
                <div class="content-lk">
                    <div class="content-lk-inner">
                        <div class="container">
                            <div class="lk-slim-block">
                                <div class="title-icon">
                                    <div class="orange-icon">
                                        <div class="icon--lk-arrows"></div>
                                    </div>
                                    <div class="title-icon__title-wrapper">
                                        <div class="title-icon__title1">Balance</div>
                                        <div class="title-icon__title2">Withdrawal</div>
                                    </div>
                                </div>
                                <div class="lk-stats-block">
                                    <div class="caption-wrapper">
                                        <div class="caption">My statistics</div>
                                        <div class="caption-decor"></div>
                                    </div>
                                    <div class="row-2">
                                        <div class="col">
                                            <div class="stat-item frame">
                                                <div class="frame-line"></div>
                                                <div class="stat-item-inner frame-inner">
                                                    <div class="wrapper">
                                                        <div class="stat-item__text">Invested</div>
                                                        <div class="stat-item__val notranslate" translate="no">
                                                            ${$userinfo.balance_totals.deposit|default:"0.00"|abs|number_format:2:".":""}
                                                        </div>
                                                    </div>
                                                    <div class="stat-item__pic">
                                                        <div class="icon--lk-case-round"></div>
                                                    </div>
                                                </div>
                                                <div class="frame-line"></div>
                                            </div>
                                        </div>
                                        <div class="col">
                                            <div class="stat-item frame">
                                                <div class="frame-line"></div>
                                                <div class="stat-item-inner frame-inner">
                                                    <div class="wrapper">
                                                        <div class="stat-item__text">Withdrawn</div>
                                                        <div class="stat-item__val notranslate" translate="no">
                                                            ${$userinfo.balance_totals.withdrawal|default:"0.00"|abs|number_format:2:".":""}
                                                        </div>
                                                    </div>
                                                    <div class="stat-item__pic">
                                                        <div class="icon--lk-hand"></div>
                                                    </div>
                                                </div>
                                                <div class="frame-line"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>




                                {if $errors && !isset($errors.csrf_check)}
                                <div id="modal_code_error" class="jquery-modal blocker current" style="z-index: 1999;display: block;">

                                    <div class="modal-error modal-info modal" id="modal-error" style="display: inline-block;">
                                        <div class="close modal_error" style="cursor: pointer;">
                                            <div class="icon--close"></div>
                                        </div>
                                        <div class="frame">
                                            <div class="frame-line"></div>
                                            <div class="frame-inner right-el">
                                                <div class="modal-header">
                                                    <div class="modal-header-bg"></div>
                                                    <div class="modal-header-icon-bg"></div>
                                                    <div class="orange-icon red">
                                                        <div class="icon--error"></div>
                                                    </div>
                                                </div>
                                                <div class="modal-title">Error!</div>
                                                {if $errors.ec_forbidden}<div class="modal-text">Sorry, withdraw for this processing is temproary forbidden.</div>{/if}
                                                {if $errors.on_hold}<div class="modal-text">Sorry, this amount on hold now.</div>{/if}
                                                {if $errors.zero}<div class="modal-text">Sorry, you can't request a withdraw smaller than {$currency_sign}0.00 only</div>{/if}
                                                {if $errors.less_min}<div class="modal-text">Sorry, you can request not less than {$fees.amount_min|fiat}</div>{/if}
                                                {if $errors.greater_max}<div class="modal-text">Sorry, you can request not greater than {$fees.amount_max|fiat}</div>{/if}
                                                {if $errors.daily_limit}<div class="modal-text">Sorry, you have exceeded a daily limit</div>{/if}
                                                {if $errors.not_enought}<div class="modal-text">Sorry, you have requested the amount larger than the one on your balance.</div>{/if}
                                                {if $errors.invalid_transaction_code}<div class="modal-text">You have entered the invalid transaction code.</div>{/if}
                                                {if $errors.invalid_tfa_code}<div class="modal-text">You have entered invalid 2FA code.</div>{/if}
                                                {if $errors.no_deposits}<div class="modal-text">You have not done any deposits yet. Withdrawal function will be available after a deposit.</div>{/if}
                                                {if $errors.no_active_deposits}<div class="modal-text">You must have active deposit to withdraw.</div>{/if}
                                                {if $errors.no_account}<div class="modal-text">Please, provide your account to withdraw funds to first <a href='{"?a=edit_account"|encurl}'>here</a>.</div>{/if}
                                                {if $errors.demo}<div class="modal-text">Withdraw is not available for demo account.</div>{/if}
                                                {if $errors.turing_image}<div class="modal-text">Invalid turing image</div>{/if}
                                                {if $errors.account_suspended}<div class="modal-text">Account is suspended</div>{/if}
                                                <div class="flex-center">
                                                    <div class="btn modal_error" rel="modal:close">
                                                        <div class="btn-bg">
                                                            <div class="btn-text">I have read</div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="frame-line"></div>
                                        </div>
                                    </div>

                                </div>
                                {elseif $say eq 'processed'}
                                <div id="modal_code_error" class="jquery-modal blocker current" style="z-index: 1999;display: block;">
                                    <div class="modal-success modal-info modal" id="modal-success" style="display: inline-block;">
                                        <div class="close modal_error" style="cursor: pointer;">
                                            <div class="icon--close"></div>
                                        </div>
                                        <div class="frame">
                                            <div class="frame-line"></div>
                                            <div class="frame-inner right-el">
                                                <div class="modal-header">
                                                    <div class="modal-header-bg"></div>
                                                    <div class="modal-header-icon-bg"></div>
                                                    <div class="orange-icon green">
                                                        <div class="icon--success"></div>
                                                    </div>
                                                </div>
                                                <div class="modal-title">Success!</div>
                                                <div class="modal-text"></div>
                                                <div class="flex-center">
                                                    <div class="btn modal_error" rel="modal:close">
                                                        <div class="btn-bg">
                                                            <div class="btn-text">I have read</div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="frame-line"></div>
                                        </div>
                                    </div>
                                </div>
                                {/if}






                                {if $preview}



                                <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|default:''}">
                                    <div class="form-wrapper" id="balanceApp">

                                        <div class="frame">
                                            <div class="frame-line"></div>
                                            <div class="frame-inner">
                                                <div class="flex bottom">
                                                    <div class="form-item__icon"><svg width="67" height="68" viewBox="0 0 67 68" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                            <path d="M45.216.5a9.5 9.5 0 0 1 7.153 3.249l11.784 13.485a9.5 9.5 0 0 1 2.347 6.251v21.052a9.5 9.5 0 0 1-2.322 6.223L52.506 64.223a9.5 9.5 0 0 1-7.178 3.277H21.672a9.5 9.5 0 0 1-7.178-3.277L2.822 50.76A9.5 9.5 0 0 1 .5 44.537V23.44a9.5 9.5 0 0 1 2.297-6.194l11.56-13.44A9.5 9.5 0 0 1 21.559.5h23.657Z" stroke="#fff" stroke-opacity=".2" />
                                                            <circle cx="1" cy="1" r="1" fill="#fff" />
                                                            <circle cx="66" cy="1" r="1" fill="#fff" />
                                                            <circle cx="1" cy="67" r="1" fill="#fff" />
                                                            <circle cx="66" cy="67" r="1" fill="#fff" />
                                                            <g clip-path="url(#clip0_118_23426)">
                                                                <path d="M42 44.667H26v2.666h-2.667v-2.666H22a1.333 1.333 0 0 1-1.334-1.334v-20A1.334 1.334 0 0 1 22 22h24a1.333 1.333 0 0 1 1.333 1.333v20A1.333 1.333 0 0 1 46 44.667h-1.334v2.666H42v-2.666ZM23.333 42h21.334V24.667H23.332V42Zm12-5.501v4.168h-2.666v-4.168A5.336 5.336 0 0 1 34 26a5.333 5.333 0 0 1 1.333 10.499ZM34 34a2.667 2.667 0 1 0 0-5.334A2.667 2.667 0 0 0 34 34Z" fill="#fff" />
                                                            </g>
                                                            <defs>
                                                                <clipPath id="clip0_118_23426">
                                                                    <path fill="#fff" d="M18 18h32v32H18z" />
                                                                </clipPath>
                                                            </defs>
                                                        </svg></div>
                                                    <div class="v-form-control">
                                                        <div class="label caption-wrapper">
                                                            <div class="caption"><span>0.1</span> Choose balance</div>
                                                            <div class="caption-decor"></div>
                                                        </div>

                                                        <div class="input-wrapper">
                                                            <div class="select-control select-balance">
                                                                <input type="hidden" name="balance" v-model="selectedPsId">
                                                                <div class="select-wrapper">
                                                                    <div class="select-control__selected">
                                                                        <div class="item notranslate" translate="no" data-item="{$p_id_default|default:'0'}">
                                                                            <div class="flex middle">
                                                                                <div class="item-icon {if $p_id_default == "48" || $p_id_default=="1109" }icon--btc{elseif $p_id_default=="69" || $p_id_default=="1110" }icon--eth{elseif $p_id_default=="82" || $p_id_default=="1131" }icon--usdt{elseif $p_id_default=="92" || $p_id_default=="1130" }icon--usdt{elseif $p_id_default=="85" || $p_id_default=="1116" }icon--trx{elseif $p_id_default=="68" || $p_id_default=="1111" }icon--ltc{elseif $p_id_default=="94" || $p_id_default=="1127" }icon--bnb{elseif $p_id_default=="79" || $p_id_default=="1120" }icon--doge{elseif $p_id_default=="72" || $p_id_default=="1121" }icon--xrp{else}icon--usd{/if}"></div>
                                                                                <div class="item-name">
                                                                                    {$p_name_default|default:'None'}</div>
                                                                            </div>
                                                                            <div class="item-balance">
                                                                                {$p_available_default|default:'0'}
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="select-control__list">
                                                                        {foreach from=$ps item=p}
                                                                        <div class="item notranslate selected" data-item="{$p.id}" data-id="{$p.id}" data-name="{$p.name|escape:html}" data-wallet="{if $p.account != ''}{$p.account}{else}Not Set Wallet{/if}" @mousedown="selectedPsId = 1" translate="no">
                                                                            <div class="flex middle">
                                                                                <div class="item-icon {if $p.id == "48" || $p.id=="1109" }icon--btc{elseif $p.id=="69" || $p.id=="1110" }icon--eth{elseif $p.id=="82" || $p.id=="1131" }icon--usdt{elseif $p.id=="92" || $p.id=="1130" }icon--usdt{elseif $p.id=="85" || $p.id=="1116" }icon--trx{elseif $p.id=="68" || $p.id=="1111" }icon--ltc{elseif $p.id=="94" || $p.id=="1127" }icon--bnb{elseif $p.id=="79" || $p.id=="1120" }icon--doge{elseif $p.id=="72" || $p.id=="1121" }icon--xrp{else}icon--usd{/if}"></div>
                                                                                <div class="item-name">{$p.name|escape:html}
                                                                                </div>
                                                                            </div>
                                                                            <div class="item-balance">
                                                                                {$p.available|fiat:$p.ec}
                                                                            </div>
                                                                        </div>
                                                                        {/foreach}
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="dot-line" v-show=""></div>
                                                <div class="flex bottom">
                                                    <div class="form-item__icon"><svg width="67" height="68" viewBox="0 0 67 68" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                            <path d="M45.216.5a9.5 9.5 0 0 1 7.153 3.249l11.784 13.485a9.5 9.5 0 0 1 2.347 6.251v21.052a9.5 9.5 0 0 1-2.322 6.223L52.506 64.223a9.5 9.5 0 0 1-7.178 3.277H21.672a9.5 9.5 0 0 1-7.178-3.277L2.822 50.76A9.5 9.5 0 0 1 .5 44.537V23.44a9.5 9.5 0 0 1 2.297-6.194l11.56-13.44A9.5 9.5 0 0 1 21.559.5h23.657Z" stroke="#fff" stroke-opacity=".2" />
                                                            <circle cx="1" cy="1" r="1" fill="#fff" />
                                                            <circle cx="66" cy="1" r="1" fill="#fff" />
                                                            <circle cx="1" cy="67" r="1" fill="#fff" />
                                                            <circle cx="66" cy="67" r="1" fill="#fff" />
                                                            <g clip-path="url(#clip0_118_23462)">
                                                                <path d="M44.666 27.333v-2.666H23.334v18.666h21.334v-2.666H34a1.333 1.333 0 0 1-1.334-1.334V28.667A1.333 1.333 0 0 1 34 27.333h10.666ZM22 22h24a1.333 1.333 0 0 1 1.333 1.333v21.334A1.333 1.333 0 0 1 46 46H22a1.334 1.334 0 0 1-1.334-1.333V23.333A1.334 1.334 0 0 1 22 22Zm13.333 8v8h9.334v-8h-9.334ZM38 32.667h4v2.666h-4v-2.666Z" fill="#fff" />
                                                            </g>
                                                            <defs>
                                                                <clipPath id="clip0_118_23462">
                                                                    <path fill="#fff" d="M18 18h32v32H18z" />
                                                                </clipPath>
                                                            </defs>
                                                        </svg></div>
                                                    <div class="v-form-control">
                                                        <div class="label caption-wrapper">
                                                            <div class="caption"><span>0.2</span> Wallet address</div>
                                                            <div class="caption-decor"></div>
                                                        </div>
                                                        <div class="input-wrapper">
                                                            <input id="withdraw_wallet" type="text" value="{if $p_wallet != ''}{$p_wallet}{else}Not Set Wallet{/if}">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="dot-line" v-show=""></div>
                                                <div class="flex bottom">
                                                    <div class="form-item__icon">
                                                        <svg width="67" height="68" viewBox="0 0 67 68" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                            <path d="M45.216.5a9.5 9.5 0 0 1 7.153 3.249l11.784 13.485a9.5 9.5 0 0 1 2.347 6.251v21.052a9.5 9.5 0 0 1-2.322 6.223L52.506 64.223a9.5 9.5 0 0 1-7.178 3.277H21.672a9.5 9.5 0 0 1-7.178-3.277L2.822 50.76A9.5 9.5 0 0 1 .5 44.537V23.44a9.5 9.5 0 0 1 2.297-6.194l11.56-13.44A9.5 9.5 0 0 1 21.559.5h23.657Z" stroke="#fff" stroke-opacity=".2" />
                                                            <circle cx="1" cy="1" r="1" fill="#fff" />
                                                            <circle cx="66" cy="1" r="1" fill="#fff" />
                                                            <circle cx="1" cy="67" r="1" fill="#fff" />
                                                            <circle cx="66" cy="67" r="1" fill="#fff" />
                                                            <g clip-path="url(#clip0_118_23499)">
                                                                <path d="m39.563 32.667-7.152-7.152 1.885-1.886L44.666 34l-10.37 10.37-1.885-1.885 7.152-7.152h-16.23v-2.666h16.23Z" fill="#fff" />
                                                            </g>
                                                            <defs>
                                                                <clipPath id="clip0_118_23499">
                                                                    <path fill="#fff" d="M18 18h32v32H18z" />
                                                                </clipPath>
                                                            </defs>
                                                        </svg>
                                                    </div>
                                                    <div class="v-form-control">
                                                        <div class="label caption-wrapper">
                                                            <div class="caption"><span>0.3</span> Withdrawal amount</div>
                                                            <div class="caption-decor"></div>
                                                        </div>
                                                        <div class="input-wrapper">
                                                            <input id="withdraw_amount" type="text" name=amount value="{$frm.amount|amount_format|default:" 10.00"}">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="frame-line"></div>
                                        </div>
                                        <div class="info-item">
                                            <div class="info-item__decor"></div>
                                            <div class="info-item__content">Withdrawals are processed instantly. <br>The receipt
                                                of funds depends on the selected network. </div>
                                            <div class="info-item__decor right"></div>
                                        </div>
                                        <button id="withdraw_process" class="line-bg-btn" class="line-bg-btn">
                                            <div class="btn" @click="withdraw">
                                                <div class="btn-bg">
                                                    <div class="btn-text">Request</div>
                                                </div>
                                            </div>
                                        </button>
                                    </div>


                                    <div id="modal_code" class="jquery-modal blocker current" style="display: block;">

                                        <div class="modal-withdraw modal-info modal" id="confirmWithdrawApp" {if $errors}style="display: none;" {else}style="display: inline-block;" {/if}>
                                            <a class="close modal_close_rex" href="?a=withdraw">
                                                <div class="icon--close"></div>
                                            </a>
                                            <div class="frame">
                                                <div class="frame-line"></div>
                                                <div class="frame-inner right-el">
                                                    <div class="modal-header">
                                                        <div class="modal-header-bg"></div>
                                                        <div class="modal-header-icon-bg"></div>
                                                        <div class="orange-icon red">
                                                            <div class="icon--lk-upload"></div>
                                                        </div>
                                                    </div>
                                                    <div class="modal-title">Check the withdrawal details</div>
                                                    <div class="modal-content">
                                                        <div class="transact-item__header">
                                                            <div class="transact-item__row">
                                                                <div class="transact-item__amount-wrapper">
                                                                    <div class="transact-item__icon icon--lk-withdraw"></div>
                                                                    <div id="amount_confirm" class="transact-item__amount">
                                                                        {$amount|fiat:$ec}
                                                                    </div>
                                                                </div>
                                                                <div class="lk-label label-red">Withdrawal</div>
                                                            </div>
                                                        </div>
                                                        <div class="transact-item__content">
                                                            <div class="transact-item__row">
                                                                <div class="transact-item__name">Currency</div>
                                                                <div class="flex middle">
                                                                    <div class="transact-item__icon icon--"></div>
                                                                    <div id="name_confirm" class="transact-item__text notranslate" translate="no">
                                                                        {$currency}
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="transact-item__row">
                                                                <div class="transact-item__name">Address</div>
                                                                <div id="address_confirm" class="transact-item__text notranslate" translate="no">
                                                                    {if $account != ''}{$account}{else}Not Set Wallet{/if}
                                                                </div>
                                                            </div>
                                                            {if $frm.ec=="69" || $frm.ec=="1110" || $frm.ec=="82" || $frm.ec=="1131" || $frm.ec=="92" || $frm.ec=="1130"}
                                                            <div class="transact-item__row">
                                                                <div class="transact-item__name">Network</div>
                                                                <div class="transact-item__text notranslate" translate="no">
                                                                    {if $frm.ec=="69" || $frm.ec=="1110" }ERC20{elseif $frm.ec=="82" || $frm.ec=="1131" }ERC20{elseif $frm.ec=="92" || $frm.ec=="1130" }TRC20{/if}
                                                                </div>
                                                            </div>
                                                            {/if}
                                                        </div>
                                                        {if $ti.check.withdrawal}
                                                        {else}
                                                        {if $account != ''}
                                                        <label class="checkbox-wrapper" class="shake">
                                                            <input class="checkbox-inp" type="checkbox" v-model="accepted">
                                                            <div class="checkbox"></div>
                                                            <div class="checkbox-text">I confirm that the details are correct
                                                            </div>
                                                        </label>
                                                        {/if}
                                                        {/if}
                                                    </div>
                                                    {if $ti.check.withdrawal}
                                                    <div class="flex-center">
                                                        <div class="btn" id="modal_continue">
                                                            <div class="btn-bg">
                                                                <div class="btn-text">Continue</div>
                                                            </div>
                                                        </div>
                                                    </div>

                                                    {else}

                                                    {if $account != ''}
                                                    <div class="flex-center">
                                                        <button class="btn" @click="confirm" id="confirmButton" disabled>
                                                            <div class="btn-bg">
                                                                <div class="btn-text">Confirm withdrawal</div>
                                                            </div>
                                                        </button>
                                                    </div>
                                                    {else}
                                                    <div class="flex-center">
                                                        <a class="btn" href="?a=edit_account">
                                                            <div class="btn-bg">
                                                                <div class="btn-text">Set Up Wallet</div>
                                                            </div>
                                                        </a>
                                                    </div>
                                                    {/if}

                                                    {/if}
                                                </div>
                                                <div class="frame-line"></div>
                                            </div>
                                        </div>


                                        {if $ti.check.withdrawal}
                                        <div class="modal-error modal-info modal" id="modal_check_code" style="display: none;">
                                            <a class="close modal_close_rex" href="#close-modal">
                                                <div class="icon--close"></div>
                                            </a>
                                            <div class="frame">
                                                <div class="frame-line"></div>
                                                <div class="frame-inner right-el">
                                                    <div class="modal-header">
                                                        <div class="modal-header-bg"></div>
                                                        <div class="modal-header-icon-bg"></div>
                                                        <div class="orange-icon">
                                                            <div class="icon--lk-shield-round"></div>
                                                        </div>
                                                    </div>
                                                    <div class="modal-content">
                                                        <div class="caption-wrapper">
                                                            <div class="caption">Code confirmation</div>
                                                            <div class="caption-decor"></div>
                                                        </div>
                                                        <div class="info-item no-bg">
                                                            <div class="info-item__decor"></div>
                                                            <img id="coderex" src="{" ?a=show_validation_image&`$ti.session.name`=`$ti.session.id`&rand=`$ti.session.rand`"|encurl}">
                                                            <div class="info-item__decor right"></div>
                                                        </div>
                                                        <br>
                                                        <div class="caption-wrapper">
                                                            <div class="caption">Enter code confirmation</div>
                                                            <div class="caption-decor"></div>
                                                        </div>
                                                        <div class="info-item no-bg">
                                                            <div class="info-item__decor"></div>
                                                            <input name=validation_number type="text">
                                                            <div class="info-item__decor right"></div>
                                                        </div>
                                                    </div>
                                                    <div class="flex-center">
                                                        <button class="btn" type=submit>
                                                            <div class="btn-bg">
                                                                <div class="btn-text">Confirm withdrawal</div>
                                                            </div>
                                                        </button>
                                                    </div>
                                                </div>
                                                <div class="frame-line"></div>
                                            </div>
                                            <a href="#close-modal" class="close-modal modal_close_rex">Close</a>
                                        </div>
                                        {/if}

                                    </div>



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

                    {else}


                    {if $have_available}
                    <form method=post>
                        <input type=hidden name=a value=withdraw>
                        <input type=hidden name=action value=preview>
                        <input type=hidden name=say value="">
                        <input id="type_ec" type=hidden name=ec value="{$p_id_default|default:'0'}">
                        <div class="form-wrapper" id="balanceApp">

                            <div class="frame">
                                <div class="frame-line"></div>
                                <div class="frame-inner">
                                    <div class="flex bottom">
                                        <div class="form-item__icon"><svg width="67" height="68" viewBox="0 0 67 68" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                <path d="M45.216.5a9.5 9.5 0 0 1 7.153 3.249l11.784 13.485a9.5 9.5 0 0 1 2.347 6.251v21.052a9.5 9.5 0 0 1-2.322 6.223L52.506 64.223a9.5 9.5 0 0 1-7.178 3.277H21.672a9.5 9.5 0 0 1-7.178-3.277L2.822 50.76A9.5 9.5 0 0 1 .5 44.537V23.44a9.5 9.5 0 0 1 2.297-6.194l11.56-13.44A9.5 9.5 0 0 1 21.559.5h23.657Z" stroke="#fff" stroke-opacity=".2" />
                                                <circle cx="1" cy="1" r="1" fill="#fff" />
                                                <circle cx="66" cy="1" r="1" fill="#fff" />
                                                <circle cx="1" cy="67" r="1" fill="#fff" />
                                                <circle cx="66" cy="67" r="1" fill="#fff" />
                                                <g clip-path="url(#clip0_118_23426)">
                                                    <path d="M42 44.667H26v2.666h-2.667v-2.666H22a1.333 1.333 0 0 1-1.334-1.334v-20A1.334 1.334 0 0 1 22 22h24a1.333 1.333 0 0 1 1.333 1.333v20A1.333 1.333 0 0 1 46 44.667h-1.334v2.666H42v-2.666ZM23.333 42h21.334V24.667H23.332V42Zm12-5.501v4.168h-2.666v-4.168A5.336 5.336 0 0 1 34 26a5.333 5.333 0 0 1 1.333 10.499ZM34 34a2.667 2.667 0 1 0 0-5.334A2.667 2.667 0 0 0 34 34Z" fill="#fff" />
                                                </g>
                                                <defs>
                                                    <clipPath id="clip0_118_23426">
                                                        <path fill="#fff" d="M18 18h32v32H18z" />
                                                    </clipPath>
                                                </defs>
                                            </svg></div>
                                        <div class="v-form-control">
                                            <div class="label caption-wrapper">
                                                <div class="caption"><span>0.1</span> Choose balance</div>
                                                <div class="caption-decor"></div>
                                            </div>

                                            <div class="input-wrapper">
                                                <div class="select-control select-balance">
                                                    <input type="hidden" name="balance" v-model="selectedPsId">
                                                    <div class="select-wrapper">
                                                        <div class="select-control__selected">
                                                            <div class="item notranslate" translate="no" data-item="{$p_id_default|default:'0'}">
                                                                <div class="flex middle">
                                                                    <div class="item-icon {if $p_id_default == "48" || $p_id_default=="1109" }icon--btc{elseif $p_id_default=="69" || $p_id_default=="1110" }icon--eth{elseif $p_id_default=="82" || $p_id_default=="1131" }icon--usdt{elseif $p_id_default=="92" || $p_id_default=="1130" }icon--usdt{elseif $p_id_default=="85" || $p_id_default=="1116" }icon--trx{elseif $p_id_default=="68" || $p_id_default=="1111" }icon--ltc{elseif $p_id_default=="94" || $p_id_default=="1127" }icon--bnb{elseif $p_id_default=="79" || $p_id_default=="1120" }icon--doge{elseif $p_id_default=="72" || $p_id_default=="1121" }icon--xrp{else}icon--usd{/if}"></div>
                                                                    <div class="item-name">
                                                                        {$p_name_default|default:'None'}</div>
                                                                </div>
                                                                <div class="item-balance">
                                                                    {$p_available_default|default:'0'}
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="select-control__list">
                                                            {foreach from=$ps item=p}
                                                            <div class="item notranslate selected" data-item="{$p.id}" data-id="{$p.id}" data-name="{$p.name|escape:html}" data-wallet="{if $p.account != ''}{$p.account}{else}Not Set Wallet{/if}" @mousedown="selectedPsId = 1" translate="no">
                                                                <div class="flex middle">
                                                                    <div class="item-icon {if $p.id == "48" || $p.id=="1109" }icon--btc{elseif $p.id=="69" || $p.id=="1110" }icon--eth{elseif $p.id=="82" || $p.id=="1131" }icon--usdt{elseif $p.id=="92" || $p.id=="1130" }icon--usdt{elseif $p.id=="85" || $p.id=="1116" }icon--trx{elseif $p.id=="68" || $p.id=="1111" }icon--ltc{elseif $p.id=="94" || $p.id=="1127" }icon--bnb{elseif $p.id=="79" || $p.id=="1120" }icon--doge{elseif $p.id=="72" || $p.id=="1121" }icon--xrp{else}icon--usd{/if}"></div>
                                                                    <div class="item-name">{$p.name|escape:html}
                                                                    </div>
                                                                </div>
                                                                <div class="item-balance">
                                                                    {$p.available|fiat:$p.ec}
                                                                </div>
                                                            </div>
                                                            {/foreach}
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="dot-line" v-show=""></div>
                                    <div class="flex bottom">
                                        <div class="form-item__icon"><svg width="67" height="68" viewBox="0 0 67 68" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                <path d="M45.216.5a9.5 9.5 0 0 1 7.153 3.249l11.784 13.485a9.5 9.5 0 0 1 2.347 6.251v21.052a9.5 9.5 0 0 1-2.322 6.223L52.506 64.223a9.5 9.5 0 0 1-7.178 3.277H21.672a9.5 9.5 0 0 1-7.178-3.277L2.822 50.76A9.5 9.5 0 0 1 .5 44.537V23.44a9.5 9.5 0 0 1 2.297-6.194l11.56-13.44A9.5 9.5 0 0 1 21.559.5h23.657Z" stroke="#fff" stroke-opacity=".2" />
                                                <circle cx="1" cy="1" r="1" fill="#fff" />
                                                <circle cx="66" cy="1" r="1" fill="#fff" />
                                                <circle cx="1" cy="67" r="1" fill="#fff" />
                                                <circle cx="66" cy="67" r="1" fill="#fff" />
                                                <g clip-path="url(#clip0_118_23462)">
                                                    <path d="M44.666 27.333v-2.666H23.334v18.666h21.334v-2.666H34a1.333 1.333 0 0 1-1.334-1.334V28.667A1.333 1.333 0 0 1 34 27.333h10.666ZM22 22h24a1.333 1.333 0 0 1 1.333 1.333v21.334A1.333 1.333 0 0 1 46 46H22a1.334 1.334 0 0 1-1.334-1.333V23.333A1.334 1.334 0 0 1 22 22Zm13.333 8v8h9.334v-8h-9.334ZM38 32.667h4v2.666h-4v-2.666Z" fill="#fff" />
                                                </g>
                                                <defs>
                                                    <clipPath id="clip0_118_23462">
                                                        <path fill="#fff" d="M18 18h32v32H18z" />
                                                    </clipPath>
                                                </defs>
                                            </svg></div>
                                        <div class="v-form-control">
                                            <div class="label caption-wrapper">
                                                <div class="caption"><span>0.2</span> Wallet address</div>
                                                <div class="caption-decor"></div>
                                            </div>
                                            <div class="input-wrapper">
                                                <input id="withdraw_wallet" type="text" value="{if $p_wallet != ''}{$p_wallet}{else}Not Set Wallet{/if}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="dot-line" v-show=""></div>
                                    <div class="flex bottom">
                                        <div class="form-item__icon">
                                            <svg width="67" height="68" viewBox="0 0 67 68" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                <path d="M45.216.5a9.5 9.5 0 0 1 7.153 3.249l11.784 13.485a9.5 9.5 0 0 1 2.347 6.251v21.052a9.5 9.5 0 0 1-2.322 6.223L52.506 64.223a9.5 9.5 0 0 1-7.178 3.277H21.672a9.5 9.5 0 0 1-7.178-3.277L2.822 50.76A9.5 9.5 0 0 1 .5 44.537V23.44a9.5 9.5 0 0 1 2.297-6.194l11.56-13.44A9.5 9.5 0 0 1 21.559.5h23.657Z" stroke="#fff" stroke-opacity=".2" />
                                                <circle cx="1" cy="1" r="1" fill="#fff" />
                                                <circle cx="66" cy="1" r="1" fill="#fff" />
                                                <circle cx="1" cy="67" r="1" fill="#fff" />
                                                <circle cx="66" cy="67" r="1" fill="#fff" />
                                                <g clip-path="url(#clip0_118_23499)">
                                                    <path d="m39.563 32.667-7.152-7.152 1.885-1.886L44.666 34l-10.37 10.37-1.885-1.885 7.152-7.152h-16.23v-2.666h16.23Z" fill="#fff" />
                                                </g>
                                                <defs>
                                                    <clipPath id="clip0_118_23499">
                                                        <path fill="#fff" d="M18 18h32v32H18z" />
                                                    </clipPath>
                                                </defs>
                                            </svg>
                                        </div>
                                        <div class="v-form-control">
                                            <div class="label caption-wrapper">
                                                <div class="caption"><span>0.3</span> Withdrawal amount</div>
                                                <div class="caption-decor"></div>
                                            </div>
                                            <div class="input-wrapper">
                                                <input id="withdraw_amount" type="text" name=amount value="{$frm.amount|amount_format|default:" 10.00"}">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="frame-line"></div>
                            </div>
                            <div class="info-item">
                                <div class="info-item__decor"></div>
                                <div class="info-item__content">Withdrawals are processed instantly. <br>The receipt
                                    of funds depends on the selected network. </div>
                                <div class="info-item__decor right"></div>
                            </div>
                            <div id="withdraw_process" class="line-bg-btn" class="line-bg-btn">
                                <button class="btn" @click="withdraw">
                                    <div class="btn-bg">
                                        <div class="btn-text">Request</div>
                                    </div>
                                </button>
                            </div>
                        </div>


                        <div id="modal_code" class="jquery-modal blocker current" style="display: none;">

                            <div class="modal-withdraw modal-info modal" id="confirmWithdrawApp" style="display: inline-block;">
                                <a class="close modal_close_rex" href="#close-modal">
                                    <div class="icon--close"></div>
                                </a>
                                <div class="frame">
                                    <div class="frame-line"></div>
                                    <div class="frame-inner right-el">
                                        <div class="modal-header">
                                            <div class="modal-header-bg"></div>
                                            <div class="modal-header-icon-bg"></div>
                                            <div class="orange-icon red">
                                                <div class="icon--lk-upload"></div>
                                            </div>
                                        </div>
                                        <div class="modal-title">Check the withdrawal details</div>
                                        <div class="modal-content">
                                            <div class="transact-item__header">
                                                <div class="transact-item__row">
                                                    <div class="transact-item__amount-wrapper">
                                                        <div class="transact-item__icon icon--lk-withdraw"></div>
                                                        <div id="amount_confirm" class="transact-item__amount">$0
                                                        </div>
                                                    </div>
                                                    <div class="lk-label label-red">Withdrawal</div>
                                                </div>
                                            </div>
                                            <div class="transact-item__content">
                                                <div class="transact-item__row">
                                                    <div class="transact-item__name">Currency</div>
                                                    <div class="flex middle">
                                                        <div class="transact-item__icon icon--"></div>
                                                        <div id="name_confirm" class="transact-item__text notranslate" translate="no">
                                                            {$p_name_default|default:'None'}</div>
                                                    </div>
                                                </div>
                                                <div class="transact-item__row">
                                                    <div class="transact-item__name">Address</div>
                                                    <div id="address_confirm" class="transact-item__text notranslate" translate="no">{if
                                                        $p_wallet != ''}{$p_wallet}{else}Not Set Wallet{/if}</div>
                                                </div>
                                                <div class="transact-item__row">
                                                    <div class="transact-item__name">Network</div>
                                                    <div class="transact-item__text notranslate" translate="no">
                                                        BEP20</div>
                                                </div>
                                            </div>
                                            <label class="checkbox-wrapper" class="shake">
                                                <input class="checkbox-inp" type="checkbox" v-model="accepted">
                                                <div class="checkbox"></div>
                                                <div class="checkbox-text">I confirm that the details are correct
                                                </div>
                                            </label>
                                        </div>
                                        <div class="flex-center">
                                            <a class="btn" @click="confirm">
                                                <div class="btn-bg">
                                                    <div class="btn-text">Confirm withdrawal</div>
                                                </div>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="frame-line"></div>
                                </div>
                            </div>
                        </div>



                </div>
            </div>
            </div>
            </form>
            {else}

            <div class="form-wrapper" id="balanceApp">
                <div class="info-item">
                    <div class="info-item__decor"></div>
                    <div class="info-item__content">Unfortunately, there are no funds available to withdraw at this time.<br>
                        We recommend that you explore our investment plans to grow your account.
                    </div>
                    <div class="info-item__decor right"></div>
                </div>
            </div>
			
			<!-- Close Section -->
            </div>
            </div>
            </div>
			<!-- Close Section -->
            {/if}



            {/if}

            {include file="account_footer.tpl"}

            </div>
            </div>

            {include file="account_footer_scripts.tpl"}

            <script>
                
                const selectItems = document.querySelectorAll('.select-control__list .item');

                
                selectItems.forEach(item => {
                    item.addEventListener('click', function() {
                        
                        const dataId = this.getAttribute('data-id');
                        const dataWallet = this.getAttribute('data-wallet');
                        const dataName = this.getAttribute('data-name');

                        
                        document.getElementById('type_ec').value = dataId;
                        document.getElementById('withdraw_wallet').value = dataWallet;
                        document.getElementById('name_confirm').textContent = dataName;
                        document.getElementById('address_confirm').textContent = dataWallet;

                    });
                });

            </script>


            <script>
                try {
                    const checkbox = document.querySelector('.checkbox-inp');
                    const confirmButton = document.getElementById('confirmButton');
                    checkbox.addEventListener('change', function() {
                        if (this.checked) {
                            confirmButton.disabled = false; 
                        } else {
                            confirmButton.disabled = true; 
                        }
                    });
                } catch (error) {
                    
                }

            </script>


            <script>
             
                var modalCodeError = document.getElementById("modal_code_error");
                var confirmWithdrawApp = document.getElementById("confirmWithdrawApp");

               
                var closeElements = document.querySelectorAll(".modal_error");

               
                closeElements.forEach(function(element) {
                    element.addEventListener("click", function() {
                       
                        modalCodeError.style.display = "none";

                       
                        confirmWithdrawApp.style.display = "inline-block";
                    });
                });

            </script>

            <script>
                try {
                   
                    var modalContinueButton = document.getElementById("modal_continue");

                    var modalCode = document.getElementById("modal_check_code");

                   
                    var confirmWithdrawApp = document.getElementById("confirmWithdrawApp");

                   
                    modalContinueButton.addEventListener("click", function() {
                        
                        confirmWithdrawApp.style.display = "none";
                        modalCode.style.display = "inline-block";


                    });

                } catch (error) {
                    
                }

            </script>

        </body>

</html>
