added new page rentals_and_sales

This commit is contained in:
gerchek 2024-04-05 17:41:28 +05:00
parent 9bd59f20f5
commit ba9f90349b
28 changed files with 1747 additions and 14 deletions

View File

@ -0,0 +1,19 @@
<?php namespace Tps\Shops\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class RentalsAndSalesController extends Controller
{
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController' ];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $reorderConfig = 'config_reorder.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Tps.Shops', 'main-menu-item', 'side-menu-item9');
}
}

View File

@ -0,0 +1,19 @@
<div data-control="toolbar">
<a href="<?= Backend::url('tps/shops/rentalsandsalescontroller/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
<a href="<?= Backend::url('tps/shops/rentalsandsalescontroller/reorder') ?>" class="btn btn-default oc-icon-list"><?= e(trans('backend::lang.reorder.default_title')) ?></a>
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"
onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked')
})"
data-request="onDelete"
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator>
<?= e(trans('backend::lang.list.delete_selected')) ?>
</button>
</div>

View File

@ -0,0 +1,3 @@
<div data-control="toolbar">
<a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>" class="btn btn-primary oc-icon-caret-left"><?= e(trans('backend::lang.form.return_to_list')) ?></a>
</div>

View File

@ -0,0 +1,10 @@
name: RentalsAndSalesController
form: $/tps/shops/models/rentalsandsales/fields.yaml
modelClass: Tps\Shops\Models\RentalsAndSales
defaultRedirect: tps/shops/rentalsandsalescontroller
create:
redirect: 'tps/shops/rentalsandsalescontroller/update/:id'
redirectClose: tps/shops/rentalsandsalescontroller
update:
redirect: tps/shops/rentalsandsalescontroller
redirectClose: tps/shops/rentalsandsalescontroller

View File

@ -0,0 +1,12 @@
list: $/tps/shops/models/rentalsandsales/columns.yaml
modelClass: Tps\Shops\Models\RentalsAndSales
title: RentalsAndSalesController
noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
toolbar:
buttons: list_toolbar
search:
prompt: 'backend::lang.list.search_prompt'
recordUrl: 'tps/shops/rentalsandsalescontroller/update/:id'

View File

@ -0,0 +1,4 @@
title: RentalsAndSalesController
modelClass: Tps\Shops\Models\RentalsAndSales
toolbar:
buttons: reorder_toolbar

View File

@ -0,0 +1,46 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>">RentalsAndSalesController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1 @@
<?= $this->listRender() ?>

View File

@ -0,0 +1,22 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>">RentalsAndSalesController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<?php endif ?>
<p>
<a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>" class="btn btn-default oc-icon-chevron-left">
<?= e(trans('backend::lang.form.return_to_list')) ?>
</a>
</p>

View File

@ -0,0 +1,8 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>">RentalsAndSalesController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?= $this->reorderRender() ?>

View File

@ -0,0 +1,54 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>">RentalsAndSalesController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('tps/shops/rentalsandsalescontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1,27 @@
<?php namespace Tps\Shops\Models;
use Model;
/**
* Model
*/
class RentalsAndSales extends Model
{
use \October\Rain\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
public $table = 'tps_shops_rentals_and_sales';
/**
* @var array Validation rules
*/
public $rules = [
];
public $attachMany = [
'images' => 'Tps\Shops\Classes\Attachment',
];
}

View File

@ -0,0 +1,22 @@
columns:
id:
label: id
type: number
type:
label: type
type: text
name:
label: name
type: text
floor:
label: floor
type: number
sector:
label: sector
type: text
created_at:
label: created_at
type: datetime
updated_at:
label: updated_at
type: datetime

View File

@ -0,0 +1,47 @@
fields:
type:
label: Тип
options:
rental: Аренда
sale: Продажа
showSearch: true
span: auto
type: dropdown
name:
label: 'Указать аренда или продажа'
span: auto
type: text
number:
label: 'Номер арендатора'
span: auto
type: text
floor:
label: Этаж
options:
- '0'
- '1'
- '2'
- '3'
- '4'
- '5'
showSearch: true
span: auto
type: dropdown
sector:
label: Сектор
span: auto
type: text
description:
label: Описание
size: small
span: auto
type: textarea
images:
label: images
mode: image
useCaption: true
thumbOptions:
mode: crop
extension: auto
span: auto
type: fileupload

View File

@ -42,3 +42,7 @@ navigation:
label: Notification label: Notification
url: tps/shops/notification url: tps/shops/notification
icon: icon-comments icon: icon-comments
side-menu-item9:
label: 'Аренда и продажа'
url: tps/shops/rentalsandsalescontroller
icon: icon-line-chart

View File

@ -0,0 +1,29 @@
<?php namespace Tps\Shops\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateTpsShopsRentalsAndSales extends Migration
{
public function up()
{
Schema::create('tps_shops_rentals_and_sales', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('type');
$table->string('name')->nullable();
$table->string('number')->nullable();
$table->integer('floor');
$table->string('sector')->nullable();
$table->text('description')->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
});
}
public function down()
{
Schema::dropIfExists('tps_shops_rentals_and_sales');
}
}

View File

@ -90,3 +90,6 @@
1.0.31: 1.0.31:
- 'Created table tps_shops_notification' - 'Created table tps_shops_notification'
- builder_table_create_tps_shops_notification.php - builder_table_create_tps_shops_notification.php
1.0.32:
- 'Created table tps_shops_rentals_and_sales'
- builder_table_create_tps_shops_rentals_and_sales.php

View File

