607 lines
29 KiB
PHP
607 lines
29 KiB
PHP
|
|
<?php
|
|||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
|||
|
|
|
|||
|
|
ini_set('display_errors', 0);
|
|||
|
|
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
|
|||
|
|
|
|||
|
|
?>
|
|||
|
|
<div class="modal__body analytics-obj-list is-active" data-view="list">
|
|||
|
|
<input type="hidden" value="" id="selectedObjId">
|
|||
|
|
<input type="hidden" value="" id="selectedObjLat">
|
|||
|
|
<input type="hidden" value="" id="selectedObjLon">
|
|||
|
|
<input type="hidden" value="" id="selectedObjAddress">
|
|||
|
|
<input type="hidden" value="" id="openedForCabinet">
|
|||
|
|
<div class="object">
|
|||
|
|
<ul class="object__list">
|
|||
|
|
<?php
|
|||
|
|
|
|||
|
|
if ($_SESSION['id'] && isset($_GET['objectId'])) {
|
|||
|
|
|
|||
|
|
$view = array();
|
|||
|
|
$favour = array();
|
|||
|
|
|
|||
|
|
$sql = "SELECT * FROM views WHERE id_user = $_SESSION[id]";
|
|||
|
|
$rez = mysql_query($sql);
|
|||
|
|
while($f=mysql_fetch_assoc($rez)) $view[] = $f['id_obj'];
|
|||
|
|
|
|||
|
|
$sql = "SELECT * FROM favor WHERE id_user = $_SESSION[id]";
|
|||
|
|
$rez = mysql_query($sql);
|
|||
|
|
while($f=mysql_fetch_assoc($rez)) $favour[] = $f['id_obj'];
|
|||
|
|
|
|||
|
|
$agencyId = User::getAgencyIdForUser($_SESSION['id']);
|
|||
|
|
|
|||
|
|
$usersIds = User::getAllAgencyUsers($agencyId);
|
|||
|
|
$usersIds[] = $_SESSION['id'];
|
|||
|
|
$usersIds = array_unique($usersIds);
|
|||
|
|
$notes_bd_usl = "created_by IN (" . implode(",", $usersIds) . ")";
|
|||
|
|
|
|||
|
|
$numOnPage = 10;
|
|||
|
|
|
|||
|
|
$cabinetObjCompetitors = [];
|
|||
|
|
|
|||
|
|
$db = new MysqlPdo(hstsph, null, null, null, true, '9306');
|
|||
|
|
|
|||
|
|
$get = clearInputData($_GET);
|
|||
|
|
|
|||
|
|
$objectId = trim($_GET['objectId']);
|
|||
|
|
$pageNumber = trim($_GET['page']);
|
|||
|
|
$forCabinet = isset($get['cabinet']) && $get['cabinet'] == 1;
|
|||
|
|
|
|||
|
|
//если у нас форма для кабинета, то тащим все, что было выбрано раньше для отметка как выбранного
|
|||
|
|
if ($forCabinet) {
|
|||
|
|
//очищаем сессионную переменную
|
|||
|
|
$_SESSION['cabinetCompetitor'][$objectId] = [];
|
|||
|
|
//начитываем массив из БД
|
|||
|
|
$cabinetObjCompetitors = ObjectCabinet::getCabinetObjCompetitorsAsObjectIds($mdb, $objectId);
|
|||
|
|
//проставляем в сессию
|
|||
|
|
if (count($cabinetObjCompetitors) > 0) {
|
|||
|
|
foreach ($cabinetObjCompetitors as $comp) {
|
|||
|
|
$_SESSION['cabinetCompetitor'][$objectId][] = $comp;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!$pageNumber) {
|
|||
|
|
$pageNumber = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$sql = "SELECT * FROM objects WHERE id = $objectId";
|
|||
|
|
$res = mysql_query($sql);
|
|||
|
|
$obj = mysql_fetch_assoc($res);
|
|||
|
|
|
|||
|
|
$parentRegion = '2';
|
|||
|
|
$parentRegionName = '';
|
|||
|
|
|
|||
|
|
$sqlRegion = "SELECT parent, name FROM rf_regions WHERE id=$obj[id_rf_region] or parent=$obj[id_rf_region]";
|
|||
|
|
$resRegion = mysql_query($sqlRegion);
|
|||
|
|
|
|||
|
|
if (mysql_num_rows($resRegion) > 0) {
|
|||
|
|
while($row = mysql_fetch_assoc($resRegion)){
|
|||
|
|
if ($row['parent']) {
|
|||
|
|
$parentRegion = $row['parent'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$sqlParentRegion = "SELECT name FROM rf_regions WHERE id=$parentRegion";
|
|||
|
|
$resParentRegion = mysql_query($sqlParentRegion);
|
|||
|
|
|
|||
|
|
if (mysql_num_rows($resParentRegion)) {
|
|||
|
|
$parentReg = mysql_fetch_assoc($resParentRegion);
|
|||
|
|
$parentRegionName = $parentReg['name'];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ищем исключения для этого объекта и этого пользователя
|
|||
|
|
$sqlExcl = "SELECT excluded_object_id FROM objects_analytic_exclude WHERE object_id = $objectId and user_id = $_SESSION[id]";
|
|||
|
|
$resExcl = mysql_query($sqlExcl);
|
|||
|
|
|
|||
|
|
$exclIds = array();
|
|||
|
|
$exclSql = "";
|
|||
|
|
$komnSql = "";
|
|||
|
|
$commTypeSql = "";
|
|||
|
|
$studioSql = "";
|
|||
|
|
|
|||
|
|
if (mysql_num_rows($resExcl) > 0) {
|
|||
|
|
while($row = mysql_fetch_assoc($resExcl)){
|
|||
|
|
if ($row['excluded_object_id']) {
|
|||
|
|
$exclIds[] = $row['excluded_object_id'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (count($exclIds)) {
|
|||
|
|
$exclSql = "AND id NOT IN (" . implode(",", $exclIds) . ")";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($obj['komnat'] && $obj['type'] != 3) {
|
|||
|
|
$komnSql = "AND komnat=$obj[komnat]";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($obj['studio_flag'] > 0) {
|
|||
|
|
$studioSql .= "AND studio_flag = '1'";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($obj['type'] == 4) {
|
|||
|
|
$commTypeSql = "AND type_category=$obj[type_category]";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!preg_match('~\d~', $obj['adres']) && $obj['dom']) {
|
|||
|
|
$obj['adres'] = $obj['adres'] . " " . $obj['dom'];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$adres_search = getAdresSearchNoLower($obj['adres']);
|
|||
|
|
|
|||
|
|
$adres_mas = explode(" ", $adres_search);
|
|||
|
|
|
|||
|
|
$ausl_mas = array();
|
|||
|
|
|
|||
|
|
for ($a = 0; $a < count($adres_mas); $a++) {
|
|||
|
|
if ($adres_mas[$a]) {
|
|||
|
|
$ausl_mas[] = trim($adres_mas[$a]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$foundIds = array();
|
|||
|
|
|
|||
|
|
$latitude = null;
|
|||
|
|
$longitude = null;
|
|||
|
|
|
|||
|
|
$objectLatitude = null;
|
|||
|
|
$objectLongitude = null;
|
|||
|
|
|
|||
|
|
$hasLocRecord = false;
|
|||
|
|
|
|||
|
|
$sqlLocationInfo = "SELECT * FROM object_location WHERE object_id=$objectId";
|
|||
|
|
$rezLocationInfo = mysql_query($sqlLocationInfo);
|
|||
|
|
|
|||
|
|
if (mysql_num_rows($rezLocationInfo) > 0) {
|
|||
|
|
$objLocationInfo = mysql_fetch_assoc($rezLocationInfo);
|
|||
|
|
$objectLatitude = $objLocationInfo['latitude'];
|
|||
|
|
$objectLongitude = $objLocationInfo['longitude'];
|
|||
|
|
$hasLocRecord = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//берем координаты по адресу
|
|||
|
|
if (!preg_match('~\d~', $obj['adres']) && $obj['dom']) {
|
|||
|
|
$obj['adres'] = $obj['adres'] . " " . $obj['dom'];
|
|||
|
|
|
|||
|
|
if ($obj['korpus']) {
|
|||
|
|
$obj['adres'] = $obj['adres'] . " " . $obj['korpus'];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!$obj['litera']) {
|
|||
|
|
$obj['adres'] = $obj['adres'] . " " . $obj['litera'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$yaParams['geocode'] = $obj['adres'];
|
|||
|
|
$yaParams['format'] = 'json';
|
|||
|
|
$yaParams['results'] = "1";
|
|||
|
|
$yaParams['apikey'] = "898fc684-cdf6-4af8-af57-15e2781d68d1";
|
|||
|
|
|
|||
|
|
$yaUrlParams = http_build_query($yaParams);
|
|||
|
|
|
|||
|
|
$url = "https://geocode-maps.yandex.ru/1.x/?" . $yaUrlParams;
|
|||
|
|
|
|||
|
|
$json = file_get_contents($url);
|
|||
|
|
$json = json_decode($json, true);
|
|||
|
|
|
|||
|
|
if ($json['response'] && $json['response']['GeoObjectCollection'] &&
|
|||
|
|
$json['response']['GeoObjectCollection']['featureMember'] && $json['response']['GeoObjectCollection']['featureMember'][0]['GeoObject']) {
|
|||
|
|
|
|||
|
|
$geoObj = $json['response']['GeoObjectCollection']['featureMember'][0]['GeoObject'];
|
|||
|
|
|
|||
|
|
if ($geoObj['Point'] && $geoObj['Point']['pos']) {
|
|||
|
|
$coordsArrayStr = $geoObj['Point']['pos'];
|
|||
|
|
$coordsArray = explode(" ", $coordsArrayStr);
|
|||
|
|
$latitude = $coordsArray[1];
|
|||
|
|
$longitude = $coordsArray[0];
|
|||
|
|
if (!$hasLocRecord) {
|
|||
|
|
$sql = "INSERT INTO object_location (object_id, address, latitude, longitude) VALUES ('$obj[id]', '$obj[adres]', '$latitude', '$longitude')";
|
|||
|
|
mysql_query($sql);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$objType = $obj['type'];
|
|||
|
|
$objOperationType = $obj['operation_type'];
|
|||
|
|
|
|||
|
|
$coordinatesSql = "";
|
|||
|
|
|
|||
|
|
if ($latitude != null && $longitude != null) {
|
|||
|
|
$coordinatesSql = "MATCH ('@(id_rf_region,parent) $parentRegion') AND latitude = " . $latitude ." AND longitude = " . $longitude;
|
|||
|
|
|
|||
|
|
$sqlCountCoords = "SELECT id,
|
|||
|
|
IF(use_in_advert = 1 OR ads_source > 0, 1, 0) AS is_advert_enabled_or_rscan
|
|||
|
|
FROM objects, objects_delta
|
|||
|
|
WHERE archive = 0
|
|||
|
|
AND black = 0
|
|||
|
|
AND moder = 0
|
|||
|
|
AND is_advert_enabled_or_rscan = 1
|
|||
|
|
AND id <> $obj[id]
|
|||
|
|
AND operation_type = $obj[operation_type]
|
|||
|
|
AND type=$obj[type] $commTypeSql $komnSql $exclSql $studioSql
|
|||
|
|
AND $coordinatesSql
|
|||
|
|
LIMIT 0, 10000 OPTION max_matches=1000000"
|
|||
|
|
;
|
|||
|
|
|
|||
|
|
if ($_SESSION['id'] == 93) {
|
|||
|
|
echo $sqlCountCoords;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$rezCoordsSearch = $db->query($sqlCountCoords, true);
|
|||
|
|
|
|||
|
|
if ($db->num_rows($rezCoordsSearch) > 0) {
|
|||
|
|
while ($objCoords = $db->fetch_assoc($rezCoordsSearch)) {
|
|||
|
|
$foundIds[] = $objCoords['id'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($objectLatitude != null && $objectLongitude != null) {
|
|||
|
|
$coordinatesSql = "MATCH ('@(id_rf_region,parent) $parentRegion') AND latitude = " . $objectLatitude ." AND longitude = " . $objectLongitude;
|
|||
|
|
|
|||
|
|
$sqlCountCoords = "SELECT id,
|
|||
|
|
IF(use_in_advert = 1 OR ads_source > 0, 1, 0) AS is_advert_enabled_or_rscan
|
|||
|
|
FROM objects, objects_delta
|
|||
|
|
WHERE archive = 0
|
|||
|
|
AND black = 0
|
|||
|
|
AND moder = 0
|
|||
|
|
AND is_advert_enabled_or_rscan = 1
|
|||
|
|
AND id <> $obj[id]
|
|||
|
|
AND operation_type = $obj[operation_type]
|
|||
|
|
AND type=$obj[type] $commTypeSql $komnSql $exclSql $studioSql
|
|||
|
|
AND $coordinatesSql
|
|||
|
|
LIMIT 0, 10000 OPTION max_matches=1000000"
|
|||
|
|
;
|
|||
|
|
|
|||
|
|
if ($_SESSION['id'] == 93) {
|
|||
|
|
echo $sqlCountCoords;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$rezCoordsSearch = $db->query($sqlCountCoords, true);
|
|||
|
|
|
|||
|
|
if ($db->num_rows($rezCoordsSearch) > 0) {
|
|||
|
|
while ($objCoords = $db->fetch_assoc($rezCoordsSearch)) {
|
|||
|
|
$foundIds[] = $objCoords['id'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$strSph = '';
|
|||
|
|
|
|||
|
|
for ($a = 0; $a < count($ausl_mas); $a++) {
|
|||
|
|
if (strlen($strSph) > 1) {
|
|||
|
|
$strSph = $strSph . ' ';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$strSph = $strSph . '@adres ' . trim(str_replace("/","-",$ausl_mas[$a]));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$adres_usl = "MATCH ('@(id_rf_region,parent) $parentRegion $strSph')";
|
|||
|
|
|
|||
|
|
$sqlCount = "SELECT id,
|
|||
|
|
IF(use_in_advert = 1 OR ads_source > 0, 1, 0) AS is_advert_enabled_or_rscan
|
|||
|
|
FROM objects, objects_delta
|
|||
|
|
WHERE archive = 0
|
|||
|
|
AND black = 0
|
|||
|
|
AND moder = 0
|
|||
|
|
AND is_advert_enabled_or_rscan = 1
|
|||
|
|
AND id <> $obj[id]
|
|||
|
|
AND operation_type = $obj[operation_type]
|
|||
|
|
AND type=$obj[type] $commTypeSql $komnSql $exclSql $studioSql
|
|||
|
|
AND $adres_usl
|
|||
|
|
LIMIT 0, 10000 OPTION max_matches=1000000"
|
|||
|
|
;
|
|||
|
|
|
|||
|
|
if ($_SESSION['id'] == 93) {
|
|||
|
|
echo $sqlCount;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$rezAddressSearch = $db->query($sqlCount, true);
|
|||
|
|
|
|||
|
|
if ($db->num_rows($rezAddressSearch) > 0) {
|
|||
|
|
while ($objAddr = $db->fetch_assoc($rezAddressSearch)) {
|
|||
|
|
if (!in_array($objAddr['id'], $foundIds)) {
|
|||
|
|
$foundIds[] = $objAddr['id'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$vsego = count($foundIds);
|
|||
|
|
|
|||
|
|
if ($vsego > 0) {
|
|||
|
|
|
|||
|
|
$from = ($pageNumber - 1) * $numOnPage;
|
|||
|
|
|
|||
|
|
$all_pages = ceil($vsego / $numOnPage);
|
|||
|
|
|
|||
|
|
$sqlSearch = "SELECT *,
|
|||
|
|
IF(use_in_advert = 1 OR ads_source > 0, 1, 0) AS is_advert_enabled_or_rscan
|
|||
|
|
FROM objects, objects_delta
|
|||
|
|
WHERE id in (" . implode(",", $foundIds) . ")
|
|||
|
|
AND is_advert_enabled_or_rscan = 1
|
|||
|
|
ORDER BY date_add DESC
|
|||
|
|
LIMIT $from, $numOnPage OPTION max_matches=1000000"
|
|||
|
|
;
|
|||
|
|
|
|||
|
|
/*if ($_SESSION['id'] == 93) {
|
|||
|
|
echo $sqlSearch;
|
|||
|
|
}*/
|
|||
|
|
|
|||
|
|
$rezSearch = $db->query($sqlSearch);
|
|||
|
|
|
|||
|
|
if ($db->num_rows($rezSearch) > 0) {
|
|||
|
|
|
|||
|
|
$user = new User;
|
|||
|
|
$user->get($_SESSION['id']);
|
|||
|
|
|
|||
|
|
if (!isset($user->agencyId)) {
|
|||
|
|
$user->agencyId = $_SESSION['id'];
|
|||
|
|
$user->agencyName = $user->agency_name;
|
|||
|
|
$user->fio = trim($user->last_name . ' ' . $user->first_name . ' ' . $user->middle_name);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
while ($obj = $db->fetch_assoc($rezSearch)) {
|
|||
|
|
|
|||
|
|
$photo = "";
|
|||
|
|
|
|||
|
|
$sqlPhotoInfo = "SELECT oop.sort_order, p.photo FROM objects_object_photo oop, object_photo p WHERE p.id = oop.object_photo_id AND oop.object_id = $obj[id] ORDER BY oop.sort_order";
|
|||
|
|
$rezPhotoInfo = mysql_query($sqlPhotoInfo);
|
|||
|
|
|
|||
|
|
if (mysql_num_rows($rezPhotoInfo) > 0) {
|
|||
|
|
while ($photoInfo = mysql_fetch_assoc($rezPhotoInfo)) {
|
|||
|
|
$photo = $photoInfo;
|
|||
|
|
$obj['photo' . $photoInfo['sort_order']] = $photoInfo['photo'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
include($_SERVER['DOCUMENT_ROOT'] . "/templates/object_analytics_template.php");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
echo '<div class="f-system_pagination" style="padding: 20px 20px 0 20px;"><ul class="pagination">';
|
|||
|
|
if ($all_pages > 1) {
|
|||
|
|
paging($pageNumber, $all_pages, $objectId);
|
|||
|
|
}
|
|||
|
|
echo '</ul></div>';
|
|||
|
|
} else {
|
|||
|
|
echo "Объекты не найдены.";
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
echo "Объекты не найдены.";
|
|||
|
|
}
|
|||
|
|
echo '<script type="text/javascript">$("#selectedObjId").val("'. $objectId . '");</script>';
|
|||
|
|
echo '<script type="text/javascript">$("#selectedObjLat").val("'. $latitude . '");</script>';
|
|||
|
|
echo '<script type="text/javascript">$("#selectedObjLon").val("'. $longitude . '");</script>';
|
|||
|
|
echo '<script type="text/javascript">$("#selectedObjAddress").val("'. $obj['adres'] . '");</script>';
|
|||
|
|
echo '<script type="text/javascript">$("#openedForCabinet").val("'. ($forCabinet ? 1 : 0) . '");</script>';
|
|||
|
|
|
|||
|
|
if ($forCabinet) {
|
|||
|
|
echo '<script type="text/javascript">$("#saveAnalyticsCabinetSelection").show();</script>';
|
|||
|
|
echo '<script type="text/javascript">$("#selectAllLinkForCabinet").show();</script>';
|
|||
|
|
} else {
|
|||
|
|
echo '<script type="text/javascript">$("#saveAnalyticsCabinetSelection").hide();</script>';
|
|||
|
|
echo '<script type="text/javascript">$("#selectAllLinkForCabinet").hide();</script>';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($objType == 4 || $objType == 7) {
|
|||
|
|
echo '<script type="text/javascript">$("#kitchenAreaFrom").val("");$("#kitchenAreaTo").val("");$("#analyticsKitchenBlock").hide();</script>';
|
|||
|
|
} else {
|
|||
|
|
echo '<script type="text/javascript">$("#kitchenAreaFrom").val("");$("#kitchenAreaTo").val("");$("#analyticsKitchenBlock").show();</script>';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($objOperationType == 1 && $objType != 7) {
|
|||
|
|
echo '<script type="text/javascript">$("#yearFrom").val("");$("#yearTo").val("");$("#analyticsYearBlock").show();</script>';
|
|||
|
|
} else {
|
|||
|
|
echo '<script type="text/javascript">$("#yearFrom").val("");$("#yearTo").val("");$("#analyticsYearBlock").hide();</script>';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($objType == 1) {
|
|||
|
|
echo '<script type="text/javascript">$("#analytics-filter-kv-type").val("");$("#analyticsKvTypeBlock").show();</script>';
|
|||
|
|
} else {
|
|||
|
|
echo '<script type="text/javascript">$("#analytics-filter-kv-type").val("");$("#analyticsKvTypeBlock").hide();</script>';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($objType == 4) {
|
|||
|
|
echo '<script type="text/javascript">$("#analytics-filter-comm-type").val("");$("#analyticsCommTypeBlock").show();</script>';
|
|||
|
|
} else {
|
|||
|
|
echo '<script type="text/javascript">$("#analytics-filter-comm-type").val("");$("#analyticsCommTypeBlock").hide();</script>';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
?>
|
|||
|
|
</ul>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
$('#rangeFrom').val("0");
|
|||
|
|
$('#rangeTo').val("1500");
|
|||
|
|
$('#areaFrom').val("");
|
|||
|
|
$('#areaTo').val("");
|
|||
|
|
$('#kitchenAreaFrom').val("");
|
|||
|
|
$('#kitchenAreaTo').val("");
|
|||
|
|
$('#yearFrom').val("");
|
|||
|
|
$('#yearTo').val("");
|
|||
|
|
$("#analytics-filter-kv-type").val("");
|
|||
|
|
$("#analytics-filter-comm-type").val("");
|
|||
|
|
const rangeSlider = document.getElementById('range');
|
|||
|
|
if (rangeSlider && rangeSlider.noUiSlider) {
|
|||
|
|
rangeSlider.noUiSlider.set([0, 1500]);
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal__body analytics-obj-map" data-view="map">
|
|||
|
|
<div class="map-view-container">
|
|||
|
|
<div class="map" id="analyticsMainMap"></div>
|
|||
|
|
<div class="object">
|
|||
|
|
<ul class="object__list"></ul>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="inner-modal map-modal">
|
|||
|
|
<div class="inner-modal__container map-modal__container">
|
|||
|
|
<div class="inner-modal__header map-modal__header">
|
|||
|
|
<h2 class="inner-modal__title">Объект на карте:</h2>
|
|||
|
|
<button class="inner-modal__close btn-default" type="button">
|
|||
|
|
<svg width="18" height="18">
|
|||
|
|
<use xlink:href="#icon-close"></use>
|
|||
|
|
</svg>
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="inner-modal__content map-modal__content" id="map-modal__content" style="width:600px; height:500px;"></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="inner-modal description-modal">
|
|||
|
|
<div class="inner-modal__container description-modal__container">
|
|||
|
|
<div class="inner-modal__header">
|
|||
|
|
<h2 class="inner-modal__title">Описание объекта:</h2>
|
|||
|
|
<button class="inner-modal__close btn-default" type="button">
|
|||
|
|
<svg width="18" height="18">
|
|||
|
|
<use xlink:href="#icon-close"></use>
|
|||
|
|
</svg>
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="inner-modal__content description-modal__content">
|
|||
|
|
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Illum distinctio explicabo delectus repellendus tenetur rerum eum beatae ullam eaque? Quisquam voluptates ducimus ex temporibus natus harum nesciunt facere dolorem sapiente? </p><br>
|
|||
|
|
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iusto minima, fugiat, deleniti exercitationem temporibus est dolor quisquam incidunt illo quaerat reprehenderit obcaecati distinctio quas numquam? Dolorum, laborum neque. Ab, vel?</p>
|
|||
|
|
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae totam sit nostrum modi nobis. Sed delectus neque inventore commodi pariatur sequi itaque nemo minus culpa! Facilis a esse itaque tempore? Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae totam sit nostrum modi nobis. Sed delectus neque inventore commodi pariatur sequi itaque nemo minus culpa! Facilis a esse itaque tempore?</p>
|
|||
|
|
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae totam sit nostrum modi nobis. Sed delectus neque inventore commodi pariatur sequi itaque nemo minus culpa! Facilis a esse itaque tempore? Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae totam sit nostrum modi nobis. Sed delectus neque inventore commodi pariatur sequi itaque nemo minus culpa! Facilis a esse itaque tempore?</p>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="inner-modal average-modal">
|
|||
|
|
<div class="inner-modal__container average-modal__container">
|
|||
|
|
<div class="inner-modal__header">
|
|||
|
|
<h2 class="inner-modal__title">Средние цены</h2>
|
|||
|
|
<button class="inner-modal__close btn-default" type="button">
|
|||
|
|
<svg width="18" height="18">
|
|||
|
|
<use xlink:href="#icon-close"></use>
|
|||
|
|
</svg>
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="average">
|
|||
|
|
<div class="average-table"><span class="average-table__title" style="color: red;" id="analyticsMetersTitleWarning">Недостаточно данных для анализа. Измените фильтр для увеличения выборки анализируемых объектов.</span><span class="average-table__title" id="analyticsMetersTitle">Среднерыночная стоимость «Квадратного метра»</span>
|
|||
|
|
<div class="average-table__content">
|
|||
|
|
<div class="average-table__row">
|
|||
|
|
<div class="average-table__row-pricelist"><span class="average-table__text">Демпинговые цены от:</span><span class="average-table__text average-table__text--red" id="analyticsDempMeters">2 000 000 – 3 000 000 р</span></div>
|
|||
|
|
</div>
|
|||
|
|
<div class="average-table__row">
|
|||
|
|
<div class="average-table__row-pricelist"><span class="average-table__text">Средние цены от:</span><span class="average-table__text average-table__text--yellow" id="analyticsAvarageMeters">3 000 000 – 5 000 000 р</span></div>
|
|||
|
|
</div>
|
|||
|
|
<div class="average-table__row">
|
|||
|
|
<div class="average-table__row-pricelist"><span class="average-table__text">Высокие цены от:</span><span class="average-table__text average-table__text--green" id="analyticsHighMeters">5 000 000 – 8 000 000 р</span></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="average-table"><span class="average-table__title">Среднерыночная стоимость «Объекта»</span>
|
|||
|
|
<div class="average-table__content">
|
|||
|
|
<div class="average-table__row">
|
|||
|
|
<div class="average-table__row-pricelist"><span class="average-table__text">Демпинговые цены от:</span><span class="average-table__text average-table__text--red" id="analyticsDempAllPrice">2 000 000 – 3 000 000 р</span></div><a id="analyticsDempAllPriceLink" onclick="openObjectList('low');" href="javascript:{};">Объекты в сравнении</a>
|
|||
|
|
</div>
|
|||
|
|
<div class="average-table__row">
|
|||
|
|
<div class="average-table__row-pricelist"><span class="average-table__text">Средние цены от:</span><span class="average-table__text average-table__text--yellow" id="analyticsAvarageAllPrice">3 000 000 – 5 000 000 р</span></div><a id="analyticsAvarageAllPriceLink" onclick="openObjectList('average');" href="javascript:{};">Объекты в сравнении</a>
|
|||
|
|
</div>
|
|||
|
|
<div class="average-table__row">
|
|||
|
|
<div class="average-table__row-pricelist"><span class="average-table__text">Высокие цены от:</span><span class="average-table__text average-table__text--green" id="analyticsHighAllPrice">5 000 000 – 8 000 000 р</span></div><a id="analyticsHighAllPriceLink" onclick="openObjectList('high');" href="javascript:{};">Объекты в сравнении</a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="average__recomendation average-table"><span class="average-table__title">Рекомендованная цена продажи</span>
|
|||
|
|
<ul>
|
|||
|
|
<li><span class="average-table__text">За 12 месяцев:</span><span class="average-table__text average-table__text--bold" id="analyticsTwelveMonthPrice">300 000 000 р</span></li>
|
|||
|
|
<li><span class="average-table__text">За 3 месяца:</span><span class="average-table__text average-table__text--bold" id="analyticsThreeMonthPrice">1 300 000 000 р</span></li>
|
|||
|
|
<li><span class="average-table__text">Сделка завтра:</span><span class="average-table__text average-table__text--bold" id="analyticsNowPrice">1 300 000 000 р</span></li>
|
|||
|
|
</ul>
|
|||
|
|
</div><!--<a class="btn-default average__report-btn" href="#">
|
|||
|
|
<svg width="18" height="18">
|
|||
|
|
<use xlink:href="#icon-pdf"></use>
|
|||
|
|
</svg><span>Сформировать отчет для клиента</span></a>-->
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<?php
|
|||
|
|
|
|||
|
|
function paging($page, $all_pages, $objId) {
|
|||
|
|
if ($page == 1) {
|
|||
|
|
echo "<li class=active><a class='obj-analysis-paging2' data-id='$objId' data-page-num='1' href='javascript:void(0);'>1</a></li>";
|
|||
|
|
} else {
|
|||
|
|
$prev = $page - 1;
|
|||
|
|
echo "<li><a data-page-num='$prev' class='obj-analysis-paging2' data-id='$objId' href='javascript:void(0);'>«</a></li>";
|
|||
|
|
echo "<li><a data-page-num='1' class='obj-analysis-paging2' data-id='$objId' href='javascript:void(0);'>1</a></li>";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($all_pages > 8) {
|
|||
|
|
|
|||
|
|
if ($page > 4) {
|
|||
|
|
|
|||
|
|
$ot = $page - 3;
|
|||
|
|
echo "<li><a href='javascript:void(0);'>...</a></li>";
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
$ot = 2;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($page < $all_pages - 4) {
|
|||
|
|
$do = $page + 3;
|
|||
|
|
} else {
|
|||
|
|
$do = $all_pages;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
$ot = 2;
|
|||
|
|
$do = $all_pages;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for ($i = $ot; $i < $do; $i++) {
|
|||
|
|
if ($i == $page) $cl = "active"; else $cl = "";
|
|||
|
|
echo "<li class='$cl'><a class='obj-analysis-paging2' data-id='$objId' data-page-num='$i' href='javascript:void(0);'>$i</a></li>";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($all_pages > 8 and $page < $all_pages - 4) {
|
|||
|
|
echo "<li><a href='javascript:void(0);'>...</a></li>";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($page == $all_pages)
|
|||
|
|
echo "<li class=active><a class='obj-analysis-paging2' data-id='$objId' data-page-num='$all_pages' href='javascript:void(0);'>$all_pages</a></li>";
|
|||
|
|
else {
|
|||
|
|
echo "<li><a class='obj-analysis-paging2' data-id='$objId' data-page-num='$all_pages' href='javascript:void(0);'>$all_pages</a></li>";
|
|||
|
|
$nxt = $page + 1;
|
|||
|
|
echo "<li><a class='obj-analysis-paging2' data-id='$objId' data-page-num='$nxt' href='javascript:void(0);'>»</a></li>";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
initPaging();
|
|||
|
|
|
|||
|
|
function cabinetCompetitorSwitch(el) {
|
|||
|
|
let objectIdToCheck = $(el).data("id");
|
|||
|
|
let objectId = $("#selectedObjId").val();
|
|||
|
|
let state = $(el).is(":checked");
|
|||
|
|
|
|||
|
|
if (objectIdToCheck && objectId) {
|
|||
|
|
$.ajax({
|
|||
|
|
url: '/ajax/switchCabinetCompetitorState.php',
|
|||
|
|
method: "post",
|
|||
|
|
data: {
|
|||
|
|
"objectIdToCheck": objectIdToCheck,
|
|||
|
|
"objectId": objectId,
|
|||
|
|
"state": state ? 1 : 0
|
|||
|
|
},
|
|||
|
|
success: function(data) {
|
|||
|
|
},
|
|||
|
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
|||
|
|
console.log("eRROR: " + errorThrown + "; status:" + textStatus);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$('#analyticsOpenFilterButton').html("Уточнить");
|
|||
|
|
|
|||
|
|
$(document).ready(function () {
|
|||
|
|
getReSearchObjectsCountsAnalytics();
|
|||
|
|
getTaskCountersForObjects('.modal__content .object__list', '.object-card');
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
<script type="text/javascript" src="/js/analytics/bundle.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/analytics/bundle.js')?>"></script>
|