Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions AdminUI/LearningHub.Nhs.AdminUI/Controllers/RoadmapController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task<IActionResult> AddUpdate(UpdateViewModel update)
RoadmapTypeId = update.RoadmapTypeId,
};
var roadmapId = await this.roadmapService.AddRoadmap(roadmap);
return this.RedirectToAction("EditUpdate", new { id = roadmapId });
return this.RedirectToAction("Details", new { id = roadmapId });
}

/// <summary>
Expand Down Expand Up @@ -160,7 +160,7 @@ public async Task<IActionResult> EditUpdate(UpdateViewModel update)
Id = update.Id,
};
await this.roadmapService.UpdateRoadmap(roadmap);
return this.RedirectToAction("EditUpdate", new { roadmap.Id });
return this.RedirectToAction("Details", new { roadmap.Id });
}

/// <summary>
Expand Down Expand Up @@ -202,6 +202,18 @@ public async Task<IActionResult> Updates(string searchTerm = null)
return this.View(model);
}

/// <summary>
/// The Details.
/// </summary>
/// <param name="id">The id<see cref="int"/>.</param>
/// <returns>The <see cref="Task{IActionResult}"/>.</returns>
[HttpGet]
public async Task<IActionResult> Details(int id)
{
var roadmap = await this.roadmapService.GetIdAsync(id);
return this.View(roadmap);
}

/// <summary>
/// The UploadFile.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Interfaces/IRoadmapService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using LearningHub.Nhs.Models.Entities;
using LearningHub.Nhs.Models.RoadMap;

/// <summary>
/// Defines the <see cref="IRoadmapService" />.
Expand Down Expand Up @@ -36,6 +37,13 @@ public interface IRoadmapService
/// <returns>The <see cref="List{Roadmap}"/>.</returns>
Task<List<Roadmap>> GetUpdates();

/// <summary>
/// The GetIdAsync.
/// </summary>
/// <param name="id">The id<see cref="int"/>.</param>
/// <returns>The <see cref="Task{Roadmap}"/>.</returns>
Task<RoadMapViewModel> GetIdAsync(int id);

/// <summary>
/// The UpdateRoadmap.
/// </summary>
Expand Down
29 changes: 29 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Services/RoadmapService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading.Tasks;
using LearningHub.Nhs.AdminUI.Interfaces;
using LearningHub.Nhs.Models.Entities;
using LearningHub.Nhs.Models.RoadMap;
using Newtonsoft.Json;

/// <summary>
Expand Down Expand Up @@ -134,6 +135,34 @@ public async Task<List<Roadmap>> GetUpdates()
return viewmodel;
}

/// <summary>
/// The GetIdAsync.
/// </summary>
/// <param name="id">The id<see cref="int"/>.</param>
/// <returns>The <see cref="Task{Roadmap}"/>.</returns>
public async Task<RoadMapViewModel> GetIdAsync(int id)
{
RoadMapViewModel viewmodel = null;

var client = await this.LearningHubHttpClient.GetClientAsync();
var request = $"Roadmap/GetRoadMapsById/{id}";
var response = await client.GetAsync(request).ConfigureAwait(false);

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
viewmodel = JsonConvert.DeserializeObject<RoadMapViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
||
response.StatusCode == System.Net.HttpStatusCode.Forbidden)
{
throw new Exception("AccessDenied");
}

return viewmodel;
}

/// <summary>
/// The UpdateRoadmap.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Views/Log/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
</tr>
</thead>
<tbody>
@if (Model.Results != null)
{
@foreach (var item in Model.Results.Items)
{
<tr>
Expand All @@ -46,6 +48,7 @@
</td>
</tr>
}
}
</tbody>
</table>
</div>
Expand Down
98 changes: 98 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
@model LearningHub.Nhs.Models.RoadMap.RoadMapViewModel;
@using LearningHub.Nhs.AdminUI.Services

@{
ViewData["Title"] = "Details";
}
@section SideMenu {
@{
await Html.RenderPartialAsync("_NavSection");
}
}

<div class="panel-body admin-body">
<div class="d-flex flex-row justify-content-between col-12">
<a href="@Url.Action("Updates", "Roadmap")" class="pl-3"><i class="fa-solid fa-chevron-left">&nbsp;</i> Go back</a>
<div class="admin-title right-side">
<button type="button" class="btn btn-admin" onclick="location.href='@Url.Action("EditUpdate", "Roadmap", new { id = Model.Id })'"><i class="fa-solid fa-pencil"></i> Edit</button>

Check failure on line 17 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'Id' and no accessible extension method 'Id' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 17 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'Id' and no accessible extension method 'Id' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)
</div>
</div>
@{
string noneVal = "";
}
<div class="admin-section">
<div class="col-12">
<div class="id-container">ID @Model.Id</div>

Check failure on line 25 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'Id' and no accessible extension method 'Id' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'Id' and no accessible extension method 'Id' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)
@ViewBag.UpdateSaveError
<dl>
<dt>
Title
</dt>
<dd>
@Html.DisplayFor(model => model.Title)
</dd>
<dt>
Date
</dt>
<dd>
@Html.DisplayFor(model => model.RoadmapDate)
</dd>
<dt>
Feature Image
</dt>
<dd>
<img src="/file/download/RoadmapImage/@Model.ImageName" style="width: 100px; height: 60px" class="mt-1" />
</dd>
<dt>
Description
</dt>
<dd>
@Html.Raw(Model.Description)
</dd>
<dt>
Status
</dt>