@ -42,7 +42,8 @@ function initializeCustomSelect() {
// } // }
// s.options[i].setAttribute("selected", "selected"); // s.options[i].setAttribute("selected", "selected");
// console.log(s.options[i]); // console.log(s.options[i]);
handleChange(s.selectedIndex); // handleChange(s.selectedIndex, 'shops');
handleChange(s.selectedIndex, s.name);
@ -111,18 +112,261 @@ document.addEventListener("click", closeAllSelect);
initializeCustomSelect(); initializeCustomSelect();
function handleChange(selectElement) {
var floorID = selectElement; // Get the selected value of the dropdown
console.log("Selected Value:", floorID);
// **************************************************
// function afterUpdate1() {
// console.log("runned my function");
// var itemsPerPage = 1;
// var currentPage = 0;
// var items = document.querySelectorAll(".shops_item_data");
// var totalPages = Math.ceil(items.length / itemsPerPage);
// var nextButton = document.querySelector(".next-button");
// var prevButton = document.querySelector(".prev-button");
// var pageInput = document.querySelector(".input_page");
// var paginationBlock = document.querySelector("#all_pagination");
// // Initially hide all items except the first page
// for (var i = itemsPerPage; i < items.length; i++) {
// items[i].style.display = "none";
// }
// updatePagination();
// prevButton.addEventListener("click", function () {
// if (currentPage > 0) {
// currentPage--;
// updatePagination();
// }
// });
// nextButton.addEventListener("click", function () {
// if (currentPage < totalPages - 1) {
// currentPage++;
// updatePagination();
// }
// });
// function updatePagination() {
// var startIndex = currentPage * itemsPerPage;
// var endIndex = startIndex + itemsPerPage;
// for (var i = 0; i < items.length; i++) {
// if (i >= startIndex && i < endIndex) {
// items[i].style.display = "block";
// } else {
// items[i].style.display = "none";
// }
// }
// if(pageInput.value != null)
// {
// pageInput.value = currentPage + 1; // Update input field value
// }
// }
// };
// function afterUpdate2() {
// var itemsPerPage = 9;
// var currentPage = 0;
// var items = document.querySelectorAll("#rentals .shops_item");
// var totalPages = Math.ceil(items.length / itemsPerPage);
// var nextButton = document.querySelector("#rentals_pagination .next-button");
// var prevButton = document.querySelector("#rentals_pagination .prev-button");
// var pageInput = document.querySelector("#rentals_pagination .input_page");
// var paginationBlock = document.querySelector("#rentals_pagination");
// // Initially hide all items except the first page
// for (var i = itemsPerPage; i < items.length; i++) {
// items[i].style.display = "none";
// }
// updatePagination();
// prevButton.addEventListener("click", function () {
// if (currentPage > 0) {
// currentPage--;
// updatePagination();
// }
// });
// nextButton.addEventListener("click", function () {
// if (currentPage < totalPages - 1) {
// currentPage++;
// updatePagination();
// }
// });
// function updatePagination() {
// var startIndex = currentPage * itemsPerPage;
// var endIndex = startIndex + itemsPerPage;
// for (var i = 0; i < items.length; i++) {
// if (i >= startIndex && i < endIndex) {
// items[i].style.display = "block";
// } else {
// items[i].style.display = "none";
// }
// }
// console.log(items.length);
// if(pageInput.value != null)
// {
// pageInput.value = currentPage + 1; // Update input field value
// }
// }
// };
// function afterUpdate3() {
// var itemsPerPage = 9;
// var currentPage = 0;
// var items = document.querySelectorAll("#sales .shops_item");
// var totalPages = Math.ceil(items.length / itemsPerPage);
// var nextButton = document.querySelector("#sales_pagination .next-button");
// var prevButton = document.querySelector("#sales_pagination .prev-button");
// var pageInput = document.querySelector("#sales_pagination .input_page");
// var paginationBlock = document.querySelector("#sales_pagination");
// // Initially hide all items except the first page
// for (var i = itemsPerPage; i < items.length; i++) {
// items[i].style.display = "none";
// }
// updatePagination();
// prevButton.addEventListener("click", function () {
// if (currentPage > 0) {
// currentPage--;
// updatePagination();
// }
// });
// nextButton.addEventListener("click", function () {
// if (currentPage < totalPages - 1) {
// currentPage++;
// updatePagination();
// }
// });
// function updatePagination() {
// var startIndex = currentPage * itemsPerPage;
// var endIndex = startIndex + itemsPerPage;
// for (var i = 0; i < items.length; i++) {
// if (i >= startIndex && i < endIndex) {
// items[i].style.display = "block";
// } else {
// items[i].style.display = "none";
// }
// }
// if(pageInput.value != null)
// {
// pageInput.value = currentPage + 1; // Update input field value
// }
// }
// };
// function afterUpdate4() {
// // Initially hide all pagination buttons except the one for the active tab
// var allPagination = document.querySelector('.shops_block_all_pagination');
// var rentalsPagination = document.querySelector('.shops_block_rentals_pagination');
// var salesPagination = document.querySelector('.shops_block_sales_pagination');
// allPagination.style.display = "inline-flex";
// rentalsPagination.style.display = "none";
// salesPagination.style.display = "none";
// // Handle click events on tab links
// var tabLinks = document.querySelectorAll('.shops_tab-link');
// // console.log(tabLinks);
// tabLinks.forEach(function(tabLink) {
// tabLink.addEventListener('click', function() {
// // Remove 'active' class from all tab links
// tabLinks.forEach(function(link) {
// link.classList.remove('active');
// });
// // Add 'active' class to the clicked tab link
// tabLink.classList.add('active');
// // Hide all pagination buttons
// allPagination.style.display = "none";
// rentalsPagination.style.display = "none";
// salesPagination.style.display = "none";
// // Get the data-tab attribute value of the clicked tab link
// var tabId = tabLink.getAttribute('data-tab');
// console.log(tabId + '_pagination');
// document.querySelector(tabId + '_pagination').style.display = "inline-flex";
// });
// });
// };
// **********************************************************************************************
function handleChange(selectElement,type) {
var floorID = selectElement;
if(type == 'shops')
{
console.log("Selected type:", type);
$.request('onUpdate', { $.request('onUpdate', {
data: { floorID: floorID }, data: { floorID: floorID },
update: { update: {
'home/shop_item': '#rest-all', 'home/shop_item': '#rest-all',
'home/pagination': '#pagination-container' // Update this with the correct ID or selector 'home/pagination': '#pagination-container'
} }
}); });
}
if(type == 'rentals_and_sales'){
console.log("Selected type:", type);
$.request('onUpdate', {
data: { floorID: floorID },
update: {
'home/rentals_and_sales/rentals_and_sales': '#all',
'home/rentals_and_sales/rentals': '#rentals',
'home/rentals_and_sales/sales': '#sales',
'home/rentals_and_sales/js_code': '#js_code',
},
complete: function(data) {
afterPartialUpdate();
}
});
}
return false; return false;
} }
// complete: function(data) {
// // console.log("hi");
// }
// complete: function(data) {
// // This code runs after the first AJAX request is completed
// $.request('refreshOtherPartial', {
// update: {
// 'other/partial': '#otherPartial'
// },
// complete: function(data) {
// // This code runs after the second AJAX request is completed
// console.log("Other partial refreshed");
// }
// });
// }

View File

@ -0,0 +1,104 @@
title = "rental_or_sale"
url = "/rental_or_sale/:id"
layout = "default"
is_hidden = 0
==
<?php
function onStart(){
$id = $this->param('id');
$this['sale'] = Tps\Shops\Models\RentalsAndSales::where("id", $id)->get()->first();
}
?>
==
<section class="crumb">
<div class="auto_container">
<div class="crumb_wrap">
<div class="crumb_row">
<a href="{{'home'|page}}" class="crumb_title">
<span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M1.25 12.88V6.91459C1.25 6.33752 1.51642 5.79278 1.97193 5.4385L6.85193 1.64294C7.52721 1.11773 8.47279 1.11773 9.14807 1.64294L14.0281 5.4385C14.4836 5.79278 14.75 6.33752 14.75 6.91459V12.88C14.75 13.9128 13.9128 14.75 12.88 14.75H10.75C10.4739 14.75 10.25 14.5261 10.25 14.25V11.6487C10.25 11.3855 10.207 11.1193 10.0677 10.896C9.88545 10.6039 9.64228 10.3523 9.35303 10.1595C8.95253 9.89251 8.48167 9.75 8 9.75C7.51833 9.75 7.04747 9.89251 6.64697 10.1595C6.35772 10.3523 6.11455 10.6039 5.93234 10.896C5.79305 11.1193 5.75 11.3855 5.75 11.6487V14.25C5.75 14.5261 5.52614 14.75 5.25 14.75H3.12C2.08723 14.75 1.25 13.9128 1.25 12.88Z"
stroke="#292929" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</span>
{{'Главная'|_}}
</a>
</div>
</div>
</div>
</section>
<section class="post">
<div class="auto_container">
<div class="post_wrap">
<div class="post_box">
<div class="post_info">
<h2 class="post_info-title wow fadeInUp" data-wow-duration=".3s" data-wow-delay=".1s">
{{ sale.name}}
</h2>
<div class="post_info-row">
<h6 class="post_info-cnt wow fadeInUp" data-wow-duration=".3s" data-wow-delay=".1s">
{{sale.floor}} {{'ЭТАЖ'|_}}
</h6>
<h6 class="post_info-cnt wow fadeInUp" data-wow-duration=".3s" data-wow-delay=".13s">
<span>
<svg width="18" height="17" viewBox="0 0 18 17" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M8.88949 1.41675C7.48854 1.41675 6.11905 1.83218 4.9542 2.61051C3.78935 3.38883 2.88146 4.4951 2.34534 5.78941C1.80922 7.08372 1.66895 8.50794 1.94226 9.88197C2.21557 11.256 2.89019 12.5181 3.88082 13.5088C4.87144 14.4994 6.13357 15.174 7.5076 15.4473C8.88163 15.7206 10.3059 15.5803 11.6002 15.0442C12.8945 14.5081 14.0007 13.6002 14.7791 12.4354C15.5574 11.2705 15.9728 9.90103 15.9728 8.50008C15.9728 7.56989 15.7896 6.6488 15.4336 5.78941C15.0777 4.93002 14.5559 4.14916 13.8982 3.49141C13.2404 2.83366 12.4596 2.31191 11.6002 1.95593C10.7408 1.59996 9.81969 1.41675 8.88949 1.41675ZM8.88949 14.1667C7.76873 14.1667 6.67314 13.8344 5.74126 13.2117C4.80938 12.5891 4.08307 11.7041 3.65417 10.6686C3.22528 9.63317 3.11306 8.4938 3.33171 7.39457C3.55036 6.29534 4.09005 5.28564 4.88255 4.49314C5.67505 3.70065 6.68475 3.16095 7.78398 2.9423C8.8832 2.72365 10.0226 2.83587 11.058 3.26476C12.0935 3.69366 12.9785 4.41997 13.6012 5.35185C14.2238 6.28373 14.5562 7.37932 14.5562 8.50008C14.5562 10.003 13.9591 11.4443 12.8964 12.507C11.8337 13.5697 10.3924 14.1667 8.88949 14.1667Z"
fill="#292929" />
<path
d="M11.7228 7.79159H9.59782V5.66659C9.59782 5.47872 9.52319 5.29856 9.39035 5.16572C9.25751 5.03288 9.07735 4.95825 8.88949 4.95825C8.70162 4.95825 8.52146 5.03288 8.38862 5.16572C8.25578 5.29856 8.18115 5.47872 8.18115 5.66659V8.49992C8.18115 8.68778 8.25578 8.86795 8.38862 9.00079C8.52146 9.13363 8.70162 9.20825 8.88949 9.20825H11.7228C11.9107 9.20825 12.0908 9.13363 12.2237 9.00079C12.3565 8.86795 12.4312 8.68778 12.4312 8.49992C12.4312 8.31206 12.3565 8.13189 12.2237 7.99905C12.0908 7.86621 11.9107 7.79159 11.7228 7.79159Z"
fill="#292929" />
</svg>
</span>
{{sale.sector}}
</h6>
<a href="tel:+993 {{sale.number}}" class="post_info-cnt wow fadeInUp" data-wow-duration=".3s" data-wow-delay=".17s">
<span>
<svg width="18" height="17" viewBox="0 0 18 17" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12.7145 15.5833C9.82257 15.5795 7.05017 14.429 5.00527 12.3841C2.96037 10.3392 1.8099 7.56684 1.80615 4.67492C1.80615 3.81075 2.14944 2.98198 2.7605 2.37093C3.37155 1.75987 4.20032 1.41658 5.06449 1.41658C5.24748 1.41519 5.43016 1.4318 5.6099 1.46617C5.78366 1.49188 5.95448 1.53459 6.1199 1.59367C6.23624 1.63449 6.33992 1.70497 6.42067 1.79814C6.50142 1.89132 6.55645 2.00396 6.58032 2.12492L7.55074 6.37492C7.57689 6.49028 7.57374 6.61035 7.54157 6.72419C7.5094 6.83802 7.44924 6.94198 7.36657 7.02659C7.27449 7.12575 7.2674 7.13283 6.39615 7.58617C7.09386 9.11677 8.318 10.3459 9.84574 11.0499C10.3062 10.1716 10.3132 10.1645 10.4124 10.0724C10.497 9.98975 10.601 9.92958 10.7148 9.89741C10.8286 9.86524 10.9487 9.86209 11.0641 9.88825L15.3141 10.8587C15.4312 10.8858 15.5394 10.9424 15.6286 11.0229C15.7179 11.1034 15.7851 11.2054 15.8241 11.3191C15.8839 11.4872 15.9289 11.6602 15.9587 11.8362C15.9872 12.0142 16.0014 12.1942 16.0012 12.3745C15.9881 13.235 15.6352 14.0553 15.0194 14.6565C14.4036 15.2577 13.575 15.5908 12.7145 15.5833ZM5.06449 2.83325C4.57662 2.83512 4.10927 3.02975 3.76429 3.37472C3.41932 3.7197 3.22468 4.18705 3.22282 4.67492C3.2247 7.19169 4.22531 9.60484 6.00494 11.3845C7.78456 13.1641 10.1977 14.1647 12.7145 14.1666C13.2024 14.1647 13.6697 13.9701 14.0147 13.6251C14.3597 13.2801 14.5543 12.8128 14.5562 12.3249V12.0912L11.2695 11.3333L11.0641 11.7228C10.7453 12.3391 10.5116 12.7853 9.91657 12.5445C8.74278 12.1244 7.67731 11.448 6.79759 10.5646C5.91787 9.68123 5.24598 8.61295 4.83074 7.43742C4.57574 6.88492 5.0574 6.62992 5.66657 6.31117L6.05615 6.11992L5.29824 2.83325H5.06449Z"
fill="#292929" />
</svg>
</span>
+993 {{sale.number}}
</a>
</div>
<div class="post_info-txt wow fadeInUp" data-wow-duration=".3s" data-wow-delay=".23s">
{{sale.name}}
</div>
</div>
{% if sale.images|length > 0%}
<div class="post_photo wow fadeInRight" data-wow-duration=".3s" data-wow-delay=".1s">
<div class="shop_slider">
{% for image in sale.images %}
<div class="shop_slider-item">
<img src="{{image.path}}" alt="restaurant-photo">
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,249 @@
title = "rentals_and_sales"
url = "/rentals_and_sales"
layout = "default"
is_hidden = 0
==
<?php
function onStart(){
$this['rentals_and_sales'] = Tps\Shops\Models\RentalsAndSales::orderBy('id', 'desc')->get();
$this['rentals_and_sales_all'] = $this['rentals_and_sales'];
$this['rentals'] = $this['rentals_and_sales']->where("type", "rental");
$this['sales'] = $this['rentals_and_sales']->where("type", "sale");
//dd($this['sales']);
}
function onUpdate()
{
$floorID = post('floorID');
$floorID = strval(intval($floorID) - 1);
//dd($floorID);
$this['floor_data'] = Tps\Shops\Models\RentalsAndSales::orderBy('created_at')->where('floor', $floorID)->get();
$this['rentals_and_sales_all'] = $this['floor_data'];
$this['rentals'] = $this['floor_data']->where("type", "rental");
$this['sales'] = $this['floor_data']->where("type", "sale");
//dd($this['rentals_and_sales_all']);
//dd(['rentals_and_sales_all' => $this['rentals_and_sales_all'], 'rentals' => $this['rentals'], 'sales' => $this['sales']]);
return [
'home/rentals_and_sales/rentals_and_sales' => $this->renderPartial('home/rentals_and_sales/rentals_and_sales', ['rentals_and_sales_all' => $this['rentals_and_sales_all']]),
'home/rentals_and_sales/rentals' => $this->renderPartial('home/rentals_and_sales/rentals', ['rentals' => $this['rentals']]),
'home/rentals_and_sales/sales' => $this->renderPartial('home/rentals_and_sales/sales', ['sales' => $this['sales']])
];
}
?>
==
<section class="crumb">
<div class="auto_container">
<div class="crumb_wrap">
<div class="crumb_row">
<a href="{{'home'|page}}" class="crumb_title">
<span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M1.25 12.88V6.91459C1.25 6.33752 1.51642 5.79278 1.97193 5.4385L6.85193 1.64294C7.52721 1.11773 8.47279 1.11773 9.14807 1.64294L14.0281 5.4385C14.4836 5.79278 14.75 6.33752 14.75 6.91459V12.88C14.75 13.9128 13.9128 14.75 12.88 14.75H10.75C10.4739 14.75 10.25 14.5261 10.25 14.25V11.6487C10.25 11.3855 10.207 11.1193 10.0677 10.896C9.88545 10.6039 9.64228 10.3523 9.35303 10.1595C8.95253 9.89251 8.48167 9.75 8 9.75C7.51833 9.75 7.04747 9.89251 6.64697 10.1595C6.35772 10.3523 6.11455 10.6039 5.93234 10.896C5.79305 11.1193 5.75 11.3855 5.75 11.6487V14.25C5.75 14.5261 5.52614 14.75 5.25 14.75H3.12C2.08723 14.75 1.25 13.9128 1.25 12.88Z"
stroke="#292929" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</span>
{{'Главная'|_}}
</a>
<h4 class="crumb_title">
{{'Аренда и продажа '|_}}
</h4>
</div>
</div>
</div>
</section>
<!-- Shops ============================ -->
<style>
.pagination-buttons{
margin-top: 30px;
}
</style>
<section class="shops">
<div class="auto_container">
<div class="shops_wrap">
<div class="shops_sort">
<form action="{{ 'search_rentals_and_sales'|page }}" method="GET" class="menu_search">
<div class="shops_search">
<input type="text" name="q" placeholder="{{'Поиск аренды и продажи'|_}}">
<button type="submit">
<svg width="19" height="19" viewBox="0 0 19 19" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M17.71 16.29L14.31 12.9C15.407 11.5025 16.0022 9.77666 16 8C16 6.41775 15.5308 4.87103 14.6518 3.55544C13.7727 2.23985 12.5233 1.21447 11.0615 0.608967C9.59966 0.00346625 7.99113 -0.15496 6.43928 0.153721C4.88743 0.462403 3.46197 1.22433 2.34315 2.34315C1.22433 3.46197 0.462403 4.88743 0.153721 6.43928C-0.15496 7.99113 0.00346625 9.59966 0.608967 11.0615C1.21447 12.5233 2.23985 13.7727 3.55544 14.6518C4.87103 15.5308 6.41775 16 8 16C9.77666 16.0022 11.5025 15.407 12.9 14.31L16.29 17.71C16.383 17.8037 16.4936 17.8781 16.6154 17.9289C16.7373 17.9797 16.868 18.0058 17 18.0058C17.132 18.0058 17.2627 17.9797 17.3846 17.9289C17.5064 17.8781 17.617 17.8037 17.71 17.71C17.8037 17.617 17.8781 17.5064 17.9289 17.3846C17.9797 17.2627 18.0058 17.132 18.0058 17C18.0058 16.868 17.9797 16.7373 17.9289 16.6154C17.8781 16.4936 17.8037 16.383 17.71 16.29ZM2 8C2 6.81332 2.3519 5.65328 3.01119 4.66658C3.67047 3.67989 4.60755 2.91085 5.7039 2.45673C6.80026 2.0026 8.00666 1.88378 9.17055 2.11529C10.3344 2.3468 11.4035 2.91825 12.2426 3.75736C13.0818 4.59648 13.6532 5.66558 13.8847 6.82946C14.1162 7.99335 13.9974 9.19975 13.5433 10.2961C13.0892 11.3925 12.3201 12.3295 11.3334 12.9888C10.3467 13.6481 9.18669 14 8 14C6.4087 14 4.88258 13.3679 3.75736 12.2426C2.63214 11.1174 2 9.5913 2 8Z"
fill="white" />
</svg>
</button>
</div>
<div class="custom-select w150" id="mySelect">
<select name="rentals_and_sales" onchange="handleChange(this)">
<option value="">{{'Все этажы'|_}}</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<div id="output"></div>
</div>
</form>
</div>
<div class="shops_tab">
<h4 class="shops_tab-link tabBtn active" data-tab="#all">
{{'ВСЕ'|_}}
</h4>
<h4 class="shops_tab-link tabBtn" data-tab="#rentals">
{{'Аренда'|_}}
</h4>
<h4 class="shops_tab-link tabBtn" data-tab="#sales">
{{'продажа'|_}}
</h4>
</div>
<!-- <div id="data_rentals_and_sales_all"> -->
<div class="shops_block tabItem active" id="all">
{% partial 'home/rentals_and_sales/rentals_and_sales' rentals_and_sales_all=rentals_and_sales_all%}
</div>
<!-- </div> -->
<div class="pag_group pagination-buttons shops_block_all_pagination" id="all_pagination">
<div class="pag_btn prev prev-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="50" height="50" rx="10" transform="rotate(-180 50 50)" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3784)">
<path d="M22.0212 25.0001C22.0211 24.9041 22.04 24.809 22.0767 24.7203C22.1134 24.6316 22.1673 24.551 22.2352 24.4831L26.7292 19.9881C26.8666 19.8507 27.0529 19.7736 27.2472 19.7736C27.4415 19.7736 27.6278 19.8507 27.7652 19.9881C27.9026 20.1255 27.9798 20.3118 27.9798 20.5061C27.9798 20.7004 27.9026 20.8867 27.7652 21.0241L23.7882 25.0001L27.7652 28.9741C27.8334 29.0421 27.8874 29.1229 27.9244 29.2119C27.9613 29.3008 27.9804 29.3961 27.9805 29.4924C27.9806 29.5887 27.9617 29.6841 27.9249 29.7731C27.8882 29.8621 27.8342 29.943 27.7662 30.0111C27.6982 30.0793 27.6174 30.1334 27.5285 30.1703C27.4395 30.2072 27.3442 30.2263 27.2479 30.2264C27.1516 30.2265 27.0562 30.2076 26.9672 30.1708C26.8782 30.1341 26.7974 30.0801 26.7292 30.0121L22.2352 25.5171C22.1673 25.4493 22.1134 25.3687 22.0767 25.2799C22.04 25.1912 22.0211 25.0961 22.0212 25.0001Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3784">
<rect width="10.452" height="5.958" fill="white" transform="translate(27.9785 19.774) rotate(90)"></rect>
</clipPath>
</defs>
</svg>
</div>
<input type="text" name="page" value="1" class="input_page" disabled>
<div class="pag_btn next next-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" rx="10" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3788)">
<path d="M27.9808 24.9999C27.9808 25.0959 27.962 25.191 27.9253 25.2797C27.8885 25.3684 27.8347 25.449 27.7668 25.5169L23.2728 30.0119C23.1354 30.1493 22.949 30.2264 22.7548 30.2264C22.5605 30.2264 22.3741 30.1493 22.2368 30.0119C22.0994 29.8745 22.0222 29.6882 22.0222 29.4939C22.0222 29.2996 22.0994 29.1133 22.2368 28.9759L26.2138 24.9999L22.2368 21.0259C22.1686 20.9579 22.1145 20.8771 22.0776 20.7881C22.0406 20.6992 22.0216 20.6039 22.0215 20.5076C22.0214 20.4113 22.0403 20.3159 22.077 20.2269C22.1138 20.1379 22.1677 20.057 22.2358 19.9889C22.3038 19.9207 22.3846 19.8666 22.4735 19.8297C22.5624 19.7928 22.6578 19.7737 22.754 19.7736C22.8503 19.7735 22.9457 19.7924 23.0347 19.8292C23.1237 19.8659 23.2046 19.9199 23.2728 19.9879L27.7668 24.4829C27.8347 24.5507 27.8885 24.6313 27.9253 24.7201C27.962 24.8088 27.9808 24.9039 27.9808 24.9999Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3788">
<rect width="10.452" height="5.958" fill="white" transform="translate(22.0215 30.226) rotate(-90)"></rect>
</clipPath>
</defs>
</svg>
</div>
</div>
<!-- <div id="data_rentals"> -->
<div class="shops_block tabItem" id="rentals">
{% partial 'home/rentals_and_sales/rentals' rentals=rentals%}
</div>
<!-- </div> -->
<div class="pag_group pagination-buttons shops_block_rentals_pagination" id="rentals_pagination">
<div class="pag_btn prev prev-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="50" height="50" rx="10" transform="rotate(-180 50 50)" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3784)">
<path d="M22.0212 25.0001C22.0211 24.9041 22.04 24.809 22.0767 24.7203C22.1134 24.6316 22.1673 24.551 22.2352 24.4831L26.7292 19.9881C26.8666 19.8507 27.0529 19.7736 27.2472 19.7736C27.4415 19.7736 27.6278 19.8507 27.7652 19.9881C27.9026 20.1255 27.9798 20.3118 27.9798 20.5061C27.9798 20.7004 27.9026 20.8867 27.7652 21.0241L23.7882 25.0001L27.7652 28.9741C27.8334 29.0421 27.8874 29.1229 27.9244 29.2119C27.9613 29.3008 27.9804 29.3961 27.9805 29.4924C27.9806 29.5887 27.9617 29.6841 27.9249 29.7731C27.8882 29.8621 27.8342 29.943 27.7662 30.0111C27.6982 30.0793 27.6174 30.1334 27.5285 30.1703C27.4395 30.2072 27.3442 30.2263 27.2479 30.2264C27.1516 30.2265 27.0562 30.2076 26.9672 30.1708C26.8782 30.1341 26.7974 30.0801 26.7292 30.0121L22.2352 25.5171C22.1673 25.4493 22.1134 25.3687 22.0767 25.2799C22.04 25.1912 22.0211 25.0961 22.0212 25.0001Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3784">
<rect width="10.452" height="5.958" fill="white" transform="translate(27.9785 19.774) rotate(90)"></rect>
</clipPath>
</defs>
</svg>
</div>
<input type="text" name="page" value="1" class="input_page" disabled>
<div class="pag_btn next next-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" rx="10" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3788)">
<path d="M27.9808 24.9999C27.9808 25.0959 27.962 25.191 27.9253 25.2797C27.8885 25.3684 27.8347 25.449 27.7668 25.5169L23.2728 30.0119C23.1354 30.1493 22.949 30.2264 22.7548 30.2264C22.5605 30.2264 22.3741 30.1493 22.2368 30.0119C22.0994 29.8745 22.0222 29.6882 22.0222 29.4939C22.0222 29.2996 22.0994 29.1133 22.2368 28.9759L26.2138 24.9999L22.2368 21.0259C22.1686 20.9579 22.1145 20.8771 22.0776 20.7881C22.0406 20.6992 22.0216 20.6039 22.0215 20.5076C22.0214 20.4113 22.0403 20.3159 22.077 20.2269C22.1138 20.1379 22.1677 20.057 22.2358 19.9889C22.3038 19.9207 22.3846 19.8666 22.4735 19.8297C22.5624 19.7928 22.6578 19.7737 22.754 19.7736C22.8503 19.7735 22.9457 19.7924 23.0347 19.8292C23.1237 19.8659 23.2046 19.9199 23.2728 19.9879L27.7668 24.4829C27.8347 24.5507 27.8885 24.6313 27.9253 24.7201C27.962 24.8088 27.9808 24.9039 27.9808 24.9999Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3788">
<rect width="10.452" height="5.958" fill="white" transform="translate(22.0215 30.226) rotate(-90)"></rect>
</clipPath>
</defs>
</svg>
</div>
</div>
<!-- <div id="data_sales"> -->
<div class="shops_block tabItem" id="sales">
{% partial 'home/rentals_and_sales/sales' sales=sales%}
</div>
<!-- </div> -->
<div class="pag_group pagination-buttons shops_block_sales_pagination" id="sales_pagination">
<div class="pag_btn prev prev-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="50" height="50" rx="10" transform="rotate(-180 50 50)" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3784)">
<path d="M22.0212 25.0001C22.0211 24.9041 22.04 24.809 22.0767 24.7203C22.1134 24.6316 22.1673 24.551 22.2352 24.4831L26.7292 19.9881C26.8666 19.8507 27.0529 19.7736 27.2472 19.7736C27.4415 19.7736 27.6278 19.8507 27.7652 19.9881C27.9026 20.1255 27.9798 20.3118 27.9798 20.5061C27.9798 20.7004 27.9026 20.8867 27.7652 21.0241L23.7882 25.0001L27.7652 28.9741C27.8334 29.0421 27.8874 29.1229 27.9244 29.2119C27.9613 29.3008 27.9804 29.3961 27.9805 29.4924C27.9806 29.5887 27.9617 29.6841 27.9249 29.7731C27.8882 29.8621 27.8342 29.943 27.7662 30.0111C27.6982 30.0793 27.6174 30.1334 27.5285 30.1703C27.4395 30.2072 27.3442 30.2263 27.2479 30.2264C27.1516 30.2265 27.0562 30.2076 26.9672 30.1708C26.8782 30.1341 26.7974 30.0801 26.7292 30.0121L22.2352 25.5171C22.1673 25.4493 22.1134 25.3687 22.0767 25.2799C22.04 25.1912 22.0211 25.0961 22.0212 25.0001Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3784">
<rect width="10.452" height="5.958" fill="white" transform="translate(27.9785 19.774) rotate(90)"></rect>
</clipPath>
</defs>
</svg>
</div>
<input type="text" name="page" value="1" class="input_page" disabled>
<div class="pag_btn next next-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" rx="10" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3788)">
<path d="M27.9808 24.9999C27.9808 25.0959 27.962 25.191 27.9253 25.2797C27.8885 25.3684 27.8347 25.449 27.7668 25.5169L23.2728 30.0119C23.1354 30.1493 22.949 30.2264 22.7548 30.2264C22.5605 30.2264 22.3741 30.1493 22.2368 30.0119C22.0994 29.8745 22.0222 29.6882 22.0222 29.4939C22.0222 29.2996 22.0994 29.1133 22.2368 28.9759L26.2138 24.9999L22.2368 21.0259C22.1686 20.9579 22.1145 20.8771 22.0776 20.7881C22.0406 20.6992 22.0216 20.6039 22.0215 20.5076C22.0214 20.4113 22.0403 20.3159 22.077 20.2269C22.1138 20.1379 22.1677 20.057 22.2358 19.9889C22.3038 19.9207 22.3846 19.8666 22.4735 19.8297C22.5624 19.7928 22.6578 19.7737 22.754 19.7736C22.8503 19.7735 22.9457 19.7924 23.0347 19.8292C23.1237 19.8659 23.2046 19.9199 23.2728 19.9879L27.7668 24.4829C27.8347 24.5507 27.8885 24.6313 27.9253 24.7201C27.962 24.8088 27.9808 24.9039 27.9808 24.9999Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3788">
<rect width="10.452" height="5.958" fill="white" transform="translate(22.0215 30.226) rotate(-90)"></rect>
</clipPath>
</defs>
</svg>
</div>
</div>
<!-- </div> -->
</div>
</div>
</section>
<!-- Shops end ========================= -->
<div class="shops_block tabItem" id="js_code">
{% partial 'home/rentals_and_sales/js_code'%}
</div>

