diff --git a/addons/default/visiosoft/advs-module/resources/css/list.css b/addons/default/visiosoft/advs-module/resources/css/list.css index 84755030b..a62c171b2 100644 --- a/addons/default/visiosoft/advs-module/resources/css/list.css +++ b/addons/default/visiosoft/advs-module/resources/css/list.css @@ -43,4 +43,66 @@ .table-classified .td-country, .table-classified .td-subject { min-width: 200px; +} + +/* Mobile filter */ +.mobile-list-action { + margin-left: -30px; + margin-right: -30px; + border: 1px solid #dee2e68a; +} + +.mobile-list-action a { + font-size: 11px; + line-height: 22px; + text-align: center; + margin-top: -5px; + display: block; + color: #022543; +} + +.mobile-list-action a:hover, +.mobile-list-action a:hover { + text-decoration: none; +} + +.mobile-list-action a:after { + position: absolute; + width: 1px; + height: 33px; + top: 0; + right: 0; + content: ''; + background: #c9c9c9; +} + +.mobile-list-action i { + font-size: 19px; + color: #a1a1a1; +} + +.mobile-list-action div { + margin-top: 6px; +} + +.edit-category-filter-modal { + top: 7px; + right: 14px; +} + +.edit-category-filter-modal a { + text-decoration: none; +} + +#categoryModal { + background-color: rgba(0, 0, 0, 0.8); +} + +.category-select-mobile span { + right: 10px; + top: 6px; +} + +#filterModal { + overflow-y: auto; } \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/js/filter_modal.js b/addons/default/visiosoft/advs-module/resources/js/filter_modal.js new file mode 100644 index 000000000..09918cc94 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/js/filter_modal.js @@ -0,0 +1,131 @@ +$('#filter_modal_btn').on('click', function () { + $('#filterModal').modal('toggle'); +}) + +$('.edit-category-filter-modal').on('click', function () { + $('#filterModal').modal('hide'); + $('#categoryModal').modal('toggle'); +}) + + +function crud(params, url, type, callback) { + $.ajax({ + type: type, + async: false, + data: params, + url: url, + success: function (response) { + callback(response); + }, + }); +} + +var level = 0; +var id_list = categories; +var selected; +var selected_cat; +var all_categories = {}; +var promiseForCategory = new Promise(function (resolve) { + if (categories.length != 0) { + $.each(categories, function (index, value) { + crud({ + 'level': level, + "cat": categories['cat' + level] + }, '/class/ajaxCategory', 'POST', function (callback) { + all_categories['cat' + (level + 1)] = callback; + }) + level++; + }); + } else { + crud({'level': level, "cat": ""}, '/class/ajaxCategory', 'POST', function (callback) { + all_categories['cat' + (level + 1)] = callback; + }) + level++; + } + resolve(all_categories); +}); + +promiseForCategory.then(function (categories_list) { + level = 0; + $.each(categories_list, function (index, value) { + level++; + $('.category-row').append(CategoryField(index, level)); + $.each(value, function (index2, value2) { + selected = ""; + if (id_list[index] == value2.id) { + selected = "selected"; + selected_cat = value2.id; + } + $('.' + index).append(""); + }); + }); +}) + + +function CategoryField(name, level) { + return '
\n' + + '\n\n
'; +} + + +$(document).ready(function () { + + $(".cat-select").on('change', function (e) { + if (Object.keys($(this).val()).length > 1) { + $('option[value="' + $(this).val().toString().split(',')[1] + '"]').prop('selected', false); + } + }); + selectedValue() +}); + + +function selectedValue() { + return $('.cat-select').on('change', function () { + var value = $(this).val(); + $('.set_category').attr("data-selected", value); + $('input[name="cat"]').val(value) + var all_category_box = $('.category-row').find('.category-box'); + var level = parseInt($(this).attr('data-level')) + 1; + + //Remove right select fields + for (var i = level - 1; i <= all_category_box.length - 1; i++) { + all_category_box[i].remove(); + } + + + crud({"cat": value, 'level': level}, '/class/ajaxCategory', 'POST', function (callback) { + if (callback.length > 0) { + $('.category-row').append(CategoryField('cat' + level, level)); + $.each(callback, function (index, value) { + $('.cat' + level).append(""); + }); + } + selectedValue().unbind() + editCategorySpan() + return selectedValue(); + }) + }) +} + + +function editCategorySpan() { + $('.selected-category-name').html("") + $.each($('.category-row').find('.category-select-mobile'), function (index, value) { + var selected_name = $(this).find('.cat-select').find(':selected'); + $('.selected-category-name').append(selected_name.html() + ','); + }); +} + +$('.set_category').on('click', function () { + + $('#categoryModal').modal('hide'); + + $('#filterModal').find('form').attr("action", '/advs/list'); + $('#filterModal').modal('toggle'); +}) + + + + diff --git a/addons/default/visiosoft/advs-module/resources/js/list.js b/addons/default/visiosoft/advs-module/resources/js/list.js index 7df92d54b..bdba47f1b 100644 --- a/addons/default/visiosoft/advs-module/resources/js/list.js +++ b/addons/default/visiosoft/advs-module/resources/js/list.js @@ -24,6 +24,9 @@ $('.sort-by-item').on('click', function () { let searchParams = new URLSearchParams(window.location.search); var sort_by = searchParams.get('sort_by'); var url = window.location.href; + if (url.slice(-1) === "#") { + url = url.slice(0, -1); + } var goURL = ""; var value = $(this).attr('data-value'); if (window.location.search == "") { diff --git a/addons/default/visiosoft/advs-module/resources/js/new-create.js b/addons/default/visiosoft/advs-module/resources/js/new-create.js index 76c0d7741..e6043cd8b 100644 --- a/addons/default/visiosoft/advs-module/resources/js/new-create.js +++ b/addons/default/visiosoft/advs-module/resources/js/new-create.js @@ -15,15 +15,14 @@ var filter = {}; filter.getCats = (catId, divId) => { $.ajax({ type: 'get', - url: '/class/getcats/'+ divId, + url: '/class/getcats/' + divId, success: function (response) { hideLoader() - if(response == 0){ + if (response == 0) { stop(); - } - else { - response.forEach(function(options){ - $(catId).append(""); + } else { + response.forEach(function (options) { + $(catId).append(""); $(catId).closest('li').show(); }); } @@ -35,40 +34,42 @@ filter.getCats = (catId, divId) => { }; $(document).ready(function () { - $("select[name='currency']").val(default_currency); - if(default_GET == 1) - { + if ($('input[name="slug"]').val() == "") { + $("select[name='currency']").val(default_currency); + } + + if (default_GET == 1) { $('#is_get_adv').prop('checked', true); } }); -$(document).on('change', '.sub_cats', function(){ +$(document).on('change', '.sub_cats', function () { divId = $(this).find('option:selected').val(); if (divId == 0) { $(this).parent().nextAll().remove(); } else filter.callCats(divId); }); -function getAdv(){ - if (document.getElementById('getMethod').checked){ + +function getAdv() { + if (document.getElementById('getMethod').checked) { var val = $('input[name=price]').val(); - val = val*90/100; - $("#priceLi").append(''); + val = val * 90 / 100; + $("#priceLi").append(''); } else { $("#getprice").remove(); } } + $('input[name=price]').bind('keyup change', function () { var val = $('input[name=price]').val(); - val = val*90/100; + val = val * 90 / 100; $("#getprice").val(val); }); - $('input[name="price"]').on('click', function () { - if($(this).val() == "0.00") - { + if ($(this).val() == "0.00") { $(this).val(""); } }) diff --git a/addons/default/visiosoft/advs-module/resources/js/sort_modal.js b/addons/default/visiosoft/advs-module/resources/js/sort_modal.js new file mode 100644 index 000000000..08459eb4f --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/js/sort_modal.js @@ -0,0 +1,3 @@ +$('#sort_modal_btn').on('click', function () { + $('#sortModal').modal('toggle'); +}) \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/button.php b/addons/default/visiosoft/advs-module/resources/lang/en/button.php index e0b9fc5b2..4779817a1 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/button.php @@ -8,10 +8,12 @@ return [ 'new_district' => 'New District', 'new_neighborhood' => 'New Neighborhood', 'new_village' => 'New Village', + 'edit' => "Edit", 'approve' => "Approve", 'decline' => 'Decline', 'extend' => 'Extend', 'extend_all' => 'Extend All', + 'categories' => 'Categories', 'sub_category' => 'Sub Categories', 'add_sub_category' => 'Add Sub Category', 'sub_cities' => 'Sub Cities', @@ -23,6 +25,7 @@ return [ 'sub_neighborhoods' => 'Sub Neighborhoods', 'sub_village' => 'Sub Village', 'general_settings' => 'General Settings', + 'save_category' => 'Save Category', 'update_category' => [ 'name' => 'Update Category' ], diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/field.php b/addons/default/visiosoft/advs-module/resources/lang/en/field.php index f3902def4..08aa17502 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/field.php @@ -123,6 +123,8 @@ return [ 'list-page' => 'List Page', 'search' => 'Search', 'recommended' => 'Recommended Ads for You', + 'filter' => 'Filter', + 'sort' => 'Sort', 'sort_by' => 'Sort By', 'pick_option' => 'Pick an option', 'pick_ordering' => 'Ordering', @@ -233,6 +235,7 @@ return [ 'name' => 'Sold out', ], 'edit_category' => 'Edit Category', + 'set_category' => 'Set Category', 'max' => [ 'name' => 'Max', ], diff --git a/addons/default/visiosoft/advs-module/resources/views/list/list.twig b/addons/default/visiosoft/advs-module/resources/views/list/list.twig index fdd9fd8a5..61e7ea393 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/list.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/list.twig @@ -10,7 +10,7 @@
-
+
{% include "visiosoft.module.advs::list/partials/list-filter" %}
@@ -18,13 +18,24 @@ + + {% include "visiosoft.module.advs::list/partials/filter-modal" %} + {% include "visiosoft.module.advs::list/partials/sort-modal" %} + diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/display-mode.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/display-mode.twig index b504ba7a2..98c82d17b 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/display-mode.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/display-mode.twig @@ -1,4 +1,4 @@ -
+
{% if setting_value('visiosoft.module.location::list_page_location') %} @@ -13,7 +13,7 @@ {{ trans('visiosoft.module.advs::field.show_list_view.name') }}
-
+
{{ trans('visiosoft.module.advs::field.show_table_view.name') }} diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/filter-modal.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/filter-modal.twig new file mode 100644 index 000000000..95a13068e --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/filter-modal.twig @@ -0,0 +1,73 @@ + +{{ asset_add('scripts.js','visiosoft.module.advs::js/filter_modal.js') }} + + + diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig index 45d3ecdfd..00ed64d4c 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig @@ -111,7 +111,7 @@
-
+
+{{ asset_add('scripts.js','visiosoft.module.advs::js/sort_modal.js') }} \ No newline at end of file diff --git a/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/list-filter.twig b/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/list-filter.twig index 8961f7c04..cad6118d9 100644 --- a/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/list-filter.twig +++ b/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/list-filter.twig @@ -1,4 +1,4 @@ -
+