diff --git a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj
index 21ec69f5e..dd474573d 100644
--- a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj
+++ b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj
@@ -89,7 +89,7 @@
-
+
diff --git a/LearningHub.Nhs.WebUI/Controllers/SearchController.cs b/LearningHub.Nhs.WebUI/Controllers/SearchController.cs
index 2cebfd11c..bfa441aae 100644
--- a/LearningHub.Nhs.WebUI/Controllers/SearchController.cs
+++ b/LearningHub.Nhs.WebUI/Controllers/SearchController.cs
@@ -292,5 +292,17 @@ public async Task Image(string name)
return this.Ok(this.Content("No file found"));
}
}
+
+ ///
+ /// GetAutoSuggestion returns the auto suggestion options.
+ ///
+ /// search term.
+ /// ActionResult.
+ [HttpGet("GetAutoSuggestion")]
+ public async Task GetAutoSuggestion(string term)
+ {
+ var autoSuggestions = await this.searchService.GetAutoSuggestionList(term);
+ return this.PartialView("_AutoComplete", autoSuggestions);
+ }
}
}
\ No newline at end of file
diff --git a/LearningHub.Nhs.WebUI/Interfaces/ISearchService.cs b/LearningHub.Nhs.WebUI/Interfaces/ISearchService.cs
index b01be5bce..8a2f0aec1 100644
--- a/LearningHub.Nhs.WebUI/Interfaces/ISearchService.cs
+++ b/LearningHub.Nhs.WebUI/Interfaces/ISearchService.cs
@@ -84,5 +84,12 @@ public interface ISearchService
/// The catalogue Search Request Model.
/// The .
Task GetAllCatalogueSearchResultAsync(AllCatalogueSearchRequestModel catalogueSearchRequestModel);
+
+ ///
+ /// The Get AutoSuggestion List.
+ ///
+ /// The term.
+ /// The .
+ Task GetAutoSuggestionList(string term);
}
}
diff --git a/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj b/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj
index 9e46194b1..c1930e7fa 100644
--- a/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj
+++ b/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj
@@ -108,7 +108,7 @@
-
+
diff --git a/LearningHub.Nhs.WebUI/Services/SearchService.cs b/LearningHub.Nhs.WebUI/Services/SearchService.cs
index 8e22e0eeb..22f98dcdb 100644
--- a/LearningHub.Nhs.WebUI/Services/SearchService.cs
+++ b/LearningHub.Nhs.WebUI/Services/SearchService.cs
@@ -634,6 +634,31 @@ public async Task GetAllCatalogueSearchResultAsync(
}
}
+ ///
+ /// The GetAutoSuggestionList.
+ ///
+ /// The term.
+ /// The auto suggestion list.
+ public async Task GetAutoSuggestionList(string term)
+ {
+ var client = await this.LearningHubHttpClient.GetClientAsync();
+ var request = $"Search/GetAutoSuggestionResult/{term}";
+ var response = await client.GetAsync(request).ConfigureAwait(false);
+
+ var viewModel = new AutoSuggestionModel();
+ if (response.IsSuccessStatusCode)
+ {
+ var result = response.Content.ReadAsStringAsync().Result;
+ viewModel = JsonConvert.DeserializeObject(result);
+ }
+ else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.Forbidden)
+ {
+ throw new Exception("AccessDenied");
+ }
+
+ return viewModel;
+ }
+
///
/// The RemoveHtmlTags.
///
diff --git a/LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss b/LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss
index 3bd13c109..c8935fd80 100644
--- a/LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss
+++ b/LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss
@@ -183,6 +183,57 @@
}
}
+.autosuggestion-menu {
+ padding: 16px 16px 0px 16px;
+ background-color: $color_nhsuk-white;
+ border-bottom: 1px solid $color_nhsuk-grey-4;
+ border-radius: 0px 0px 4px 4px;
+ border-left: 1px solid $color_nhsuk-grey-4;
+ border-right: 1px solid $color_nhsuk-grey-4;
+ box-shadow: 0px 2px 3px 0px $color_nhsuk-grey-4;
+ list-style: none;
+ overflow-x: hidden;
+ overflow-y: auto;
+ position: absolute;
+ width: 100%;
+ z-index: 1;
+ margin-bottom: 0;
+}
+
+.autosuggestion-option {
+ margin-bottom: 0;
+ border-bottom: 1px solid $color_nhsuk-grey-4;
+ color: $color_nhsuk-blue;
+ cursor: pointer;
+ font-size: 16px;
+ padding-bottom: 12px;
+ text-align: left;
+ text-decoration: none;
+}
+
+.autosuggestion-option .autosuggestion-icon {
+ fill: $color_nhsuk-grey-3 !important;
+ float: left;
+ height: 20px;
+ margin: 2px 8px 0 0;
+ width: 16px;
+}
+
+.autosuggestion-option .autosuggestion-subtext {
+ color: $color_nhsuk-grey-2 !important;
+ padding-left: 24px;
+ margin: 0px;
+}
+
+.autosuggestion-option .autosuggestion-link {
+ display: flex;
+ margin-bottom: 0px;
+ text-decoration: underline;
+}
+
+li.autosuggestion-option:last-of-type {
+ border-bottom: none !important;
+}
/* large desktop */
@media (min-width: px2rem(990)) {
@@ -314,6 +365,10 @@
box-shadow: 0 0 0 2px white;
z-index: 10;
}
+
+ .autosuggestion-menu {
+ top: 100%;
+ }
}
/* tablet */
@@ -332,6 +387,10 @@
.nhsuk-header__menu .nhsuk-header__not-mobile {
display: none;
}
+
+ .autosuggestion-menu {
+ top: 100%;
+ }
}
/* mobile */
@@ -430,4 +489,8 @@
.nhsuk-width-container.nhsuk-header__container.app-width-container {
padding-bottom: 0;
}
+
+ .autosuggestion-menu {
+ top: 100%;
+ }
}
\ No newline at end of file
diff --git a/LearningHub.Nhs.WebUI/Views/Search/_AutoComplete.cshtml b/LearningHub.Nhs.WebUI/Views/Search/_AutoComplete.cshtml
new file mode 100644
index 000000000..ba031ab0e
--- /dev/null
+++ b/LearningHub.Nhs.WebUI/Views/Search/_AutoComplete.cshtml
@@ -0,0 +1,45 @@
+@model LearningHub.Nhs.Models.Search.AutoSuggestionModel;
+@{
+ var counter = 0;
+ var counter_res = 0;
+}
+@if (Model != null)
+{
+ @foreach (var item in Model.ConceptDocument.ConceptDocumentList)
+ {
+ counter++;
+
+
+
+ @item.Concept
+
+
+ }
+ @foreach (var item in Model.ResourceDocument.ResourceDocumentList)
+ {
+ counter_res++;
+
+
+
+ @item.Title
+ Resource
+
+
+ }
+ @foreach (var item in Model.CatalogueDocument.CatalogueDocumentList)
+ {
+
+
+
+ @item.Name
+ Catalogue
+
+
+ }
+}
\ No newline at end of file
diff --git a/LearningHub.Nhs.WebUI/Views/Search/_SearchBar.cshtml b/LearningHub.Nhs.WebUI/Views/Search/_SearchBar.cshtml
index 620d6cb76..7ec19feef 100644
--- a/LearningHub.Nhs.WebUI/Views/Search/_SearchBar.cshtml
+++ b/LearningHub.Nhs.WebUI/Views/Search/_SearchBar.cshtml
@@ -1,9 +1,10 @@
@model string