Joywork/my-reservations.php

214 lines
9.6 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']) {
header("location:index.php");
die("Доступ запрещён!");
}
$sqlForNeedNb = "SELECT COUNT(blocks.id) as count
FROM `blocks`
INNER JOIN regions r on r.id = blocks.region_id
INNER JOIN rf_regions rr on rr.id = r.rf_region_id
WHERE rr.id = $user->region_rf_id
";
$rezForNeedNb = mysql_query($sqlForNeedNb);
$showNewbuildings = false;
$countResult = mysql_fetch_assoc($rezForNeedNb);
if ($countResult['count'] != '0') {
$showNewbuildings = true;
}
if ($showNewbuildings == false) {
header("location:/index.php");
die("Доступ запрещён!");
}
include $_SERVER['DOCUMENT_ROOT'] . '/import/obj/ImportRecord.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/document/target/DocTarget.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/IReservationState.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/BaseState.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/StateNew.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/StateCancel.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/StateWork.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/StateDelete.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/state/StateBought.php';
include $_SERVER['DOCUMENT_ROOT'] . '/import/reservation/Reservation.php';
require($_SERVER['DOCUMENT_ROOT']."/templates/new-header.php");
?>
<div class="content-right">
<div class="inner">
<div class="main-title <?php if (isset($user_view)) {echo "two-line";}?>">
<h1>
Мои брони
</h1>
</div>
<script type="text/javascript" src="/js/ajax-form.js"></script>
<script type="text/javascript" src="/js/core.js?t=3"></script>
<div class="object-content__preloader" style="display: block;">
<img src="../images/rocket-spinner.svg" width="96px">
</div>
<div class="fr-system__objects my-reservation">
<?php
$num_on_page = 20;
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$from = ($page - 1) * $num_on_page;
$searchName = null;
$url_params = '';
$reservationsCount = Reservation::count($_SESSION['id']);
$all_pages = ceil($reservationsCount / $num_on_page);
if ($reservationsCount > 0) {
$reservationsList = Reservation::search($_SESSION['id'], $from, $num_on_page);
?>
<div class="jw__NB">
<?php
$numFrom = $from + 1;
$numTo = (($from + $num_on_page) >= $reservationsCount) ? $reservationsCount : ($from + $num_on_page);
echo '<div style="margin: 13px 35px; font-weight: bold;">Показаны записи ' . $numFrom . '-' . $numTo . ' из ' . $reservationsCount . '</div>'
?>
<div class="jw__NB__flat-list">
<table>
<thead>
<tr>
<th>Инфо</th>
<th>ID</th>
<th>Дата брони</th>
<th>Ф.И.О. клиента</th>
<th>Статус брони</th>
<th>Пользователь</th>
<th>Цена кв при 100% опл</th>
<th>Базовая стоимость</th>
<th>Ожидаемая комиссия</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$num = 1;
foreach ($reservationsList as $reservation) {
echo '<tr ';
if ($num % 2 > 0) {
echo 'style="background-color: #f9f9f9;"';
}
$fee = (float)$reservation->fee;
$feeFormated = number_format($reservation->fee, 2, ',', ' ');
$money = number_format(round($reservation->full_price*$fee / 100), 0, ',', ' ');
echo '>';
echo '<td><a href="#" class="view-reservation" data-id="' . $reservation->id . '" title="Просмотр"><i class="ti-search"></i></a></td>';
echo '<td>' . $reservation->id . '</td>';
echo '<td>' . $reservation->created_at . '</td>';
echo '<td>' . $reservation->getFullname() . '</td>';
echo '<td>' . $reservation->getStateName() . '</td>';
echo '<td>' . $reservation->firstname . '</td>';
echo '<td style="white-space: nowrap;">' . number_format($reservation->full_price, 0, ',', ' ') . '</td>';
echo '<td style="white-space: nowrap;">' . number_format($reservation->base_price, 0, ',', ' ') . '</td>';
echo '<td>' . sprintf('%s (%s%%)', $money, $feeFormated) . '</td>';
echo '<td style="width: 26px; height: 26px;"><div id="action_loader_' . $reservation->id . '" style="width: 26px; height:26px; background:url(/images/ajax_preloader.gif) no-repeat center center; background-size: 26px 26px; display: none;"></div></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>
</div>
<div class="full_modal-bg" id="flat-booking__bg" style="z-index: 99998; display: none;">
<span class="pseudo-link closer event-modal-closer">
<i class="ti-close"></i>
</span>
<div class="full_modal flat__modal flat-booking" id="flat-booking" style="display: none;">
</div>
</div>
<div class="full_modal-bg" id="flat__bg" style="display: none;z-index: 99999;">
<span class="pseudo-link closer-flat event-modal-closer"
style="z-index: 999999" onclick="$('#flat').hide(10); $('#flat__bg').hide(10);">
<i class="ti-close"></i>
</span>
<div class="full_modal flat__modal" id="flat" style="display: none;">
<div class="flat__inner">
<div class="flat__top">
<h2 id="flat_modal_title">Квартира №2562</h2>
</div>
<div class="jw-tabs" id="flatModalTabs">
<ul class="tabs__caption">
<li><span>Квартира</span></li>
<li><span>О комплексе</span></li>
<li><span>Ипотека</span></li>
<li><span>Документы</span></li>
<li><span>Условия покупки</span></li>
</ul>
<div>
<div class="tabs__content" style="display: none;" id="flat_info_tab">
</div>
<div class="tabs__content" style="display: block;" id="block_info_tab">
</div>
<div class="tabs__content" style="display: none;" id="banks_info_tab">
</div>
<div class="tabs__content" style="display: none;" id="docs_info_tab">
</div>
<div class="tabs__content" style="display: none;" id="conditions_info_tab">
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="/js/fotorama.js"></script>
<script type="text/javascript">
setTimeout(function(){
var elem = document.createElement('script');
elem.type = 'text/javascript';
elem.src = 'https://api-maps.yandex.ru/2.1/?load=package.standard&apikey=692f0a05-cb88-4158-88b9-06bc0dc93004&lang=ru_RU';
document.getElementsByTagName('body')[0].appendChild(elem);
}, 1000);
</script>
<?php require($_SERVER['DOCUMENT_ROOT']."/templates/footer.php"); ?>