From 3145c1b501555ab16d34b1beea1bc0c62deaf664 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Thu, 19 Jan 2023 21:13:23 -0700 Subject: [PATCH] MudTable --- ClientHub/Pages/AwaitingDisposition.razor | 48 ++++++++++- ClientHub/Pages/AwaitingDisposition.razor.cs | 59 +++++++++++++- ClientHub/wwwroot/styles/Site.css | 86 ++++++++++---------- 3 files changed, 149 insertions(+), 44 deletions(-) diff --git a/ClientHub/Pages/AwaitingDisposition.razor b/ClientHub/Pages/AwaitingDisposition.razor index 922cf54..81dbbaa 100644 --- a/ClientHub/Pages/AwaitingDisposition.razor +++ b/ClientHub/Pages/AwaitingDisposition.razor @@ -12,15 +12,59 @@
-
+
Open
- Refresh + Refresh +
+
+ View
+@if (_Records == null) +{ + +} +else if (_Records.Any()) +{ + + + + + + + + + + + + ToolType + Tool + Reactor + RDS + PSN + Layer + Zone + InsertDate + Expiration + + + @context.ToolType + @context.Tool + @context.Reactor + @context.RDS + @context.PSN + @context.Layer + @context.Zone + @context.InsertDate + @context.Expiration + + +} + \ No newline at end of file diff --git a/ClientHub/Pages/AwaitingDisposition.razor.cs b/ClientHub/Pages/AwaitingDisposition.razor.cs index 42b7690..b74e18d 100644 --- a/ClientHub/Pages/AwaitingDisposition.razor.cs +++ b/ClientHub/Pages/AwaitingDisposition.razor.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; +using OI.Metrology.ClientHub.Models; +using OI.Metrology.Shared.Models.Stateless; namespace OI.Metrology.ClientHub.Pages; @@ -7,7 +9,20 @@ public partial class AwaitingDisposition { [Inject] protected IJSRuntime? JSRuntime { get; set; } - [Inject] protected Models.AppSettings? AppSettings { get; set; } + [Inject] protected HttpClient? HttpClient { get; set; } + [Inject] protected AppSettings? AppSettings { get; set; } + [Inject] protected ILogger? Logger { get; set; } + + private string? _ToolTypeFilter; + private string? _ToolFilter; + private string? _ReactorFilter; + private string? _RdsFilter; + private string? _PSNFilter; + private string? _LayerFilter; + private string? _ZoneFilter; + private readonly List _Records; + + public AwaitingDisposition() => _Records = new(); protected override Task OnAfterRenderAsync(bool firstRender) { @@ -22,4 +37,46 @@ public partial class AwaitingDisposition return Task.CompletedTask; } + private bool FilterRecords(Metrology.Shared.DataModels.AwaitingDisposition? record) + { + bool? result = _ToolTypeFilter is not null ? record?.ToolType?.Contains(_ToolTypeFilter, StringComparison.CurrentCultureIgnoreCase) : null; + if (result is null || result.Value) + result = _ToolFilter is not null ? record?.Tool?.Contains(_ToolFilter, StringComparison.CurrentCultureIgnoreCase) : null; + if (result is null || result.Value) + result = _ReactorFilter is not null ? record?.Reactor?.Contains(_ReactorFilter, StringComparison.CurrentCultureIgnoreCase) : null; + if (result is null || result.Value) + result = _RdsFilter is not null ? record?.RDS?.Contains(_RdsFilter, StringComparison.CurrentCultureIgnoreCase) : null; + if (result is null || result.Value) + result = _PSNFilter is not null ? record?.PSN?.Contains(_PSNFilter, StringComparison.CurrentCultureIgnoreCase) : null; + if (result is null || result.Value) + result = _LayerFilter is not null ? record?.Layer?.Contains(_LayerFilter, StringComparison.CurrentCultureIgnoreCase) : null; + if (result is null || result.Value) + result = _ZoneFilter is not null ? record?.Zone?.Contains(_ZoneFilter, StringComparison.CurrentCultureIgnoreCase) : null; + result ??= true; + return result.Value; + } + + private void RefreshClick() => _Records.Clear(); + + private async Task LoadClickAsync() + { + if (Logger is null) + throw new NullReferenceException(nameof(Logger)); + if (HttpClient is null) + throw new NullReferenceException(nameof(HttpClient)); + _Records.Clear(); + string controllerName = IAwaitingDispoController.GetRouteName(); + try + { + Metrology.Shared.DataModels.AwaitingDisposition[]? collection = await HttpClient.GetFromJsonAsync($"api/{controllerName}"); + if (collection is not null) + _Records.AddRange(collection); + } + catch (Exception) + { + string json = await HttpClient.GetStringAsync($"api/{controllerName}"); + Logger.LogInformation(message: json); + } + } + } \ No newline at end of file diff --git a/ClientHub/wwwroot/styles/Site.css b/ClientHub/wwwroot/styles/Site.css index c3c986b..1992cbc 100644 --- a/ClientHub/wwwroot/styles/Site.css +++ b/ClientHub/wwwroot/styles/Site.css @@ -1,102 +1,106 @@ body { - padding-top: 50px; - padding-bottom: 20px; - background-color: #FAFAFA; + padding-top: 50px; + padding-bottom: 20px; + background-color: #fafafa; } /* Set padding to keep content from hitting the edges */ .body-content { - padding-left: 15px; - padding-right: 15px; + padding-left: 15px; + padding-right: 15px; } /* Set width on the form input elements since they're 100% wide by default */ input, select, textarea { - max-width: 280px; + max-width: 280px; } div.modal-content-error { - background-color: #9e2525; - color: #ffffff; + background-color: #9e2525; + color: #ffffff; } div.modal-content-success { - background-color: #e5fbe5; - color: #000000; + background-color: #e5fbe5; + color: #000000; } div.modal-content-info { - background-color: #5bc0de; - color: #000000; + background-color: #5bc0de; + color: #000000; } div.modal-content-warning { - background-color: yellow; - color: #000000; + background-color: yellow; + color: #000000; } .changes-highlight { - background-color: yellow; + background-color: yellow; } .k-alt .changes-highlight { - background-color: #f0f050; + background-color: #f0f050; } .button-highlight { - background-color: yellow !important; + background-color: yellow !important; } .history-deleted { - background-color: #FFDDDD; + background-color: #ffdddd; } .k-alt.history-deleted { - background-color: #EECCCC !important; + background-color: #eecccc !important; } .error-highlight { - color: red; - font-weight: bold; + color: red; + font-weight: bold; } .checkbox-container { - max-height: 200px; - overflow: auto; + max-height: 200px; + overflow: auto; } .test-database { - background-color: red !important; + background-color: red !important; } - .test-database .navbar-brand, - .test-database .navbar-text, - .test-database .navbar-nav > li > a { - color: white; - } +.test-database .navbar-brand, +.test-database .navbar-text, +.test-database .navbar-nav > li > a { + color: white; +} - .test-database .navbar-nav > li > a:hover, - .test-database .navbar-nav > li > a:focus { - color: black !important; - } +.test-database .navbar-nav > li > a:hover, +.test-database .navbar-nav > li > a:focus { + color: black !important; +} .test-database-text { - font-weight: bold; - font-size: 20px; - line-height: 20px; + font-weight: bold; + font-size: 20px; + line-height: 20px; } .navbar { - border-bottom-color: black; - background-color: white; + border-bottom-color: black; + background-color: white; } .navbar-nav > li > a { - font-weight: bold; + font-weight: bold; } .icon-bar { - background-color: black; -} \ No newline at end of file + background-color: black; +} + +.mud-table-cell { + font-size: 1.875rem; +}