{include file="header.tpl"}
<div id="content-page" class="content-page">
    <div class="container-fluid">
        <div id="perfect_m"></div>
        <div class="row" id="dep_block">
            <div class="col-sm-12">
                <div class="iq-card">
                    <div class="iq-card-header d-flex justify-content-between">
                        <div class="iq-header-title">
                            <h4 class="card-title">Deposit Funds</h4>
                        </div>
                    </div>
                    <div class="iq-card-body">
{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.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}

<form method=post name="spendform">
<input type=hidden name=a value=deposit>
<div class="form-group" style="margin-top: 20px;">
<label><i class="mdi mdi-bank"></i> Investment Plan<span class="text-danger">*</span></label>
<select class="form-control" name="h_id" style="color: #111;" required>
<option value=''>SELECT INVESTMENT PLAN</option>
{section name=plans loop=$plans}
<option value="{$plans[plans].id}">{$plans[plans].name}</option>
{/section}
</select>
</div>

<div class="form-group" style="margin-top: 20px;">
<label><i class="mdi mdi-bank"></i> Preferred Method<span class="text-danger">*</span></label>
<select class="form-control" name="type" style="color: #111;" required>
<option value="">SELECT PREFERRED METHOD</option>
{section name=p loop=$ps}
 {if $ps[p].status}
   <option value="process_{$ps[p].id}">{$ps[p].name}</option>
 {/if}
{/section}
{section name=p loop=$ps}
  {if $ps[p].balance > 0 and $ps[p].status == 1}
   <option value="account_{$ps[p].id}">Balance {$ps[p].name} ({$currency_sign}{$ps[p].balance})</option>
 {/if}
{/section}
</select>
</div>
<div class="form-group">
    <label><i class="mdi mdi-cash-multiple"></i> Amount ({$currency_sign})<span class="text-danger">*</span></label>
    <input type=text name=amount value='{$min_deposit}' required placeholder="Enter Amount" class="form-control">
</div>
<div class="form-group text-right m-b-0">
    <button class="btn btn-primary btn-lg"><i class="fa fa-briefcase"></i> 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}
{include file="footer.tpl"}