Integrated bootstrap tabs into the backend users page.

This commit is contained in:
alext 2017-09-22 14:47:54 +02:00
parent 355ddaeda4
commit 80c6b61686
2 changed files with 408 additions and 415 deletions

View file

@ -32,15 +32,17 @@
<!-- PAGE NAVIGATION --> <!-- PAGE NAVIGATION -->
<ul class="nav nav-tabs"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="admins-tab tab active"><a><?= lang('admins') ?></a></li> <li role="presentation" class="active"><a href="#admins" aria-controls="admins" role="tab" data-toggle="tab"><?= lang('admins') ?></a></li>
<li role="presentation" class="providers-tab tab"><a><?= lang('providers') ?></a></li> <li role="presentation"><a href="#providers" aria-controls="providers" role="tab" data-toggle="tab"><?= lang('providers') ?></a></li>
<li role="presentation" class="secretaries-tab tab"><a><?= lang('secretaries') ?></a></li> <li role="presentation"><a href="#secretaries" aria-controls="secretaries" role="tab" data-toggle="tab"><?= lang('secretaries') ?></a></li>
</ul> </ul>
<div class="tab-content">
<!-- ADMINS TAB --> <!-- ADMINS TAB -->
<div id="admins" class="tab-content"> <div role="tabpanel" class="tab-pane active" id="admins">
<div class="row"> <div class="row">
<div id="filter-admins" class="filter-records column col-xs-12 col-sm-5"> <div id="filter-admins" class="filter-records column col-xs-12 col-sm-5">
<form class="input-append"> <form class="input-append">
@ -184,7 +186,7 @@
<!-- PROVIDERS TAB --> <!-- PROVIDERS TAB -->
<div id="providers" class="tab-content" style="display:none;"> <div role="tabpanel" class="tab-pane" id="providers">
<div class="row"> <div class="row">
<div id="filter-providers" class="filter-records column col-xs-12 col-sm-5"> <div id="filter-providers" class="filter-records column col-xs-12 col-sm-5">
<form class="input-append"> <form class="input-append">
@ -461,7 +463,7 @@
<!-- SECRETARIES TAB --> <!-- SECRETARIES TAB -->
<div id="secretaries" class="tab-content" style="display:none;"> <div role="tabpanel" class="tab-pane" id="secretaries">
<div class="row"> <div class="row">
<div id="filter-secretaries" class="filter-records column col-xs-12 col-sm-5"> <div id="filter-secretaries" class="filter-records column col-xs-12 col-sm-5">
<form class="input-append"> <form class="input-append">
@ -607,4 +609,5 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>

View file

@ -123,31 +123,23 @@ window.BackendUsers = window.BackendUsers || {};
* *
* Changes the displayed tab. * Changes the displayed tab.
*/ */
$('.tab').click(function() { $('a[data-toggle="tab"]').on('shown.bs.tab', function() {
$(this).parent().find('.active').removeClass('active'); if ($(this).attr('href') === '#admins') {
$(this).addClass('active');
$('.tab-content').hide();
$('#admins, #providers, #secretaries').off();
if ($(this).hasClass('admins-tab')) { // display admins tab
$('#admins').show();
helper = new AdminsHelper(); helper = new AdminsHelper();
} else if ($(this).hasClass('providers-tab')) { // display providers tab } else if ($(this).attr('href') === '#providers') {
$('#providers').show();
$('#provider-services').data('jsp').destroy(); $('#provider-services').data('jsp').destroy();
$('#provider-services').jScrollPane({ mouseWheelSpeed: 70 }); $('#provider-services').jScrollPane({ mouseWheelSpeed: 70 });
helper = new ProvidersHelper(); helper = new ProvidersHelper();
} else if ($(this).hasClass('secretaries-tab')) { // display secretaries tab } else if ($(this).attr('href') === '#secretaries') {
$('#secretaries').show();
helper = new SecretariesHelper(); helper = new SecretariesHelper();
// Update the list with the all the available providers. // Update the list with the all the available providers.
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers'; var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers';
var postData = { var data = {
csrfToken: GlobalVariables.csrfToken, csrfToken: GlobalVariables.csrfToken,
key: '' key: ''
}; };
$.post(postUrl, postData, function(response) { $.post(url, data, function(response) {
if (!GeneralFunctions.handleAjaxExceptions(response)) { if (!GeneralFunctions.handleAjaxExceptions(response)) {
return; return;
} }
@ -165,12 +157,10 @@ window.BackendUsers = window.BackendUsers || {};
provider.first_name + ' ' + provider.last_name + provider.first_name + ' ' + provider.last_name +
'</label>' + '</label>' +
'</div>'; '</div>';
}); });
html += '</div>'; html += '</div>';
$('#secretary-providers').html(html); $('#secretary-providers').html(html);
$('#secretary-providers input:checkbox').prop('disabled', true);
$('#secretary-providers input[type="checkbox"]').prop('disabled', true);
$('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 }); $('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 });
}, 'json').fail(GeneralFunctions.ajaxFailureHandler); }, 'json').fail(GeneralFunctions.ajaxFailureHandler);
} }
@ -226,6 +216,6 @@ window.BackendUsers = window.BackendUsers || {};
} }
}, 'json').fail(GeneralFunctions.ajaxFailureHandler); }, 'json').fail(GeneralFunctions.ajaxFailureHandler);
}); });
}; }
})(window.BackendUsers); })(window.BackendUsers);