From 405778ad9a81fc7558c83bd6db2068583197fff6 Mon Sep 17 00:00:00 2001 From: Arunima George Date: Tue, 10 Sep 2024 15:38:22 +0100 Subject: [PATCH] TD-4038: Implemented search bar in AllCatalogue search results page --- .../Views/Catalogue/AllCatalogue.cshtml | 2 +- .../Views/Catalogue/AllCatalogueSearch.cshtml | 37 ++++++++++++++----- .../Catalogue/_AllCatalogueSearchBar.cshtml | 4 +- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogue.cshtml b/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogue.cshtml index 118a5c5f8..702e4277c 100644 --- a/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogue.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogue.cshtml @@ -20,7 +20,7 @@
- @await Html.PartialAsync("_AllCatalogueSearchBar", Model) + @await Html.PartialAsync("_AllCatalogueSearchBar", string.Empty)
diff --git a/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogueSearch.cshtml b/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogueSearch.cshtml index 1d3bee421..be167f34f 100644 --- a/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogueSearch.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Catalogue/AllCatalogueSearch.cshtml @@ -14,26 +14,31 @@ @section styles { + } -
@if (hasSearchTerm) { var parms = new Dictionary { { "term", searchTerm } }; } - else - { - - }

@(hasSearchTerm ? $"Search results for {searchTerm}" : "All catalogues")

-

- @($"{Model.TotalCount} catalogue results") -

- +
+
+
+ @await Html.PartialAsync("_AllCatalogueSearchBar", searchTerm) +
+
+
+ @if (Model.TotalCount > 0) + { +

+ @($"{Model.TotalCount} catalogue results") +

+ }
    @@ -129,4 +134,18 @@ @await Html.PartialAsync("_Pagination", new PaginationViewModel(currentPage, totalPage, prevUrl, nextUrl)) } + + @if (Model.TotalCount == 0) + { +
    +
    +

    No results found for @searchTerm

    +

    You could try:

    +
      +
    • checking your spelling
    • +
    • searching again using other words
    • +
    +
    +
    + }
\ No newline at end of file diff --git a/LearningHub.Nhs.WebUI/Views/Catalogue/_AllCatalogueSearchBar.cshtml b/LearningHub.Nhs.WebUI/Views/Catalogue/_AllCatalogueSearchBar.cshtml index d86fdaeb4..c41d0ce35 100644 --- a/LearningHub.Nhs.WebUI/Views/Catalogue/_AllCatalogueSearchBar.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Catalogue/_AllCatalogueSearchBar.cshtml @@ -1,8 +1,8 @@ -@model LearningHub.Nhs.Models.Catalogue.AllCatalogueResponseViewModel; +@model string