Joywork/admin/antiznakPay.php
2026-05-22 21:21:54 +03:00

153 lines
5.7 KiB
PHP

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
// закрываем доступ на выполнение запросов
if (!isset($_SESSION['superadmin'])) {
header("location:/index.php");
die("Доступ запрещён!");
}
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/header-admin.php");
?>
<link rel="stylesheet" href="/css/vue-select.css?v=21">
<style>
.tr__color {
background-color: #f9f9f9;
}
</style>
<div id="antiznak_pay">
<div class="main-title">
<h1>Оплата АнтиЗнак</h1>
</div>
<div class="users fr__users" style="margin-right: 20px;">
<?php
$sqlCount = "SELECT count(id) FROM antiznak_user_request";
$rezCount = mysql_query($sqlCount);
$count = mysql_result($rezCount, 0);
$num_on_page = 20;
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$from = ($page - 1) * $num_on_page;
$all_pages = ceil($count / $num_on_page);
if ($count > 0) {
$sql = "select * from antiznak_user_request order by created_at DESC LIMIT $from, $num_on_page";
$rez = mysql_query($sql);
if (mysql_num_rows($rez) > 0) {
?>
<div class="jw__NB">
<div class="jw__NB__flat-list">
<table>
<thead>
<tr>
<th>Дата запроса</th>
<th>ФИО пользователя</th>
<th>Телефон пользователя</th>
<th>Email пользователя</th>
<th>Количество выписок</th>
<th>Цена</th>
<th>Оплачено</th>
<th></th>
<th>Остаток</th>
</tr>
</thead>
<tbody>
<?php
$num = 1;
while($request = mysql_fetch_array($rez)) {
$sqlUser = new User();
$sqlUser->get($request['user_id']);
echo '<tr ';
if ($num % 2 > 0) {
echo 'style="background-color: #f9f9f9;"';
}
echo '>';
echo '<td>' . date_format(date_create($request['created_at']), 'd.m.Y H:i:s') . '</td>';
echo '<td>' . ($sqlUser->agency ? ($sqlUser->agency_name . "<br/> (" . trim($sqlUser->last_name . ' ' . $sqlUser->first_name . ' ' . $sqlUser->middle_name) .")") : trim($sqlUser->last_name . ' ' . $sqlUser->first_name . ' ' . $sqlUser->middle_name)) . '</td>';
echo '<td>' . $sqlUser->phone . '</td>';
echo '<td>' . $sqlUser->email . '</td>';
echo '<td>' . $request['count'] . '</td>';
echo '<td>' . $request['price'] . '</td>';
echo '<td>' . ($request['paid'] == 0 ? "Нет" : "Да") . '</td>';
if ($request['paid'] == 0) {
echo '<td width="50"><a href="javascript:{}" onclick="confirmPay(' . $request['id'] . ');">Подтвердить оплату</a></td>';
} else {
echo '<td width="50">&nbsp;</td>';
}
echo '<td>'.$sqlUser->antiznak_request_count.'</td>';
echo '</tr>';
$num++;
}
?>
</tbody>
</table>
</div>
<?php
echo '<div class="f-system_pagination" style="padding: 20px 20px 0 20px;"><ul class="pagination">';
if ($all_pages > 1) {
num_of_pages($page, $all_pages, $url_params);
}
echo '</ul></div>';
?>
</div>
<? } ?>
<? } else echo "<div class='empty-block'><h1><i class='ti-na'></i></h1><h2>Заказов не найдено</h2></div>" ?>
<div class="clear"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="/js/vue.min.js"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>-->
<script src="/js/vue-select.js"></script>
<script src="/js/admin/antiznak-tariffs.js?<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/admin/antiznak-tariffs.js')?>"></script>
<script type="text/javascript">
function confirmPay(requestId) {
axios.post('/ajax/vue_ajax/antiznak_axios.php', {
request: 'confirm_request_pay',
id: requestId,
}, )
.then((response) => {
window.location.reload(true);
})
.catch(function(error) {
console.log(error);
});
}
</script>
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/footer-admin.php");
?>