Merge pull request #264 from openclassify/vedat

Vedat
This commit is contained in:
Fatih Alp 2020-01-30 17:53:04 +03:00 committed by GitHub
commit 2d47f84782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 255 additions and 98 deletions

View File

@ -74,41 +74,6 @@ return [
],
],
'default_country' => [
'type' => 'anomaly.field_type.relationship',
'bind' => 'adv.default_country',
'env' => 'ADV_COUNTRY',
'config' => [
'related' => CountryModel::class,
"default_value" => 212,
]
],
'default_city' => [
'type' => 'anomaly.field_type.relationship',
'bind' => 'adv.default_city',
'env' => 'ADV_CITY',
'config' => [
'related' => LocationCitiesEntryModel::class,
"default_value" => 34,
]
],
'default_district' => [
'type' => 'anomaly.field_type.relationship',
'bind' => 'adv.default_district',
'env' => 'ADV_DISTRICT',
'config' => [
'related' => LocationDistrictsEntryModel::class,
"default_value" => 1091,
]
],
'google_map_key' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.google_map_key',
'env' => 'ADV_MAP_KEY',
'config' => [
'default_value' => 'AIzaSyCAGc0z8kg9rKGVy2FizFKoz0FoWWWzoGQ',
],
],
'google_statistic_code' => [
'type' => 'anomaly.field_type.editor',
'bind' => 'adv.google_statistic_code',
@ -117,22 +82,6 @@ return [
'default_value' => '',
],
],
'map_coordinates_long' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.map_coordinates_long',
'env' => 'ADV_MAP_LONG',
'config' => [
'default_value' => '28.74558607285155',
],
],
'map_coordinates_lat' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.map_coordinates_lat',
'env' => 'ADV_MAP_LAT',
'config' => [
'default_value' => '40.97817786299617',
],
],
'logo' => [
'type' => 'anomaly.field_type.file',
'bind' => 'adv.logo',

View File

@ -7,7 +7,7 @@
<script>
var lat = parseFloat({{ map_arr[0] }});
var lng = parseFloat({{ map_arr[1] }});
var google_map_key = "{{ setting_value('visiosoft.module.advs::google_map_key') }}";
var google_map_key = "{{ setting_value('visiosoft.module.location::google_map_key') }}";
function initMap() {
var myLatLng = {lat: lat, lng: lng};
@ -22,7 +22,7 @@
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.advs::google_map_key') }}&callback=initMap"
<script src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.location::google_map_key') }}&callback=initMap"
type="text/javascript"></script>
{% endif %}

View File

@ -128,7 +128,7 @@
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js">
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.advs::google_map_key') }}&callback=initMap">
src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.location::google_map_key') }}&callback=initMap">
</script>
{% endblock %}

View File

@ -109,10 +109,10 @@
</div>
</section>
<script>
var default_country = "{{ setting_value('visiosoft.module.advs::default_country') }}";
var default_city = "{{ setting_value('visiosoft.module.advs::default_city') }}";
var default_district = "{{ setting_value('visiosoft.module.advs::default_district') }}";
var default_neighborhood = "{{ setting_value('visiosoft.module.advs::default_neighborhood') }}";
var default_country = "{{ setting_value('visiosoft.module.location::default_country') }}";
var default_city = "{{ setting_value('visiosoft.module.location::default_city') }}";
var default_district = "{{ setting_value('visiosoft.module.location::default_district') }}";
var default_neighborhood = "{{ setting_value('visiosoft.module.location::default_neighborhood') }}";
var default_currency = "{{ setting_value('streams::currency') }}";
var default_GET = "{{ setting_value('visiosoft.module.advs::default_GET') }}";
var adv_id = "{{ id }}";

View File

@ -1,34 +0,0 @@
<?php
return [
'home_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'list_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'detail_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'create_ad_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
], 'default_country' => [
'type' => 'anomaly.field_type.relationship',
"config" => [
"related" => \Visiosoft\LocationModule\Country\CountryModel::class,
'default_value' => 212,
]
],
];

View File

@ -0,0 +1,30 @@
<?php
return [
'monitoring' => [
'stacked' => false,
'tabs' => [
'general' => [
'title' => 'visiosoft.module.location::section.general',
'fields' => [
'home_page_location', 'list_page_location', 'detail_page_location', 'create_ad_page_location',
],
],
'map' => [
'title' => 'visiosoft.module.location::section.map',
'fields' => [
'default_country', 'default_city', 'default_district', 'default_neighborhood'
],
],
'setting' => [
'title' => 'visiosoft.module.location::section.setting',
'fields' => [
'google_map_key', 'map_coordinates_long', 'map_coordinates_lat'
],
],
'html' => [
'html' => '{% include "visiosoft.module.location::settings/field" %}',
],
],
],
];

View File

@ -0,0 +1,71 @@
<?php
return [
'home_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'list_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'detail_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'create_ad_page_location' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'default_country' => [
'type' => 'anomaly.field_type.relationship',
"config" => [
"related" => \Visiosoft\LocationModule\Country\CountryModel::class,
'default_value' => 212,
]
],
'default_city' => [
'type' => 'anomaly.field_type.select',
],
'default_district' => [
'type' => 'anomaly.field_type.select',
],
'default_neighborhood' => [
'type' => 'anomaly.field_type.select',
],
'google_map_key' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.google_map_key',
'env' => 'ADV_MAP_KEY',
'config' => [
'default_value' => 'AIzaSyCAGc0z8kg9rKGVy2FizFKoz0FoWWWzoGQ',
],
],
'map_coordinates_long' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.map_coordinates_long',
'env' => 'ADV_MAP_LONG',
'config' => [
'default_value' => '28.74558607285155',
],
],
'map_coordinates_lat' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.map_coordinates_lat',
'env' => 'ADV_MAP_LAT',
'config' => [
'default_value' => '40.97817786299617',
],
],
];

