diff --git a/resources/views/info_company_new.blade.php b/resources/views/info_company_new.blade.php index 3ac9375..07d84cd 100644 --- a/resources/views/info_company_new.blade.php +++ b/resources/views/info_company_new.blade.php @@ -58,10 +58,8 @@ }); $("#list_button").on('click', function () { - $('#flot').removeClass('active'); - $('#flot_list').removeClass('showed'); - $('#vacancy').addClass('active'); - $('#vacancy_list').addClass('showed'); + activateTab('vacancy'); + history.pushState({}, '', '#vacancy'); }) $(document).on('click', '#send_message_to_employer', function() { @@ -72,6 +70,40 @@ $('#worker_to_user_id').val(this_.attr('data-tuid')); $('#worker_vacancy').val(this_.attr('data-vacancy')); }); + + function activateTab(tab) { + if (tab === 'vacancy') { + document.getElementById('flot').classList.remove('active'); + document.getElementById('flot_list').classList.remove('showed'); + document.getElementById('vacancy').classList.add('active'); + document.getElementById('vacancy_list').classList.add('showed'); + } else { + document.getElementById('vacancy').classList.remove('active'); + document.getElementById('vacancy_list').classList.remove('showed'); + document.getElementById('flot').classList.add('active'); + document.getElementById('flot_list').classList.add('showed'); + } + } + + document.addEventListener('DOMContentLoaded', function () { + const hash = window.location.hash; + if (hash === '#vacancy') { + activateTab('vacancy'); + } else { + activateTab('flot'); + } + + document.getElementById('flot').addEventListener('click', function () { + activateTab('flot'); + history.pushState({}, '', '#flot'); + }); + + document.getElementById('vacancy').addEventListener('click', function () { + activateTab('vacancy'); + history.pushState({}, '', '#vacancy'); + }); + + }); @include('js.favorite-vacancy-45')