{include file="mheader.tpl"}
     
                <link rel="stylesheet" type="text/css" href="dash/cssjs/spop.min.css">
<script src="dash/cssjs/spop.min.js"></script>
<section class="w3-auto w3-card w3-padding">
    <div class="bolder w3-black" style="">
        <h4 class="w3-large upper bolder w3-text-white " style="padding:16px 5px 16px;"><b>
                Deposit Page</b></h4>
    </div>
{if $fatal}

{if $fatal == 'one_per_month'}
You can deposit once a month only.
{/if}

{else}

{literal}
<script language="javascript"><!--
function openCalculator(id)
{

  w = 225; h = 400;
  t = (screen.height-h-30)/2;
  l = (screen.width-w-30)/2;
  window.open('?a=calendar&type=' + id, 'calculator' + id, "top="+t+",left="+l+",width="+w+",height="+h+",resizable=1,scrollbars=0");

{/literal}
  {if $qplans > 1}
{literal}
  for (i = 0; i < document.spendform.h_id.length; i++)
  {
    if (document.spendform.h_id[i].value == id)
    {
      document.spendform.h_id[i].checked = true;
    }
  }
{/literal}
  {/if}
{literal}

}

function updateCompound() {
  var id = 0;
  var tt = document.spendform.h_id.type;
  if (tt && tt.toLowerCase() == 'hidden') {
    id = document.spendform.h_id.value;
  } else {
    for (i = 0; i < document.spendform.h_id.length; i++) {
      if (document.spendform.h_id[i].checked) {
        id = document.spendform.h_id[i].value;
      }
    }
  }

  var cpObj = document.getElementById('compound_percents');
  if (cpObj) {
    while (cpObj.options.length != 0) {
      cpObj.options[0] = null;
    }
  }

  if (cps[id] && cps[id].length > 0) {
    document.getElementById('coumpond_block').style.display = '';

    for (i in cps[id]) {
      cpObj.options[cpObj.options.length] = new Option(cps[id][i]);
    }
  } else {
    document.getElementById('coumpond_block').style.display = 'none';
  }
}
var cps = {};
--></script>
{/literal}

{if $frm.say eq 'deposit_success'}
<h3>The deposit has been successfully saved.</h3>
<br><br>
{/if}

{if $frm.say eq 'deposit_saved'}
<h3>The deposit has been saved. It will become active when the administrator checks statistics.</h3><br><br>
{/if}

 
{if $errors}
{if $errors.less_min}
Sorry, you can deposit not less than {$currency_sign}{$errors.less_min} with selected processing<br><br>
{/if}
{if $errors.greater_max}
Sorry, you can deposit not greater than {$currency_sign}{$errors.greater_max} with selected processing<br><br>
{/if}
{if $errors.not_enough_funds}
You have no enough funds to complete the operation.<br><br>
{/if}
{if $errors.ec_forbidden}
Sorry, deposit with selected processing is temproary forbidden.<br><br>
{/if}
{if $errors.cannot_invest_this_plan_anymore}
Sorry, you cannot invest this plan anymore<br><br>
{/if}
{if $errors.no_ps}
Please, select funds source.
{/if}
{/if}

<form method=post name="spendform">
<input type=hidden name=a value=deposit>


<div class=" ">
            <div class="w3-small textcolor w3-black fcbold " style="padding:5px;">Select
                investment Plan </div>
            <section class="w3-row">
                
             {foreach from=$plans item=plan name=fplans}   
            <table class="w3-table-all  " id="pl-{$plan.id}" style="margin-top:5px;" onclick="changed('3','0','2')">
                    <tr class=" w3-hover-red w3-round" id="tr-{$plan.id}" style="background-color:black;color:white;">
                        <td>
                            <div class="w3-text-white">
                                <div class="w3-small">
                                    <input type="radio" name=h_id value="{$plan.id}" class="" required>

                                    <div class="w3-padding w3-tiny">
                                        <div class="w3-small"><b>
                                                {$plan.name|escape:html} </b></div>
                                       {foreach from=$plan.plans item=o}         
                                        <b>ROI</b>:
                                       {$o.percent}% <b>Duration</b> :
                                        After                                        1                                        day                                        <div>
                                            <b>Min</b>
                                            {$o.min_deposit} <b>MAx</b>
                                            {if $o.max_deposit == 0}&infin;{else}{$o.max_deposit}{/if}   
                                            
                                            {/foreach}
                                            
                                            </div>

                                    </div>
                                </div>
                            </div>
                            <div>
                            </div>
                        </td>
                    </tr>
                </table>
{/foreach}


 </section>
        </div>
        <br>
        <section class="w3-card-4 bolder    " style="overflow: scroll;padding: 10px;margin-bottom: 50px;">
            <table cellspacing=0 cellpadding=2 border=0>
