-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
550 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/UDS.Net.Forms/Models/PacketSubmissionErrorsPaginatedModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
namespace UDS.Net.Forms.Models | ||
{ | ||
public class PacketSubmissionErrorsPaginatedModel : PaginatedModel | ||
{ | ||
public int PacketSubmissionId { get; set; } | ||
|
||
public List<PacketSubmissionErrorModel> List { get; set; } = new List<PacketSubmissionErrorModel>(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
using UDS.Net.Services.DomainModels; | ||
using UDS.Net.Services.DomainModels.Submission; | ||
|
||
namespace UDS.Net.Forms.Models | ||
{ | ||
public class PacketSubmissionModel | ||
{ | ||
public int Id { get; set; } | ||
|
||
public int VisitId { get; set; } | ||
|
||
[Required] | ||
[Display(Name = "Submission date")] | ||
public DateTime SubmissionDate { get; set; } | ||
|
||
[Required] | ||
public DateTime CreatedAt { get; set; } | ||
|
||
[Required] | ||
public string CreatedBy { get; set; } = ""; | ||
|
||
public string? ModifiedBy { get; set; } | ||
|
||
public int ErrorCount { get; set; } = 0; | ||
|
||
public virtual IList<PacketSubmissionErrorModel> Errors { get; set; } = new List<PacketSubmissionErrorModel>(); | ||
public virtual PacketSubmissionErrorsPaginatedModel Errors { get; set; } = new PacketSubmissionErrorsPaginatedModel(); | ||
public string GetFileName(string participantLegacyId, DateTime visitDate) | ||
{ | ||
return $"UDS_{participantLegacyId}_{visitDate.Year}_EXPORTED_{SubmissionDate.ToFileTime()}.csv"; | ||
} | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
src/UDS.Net.Forms/Models/PacketSubmissionsPaginatedModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
namespace UDS.Net.Forms.Models | ||
{ | ||
public class PacketSubmissionsModel | ||
{ | ||
public bool CanCreateNewSubmission { get; set; } = false; | ||
public List<PacketSubmissionModel> List { get; set; } = new List<PacketSubmissionModel>(); | ||
} | ||
} | ||
|
48 changes: 48 additions & 0 deletions
48
src/UDS.Net.Forms/Models/PageModels/PacketSubmissionPageModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using UDS.Net.Forms.Extensions; | ||
using UDS.Net.Services; | ||
|
||
namespace UDS.Net.Forms.Models.PageModels | ||
{ | ||
public class PacketSubmissionPageModel : PageModel | ||
{ | ||
protected readonly IVisitService _visitService; | ||
protected readonly IPacketSubmissionService _packetSubmissionService; | ||
|
||
[BindProperty] | ||
public PacketSubmissionModel? PacketSubmission { get; set; } | ||
|
||
public VisitModel? Visit { get; set; } | ||
|
||
public PacketSubmissionPageModel(IVisitService visitService, IPacketSubmissionService packetSubmissionService) : base() | ||
{ | ||
_visitService = visitService; | ||
_packetSubmissionService = packetSubmissionService; | ||
} | ||
|
||
public async Task<IActionResult> OnGetAsync(int? id) | ||
{ | ||
if (id == null || id == 0) | ||
return NotFound(); | ||
|
||
var packetSubmission = await _packetSubmissionService.GetById("", id.Value); | ||
|
||
if (packetSubmission == null) | ||
return NotFound(); | ||
|
||
PacketSubmission = packetSubmission.ToVM(); | ||
|
||
var visit = await _visitService.GetById("", packetSubmission.VisitId); | ||
|
||
if (visit == null) | ||
return NotFound(); | ||
|
||
Visit = visit.ToVM(); | ||
|
||
return Page(); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,35 @@ | ||
@page | ||
@page "{id:int?}" | ||
@model UDS.Net.Forms.Pages.PacketSubmissions.CreateModel | ||
@{ | ||
ViewData["Title"] = "Create packet submission"; | ||
} | ||
|
||
<div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> | ||
<form method="post"> | ||
<div class="relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6"> | ||
<div> | ||
<div class="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100"> | ||
<svg class="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" /> | ||
</svg> | ||
</div> | ||
<div class="mt-3 text-center sm:mt-5"> | ||
<h3 class="text-base font-semibold leading-6 text-gray-900" id="modal-title">Are you sure?</h3> | ||
<div class="mt-2"> | ||
<p class="text-sm text-gray-500">Clicking "Yes" will download the .csv file to your computer.</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2 sm:gap-3"> | ||
<input asp-for="PacketSubmission.VisitId" type="hidden" /> | ||
<input asp-for="PacketSubmission.SubmissionDate" type="hidden" /> | ||
<input asp-for="PacketSubmission.CreatedAt" type="hidden" /> | ||
<input asp-for="PacketSubmission.CreatedBy" type="hidden" /> | ||
<button type="submit" class="inline-flex w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:col-start-2">Yes, download</button> | ||
<a asp-page="Index" asp-route-visitId="@Model.Visit.Id" class="mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:col-start-1 sm:mt-0">Cancel</a> | ||
</div> | ||
</div> | ||
|
||
|
||
</form> | ||
</div> |
82 changes: 80 additions & 2 deletions
82
src/UDS.Net.Forms/Pages/PacketSubmissions/Create.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@page | ||
@model UDS.Net.Forms.Pages.PacketSubmissions.DetailsModel | ||
@{ | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
src/UDS.Net.Forms/Pages/PacketSubmissions/Details.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using UDS.Net.Forms.Models.PageModels; | ||
using UDS.Net.Services; | ||
|
||
namespace UDS.Net.Forms.Pages.PacketSubmissions | ||
{ | ||
public class DetailsModel : PacketSubmissionPageModel | ||
{ | ||
public DetailsModel(IVisitService visitService, IPacketSubmissionService packetSubmissionService) : base(visitService, packetSubmissionService) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
@page | ||
@page "{id:int?}" | ||
@model UDS.Net.Forms.Pages.PacketSubmissions.EditModel | ||
@{ | ||
ViewData["Title"] = "Edit packet submission"; | ||
} | ||
|
Oops, something went wrong.