Merge pull request #249 from openclassify/vedat

removed required location fields
This commit is contained in:
Fatih Alp 2020-01-22 19:05:47 +03:00 committed by GitHub
commit 4c72fffe7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 42 deletions

View File

@ -12,11 +12,11 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration
*/
protected $stream = [
'slug' => 'advs',
'title_column' => 'name',
'translatable' => true,
'trashable' => true,
'searchable' => false,
'sortable' => false,
'title_column' => 'name',
'translatable' => true,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];
/**
@ -55,12 +55,8 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration
'online_payment',
'is_get_adv',
'stock',
'country' => [
'required' => true
],
'city' => [
'required' => true
],
'country',
'city',
'district',
'neighborhood',
'village',

View File

@ -69,15 +69,11 @@ function Locations(cat, level, name){
data: "cat=" + cat + "&level=" + level,
url: "/class/ajax",
success: function(msg){
hideLoader()
$('select[name="'+name+'"]').find('option').remove();
$('select[name="'+name+'"]').append('<option value="">Choose an option...</option>');
$.each(msg, function(key, value){
$('select[name="'+name+'"]').append('<option value="'+value.id+'">'+value.name+'</option>');
});
},
beforeSend: function () {
showLoader()
}
}).promise().done(function() {
setLocation(level);

View File

@ -73,7 +73,29 @@ $('input[name="price"]').on('click', function () {
}
})
$(document).on('ajaxComplete ready shown.bs.tab', function () {
$(document).ready(function () {
$('input[data-provides="anomaly.field_type.slug"]:not([data-initialized])').each(function () {
$(this).attr('data-initialized', '');
var config = {
slug: this,
lowercase: $(this).data('lowercase')
};
/**
* Only slugify other fields if
* value is empty OR configured
* to always slugify field values.
*/
if (!$(this).val() || $(this).data('always_slugify')) {
config.slugify = '[data-field="' + $(this).data('slugify') + '"]:visible:first';
}
// Slugify slug inputs.
$(this).slugify(config);
});
// Initialize WYSIWYG editors.
$('textarea[data-field="advs_desc"]:not(.hasEditor)').each(function () {

View File

@ -107,7 +107,6 @@
</div>
{{ form.close|raw }}
</div>
</div>
</section>
<script>
var default_country = "{{ setting_value('visiosoft.module.advs::default_country') }}";
@ -119,10 +118,7 @@
var adv_id = "{{ id }}";
</script>
<script src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.advs::google_map_key') }}&callback="
type="text/javascript"></script>
{{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }}
{{ asset_add("scripts.js", "visiosoft.module.advs::js/location.js") }}
{{ asset_add("scripts.js", "streams::js/form/form.js") }}
{{ asset_add("scripts.js", "streams::js/form/translations.js") }}

View File

@ -19,7 +19,12 @@ return [
'default_value' => true,
],
],
'default_country' => [
'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,

View File

@ -16,4 +16,7 @@ return [
'default_country' => [
'name' => 'Default Country',
],
'create_ad_page_location' => [
'name' => 'Create Ad Page Location',
],
];

View File

@ -1,27 +1,32 @@
<div class="row form-group location-map">
<div class="col-sm-4">
<ul style="padding: 0">
<li class="country-data" data-content="{{ adv['country_id'] }}"
data-default="{{ setting_value('visiosoft.module.advs::default_country') }}"
class="location-field country-data">{{ form.fields.country|raw }}</li>
<li class="city-data" data-content="{{ adv['city'] }}"
data-default="{{ setting_value('visiosoft.module.advs::default_city') }}"
class="location-field city-data">{{ form.fields.city|raw }}</li>
<li class="district-data" data-content="{{ adv['district'] }}"
class="location-field district-data">{{ form.fields.district|raw }}</li>
<li class="neighborhood-data" data-content="{{ adv['neighborhood'] }}"
class="location-field neighborhood-data">{{ form.fields.neighborhood|raw }}</li>
<li class="village-data" data-content="{{ adv['village'] }}"
class="location-field">{{ form.fields.village|raw }}</li>
</ul>
</div>
<div class="col-sm-8">
<div id="map-canvas" style="
{% if setting_value('visiosoft.module.location::create_ad_page_location') %}
<div class="row form-group location-map">
<div class="col-sm-4">
<ul style="padding: 0">
<li class="country-data" data-content="{{ adv['country_id'] }}"
data-default="{{ setting_value('visiosoft.module.advs::default_country') }}"
class="location-field country-data">{{ form.fields.country|raw }}</li>
<li class="city-data" data-content="{{ adv['city'] }}"
data-default="{{ setting_value('visiosoft.module.advs::default_city') }}"
class="location-field city-data">{{ form.fields.city|raw }}</li>
<li class="district-data" data-content="{{ adv['district'] }}"
class="location-field district-data">{{ form.fields.district|raw }}</li>
<li class="neighborhood-data" data-content="{{ adv['neighborhood'] }}"
class="location-field neighborhood-data">{{ form.fields.neighborhood|raw }}</li>
<li class="village-data" data-content="{{ adv['village'] }}"
class="location-field">{{ form.fields.village|raw }}</li>
</ul>
</div>
<div class="col-sm-8">
<div id="map-canvas" style="
position: relative; overflow: hidden;
transform: translateZ(0px) translateZ(0px) translateZ(0px) translateZ(0px) translateZ(0px) translateZ(0px);
width: 100%;
height:550px;
background-color: rgb(229, 227, 223);
"></div>
</div>
</div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key={{ setting_value('visiosoft.module.advs::google_map_key') }}&callback="
type="text/javascript"></script>
{{ asset_add("scripts.js", "visiosoft.module.advs::js/location.js") }}
{% endif %}

View File

@ -59,7 +59,7 @@ return [
'name' => 'Kimlik Numarası'
],
'adress_name' => [
'name' => 'Adres Ado'
'name' => 'Adres Adı'
],
'adress_first_name' => [
'name' => 'İsim'