View File

@ -0,0 +1,81 @@
title = "search_rentals_and_sales"
url = "/search_rentals_and_sales"
layout = "default"
is_hidden = 0
==
<?php
function onStart(){
$query = '%' . input('q') . '%';
$this['data'] = Tps\Shops\Models\RentalsAndSales::where(function($queryBuilder) use ($query) {
$queryBuilder->where('name', 'LIKE', '%' . $query . '%')
->orWhere('number', 'LIKE', '%' . $query . '%')
->orWhere('sector', 'LIKE', '%' . $query . '%')
->orWhere('description', 'LIKE', '%' . $query . '%');
// Add more 'orWhere' calls for other fields as needed
})->get();
//dd($this['data']);
}
?>
==
<section class="crumb">
<div class="auto_container">
<div class="crumb_wrap">
<div class="crumb_row">
<a href="{{'home'|page}}" class="crumb_title">
<span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M1.25 12.88V6.91459C1.25 6.33752 1.51642 5.79278 1.97193 5.4385L6.85193 1.64294C7.52721 1.11773 8.47279 1.11773 9.14807 1.64294L14.0281 5.4385C14.4836 5.79278 14.75 6.33752 14.75 6.91459V12.88C14.75 13.9128 13.9128 14.75 12.88 14.75H10.75C10.4739 14.75 10.25 14.5261 10.25 14.25V11.6487C10.25 11.3855 10.207 11.1193 10.0677 10.896C9.88545 10.6039 9.64228 10.3523 9.35303 10.1595C8.95253 9.89251 8.48167 9.75 8 9.75C7.51833 9.75 7.04747 9.89251 6.64697 10.1595C6.35772 10.3523 6.11455 10.6039 5.93234 10.896C5.79305 11.1193 5.75 11.3855 5.75 11.6487V14.25C5.75 14.5261 5.52614 14.75 5.25 14.75H3.12C2.08723 14.75 1.25 13.9128 1.25 12.88Z"
stroke="#292929" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</span>
{{'Главная'|_}}
</a>
<h4 class="crumb_title">
{{'Результат поиска'|_}}
</h4>
</div>
</div>
</div>
</section>
<section class="result page">
<div class="auto_container">
<div class="result_wrap">
<form action="{{ 'search_rentals_and_sales'|page }}" method="GET" class="menu_search">
<h1 class="menu_search-title">
{{'Результат поиска'|_}}
</h1>
{% if data|length == 0 %}
<h1 class="menu_search-title">
{{'Ничего не найдено'|_}}
</h1>
<p class="menu_search-txt">
{{'К сожалению, по вашему запросу ничего не найдено. Попробуйте воспользоваться поиском еще раз'|_}}
</p>
{% endif %}
<div class="menu_search-input">
<input type="text" name="q" placeholder="Что будем искать?">
</div>
<button class="menu_search-btn" type="submit">
{{'НАЙТИ'|_}}
</button>
</form>
<div class="rest_box">
{% partial 'home/rentals_and_sales/res_rentals_and_sales' data=data %}
</div>
</div>
</div>
</section>

