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

View file

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