        <?php $cat = array("1" => "samp", "2" => "rust", "3" => "cs", "4" => "other", "5" => "mine");?>

        <div id="page-wrapper">
            <div class="row" style="padding-top: 20px">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-body shop-head" style="background-image: url('/images/<?=$cat[$shop['shop_game']]?>_header.png')">
                            <img src="/images/<?=$cat[$shop['shop_game']]?>_icon.png" style="float: left">
                            <div class="game-name">
                                <?=$shop['shop_name']?>
                                <p><?=$shop['shop_domain']?></p>
                            </div>
                            <div class="site-balance">
                                Баланс сайта
                                <p><?=$shop['shop_balance']?> <i class="fa fa-rub"></i></p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="panel panel-default nav-panel">
                        <div class="panel-body" style="text-align: center">
                            <ul id="site-nav" class="nav nav-pills">
                                <li><a href="/project/<?=$shop['shop_id']?>">Статистика</a></li>
                                <!-- <li><a href="/project/<?=$shop['shop_id']?>/template">Шаблон</a></li> -->
                                <!-- <li><a href="/project/<?=$shop['shop_id']?>/servers">Серверы</a></li> -->
                                <li class="active"><a href="/project/<?=$shop['shop_id']?>/items">Последние покупки</a></li>
                                <!-- <li><a href="/project/<?=$shop['shop_id']?>/players">Игроки</a></li> -->
                                <!-- <li><a href="/project/<?=$shop['shop_id']?>/news">Новости</a></li> -->
                                <li><a href="/project/<?=$shop['shop_id']?>/setting">Настройки</a></li>
                                <li><a href="/project/<?=$shop['shop_id']?>/form">Форма оплаты</a></li>
                                <li class="pull-right"><a href="#"><?php if($shop['shop_status'] == 0): ?> 
                               <span class="label label-warning">Ожидает модерации</span>
                               <?php elseif($shop['shop_status'] == 1): ?> 
                               <span class="label label-success">Одобрен</span>
                               <?php elseif($shop['shop_status'] >= 2): ?> 
                               <span class="label label-danger">Заблокирован</span>
                               <?php endif; ?></a></li>
                            </ul>
                        </div>
                    </div>
                </div>

                <div class="col-lg-12">
                    <table class="table">
                     <thead>
                       <tr>
                          <th>#</th>
                          <th>Дата</th>
                          <th>Система</th>
                          <th>№ Счета</th>
                          <th>Сумма платежа</th>
                          <th>Ваш доход</th>
                          <th>Статус</th>
                          <th></th>
                       </tr>
                     </thead>
                     <tbody>
                      <?php foreach($items as $item): ?> 
                      <div class="modal fade" id="detail-<?php echo $item['log_payments_id'] ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                          <div class="modal-content">
                            <div class="modal-header">
                              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                              <h4 class="modal-title" id="myModalLabel">Детали платежа #<?php echo $item['log_payments_id'] ?></h4>
                            </div>
                            <div class="modal-body">
                              <? $sign = md5($item['user_id'].$item['log_payments_sum'].$shop['shop_secret_key'])?>
                              <?php if($item['log_payments_status'] >= 2): ?> 
                              <div id="requests-<?php echo $item['log_payments_id'] ?>" style="display: none"?>
                                <div class="well well-sm" style="word-wrap: break-word;">
                                <span class="label label-success">Запрос</span><hr style="margin: 5px 0">
                                <?php echo $shop['shop_url'] ?>?<br>
                                method=check&amp;params[account]=<?php echo $item['user_id'] ?>&amp;params[projectId]=<?php echo $item['shop_id'] ?>&amp;params[sum]=<?php echo $item['log_payments_sum'] ?>&amp;params[sign]=<?=$sign?>&amp;params[localpayId]=<?php echo $item['log_payments_id'] ?>
                                </div>
                                <div class="well well-sm" style="word-wrap: break-word; text-align: right">
                                <span class="label label-success" style="clear: right">Ответ</span><hr style="margin: 5px 0">
                                {"jsonrpc":"2.0","result":{"message":"CHECK is successful"},"id":1}
                                </div>
                                <div class="well well-sm" style="word-wrap: break-word;">
                                <span class="label label-success">Запрос</span><hr style="margin: 5px 0">
                                <?php echo $shop['shop_url'] ?>?<br>
                                method=pay&amp;params[account]=<?php echo $item['user_id'] ?>&amp;params[projectId]=<?php echo $item['shop_id'] ?>&amp;params[sum]=<?php echo $item['log_payments_sum'] ?>&amp;params[sign]=<?=$sign?>&amp;params[localpayId]=<?php echo $item['log_payments_id'] ?>
                                </div>
                                <div class="well well-sm" style="word-wrap: break-word; text-align: right">
                                <span class="label label-success" style="clear: right">Ответ</span><hr style="margin: 5px 0">
                                {"jsonrpc":"2.0","result":{"message":"Pay is successful"},"id":1}
                                </div>
                              </div>
                              <?elseif($item['log_payments_status'] == 0): ?>
                              <div id="requests-<?php echo $item['log_payments_id'] ?>" style="display: none"?>
                                <div class="well well-sm" style="word-wrap: break-word;">
                                <span class="label label-success">Запрос</span><hr style="margin: 5px 0">
                                <?php echo $shop['shop_url'] ?>?<br>
                                method=check&amp;params[account]=<?php echo $item['user_id'] ?>&amp;params[projectId]=<?php echo $item['shop_id'] ?>&amp;params[sum]=<?php echo $item['log_payments_sum'] ?>&amp;params[sign]=<?=$sign?>&amp;params[localpayId]=<?php echo $item['log_payments_id'] ?>
                                </div>
                                <div class="well well-sm" style="word-wrap: break-word; text-align: right">
                                <span class="label label-success" style="clear: right">Ответ</span><hr style="margin: 5px 0">
                                {"jsonrpc":"2.0","result":{"message":"CHECK is successful"},"id":1}
                                </div>
                              </div>
                              <?else:?>
                              <div id="requests-<?php echo $item['log_payments_id'] ?>" style="display: none"?>
                                <div class="well well-sm" style="word-wrap: break-word;">
                                <span class="label label-success">Запрос</span><hr style="margin: 5px 0">
                                <?php echo $shop['shop_url'] ?>?<br>
                                method=check&amp;params[account]=<?php echo $item['user_id'] ?>&amp;params[projectId]=<?php echo $item['shop_id'] ?>&amp;params[sum]=<?php echo $item['log_payments_sum'] ?>&amp;params[sign]=<?=$sign?>&amp;params[localpayId]=<?php echo $item['log_payments_id'] ?>
                                </div>
                                <div class="well well-sm" style="word-wrap: break-word; text-align: right">
                                <span class="label label-danger" style="clear: right">Ответ</span><hr style="margin: 5px 0">
                                {"jsonrpc":"2.0","error":{"code":-32000,"message":"Character not found!"},"id":1}
                                </div>
                              </div>
                              <?endif?>
                              <div class="btn btn-primary btn-xs open" data-id="<?php echo $item['log_payments_id'] ?>">Показать подробности</div>
                              <br><br>Система оплаты: <b><?php echo $item['log_payments_system']?></b>
                              <br>Время создания платежа: <b><?php echo date("d.m.Y в H:i", strtotime($item['log_payments_time'])) ?></b>
                              <?php if($item['log_payments_status'] >= 2): ?> 
                              <br>Время оплаты платежа: <b><?php echo date("d.m.Y в H:i", strtotime($item['log_payments_time_complete'])) ?></b>
                              <?else:?>
                              <br>Время оплаты платежа: <b>Неоплачен</b>  
                              <?endif?>
                              <br>№ счета: <b><?php echo $item['user_id'] ?></b>
                              <br>Сумма платежа: <b><?php echo $item['log_payments_sum'] ?> <i class="fa fa-rub"></i></b>
                              <br>Ваш доход: <b><small>+</small><?php echo $item['log_payments_sum_client'] ?> <i class="fa fa-rub"></i> (<?=floor($item['log_payments_sum_client']*100/$item['log_payments_sum'])?>%)</b>
                            </div>
                          </div>
                        </div>
                      </div>

                      <tr style="cursor: pointer;">
                       <td><?php echo $item['log_payments_id'] ?></td>
                       <td><?php echo date("d.m.Y в H:i", strtotime($item['log_payments_time'])) ?></td>
                       <td><?php echo $item['log_payments_system']?></td>
                       <td><?php echo $item['user_id'] ?></td>
                       <td><?php echo $item['log_payments_sum'] ?> <i class="fa fa-rub"></i></td>
                       <td><small>+</small><?php echo (float)$item['log_payments_sum_client'] ?> <i class="fa fa-rub"></i></td>
                       <td><?php if($item['log_payments_status'] == 0): ?> 
                       <span class="label label-warning">В процессе</span>
                       <?php elseif($item['log_payments_status'] == 1): ?> 
                       <span class="label label-danger">Ошибка</span>
                       <?php elseif($item['log_payments_status'] >= 2): ?> 
                       <span class="label label-success">Оплачен</span>
                       <?php endif; ?> </td>
                       <td data-toggle="tooltip" data-placement="left" title="Детализация платежа"><i class="fa fa-list" data-toggle="modal" data-target="#detail-<?php echo $item['log_payments_id'] ?>"></i></td>
                      </tr>
                      <?php endforeach; ?> 
                      <?php if(empty($items)): ?> 
                      <tr>
                       <td colspan="7" style="text-align: center;">На данный момент покупок нет.</td>
                      <tr>
                      <?php endif; ?> 
                     </tbody>
                    </table>
                </div>
            </div>

            <script>
              $(".open").click(function(){
                $("#requests-" + $(this).attr("data-id")).css("display", "block");
                $(this).css("display", "none");
              });
            </script>
        <!-- /#page-wrapper -->