View File

@ -125,7 +125,7 @@ function onUpdate()
<div class="custom-select w150" id="mySelect"> <div class="custom-select w150" id="mySelect">
<select name="floorSelect" data-request="onChangeValue" onchange="handleChange(this)"> <select name="shops" data-request="onChangeValue" onchange="handleChange(this)">
<option value="">{{'Все этажы'|_}}</option> <option value="">{{'Все этажы'|_}}</option>
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
@ -144,7 +144,7 @@ function onUpdate()
<div class="rest_box"> <div class="rest_box">
<div class="rest_block tabItem active" id="rest-all"> <div class="rest_block tabItem active" id="rest-all">
{% partial 'home/shop_item' shops=shops %} {% partial 'home/shop_item' %}
</div> </div>
{% partial 'home/pagination' result=shops %} {% partial 'home/pagination' result=shops %}
</div> </div>

View File

@ -0,0 +1,383 @@
description = "rentals_and_sales"
==
<div class="shops_block tabItem active" id="all">
{% for sale in rentals_and_sales_all %}
<a href="{{ url('/') }}/rental_or_sale/{{sale.id}}" class="shops_item wow fadeInUp shops_item_data" data-wow-duration=".3s" data-wow-delay=".1s">
<div class="shops_item-photo">
<img src="{{sale.images.first.path}}" alt="shop-photo">
</div>
<h6 class="shops_item-label">
{% if sale.type == "rental"%}
{{'Аренда'|_}}
{% elseif sale.type == "sale"%}
{{'Продажа'|_}}
{% endif %}
</h6>
<div class="shops_item-info">
<h5 class="shops_item-name">
{{sale.name}}
</h5>
<h5 class="shops_item-floor">
{{sale.floor}}
<span>
{{'ЭТАЖ'|_}}
</span>
</h5>
</div>
<div class="shops_item-content">
<h4 class="shops_item-content-txt">
{{sale.name}}
</h4>
</div>
</a>
{% endfor %}
</div>
<div class="pag_group pagination-buttons shops_block_all_pagination" id="all_pagination">
<div class="pag_btn prev prev-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="50" height="50" rx="10" transform="rotate(-180 50 50)" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3784)">
<path d="M22.0212 25.0001C22.0211 24.9041 22.04 24.809 22.0767 24.7203C22.1134 24.6316 22.1673 24.551 22.2352 24.4831L26.7292 19.9881C26.8666 19.8507 27.0529 19.7736 27.2472 19.7736C27.4415 19.7736 27.6278 19.8507 27.7652 19.9881C27.9026 20.1255 27.9798 20.3118 27.9798 20.5061C27.9798 20.7004 27.9026 20.8867 27.7652 21.0241L23.7882 25.0001L27.7652 28.9741C27.8334 29.0421 27.8874 29.1229 27.9244 29.2119C27.9613 29.3008 27.9804 29.3961 27.9805 29.4924C27.9806 29.5887 27.9617 29.6841 27.9249 29.7731C27.8882 29.8621 27.8342 29.943 27.7662 30.0111C27.6982 30.0793 27.6174 30.1334 27.5285 30.1703C27.4395 30.2072 27.3442 30.2263 27.2479 30.2264C27.1516 30.2265 27.0562 30.2076 26.9672 30.1708C26.8782 30.1341 26.7974 30.0801 26.7292 30.0121L22.2352 25.5171C22.1673 25.4493 22.1134 25.3687 22.0767 25.2799C22.04 25.1912 22.0211 25.0961 22.0212 25.0001Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3784">
<rect width="10.452" height="5.958" fill="white" transform="translate(27.9785 19.774) rotate(90)"></rect>
</clipPath>
</defs>
</svg>
</div>
<input type="text" name="page" value="1" class="input_page" disabled>
<div class="pag_btn next next-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" rx="10" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3788)">
<path d="M27.9808 24.9999C27.9808 25.0959 27.962 25.191 27.9253 25.2797C27.8885 25.3684 27.8347 25.449 27.7668 25.5169L23.2728 30.0119C23.1354 30.1493 22.949 30.2264 22.7548 30.2264C22.5605 30.2264 22.3741 30.1493 22.2368 30.0119C22.0994 29.8745 22.0222 29.6882 22.0222 29.4939C22.0222 29.2996 22.0994 29.1133 22.2368 28.9759L26.2138 24.9999L22.2368 21.0259C22.1686 20.9579 22.1145 20.8771 22.0776 20.7881C22.0406 20.6992 22.0216 20.6039 22.0215 20.5076C22.0214 20.4113 22.0403 20.3159 22.077 20.2269C22.1138 20.1379 22.1677 20.057 22.2358 19.9889C22.3038 19.9207 22.3846 19.8666 22.4735 19.8297C22.5624 19.7928 22.6578 19.7737 22.754 19.7736C22.8503 19.7735 22.9457 19.7924 23.0347 19.8292C23.1237 19.8659 23.2046 19.9199 23.2728 19.9879L27.7668 24.4829C27.8347 24.5507 27.8885 24.6313 27.9253 24.7201C27.962 24.8088 27.9808 24.9039 27.9808 24.9999Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3788">
<rect width="10.452" height="5.958" fill="white" transform="translate(22.0215 30.226) rotate(-90)"></rect>
</clipPath>
</defs>
</svg>
</div>
</div>
<div class="shops_block tabItem" id="rentals">
{% for sale in rentals %}
<a href="{{ url('/') }}/rental_or_sale/{{sale.id}}" class="shops_item">
<div class="shops_item-photo">
<img src="{{sale.images.first.path}}" alt="shop-photo">
</div>
<h6 class="shops_item-label">
{{'Аренда'|_}}
</h6>
<div class="shops_item-content">
<h4 class="shops_item-content-txt">
{{sale.name}}
</h4>
</div>
</a>
{% endfor %}
</div>
<div class="pag_group pagination-buttons shops_block_rentals_pagination" id="rentals_pagination">
<div class="pag_btn prev prev-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="50" height="50" rx="10" transform="rotate(-180 50 50)" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3784)">
<path d="M22.0212 25.0001C22.0211 24.9041 22.04 24.809 22.0767 24.7203C22.1134 24.6316 22.1673 24.551 22.2352 24.4831L26.7292 19.9881C26.8666 19.8507 27.0529 19.7736 27.2472 19.7736C27.4415 19.7736 27.6278 19.8507 27.7652 19.9881C27.9026 20.1255 27.9798 20.3118 27.9798 20.5061C27.9798 20.7004 27.9026 20.8867 27.7652 21.0241L23.7882 25.0001L27.7652 28.9741C27.8334 29.0421 27.8874 29.1229 27.9244 29.2119C27.9613 29.3008 27.9804 29.3961 27.9805 29.4924C27.9806 29.5887 27.9617 29.6841 27.9249 29.7731C27.8882 29.8621 27.8342 29.943 27.7662 30.0111C27.6982 30.0793 27.6174 30.1334 27.5285 30.1703C27.4395 30.2072 27.3442 30.2263 27.2479 30.2264C27.1516 30.2265 27.0562 30.2076 26.9672 30.1708C26.8782 30.1341 26.7974 30.0801 26.7292 30.0121L22.2352 25.5171C22.1673 25.4493 22.1134 25.3687 22.0767 25.2799C22.04 25.1912 22.0211 25.0961 22.0212 25.0001Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3784">
<rect width="10.452" height="5.958" fill="white" transform="translate(27.9785 19.774) rotate(90)"></rect>
</clipPath>
</defs>
</svg>
</div>
<input type="text" name="page" value="1" class="input_page" disabled>
<div class="pag_btn next next-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" rx="10" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3788)">
<path d="M27.9808 24.9999C27.9808 25.0959 27.962 25.191 27.9253 25.2797C27.8885 25.3684 27.8347 25.449 27.7668 25.5169L23.2728 30.0119C23.1354 30.1493 22.949 30.2264 22.7548 30.2264C22.5605 30.2264 22.3741 30.1493 22.2368 30.0119C22.0994 29.8745 22.0222 29.6882 22.0222 29.4939C22.0222 29.2996 22.0994 29.1133 22.2368 28.9759L26.2138 24.9999L22.2368 21.0259C22.1686 20.9579 22.1145 20.8771 22.0776 20.7881C22.0406 20.6992 22.0216 20.6039 22.0215 20.5076C22.0214 20.4113 22.0403 20.3159 22.077 20.2269C22.1138 20.1379 22.1677 20.057 22.2358 19.9889C22.3038 19.9207 22.3846 19.8666 22.4735 19.8297C22.5624 19.7928 22.6578 19.7737 22.754 19.7736C22.8503 19.7735 22.9457 19.7924 23.0347 19.8292C23.1237 19.8659 23.2046 19.9199 23.2728 19.9879L27.7668 24.4829C27.8347 24.5507 27.8885 24.6313 27.9253 24.7201C27.962 24.8088 27.9808 24.9039 27.9808 24.9999Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3788">
<rect width="10.452" height="5.958" fill="white" transform="translate(22.0215 30.226) rotate(-90)"></rect>
</clipPath>
</defs>
</svg>
</div>
</div>
<div class="shops_block tabItem" id="sales">
{% for sale in sales %}
<a href="{{ url('/') }}/rental_or_sale/{{sale.id}}" class="shops_item">
<div class="shops_item-photo">
<img src="{{sale.images.first.path}}" alt="shop-photo">
</div>
<h6 class="shops_item-label">
{{'Продажа'|_}}
</h6>
<div class="shops_item-content">
<h4 class="shops_item-content-txt">
{{sale.name}}
</h4>
</div>
</a>
{% endfor %}
</div>
<div class="pag_group pagination-buttons shops_block_sales_pagination" id="sales_pagination">
<div class="pag_btn prev prev-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="50" height="50" rx="10" transform="rotate(-180 50 50)" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3784)">
<path d="M22.0212 25.0001C22.0211 24.9041 22.04 24.809 22.0767 24.7203C22.1134 24.6316 22.1673 24.551 22.2352 24.4831L26.7292 19.9881C26.8666 19.8507 27.0529 19.7736 27.2472 19.7736C27.4415 19.7736 27.6278 19.8507 27.7652 19.9881C27.9026 20.1255 27.9798 20.3118 27.9798 20.5061C27.9798 20.7004 27.9026 20.8867 27.7652 21.0241L23.7882 25.0001L27.7652 28.9741C27.8334 29.0421 27.8874 29.1229 27.9244 29.2119C27.9613 29.3008 27.9804 29.3961 27.9805 29.4924C27.9806 29.5887 27.9617 29.6841 27.9249 29.7731C27.8882 29.8621 27.8342 29.943 27.7662 30.0111C27.6982 30.0793 27.6174 30.1334 27.5285 30.1703C27.4395 30.2072 27.3442 30.2263 27.2479 30.2264C27.1516 30.2265 27.0562 30.2076 26.9672 30.1708C26.8782 30.1341 26.7974 30.0801 26.7292 30.0121L22.2352 25.5171C22.1673 25.4493 22.1134 25.3687 22.0767 25.2799C22.04 25.1912 22.0211 25.0961 22.0212 25.0001Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3784">
<rect width="10.452" height="5.958" fill="white" transform="translate(27.9785 19.774) rotate(90)"></rect>
</clipPath>
</defs>
</svg>
</div>
<input type="text" name="page" value="1" class="input_page" disabled>
<div class="pag_btn next next-button">
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" rx="10" fill="#FFB100"></rect>
<g clip-path="url(#clip0_551_3788)">
<path d="M27.9808 24.9999C27.9808 25.0959 27.962 25.191 27.9253 25.2797C27.8885 25.3684 27.8347 25.449 27.7668 25.5169L23.2728 30.0119C23.1354 30.1493 22.949 30.2264 22.7548 30.2264C22.5605 30.2264 22.3741 30.1493 22.2368 30.0119C22.0994 29.8745 22.0222 29.6882 22.0222 29.4939C22.0222 29.2996 22.0994 29.1133 22.2368 28.9759L26.2138 24.9999L22.2368 21.0259C22.1686 20.9579 22.1145 20.8771 22.0776 20.7881C22.0406 20.6992 22.0216 20.6039 22.0215 20.5076C22.0214 20.4113 22.0403 20.3159 22.077 20.2269C22.1138 20.1379 22.1677 20.057 22.2358 19.9889C22.3038 19.9207 22.3846 19.8666 22.4735 19.8297C22.5624 19.7928 22.6578 19.7737 22.754 19.7736C22.8503 19.7735 22.9457 19.7924 23.0347 19.8292C23.1237 19.8659 23.2046 19.9199 23.2728 19.9879L27.7668 24.4829C27.8347 24.5507 27.8885 24.6313 27.9253 24.7201C27.962 24.8088 27.9808 24.9039 27.9808 24.9999Z" fill="#292929"></path>
</g>
<defs>
<clipPath id="clip0_551_3788">
<rect width="10.452" height="5.958" fill="white" transform="translate(22.0215 30.226) rotate(-90)"></rect>
</clipPath>
</defs>
</svg>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
var itemsPerPage = 9;
var currentPage = 0;
var items = document.querySelectorAll(".shops_item_data");
var totalPages = Math.ceil(items.length / itemsPerPage);
var nextButton = document.querySelector(".next-button");
var prevButton = document.querySelector(".prev-button");
var pageInput = document.querySelector(".input_page");
var paginationBlock = document.querySelector("#all_pagination");
// Initially hide all items except the first page
for (var i = itemsPerPage; i < items.length; i++) {
items[i].style.display = "none";
}
updatePagination();
prevButton.addEventListener("click", function () {
if (currentPage > 0) {
currentPage--;
updatePagination();
}
});
nextButton.addEventListener("click", function () {
if (currentPage < totalPages - 1) {
currentPage++;
updatePagination();
}
});
function updatePagination() {
var startIndex = currentPage * itemsPerPage;
var endIndex = startIndex + itemsPerPage;
for (var i = 0; i < items.length; i++) {
if (i >= startIndex && i < endIndex) {
items[i].style.display = "block";
} else {
items[i].style.display = "none";
}
}
if(pageInput.value != null)
{
pageInput.value = currentPage + 1; // Update input field value
}
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
var itemsPerPage = 9;
var currentPage = 0;
var items = document.querySelectorAll("#rentals .shops_item");
var totalPages = Math.ceil(items.length / itemsPerPage);
var nextButton = document.querySelector("#rentals_pagination .next-button");
var prevButton = document.querySelector("#rentals_pagination .prev-button");
var pageInput = document.querySelector("#rentals_pagination .input_page");
var paginationBlock = document.querySelector("#rentals_pagination");
// Initially hide all items except the first page
for (var i = itemsPerPage; i < items.length; i++) {
items[i].style.display = "none";
}
updatePagination();
prevButton.addEventListener("click", function () {
if (currentPage > 0) {
currentPage--;
updatePagination();
}
});
nextButton.addEventListener("click", function () {
if (currentPage < totalPages - 1) {
currentPage++;
updatePagination();
}
});
function updatePagination() {
var startIndex = currentPage * itemsPerPage;
var endIndex = startIndex + itemsPerPage;
for (var i = 0; i < items.length; i++) {
if (i >= startIndex && i < endIndex) {
items[i].style.display = "block";
} else {
items[i].style.display = "none";
}
}
console.log(items.length);
if(pageInput.value != null)
{
pageInput.value = currentPage + 1; // Update input field value
}
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
var itemsPerPage = 9;
var currentPage = 0;
var items = document.querySelectorAll("#sales .shops_item");
var totalPages = Math.ceil(items.length / itemsPerPage);
var nextButton = document.querySelector("#sales_pagination .next-button");
var prevButton = document.querySelector("#sales_pagination .prev-button");
var pageInput = document.querySelector("#sales_pagination .input_page");
var paginationBlock = document.querySelector("#sales_pagination");
// Initially hide all items except the first page
for (var i = itemsPerPage; i < items.length; i++) {
items[i].style.display = "none";
}
updatePagination();
prevButton.addEventListener("click", function () {
if (currentPage > 0) {
currentPage--;
updatePagination();
}
});
nextButton.addEventListener("click", function () {
if (currentPage < totalPages - 1) {
currentPage++;
updatePagination();
}
});
function updatePagination() {
var startIndex = currentPage * itemsPerPage;
var endIndex = startIndex + itemsPerPage;
for (var i = 0; i < items.length; i++) {
if (i >= startIndex && i < endIndex) {
items[i].style.display = "block";
} else {
items[i].style.display = "none";
}
}
if(pageInput.value != null)
{
pageInput.value = currentPage + 1; // Update input field value
}
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Initially hide all pagination buttons except the one for the active tab
var allPagination = document.querySelector('.shops_block_all_pagination');
var rentalsPagination = document.querySelector('.shops_block_rentals_pagination');
var salesPagination = document.querySelector('.shops_block_sales_pagination');
allPagination.style.display = "inline-flex";
rentalsPagination.style.display = "none";
salesPagination.style.display = "none";
// Handle click events on tab links
var tabLinks = document.querySelectorAll('.shops_tab-link');
// console.log(tabLinks);
tabLinks.forEach(function(tabLink) {
tabLink.addEventListener('click', function() {
// Remove 'active' class from all tab links
tabLinks.forEach(function(link) {
link.classList.remove('active');
});
// Add 'active' class to the clicked tab link
tabLink.classList.add('active');
// Hide all pagination buttons
allPagination.style.display = "none";
rentalsPagination.style.display = "none";
salesPagination.style.display = "none";
// Get the data-tab attribute value of the clicked tab link
var tabId = tabLink.getAttribute('data-tab');
console.log(tabId + '_pagination');
document.querySelector(tabId + '_pagination').style.display = "inline-flex";
});
});
});
</script>

View File

@ -0,0 +1,237 @@
<script>
function afterUpdate1() {
console.log("runned my function");
var itemsPerPage = 9;
var currentPage = 0;
var items = document.querySelectorAll(".shops_item_data");
var totalPages = Math.ceil(items.length / itemsPerPage);
var nextButton = document.querySelector(".next-button");
var prevButton = document.querySelector(".prev-button");
var pageInput = document.querySelector(".input_page");
var paginationBlock = document.querySelector("#all_pagination");
// Initially hide all items except the first page
for (var i = itemsPerPage; i < items.length; i++) {
items[i].style.display = "none";
}
updatePagination();
prevButton.addEventListener("click", function () {
if (currentPage > 0) {
currentPage--;
updatePagination();
}
});
nextButton.addEventListener("click", function () {
if (currentPage < totalPages - 1) {
currentPage++;
updatePagination();
}
});
function updatePagination() {
var startIndex = currentPage * itemsPerPage;
var endIndex = startIndex + itemsPerPage;
for (var i = 0; i < items.length; i++) {
if (i >= startIndex && i < endIndex) {
items[i].style.display = "block";
} else {
items[i].style.display = "none";
}
}
if(pageInput.value != null)
{
pageInput.value = currentPage + 1; // Update input field value
}
}
};
function afterUpdate2() {
var itemsPerPage = 9;
var currentPage = 0;
var items = document.querySelectorAll("#rentals .shops_item");
var totalPages = Math.ceil(items.length / itemsPerPage);
var nextButton = document.querySelector("#rentals_pagination .next-button");
var prevButton = document.querySelector("#rentals_pagination .prev-button");
var pageInput = document.querySelector("#rentals_pagination .input_page");
var paginationBlock = document.querySelector("#rentals_pagination");
// Initially hide all items except the first page
for (var i = itemsPerPage; i < items.length; i++) {
items[i].style.display = "none";
}
updatePagination();
prevButton.addEventListener("click", function () {
if (currentPage > 0) {
currentPage--;
updatePagination();
}
});
nextButton.addEventListener("click", function () {
if (currentPage < totalPages - 1) {
currentPage++;
updatePagination();
}
});
function updatePagination() {
var startIndex = currentPage * itemsPerPage;
var endIndex = startIndex + itemsPerPage;
for (var i = 0; i < items.length; i++) {
if (i >= startIndex && i < endIndex) {
items[i].style.display = "block";
} else {
items[i].style.display = "none";
}
}
console.log(items.length);
if(pageInput.value != null)
{
pageInput.value = currentPage + 1; // Update input field value
}
}
};
function afterUpdate3() {
var itemsPerPage = 9;
var currentPage = 0;
var items = document.querySelectorAll("#sales .shops_item");
var totalPages = Math.ceil(items.length / itemsPerPage);
var nextButton = document.querySelector("#sales_pagination .next-button");
var prevButton = document.querySelector("#sales_pagination .prev-button");
var pageInput = document.querySelector("#sales_pagination .input_page");
var paginationBlock = document.querySelector("#sales_pagination");
// Initially hide all items except the first page
for (var i = itemsPerPage; i < items.length; i++) {
items[i].style.display = "none";
}
updatePagination();
prevButton.addEventListener("click", function () {
if (currentPage > 0) {
currentPage--;
updatePagination();
}
});
nextButton.addEventListener("click", function () {
if (currentPage < totalPages - 1) {
currentPage++;
updatePagination();
}
});
function updatePagination() {
var startIndex = currentPage * itemsPerPage;
var endIndex = startIndex + itemsPerPage;
for (var i = 0; i < items.length; i++) {
if (i >= startIndex && i < endIndex) {
items[i].style.display = "block";
} else {
items[i].style.display = "none";
}
}
if(pageInput.value != null)
{
pageInput.value = currentPage + 1; // Update input field value
}
}
};
function afterUpdate4() {
// Initially hide all pagination buttons except the one for the active tab
var allPagination = document.querySelector('.shops_block_all_pagination');
var rentalsPagination = document.querySelector('.shops_block_rentals_pagination');
var salesPagination = document.querySelector('.shops_block_sales_pagination');
allPagination.style.display = "inline-flex";
rentalsPagination.style.display = "none";
salesPagination.style.display = "none";
// Handle click events on tab links
var tabLinks = document.querySelectorAll('.shops_tab-link');
// console.log(tabLinks);
tabLinks.forEach(function(tabLink) {
tabLink.addEventListener('click', function() {
// Remove 'active' class from all tab links
tabLinks.forEach(function(link) {
link.classList.remove('active');
});
// Add 'active' class to the clicked tab link
tabLink.classList.add('active');
// Hide all pagination buttons
allPagination.style.display = "none";
rentalsPagination.style.display = "none";
salesPagination.style.display = "none";
// Get the data-tab attribute value of the clicked tab link
var tabId = tabLink.getAttribute('data-tab');
console.log(tabId + '_pagination');
document.querySelector(tabId + '_pagination').style.display = "inline-flex";
});
});
};
afterUpdate1();
afterUpdate2();
afterUpdate3();
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Initially hide all pagination buttons except the one for the active tab
var allPagination = document.querySelector('.shops_block_all_pagination');
var rentalsPagination = document.querySelector('.shops_block_rentals_pagination');
var salesPagination = document.querySelector('.shops_block_sales_pagination');
allPagination.style.display = "inline-flex";
rentalsPagination.style.display = "none";
salesPagination.style.display = "none";
// Handle click events on tab links
var tabLinks = document.querySelectorAll('.shops_tab-link');
// console.log(tabLinks);
tabLinks.forEach(function(tabLink) {
tabLink.addEventListener('click', function() {
// Remove 'active' class from all tab links
tabLinks.forEach(function(link) {
link.classList.remove('active');
});
// Add 'active' class to the clicked tab link
tabLink.classList.add('active');
// Hide all pagination buttons
allPagination.style.display = "none";
rentalsPagination.style.display = "none";
salesPagination.style.display = "none";
// Get the data-tab attribute value of the clicked tab link
var tabId = tabLink.getAttribute('data-tab');
console.log(tabId + '_pagination');
document.querySelector(tabId + '_pagination').style.display = "inline-flex";
});
});
});
</script>

