Joywork/admin/dischargePay.php

132 lines
4.7 KiB
PHP
Raw Permalink Normal View History

2026-05-22 20:21:54 +02:00
<?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");
?>
<div class="main-title">
<h1>Оплата выписок ЕГРН</h1>
</div>
<div class="users fr__users" style="margin-right: 20px;">
<?php
$sqlCount = "SELECT count(id) FROM discharge_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 discharge_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>
</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 '</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 type="text/javascript">
function confirmPay(requestId) {
$.ajax({
url: '/admin/ajax/confirmRequestPay.php?id=' + requestId,
success:function(data){
window.location.reload(true);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("eRROR: " + errorThrown + "; status:" + textStatus);
}
});
}
</script>
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/footer-admin.php");
?>