From 84ccd956dfc9c92e6e7946b6cb8bc0b84e0f7020 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 17 Jul 2016 11:43:52 +0200 Subject: [PATCH] The provider URL parameter will now display the provider even if teh option doesn't exist on page load (fixes #24). --- src/assets/css/backend.css | 18 +++++++++--------- src/assets/js/backend_users_providers.js | 1 + src/assets/js/frontend_book.js | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index 3ca14a89..8ad35342 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -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 { diff --git a/src/assets/js/backend_users_providers.js b/src/assets/js/backend_users_providers.js index 23b40780..356da831 100644 --- a/src/assets/js/backend_users_providers.js +++ b/src/assets/js/backend_users_providers.js @@ -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'); diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index e7b7a62f..8d879990 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -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)