mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -06:00
commit
35594a1f3d
@ -18,10 +18,11 @@
|
|||||||
{% include "visiosoft.module.advs::ad-detail/partials/author-button" %}
|
{% include "visiosoft.module.advs::ad-detail/partials/author-button" %}
|
||||||
<!-- admin -->
|
<!-- admin -->
|
||||||
|
|
||||||
<!-- breadcrumb -->
|
{% if setting_value('visiosoft.theme.base::breadcrumbs') %}
|
||||||
{% include "visiosoft.module.advs::ad-detail/partials/breadcrumb" %}
|
<!-- breadcrumb -->
|
||||||
<!-- breadcrumb -->
|
{% include "visiosoft.module.advs::ad-detail/partials/breadcrumb" %}
|
||||||
|
<!-- breadcrumb -->
|
||||||
|
{% endif %}
|
||||||
<h2 class="title">
|
<h2 class="title">
|
||||||
{{ adv.title }}
|
{{ adv.title }}
|
||||||
{{ addBlock('ad-detail/title/action',{'adv_id':adv.id})|raw }}
|
{{ addBlock('ad-detail/title/action',{'adv_id':adv.id})|raw }}
|
||||||
@ -32,23 +33,25 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
{% include "visiosoft.module.advs::ad-detail/partials/slider" %}
|
{% include "visiosoft.module.advs::ad-detail/partials/slider" %}
|
||||||
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
{% include "visiosoft.module.advs::ad-detail/partials/detail" %}
|
{% if setting_value('visiosoft.theme.base::ad_details') %}
|
||||||
|
{% include "visiosoft.module.advs::ad-detail/partials/detail" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--detail-ad -->
|
<!--detail-ad -->
|
||||||
|
|
||||||
|
{% if setting_value('visiosoft.theme.base::ad_details_tab') %}
|
||||||
|
|
||||||
{% if blocks('ad-item-content-block-area') is null %}
|
{% if blocks('ad-item-content-block-area') is null %}
|
||||||
{% include "visiosoft.module.advs::ad-detail/partials/content" %}
|
{% include "visiosoft.module.advs::ad-detail/partials/content" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ blocks('ad-item-content-block-area') }}
|
{{ blocks('ad-item-content-block-area') }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ addBlock('ad-detail/widget', {'price': adv.price, 'id': adv.id})|raw }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ addBlock('ad-detail/widget', {'price': adv.price, 'id': adv.id})|raw }}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
if (!empty($param['country'])) {
|
if (!empty($param['country'])) {
|
||||||
$query = $query->where('country_id', $param['country']);
|
$query = $query->where('country_id', $param['country']);
|
||||||
}
|
}
|
||||||
if (!empty($param['city'])) {
|
if (isset($param['city']) and !empty(array_filter($param['city']))) {
|
||||||
$query = $query->whereIn('city', $param['city']);
|
$query = $query->whereIn('city', $param['city']);
|
||||||
}
|
}
|
||||||
if (!empty($param['cat'])) {
|
if (!empty($param['cat'])) {
|
||||||
@ -90,14 +90,14 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
if (!empty($param['user'])) {
|
if (!empty($param['user'])) {
|
||||||
$query = $query->where('advs_advs.created_by_id', $param['user']);
|
$query = $query->where('advs_advs.created_by_id', $param['user']);
|
||||||
}
|
}
|
||||||
if (!empty($param['district'])) {
|
if (isset($param['district']) and !empty(array_filter($param['district']))) {
|
||||||
$query = $query->where('district', $param['district']);
|
$query = $query->whereIn('district', $param['district']);
|
||||||
}
|
}
|
||||||
if (!empty($param['neighborhood'])) {
|
if (isset($param['neighborhood']) and !empty(array_filter($param['neighborhood']))) {
|
||||||
$query = $query->where('neighborhood', $param['neighborhood']);
|
$query = $query->whereIn('neighborhood', $param['neighborhood']);
|
||||||
}
|
}
|
||||||
if (!empty($param['village'])) {
|
if (isset($param['village']) and !empty(array_filter($param['village']))) {
|
||||||
$query = $query->where('village', $param['village']);
|
$query = $query->whereIn('village', $param['village']);
|
||||||
}
|
}
|
||||||
if (!empty($param['min_price'])) {
|
if (!empty($param['min_price'])) {
|
||||||
$num = $param['min_price'];
|
$num = $param['min_price'];
|
||||||
|
|||||||
@ -146,27 +146,14 @@ class AdvsController extends PublicController
|
|||||||
$subCats = array();
|
$subCats = array();
|
||||||
|
|
||||||
$param = $this->requestHttp->toArray();
|
$param = $this->requestHttp->toArray();
|
||||||
if (!isset($param['country'])) {
|
|
||||||
if (is_null(Cookie::get('country'))) {
|
|
||||||
$param['country'] = setting_value('visiosoft.module.advs::default_country');
|
|
||||||
} else {
|
|
||||||
$param['country'] = Cookie::get('country');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($param['country'] != setting_value('visiosoft.module.advs::default_country')) {
|
|
||||||
Cookie::queue(Cookie::make('country', $param['country'], 84000));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$searchedCountry = $param['country'];
|
|
||||||
|
|
||||||
$countries = $this->country_repository->viewAll();
|
$countries = $this->country_repository->viewAll();
|
||||||
|
|
||||||
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
||||||
|
|
||||||
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
||||||
|
|
||||||
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);
|
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);
|
||||||
|
|
||||||
$advs = $this->adv_repository->addAttributes($advs);
|
$advs = $this->adv_repository->addAttributes($advs);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'monitoring' => [
|
||||||
|
'stacked' => false,
|
||||||
|
'tabs' => [
|
||||||
|
'catalog_mode' => [
|
||||||
|
'title' => 'visiosoft.theme.base::section.catalog_mode.name',
|
||||||
|
'fields' => [
|
||||||
|
'navigation_title', 'navigation_action', 'date_fields', 'price_fields',
|
||||||
|
'breadcrumbs', 'ad_details', 'ad_details_tab','latest_and_view_all_btn'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'navigation_title' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'navigation_action' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'date_fields' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'price_fields' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'breadcrumbs' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'ad_details' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'ad_details_tab' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'latest_and_view_all_btn' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 1,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
@ -9,3 +9,12 @@
|
|||||||
.table-img-100 {
|
.table-img-100 {
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
background-image: url("{{ img('visiosoft.theme.base::images/loading.gif').url }}");
|
||||||
|
background-position: center;
|
||||||
|
background-size: 25px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
height: 50px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
BIN
addons/default/visiosoft/base-theme/resources/images/loading.gif
Normal file
BIN
addons/default/visiosoft/base-theme/resources/images/loading.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@ -7,4 +7,13 @@ return [
|
|||||||
'show_all' => [
|
'show_all' => [
|
||||||
'name' => 'Show All',
|
'name' => 'Show All',
|
||||||
],
|
],
|
||||||
|
'login' => [
|
||||||
|
'name' => 'Login',
|
||||||
|
],
|
||||||
|
'logout' => [
|
||||||
|
'name' => 'Logout',
|
||||||
|
],
|
||||||
|
'profile' => [
|
||||||
|
'name' => 'Profile',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'catalog_mode' => [
|
||||||
|
'name' => 'Catalog Mode',
|
||||||
|
],
|
||||||
|
];
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'navigation_title' => [
|
||||||
|
'name' => 'Navigation Title',
|
||||||
|
],
|
||||||
|
'navigation_action' => [
|
||||||
|
'name' => 'Navigation Action',
|
||||||
|
],
|
||||||
|
'country_fields' => [
|
||||||
|
'name' => 'Country Fields',
|
||||||
|
],
|
||||||
|
'date_fields' => [
|
||||||
|
'name' => 'Date Fields',
|
||||||
|
],
|
||||||
|
'price_fields' => [
|
||||||
|
'name' => 'Price Fields',
|
||||||
|
],
|
||||||
|
'breadcrumbs' => [
|
||||||
|
'name' => 'Breadcrumb',
|
||||||
|
],
|
||||||
|
'ad_details' => [
|
||||||
|
'name' => 'Ad Details',
|
||||||
|
],
|
||||||
|
'ad_details_tab' => [
|
||||||
|
'name' => 'Ad Details Tab',
|
||||||
|
],
|
||||||
|
'latest_and_view_all_btn' => [
|
||||||
|
'name' => 'Latest and View All Btn',
|
||||||
|
],
|
||||||
|
];
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'catalog_mode' => [
|
||||||
|
'name' => 'Katalog Modu',
|
||||||
|
],
|
||||||
|
];
|
||||||
@ -1,13 +1,14 @@
|
|||||||
<div class="album bg-light">
|
<div class="album bg-light">
|
||||||
<div class="row p-2">
|
<div class="row p-2">
|
||||||
<div class="col-md-6">
|
{% if setting_value('visiosoft.theme.base::latest_and_view_all_btn') %}
|
||||||
<h4 class="p-2">{{ trans('theme::field.latest_ads.name') }}</h4>
|
<div class="col-md-6">
|
||||||
</div>
|
<h4 class="p-2">{{ trans('theme::field.latest_ads.name') }}</h4>
|
||||||
<div class="col-md-6 text-right">
|
</div>
|
||||||
<a class="btn btn-outline-secondary"
|
<div class="col-md-6 text-right">
|
||||||
href="{{ url_route('visiosoft.module.advs::list') }}">{{ trans('theme::field.show_all.name') }}</a>
|
<a class="btn btn-outline-secondary"
|
||||||
</div>
|
href="{{ url_route('visiosoft.module.advs::list') }}">{{ trans('theme::field.show_all.name') }}</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@ -25,28 +26,32 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
{% if setting_value('visiosoft.theme.base::price_fields') %}
|
||||||
<b>{{ latestAd.price }} {{ latestAd.currency }}</b>
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
</div>
|
<b>{{ latestAd.price }} {{ latestAd.currency }}</b>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="d-flex justify-content-between align-items-center text-truncate">
|
<div class="d-flex justify-content-between align-items-center text-truncate">
|
||||||
<a href="{{ latestAd.detail_url }}">
|
<a href="{{ latestAd.detail_url }}">
|
||||||
<p class="card-title d-inline-block">{{ latestAd.name }}</p>
|
<p class="card-title d-inline-block">{{ latestAd.name }}</p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% if setting_value('visiosoft.module.location::home_page_location') %}
|
{% if setting_value('visiosoft.module.location::home_page_location') %}
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<small>
|
<small>
|
||||||
<i class="fas fa-location-arrow text-primary"></i>
|
<i class="fas fa-location-arrow text-primary"></i>
|
||||||
{{ latestAd.city_name }}, {{ latestAd.country_name }}
|
{{ latestAd.city_name }}, {{ latestAd.country_name }}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if setting_value('visiosoft.theme.base::date_fields') %}
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<small>
|
||||||
|
<i class="far fa-clock text-dark"></i>
|
||||||
|
{{ latestAd.created_at|date('d/m/Y') }}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
|
||||||
<small>
|
|
||||||
<i class="far fa-clock text-dark"></i>
|
|
||||||
{{ latestAd.created_at|date('d/m/Y') }}
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="navbar-brand" href="{{ url("/") }}">{{ setting_value('streams::name', config_get('streams::distribution.name')) }}</a>
|
{% if setting_value('visiosoft.theme.base::navigation_title') %}
|
||||||
|
<a class="navbar-brand"
|
||||||
|
href="{{ url("/") }}">{{ setting_value('streams::name', config_get('streams::distribution.name')) }}</a>
|
||||||
|
{% endif %}
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent"
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent"
|
||||||
aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
|
aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
@ -20,38 +23,44 @@
|
|||||||
.childListClass('dropdown-menu')
|
.childListClass('dropdown-menu')
|
||||||
.cache({'namespace': 'user'})
|
.cache({'namespace': 'user'})
|
||||||
.render()|raw }}
|
.render()|raw }}
|
||||||
<ul class="nav navbar-nav navbar-right d-block d-sm-none">
|
|
||||||
<li class="nav-item">
|
{% if setting_value('visiosoft.theme.base::navigation_action') %}
|
||||||
{% if auth_check() %}
|
<ul class="nav navbar-nav navbar-right d-block d-sm-none">
|
||||||
<a class="nav-link" href="{{ url_route('anomaly.module.users::logout') }}">Logout</a>
|
<li class="nav-item">
|
||||||
{% else %}
|
{% if auth_check() %}
|
||||||
<a class="nav-link" href="{{ url_route('anomaly.module.users::login') }}">Login</a>
|
<a class="nav-link" href="{{ url_route('anomaly.module.users::logout') }}">{{ trans('visiosoft.theme.base::field.logout.name') }}</a>
|
||||||
{% endif %}
|
{% else %}
|
||||||
</li>
|
<a class="nav-link" href="{{ url_route('anomaly.module.users::login') }}">{{ trans('visiosoft.theme.base::field.login.name') }}</a>
|
||||||
<li class="nav-item">
|
{% endif %}
|
||||||
<a class="nav-link" href="{{ url_route('profile::profile') }}">Profile</a>
|
</li>
|
||||||
</li>
|
<li class="nav-item">
|
||||||
<li class="nav-item">
|
<a class="nav-link" href="{{ url_route('profile::profile') }}">{{ trans('visiosoft.theme.base::field.profile.name') }}</a>
|
||||||
<a href="/advs/create_adv" class="btn btn-primary">{{ trans("theme::button.post_ad.name") }}</a>
|
</li>
|
||||||
</li>
|
<li class="nav-item">
|
||||||
</ul>
|
<a href="/advs/create_adv" class="btn btn-primary">{{ trans("theme::button.post_ad.name") }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="d-none d-sm-block">
|
<div class="d-none d-sm-block">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
{% if setting_value('visiosoft.theme.base::navigation_action') %}
|
||||||
<li class="nav-item">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% if auth_check() %}
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ url_route('anomaly.module.users::logout') }}">Logout</a>
|
{% if auth_check() %}
|
||||||
{% else %}
|
<a class="nav-link" href="{{ url_route('anomaly.module.users::logout') }}">{{ trans('visiosoft.theme.base::field.logout.name') }}</a>
|
||||||
<a class="nav-link" href="{{ url_route('anomaly.module.users::login') }}">Login</a>
|
{% else %}
|
||||||
{% endif %}
|
<a class="nav-link" href="{{ url_route('anomaly.module.users::login') }}">{{ trans('visiosoft.theme.base::field.login.name') }}</a>
|
||||||
</li>
|
{% endif %}
|
||||||
<li class="nav-item">
|
</li>
|
||||||
<a class="nav-link" href="{{ url_route('profile::profile') }}">Profile</a>
|
<li class="nav-item">
|
||||||
</li>
|
<a class="nav-link" href="{{ url_route('profile::profile') }}">{{ trans('visiosoft.theme.base::field.profile.name') }}</a>
|
||||||
<li class="nav-item">
|
</li>
|
||||||
<a href="/advs/create_adv" class="btn btn-primary">{{ trans("theme::button.post_ad.name") }}</a>
|
<li class="nav-item">
|
||||||
</li>
|
<a href="/advs/create_adv" class="btn btn-primary">{{ trans("theme::button.post_ad.name") }}</a>
|
||||||
</ul>
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@ -19,4 +19,11 @@ return [
|
|||||||
'default_value' => true,
|
'default_value' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'default_country' => [
|
||||||
|
'type' => 'anomaly.field_type.relationship',
|
||||||
|
"config" => [
|
||||||
|
"related" => \Visiosoft\LocationModule\Country\CountryModel::class,
|
||||||
|
'default_value' => 212,
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,4 +1,29 @@
|
|||||||
#location .select2-selection__rendered {
|
.filter-location-back {
|
||||||
display: inline-block;
|
position: fixed;
|
||||||
padding-left: 4px;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: 200;
|
||||||
|
background-color: #000;
|
||||||
|
opacity: .3;
|
||||||
|
-ms-filter: "alpha(opacity=30)";
|
||||||
|
filter: alpha(opacity=30);
|
||||||
|
-ms-filter: "alpha(opacity=50)";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-location-body ul li:hover {
|
||||||
|
background: #227af3;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-location-body .countries,
|
||||||
|
.filter-location-body .cities,
|
||||||
|
.filter-location-body .districts,
|
||||||
|
.filter-location-body .neighborhoods,
|
||||||
|
.filter-location-body .village {
|
||||||
|
height: 200px;
|
||||||
|
overflow: auto;
|
||||||
|
display: none
|
||||||
}
|
}
|
||||||
@ -1,155 +1,332 @@
|
|||||||
let searchParams = new URLSearchParams(window.location.search);
|
var countries;
|
||||||
|
var cities;
|
||||||
|
var districts;
|
||||||
|
var neighborhoods;
|
||||||
|
var village;
|
||||||
|
|
||||||
//Set Select2 Type for Location Fields
|
//Country
|
||||||
$('.cities, .countries, .districts, .neighborhoods, .village').select2({
|
$('.filter-country-btn').on('click', function () {
|
||||||
placeholder: select_trans
|
if (countries == undefined) {
|
||||||
|
var promiseForCountries = new Promise(function (resolve, reject) {
|
||||||
|
crud('', '/ajax/getCountry', 'POST', beforeSend(), function (callback) {
|
||||||
|
countries = callback;
|
||||||
|
resetValue('country', true, false)
|
||||||
|
$.each(countries, function (index, value) {
|
||||||
|
$('.filter-location-modal .countries').append(item('country', value.id, value.name));
|
||||||
|
});
|
||||||
|
if (countries == "")
|
||||||
|
$('.filter-location-modal .countries').html(null_msg);
|
||||||
|
else if ($('input[name="country"]').val() != "")
|
||||||
|
$(".filter-location-body .countries li[data-id='" + $('input[name="country"]').val() + "'] input[type='checkbox']").prop('checked', true);
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
promiseForCountries.then(function () {
|
||||||
|
SelectOnClick();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('.filter-location-modal .countries').show();
|
||||||
|
$('.filter-location-modal').show();
|
||||||
|
$('.filter-location-back').show();
|
||||||
|
scroolToModal()
|
||||||
|
});
|
||||||
|
|
||||||
|
//City
|
||||||
|
$('.filter-city-btn').on('click', function () {
|
||||||
|
var countries_value = $('input[name="country"]').val();
|
||||||
|
var selected__city_request = $('input[name="city[]"]').val();
|
||||||
|
if (cities == undefined || $(this).attr('data-parent') != countries_value) {
|
||||||
|
$(this).attr('data-parent', countries_value)
|
||||||
|
var promiseForCities = new Promise(function (resolve, reject) {
|
||||||
|
crud('id=' + countries_value, '/ajax/getCities', 'POST', beforeSend(), function (callback) {
|
||||||
|
cities = callback;
|
||||||
|
resetValue('city', true, false)
|
||||||
|
$.each(cities, function (index, value) {
|
||||||
|
$('.filter-location-modal .cities').append(item('city', value.id, value.name));
|
||||||
|
});
|
||||||
|
if (cities == "")
|
||||||
|
$('.filter-location-modal .cities').html(null_msg);
|
||||||
|
else if (selected__city_request != "") {
|
||||||
|
$.each(selected__city_request.split(','), function (index, value) {
|
||||||
|
$(".filter-location-body .cities li[data-id='" + value + "'] input[type='checkbox']").prop('checked', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
promiseForCities.then(function () {
|
||||||
|
SelectOnClick();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('.filter-location-modal .cities').show();
|
||||||
|
$('.filter-location-modal').show();
|
||||||
|
$('.filter-location-back').show();
|
||||||
|
scroolToModal()
|
||||||
|
});
|
||||||
|
|
||||||
|
//District
|
||||||
|
$('.filter-district-btn').on('click', function () {
|
||||||
|
var city_value = $('input[name="city[]"]').val();
|
||||||
|
var selected_district_request = $('input[name="district[]"]').val();
|
||||||
|
if (districts == undefined || $(this).attr('data-parent') != city_value) {
|
||||||
|
$(this).attr('data-parent', city_value)
|
||||||
|
var promiseForDistricts = new Promise(function (resolve, reject) {
|
||||||
|
crud('id=' + city_value, '/ajax/getDistricts', 'POST', beforeSend(), function (callback) {
|
||||||
|
districts = callback;
|
||||||
|
resetValue('district', true, false)
|
||||||
|
$.each(districts, function (index, value) {
|
||||||
|
$('.filter-location-modal .districts').append(item('district', value.id, value.name));
|
||||||
|
});
|
||||||
|
if (districts == "")
|
||||||
|
$('.filter-location-modal .districts').html(null_msg);
|
||||||
|
else if (selected_district_request != "") {
|
||||||
|
$.each(selected_district_request.split(','), function (index, value) {
|
||||||
|
$(".filter-location-body .districts li[data-id='" + value + "'] input[type='checkbox']").prop('checked', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
promiseForDistricts.then(function () {
|
||||||
|
SelectOnClick();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('.filter-location-modal .districts').show();
|
||||||
|
$('.filter-location-modal').show();
|
||||||
|
$('.filter-location-back').show();
|
||||||
|
scroolToModal()
|
||||||
|
});
|
||||||
|
|
||||||
|
//Neighborhood
|
||||||
|
$('.filter-neighborhood-btn').on('click', function () {
|
||||||
|
var district_value = $('input[name="district[]"]').val();
|
||||||
|
var selected_neighborhood_request = $('input[name="neighborhood[]"]').val();
|
||||||
|
if (neighborhoods == undefined || $(this).attr('data-parent') != district_value) {
|
||||||
|
$(this).attr('data-parent', district_value)
|
||||||
|
var promiseForNeighborhoods = new Promise(function (resolve, reject) {
|
||||||
|
crud('id=' + district_value, '/ajax/getNeighborhoods', 'POST', beforeSend(), function (callback) {
|
||||||
|
neighborhoods = callback;
|
||||||
|
resetValue('neighborhood', true, false)
|
||||||
|
$.each(neighborhoods, function (index, value) {
|
||||||
|
$('.filter-location-modal .neighborhoods').append(item('neighborhood', value.id, value.name));
|
||||||
|
});
|
||||||
|
if (neighborhoods == "")
|
||||||
|
$('.filter-location-modal .neighborhoods').html(null_msg);
|
||||||
|
else if (selected_neighborhood_request != "") {
|
||||||
|
$.each(selected_neighborhood_request.split(','), function (index, value) {
|
||||||
|
$(".filter-location-body .neighborhoods li[data-id='" + value + "'] input[type='checkbox']").prop('checked', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
promiseForNeighborhoods.then(function () {
|
||||||
|
SelectOnClick();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('.filter-location-modal .neighborhoods').show();
|
||||||
|
$('.filter-location-modal').show();
|
||||||
|
$('.filter-location-back').show();
|
||||||
|
scroolToModal()
|
||||||
|
});
|
||||||
|
|
||||||
|
//Village
|
||||||
|
$('.filter-village-btn').on('click', function () {
|
||||||
|
var neighborhood_value = $('input[name="neighborhood[]"]').val();
|
||||||
|
var selected_village_request = $('input[name="village[]"]').val();
|
||||||
|
if (village == undefined || $(this).attr('data-parent') != neighborhood_value) {
|
||||||
|
$(this).attr('data-parent', neighborhood_value)
|
||||||
|
var promiseForVillage = new Promise(function (resolve, reject) {
|
||||||
|
crud('id=' + neighborhood_value, '/ajax/getVillage', 'POST', beforeSend(), function (callback) {
|
||||||
|
village = callback;
|
||||||
|
$('.filter-location-modal .village').html("");
|
||||||
|
$.each(village, function (index, value) {
|
||||||
|
$('.filter-location-modal .village').append(item('village', value.id, value.name));
|
||||||
|
});
|
||||||
|
if (village == "")
|
||||||
|
$('.filter-location-modal .village').html(null_msg);
|
||||||
|
else if (selected_village_request != "") {
|
||||||
|
$.each(selected_village_request.split(','), function (index, value) {
|
||||||
|
$(".filter-location-body .village li[data-id='" + value + "'] input[type='checkbox']").prop('checked', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
promiseForVillage.then(function () {
|
||||||
|
SelectOnClick();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('.filter-location-modal .village').show();
|
||||||
|
$('.filter-location-modal').show();
|
||||||
|
$('.filter-location-back').show();
|
||||||
|
scroolToModal()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FindLocations = (id, table, typeDb, divId, paramName = null) => {
|
$('.filter-modal-close , .filter-location-back').on('click', function () {
|
||||||
|
$('.filter-location-modal').hide();
|
||||||
|
$('.filter-location-back').hide();
|
||||||
|
$('.filter-location-modal .countries').hide();
|
||||||
|
$('.filter-location-modal .cities').hide();
|
||||||
|
$('.filter-location-modal .districts').hide();
|
||||||
|
$('.filter-location-modal .neighborhoods').hide();
|
||||||
|
$('.filter-location-modal .village').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function SelectOnClick() {
|
||||||
|
|
||||||
|
$(".filter-location-body input[type='checkbox']").unbind();
|
||||||
|
searchLocationName()
|
||||||
|
$('.loading').hide();
|
||||||
|
|
||||||
|
return $(".filter-location-body input[type='checkbox']").change(function () {
|
||||||
|
|
||||||
|
resetValue($(this).attr('data-field'), false, true)
|
||||||
|
|
||||||
|
var input = $('input[name="' + $(this).attr('data-field') + '[]"]');
|
||||||
|
var input_text = $(this).parent().find('small').html();
|
||||||
|
var text_html = $('.selected-' + $(this).attr('data-field') + ' small');
|
||||||
|
var text = "";
|
||||||
|
var input_val = input.val();
|
||||||
|
var id = $(this).attr('data-id');
|
||||||
|
|
||||||
|
if ($(this).attr('data-field') == "country") {
|
||||||
|
input.val(id)
|
||||||
|
text_html.html(input_text)
|
||||||
|
$(".filter-location-body input[type='checkbox']").prop('checked', false);
|
||||||
|
$(".filter-location-body li[data-id='" + id + "'] input[type='checkbox']").prop('checked', true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (input_val != "") {
|
||||||
|
input_val = input_val.split(',');
|
||||||
|
text = text_html.html().split(',');
|
||||||
|
} else {
|
||||||
|
input_val = [];
|
||||||
|
text = [];
|
||||||
|
}
|
||||||
|
if (this.checked) {
|
||||||
|
input_val.push(id);
|
||||||
|
text.push(input_text)
|
||||||
|
} else {
|
||||||
|
input_val.splice($.inArray(id, input_val), 1);
|
||||||
|
text.splice($.inArray(input_text, text), 1);
|
||||||
|
}
|
||||||
|
input.val(input_val.join(','))
|
||||||
|
text_html.html(text.join(','))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function crud(params, url, type, beforeSend, callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'get',
|
type: type,
|
||||||
url: '/getlocations',
|
data: params,
|
||||||
data: {
|
url: url,
|
||||||
id: id,
|
beforeSend: function () {
|
||||||
table: table,
|
beforeSend
|
||||||
typeDb: typeDb,
|
|
||||||
},
|
},
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
setLocations(response, id, table, typeDb, divId, paramName);
|
callback(response);
|
||||||
return response;
|
|
||||||
},
|
},
|
||||||
error: function (err) {
|
|
||||||
reject(Error("It broke"));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
|
function item(field_name, id, value) {
|
||||||
|
return '<li class="px-2" data-id="' + id + '">\n' +
|
||||||
|
' <label class="w-100">\n' +
|
||||||
|
' <input type="checkbox" data-field="' + field_name + '" data-id="' + id + '">\n' +
|
||||||
|
' <small>' + value + '</small>\n' +
|
||||||
|
' </label>\n' +
|
||||||
|
' </li>';
|
||||||
|
}
|
||||||
|
|
||||||
setLocations = (response, id, table, typeDb, divId, paramName) => {
|
function resetValue(location_type, reset_this, reset_parent) {
|
||||||
|
var list_class, inputs;
|
||||||
|
var selected_type = false;
|
||||||
|
|
||||||
|
//For City
|
||||||
|
if (location_type == "country") {
|
||||||
|
inputs = ['city', 'district', 'neighborhood', 'village']
|
||||||
|
list_class = ['cities', 'districts', 'neighborhoods', 'village']
|
||||||
|
selected_type = true
|
||||||
|
|
||||||
//Add Options
|
|
||||||
if(divId != ".cities")
|
|
||||||
{
|
|
||||||
$(divId).append("<option value></option>")
|
|
||||||
}
|
}
|
||||||
response.forEach(function (options) {
|
|
||||||
$(divId).append("<option value=" + options.id + ">" + options.name + "</option>")
|
|
||||||
});
|
|
||||||
|
|
||||||
//Set Selected Option
|
//For City
|
||||||
if (paramName != null) {
|
if (location_type == "city") {
|
||||||
if (divId == ".cities") {
|
if (reset_this || selected_type) {
|
||||||
$('.countries').val(searchParams.get('country'));
|
inputs = ['city', 'district', 'neighborhood', 'village']
|
||||||
$('.countries').select2();
|
list_class = ['cities', 'districts', 'neighborhoods', 'village']
|
||||||
$('.cities').val(findParam("city[]"));
|
|
||||||
} else {
|
} else {
|
||||||
$(divId).val(searchParams.get(paramName));
|
location_type = "district";
|
||||||
|
selected_type = true
|
||||||
}
|
}
|
||||||
$(divId).select2();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
//For District
|
||||||
|
if (location_type == "district") {
|
||||||
|
if (reset_this || selected_type) {
|
||||||
|
inputs = ['district', 'neighborhood', 'village']
|
||||||
|
list_class = ['districts', 'neighborhoods', 'village']
|
||||||
|
} else {
|
||||||
|
location_type = "neighborhood";
|
||||||
|
selected_type = true
|
||||||
|
}
|
||||||
|
|
||||||
//Category Change
|
|
||||||
$('.countries').on('change', function () {
|
|
||||||
$('.cities').empty();
|
|
||||||
var table = "cities";
|
|
||||||
var typeDb = 'parent_country_id';
|
|
||||||
var id = $(this).val();
|
|
||||||
var divId = ".cities";
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId);
|
|
||||||
});
|
|
||||||
|
|
||||||
//City Change
|
|
||||||
$('.cities, .select2-selection__choice__remove').on('change', function () {
|
|
||||||
$('.districts').empty();
|
|
||||||
var table = "districts";
|
|
||||||
var typeDb = 'parent_city_id';
|
|
||||||
var id = $(this).val();
|
|
||||||
var divId = ".districts";
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId);
|
|
||||||
});
|
|
||||||
|
|
||||||
//Districts Change
|
|
||||||
$('.districts').on('change', function () {
|
|
||||||
var table = "neighborhoods";
|
|
||||||
var typeDb = 'parent_district_id';
|
|
||||||
var id = $(this).val();
|
|
||||||
var divId = ".neighborhoods";
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId);
|
|
||||||
});
|
|
||||||
|
|
||||||
//Neighborhoods Change
|
|
||||||
$('.neighborhoods').on('change', function () {
|
|
||||||
var table = "village";
|
|
||||||
var typeDb = 'parent_neighborhood_id';
|
|
||||||
var id = $(this).val();
|
|
||||||
var divId = ".village";
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
jQuery(document).ready(function ($) {
|
|
||||||
|
|
||||||
}).promise().done(function () {
|
|
||||||
|
|
||||||
//Get City && Set Country
|
|
||||||
if (searchParams.get('country') != '') {
|
|
||||||
$('.cities').empty();
|
|
||||||
var table = "cities";
|
|
||||||
var typeDb = 'parent_country_id';
|
|
||||||
var id = searchParams.get('country');
|
|
||||||
var divId = ".cities";
|
|
||||||
var paramName = 'city';
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId, paramName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).promise().done(function () {
|
//For Neighborhood
|
||||||
|
if (location_type == "neighborhood") {
|
||||||
//get District && set city
|
if (reset_this || selected_type) {
|
||||||
if (findParam('city[]').length) {
|
inputs = ['neighborhood', 'village']
|
||||||
$('.districts').empty();
|
list_class = ['neighborhoods', 'village']
|
||||||
var table = "districts";
|
} else {
|
||||||
var typeDb = 'parent_city_id';
|
inputs = ['village']
|
||||||
var id = findParam('city[]');
|
list_class = ['village']
|
||||||
var divId = ".districts";
|
}
|
||||||
var paramName = 'district';
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId, paramName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).promise().done(function () {
|
//Reset All List Class From list_class
|
||||||
|
$.each(list_class, function (index, value) {
|
||||||
|
$('.filter-location-modal .' + value).html("");
|
||||||
|
});
|
||||||
|
|
||||||
//get neighborhood && set districts
|
//Reset All Input Value From inputs
|
||||||
if (searchParams.get('district') != '') {
|
$.each(inputs, function (index, value) {
|
||||||
$('.neighborhoods').empty();
|
$('input[name="' + value + '"]').val("");
|
||||||
var table = "neighborhoods";
|
if (reset_parent)
|
||||||
var typeDb = 'parent_district_id';
|
$('.filter-' + value + '-btn').attr("data-parent", "");
|
||||||
var id = searchParams.get('district');
|
});
|
||||||
var divId = ".neighborhoods";
|
}
|
||||||
var paramName = 'neighborhood';
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId, paramName);
|
function scroolToModal() {
|
||||||
}
|
//Scrool Screen
|
||||||
|
$([document.documentElement, document.body]).animate({
|
||||||
|
scrollTop: $('.filter-location-modal').offset().top - 250
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
}).promise().done(function () {
|
function searchLocationName() {
|
||||||
|
var searchField = $("#searchLocation");
|
||||||
|
searchField.unbind();
|
||||||
|
searchField.on("keyup", function () {
|
||||||
|
var value = this.value.toLowerCase().trim();
|
||||||
|
$('.filter-location-modal li').show().filter(function () {
|
||||||
|
return $(this).text().toLowerCase().trim().indexOf(value) == -1;
|
||||||
|
}).hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//get village && set neighborhoods
|
function beforeSend() {
|
||||||
if (searchParams.get('neighborhood') != '') {
|
$('.loading').show()
|
||||||
$('.village').empty();
|
$('.filter-location-modal li').show();
|
||||||
var table = "village";
|
$("#searchLocation").val('');
|
||||||
var typeDb = 'parent_neighborhood_id';
|
}
|
||||||
var id = searchParams.get('neighborhood');
|
|
||||||
var divId = ".village";
|
|
||||||
var paramName = 'village';
|
|
||||||
|
|
||||||
FindLocations(id, table, typeDb, divId, paramName);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
@ -31,4 +31,7 @@ return [
|
|||||||
'pick_option' => [
|
'pick_option' => [
|
||||||
'name' => 'Pick an option',
|
'name' => 'Pick an option',
|
||||||
],
|
],
|
||||||
|
'address' => [
|
||||||
|
'name' => 'Address',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'placeholder' => 'Type here to search',
|
||||||
|
'null_msg' => 'Not Found',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -13,4 +13,7 @@ return [
|
|||||||
'show_search_location_btn' => [
|
'show_search_location_btn' => [
|
||||||
'name' => 'Show Search Location Button',
|
'name' => 'Show Search Location Button',
|
||||||
],
|
],
|
||||||
|
'default_country' => [
|
||||||
|
'name' => 'Default Country',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return[
|
return[
|
||||||
"title" =>"Yer",
|
"title" =>"Bölge",
|
||||||
"name" =>"Yer Modülü",
|
"name" =>"Bölge Modülü",
|
||||||
"description" =>"Açıklama"
|
"description" =>"Bölge Modülü"
|
||||||
];
|
];
|
||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
return[
|
return[
|
||||||
"new_country" =>"Yeni ülke",
|
"new_country" =>"Yeni ülke",
|
||||||
"new_city" =>"Yeni şehir",
|
"new_city" =>"Yeni İl",
|
||||||
"new_district" =>"Yeni bölge",
|
"new_district" =>"Yeni İlçe",
|
||||||
"new_neighborhood" =>"Yeni mahalle",
|
"new_neighborhood" =>"Yeni mahalle",
|
||||||
"new_village" =>"Yeni köy",
|
"new_village" =>"Yeni köy",
|
||||||
"sub_cities" =>"Alt Şehirler",
|
"sub_cities" =>"Alt Şehirler",
|
||||||
|
|||||||
@ -10,11 +10,11 @@ return[
|
|||||||
|
|
||||||
],
|
],
|
||||||
"city" => [
|
"city" => [
|
||||||
"name" =>"Kent",
|
"name" =>"İl",
|
||||||
|
|
||||||
],
|
],
|
||||||
"country" => [
|
"country" => [
|
||||||
"name" =>"ülke",
|
"name" =>"Ülke",
|
||||||
|
|
||||||
],
|
],
|
||||||
"district" => [
|
"district" => [
|
||||||
@ -22,20 +22,23 @@ return[
|
|||||||
|
|
||||||
],
|
],
|
||||||
"order" => [
|
"order" => [
|
||||||
"name" =>"Sıralama düzeni",
|
"name" =>"Sıralama",
|
||||||
|
|
||||||
],
|
],
|
||||||
"neighborhood" => [
|
"neighborhood" => [
|
||||||
"name" =>"Komşuluk",
|
"name" =>"Mahalle",
|
||||||
|
|
||||||
],
|
],
|
||||||
"village" => [
|
"village" => [
|
||||||
"name" =>"köy",
|
"name" =>"Köy",
|
||||||
|
|
||||||
],
|
],
|
||||||
"description" => [
|
"description" => [
|
||||||
"name" =>"Açıklama",
|
"name" =>"Açıklama",
|
||||||
|
|
||||||
],
|
],
|
||||||
|
'address' => [
|
||||||
|
'name' => 'Adres',
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return[
|
return [
|
||||||
|
'placeholder' => 'Ara',
|
||||||
|
'null_msg' => 'Bulunamadı',
|
||||||
];
|
];
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return[
|
|
||||||
"village" => [
|
|
||||||
"name" =>"köy",
|
|
||||||
"option" => [
|
|
||||||
"read" =>"Köy okuyabilir mi ",
|
|
||||||
"write" =>"Köy oluşturabilir / düzenleyebilir mi? ",
|
|
||||||
"delete" =>"Köyü silebilir mi?",
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
||||||
@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
return[
|
return[
|
||||||
"countries" => [
|
"countries" => [
|
||||||
"title" =>"Ülkeler",
|
"title" =>"Ülke",
|
||||||
|
|
||||||
],
|
],
|
||||||
"cities" => [
|
"cities" => [
|
||||||
"title" =>"Şehirler",
|
"title" =>"İl",
|
||||||
|
|
||||||
],
|
],
|
||||||
"districts" => [
|
"districts" => [
|
||||||
"title" =>"İlçeler",
|
"title" =>"İlçer",
|
||||||
|
|
||||||
],
|
],
|
||||||
"neighborhoods" => [
|
"neighborhoods" => [
|
||||||
"title" =>"Çevredekiler",
|
"title" =>"Mahalle",
|
||||||
|
|
||||||
],
|
],
|
||||||
"village" => [
|
"village" => [
|
||||||
|
|||||||
@ -1,42 +1,102 @@
|
|||||||
<div class="row w-100 px-2 m-0">
|
<div class="row w-100 px-2 m-0">
|
||||||
<div class="col-12 px-0 py-1">
|
<div class="col-12 px-0 py-1 px-2">
|
||||||
<label class="label-filter-location">{{ trans("visiosoft.module.location::field.country.name") }}</label>
|
<b>
|
||||||
<select class="form-control countries" name="country" id="countries">
|
<span class="float-left">{{ trans('visiosoft.module.location::field.address.name') }}</span>
|
||||||
{% for country in params.countries %}
|
</b>
|
||||||
<option value="{{ country.id }}">{{ country.name }}</option>
|
<a href="#" class="a-sahibinden-type selected-country filter-country-btn float-right">
|
||||||
{% endfor %}
|
<small>{{ getCountry(setting_value('visiosoft.module.location::default_country')).name }}</small>
|
||||||
</select>
|
</a>
|
||||||
|
{% set country = setting_value('visiosoft.module.location::default_country') %}
|
||||||
|
{% if app.request.get('country') %}
|
||||||
|
{% set country = app.request.get('country') %}
|
||||||
|
{% endif %}
|
||||||
|
<input name="country" value="{{ country }}" type="hidden">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 px-0 py-1">
|
<div class="col-12 px-0 py-1">
|
||||||
<label class="label-filter-location">{{ trans("visiosoft.module.location::field.city.name") }}</label>
|
<button type="button" class="btn btn-default border border-1 w-100 filter-city-btn" data-toggle="modal"
|
||||||
<select class="form-control cities" name="city[]" id="cities" multiple>
|
data-parent="">
|
||||||
{% for city in params.cities %}
|
<span class="float-left">{{ trans("visiosoft.module.location::field.city.name") }}</span>
|
||||||
<option value="{{ city.id }}">{{ city.name }}</option>
|
<i class="fas fa-sort-down float-right"></i>
|
||||||
{% endfor %}
|
</button>
|
||||||
</select>
|
{% set selected_cities = app.request.get('city') %}
|
||||||
|
{% set selected_cities_name = [] %}
|
||||||
|
{% for selected_city in selected_cities[0]|split(',') %}
|
||||||
|
{% set selected_cities_name = selected_cities_name|merge([getCity(selected_city|trim(',')).name]) %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="text-muted selected-city">
|
||||||
|
<small>{{ selected_cities_name|join(',') }}</small>
|
||||||
|
</div>
|
||||||
|
<input name="city[]" value="{{ app.request.get('city')|join(',') }}" type="hidden">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 px-0 py-1">
|
<div class="col-12 px-0 py-1">
|
||||||
<label class="label-filter-location">{{ trans("visiosoft.module.location::field.district.name") }}</label>
|
<button type="button" class="btn btn-default border border-1 w-100 filter-district-btn" data-toggle="modal"
|
||||||
<select class="form-control districts" name="district" id="districts">
|
data-parent="">
|
||||||
{% for district in params.districts %}
|
<span class="float-left">{{ trans("visiosoft.module.location::field.district.name") }}</span>
|
||||||
<option value="{{ district.id }}">{{ district.name }}</option>
|
<i class="fas fa-sort-down float-right"></i>
|
||||||
{% endfor %}
|
</button>
|
||||||
</select>
|
{% set selected_districts = app.request.get('district') %}
|
||||||
|
{% set selected_districts_name = [] %}
|
||||||
|
{% for selected_district in selected_districts[0]|split(',') %}
|
||||||
|
{% set selected_districts_name = selected_districts_name|merge([getDistrict(selected_district|trim(',')).name]) %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="text-muted selected-district">
|
||||||
|
<small>{{ selected_districts_name|join(',') }}</small>
|
||||||
|
</div>
|
||||||
|
<input name="district[]" value="{{ app.request.get('district')|join(',') }}" type="hidden">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 px-0 py-1">
|
<div class="col-12 px-0 py-1">
|
||||||
<label class="label-filter-location">{{ trans("visiosoft.module.location::field.neighborhood.name") }}</label>
|
<button type="button" class="btn btn-default border border-1 w-100 filter-neighborhood-btn" data-toggle="modal"
|
||||||
<select class="form-control neighborhoods" name="neighborhood" id="neighborhoods">
|
data-parent="">
|
||||||
{% for neighborhood in params.neighborhoods %}
|
<span class="float-left">{{ trans("visiosoft.module.location::field.neighborhood.name") }}</span>
|
||||||
<option value="{{ neighborhood.id }}">{{ neighborhood.name }}</option>
|
<i class="fas fa-sort-down float-right"></i>
|
||||||
{% endfor %}
|
</button>
|
||||||
</select>
|
{% set selected_neighborhoods = app.request.get('neighborhood') %}
|
||||||
|
{% set selected_neighborhoods_name = [] %}
|
||||||
|
{% for selected_neighborhood in selected_neighborhoods[0]|split(',') %}
|
||||||
|
{% set selected_neighborhoods_name = selected_neighborhoods_name|merge([getNeighborhood(selected_neighborhood|trim(',')).name]) %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="text-muted selected-neighborhood">
|
||||||
|
<small>{{ selected_neighborhoods_name|join(',') }}</small>
|
||||||
|
</div>
|
||||||
|
<input name="neighborhood[]" value="{{ app.request.get('neighborhood')|join(',') }}" type="hidden">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 px-0 py-1">
|
<div class="col-12 px-0 py-1">
|
||||||
<label class="label-filter-location">{{ trans("visiosoft.module.location::field.village.name") }}</label>
|
<button type="button" class="btn btn-default border border-1 w-100 filter-village-btn" data-toggle="modal"
|
||||||
<select class="form-control village" name="village" id="village">
|
data-parent="">
|
||||||
{% for village in params.villages %}
|
<span class="float-left">{{ trans("visiosoft.module.location::field.village.name") }}</span>
|
||||||
<option value="{{ village.id }}">{{ village.name }}</option>
|
<i class="fas fa-sort-down float-right"></i>
|
||||||
{% endfor %}
|
</button>
|
||||||
</select>
|
{% set selected_villages = app.request.get('village') %}
|
||||||
|
{% set selected_villages_name = [] %}
|
||||||
|
{% for selected_village in selected_villages[0]|split(',') %}
|
||||||
|
{% set selected_villages_name = selected_villages_name|merge([getVillage(selected_village|trim(',')).name]) %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="text-muted selected-village">
|
||||||
|
<small>{{ selected_villages_name|join(',') }}</small>
|
||||||
|
</div>
|
||||||
|
<input name="village[]" value="{{ app.request.get('village')|join(',') }}" type="hidden">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-content position-absolute filter-location-modal" style="z-index: 9999;display: none">
|
||||||
|
<div class="modal-header">
|
||||||
|
<input type="text" id="searchLocation" class="form-control"
|
||||||
|
placeholder="{{ trans('visiosoft.module.location::message.placeholder') }}">
|
||||||
|
<button type="button" class="close filter-modal-close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body filter-location-body">
|
||||||
|
<div class="loading"></div>
|
||||||
|
<ul class="list-unstyled countries"></ul>
|
||||||
|
<ul class="list-unstyled cities"></ul>
|
||||||
|
<ul class="list-unstyled districts"></ul>
|
||||||
|
<ul class="list-unstyled neighborhoods"></ul>
|
||||||
|
<ul class="list-unstyled village"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="filter-location-back" style="display: none"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var null_msg = "{{ trans('visiosoft.module.location::message.null_msg') }}!"
|
||||||
|
</script>
|
||||||
|
|||||||
@ -0,0 +1,106 @@
|
|||||||
|
<?php namespace Visiosoft\LocationModule\Http\Controller;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
||||||
|
use Visiosoft\LocationModule\City\CityModel;
|
||||||
|
use Visiosoft\LocationModule\Country\CountryModel;
|
||||||
|
use Visiosoft\LocationModule\District\DistrictModel;
|
||||||
|
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
|
||||||
|
use Visiosoft\LocationModule\Village\VillageModel;
|
||||||
|
|
||||||
|
class AjaxController extends PublicController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var CountryModel
|
||||||
|
*/
|
||||||
|
private $country_model;
|
||||||
|
/**
|
||||||
|
* @var CityModel
|
||||||
|
*/
|
||||||
|
private $city_model;
|
||||||
|
/**
|
||||||
|
* @var DistrictModel
|
||||||
|
*/
|
||||||
|
private $district_model;
|
||||||
|
/**
|
||||||
|
* @var NeighborhoodModel
|
||||||
|
*/
|
||||||
|
private $neighborhood_model;
|
||||||
|
/**
|
||||||
|
* @var VillageModel
|
||||||
|
*/
|
||||||
|
private $village_model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AjaxController constructor.
|
||||||
|
* @param CountryModel $countryModel
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
CountryModel $countryModel,
|
||||||
|
CityModel $cityModel,
|
||||||
|
DistrictModel $districtModel,
|
||||||
|
NeighborhoodModel $neighborhoodModel,
|
||||||
|
VillageModel $villageModel)
|
||||||
|
{
|
||||||
|
$this->country_model = $countryModel;
|
||||||
|
$this->city_model = $cityModel;
|
||||||
|
$this->district_model = $districtModel;
|
||||||
|
$this->neighborhood_model = $neighborhoodModel;
|
||||||
|
$this->village_model = $villageModel;
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getCountries()
|
||||||
|
{
|
||||||
|
if ($this->request->id)
|
||||||
|
return $this->country_model->find($this->request->id);
|
||||||
|
else
|
||||||
|
return $this->country_model->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getCities()
|
||||||
|
{
|
||||||
|
if ($this->request->id) {
|
||||||
|
$id = explode(',', $this->request->id);
|
||||||
|
return $this->city_model->whereIn('parent_country_id', $id)->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getDistricts()
|
||||||
|
{
|
||||||
|
if ($this->request->id) {
|
||||||
|
$id = explode(',', $this->request->id);
|
||||||
|
return $this->district_model->whereIn('parent_city_id', $id)->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getNeighborhoods()
|
||||||
|
{
|
||||||
|
if ($this->request->id) {
|
||||||
|
$id = explode(',', $this->request->id);
|
||||||
|
return $this->neighborhood_model->whereIn('parent_district_id', $id)->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getVillage()
|
||||||
|
{
|
||||||
|
if ($this->request->id) {
|
||||||
|
$id = explode(',', $this->request->id);
|
||||||
|
return $this->village_model->whereIn('parent_neighborhood_id', $id)->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ use Visiosoft\LocationModule\City\Command\GetCity;
|
|||||||
use Visiosoft\LocationModule\Country\Command\GetCountry;
|
use Visiosoft\LocationModule\Country\Command\GetCountry;
|
||||||
use Visiosoft\LocationModule\District\Command\GetDistrict;
|
use Visiosoft\LocationModule\District\Command\GetDistrict;
|
||||||
use Visiosoft\LocationModule\Neighborhood\Command\GetNeighborhood;
|
use Visiosoft\LocationModule\Neighborhood\Command\GetNeighborhood;
|
||||||
|
use Visiosoft\LocationModule\Village\Command\GetVillage;
|
||||||
|
|
||||||
class LocationModulePlugin extends Plugin
|
class LocationModulePlugin extends Plugin
|
||||||
{
|
{
|
||||||
@ -56,6 +57,17 @@ class LocationModulePlugin extends Plugin
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $ad;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
new \Twig_SimpleFunction(
|
||||||
|
'getVillage',
|
||||||
|
function ($id) {
|
||||||
|
|
||||||
|
if (!$ad = $this->dispatch(new GetVillage($id))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $ad;
|
return $ad;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@ -75,6 +75,27 @@ class LocationModuleServiceProvider extends AddonServiceProvider
|
|||||||
'admin/location/neighborhoods' => 'Visiosoft\LocationModule\Http\Controller\Admin\NeighborhoodsController@index',
|
'admin/location/neighborhoods' => 'Visiosoft\LocationModule\Http\Controller\Admin\NeighborhoodsController@index',
|
||||||
'admin/location/neighborhoods/create' => 'Visiosoft\LocationModule\Http\Controller\Admin\NeighborhoodsController@create',
|
'admin/location/neighborhoods/create' => 'Visiosoft\LocationModule\Http\Controller\Admin\NeighborhoodsController@create',
|
||||||
'admin/location/neighborhoods/edit/{id}' => 'Visiosoft\LocationModule\Http\Controller\Admin\NeighborhoodsController@edit',
|
'admin/location/neighborhoods/edit/{id}' => 'Visiosoft\LocationModule\Http\Controller\Admin\NeighborhoodsController@edit',
|
||||||
|
|
||||||
|
'ajax/getCountry' => [
|
||||||
|
'as' => 'location::getCountry',
|
||||||
|
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getCountries'
|
||||||
|
],
|
||||||
|
'ajax/getCities' => [
|
||||||
|
'as' => 'location::getCities',
|
||||||
|
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getCities'
|
||||||
|
],
|
||||||
|
'ajax/getDistricts' => [
|
||||||
|
'as' => 'location::getDistricts',
|
||||||
|
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getDistricts'
|
||||||
|
],
|
||||||
|
'ajax/getNeighborhoods' => [
|
||||||
|
'as' => 'location::getNeighborhoods',
|
||||||
|
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getNeighborhoods'
|
||||||
|
],
|
||||||
|
'ajax/getVillage' => [
|
||||||
|
'as' => 'location::getVillage',
|
||||||
|
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getVillage'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?php namespace Visiosoft\LocationModule\Village\Command;
|
||||||
|
|
||||||
|
|
||||||
|
use Visiosoft\LocationModule\Village\VillageModel;
|
||||||
|
|
||||||
|
class GetVillage
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $id
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetProduct constructor.
|
||||||
|
* @param $id
|
||||||
|
*/
|
||||||
|
public function __construct($id)
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param VillageModel $groups
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
|
public function handle(VillageModel $groups)
|
||||||
|
{
|
||||||
|
if ($this->id) {
|
||||||
|
return $groups->find($this->id);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user