The provider URL parameter will now display the provider even if teh option doesn't exist on page load (fixes #24).

This commit is contained in:
Alex Tselegidis 2016-07-17 11:43:52 +02:00
parent f9cb6b6879
commit 84ccd956df
3 changed files with 24 additions and 10 deletions

View file

@ -577,15 +577,6 @@ body .form-horizontal .controls {
}
#users-page .filter-records .results hr {
margin: 5px 0;
}
#users-page .details {
max-width: 800px;
margin-bottom: 20px;
}
#users-page .working-plan td input[type="text"] {
width: 55px;
margin: 10px 0;
@ -597,6 +588,15 @@ body .form-horizontal .controls {
margin: 0px;
}
#users-page #providers .record-details h3 a {
font-size: 24px;
margin-left: 10px;
}
#users-page #providers .record-details #provider-services .checkbox a {
margin-left: 5px;
}
/* BACKEND SETTINGS PAGE
-------------------------------------------------------------------- */
#settings-page h2 {

View file

@ -341,6 +341,7 @@
$('#providers .add-edit-delete-group').show();
$('#providers .save-cancel-group').hide();
$('#providers .record-details h3 a').remove();
$('#providers .record-details').find('input, textarea').prop('readonly', true);
$('#providers .form-message').hide();
$('#provider-notifications').removeClass('active');

View file

@ -110,7 +110,7 @@ window.FrontendBook = window.FrontendBook || {};
var $selectProvider = $('#select-provider');
var $selectService = $('#select-service');
// Check if a specific service was selected.
// Check if a specific service was selected (via URL parameter).
var selectedServiceId = GeneralFunctions.getUrlParameter(location.href, 'service');
if (selectedServiceId && $selectService.find('option[value="' + selectedServiceId + '"]').length > 0) {
@ -125,6 +125,19 @@ window.FrontendBook = window.FrontendBook || {};
// Check if a specific provider was selected.
var selectedProviderId = GeneralFunctions.getUrlParameter(location.href, 'provider');
if (selectedProviderId && $selectProvider.find('option[value="' + selectedProviderId + '"]').length === 0) {
// Select a service of this provider in order to make the provider available in the select box.
for (var index in GlobalVariables.availableProviders) {
var provider = GlobalVariables.availableProviders[index];
if (provider.id === selectedProviderId && provider.services.length > 0) {
$selectService
.val(provider.services[0])
.trigger('change');
}
}
}
if (selectedProviderId && $selectProvider.find('option[value="' + selectedProviderId + '"]').length > 0) {
$selectProvider
.val(selectedProviderId)