<?php require_once(ROOT . "/views/" . LANG . "/layouts/_header_c.php"); ?>

<div class="page-content-wrapper ">

  <div class="container">
    <div class="row">

    <?php foreach ($paysystems as $paysystem) : ?>

      <?php if ($paysystem['active_payment'] == 0) continue; ?>

      <div class="col-sm-6 col-lg-3">
        <div class="panel text-center insert_box">
          <div class="panel-body p-t-20">
            <img class="balancei_psimg m-b-5" src="assets/ps/<?=$paysystem['name']; ?>.png" style="
    box-shadow: 0 0 0 2px white;
    background-color: white;
">
            <div class="form-group m-b-0">
              <button type="button" class="btn waves-light btn-block balancei_btngo insert_new_btn" data-toggle="modal" data-target="#paymodal_<?=$paysystem['id']; ?>"><i class="fa fa-credit-card"></i> Заказать выплату </button>
            </div>
          </div>
        </div>
      </div>

      <div id="paymodal_<?=$paysystem['id']; ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog balancep_modalwidth">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
              <h4 class="modal-title" id="myModalLabel">Форма заказа выплаты</h4>
            </div>
            <form class="balancei_form" action="" method="POST">
              <input type="hidden" name="_tocken" value="<?=Session::$tocken; ?>">
              <input type="hidden" name="system" value="<?=$paysystem['name']; ?>">
              <div class="modal-body">
                <div class="balancep_modaling"><img id="imgid" src="/assets/ps/<?=$paysystem['name']; ?>.png"></div>
                <hr class="balancep_hr">
                <h5 class="balancep_h5">Комиссия: <span><?=sprintf("%.2f", $paysystem['comis']); ?> %</span></h5>
                <h5 class="balancep_h5">Мин. сумма: <span><?=$paysystem['min_pay']; ?> руб.</span></h5>
                <h5 class="balancep_h5">Макс. сумма: <span><?=$paysystem['max_pay']; ?> руб.</span></h5>
                <hr class="balancep_hr">
                <div class="form-group">
                  <input type="text" class="form-control balancei_input insert_new_input" maxlength="5" placeholder="Введите сумму выплаты... (руб.)" name="amount">
                </div>
                <!--<div class="form-group">
                  <input type="text" value="" autocomplete="off" class="form-control balancei_input insert_new_input" placeholder="Введите свой платежный пароль" name="pin">
                </div>        -->                        
              </div>
              <div class="modal-footer" style="border-top: 1px solid #f8f8f8;">
                <button type="submit" class="btn waves-light btn-block balancei_btngo insert_new_btn" style="margin-top: 0;margin-bottom: 15px;">Заказать выплату</button>
              </div>
            </form>
          </div>
        </div>
      </div>

    <?php endforeach; ?>

    </div>

  <?php if (count($last_payments) > 0) : ?>

    <div class="row">
      <div class="col-lg-10 col-lg-offset-1">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title racetabletitle"><i class="fa fa-list-ul"></i> Ваши последние выплаты</h3>
          </div>
          <div class="panel-body">
            <div class="row">
              <div class="col-xs-12">
                <div class="table-responsive">
                  <table class="table">
                    <thead>
                      <tr>
                        <th class="text-center">Дата выплаты</th>
                        <th class="text-center">Сумма выплаты</th>
                        <th class="text-center">Платежная система</th>
                        <th class="text-center">Реквизиты</th>
                        <th class="text-center">Статус</th>
                      </tr>
                    </thead>
                    <tbody>

                    <?php foreach ($last_payments as $payment) : ?>

                      <tr class="text-center">
                        <td><?=date("d/m/Y в H:i", $payment['date_add']); ?></td>
                        <td><?=sprintf("%.2f", $payment['sum']); ?> руб.</td>
                        <td><?=$payment['payment_system']; ?></td>
                        <td><?=$payment['purse']; ?></td>    
                        <td><?=$payment['status']; ?></td>    
                      </tr> 

                    <?php endforeach; ?>

                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div><!-- end row -->

  <?php endif; ?>

  </div><!-- container -->
</div> <!-- Page content Wrapper -->

<?php require_once(ROOT . "/views/" . LANG . "/layouts/_footer_c.php"); ?>