<tr>
 <td>Account Balance:</td>
 <td>{$currency_sign}<b>{$userinfo.balance_totals.balance|amount_format}</b></td>
</tr>
</table>
            <section class="  ">
                <h4 class="w3-small textcolor fcbold"><b>SELECT PAYMENT MENTHOD</b></h4>
                <label class="w3-tiny w3-margin-top textcolor">Enter amount (amount in usd)</label>
                <input type="number" name=amount value='{$frm.amount|default:$min_deposit|amount_format}' class="w3-input w3-border" id="amount" required>
                <label class="w3-tiny w3-margin-top textcolor">payment method</label>
                <select class="w3-select w3-border w3-padding " name=type  required="">
                    
                    {section name=p loop=$ps}
   {if $ps[p].balance > 0 and $ps[p].status == 1}
   <option value="account_{$ps[p].id}"> Account Balance {$ps[p].name} </option>
     
   {/if}
{/section}
{section name=p loop=$ps}
   {if $ps[p].status}
   <option value="process_{$ps[p].id}">{$ps[p].name} </option>
     
   {/if}
{/section}
                    
                                    
                                    </select>
                <button type="submit" class="w3-btn  w3-border w3-border-yellow  w3-hover-red w3-black w3-padding w3-margin-top w3-tiny">Invest</button>
                
            </section>
        </section>