@if (Model.Published)
{
<dd>
Published
</dd>
}
else
{
<dd>
Not Published
</dd>
}
<dt>
Create User
</dt>
<dd>
@Html.DisplayFor(model => model.CreateUserName)

Check failure on line 73 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'CreateUserName' and no accessible extension method 'CreateUserName' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 73 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'CreateUserName' and no accessible extension method 'CreateUserName' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)
</dd>
<dt>
Create Date
</dt>
<dd>
@Html.DisplayFor(model => model.CreateDate)

Check failure on line 79 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'CreateDate' and no accessible extension method 'CreateDate' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 79 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'CreateDate' and no accessible extension method 'CreateDate' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)
</dd>
<dt>
Amend User
</dt>
<dd>
@Html.DisplayFor(model => model.AmendUserName)

Check failure on line 85 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'AmendUserName' and no accessible extension method 'AmendUserName' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)
</dd>
<dt>
Amend Date
</dt>
<dd>
@Html.DisplayFor(model => model.AmendDate)

Check failure on line 91 in AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Details.cshtml

View workflow job for this annotation

GitHub Actions / Build and test

'RoadMapViewModel' does not contain a definition for 'AmendDate' and no accessible extension method 'AmendDate' accepting a first argument of type 'RoadMapViewModel' could be found (are you missing a using directive or an assembly reference?)
</dd>
</dl>
</div>
</div>

</div>

98 changes: 50 additions & 48 deletions AdminUI/LearningHub.Nhs.AdminUI/Views/Roadmap/Updates.cshtml
Original file line number Diff line number Diff line change
@@ -1,68 +1,70 @@
@model LearningHub.Nhs.Models.Paging.TablePagingViewModel<LearningHub.Nhs.Models.Entities.Roadmap>
@{
ViewData["Title"] = "Service updates and releases";
ViewData["CurrentPage"] = Model.Paging.CurrentPage;
var searchTerm = ViewData["SearchTerm"];
ViewData["Title"] = "Service updates and releases";
ViewData["CurrentPage"] = Model.Paging.CurrentPage;
var searchTerm = ViewData["SearchTerm"];
}

@section Styles{
<link href="~/css/Pages/update.css" type="text/css" rel="stylesheet" />
@section Styles {
<link href="~/css/Pages/update.css" type="text/css" rel="stylesheet" />
}

@section SideMenu {
@{await Html.RenderPartialAsync("_NavSection"); }
@{
await Html.RenderPartialAsync("_NavSection");
}
}

<div class="row">
<div class="col roadmap-tab-bar d-flex justify-content-start">
<div class="active">
<a>Updates</a>
</div>
<div class="col roadmap-tab-bar d-flex justify-content-start">
<div class="active">
<a>Updates</a>
</div>
<button id="add-update" class="btn btn-custom-green" onclick="window.location.href = '/Roadmap/AddUpdate'"><i class="fa fa-plus"></i> Add</button>
</div>
<button id="add-update" class="btn btn-custom-green" onclick="window.location.href = '/Roadmap/AddUpdate'"><i class="fa fa-plus"></i> Add</button>
</div>
<div class="table-responsive">
<table class="table table-striped lh-datatable filtered">
<thead>
<tr>
<th style="width: 75%;"><div class="input-group"><input type="text" class="form-control" id="update-search-input" /><span id="update-search-button"><i class="fa fa-search"></i></span></div></th>
<th style="width: 15%;"></th>
<th style="width: 10%">Published</th>
<table class="table table-striped lh-datatable filtered">
<thead>
<tr>
<th style="width: 75%;"><div class="input-group"><input type="text" class="form-control" id="update-search-input" /><span id="update-search-button"><i class="fa fa-search"></i></span></div></th>
<th style="width: 15%;"></th>
<th style="width: 10%">Published</th>

</tr>
</thead>
<tbody>
@foreach (var item in Model.Results.Items)
</tr>
</thead>
<tbody>
@foreach (var item in Model.Results.Items)
{
<tr>
<td>
@Html.ActionLink(item.Title.ToString(), "Details", new { id = item.Id })
</td>
<td>
@Html.ActionLink(item.RoadmapDate.Value.ToString("dd MMM yyyy"), "Details", new { id = item.Id })
</td>
<td>
@if (item.Published)
{
<tr>
<td>
@Html.ActionLink(item.Title.ToString(), "EditUpdate", new { id = item.Id })
</td>
<td>
@Html.ActionLink(item.RoadmapDate.Value.ToString("dd MMM yyyy"), "EditUpdate", new { id = item.Id })
</td>
<td>
@if (item.Published)
{
<i class="fa fa-check"></i>
}
else
{
<i class="fa fa-times"></i>
}
</td>
</tr>
<i class="fa fa-check"></i>
}
</tbody>
</table>
else
{
<i class="fa fa-times"></i>
}
</td>
</tr>
}
</tbody>
</table>
</div>

@section Scripts {
<script src="~/js/pagingContol.js"></script>
<script>
$('#update-search-button').on('click', function () {
var searchTerm = $('#update-search-input').val();
window.location.href = "/Roadmap/Updates?searchTerm=" + encodeURIComponent(searchTerm);
});
</script>
<script src="~/js/pagingContol.js"></script>
<script>
$('#update-search-button').on('click', function () {
var searchTerm = $('#update-search-input').val();
window.location.href = "/Roadmap/Updates?searchTerm=" + encodeURIComponent(searchTerm);
});
</script>
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
sideMenu = "settings";
break;
case "roadmap":
sideMenu = "settings";
if (activeItem.Contains("update"))
{
sideMenu = "settings";
controller = "updates";
}
break;
Expand Down
Loading
Loading