732 lines
35 KiB
Plaintext
732 lines
35 KiB
Plaintext
@page "/mrb/{mrbNumber}"
|
|
@page "/mrb/new"
|
|
@using System.Text
|
|
|
|
@if (mrbNumber is not null) {
|
|
<PageTitle>MRB @mrbNumber</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="@ReturnToAllMrbs"
|
|
Size="Size.Large" />
|
|
<MudText Typo="Typo.h3" Align="Align.Center">MRB @mrbNumber</MudText>
|
|
<MudPaper Height="100%" Width="0.1%" Square="true" />
|
|
</MudPaper>
|
|
}
|
|
|
|
@if (mrb is not null) {
|
|
<MudTimeline Class="mt-2 pt-2" TimelineOrientation="TimelineOrientation.Horizontal"
|
|
TimelinePosition="TimelinePosition.Bottom">
|
|
@for (int i = 0; i < MRB.Stages.Length; i++) {
|
|
Color color;
|
|
if (mrb.StageNo > i || mrb.StageNo == (MRB.Stages.Length - 1)) {
|
|
color = Color.Success;
|
|
} else if (mrb.StageNo == i) {
|
|
color = Color.Info;
|
|
} else {
|
|
color = Color.Dark;
|
|
}
|
|
|
|
string stageName = MRB.Stages[i];
|
|
|
|
<MudTimelineItem Color="@color" Variant="Variant.Filled">
|
|
<MudText Align="Align.Center" Color="@color">@stageName</MudText>
|
|
</MudTimelineItem>
|
|
}
|
|
</MudTimeline>
|
|
|
|
bool mrbIsSubmitted = mrb.SubmittedDate > DateTimeUtilities.MIN_DT;
|
|
bool mrbReadyToSubmit = mrbIsReadyToSubmit();
|
|
bool userIsApprover = currentUserIsApprover();
|
|
|
|
bool approvalsArePending = false;
|
|
foreach (Approval approval in nonTaskApprovals) {
|
|
if (approval.ItemStatus == 0) approvalsArePending = true;
|
|
}
|
|
|
|
bool userIsOriginator = mrb.OriginatorID == authStateProvider.CurrentUser?.UserID;
|
|
bool userIsAdmin = authStateProvider.CurrentUser is null ? false : authStateProvider.CurrentUser.IsAdmin;
|
|
bool mrbNumberIsValid = mrb is null ? false : mrb.MRBNumber > 0;
|
|
User? currentUser = authStateProvider.CurrentUser;
|
|
|
|
if ((!mrbIsSubmitted && !string.IsNullOrWhiteSpace(mrb.Title)) ||
|
|
(!mrbIsSubmitted && mrbNumberIsValid && (userIsOriginator || userIsAdmin)) ||
|
|
(!mrbIsSubmitted && mrbReadyToSubmit && (userIsOriginator || userIsAdmin)) ||
|
|
(mrbIsSubmitted && userIsApprover && approvalsArePending) ||
|
|
((userIsOriginator || userIsAdmin) && mrb.StageNo > 0 && mrb.StageNo < 4)) {
|
|
<MudPaper Outlined="true"
|
|
Class="p-2 m-2 d-flex flex-wrap gap-3 justify-content-center align-content-center"
|
|
Elevation="10">
|
|
@if (!mrbIsSubmitted && !string.IsNullOrWhiteSpace(mrb.Title)) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Disabled="@saveInProcess"
|
|
OnClick=SaveMRB>
|
|
@if (saveInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Save</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
@if (!mrbIsSubmitted && mrbNumberIsValid && (userIsOriginator || userIsAdmin)) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Secondary"
|
|
Disabled="@deleteInProcess"
|
|
OnClick=DeleteMRB>
|
|
@if (deleteInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Delete</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
@if (!mrbIsSubmitted && mrbReadyToSubmit && (userIsOriginator || userIsAdmin)) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Disabled="@submitInProcess"
|
|
OnClick=SubmitMRBForApproval>
|
|
@if (submitInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Submit for Approval</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
@if (mrbIsSubmitted && userIsApprover && approvalsArePending) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Disabled="@approvalInProcess"
|
|
OnClick=ApproveMRB>
|
|
@if (approvalInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Approve</MudText>
|
|
}
|
|
</MudButton>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Secondary"
|
|
Disabled="@denialInProcess"
|
|
OnClick=DenyMRB>
|
|
@if (denialInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Deny</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
@if ((userIsOriginator || userIsAdmin) && mrb.StageNo > 0 && mrb.StageNo < 4) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Disabled="@recallInProcess"
|
|
OnClick=RecallMRB>
|
|
@if (recallInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Recall</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
</MudPaper>
|
|
}
|
|
|
|
@if (!mrbIsSubmitted && 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=mrb.MRBNumber
|
|
Text="@mrb.MRBNumber.ToString()"
|
|
T="int"
|
|
Disabled="true"
|
|
Label="MRB#"
|
|
Required
|
|
Variant="Variant.Outlined" />
|
|
<MudTextField @bind-Value=mrb.Title
|
|
Text="@mrb.Title"
|
|
Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
T="string"
|
|
AutoGrow
|
|
AutoFocus
|
|
Clearable
|
|
Required
|
|
Variant="Variant.Outlined"
|
|
Label="Title" />
|
|
<MudTextField Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
@bind-Value=mrb.IssueDescription
|
|
Text="@mrb.IssueDescription"
|
|
AutoGrow
|
|
Required
|
|
Clearable
|
|
Variant="Variant.Outlined"
|
|
Label="Description" />
|
|
<MudTextField Disabled="true"
|
|
T="string"
|
|
Value="@DateTimeUtilities.GetDateAsStringMinDefault(mrb.SubmittedDate)"
|
|
Label="Submit Date"
|
|
Variant="Variant.Outlined" />
|
|
<MudTextField Disabled="true"
|
|
Label="Approval Date"
|
|
Variant="Variant.Outlined"
|
|
Value="@DateTimeUtilities.GetDateAsStringMaxDefault(mrb.ApprovalDate)"
|
|
T="string" />
|
|
<MudTextField Disabled="true"
|
|
Label="Closed Date"
|
|
Variant="Variant.Outlined"
|
|
Value="@DateTimeUtilities.GetDateAsStringMaxDefault(mrb.CloseDate)"
|
|
T="string" />
|
|
@if (mrb is not null && mrb.CancelDate < DateTimeUtilities.MAX_DT) {
|
|
<MudTextField Disabled="true"
|
|
Label="Canceled Date"
|
|
Variant="Variant.Outlined"
|
|
Value="@DateTimeUtilities.GetDateAsStringMaxDefault(mrb.CancelDate)"
|
|
T="string" />
|
|
}
|
|
|
|
<MudSelect T="string"
|
|
Label="Originator"
|
|
Variant="Variant.Outlined"
|
|
Required
|
|
Clearable
|
|
AnchorOrigin="Origin.BottomCenter"
|
|
Disabled=@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)
|
|
@bind-Value=mrb.OriginatorName
|
|
Text="@mrb.OriginatorName">
|
|
@foreach (User user in allActiveUsers.OrderBy(u => u.LastName)) {
|
|
<MudSelectItem T="string" Value="@($"{user.FirstName} {user.LastName}")" />
|
|
}
|
|
</MudSelect>
|
|
<MudSelect T="string"
|
|
Label="Category"
|
|
Variant="Variant.Outlined"
|
|
Required
|
|
Immediate
|
|
Clearable
|
|
AnchorOrigin="Origin.BottomCenter"
|
|
Disabled=@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)
|
|
@bind-Value=mrb.Category
|
|
Text="@mrb.Category">
|
|
<MudSelectItem Value="@("Material Containment")" />
|
|
<MudSelectItem Value="@("Material Release")" />
|
|
<MudSelectItem Value="@("Material Transfer")" />
|
|
</MudSelect>
|
|
<MudSelect T="string"
|
|
Label="Department"
|
|
Variant="Variant.Outlined"
|
|
Required
|
|
Clearable
|
|
AnchorOrigin="Origin.BottomCenter"
|
|
Disabled=@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)
|
|
ValueChanged="@DepartmentChanged"
|
|
Text="@mrb.Department">
|
|
<MudSelectItem Value="@("Production")" />
|
|
<MudSelectItem Value="@("Engineering")" />
|
|
<MudSelectItem Value="@("Materials")" />
|
|
<MudSelectItem Value="@("Facilities")" />
|
|
<MudSelectItem Value="@("Maintenance")" />
|
|
<MudSelectItem Value="@("Quality")" />
|
|
</MudSelect>
|
|
<MudSelect T="string"
|
|
Label="Process"
|
|
Variant="Variant.Outlined"
|
|
Required
|
|
Clearable
|
|
AnchorOrigin="Origin.BottomCenter"
|
|
Disabled=@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)
|
|
ValueChanged="@ProcessChanged"
|
|
Text="@mrb.Process">
|
|
@if (mrb.Department.Equals("Production")) {
|
|
foreach (Process process in Process.ProductionProcesses) {
|
|
<MudSelectItem Value="@process.Name" />
|
|
}
|
|
} else if (mrb.Department.Equals("Engineering")) {
|
|
foreach (Process process in Process.EngineeringProcesses) {
|
|
<MudSelectItem Value="@process.Name" />
|
|
}
|
|
} else if (mrb.Department.Equals("Materials")) {
|
|
foreach (Process process in Process.MaterialsProcesses) {
|
|
<MudSelectItem Value="@process.Name" />
|
|
}
|
|
} else if (mrb.Department.Equals("Facilities")) {
|
|
foreach (Process process in Process.FacilitiesProcesses) {
|
|
<MudSelectItem Value="@process.Name" />
|
|
}
|
|
} else if (mrb.Department.Equals("Maintenance")) {
|
|
foreach (Process process in Process.MaintenanceProcesses) {
|
|
<MudSelectItem Value="@process.Name" />
|
|
}
|
|
} else if (mrb.Department.Equals("Quality")) {
|
|
foreach (Process process in Process.QualityProcesses) {
|
|
<MudSelectItem Value="@process.Name" />
|
|
}
|
|
}
|
|
</MudSelect>
|
|
@if (mrb.Process.Equals("Reactor") ||
|
|
mrb.Process.Equals("Metrology") ||
|
|
mrb.Process.Equals("Cleans") ||
|
|
mrb.Process.Equals("Packaging") ||
|
|
mrb.Process.Equals("Final QA")) {
|
|
<MudSelect T="string"
|
|
Label="Tool"
|
|
Clearable
|
|
Variant="Variant.Outlined"
|
|
AnchorOrigin="Origin.BottomCenter"
|
|
Disabled=@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)
|
|
Text="@mrb.Tool"
|
|
@bind-Value=mrb.Tool
|
|
>
|
|
<MudSelectItem Value="@string.Empty" />
|
|
@if (mrb.Process.Equals("Reactor")) {
|
|
@foreach (Tool tool in Tool.ReactorTools) {
|
|
<MudSelectItem Value="@tool.Name" />
|
|
}
|
|
}
|
|
@if (mrb.Process.Equals("Metrology")) {
|
|
@foreach (Tool tool in Tool.MetrologyTools) {
|
|
<MudSelectItem Value="@tool.Name" />
|
|
}
|
|
}
|
|
@if (mrb.Process.Equals("Cleans")) {
|
|
@foreach (Tool tool in Tool.CleansTools) {
|
|
<MudSelectItem Value="@tool.Name" />
|
|
}
|
|
}
|
|
@if (mrb.Process.Equals("Packaging")) {
|
|
@foreach (Tool tool in Tool.PackagingTools) {
|
|
<MudSelectItem Value="@tool.Name" />
|
|
}
|
|
}
|
|
@if (mrb.Process.Equals("Final QA")) {
|
|
@foreach (Tool tool in Tool.FqaTools) {
|
|
<MudSelectItem Value="@tool.Name" />
|
|
}
|
|
}
|
|
</MudSelect>
|
|
}
|
|
|
|
<MudTextField Disabled="true"
|
|
@bind-Value=mrb.NumberOfLotsAffected
|
|
Text="@mrb.NumberOfLotsAffected.ToString()"
|
|
Variant="Variant.Outlined"
|
|
Clearable
|
|
Immediate
|
|
Label="Total Quantity" />
|
|
<MudNumericField @bind-Value=mrb.Val
|
|
Required
|
|
Label="Value"
|
|
Variant="Variant.Outlined"
|
|
Adornment="Adornment.Start"
|
|
AdornmentIcon="@Icons.Material.Filled.AttachMoney"
|
|
AdornmentColor="Color.Success"
|
|
Immediate
|
|
ErrorText="Value must be greater than 0"
|
|
Validation="new Func<double, bool>(v => v > 0)"
|
|
Clearable
|
|
Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)" />
|
|
<MudTextField Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
@bind-Value=mrb.RMANo
|
|
Text="@mrb.RMANo.ToString()"
|
|
Clearable
|
|
Variant="Variant.Outlined"
|
|
Label="RMA#" />
|
|
<MudTextField Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
@bind-Value=mrb.PCRBNo
|
|
@ref=pcrbNoField
|
|
Text="@mrb.PCRBNo"
|
|
Variant="Variant.Outlined"
|
|
Clearable
|
|
Immediate
|
|
AutoGrow
|
|
Validation="@(new Func<string, Task<string>>(PCRBNoIsValid))"
|
|
Label="PCRB#" />
|
|
<MudPaper Outlined="true" Class="p-2">
|
|
<MudCheckBox Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
Color="Color.Tertiary"
|
|
ValueChanged="@(new Func<bool, Task>(SpecsImpactedChanged))"
|
|
Label="Specs Impacted?"
|
|
LabelPosition="LabelPosition.Start" />
|
|
@if (mrb.SpecsImpacted) {
|
|
<MudTextField Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
@bind-Value=mrb.ProcessECNNumber
|
|
@ref=processEcnField
|
|
Required
|
|
Clearable
|
|
Variant="Variant.Outlined"
|
|
InputType="@InputType.Number"
|
|
Validation="@(new Func<int, Task<string>>(ECNNoIsValid))"
|
|
Label="Process ECN#"
|
|
Immediate
|
|
AutoGrow />
|
|
}
|
|
</MudPaper>
|
|
<MudPaper Outlined="true" Class="p-2">
|
|
<MudCheckBox Disabled="@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)"
|
|
ValueChanged="@(new Func<bool, Task>(CustomerImpactedChanged))"
|
|
Color="Color.Tertiary"
|
|
Label="Customer Impacted?"
|
|
LabelPosition="LabelPosition.Start" />
|
|
@if (mrb.CustomerImpacted) {
|
|
<MudSelect T="string"
|
|
Label="Affected Customer"
|
|
Required
|
|
Clearable
|
|
Variant="Variant.Outlined"
|
|
AnchorOrigin="Origin.BottomCenter"
|
|
Disabled=@(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)
|
|
@bind-Value=mrb.CustomerImpactedName
|
|
Text="@mrb.CustomerImpactedName">
|
|
@foreach (string customer in customerNames) {
|
|
<MudSelectItem Value="@(customer)" />
|
|
}
|
|
</MudSelect>
|
|
}
|
|
</MudPaper>
|
|
</MudPaper>
|
|
}
|
|
|
|
@if (mrb is not null && mrb.MRBNumber > 0) {
|
|
<MudPaper Outlined="true"
|
|
Class="p-2 m-2 d-flex flex-column justify-start">
|
|
<MudText Typo="Typo.h4" Align="Align.Center">Supporting Documents</MudText>
|
|
<MudDivider DividerType="DividerType.Middle" Class="my-2" />
|
|
@if (!(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) {
|
|
<MudFileUpload T="IReadOnlyList<IBrowserFile>" OnFilesChanged="AddAttachments" Class="centered-upload">
|
|
<ActivatorContent>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
style="margin: auto;"
|
|
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>
|
|
</ActivatorContent>
|
|
</MudFileUpload>
|
|
}
|
|
|
|
@if (mrbAttachments is not null) {
|
|
<MudTable Items="@mrbAttachments"
|
|
Class="m-2"
|
|
Striped="true"
|
|
Filter="new Func<MRBAttachment, bool>(FilterFuncForMRBAttachmentTable)"
|
|
SortLabel="Sort By"
|
|
Hover="true">
|
|
<ToolBarContent>
|
|
<MudSpacer />
|
|
<MudTextField @bind-Value="attachmentSearchString"
|
|
Placeholder="Search"
|
|
Adornment="Adornment.Start"
|
|
AdornmentIcon="@Icons.Material.Filled.Search"
|
|
IconSize="Size.Medium"
|
|
Class="mt-0" />
|
|
</ToolBarContent>
|
|
<HeaderContent>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAttachment, object>(x=>x.FileName)">
|
|
Name
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel InitialDirection="SortDirection.Descending" SortBy="new Func<MRBAttachment,object>(x=>x.UploadDate)">
|
|
Upload Date
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
<MudTd DataLabel="Name">
|
|
<a href="@(@$"{config["FabApprovalApiBaseUrl"]}/mrb/attachmentFile?path={context.Path}&fileName={context.FileName}")"
|
|
download="@(context.FileName)"
|
|
target="_top">
|
|
@context.FileName
|
|
</a>
|
|
</MudTd>
|
|
<MudTd DataLabel="Upload Date">@context.UploadDate.ToString("yyyy-MM-dd HH:mm")</MudTd>
|
|
@if (mrb is not null && !(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) {
|
|
<MudTd>
|
|
<MudButton Color="Color.Secondary"
|
|
Variant="Variant.Filled"
|
|
Disabled="@deleteActionInProcess"
|
|
OnClick="@((e) => DeleteAttachment(context))">
|
|
@if (deleteActionInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Deleting</MudText>
|
|
} else {
|
|
<MudText>Delete</MudText>
|
|
}
|
|
</MudButton>
|
|
</MudTd>
|
|
}
|
|
</RowTemplate>
|
|
</MudTable>
|
|
}
|
|
</MudPaper>
|
|
|
|
<MudPaper Outlined="true"
|
|
Class="p-2 m-2 d-flex flex-column justify-start">
|
|
<MudText Typo="Typo.h4" Align="Align.Center">Actions</MudText>
|
|
<MudDivider DividerType="DividerType.Middle" Class="my-2" />
|
|
@if (!(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Class="flex-grow-0"
|
|
Style="max-width: 185px;"
|
|
OnClick="@((e) => CreateNewAction())">
|
|
Create New Action
|
|
</MudButton>
|
|
}
|
|
|
|
@if (mrb.SubmittedDate > DateTimeUtilities.MIN_DT && mrb.StageNo == 3 &&
|
|
(currentUser?.UserID == mrb.OriginatorID || currentUser?.IsAdmin == true)) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Class="flex-grow-0"
|
|
Style="max-width: 185px;"
|
|
Disabled="@completeAllActionsInProcess"
|
|
OnClick="@((e) => CompleteAllActions())">
|
|
@if (completeAllActionsInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Complete All Actions</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
|
|
@if (mrbActions is not null) {
|
|
<MudTable Items="@mrbActions"
|
|
Class="m-2"
|
|
Striped="true"
|
|
Filter="new Func<MRBAction, bool>(FilterFuncForMRBActionTable)"
|
|
SortLabel="Sort By"
|
|
Hover="true">
|
|
<ToolBarContent>
|
|
<a href="@(@$"{config["FabApprovalApiBaseUrl"]}/mrb/actions/csvFile?mrbNumber={mrbNumberInt}")"
|
|
download
|
|
target="_top">
|
|
Download as CSV File
|
|
</a>
|
|
<MudSpacer />
|
|
<MudTextField @bind-Value="actionSearchString"
|
|
Placeholder="Search"
|
|
Adornment="Adornment.Start"
|
|
AdornmentIcon="@Icons.Material.Filled.Search"
|
|
IconSize="Size.Medium"
|
|
Class="mt-0" />
|
|
</ToolBarContent>
|
|
<HeaderContent>
|
|
<MudTh>
|
|
<MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<MRBAction,object>(x=>x.Action)">
|
|
Action
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAction,object>(x=>x.Customer)">
|
|
Customer
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAction,object>(x=>x.Quantity)">
|
|
Qty
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAction,object>(x=>x.PartNumber)">
|
|
Part Number
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAction,object>(x=>x.LotNumber)">
|
|
Batch Number / Lot Number
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
Justification
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAction, object>(x=>x.AssignedDate)">
|
|
Assigned Date
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="new Func<MRBAction, object>(x=>x.CompletedDate)">
|
|
Completed Date
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<MRBAction,object>(x=>x.CompletedByUser?.GetFullName() ??
|
|
x.CompletedByUserID.ToString())">
|
|
Completed By
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="string">
|
|
Comments
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
Attachments
|
|
</MudTh>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
@if (context.Action.ToLower().Equals("convert")) {
|
|
<MudTd DataLabel="Action">@context.Action @context.ConvertFrom to @context.ConvertTo</MudTd>
|
|
} else {
|
|
<MudTd DataLabel="Action">@context.Action</MudTd>
|
|
}
|
|
<MudTd DataLabel="Customer">@context.Customer</MudTd>
|
|
<MudTd DataLabel="Qty">@context.Quantity</MudTd>
|
|
<MudTd DataLabel="Part Number">@context.PartNumber</MudTd>
|
|
<MudTd DataLabel="Batch Number / Lot Number">@context.LotNumber</MudTd>
|
|
<MudTd DataLabel="Justification">@context.Justification</MudTd>
|
|
<MudTd DataLabel="Assigned Date">@DateTimeUtilities.GetDateAsStringMinDefault(context.AssignedDate)</MudTd>
|
|
<MudTd DataLabel="Completed Date">@DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate)</MudTd>
|
|
<MudTd DataLabel="Completed By">@context.CompletedByUser?.GetFullName()</MudTd>
|
|
<MudTd DataLabel="Comments">
|
|
@if (taskApprovals.Where(t => t.TaskID == context.ActionID).Count() > 0) {
|
|
Approval? approval = taskApprovals.Where(t => t.TaskID == context.ActionID).FirstOrDefault();
|
|
if (approval is not null) {
|
|
<MudText>@approval.Comments</MudText>
|
|
} else {
|
|
<MudText>@string.Empty</MudText>
|
|
}
|
|
}
|
|
</MudTd>
|
|
<MudTd DataLabel="Attachments">
|
|
@if (mrbActionAttachments.Where(a => a.ActionID == context.ActionID).Count() > 0) {
|
|
IEnumerable<MRBActionAttachment> attachments = mrbActionAttachments.Where(a => a.ActionID == context.ActionID).ToList();
|
|
foreach (MRBActionAttachment attachment in attachments) {
|
|
<MudTooltip Text="@attachment.FileName">
|
|
<MudFab Color="Color.Success"
|
|
StartIcon="@Icons.Material.Filled.AttachFile"
|
|
Size="Size.Small"
|
|
Href="@(@$"{config["FabApprovalApiBaseUrl"]}/mrb/attachmentFile?path={attachment.Path}&fileName={attachment.FileName}")" />
|
|
</MudTooltip>
|
|
}
|
|
}
|
|
</MudTd>
|
|
@if (mrb is not null && !(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) {
|
|
<MudTd>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
OnClick="@((e) => EditAction(context))">
|
|
Edit
|
|
</MudButton>
|
|
<MudButton Color="Color.Secondary"
|
|
Variant="Variant.Filled"
|
|
Disabled="@deleteActionInProcess"
|
|
OnClick="@((e) => DeleteAction(context))">
|
|
@if (deleteActionInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Deleting</MudText>
|
|
} else {
|
|
<MudText>Delete</MudText>
|
|
}
|
|
</MudButton>
|
|
</MudTd>
|
|
}
|
|
@if (currentUser is not null && taskApprovals.Where(t => t.CompletedDate > DateTime.Now &&
|
|
t.UserID == currentUser.UserID &&
|
|
t.TaskID == context.ActionID).ToList().Count() > 0 &&
|
|
context.CompletedDate >= DateTimeUtilities.MAX_DT) {
|
|
<MudTd>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
OnClick="@((e) => CompleteAction(context))">
|
|
Mark Complete
|
|
</MudButton>
|
|
</MudTd>
|
|
}
|
|
</RowTemplate>
|
|
<PagerContent>
|
|
<MudTablePager />
|
|
</PagerContent>
|
|
</MudTable>
|
|
}
|
|
</MudPaper>
|
|
|
|
bool mrbIsSubmitted = mrb.SubmittedDate > DateTimeUtilities.MIN_DT;
|
|
bool mrbReadyToSubmit = mrbIsReadyToSubmit();
|
|
bool userIsOriginator = mrb.OriginatorID == authStateProvider.CurrentUser?.UserID;
|
|
bool userIsAdmin = authStateProvider.CurrentUser is null ? false : authStateProvider.CurrentUser.IsAdmin;
|
|
|
|
<MudPaper Outlined="true"
|
|
Class="p-2 m-2 d-flex flex-column justify-center">
|
|
<MudText Typo="Typo.h4" Align="Align.Center">Approvals</MudText>
|
|
<MudDivider DividerType="DividerType.Middle" Class="my-2" />
|
|
@if (!mrbIsSubmitted && mrbReadyToSubmit && (userIsOriginator || userIsAdmin)) {
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Tertiary"
|
|
Style="max-width: 185px;"
|
|
Disabled="@submitInProcess"
|
|
OnClick=SubmitMRBForApproval>
|
|
@if (submitInProcess) {
|
|
<MudProgressCircular Class="m-1" Size="Size.Small" Indeterminate="true" />
|
|
<MudText>Processing</MudText>
|
|
} else {
|
|
<MudText>Submit for Approval</MudText>
|
|
}
|
|
</MudButton>
|
|
}
|
|
|
|
@if (nonTaskApprovals is not null) {
|
|
<MudTable Items="@nonTaskApprovals"
|
|
Class="m-2"
|
|
Striped="true">
|
|
<HeaderContent>
|
|
<MudTh>Role</MudTh>
|
|
<MudTh>Approver Name</MudTh>
|
|
<MudTh>Status</MudTh>
|
|
<MudTh>Assigned Date</MudTh>
|
|
<MudTh>Disposition Date</MudTh>
|
|
<MudTh>Comments</MudTh>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
<MudTd DataLabel="Role">@context.SubRoleCategoryItem</MudTd>
|
|
<MudTd DataLabel="Approver Name">@context.User?.GetFullName()</MudTd>
|
|
<MudTd DataLabel="Status">@context.StatusMessage</MudTd>
|
|
<MudTd DataLabel="Assigned Date">@DateTimeUtilities.GetDateAsStringMaxDefault(context.AssignedDate)</MudTd>
|
|
<MudTd DataLabel="Disposition Date">@DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate)</MudTd>
|
|
<MudTd DataLabel="Comments">@context.Comments</MudTd>
|
|
@if (context.ItemStatus == 0 && authStateProvider.CurrentUser is not null && authStateProvider.CurrentUser.IsAdmin) {
|
|
<MudTd>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Warning"
|
|
OnClick="@((e) => ReassignApproval(context))">
|
|
Reassign
|
|
</MudButton>
|
|
</MudTd>
|
|
}
|
|
</RowTemplate>
|
|
</MudTable>
|
|
}
|
|
</MudPaper>
|
|
}
|
|
|
|
<MudOverlay Visible=processing DarkBackground="true" AutoClose="false">
|
|
<MudProgressCircular Color="Color.Info" Size="Size.Large" Indeterminate="true" />
|
|
</MudOverlay> |