Replaced the custom tab widget in backend providers with bootstrap based navigation

This commit is contained in:
Alex Tselegidis 2020-09-07 14:12:52 +03:00
parent 6f69c52a3f
commit 6188df7ae5
5 changed files with 190 additions and 205 deletions

View file

@ -83,7 +83,7 @@
</div>
<div class="record-details column col-12 col-md-7">
<div class="float-md-left mb-4">
<div class="float-md-left mb-4 mr-4">
<div class="add-edit-delete-group btn-group">
<button id="add-provider" class="btn btn-primary">
<i class="far fa-plus-square mr-2"></i>
@ -111,17 +111,28 @@
</div>
</div>
<div class="switch-view float-md-right d-md-flex align-items-center mb-4">
<strong><?= lang('current_view') ?></strong>
<div class="display-details current"><?= lang('details') ?></div>
<div class="display-working-plan"><?= lang('working_plan') ?></div>
</div>
<ul class="nav nav-pills switch-view">
<li class="nav-item">
<a class="nav-link active" href="#details" data-toggle="tab">
<?= lang('details') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#working-plan" data-toggle="tab">
<?= lang('working_plan') ?>
</a>
</li>
</ul>
<?php
// This form message is outside the details view, so that it can be
// visible when the user has working plan view active.
?>
<?php // This form message is outside the details view, so that it can be
// visible when the user has working plan view active. ?>
<div class="form-message alert" style="display:none;"></div>
<div class="details-view provider-view">
<div class="tab-content">
<div class="details-view tab-pane fade show active clearfix" id="details">
<h3><?= lang('details') ?></h3>
<input type="hidden" id="provider-id" class="record-id">
@ -186,12 +197,15 @@
<div class="form-group">
<label for="provider-password"><?= lang('password') ?> *</label>
<input type="password" id="provider-password" class="form-control required" maxlength="512" autocomplete="new-password">
<input type="password" id="provider-password" class="form-control required"
maxlength="512" autocomplete="new-password">
</div>
<div class="form-group">
<label for="provider-password-confirm"><?= lang('retype_password') ?> *</label>
<input type="password" id="provider-password-confirm" class="form-control required" maxlength="512" autocomplete="new-password">
<input type="password" id="provider-password-confirm"
class="form-control required" maxlength="512"
autocomplete="new-password">
</div>
<div class="form-group">
@ -224,7 +238,7 @@
</div>
</div>
<div class="working-plan-view provider-view" style="display: none;">
<div class="working-plan-view tab-pane fade clearfix" id="working-plan">
<h3><?= lang('working_plan') ?></h3>
<button id="reset-working-plan" class="btn btn-primary"
title="<?= lang('reset_working_plan') ?>">
@ -302,6 +316,7 @@
</div>
</div>
</div>
</div>
<!-- SECRETARIES TAB -->
@ -425,12 +440,14 @@
<div class="form-group">
<label for="secretary-password"><?= lang('password') ?> *</label>
<input type="password" id="secretary-password" class="form-control required" maxlength="512" autocomplete="new-password">
<input type="password" id="secretary-password" class="form-control required"
maxlength="512" autocomplete="new-password">
</div>
<div class="form-group">
<label for="secretary-password-confirm"><?= lang('retype_password') ?> *</label>
<input type="password" id="secretary-password-confirm" class="form-control required" maxlength="512" autocomplete="new-password">
<input type="password" id="secretary-password-confirm" class="form-control required"
maxlength="512" autocomplete="new-password">
</div>
<div class="form-group">
@ -587,12 +604,14 @@
<div class="form-group">
<label for="admin-password"><?= lang('password') ?> *</label>
<input type="password" id="admin-password" class="form-control required" maxlength="512" autocomplete="new-password">
<input type="password" id="admin-password" class="form-control required" maxlength="512"
autocomplete="new-password">
</div>
<div class="form-group">
<label for="admin-password-confirm"><?= lang('retype_password') ?> *</label>
<input type="password" id="admin-password-confirm" class="form-control required" maxlength="512" autocomplete="new-password">
<input type="password" id="admin-password-confirm" class="form-control required"
maxlength="512" autocomplete="new-password">
</div>
<div class="form-group">

View file

@ -714,40 +714,13 @@ body .form-horizontal .controls {
#users-page #providers .switch-view {
overflow: auto;
margin-bottom: 5px;
background: none;
padding: 0;
margin: 0;
}
#users-page #providers .switch-view div {
display: inline-block;
padding: 6px 13px;
color: #333;
float: left;
margin-right: 3px;
cursor: pointer;
min-width: 100px;
text-align: center;
}
#users-page #providers .switch-view div:hover:not(.current) {
background: #F5F5F5;
}
#users-page #providers .switch-view strong {
display: inline-block;
float: left;
margin-right: 20px;
font-size: 17px;
}
#users-page #providers .switch-view .current {
color: #FFF;
background: #39c678;
}
#users-page #providers .details-view,
#users-page #providers .working-plan-view {
clear: both;
overflow: auto;
#users-page #providers .switch-view .nav-item {
margin: 0;
}
#users-page #providers .working-plan-view .work-start,

View file

@ -436,3 +436,7 @@ body .popover-body a {
.has-error .form-control {
border-color: #dc3545;
}
body .clearfix {
clear: both;
}

View file

@ -137,6 +137,10 @@ window.BackendUsers = window.BackendUsers || {};
* Changes the displayed tab.
*/
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
if ($(this).parents('.switch-view').length) {
return; // Do not proceed if this was the sub navigation.
}
if ($(this).attr('href') === '#admins') {
helper = new AdminsHelper();
} else if ($(this).attr('href') === '#providers') {

View file

@ -205,23 +205,8 @@
/**
* Event: Display Provider Details "Click"
*/
$('#providers').on('click', '.display-details', function () {
$('#providers .switch-view .current').removeClass('current');
$(this).addClass('current');
$('.working-plan-view').hide('fade', function () {
$('.details-view').show('fade');
});
});
/**
* Event: Display Provider Working Plan "Click"
*/
$('#providers').on('click', '.display-working-plan', function () {
$('#providers .switch-view .current').removeClass('current');
$(this).addClass('current');
$('.details-view').hide('fade', function () {
$('.working-plan-view').show('fade');
});
$('#providers').on('shown.bs.tab', 'a[data-toggle="tab"]', function () {
Backend.placeFooterToBottom();
});
/**