@page "/mrb/{mrbNumber}" @page "/mrb/new" @using System.Text @if (mrbNumber is not null) { MRB @mrbNumber MRB @mrbNumber } @if (mrb is not null) { @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]; @stageName } 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)) { @if (!mrbIsSubmitted && !string.IsNullOrWhiteSpace(mrb.Title)) { @if (saveInProcess) { Processing } else { Save } } @if (!mrbIsSubmitted && mrbNumberIsValid && (userIsOriginator || userIsAdmin)) { @if (deleteInProcess) { Processing } else { Delete } } @if (!mrbIsSubmitted && mrbReadyToSubmit && (userIsOriginator || userIsAdmin)) { @if (submitInProcess) { Processing } else { Submit for Approval } } @if (mrbIsSubmitted && userIsApprover && approvalsArePending) { @if (approvalInProcess) { Processing } else { Approve } @if (denialInProcess) { Processing } else { Deny } } @if ((userIsOriginator || userIsAdmin) && mrb.StageNo > 0 && mrb.StageNo < 4) { @if (recallInProcess) { Processing } else { Recall } } } @if (!mrbIsSubmitted && GetIncompleteFields().Count() > 0) { IEnumerable incompleteFields = GetIncompleteFields(); StringBuilder errorBuilder = new(); errorBuilder.Append($"Incomplete fields: {incompleteFields.First()}"); for (int i = 1; i < incompleteFields.Count(); i++) { errorBuilder.Append($", {incompleteFields.ElementAt(i)}"); } @errorBuilder.ToString() } @if (mrb is not null && mrb.CancelDate < DateTimeUtilities.MAX_DT) { } DateTimeUtilities.MIN_DT) @bind-Value=mrb.OriginatorName Text="@mrb.OriginatorName"> @foreach (User user in allActiveUsers.OrderBy(u => u.LastName)) { } DateTimeUtilities.MIN_DT) @bind-Value=mrb.Category Text="@mrb.Category"> DateTimeUtilities.MIN_DT) ValueChanged="@DepartmentChanged" Text="@mrb.Department"> DateTimeUtilities.MIN_DT) ValueChanged="@ProcessChanged" Text="@mrb.Process"> @if (mrb.Department.Equals("Production")) { foreach (Process process in Process.ProductionProcesses) { } } else if (mrb.Department.Equals("Engineering")) { foreach (Process process in Process.EngineeringProcesses) { } } else if (mrb.Department.Equals("Materials")) { foreach (Process process in Process.MaterialsProcesses) { } } else if (mrb.Department.Equals("Facilities")) { foreach (Process process in Process.FacilitiesProcesses) { } } else if (mrb.Department.Equals("Maintenance")) { foreach (Process process in Process.MaintenanceProcesses) { } } else if (mrb.Department.Equals("Quality")) { foreach (Process process in Process.QualityProcesses) { } } @if (mrb.Process.Equals("Reactor") || mrb.Process.Equals("Metrology") || mrb.Process.Equals("Cleans") || mrb.Process.Equals("Packaging") || mrb.Process.Equals("Final QA")) { DateTimeUtilities.MIN_DT) Text="@mrb.Tool" @bind-Value=mrb.Tool > @if (mrb.Process.Equals("Reactor")) { @foreach (Tool tool in Tool.ReactorTools) { } } @if (mrb.Process.Equals("Metrology")) { @foreach (Tool tool in Tool.MetrologyTools) { } } @if (mrb.Process.Equals("Cleans")) { @foreach (Tool tool in Tool.CleansTools) { } } @if (mrb.Process.Equals("Packaging")) { @foreach (Tool tool in Tool.PackagingTools) { } } @if (mrb.Process.Equals("Final QA")) { @foreach (Tool tool in Tool.FqaTools) { } } } @if (mrb.SpecsImpacted) { } @if (mrb.CustomerImpacted) { DateTimeUtilities.MIN_DT) @bind-Value=mrb.CustomerImpactedName Text="@mrb.CustomerImpactedName"> @foreach (string customer in customerNames) { } } } @if (mrb is not null && mrb.MRBNumber > 0) { Supporting Documents @if (!(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) { @if (attachmentUploadInProcess) { Processing } else { Upload Document } } @if (mrbAttachments is not null) { Name Upload Date @context.FileName @context.UploadDate.ToString("yyyy-MM-dd HH:mm") @if (mrb is not null && !(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) { @if (deleteActionInProcess) { Deleting } else { Delete } } } Actions @if (!(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) { Create New Action } @if (mrb.SubmittedDate > DateTimeUtilities.MIN_DT && mrb.StageNo == 3 && (currentUser?.UserID == mrb.OriginatorID || currentUser?.IsAdmin == true)) { @if (completeAllActionsInProcess) { Processing } else { Complete All Actions } } @if (mrbActions is not null) { Download as CSV File Action Customer Qty Part Number Batch Number / Lot Number Justification Assigned Date Completed Date Completed By Comments Attachments @if (context.Action.ToLower().Equals("convert")) { @context.Action @context.ConvertFrom to @context.ConvertTo } else { @context.Action } @context.Customer @context.Quantity @context.PartNumber @context.LotNumber @context.Justification @DateTimeUtilities.GetDateAsStringMinDefault(context.AssignedDate) @DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate) @context.CompletedByUser?.GetFullName() @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) { @approval.Comments } else { @string.Empty } } @if (mrbActionAttachments.Where(a => a.ActionID == context.ActionID).Count() > 0) { IEnumerable attachments = mrbActionAttachments.Where(a => a.ActionID == context.ActionID).ToList(); foreach (MRBActionAttachment attachment in attachments) { } } @if (mrb is not null && !(mrb.SubmittedDate > DateTimeUtilities.MIN_DT)) { Edit @if (deleteActionInProcess) { Deleting } else { Delete } } @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) { Mark Complete } } 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; Approvals @if (!mrbIsSubmitted && mrbReadyToSubmit && (userIsOriginator || userIsAdmin)) { @if (submitInProcess) { Processing } else { Submit for Approval } } @if (nonTaskApprovals is not null) { Role Approver Name Status Assigned Date Disposition Date Comments @context.SubRoleCategoryItem @context.User?.GetFullName() @context.StatusMessage @DateTimeUtilities.GetDateAsStringMaxDefault(context.AssignedDate) @DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate) @context.Comments @if (context.ItemStatus == 0 && authStateProvider.CurrentUser is not null && authStateProvider.CurrentUser.IsAdmin) { Reassign } } }