Joywork/ajax/getObjectRequestList.php

69 lines
2.8 KiB
PHP
Raw Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
if($_SESSION['id'] && $_GET['objectId'] && is_numeric($_GET['objectId'])) {
$get = clearInputData($_GET);
$user = new User;
$user->get($_SESSION['id']);
$sqlReq = "SELECT * from discharge_object_request where object_id = $get[objectId]";
$rezReq = mysql_query($sqlReq);
$num = 1;
$availableRequests = $user->egrn_request_count;
if (empty($availableRequests) || $availableRequests == 0) {
$availableRequests = $user->agencyEgrnRequestCount;
}
if ($availableRequests > 0) {
echo '<div class="jw__object" style="padding-bottom: 15px; font-size: 16px; box-shadow: none;">
<div class="jw__action-button">
<div title="Заказать выписку из ЕГРН" onclick="createNewRequest(this);" data-object-id="' . $get['objectId'] . '" class="action-button actionJW" style="color: #237ef7 !important;border-color: #3a8efa !important;">Новая выписка
</div>
</div>
<div style="float: right; padding-top: 7px;">
Доступно выписок: ' . $availableRequests . '
</div>
</div>';
} else {
echo '<div class="jw__object" style="padding-bottom: 15px; font-size: 16px; box-shadow: none;">
<div class="jw__action-button">
<div title="Оплатить пакет выписок" onclick="payForNewRequests();" class="action-button actionJW" style="color: #237ef7 !important;border-color: #3a8efa !important;">Оплатить выписки
</div>
</div>
</div>';
}
echo '<div class="jw__NB"><div class="jw__NB__flat-list"><table style="width: 100%"><thead><th>Дата и время</th><th>Тип выписки</th><th>&nbsp;</th></thead>';
while ($request = mysql_fetch_assoc($rezReq)) {
echo '<tr ';
if ($num % 2 > 0) {
echo 'style="background-color: #f9f9f9;"';
}
echo '>';
echo '<td>';
echo date_format(date_create($request['created_at']), 'd.m.Y H:i:s');
echo '</td>';
echo '<td>';
echo ($request['request_type'] == 'simple' ? 'Выписка из ЕГРН' : 'Выписка из ЕГРН о переходе прав на объект недвижимости');
echo '</td>';
if ($request['state'] == 'done') {
echo '<td><a style="white-space: nowrap;" target="_blank" href="' . $request['request_file'] . '" onclick="">Скачать выписку</a></td>';
} else {
echo '<td>Выписка формируется...</td>';
}
echo '</tr>';
$num++;
}
echo '</table></div></div>';
}