diff --git a/static/css/style.css b/static/css/style.css index b6f9849..80e4a59 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1122,3 +1122,15 @@ input[type=number] { .clean__link:hover { text-decoration: underline; } + +.is_active_filter { + font-weight: bold; +} + +.is_active_filter:before { + content: ''; + position: absolute; + border: 9px solid transparent; + border-left: 13px solid #DEDEDE; + margin-left: -15px; +} diff --git a/static/js/orders.js b/static/js/orders.js index 7e5c4b8..0e5884e 100644 --- a/static/js/orders.js +++ b/static/js/orders.js @@ -1,4 +1,5 @@ $(document).ready(function() { + var filterLinks = document.getElementsByClassName('filter__link'); $('.delete_license').click(function(e){ e.preventDefault(); @@ -31,11 +32,12 @@ $(document).ready(function() { var orderList = new List('listData', options); - console.log(orderList); + // console.log(orderList); $('#filterNone').click(function() { event.preventDefault(); orderList.filter(); + resetAllFilterStatus(); return false; }); @@ -96,5 +98,52 @@ $(document).ready(function() { return false; }); + function removeClass(obj, cls) { + var classes = obj.className.split(' '); + + for (var i = 0; i < classes.length; i++) { + if (classes[i] === cls) { + classes.splice(i, 1); + i--; + } + } + obj.className = classes.join(' '); +} + + + function setActive(element) { + element.className +=' is_active_filter'; + } + + function resetAllFilterStatus() { + + for (var i = 0;i < filterLinks.length; i++ ) { + if (filterLinks[i].classList.contains('is_active_filter')) { + removeClass(filterLinks[i], 'is_active_filter') + } + } + } + + function resetAnotherFilterStatus(element) { + for (var i = 0;i < filterLinks.length; i++ ) { + + if (filterLinks[i] === element) { + // console.log(filterLinks[i]); + } else { + if (filterLinks[i].classList.contains('is_active_filter')) { + removeClass(filterLinks[i], 'is_active_filter') + } + } + } + } + + + for (var i = 0;i < filterLinks.length; i++ ) { + filterLinks[i].addEventListener('click', function () { + setActive(this); + resetAnotherFilterStatus(this); + }) + } + }); diff --git a/templates/customer/profile/orders_list.html b/templates/customer/profile/orders_list.html index 1607348..afc2dcb 100644 --- a/templates/customer/profile/orders_list.html +++ b/templates/customer/profile/orders_list.html @@ -79,18 +79,18 @@
Счета
Лицензии