{include file="mheader.tpl" meta_title="Deposit"}
<!-- Page wrapper  -->
<div class="page-wrapper">
    <!-- Bread crumb -->
    <div class="row page-titles">
        <div class="col-md-5 align-self-center">
            <h3 class="text-primary">Deposit</h3>
        </div>
        <div class="col-md-7 align-self-center">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
                <li class="breadcrumb-item active">Deposit</li>
            </ol>
        </div>
    </div>
    <!-- End Bread crumb -->
    <!-- Container fluid  -->
    <div class="container-fluid">
        <!-- Start Page Content -->
        <div class="row">
            <br>
<div class="col-sm-12 text-left">
    <div class="card p-30 bg-info">
        <h3 class=" text-white">Make a deposit</h3>
        <div class="card-body">
            <div class="row my-3">
                

                
                
                
            </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>
<label class="form-label">Your Account Balance</label>
<input  class="form-control"  value='${$userinfo.balance_totals.balance|amount_format}' disabled>
      <br>
<br>
<label class="form-label">Select Package</label>
<select name=h_id class="form-control">
{foreach from=$plans item=plan name=fplans}
<option value="{$plan.id}">{$plan.name|escape:html}</option>
{/foreach}
 </select>
<br>
<br>




<label class="form-label">Select Payment Method</label>
<select name=type class="form-control">
{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}">Spend funds from {$ps[p].name}</option>
    
   {/if}
{/section}                                                                 
    </select>
<br>
<br>
<br>
<label class="form-label">Enter Amount</label>
<br>
<input class="form-control" name=amount value='{$min_deposit}' placeholder="Deposit Amount">
<br>
</div>
<div class="card-footer text-muted">
    <button type=submit value="Spend" class="btn btn-primary ml-auto">Deposit</button>

</div>

</form>
{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}

</div>
</div>
</div>
</div>
{include file="mfooter.tpl"}