forked from mirrors/easyappointments
Integrated bootstrap tabs into the backend services page.
This commit is contained in:
parent
80c6b61686
commit
861f49c259
2 changed files with 167 additions and 173 deletions
|
@ -22,184 +22,185 @@
|
|||
</script>
|
||||
|
||||
<div id="services-page" class="container-fluid backend-page">
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="services-tab tab active"><a><?= lang('services') ?></a></li>
|
||||
<li role="presentation" class="categories-tab tab"><a><?= lang('categories') ?></a></li>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#services" aria-controls="services" role="tab" data-toggle="tab"><?= lang('services') ?></a></li>
|
||||
<li role="presentation"><a href="#categories" aria-controls="categories" role="tab" data-toggle="tab"><?= lang('categories') ?></a></li>
|
||||
</ul>
|
||||
|
||||
<!-- SERVICES TAB -->
|
||||
<div class="tab-content">
|
||||
<!-- SERVICES TAB -->
|
||||
|
||||
<div id="services" class="tab-content">
|
||||
<?php // FILTER SERVICES ?>
|
||||
<div class="row">
|
||||
<div id="filter-services" class="filter-records column col-xs-12 col-sm-5">
|
||||
<form class="input-append">
|
||||
<input class="key" type="text" />
|
||||
<div class="btn-group">
|
||||
<button class="filter btn btn-default btn-sm" type="submit" title="<?= lang('filter') ?>">
|
||||
<span class="glyphglyphicon glyphicon glyphglyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
<button class="clear btn btn-default btn-sm" type="button" title="<?= lang('clear') ?>">
|
||||
<span class="glyphglyphicon glyphicon glyphglyphicon glyphicon-repeat"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div role="tabpanel" class="tab-pane active" id="services">
|
||||
<div class="row">
|
||||
<div id="filter-services" class="filter-records column col-xs-12 col-sm-5">
|
||||
<form class="input-append">
|
||||
<input class="key" type="text" />
|
||||
<div class="btn-group">
|
||||
<button class="filter btn btn-default btn-sm" type="submit" title="<?= lang('filter') ?>">
|
||||
<span class="glyphglyphicon glyphicon glyphglyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
<button class="clear btn btn-default btn-sm" type="button" title="<?= lang('clear') ?>">
|
||||
<span class="glyphglyphicon glyphicon glyphglyphicon glyphicon-repeat"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h3><?= lang('services') ?></h3>
|
||||
<div class="results"></div>
|
||||
</div>
|
||||
<h3><?= lang('services') ?></h3>
|
||||
<div class="results"></div>
|
||||
</div>
|
||||
|
||||
<div class="record-details column col-xs-12 col-sm-7">
|
||||
<div class="btn-toolbar">
|
||||
<div class="add-edit-delete-group btn-group">
|
||||
<button id="add-service" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<?= lang('add') ?>
|
||||
</button>
|
||||
<button id="edit-service" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<?= lang('edit') ?>
|
||||
</button>
|
||||
<button id="delete-service" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<?= lang('delete') ?>
|
||||
</button>
|
||||
<div class="record-details column col-xs-12 col-sm-7">
|
||||
<div class="btn-toolbar">
|
||||
<div class="add-edit-delete-group btn-group">
|
||||
<button id="add-service" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<?= lang('add') ?>
|
||||
</button>
|
||||
<button id="edit-service" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<?= lang('edit') ?>
|
||||
</button>
|
||||
<button id="delete-service" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<?= lang('delete') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="save-cancel-group btn-group" style="display:none;">
|
||||
<button id="save-service" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-ok"></span>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<button id="cancel-service" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-ban-circle"></span>
|
||||
<?= lang('cancel') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="save-cancel-group btn-group" style="display:none;">
|
||||
<button id="save-service" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-ok"></span>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<button id="cancel-service" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-ban-circle"></span>
|
||||
<?= lang('cancel') ?>
|
||||
</button>
|
||||
<h3><?= lang('details') ?></h3>
|
||||
<div class="form-message alert" style="display:none;"></div>
|
||||
|
||||
<input type="hidden" id="service-id" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-name"><?= lang('name') ?> *</label>
|
||||
<input type="text" id="service-name" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-duration"><?= lang('duration_minutes') ?> *</label>
|
||||
<input type="text" id="service-duration" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-price"><?= lang('price') ?> *</label>
|
||||
<input type="text" id="service-price" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-currency"><?= lang('currency') ?></label>
|
||||
<input type="text" id="service-currency" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-category"><?= lang('category') ?></label>
|
||||
<select id="service-category" class="form-control"></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-availabilities-type"><?= lang('availabilities_type') ?></label>
|
||||
<select id="service-availabilities-type" class="form-control">
|
||||
<option value="<?= AVAILABILITIES_TYPE_FLEXIBLE ?>">
|
||||
<?= lang('flexible') ?>
|
||||
</option>
|
||||
<option value="<?= AVAILABILITIES_TYPE_FIXED ?>">
|
||||
<?= lang('fixed') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-attendants-number"><?= lang('attendants_number') ?> *</label>
|
||||
<input type="text" id="service-attendants-number" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-description"><?= lang('description') ?></label>
|
||||
<textarea id="service-description" rows="4" class="form-control"></textarea>
|
||||
</div>
|
||||
|
||||
<p id="form-message" class="text-danger">
|
||||
<em><?= lang('fields_are_required') ?></em>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h3><?= lang('details') ?></h3>
|
||||
<div class="form-message alert" style="display:none;"></div>
|
||||
|
||||
<input type="hidden" id="service-id" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-name"><?= lang('name') ?> *</label>
|
||||
<input type="text" id="service-name" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-duration"><?= lang('duration_minutes') ?> *</label>
|
||||
<input type="text" id="service-duration" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-price"><?= lang('price') ?> *</label>
|
||||
<input type="text" id="service-price" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-currency"><?= lang('currency') ?></label>
|
||||
<input type="text" id="service-currency" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-category"><?= lang('category') ?></label>
|
||||
<select id="service-category" class="form-control"></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-availabilities-type"><?= lang('availabilities_type') ?></label>
|
||||
<select id="service-availabilities-type" class="form-control">
|
||||
<option value="<?= AVAILABILITIES_TYPE_FLEXIBLE ?>">
|
||||
<?= lang('flexible') ?>
|
||||
</option>
|
||||
<option value="<?= AVAILABILITIES_TYPE_FIXED ?>">
|
||||
<?= lang('fixed') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-attendants-number"><?= lang('attendants_number') ?> *</label>
|
||||
<input type="text" id="service-attendants-number" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-description"><?= lang('description') ?></label>
|
||||
<textarea id="service-description" rows="4" class="form-control"></textarea>
|
||||
</div>
|
||||
|
||||
<p id="form-message" class="text-danger">
|
||||
<em><?= lang('fields_are_required') ?></em>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CATEGORIES TAB -->
|
||||
<!-- CATEGORIES TAB -->
|
||||
|
||||
<div id="categories" class="tab-content" style="display:none;">
|
||||
<div class="row">
|
||||
<div id="filter-categories" class="filter-records column col-xs-12 col-sm-5">
|
||||
<form class="input-append">
|
||||
<input class="key" type="text" />
|
||||
<div class="btn-group">
|
||||
<button class="filter btn btn-default btn-sm" type="submit" title="<?= lang('filter') ?>">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
<button class="clear btn btn-default btn-sm" type="button" title="<?= lang('clear') ?>">
|
||||
<span class="glyphicon glyphicon-repeat"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div role="tabpanel" class="tab-pane" id="categories">
|
||||
<div class="row">
|
||||
<div id="filter-categories" class="filter-records column col-xs-12 col-sm-5">
|
||||
<form class="input-append">
|
||||
<input class="key" type="text" />
|
||||
<div class="btn-group">
|
||||
<button class="filter btn btn-default btn-sm" type="submit" title="<?= lang('filter') ?>">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
<button class="clear btn btn-default btn-sm" type="button" title="<?= lang('clear') ?>">
|
||||
<span class="glyphicon glyphicon-repeat"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h3><?= lang('categories') ?></h3>
|
||||
<div class="results"></div>
|
||||
</div>
|
||||
|
||||
<div class="record-details col-xs-12 col-sm-7">
|
||||
<div class="btn-toolbar">
|
||||
<div class="add-edit-delete-group btn-group">
|
||||
<button id="add-category" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-plus glyphicon glyphicon-white"></span>
|
||||
<?= lang('add') ?>
|
||||
</button>
|
||||
<button id="edit-category" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<?= lang('edit') ?>
|
||||
</button>
|
||||
<button id="delete-category" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<?= lang('delete') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="save-cancel-group btn-group" style="display:none;">
|
||||
<button id="save-category" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-ok glyphicon glyphicon-white"></span>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<button id="cancel-category" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-ban-circle"></span>
|
||||
<?= lang('cancel') ?>
|
||||
</button>
|
||||
</div>
|
||||
<h3><?= lang('categories') ?></h3>
|
||||
<div class="results"></div>
|
||||
</div>
|
||||
|
||||
<h3><?= lang('details') ?></h3>
|
||||
<div class="form-message alert" style="display:none;"></div>
|
||||
<div class="record-details col-xs-12 col-sm-7">
|
||||
<div class="btn-toolbar">
|
||||
<div class="add-edit-delete-group btn-group">
|
||||
<button id="add-category" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-plus glyphicon glyphicon-white"></span>
|
||||
<?= lang('add') ?>
|
||||
</button>
|
||||
<button id="edit-category" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<?= lang('edit') ?>
|
||||
</button>
|
||||
<button id="delete-category" class="btn btn-default" disabled="disabled">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<?= lang('delete') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="category-id" />
|
||||
<div class="save-cancel-group btn-group" style="display:none;">
|
||||
<button id="save-category" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-ok glyphicon glyphicon-white"></span>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<button id="cancel-category" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-ban-circle"></span>
|
||||
<?= lang('cancel') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category-name"><?= lang('name') ?> *</label>
|
||||
<input type="text" id="category-name" class="form-control required" />
|
||||
</div>
|
||||
<h3><?= lang('details') ?></h3>
|
||||
<div class="form-message alert" style="display:none;"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category-description"><?= lang('description') ?></label>
|
||||
<textarea id="category-description" rows="4" class="form-control"></textarea>
|
||||
<input type="hidden" id="category-id" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category-name"><?= lang('name') ?> *</label>
|
||||
<input type="text" id="category-name" class="form-control required" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category-description"><?= lang('description') ?></label>
|
||||
<textarea id="category-description" rows="4" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -76,16 +76,10 @@ window.BackendServices = window.BackendServices || {};
|
|||
*
|
||||
* Changes the displayed tab.
|
||||
*/
|
||||
$('.tab').click(function() {
|
||||
$(this).parent().find('.active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.tab-content').hide();
|
||||
|
||||
if ($(this).hasClass('services-tab')) { // display services tab
|
||||
$('#services').show();
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function() {
|
||||
if ($(this).attr('href') === '#services') {
|
||||
helper = servicesHelper;
|
||||
} else if ($(this).hasClass('categories-tab')) { // display categories tab
|
||||
$('#categories').show();
|
||||
} else if ($(this).attr('href') === '#categories') {
|
||||
helper = categoriesHelper;
|
||||
}
|
||||
|
||||
|
@ -105,13 +99,13 @@ window.BackendServices = window.BackendServices || {};
|
|||
* Use this method every time a change is made to the service categories db table.
|
||||
*/
|
||||
exports.updateAvailableCategories = function() {
|
||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories';
|
||||
var postData = {
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories';
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
key: ''
|
||||
};
|
||||
|
||||
$.post(postUrl, postData, function(response) {
|
||||
$.post(url, data, function(response) {
|
||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||
return;
|
||||
}
|
||||
|
@ -125,6 +119,5 @@ window.BackendServices = window.BackendServices || {};
|
|||
});
|
||||
$select.append(new Option('- ' + EALang.no_category + ' -', null)).val('null');
|
||||
}, 'json').fail(GeneralFunctions.ajaxFailureHandler);
|
||||
}
|
||||
|
||||
};
|
||||
})(window.BackendServices);
|
||||
|
|
Loading…
Reference in a new issue