Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

progress commit #76

Merged
merged 7 commits into from
Aug 4, 2023
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
5 changes: 4 additions & 1 deletion src/UDS.Net.Forms/Extensions/DomainToViewModelMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using UDS.Net.Forms.Models.UDS3;
using UDS.Net.Services.DomainModels;
using UDS.Net.Services.DomainModels.Forms;
using UDS.Net.Services.Enums;
using UDS.Net.Services.LookupModels;

namespace UDS.Net.Forms.Extensions
Expand Down Expand Up @@ -105,7 +106,9 @@ public static FormModel ToVM(this Form form)
CreatedBy = form.CreatedBy,
ModifiedBy = form.ModifiedBy,
DeletedBy = form.DeletedBy,
IsDeleted = form.IsDeleted
IsDeleted = form.IsDeleted,
Language = form.Language,
ReasonCodeNotIncluded = form.ReasonCode
};

if (form.Fields != null)
Expand Down
28 changes: 27 additions & 1 deletion src/UDS.Net.Forms/Pages/Visits/Details.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@
{
<span class="inline-flex flex-shrink-0 items-center rounded-full bg-indigo-50 px-1.5 py-0.5 text-xs font-medium text-indigo-700 ring-1 ring-inset ring-indigo-600/20">Required</span>
}
@{
var cssClassFormLanguage = "bg-green-50";
if (form.Language == FormLanguage.English)
cssClassFormLanguage = "bg-green-75";
else if (form.Language == FormLanguage.Spanish)
cssClassFormLanguage = "bg-green-100";
}
@if (form.Language != FormLanguage.English && form.Language != FormLanguage.Spanish)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smiththay I wonder if Instead of having an empty if statement here, could it just a single if statement for the opposite to display @form.Language ?

{

}
else
{
<span class="@cssClassFormLanguage inline-flex flex-shrink-0 items-center rounded-full px-1.5 py-0.5 text-xs font-medium text-indigo-700 ring-1 ring-inset ring-indigo-600/20">
@form.Language
</span>
}
</div>
<p class="mt-1 truncate text-sm text-gray-500">@form.Title</p>
</div>
Expand All @@ -88,6 +105,7 @@
<div class="-ml-px flex w-0 flex-1">
@{
var cssClassFormState = "text-gray-900";

if (form.Status == FormStatus.NotStarted)
cssClassFormState = "text-red-500 border-transparent";
else if (form.Status == FormStatus.InProgress)
Expand All @@ -96,9 +114,17 @@
cssClassFormState = "text-teal-500 bg-teal-50 border-teal";
else if (form.Status == FormStatus.NotIncluded)
cssClassFormState = "text-teal-500 border-transparent";

}
<span class="@cssClassFormState relative inline-flex w-0 flex-1 items-center justify-center gap-x-3 rounded-br-lg border py-4 text-sm font-semibold">
@form.Status
@if (form.Status == FormStatus.NotIncluded)
{
@form.ReasonCodeNotIncluded
}
else
{
@form.Status
}
</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/UDS.Net.Services/Extensions/DtoToDomainMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static Form ToDomain(this FormDto dto, int visitId, string username)
formLanguage = (FormLanguage)languageValue;
}
ReasonCode? reasonCode = null;
if (formStatus == FormStatus.NotIncluded && string.IsNullOrWhiteSpace(dto.ReasonCode) && Int32.TryParse(dto.ReasonCode, out int reasonCodeValue))
if (formStatus == FormStatus.NotIncluded && !string.IsNullOrWhiteSpace(dto.ReasonCode) && Int32.TryParse(dto.ReasonCode, out int reasonCodeValue))
{
reasonCode = (ReasonCode)reasonCodeValue;
}
Expand Down