{*

{foreach from=$plans item=plan name=fplans}
<table cellspacing=1 cellpadding=2 border=0 width=100%>
<tr>
 <td colspan=3>
{if $plans|@count > 1}
	<input type=radio name=h_id value="{$plan.id}" {if (($smarty.foreach.fplans.first == 1) && (!$frm.h_id)) || ($frm.h_id == $plan.id)} checked {/if} onclick="updateCompound()"> 
{else}
	<input type=hidden name=h_id value="{$plan.id}">
{/if}

<b>{$plan.name|escape:html}</b></td>
</tr><tr>
 <td class=inheader>Plan</td>
 <td class=inheader width=200>Spent Amount (<span class="fiat">{fiat}</span>)</td>
 <td class=inheader width=100 nowrap><nobr>{$plan.period} Profit (%)</nobr></td>
</tr>
{foreach from=$plan.plans item=o}
<tr>
 <td class=item>{$o.name|escape:html}</td>
 <td class=item align=right><span class="min_deposit">{$o.min_deposit}</span> - <span class="max_deposit">{if $o.max_deposit == 0}&infin;{else}{$o.max_deposit}{/if}</span></td>
 <td class=item align=right>{$o.percent}%</td>
</tr>
{/foreach}
{if $settings.enable_calculator}
<tr>
 <td colspan=3 align=right><a href="javascript:openCalculator('{$plan.id}')">Calculate your profit &gt;&gt;</a></td>
</tr>
{/if}
</table><br><br>
<script>
cps[{$plan.id}] = {$plan.compound_percents_json};
</script>
{/foreach}


{section name=plans loop=$plans}
<table cellspacing=1 cellpadding=2 border=0 width=100%>
<tr>
 <td colspan=3>
{if $qplans > 1}
	<input type=radio name=h_id value='{$plans[plans].id}' {if (($smarty.section.plans.first == 1) && ($frm.h_id eq '')) || ($frm.h_id == $plans[plans].id)} checked {/if} onclick="updateCompound()"> 
<!--	<input type=radio name=h_id value='{$plans[plans].id}' {if (($smarty.section.plans.first == 1) && ($frm.h_id eq '')) || ($frm.h_id == $plans[plans].id)} checked {/if} {if $compounding_available > 0}onclick="document.spendform.compound.disabled={if $plans[plans].use_compound == 1}false{else}true{/if};"{/if}> -->
{else}
	<input type=hidden name=h_id value='{$plans[plans].id}'>
{/if}

	<b>{$plans[plans].name}</b></td>
</tr><tr>
 <td class=inheader>Plan</td>
 <td class=inheader width=200>Spent Amount ({$currency_sign})</td>
 <td class=inheader width=100 nowrap><nobr>{$plans[plans].period} Profit (%)</nobr></td>
</tr>
{section name=options loop=$plans[plans].plans}
<tr>
 <td class=item>{$plans[plans].plans[options].name|escape:html}</td>
 <td class=item align=right>{$plans[plans].plans[options].deposit}</td>
 <td class=item align=right>{$plans[plans].plans[options].percent}</td>
</tr>
{/section}
{if $settings.enable_calculator}
<tr>
 <td colspan=3 align=right><a href="javascript:openCalculator('{$plans[plans].id}')">Calculate your profit &gt;&gt;</a></td>
</tr>
{/if}
</table><br><br>
<script>
cps[{$plans[plans].id}] = {$plans[plans].compound_percents_json};
</script>
{/section}


<table cellspacing=0 cellpadding=2 border=0>
<tr>
 <td>Account Balance:</td>
 <td>{$currency_sign}<b>{$userinfo.balance_totals.balance|amount_format}</b></td>
</tr>
</table>
<br>
<table cellspacing=0 cellpadding=2 border=0>
<tr>
 <th>Processing</th>
 <th>Topup</th>
 <th>Balance</th>
</tr>
{foreach from=$dps item=p name=p}
<tr>
 <td><img src="images/{$p.id}.gif" width="44" height="17" align="absmiddle"> {$p.name}:</td>
 <td><input type=radio name=type value="process_{$p.id}" data-fiat="{$p.fiat}"></td>
 <td><input type=radio name=type value="account_{$p.id}" data-fiat="{$p.fiat}" {if $p.available <= 0}disabled{/if}> {$p.available|fiat:$p.id}</td>
</tr>
{/foreach}
</table>
<br>
<table cellspacing=0 cellpadding=2 border=0>
<tr>
 <td>Amount to Spend ({$currency_sign}):</td>
 <td align=right><input type=text name=amount value='{$frm.amount|default:$min_deposit|amount_format}' class=inpts size=15 style="text-align:right;"></td>
</tr>
<tr id="coumpond_block" style="display:none">
 <td>Compounding(%):</td>
 <td align=right>
  <select name="compound" class=inpts id="compound_percents"></select>
 </td>
</tr>
<tr>
 <td colspan=2><input type=submit value="Spend" class=sbmt></td>
</tr>
</table>


<table cellspacing=0 cellpadding=2 border=0>
<tr>
 <td>Your account balance ({$currency_sign}):</td>
 <td align=right>{$currency_sign}{$ab_formated.total}</td>
</tr>
<tr><td>&nbsp;</td>
 <td align=right>
  <small>
{section name=p loop=$ps}
   {if $ps[p].balance > 0}{$currency_sign}{$ps[p].balance} of {$ps[p].name}{if $hold[p].amount > 0} / {$currency_sign}{$hold[p].amount} on hold{/if}<br>{/if}
{/section}
  </small>
 </td>
</tr>
<tr>
 <td>Amount to Spend ({$currency_sign}):</td>
 <td align=right><input type=text name=amount value='{$frm.amount|default:$min_deposit|amount_format}' class=inpts size=15 style="text-align:right;"></td>
</tr>
<tr id="coumpond_block" style="display:none">
 <td>Compounding(%):</td>
 <td align=right>
  <select name="compound" class=inpts id="compound_percents"></select>
 </td>
</tr>

<tr>
  <td colspan=2>
   <table cellspacing=0 cellpadding=2 border=0>
{section name=p loop=$ps}
   {if $ps[p].balance > 0 and $ps[p].status == 1}
    <tr>
     <td><input type=radio name=type value="account_{$ps[p].id}" {if $frm.type == "account_`$ps[p].id`"}checked{/if}></td>
     <td>Spend funds from the Account Balance {$ps[p].name}</td>
    </tr>
   {/if}
{/section}
{section name=p loop=$ps}
   {if $ps[p].status}
    <tr>
     <td><input type=radio name=type value="process_{$ps[p].id}" {if $frm.type == "process_`$ps[p].id`"}checked{/if}{if !$frm.type && $smarty.section.p.index == 0}checked{/if}></td>
     <td>Spend funds from {$ps[p].name}</td>
    </tr>
   {/if}
{/section}
   </table>
  </td>
</tr>
<tr>
 <td colspan=2><input type=submit value="Spend" class=sbmt></td>
</tr></table>
*}

</form>

</section>

<section class="w3-modal profitmodal" >
    <div class="w3-modal-content">
        <div class="w3-container w3-padding w3-text-white">
            <h1 class="w3-text-black upper w3-margin-top w3-small"><b>Plan profit Calculator</b></h1>
            <form>
                <input type="number" name="investamount" placeholder="Amount to invest" class="w3-input w3-border">
                <input type="hidden" name="isdaily">
                <input type="hidden" name="perc">

            </form>
            <div class="w3-margin-top">
                <button onclick="calProfit()" class="w3-small w3-btn w3-round w3-green">Calulate</button>
                <button onclick="$('.profitmodal').slideToggle()" class="w3-small w3-btn w3-round w3-margin-left w3-red">Close</button>
                <div class="displayboard w3-padding w3-light-grey w3-margin-top" style="height: 50px;padding-top:20px;">
                    
                </div>
            </div>
        </div>
        
    </div>
</section>


{literal}
<script language=javascript>
/*
for (i = 0; i<document.spendform.type.length; i++) {
  if ((document.spendform.type[i].value.match(/^process_/))) {
    document.spendform.type[i].checked = true;
    break;
  }
}
*/
updateCompound();
</script>
{/literal}

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