Merge branch 'master' of https://github.com/openclassify/openclassify into muammertop

This commit is contained in:
Muammer Top 2021-03-25 18:41:37 +03:00
commit 1948de9671
11 changed files with 117 additions and 100 deletions

View File

@ -130,12 +130,3 @@ $('.set_category').on('click', function () {
$('#filterModal').find('form').attr("action", '/advs/list'); $('#filterModal').find('form').attr("action", '/advs/list');
$('#filterModal').modal('toggle'); $('#filterModal').modal('toggle');
}); });
// Move filter on small screen
$(window).on("load resize", function () {
const width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
if (width <= 575) {
const detach = $('#listFilterForm').detach();
$('#modalListFilterForm').append(detach);
}
});

View File

@ -163,7 +163,8 @@ $(document).ready(function () {
}); });
function getCities(country) { function getCities(country) {
return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {}, true) return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {
}, true)
.then(function (cities) { .then(function (cities) {
$('select[name="filter_City"]').html("<option value=''>" + $('select[name=filter_City] option:first-child').text() + "</option>"); $('select[name="filter_City"]').html("<option value=''>" + $('select[name=filter_City] option:first-child').text() + "</option>");
$.each(cities, function (index, value) { $.each(cities, function (index, value) {
@ -172,9 +173,10 @@ function getCities(country) {
}) })
} }
$("#listFilterForm").submit(function(e) { $("#listFilterForm, #listFilterFormMobile").submit(function (e) {
// Disable unselected inputs // Disable unselected inputs
const inputs = $('#listFilterForm :input'); const inputs = $('#' + $(this).attr('id') + ' :input');
[...inputs].forEach((input) => { [...inputs].forEach((input) => {
if (input.type === 'checkbox' || input.type === 'radio') { if (input.type === 'checkbox' || input.type === 'radio') {
if ($(input).prop("checked") == false) { if ($(input).prop("checked") == false) {

View File

@ -36,7 +36,9 @@
{% endif %} {% endif %}
</a> </a>
</div> </div>
<div id="modalListFilterForm"></div> <div id="modalListFilterForm">
{% include 'visiosoft.module.advs::list/partials/list-filter' with {"filter_id": 'listFilterFormMobile'} %}
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
{% set formHtml %} {% set formHtml %}
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get" id="listFilterForm" rel="nofollow"> <form action="{{ url_route('visiosoft.module.advs::list') }}" method="get" id="{{ (filter_id) ? filter_id : "listFilterForm" }}" rel="nofollow">
{% endset %} {% endset %}
{% set catSlug = null %} {% set catSlug = null %}
{% set citySlug = null %} {% set citySlug = null %}
@ -12,7 +12,7 @@
{% endif %} {% endif %}
{% if catSlug %} {% if catSlug %}
{% set formHtml %} {% set formHtml %}
<form action="{{ url_route('adv_list_seo', [catSlug, citySlug]) }}" method="get" id="listFilterForm" rel="nofollow"> <form action="{{ url_route('adv_list_seo', [catSlug, citySlug]) }}" method="get" id="{{ (filter_id) ? filter_id : "listFilterForm" }}" rel="nofollow">
{% endset %} {% endset %}
{% endif %} {% endif %}
{{ formHtml }} {{ formHtml }}

View File

@ -50,7 +50,10 @@ class OptionConfigurationRepository extends EntryRepository implements OptionCon
$adv = $this->advRepository->find($ad_id); $adv = $this->advRepository->find($ad_id);
$configurations = array(); $configurations = array();
$product_configurations = $this->model->where('stock', '>', '0')->where('parent_adv_id', $ad_id)->get(); $product_configurations = $this->model->where('stock', '>', '0')
->where('parent_adv_id', $ad_id)
->orderBy('created_at', 'ASC')
->get();
foreach ($product_configurations as $product_configuration) { foreach ($product_configurations as $product_configuration) {
$configurations_item = json_decode($product_configuration->option_json, true); $configurations_item = json_decode($product_configuration->option_json, true);

View File

@ -15,7 +15,7 @@ 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>...</option>'); $('select[name="' + name + '"]').append('<option value="">...</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 + '">' + value.name + '</option>');
}); });

View File

@ -7,6 +7,7 @@ return [
'general_setting' => [ 'general_setting' => [
'title' => 'visiosoft.module.profile::section.general_setting', 'title' => 'visiosoft.module.profile::section.general_setting',
'fields' => [ 'fields' => [
'required_district',
'show_my_ads', 'show_my_ads',
'upload_avatar', 'upload_avatar',
'show_tax_office', 'show_tax_office',

View File

@ -70,4 +70,10 @@ return [
"education" => "anomaly.field_type.tags", "education" => "anomaly.field_type.tags",
"state_of_education" => "anomaly.field_type.tags", "state_of_education" => "anomaly.field_type.tags",
"profession" => "anomaly.field_type.tags", "profession" => "anomaly.field_type.tags",
'required_district' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => false,
]
],
]; ];

View File

@ -47,4 +47,7 @@ return [
'name' => 'Hide Register Type in Profile Page', 'name' => 'Hide Register Type in Profile Page',
'instructions' => 'Hides the register type field in the profile edit page.', 'instructions' => 'Hides the register type field in the profile edit page.',
], ],
'required_district' => [
'name' => 'Required District'
],
]; ];

View File

@ -26,7 +26,9 @@ class AdressFormFields
'city' => [ 'city' => [
'required' => true, 'required' => true,
], ],
'district', 'district' => [
'required' => setting_value( 'visiosoft.module.profile::required_district'),
],
'adress_content' => [ 'adress_content' => [
'required' => true, 'required' => true,
], ],

View File

@ -134,8 +134,15 @@ class MyProfileController extends PublicController
{ {
$message = []; $message = [];
$error_district = false;
if (setting_value('visiosoft.module.profile::required_district') and (!$this->request->district or $this->request->district == "")) {
$error_district = true;
}
$error = $form->build()->validate()->getFormErrors()->getMessages(); $error = $form->build()->validate()->getFormErrors()->getMessages();
if (!empty($error)) {
if (!empty($error) or $error_district) {
$this->messages->flush();
$message['status'] = "error"; $message['status'] = "error";
$message['msg'] = trans('visiosoft.module.profile::message.required_all'); $message['msg'] = trans('visiosoft.module.profile::message.required_all');
return $message; return $message;