2025-04-17 07:46:58 -07:00

697 lines
44 KiB
Plaintext

@page "/pcrb/{planNumber}"
@page "/pcrb/new"
@using System.Text
<PageTitle>PCRB @planNumber</PageTitle>
<MudPaper Class="p-2 m-2 d-flex flex-row justify-content-between">
<MudIconButton Icon="@Icons.Material.Filled.ChevronLeft"
Variant="Variant.Outlined"
Color="Color.Dark"
OnClick="@ReturnToAllPcrbs"
Size="Size.Large" />
<MudText Typo="Typo.h3" Align="Align.Center">PCRB @planNumber</MudText>
<MudPaper Height="100%" Width="0.1%" Square="true" />
</MudPaper>
@if (pcrb is not null) {
<MudTimeline Class="mt-2 pt-2" TimelineOrientation="TimelineOrientation.Horizontal"
TimelinePosition="TimelinePosition.Bottom">
@for (int i = 0; i < PCRB.Stages.Length; i++) {
Color color;
if (pcrb.CurrentStep > i || pcrb.CurrentStep == (PCRB.Stages.Length - 1)) {
color = Color.Success;
} else if (pcrb.CurrentStep == i) {
color = Color.Info;
} else {
color = Color.Dark;
}
string stageName = PCRB.Stages[i];
<MudTimelineItem Color="@color" Variant="Variant.Filled">
<MudText Align="Align.Center" Color="@color">@stageName</MudText>
</MudTimelineItem>
}
</MudTimeline>
bool pcrbIsSubmitted = pcrb.CurrentStep > 0 && pcrb.InsertTimeStamp > DateTimeUtilities.MIN_DT;
bool pcrbIsComplete = pcrb.ClosedDate < DateTimeUtilities.MAX_DT && pcrb.CurrentStep == (PCRB.Stages.Length - 1);
bool userIsOriginator = pcrb.OwnerID == authStateProvider.CurrentUser?.UserID;
bool userIsAdmin = authStateProvider.CurrentUser is null ? false : authStateProvider.CurrentUser.IsAdmin;
bool userIsApprover = UserIsApprover();
@if ((!pcrbIsSubmitted && !string.IsNullOrWhiteSpace(pcrb.Title) && (userIsOriginator || userIsAdmin)) ||
(!pcrbIsSubmitted && pcrb.PlanNumber > 0 && (userIsOriginator || userIsAdmin))) {
<MudPaper Outlined="true"
Class="p-2 m-2 d-flex flex-wrap gap-3 justify-content-center align-content-center"
Elevation="10">
@if (!pcrbIsSubmitted && !string.IsNullOrWhiteSpace(pcrb.Title) && (userIsOriginator || userIsAdmin)) {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
Disabled="@saveInProcess"
OnClick=SavePCRB>
@if (saveInProcess) {
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
<MudText>Processing</MudText>
} else {
<MudText>Save</MudText>
}
</MudButton>
}
@if (!pcrbIsSubmitted && pcrb.PlanNumber > 0 && (userIsOriginator || userIsAdmin)) {
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
Disabled="@deleteInProcess"
OnClick=DeletePCRB>
@if (deleteInProcess) {
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
<MudText>Processing</MudText>
} else {
<MudText>Delete</MudText>
}
</MudButton>
}
</MudPaper>
}
@if (!pcrbIsSubmitted && GetIncompleteFields().Count() > 0) {
IEnumerable<string> incompleteFields = GetIncompleteFields();
StringBuilder errorBuilder = new();
errorBuilder.Append($"Incomplete fields: {incompleteFields.First()}");
for (int i = 1; i < incompleteFields.Count(); i++) {
errorBuilder.Append($", {incompleteFields.ElementAt(i)}");
}
<MudPaper Outlined Class="p-2 m-2">
<MudText Align="Align.Center" Color="Color.Secondary" Typo="Typo.h6">
@errorBuilder.ToString()
</MudText>
</MudPaper>
}
<MudPaper Outlined="true"
Class="p-2 m-2 d-flex flex-wrap gap-3 justify-content-center align-content-start"
Elevation="10">
<MudTextField @bind-Value=pcrb.PlanNumber
Text="@pcrb.PlanNumber.ToString()"
T="int"
Disabled="true"
Label="Change#"
Required
Variant="Variant.Outlined" />
<MudTextField @bind-Value=pcrb.Title
Text="@pcrb.Title"
Disabled="@(pcrbIsSubmitted)"
T="string"
AutoGrow
AutoFocus
Immediate
Clearable
Required
Variant="Variant.Outlined"
Label="Project Name" />
<MudSelect T="User"
Label="Originator"
Variant="Variant.Outlined"
Required
Clearable
AnchorOrigin="Origin.BottomCenter"
ToStringFunc="@UserToNameConverter"
Disabled=@(pcrbIsSubmitted)
@bind-Value=@selectedOwner>
@foreach (User user in allActiveUsers.OrderBy(u => u.LastName)) {
<MudSelectItem T="User" Value="@(user)" />
}
</MudSelect>
<MudSelect T="string"
Variant="Variant.Outlined"
Required
Clearable
AnchorOrigin="Origin.BottomCenter"
Disabled="@pcrbIsSubmitted"
@bind-Value="@pcrb.ChangeLevel"
Text="@pcrb.ChangeLevel"
Label="Change Level">
<MudSelectItem Value="@("Global - Class 1")" />
<MudSelectItem Value="@("Other Site + Mesa - Class 2")" />
<MudSelectItem Value="@("Mesa - Class 3")" />
</MudSelect>
<MudSelect T="string"
Variant="Variant.Outlined"
Required
Clearable
AnchorOrigin="Origin.BottomCenter"
Disabled="@pcrbIsSubmitted"
@bind-Value="@pcrb.Type"
Text="@pcrb.Type"
Label="Change Type">
<MudSelectItem Value="@("Cost Savings")" />
<MudSelectItem Value="@("Process Efficiency")" />
<MudSelectItem Value="@("Process Improvement")" />
<MudSelectItem Value="@("Business Continuity")" />
</MudSelect>
<MudCheckBox Disabled="@pcrbIsSubmitted"
Color="Color.Tertiary"
@bind-Value=pcrb.IsITAR
Label="Export Controlled"
LabelPosition="LabelPosition.Start" />
<MudTextField Disabled="true"
T="string"
Value="@DateTimeUtilities.GetDateAsStringMinDefault(pcrb.InsertTimeStamp)"
Label="Submit Date"
Variant="Variant.Outlined" />
<MudTextField Disabled="true"
T="string"
Value="@DateTimeUtilities.GetDateAsStringMinDefault(pcrb.LastUpdateDate)"
Label="Last Update"
Variant="Variant.Outlined" />
<MudTextField Disabled="true"
T="string"
Value="@DateTimeUtilities.GetDateAsStringMaxDefault(pcrb.ClosedDate)"
Label="Complete Date"
Variant="Variant.Outlined" />
</MudPaper>
<MudPaper Outlined="true"
Class="p-2 m-2 d-flex flex-wrap gap-3 justify-content-center align-content-start"
Elevation="10">
<MudTextField @bind-Value=pcrb.ChangeDescription
Text="@pcrb.ChangeDescription"
Disabled="@(pcrbIsSubmitted)"
T="string"
AutoGrow
Immediate
Clearable
Required
Variant="Variant.Outlined"
Label="Description Of Change" />
<MudTextField @bind-Value=pcrb.ReasonForChange
Text="@pcrb.ReasonForChange"
Disabled="@(pcrbIsSubmitted)"
T="string"
AutoGrow
Immediate
Clearable
Required
Variant="Variant.Outlined"
Label="Reason For Change" />
</MudPaper>
@if (pcrb.PlanNumber > 0 && pcrb.CurrentStep > 0) {
<MudExpansionPanels MultiExpansion="true">
@for (int i = 1; i < 4; i++) {
int current_i = i;
bool previousStageSubmitted = current_i == 1;
IEnumerable<Approval> previousStageApprovals = approvals.Where(a => a.Step == (current_i - 1));
int previousStageUnsubmittedApprovalCount = previousStageApprovals.Where(a => a.AssignedDate <= DateTimeUtilities.MIN_DT).Count();
int previousStagePendingApprovalCount = previousStageApprovals.Where(a => a.ItemStatus == 0 && a.AssignedDate > DateTimeUtilities.MIN_DT).Count();
int previousStageApprovedApprovalCount = previousStageApprovals.Where(a => a.ItemStatus == 1).Count();
int previousStageDeniedApprovalCount = previousStageApprovals.Where(a => a.ItemStatus == -1).Count();
bool previousStageApproved = current_i == 1;
if (!previousStageApproved) {
if (previousStageApprovals.Count() > 0 && previousStageUnsubmittedApprovalCount == 0 &&
previousStagePendingApprovalCount == 0 && previousStageApprovedApprovalCount >= 4)
previousStageApproved = true;
}
if (!previousStageSubmitted) {
if (((previousStagePendingApprovalCount > 0 || previousStageApprovedApprovalCount >= 4) &&
previousStageDeniedApprovalCount < previousStageApprovals.Count()) || previousStageApproved)
previousStageSubmitted = true;
}
IEnumerable<Approval> currentStageApprovals = approvals.Where(a => a.Step == current_i);
int currentStageUnsubmittedApprovalCount = currentStageApprovals.Where(a => a.AssignedDate <= DateTimeUtilities.MIN_DT).Count();
int currentStagePendingApprovalsCount = currentStageApprovals.Where(a => a.ItemStatus == 0 && a.AssignedDate > DateTimeUtilities.MIN_DT).Count();
int currentStageApprovedApprovalsCount = currentStageApprovals.Where(a => a.ItemStatus == 1).Count();
int currentStageDeniedApprovalsCount = currentStageApprovals.Where(a => a.ItemStatus == -1).Count();
bool currentStageApproved = currentStageApprovedApprovalsCount >= 4 && currentStageUnsubmittedApprovalCount == 0 &&
currentStagePendingApprovalsCount == 0;
bool currentStageSubmitted = (currentStageApprovals.Count() > 0 && currentStagePendingApprovalsCount > 0 &&
currentStageDeniedApprovalsCount < currentStageApprovals.Count()) || currentStageApproved;
IEnumerable<PCRBAttachment> currentStageAttachments = attachments.Where(a => a.Step == current_i);
bool previousStageHasOpenGatedActionItems = actionItems.Where(a => a.Step == (current_i - 1) &&
a.ClosedStatus == false &&
a.Gating == true).Count() > 0;
IEnumerable<PCRBActionItem> currentStageActionItems = actionItems.Where(a => a.Step == current_i);
int currentStagePendingActionItemCount = currentStageActionItems.Where(a => a.ClosedStatus == false).Count();
bool allActionItemsComplete = current_i < 3 || actionItems.Where(a => a.ClosedStatus == false).Count() == 0;
bool actionItemsAreComplete = actionItems.Where(a => a.ClosedStatus == false).Count() == 0;
bool attachmentsMissing = currentStageAttachments.Count() == 0;
bool actionItemsIncomplete = current_i < 3 && currentStagePendingActionItemCount > 0;
bool affectedDocumentsIncomplete = current_i == 3 && pcr3Documents.Where(d => d.CompletedByID <= 0).Count() > 0;
bool approvalsIncomplete = currentStageApprovals.Count() > 0 && currentStagePendingApprovalsCount > 0;
IEnumerable<PCRBAttendee> currentStageAttendees = attendees.Where(a => a.Step == current_i);
bool atLeastOneAttendeeAttended = currentStageAttendees.Where(a => a.Attended == true).Count() > 0;
<MudExpansionPanel Class="m-2" Expanded="@(previousStageSubmitted && (attachmentsMissing || actionItemsIncomplete ||
affectedDocumentsIncomplete || !currentStageSubmitted || approvalsIncomplete))">
<TitleContent>
<MudText Typo="Typo.h4" Align="Align.Center">@($"PCR {current_i}")</MudText>
@if (previousStageSubmitted && (attachmentsMissing || actionItemsIncomplete ||
affectedDocumentsIncomplete || approvalsIncomplete)) {
StringBuilder sb = new();
int missingSectionCount = 0;
sb.Append("Incomplete sections: ");
if (attachmentsMissing) {
missingSectionCount++;
sb.Append("upload PCRB");
}
if (actionItemsIncomplete) {
if (missingSectionCount > 0) sb.Append(", ");
missingSectionCount++;
sb.Append("action items incomplete");
}
if (affectedDocumentsIncomplete) {
if (missingSectionCount > 0) sb.Append(", ");
missingSectionCount++;
sb.Append("affected documents not closed");
}
if (approvalsIncomplete) {
if (missingSectionCount > 0) sb.Append(", ");
sb.Append("approvals still pending");
}
<MudText Align="Align.Center" Color="Color.Secondary" Typo="Typo.h6">
@sb.ToString()
</MudText>
}
@if (actionItemsIncomplete) {
<MudText Align="Align.Center" Color="Color.Secondary" Typo="Typo.subtitle1">
All actions must be completed before PCR3 is submitted for approval
</MudText>
}
@if (previousStageHasOpenGatedActionItems) {
<MudText Align="Align.Center" Color="Color.Secondary" Typo="Typo.subtitle1">
This stage cannot be submitted for approval until previous stage's gated action items are closed
</MudText>
}
</TitleContent>
<ChildContent>
<MudPaper Outlined="true"
Class="p-2 m-2 d-flex flex-column justify-start">
<MudText Typo="Typo.h5" Align="Align.Center">Supporting Documents</MudText>
<MudTable Items="@attachments.Where(a => a.Step == current_i)"
Class="m-2"
Striped="true"
SortLabel="Sort By"
Hover="true">
<ToolBarContent>
<MudStack Row="true" Justify="Justify.Center" Spacing="1" Style="width: 100%">
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && previousStageSubmitted && !currentStageSubmitted) {
@if (current_i == 1) {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
Href="https://plm.intra.infineon.com/Windchill/netmarkets/jsp/ext/infineon/dcoidreleased.jsp?obid=OR:wt.doc.WTDocument:1477717325"
Target="_blank">
Download PCRB Template
</MudButton>
}
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
OnClick="@((e) => UploadAttachment(current_i))"
Disabled="@attachmentUploadInProcess"
StartIcon="@Icons.Material.Filled.AttachFile">
@if (attachmentUploadInProcess) {
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
<MudText>Processing</MudText>
} else {
<MudText>Upload Document</MudText>
}
</MudButton>
}
</MudStack>
</ToolBarContent>
<HeaderContent>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBAttachment, object>(x=>x.FileName)">
File Name
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBAttachment, object>(x=>x.UploadedBy is null ? string.Empty : x.UploadedBy.LastName)">
Uploaded By
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBAttachment, object>(x=>x.UploadDateTime)">
Uploaded Date
</MudTableSortLabel>
</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="File Name">
<a href="@(@$"{config["FabApprovalApiBaseUrl"]}/pcrb/attachmentFile?path={context.Path}&fileName={context.FileName}")"
download="@(context.FileName)"
target="_top">
@context.FileName
</a>
</MudTd>
<MudTd DataLabel="Uploaded By">@(context.UploadedBy is null ? string.Empty : context.UploadedBy.GetFullName())</MudTd>
<MudTd DataLabel="Uploaded Date">@context.UploadDateTime.ToString("yyyy-MM-dd HH:mm")</MudTd>
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && previousStageSubmitted && !currentStageSubmitted) {
<MudTd Style="text-align:center;">
<MudButton Color="Color.Secondary"
Variant="Variant.Filled"
Disabled="@deleteAttachmentInProcess"
OnClick="@((e) => DeleteAttachment(context))">
@if (deleteAttachmentInProcess) {
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
<MudText>Deleting</MudText>
} else {
<MudText>Delete</MudText>
}
</MudButton>
</MudTd>
}
</RowTemplate>
</MudTable>
<MudDivider DividerType="DividerType.Middle" Class="my-1" />
@if (current_i < 3) {
<MudText Typo="Typo.h5" Align="Align.Center">Action Items</MudText>
@if (!currentStageSubmitted && actionItems.Where(a => a.Step == current_i).Count() == 0) {
<MudText Typo="Typo.h6" Color="Color.Secondary" Align="Align.Center">
Add action items if applicable
</MudText>
}
<MudTable Items="@actionItems.Where(a => a.Step == current_i)"
Class="m-2"
Striped="true"
SortLabel="Sort By"
Hover="true">
<ToolBarContent>
<MudStack Row="true" Justify="Justify.Center" Spacing="1" Style="width: 100%">
@if (previousStageSubmitted && !currentStageSubmitted) {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
OnClick="@((e) => CreateNewActionItem(current_i))">
<MudText>New Action Item</MudText>
</MudButton>
}
@if (currentStagePendingActionItemCount > 0) {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
Disabled="@processing"
OnClick="@((e) => CloseAllActionItems(current_i))">
<MudText>Complete All Actions</MudText>
</MudButton>
}
</MudStack>
</ToolBarContent>
<HeaderContent>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBActionItem, object>(x=>x.Name)">
Action
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBActionItem, object>(x=>x.ResponsiblePerson is null ?
string.Empty :
x.ResponsiblePerson.LastName)">
Responsible Person
</MudTableSortLabel>
</MudTh>
<MudTh>
Gating
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBActionItem, object>(x=>x.ClosedDate is null ?
DateTimeUtilities.MAX_DT :
x.ClosedDate)">
Closed Date
</MudTableSortLabel>
</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Action">@context.Name</MudTd>
<MudTd DataLabel="Responsible Person">
@(context.ResponsiblePerson is null ? string.Empty : context.ResponsiblePerson.GetFullName())
</MudTd>
<MudTd DataLabel="Gating">@(context.Gating ? "Yes" : "No")</MudTd>
<MudTd DataLabel="Closed Date">
@DateTimeUtilities.GetDateAsStringMaxDefault(context.ClosedDate)
</MudTd>
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && context.ClosedByID == 0) {
<MudTd Style="text-align:center;">
<MudButton Color="Color.Tertiary"
Variant="Variant.Filled"
OnClick="@((e) => UpdateActionItem(context))">
<MudText>Update</MudText>
</MudButton>
@if (!currentStageSubmitted) {
<MudButton Color="Color.Secondary"
Variant="Variant.Filled"
OnClick="@((e) => DeleteActionItem(context))">
<MudText>Delete</MudText>
</MudButton>
}
</MudTd>
}
</RowTemplate>
</MudTable>
} else {
int openPCR3Documents = pcr3Documents.Where(d => d.CompletedByID <= 0).Count();
<MudText Typo="Typo.h5" Align="Align.Center">Affected Documents</MudText>
<MudTable Items="@pcr3Documents"
Class="m-2"
Striped="true"
SortLabel="Sort By"
Hover="true">
<HeaderContent>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCR3Document, object>(x=>x.DocType)">
Document Type
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCR3Document, object>(x=>x.DocNumbers)">
Document Numbers
</MudTableSortLabel>
</MudTh>
<MudTh>
Comments
</MudTh>
<MudTh>
ECN#
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCR3Document, object>(x=>x.CompletedDate >= DateTimeUtilities.MAX_DT ?
DateTimeUtilities.MAX_DT :
x.CompletedDate)">
Closed Date
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCR3Document, object>(x=>x.CompletedBy is null ?
string.Empty :
x.CompletedBy.LastName)">
Closed By
</MudTableSortLabel>
</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Document Type">@context.DocType</MudTd>
<MudTd DataLabel="Document Numbers">@context.DocNumbers</MudTd>
<MudTd DataLabel="Comments">@context.Comment</MudTd>
<MudTd DataLabel="ECN#">
@if (string.IsNullOrWhiteSpace(context.GetEcnNumberString())) {
context.GetEcnNumberString();
} else {
<MudLink
Href=@($"{config["OldFabApprovalUrl"]}/ECN/Edit?IssueID={context.GetEcnNumberString()}")
Target="_blank">
@context.GetEcnNumberString()
</MudLink>
}
</MudTd>
<MudTd DataLabel="Closed Date">@(DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate))</MudTd>
<MudTd DataLabel="Closed By">
@(context.CompletedBy is null ? string.Empty : context.CompletedBy.GetFullName())
</MudTd>
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && !currentStageSubmitted) {
<MudTd Style="text-align:center;">
<MudButton Color="Color.Tertiary"
Variant="Variant.Filled"
OnClick="@((e) => UpdatePCR3Document(context))">
<MudText>Update</MudText>
</MudButton>
</MudTd>
}
</RowTemplate>
</MudTable>
}
<MudDivider DividerType="DividerType.Middle" Class="my-1" />
<MudText Typo="Typo.h5" Align="Align.Center">Attendees</MudText>
<MudTable Items="@attendees.Where(a => a.Step == current_i)"
Class="m-2"
Striped="true"
SortLabel="Sort By"
Hover="true">
<ToolBarContent>
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && !currentStageSubmitted) {
<MudStack Row="true" Justify="Justify.Center" Spacing="1" Style="width: 100%">
<MudButton Color="Color.Tertiary"
Variant="Variant.Filled"
Class="m-1"
OnClick="@((e) => AddAttendee(current_i))">
<MudText>Add Attendee</MudText>
</MudButton>
<MudButton Color="Color.Tertiary"
Variant="Variant.Filled"
Class="m-1"
OnClick="@((e) => MarkAllAttended(current_i))">
<MudText>Mark All Attended</MudText>
</MudButton>
</MudStack>
}
</ToolBarContent>
<HeaderContent>
<MudTh>
<MudTableSortLabel SortBy="new Func<PCRBAttendee, object>(x=>x.Attendee is null ?
string.Empty :
x.Attendee.LastName)">
Attendee Name
</MudTableSortLabel>
</MudTh>
<MudTh>Attended?</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Attendee Name">
@(context.Attendee is null ? string.Empty : context.Attendee.GetFullName())
</MudTd>
<MudTd DataLabel="Attended?">
<MudIconButton Disabled="@(pcrb.ClosedDate < DateTimeUtilities.MAX_DT || currentStageSubmitted)"
Icon="@(context.Attended ? Icons.Material.Filled.CheckBox : Icons.Material.Filled.CheckBoxOutlineBlank)"
Color="Color.Tertiary"
OnClick="@((e) => MarkAttended(context))" />
</MudTd>
</RowTemplate>
</MudTable>
<MudDivider DividerType="DividerType.Middle" Class="my-1" />
<MudText Typo="Typo.h5" Align="Align.Center">Approvers</MudText>
@if (!actionItemsAreComplete && current_i == 3) {
<MudText Align="Align.Center" Color="Color.Secondary" Typo="Typo.subtitle1">
All actions must be completed before PCR3 is submitted for approval
</MudText>
}
<MudTable Items="@approvals.Where(a => a.Step == current_i).OrderBy(a => a.CompletedDate)"
Class="m-2"
Striped="true"
SortLabel="Sort By"
Hover="true">
<ToolBarContent>
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && previousStageApproved) {
<MudStack Row="true" Justify="Justify.Center" Spacing="1" Style="width: 100%">
@if (!currentStageSubmitted) {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
OnClick="@((e) => AddApprover(current_i))">
<MudText>Add Approver</MudText>
</MudButton>
}
@if (previousStageSubmitted && !currentStageSubmitted && currentStageAttachments.Count() > 0 &&
!affectedDocumentsIncomplete && allActionItemsComplete &&
!previousStageHasOpenGatedActionItems && atLeastOneAttendeeAttended) {
@if (submitInProcess) {
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
<MudText>Submitting</MudText>
} else {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
Disabled="@submitInProcess"
OnClick="@((e) => SubmitForApproval(current_i))">
<MudText>Submit For Approval</MudText>
</MudButton>
}
}
</MudStack>
}
</ToolBarContent>
<HeaderContent>
<MudTh>
<MudTableSortLabel SortBy="new Func<Approval, object>(x=>x.User is null ?
string.Empty :
x.User.LastName)">
Approver Name
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortBy="new Func<Approval, object>(x=>SubRoleCategoryItemToJobTitleConverter(x.SubRoleCategoryItem))">
Job Title
</MudTableSortLabel>
</MudTh>
<MudTh>Status</MudTh>
<MudTh>Assigned Date</MudTh>
<MudTh>Disposition Date</MudTh>
<MudTh>Comments</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Approver Name">
@(context.User is null ? string.Empty : context.User.GetFullName())
</MudTd>
<MudTd DataLabel="Job Title">@SubRoleCategoryItemToJobTitleConverter(context.SubRoleCategoryItem)</MudTd>
<MudTd DataLabel="Status">@GetApprovalStatus(context.ItemStatus)</MudTd>
<MudTd DataLabel="Assigned Date">@DateTimeUtilities.GetDateAsStringMinDefault(context.AssignedDate)</MudTd>
<MudTd DataLabel="Disposition Date">@DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate)</MudTd>
<MudTd DataLabel="Comments">@context.Comments</MudTd>
@if (pcrb.ClosedDate >= DateTimeUtilities.MAX_DT && (currentStageUnsubmittedApprovalCount > 0 ||
currentStagePendingApprovalsCount > 0)) {
<MudTd Style="text-align:center;">
@if (context.ItemStatus == 0 && userIsAdmin) {
<MudButton Color="Color.Warning"
Variant="Variant.Filled"
Class="m-1"
OnClick="@((e) => UpdateApproval(context))">
<MudText>Update</MudText>
</MudButton>
}
@if ((current_i < 3 || pcr3Documents.Where(d=>d.CompletedByID == 0).Count() == 0) &&
(authStateProvider.CurrentUser is not null && context.UserID == authStateProvider.CurrentUser.UserID) &&
context.ItemStatus == 0 && context.AssignedDate > DateTimeUtilities.MIN_DT) {
<MudButton Color="Color.Tertiary"
Variant="Variant.Filled"
Class="m-1"
Disabled="@processing"
OnClick="@((e) => ApprovePCR(current_i))">
<MudText>Approve</MudText>
</MudButton>
<MudButton Color="Color.Secondary"
Variant="Variant.Filled"
Class="m-1"
Disabled="@processing"
OnClick="@((e) => DenyPCR(current_i))">
<MudText>Deny</MudText>
</MudButton>
}
</MudTd>
}
</RowTemplate>
</MudTable>
</MudPaper>
</ChildContent>
</MudExpansionPanel>
}
</MudExpansionPanels>
}
}
<MudOverlay Visible=processing DarkBackground="true" AutoClose="false">
<MudProgressCircular Color="Color.Info" Size="Size.Large" Indeterminate="true" />
</MudOverlay>