This commit is contained in:
vedatakdogan 2020-12-24 17:39:41 +03:00
commit 10d3445016
5 changed files with 22 additions and 9 deletions

View File

@ -87,9 +87,9 @@ function Locations(cat, level, name) {
url: "/class/ajax", url: "/class/ajax",
success: function (msg) { success: function (msg) {
$('select[name="' + name + '"]').find('option').remove(); $('select[name="' + name + '"]').find('option').remove();
$('select[name="' + name + '"]').append('<option value="">' + chooseOptionTrans + '</option>'); $('select[name="' + name + '"]').append(`<option value="">${chooseOptionTrans}</option>`);
$.each(msg, function (key, value) { $.each(msg, function (key, value) {
$('select[name="' + name + '"]').append('<option value="' + value.id + '">' + value.name + '</option>'); $(`select[name="${name}"]`).append(`<option value="${value.id}">${capFirst(value.name)}</option>`);
}); });
} }
}).promise().done(function () { }).promise().done(function () {
@ -98,6 +98,11 @@ function Locations(cat, level, name) {
}); });
} }
function capFirst(value) {
if (!value) return ''
return value.toLowerCase().replace(/(?:^|\s|["'([{])+\S/g, match => match.toUpperCase());
}
function setLocation(level) { function setLocation(level) {
if (level == 1) { if (level == 1) {
$('select[name="' + citySelectName + '"]').val(getCity); $('select[name="' + citySelectName + '"]').val(getCity);

View File

@ -246,6 +246,6 @@
{{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }} {{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }}
{{ asset_add("scripts.js", "streams::js/form/form.js") }} {{ asset_add("scripts.js", "streams::js/form/form.js") }}
{{ asset_add("scripts.js", "streams::js/form/translations.js") }} {{ asset_add("scripts.js", "streams::js/form/translations.js") }}
{{ asset_add("styles.css", "visiosoft.module.advs::css/new-create.js") }} {{ asset_add("styles.css", "visiosoft.module.advs::css/new-create.css") }}
{% endblock %} {% endblock %}

View File

@ -47,7 +47,14 @@ class AdvTableColumns
], ],
'country' => [ 'country' => [
'class' => 'advs-country', 'class' => 'text-center',
'wrapper' => '<strong><span class="text-muted">{value.city}</span><br>{value.country}</strong>',
'value' => [
'city' => function (EntryInterface $entry) {
return $entry->getCity();
},
'country' => 'country',
]
], ],
'created_by' => [ 'created_by' => [
'value' => 'entry.created_by.name', 'value' => 'entry.created_by.name',

View File

@ -190,7 +190,7 @@ function SelectOnClick() {
searchLocationName() searchLocationName()
$('.loading').hide(); $('.loading').hide();
return $(".filter-location-body input[type='checkbox']").change(function () { return $(".filter-location-body input[type='checkbox']").on('change', function () {
resetValue($(this).attr('data-field'), false, true) resetValue($(this).attr('data-field'), false, true)
@ -202,7 +202,7 @@ function SelectOnClick() {
var id = $(this).attr('data-id'); var id = $(this).attr('data-id');
if ($(this).attr('data-field') == "country") { if ($(this).attr('data-field') == "country") {
$('.selected-city').html(''); $('.selected-city small').html('');
$('input[name="city[]"]').val(''); $('input[name="city[]"]').val('');
// text_html.html(input_text) // text_html.html(input_text)
// $(".filter-location-body li[data-id='" + id + "'] input[type='checkbox']").prop('checked', true); // $(".filter-location-body li[data-id='" + id + "'] input[type='checkbox']").prop('checked', true);
@ -247,13 +247,13 @@ function item(field_name, id, value, abv = '') {
if (field_name === 'country') { if (field_name === 'country') {
return '<li class="px-2" data-id="' + id + '">\n' + return '<li class="px-2" data-id="' + id + '">\n' +
' <label class="w-100">\n' + ' <label class="w-100">\n' +
' <input type="checkbox" data-field="' + field_name + '" data-id="' + id + '" '+ selected +'>\n' + ' <input' +
' type="checkbox" data-field="' + field_name + '" data-id="' + id + '" '+ selected +'>\n' +
' <span class="flag ml-1 flag-' + abv + '">\n' + ' <span class="flag ml-1 flag-' + abv + '">\n' +
' </span>\n' + ' </span>\n' +
' <small>' + value + '</small>\n' + ' <small>' + value + '</small>\n' +
' </label>\n' + ' </label>\n' +
' </li>'; ' </li>';
} else { } else {
return '<li class="px-2" data-id="' + id + '">\n' + return '<li class="px-2" data-id="' + id + '">\n' +
' <label class="w-100">\n' + ' <label class="w-100">\n' +

View File

@ -74,6 +74,7 @@ class Register2FormFields
1 => 'visiosoft.module.profile::field.personal.name', 1 => 'visiosoft.module.profile::field.personal.name',
2 => 'visiosoft.module.profile::field.corporate.name' 2 => 'visiosoft.module.profile::field.corporate.name'
], ],
"default_value" => 1,
"mode" => "radio", "mode" => "radio",
], ],
], ],