View File

@ -0,0 +1,21 @@
==
<!-- <div class="shops_block tabItem" id="rentals"> -->
{% for sale in rentals %}
<a href="{{ url('/') }}/rental_or_sale/{{sale.id}}" class="shops_item">
<div class="shops_item-photo">
<img src="{{sale.images.first.path}}" alt="shop-photo">
</div>
<h6 class="shops_item-label">
{{'Аренда'|_}}
</h6>
<div class="shops_item-content">
<h4 class="shops_item-content-txt">
{{sale.name}}
</h4>
</div>
</a>
{% endfor %}
<!-- </div> -->

View File

@ -0,0 +1,39 @@
==
<!-- <div class="shops_block tabItem active" id="all"> -->
{% for sale in rentals_and_sales_all %}
<a href="{{ url('/') }}/rental_or_sale/{{sale.id}}" class="shops_item wow fadeInUp shops_item_data" data-wow-duration=".3s" data-wow-delay=".1s">
<div class="shops_item-photo">
<img src="{{sale.images.first.path}}" alt="shop-photo">
</div>
<h6 class="shops_item-label">
{% if sale.type == "rental"%}
{{'Аренда'|_}}
{% elseif sale.type == "sale"%}
{{'Продажа'|_}}
{% endif %}
</h6>
<div class="shops_item-info">
<h5 class="shops_item-name">
{{sale.name}}
</h5>
<h5 class="shops_item-floor">
{{sale.floor}}
<span>
{{'ЭТАЖ'|_}}
</span>
</h5>
</div>
<div class="shops_item-content">
<h4 class="shops_item-content-txt">
{{sale.name}}
</h4>
</div>
</a>
{% endfor %}
<!-- </div> -->

View File

@ -0,0 +1,23 @@
==
{% for item in data%}
<a href="{{ url('/') }}/rental_or_sale/{{item.id}}" class="rest_item">
<div class="rest_item-photo">
<img src="{{item.images[0].path}}" alt="restaurant-photo" />
</div>
<div class="rest_item-info">
<h5 class="rest_item-title">
{{item.name}}
</h5>
<p class="rest_item-txt">
{{item.name}}, {{item.number}}, {{item.sector}}
</p>
<div class="rest_item-row">
<div class="rest_item-floor">
{{item.floor}} {{'Этаж'|_}}
</div>
</div>
</div>
</a>
{% endfor %}

View File

@ -0,0 +1,22 @@
==
<!-- <div class="shops_block tabItem" id="sales"> -->
{% for sale in sales %}
<a href="{{ url('/') }}/rental_or_sale/{{sale.id}}" class="shops_item">
<div class="shops_item-photo">
<img src="{{sale.images.first.path}}" alt="shop-photo">
</div>
<h6 class="shops_item-label">
{{'Продажа'|_}}
</h6>
<div class="shops_item-content">
<h4 class="shops_item-content-txt">
{{sale.name}}
</h4>
</div>
</a>
{% endfor %}
<!-- </div> -->