<?php
    $table = "support_appeal";
    if (!DEMO) {
        $report = form_delete($table);
    }
    /*$
    //обновление (загрузка файла)
    fields = ["img"=>"file",];
    $report = form_update_fields($table, $fields);*/
?>

<div id="page-wrapper">
    <?php include(ROOT."/adg/pages/show_report.php"); ?>
    <div class="container-fluid">
            <!-- Flot Charts -->
        <div class="row">
            <div class="col-lg-12">
                <h2 class="page-header"><?php echo $page_title; ?></h2>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-bar-chart-o"></i> Список</h3>
                    </div>
                    <div class="panel-body">
                        <div class="flot-chart">
                            <div class="flot-chart-content" id="flot-line-chart">
                                <div class="table-responsive">
                                    <table class="table table-bordered table-hover">
                                        <thead>
                                            <tr>
                                                <th>Логин</th>
                                                <th>Тема</th>
                                                <th>Дата</th>
                                                <th>Статус</th>
                                                <th>Обработать</th>
                                                <th>Удалить</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php foreach (get_list($table, '1 = 1', 'date DESC') as $item) { ?>
                                            <tr>
                                                <td>
                                                    <?php echo escape($item['login']); ?>
                                                </td>
                                                <td>
                                                    <?php echo escape($item['subject']); ?>
                                                </td>
                                                <td>
                                                    <?php echo formatDate($item['date']); ?>
                                                </td>
                                                <td>
                                                    <?php echo support_status($item['status']); ?>
                                                </td>
                                                <td>
                                                    <form action="?page=update_support_appeal" method="get">
                                                        <?php /*echo csrf_install(); */?>
                                                        <input type = "hidden" name = "page" value = "update_support_appeal">
                                                        <input type = "hidden" name = "id" value = "<?php echo $item['id']; ?>">
                                                        <button type="submit" class="btn btn-default edit">Изменить</button>
                                                    </form>
                                                </td>
                                                <td>
                                                    <?php button_delete($item['id']); ?>
                                                </td>
                                            </tr>
                                            <?php } ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
