From f9cb6b6879ca87a06858c75c5c1a010a21858b17 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sat, 16 Jul 2016 21:32:50 +0200 Subject: [PATCH] Added dedicated links in backcend in order for each provider-service combination (fixes #24). --- src/assets/js/backend_users_providers.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/assets/js/backend_users_providers.js b/src/assets/js/backend_users_providers.js index 8b37f97d..23b40780 100644 --- a/src/assets/js/backend_users_providers.js +++ b/src/assets/js/backend_users_providers.js @@ -358,6 +358,7 @@ $('#providers .record-details').find('input, textarea').val(''); $('#providers input[type="checkbox"]').prop('checked', false); $('#provider-services input[type="checkbox"]').prop('checked', false); + $('#provider-services a').remove(); $('#providers .breaks tbody').empty(); }; @@ -386,11 +387,26 @@ $('#provider-notifications').removeClass('active'); } + // Add dedicated provider link. + var dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id); + var linkHtml = ''; + $('#providers .record-details h3') + .find('a') + .remove() + .end() + .append(linkHtml); + + $('#provider-services a').remove(); $('#provider-services input[type="checkbox"]').prop('checked', false); $.each(provider.services, function(index, serviceId) { $('#provider-services input[type="checkbox"]').each(function() { if ($(this).attr('data-id') == serviceId) { $(this).prop('checked', true); + // Add dedicated service-provider link. + dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id) + + '&service=' + encodeURIComponent(serviceId); + linkHtml = ''; + $(this).parent().append(linkHtml); } }); });