{include file="header.tpl"}

<div class="main-content">
  <div class="page-content">
    <div class="row">
      <div class="col-xl-12">
        <div class="card">
          <div class="card-body">

            {if $ok == 1}

              <h4 class="card-title">Please confirm your deposit</h4>
              <br><br>

              {$description}<br>
<style>
    button {
      color: black;
    }
  </style>

 
  <button onclick="copyContent()">Copy wallet id</button>

  <script>
    function copyContent() {
      // Get the element with the ID
      var element = document.getElementById("myId");

      // Create a textarea element
      var textarea = document.createElement("textarea");

      // Set the textarea's value to the text content of the element
      textarea.value = element.textContent;

      // Append the textarea to the body
      document.body.appendChild(textarea);

      // Select the text inside the textarea
      textarea.select();

      // Copy the selected text to the clipboard
      document.execCommand("copy");

      // Remove the textarea from the body
      document.body.removeChild(textarea);

      // Alert the user that the content has been copied
      alert("Content has been copied to the clipboard: " + element.textContent);
    }
  </script>


              <table class="table table-sm">
                {if $deposit.id > 0}
                <tr>
                  <th>Plan:</th>
                  <td>{$deposit.name|escape:html}</td>
                </tr>
                <tr>
                  <th>Profit:</th>
                  <td>
                    {$deposit.percent}% 
                    {if $deposit.period == 'end'}
                      after {$deposit.periods} days
                    {else}
                      {$deposit.period_name} for {$deposit.periods} {$deposit.time_units}{if $deposit.time_units != 1}s{/if}
                      {if $deposit.work_week}(mon-fri){/if}
                    {/if}
                  </td>
                </tr>
                <tr>
                  <th>Principal Return:</th>
                  <td>
                    {if $deposit.principal_return}
                      Yes{if $deposit.principal_return_hold_percent > 0}, with {$deposit.principal_return_hold_percent|number_format:2}% fee{/if}
                    {else}
                      No (included in profit)
                    {/if}
                  </td>
                </tr>
                <tr>
                  <th>Principal Withdraw:</th>
                  <td>
                    {if $deposit.principal_withdraw}
                      Available with 
                      {foreach from=$deposit.principal_withdraw_terms item=t name=wpt}
                        {$t.percent}% fee 
                        {if $t.duration > 0}after {$t.duration} days{/if}
                        {if !$smarty.foreach.wpt.last} or {/if}
                      {/foreach}
                      {if $deposit.principal_withdraw_duration_max}
                        but before {$deposit.principal_withdraw_duration_max|number_format} days
                      {/if}
                    {else}
                      Not available
                    {/if}
                  </td>
                </tr>
                {if $deposit.use_compound == 1}
                <tr>
                  <th>Compound:</th>
                  <td>{$deposit.compound|number_format}%</td>
                </tr>
                {/if}
                {/if}

                {if $deposit.converted_amount}
                <tr>
                  <th>Amount:</th>
                  <td>{$currency_sign}{$deposit.converted_amount}</td>
                </tr>
                <tr>
                  <th>{$deposit.converted_fiat} Amount:</th>
                  <td>{$deposit.amount|number_format:2}</td>
                </tr>
                {else}
                <tr>
                  <th>Amount:</th>
                  <td>{$currency_sign}{$deposit.amount}</td>
                </tr>
                {/if}
              </table>

              <br><br>
              <form name="spend" method="post">
                <input type="hidden" name="a" value="deposit">
                <input type="hidden" name="action" value="confirm">
                <input type="hidden" name="type" value="{$type}">
                <input type="hidden" name="h_id" value="{$h_id}">
                <input type="hidden" name="compound" value="{$compound}">
                <input type="hidden" name="amount" value="{$famount}">

                {if $fields}
                <table class="table table-sm">
                  <tr>
                    <td colspan=2><b>Required Information:</b></td>
                  </tr>
                  {section name=f loop=$fields}
                  <tr>
                    <td>{$fields[f].name}</td>
                    <td><input type="text" name="fields[{$fields[f].id}]" class="form-control form-control-sm" value=""></td>
                  </tr>
                  {/section}
                </table>
                {/if}

                <br>
                <input type="submit" value="Save" class="btn btn-sm btn-primary"> &nbsp;
                <input type="button" class="btn btn-sm btn-secondary" value="Cancel" onclick="document.location='?a=deposit'">
              </form>

            {else}

              {if $max_deposit_less == 1}
                <div class="text-danger">Sorry, the maximal deposit is {$max_deposit_format}.</div>
              {/if}
              {if $wrong_paln == 1}
                <div class="text-danger">The Plan does not exist.</div>
              {/if}
              {if $not_enough_funds == 1}
                <div class="text-danger">You have not enough funds to complete the operation.</div>
              {/if}
              {if $less_for_bankwire == 1}
                <div class="text-danger">The minimal spend amount for Bank Wire is {$currency_sign}{$min_amount}.</div>
              {/if}
              {if $less_than_min == 1}
                <div class="text-danger">The minimal spend amount for '{$plan_name}' is {$currency_sign}{$min_amount}.</div>
              {/if}
              {if $zero_amount}
                <div class="text-danger">You should enter amount greater than zero.</div>
              {/if}

              <br>
              Click <a href="?a=deposit">here</a> and try again.

            {/if}

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

{include file="footer.tpl"}