View File

@ -0,0 +1,86 @@
new Promise(function (resolve, reject) {
if (parseInt(default_country)) {
getCities(parseInt(default_country))
resolve(true);
}
}).then(function (resolve) {
if (resolve) {
if (parseInt(default_city)) {
getDistricts(parseInt(default_city))
$('select[name="default_city"]').val(default_city)
return true;
}
}
}).then(function (resolve) {
if (resolve) {
if (parseInt(default_district)) {
getNeighborhoods(parseInt(default_district))
$('select[name="default_district"]').val(default_district)
return true;
}
}
}).then(function (resolve) {
if (resolve) {
if (parseInt(default_neighborhood)) {
$('select[name="default_neighborhood"]').val(default_neighborhood)
}
}
});
function getCities(country) {
crud('id=' + country, '/ajax/getCities', 'POST', function (callback) {
cities = callback;
$('select[name="default_city"]').html("<option>" + pick_option + "</option>");
$.each(cities, function (index, value) {
$('select[name="default_city"]').append("<option value='" + value.id + "'>" + value.name + "</option>");
});
})
}
function getDistricts(city) {
crud('id=' + city, '/ajax/getDistricts', 'POST', function (callback) {
cities = callback;
$('select[name="default_district"]').html("<option>" + pick_option + "</option>");
$.each(cities, function (index, value) {
$('select[name="default_district"]').append("<option value='" + value.id + "'>" + value.name + "</option>");
});
})
}
function getNeighborhoods(district) {
crud('id=' + district, '/ajax/getNeighborhoods', 'POST', function (callback) {
cities = callback;
$('select[name="default_neighborhood"]').html("<option>" + pick_option + "</option>");
$.each(cities, function (index, value) {
$('select[name="default_neighborhood"]').append("<option value='" + value.id + "'>" + value.name + "</option>");
});
})
}
$(document).on('change', 'select[name="default_country"]', function () {
getCities($(this).val());
});
$(document).on('change', 'select[name="default_city"]', function () {
getDistricts($(this).val())
});
$(document).on('change', 'select[name="default_district"]', function () {
getNeighborhoods($(this).val())
});
function crud(params, url, type, callback) {
$.ajax({
type: type,
data: params,
async: false,
url: url,
success: function (response) {
callback(response);
},
});
}

View File

@ -16,4 +16,7 @@ return [
'village' => [
'title' => 'Village',
],
'general' => 'General',
'map' => 'Map',
'setting' => 'Setting',
];

View File

@ -19,4 +19,25 @@ return [
'create_ad_page_location' => [
'name' => 'Create Ad Page Location',
],
'default_city' => [
'name' => 'Default City',
],
'default_district' => [
'name' => 'Default District',
],
'default_neighborhood' => [
'name' => 'Default Neighborhood',
],
'google_map_key' => [
'name' => 'Google Maps Api Key',
],
'map_coordinates_long' => [
'name' => 'Default Long',
],
'map_coordinates_lat' => [
'name' => 'Default Lang',
],
];

View File

@ -16,4 +16,7 @@ return [
'village' => [
'title' => 'Köy',
],
'general' => 'Genel',
'map' => 'Harita',
'setting' => 'Ayarlar',
];

View File

@ -2,18 +2,38 @@
return [
'home_page_location' => [
'name' => 'Home Page Location Field',
'name' => 'Anasayfa lokasyon gösterimi',
],
'list_page_location' => [
'name' => 'List Page Location Field',
'name' => 'Listeleme sayfası lokasyon gösterimi',
],
'detail_page_location' => [
'name' => 'Detail Page Location Field',
'name' => 'Detay sayfası lokasyon gösterimi',
],
'show_search_location_btn' => [
'name' => 'Show Search Location Button',
'name' => 'Arama Lokasyon buton gösterimi',
],
'default_country' => [
'name' => 'Default Country',
'name' => 'Varsayılan Ülke',
],
'default_city' => [
'name' => 'Varsayılan İl',
],
'default_district' => [
'name' => 'Varsayılan İlçe',
],
'default_neighborhood' => [
'name' => 'Varsayılan Mahalle',
],
'google_map_key' => [
'name' => 'Google Maps Api Key',
],
'map_coordinates_long' => [
'name' => 'Varsayılan Long',
],
'map_coordinates_lat' => [
'name' => 'Varsayılan Lang',
],
];

View File

@ -26,7 +26,7 @@
"></div>
</div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.advs::google_map_key') }}&callback="
<script src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.location::google_map_key') }}&callback="
type="text/javascript"></script>
{{ asset_add("scripts.js", "visiosoft.module.advs::js/location.js") }}
{% endif %}

View File

@ -0,0 +1,8 @@
<script>
var default_country = "{{ setting_value('visiosoft.module.location::default_country') }}"
var default_city = "{{ setting_value('visiosoft.module.location::default_city') }}"
var default_district = "{{ setting_value('visiosoft.module.location::default_district') }}"
var default_neighborhood = "{{ setting_value('visiosoft.module.location::default_neighborhood') }}"
var pick_option = "{{ trans('visiosoft.module.location::field.pick_option.name') }}"
</script>
{{ asset_add("scripts.js","visiosoft.module.location::js/settings.js") }}