#1102 Locations are not shownig in listing page

This commit is contained in:
Diatrex 2020-03-18 11:53:46 +03:00
parent 62be7da43b
commit bd2f4cf4fb
2 changed files with 170 additions and 170 deletions

View File

@ -1,188 +1,188 @@
{% set formHtml %} {% set formHtml %}
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get"> <form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
{% endset %} {% endset %}
{% if 'cat' in param|keys %} {% if 'cat' in param|keys %}
{% if not param['cat'] is empty %} {% if not param['cat'] is empty %}
{% set catId = entries('cats', 'category').find(param['cat']) %} {% set catId = entries('cats', 'category').find(param['cat']) %}
{% set cityId = null %} {% set cityId = null %}
{% if 'city' in param|keys %} {% if 'city' in param|keys %}
{% set citiesArray = param['city'][0]|split(',') %} {% set citiesArray = param['city'][0]|split(',') %}
{% if count(citiesArray) is same as(1) %} {% if count(citiesArray) is same as(1) %}
{% set cityId = entries('location', 'cities').find(param['city'][0]) %} {% set cityId = entries('location', 'cities').find(param['city'][0]) %}
{% endif %}
{% endif %} {% endif %}
{% endif %} {% set formHtml %}
{% set formHtml %} <form action="{{ url_route('adv_list_seo', [catId.slug, cityId.slug]) }}" method="get">
<form action="{{ url_route('adv_list_seo', [catId.slug, cityId.slug]) }}" method="get">
{% endset %} {% endset %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{{ formHtml }} {{ formHtml }}
<div class="row"> <div class="row">
<input type="hidden" name="cat" value="{{ app.request.get('cat') }}"> <input type="hidden" name="cat" value="{{ app.request.get('cat') }}">
<input type="hidden" name="user" value="{{ app.request.get('user') }}"> <input type="hidden" name="user" value="{{ app.request.get('user') }}">
<div class="col-md-12 px-4"> <div class="col-md-12 px-4">
<div class="row"> <div class="row">
<div id="filter" class="w-100 mb-3"> <div id="filter" class="w-100 mb-3">
{{ addBlock('ads-list/partials/list-filter',{ {{ addBlock('ads-list/partials/list-filter',{
'mainCats':mainCats, 'mainCats':mainCats,
'subCats':subCats, 'subCats':subCats,
'ranges':ranges, 'ranges':ranges,
'checkboxes':checkboxes, 'checkboxes':checkboxes,
'topfields' : topfields, 'topfields' : topfields,
'radio':radio, 'radio':radio,
'countries':countries, 'countries':countries,
'cities':cities, 'cities':cities,
'districts':districts, 'districts':districts,
'neighborhoods':neighborhoods, 'neighborhoods':neighborhoods,
'villages':villages, 'villages':villages,
'param':param 'param':param
})|raw }} })|raw }}
<!-- Price Filter Start --> <!-- Price Filter Start -->
{% include 'visiosoft.module.advs::list/partials/price-filter' %} {% include 'visiosoft.module.advs::list/partials/price-filter' %}
<!-- Price Filter End --> <!-- Price Filter End -->
<!-- Date Filter Start --> <!-- Date Filter Start -->
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header breadcrumb mb-0" id="dateHeading"> <div class="card-header breadcrumb mb-0" id="dateHeading">
<h5 class="mb-0"> <h5 class="mb-0">
<button class="btn btn-link text-dark" data-toggle="collapse" data-target="#date" <button class="btn btn-link text-dark" data-toggle="collapse" data-target="#date"
aria-expanded="true" aria-controls="date"> aria-expanded="true" aria-controls="date">
<i class="fa fa-calendar"></i> <i class="fa fa-calendar"></i>
{{ trans("visiosoft.module.advs::field.date.name") }} {{ trans("visiosoft.module.advs::field.date.name") }}
</button> </button>
</h5> </h5>
</div>
<div id="dateContainer" class="collapse show overflow-auto" aria-labelledby="dateHeading"
data-parent="#filter"
style="max-height: 300px;">
<div class="d-flex flex-column p-3 m-0">
<div class="form-check py-1">
<input class="form-check-input"
{% if app.request.get('date') == 'day' %}
checked
{% endif %}
type="radio" name="date" id="dateDay"
value="day">
<label class="form-check-label" for="dateDay">
{{ trans("visiosoft.module.advs::field.in_the_last_24_hours.name") }}
</label>
</div>
<div class="form-check py-1">
<input class="form-check-input"
{% if app.request.get('date') == 'week' %}
checked
{% endif %}
type="radio" name="date" id="dateWeek"
value="week">
<label class="form-check-label" for="dateWeek">
{{ trans("visiosoft.module.advs::field.in_the_last_week.name") }}
</label>
</div>
<div class="form-check py-1">
<input class="form-check-input"
{% if app.request.get('date') == 'month' %}
checked
{% endif %}
type="radio" name="date" id="dateMonth"
value="month">
<label class="form-check-label" for="dateMonth">
{{ trans("visiosoft.module.advs::field.in_the_last_month.name") }}
</label>
</div>
</div>
</div>
</div> </div>
<!-- Date Filter End --> <div id="dateContainer" class="collapse show overflow-auto" aria-labelledby="dateHeading"
data-parent="#filter"
<!-- Media Filter Start --> style="max-height: 300px;">
<div class="card mb-3"> <div class="d-flex flex-column p-3 m-0">
<div class="card-header breadcrumb mb-0" id="mediaHeading"> <div class="form-check py-1">
<h5 class="mb-0"> <input class="form-check-input"
<button class="btn btn-link text-dark" data-toggle="collapse" data-target="#media" {% if app.request.get('date') == 'day' %}
aria-expanded="true" aria-controls="media">
<i class="fa fa-camera"></i>
{{ trans("visiosoft.module.advs::field.photo.name") }}
, {{ trans("visiosoft.module.advs::field.video.name") }}
</button>
</h5>
</div>
<div id="mediaContainer" class="collapse show overflow-auto" aria-labelledby="mediaHeading"
data-parent="#filter"
style="max-height: 300px;">
<div class="d-flex p-3 m-0 flex-column">
<div class="form-check py-1">
<input class="form-check-input" type="checkbox"
{% if app.request.get('photo') == true %}
checked checked
{% endif %} {% endif %}
value="true" name="photo" type="radio" name="date" id="dateDay"
id="photo"> value="day">
<label class="form-check-label" for="photo"> <label class="form-check-label" for="dateDay">
{{ trans("visiosoft.module.advs::field.ads_with_photo.name") }} {{ trans("visiosoft.module.advs::field.in_the_last_24_hours.name") }}
</label> </label>
</div> </div>
<div class="form-check py-1"> <div class="form-check py-1">
<input class="form-check-input" type="checkbox" <input class="form-check-input"
{% if app.request.get('video') == true %} {% if app.request.get('date') == 'week' %}
checked checked
{% endif %} {% endif %}
value="true" name="video" type="radio" name="date" id="dateWeek"
id="video"> value="week">
<label class="form-check-label" for="video"> <label class="form-check-label" for="dateWeek">
{{ trans("visiosoft.module.advs::field.ads_with_video.name") }} {{ trans("visiosoft.module.advs::field.in_the_last_week.name") }}
</label> </label>
</div> </div>
<div class="form-check py-1">
<input class="form-check-input"
{% if app.request.get('date') == 'month' %}
checked
{% endif %}
type="radio" name="date" id="dateMonth"
value="month">
<label class="form-check-label" for="dateMonth">
{{ trans("visiosoft.module.advs::field.in_the_last_month.name") }}
</label>
</div> </div>
</div> </div>
</div> </div>
<!-- Media Filter End --> </div>
<!-- Date Filter End -->
<!-- Map Filter Start --> <!-- Media Filter Start -->
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header breadcrumb mb-0" id="mapHeading"> <div class="card-header breadcrumb mb-0" id="mediaHeading">
<h5 class="mb-0"> <h5 class="mb-0">
<button class="btn btn-link text-dark" data-toggle="collapse" <button class="btn btn-link text-dark" data-toggle="collapse" data-target="#media"
data-target="#mapFilter" aria-expanded="true" aria-controls="media">
aria-expanded="true" aria-controls="mapFilter"> <i class="fa fa-camera"></i>
<i class="fa fa-map"></i> {{ trans("visiosoft.module.advs::field.photo.name") }}
{{ trans("visiosoft.module.advs::field.map.name") }} , {{ trans("visiosoft.module.advs::field.video.name") }}
</button> </button>
</h5> </h5>
</div> </div>
<div id="mapContainer" class="collapse show overflow-auto" aria-labelledby="mapHeading" <div id="mediaContainer" class="collapse show overflow-auto" aria-labelledby="mediaHeading"
data-parent="#filter" data-parent="#filter"
style="max-height: 300px;"> style="max-height: 300px;">
<div class="row p-3 m-0"> <div class="d-flex p-3 m-0 flex-column">
<div class="form-check py-1"> <div class="form-check py-1">
<input class="form-check-input" type="checkbox" <input class="form-check-input" type="checkbox"
{% if app.request.get('map') == true %} {% if app.request.get('photo') == true %}
checked checked
{% endif %} {% endif %}
value="true" name="map" value="true" name="photo"
id="mapFilter"> id="photo">
<label class="form-check-label" for="mapFilter"> <label class="form-check-label" for="photo">
{{ trans("visiosoft.module.advs::field.yes.name") }} {{ trans("visiosoft.module.advs::field.ads_with_photo.name") }}
</label> </label>
</div> </div>
<div class="form-check py-1">
<input class="form-check-input" type="checkbox"
{% if app.request.get('video') == true %}
checked
{% endif %}
value="true" name="video"
id="video">
<label class="form-check-label" for="video">
{{ trans("visiosoft.module.advs::field.ads_with_video.name") }}
</label>
</div> </div>
</div> </div>
</div> </div>
<!-- Map Filter End --> </div>
<!-- Media Filter End -->
<div class="card"> <!-- Map Filter Start -->
<div class="card-header bg-primary text-center" id="submitHeading"> <div class="card mb-3">
<h5 class="mb-0"> <div class="card-header breadcrumb mb-0" id="mapHeading">
<button class="btn btn-link text-white w-100"> <h5 class="mb-0">
<i class="fas fa-search"></i> <button class="btn btn-link text-dark" data-toggle="collapse"
{{ trans("visiosoft.module.advs::field.search") }} data-target="#mapFilter"
</button> aria-expanded="true" aria-controls="mapFilter">
</h5> <i class="fa fa-map"></i>
{{ trans("visiosoft.module.advs::field.map.name") }}
</button>
</h5>
</div>
<div id="mapContainer" class="collapse show overflow-auto" aria-labelledby="mapHeading"
data-parent="#filter"
style="max-height: 300px;">
<div class="row p-3 m-0">
<div class="form-check py-1">
<input class="form-check-input" type="checkbox"
{% if app.request.get('map') == true %}
checked
{% endif %}
value="true" name="map"
id="mapFilter">
<label class="form-check-label" for="mapFilter">
{{ trans("visiosoft.module.advs::field.yes.name") }}
</label>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- Map Filter End -->
<div class="card">
<div class="card-header bg-primary text-center" id="submitHeading">
<h5 class="mb-0">
<button class="btn btn-link text-white w-100">
<i class="fas fa-search"></i>
{{ trans("visiosoft.module.advs::field.search") }}
</button>
</h5>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</form> </div>
</form>

View File

@ -8,7 +8,7 @@ var village;
$('.filter-country-btn').on('click', function () { $('.filter-country-btn').on('click', function () {
if (countries == undefined) { if (countries == undefined) {
var promiseForCountries = new Promise(function (resolve, reject) { var promiseForCountries = new Promise(function (resolve, reject) {
crud('', '/ajax/getCountry', 'POST', beforeSend(), function (callback) { locationCrud('', '/ajax/getCountry', 'POST', beforeSend(), function (callback) {
countries = callback; countries = callback;
resetValue('country', true, false) resetValue('country', true, false)
$.each(countries, function (index, value) { $.each(countries, function (index, value) {
@ -39,7 +39,7 @@ $('.filter-city-btn').on('click', function () {
if (cities == undefined || $(this).attr('data-parent') != countries_value) { if (cities == undefined || $(this).attr('data-parent') != countries_value) {
$(this).attr('data-parent', countries_value) $(this).attr('data-parent', countries_value)
var promiseForCities = new Promise(function (resolve, reject) { var promiseForCities = new Promise(function (resolve, reject) {
crud('id=' + countries_value, '/ajax/getCities', 'POST', beforeSend(), function (callback) { locationCrud('id=' + countries_value, '/ajax/getCities', 'POST', beforeSend(), function (callback) {
cities = callback; cities = callback;
resetValue('city', true, false) resetValue('city', true, false)
$.each(cities, function (index, value) { $.each(cities, function (index, value) {
@ -73,7 +73,7 @@ $('.filter-district-btn').on('click', function () {
if (districts == undefined || $(this).attr('data-parent') != city_value) { if (districts == undefined || $(this).attr('data-parent') != city_value) {
$(this).attr('data-parent', city_value) $(this).attr('data-parent', city_value)
var promiseForDistricts = new Promise(function (resolve, reject) { var promiseForDistricts = new Promise(function (resolve, reject) {
crud('id=' + city_value, '/ajax/getDistricts', 'POST', beforeSend(), function (callback) { locationCrud('id=' + city_value, '/ajax/getDistricts', 'POST', beforeSend(), function (callback) {
districts = callback; districts = callback;
resetValue('district', true, false) resetValue('district', true, false)
$.each(districts, function (index, value) { $.each(districts, function (index, value) {
@ -107,7 +107,7 @@ $('.filter-neighborhood-btn').on('click', function () {
if (neighborhoods == undefined || $(this).attr('data-parent') != district_value) { if (neighborhoods == undefined || $(this).attr('data-parent') != district_value) {
$(this).attr('data-parent', district_value) $(this).attr('data-parent', district_value)
var promiseForNeighborhoods = new Promise(function (resolve, reject) { var promiseForNeighborhoods = new Promise(function (resolve, reject) {
crud('id=' + district_value, '/ajax/getNeighborhoods', 'POST', beforeSend(), function (callback) { locationCrud('id=' + district_value, '/ajax/getNeighborhoods', 'POST', beforeSend(), function (callback) {
neighborhoods = callback; neighborhoods = callback;
resetValue('neighborhood', true, false) resetValue('neighborhood', true, false)
$.each(neighborhoods, function (index, value) { $.each(neighborhoods, function (index, value) {
@ -141,7 +141,7 @@ $('.filter-village-btn').on('click', function () {
if (village == undefined || $(this).attr('data-parent') != neighborhood_value) { if (village == undefined || $(this).attr('data-parent') != neighborhood_value) {
$(this).attr('data-parent', neighborhood_value) $(this).attr('data-parent', neighborhood_value)
var promiseForVillage = new Promise(function (resolve, reject) { var promiseForVillage = new Promise(function (resolve, reject) {
crud('id=' + neighborhood_value, '/ajax/getVillage', 'POST', beforeSend(), function (callback) { locationCrud('id=' + neighborhood_value, '/ajax/getVillage', 'POST', beforeSend(), function (callback) {
village = callback; village = callback;
$('.filter-location-modal .village').html(""); $('.filter-location-modal .village').html("");
$.each(village, function (index, value) { $.each(village, function (index, value) {
@ -225,7 +225,7 @@ function SelectOnClick() {
} }
function crud(params, url, type, beforeSend, callback) { function locationCrud(params, url, type, beforeSend, callback) {
$.ajax({ $.ajax({
type: type, type: type,
data: params, data: params,