diff --git a/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor b/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor new file mode 100644 index 0000000..2b29c28 --- /dev/null +++ b/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor @@ -0,0 +1,53 @@ +@page "/Quotes/QuoteCreate" +@using Gremlin_BlazorServer.Data.EntityClasses + + + +
+ + Quote Creation + + + + ProductNumber + + + + OptionNumber + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + Authentication Failure! + You're not signed in. Please click on the upper right to either register or log in. +
+
+
\ No newline at end of file diff --git a/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor.cs b/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor.cs new file mode 100644 index 0000000..12cbf7e --- /dev/null +++ b/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor.cs @@ -0,0 +1,31 @@ +using System.Security.Claims; +using Gremlin_BlazorServer.Data.EntityClasses; +using Gremlin_BlazorServer.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Authorization; + +namespace Gremlin_BlazorServer.Pages.Quotes; + +public partial class QuoteCreate { + private IList? foundProducts; + private IList? lineItems; + private string optionNumber = ""; + private string productNumber = ""; + private Product selectedProduct; + [CascadingParameter] private Task? AuthenticationStateTask { get; set; } + + protected override async Task OnInitializedAsync() { + if (AuthenticationStateTask != null) { + ClaimsPrincipal user = (await AuthenticationStateTask).User; + if (user.Identity is { IsAuthenticated: true }) { + // quotes = await GenericController.GetAllAsync(); + } + } + + await base.OnInitializedAsync(); + } + + private async Task OnSearchChanged() => foundProducts = await GenericController.GetAllAsync(p => p.ProductNumber.Contains(productNumber) && p.OptionNumber.Contains(optionNumber)); + + private void OnSelectedProductChanged(Product product) => selectedProduct = product; +} \ No newline at end of file diff --git a/Gremlin_BlazorServer/Pages/Quotes/QuoteIndex.razor.cs b/Gremlin_BlazorServer/Pages/Quotes/QuoteIndex.razor.cs index dbaac97..db234e5 100644 --- a/Gremlin_BlazorServer/Pages/Quotes/QuoteIndex.razor.cs +++ b/Gremlin_BlazorServer/Pages/Quotes/QuoteIndex.razor.cs @@ -8,40 +8,38 @@ using Microsoft.AspNetCore.Components.Authorization; namespace Gremlin_BlazorServer.Pages.Quotes; public partial class QuoteIndex { - private readonly CultureInfo cultureInfo = new("de-DE"); - - private IList? quotes; - private Quote? selectedQuote; - private string selectedTab = "details"; - - [CascadingParameter] private Task? AuthenticationStateTask { get; set; } - - protected override async Task OnInitializedAsync() { - if (AuthenticationStateTask != null) { - ClaimsPrincipal user = (await AuthenticationStateTask).User; - if (user.Identity is { IsAuthenticated: true }) quotes = await GenericController.GetAllAsync(); - } - - await base.OnInitializedAsync(); - } - - private async Task OnSelectedQuoteChanged(Quote selectedQuote) { - this.selectedQuote = selectedQuote; - this.selectedQuote.Recipient = GenericController.Get(c => c.ContactId.Equals(this.selectedQuote.RecipientId)); - if (this.selectedQuote.Recipient != null && this.selectedQuote != null) { - this.selectedQuote = await GenericController.Get(c => c.QuoteId.Equals(selectedQuote.QuoteId), "Recipient", "LineItems"); - this.selectedQuote.Recipient.Account = GenericController.Get(a => a.AccountId.Equals(this.selectedQuote.Recipient.AccountId)); - } - - //selectedQuote.LineItems = await genericController.GetAllAsync(lI => lI.Quote.Equals(selectedQuote)); - } - - private void OnCreateNewQuote() { - NavigationManager.NavigateTo("Quotes/QuoteAdd"); - } - - private Task OnSelectedTabChanged(string selectedTab) { - this.selectedTab = selectedTab; - return Task.CompletedTask; - } + private readonly CultureInfo cultureInfo = new("de-DE"); + + private IList? quotes; + private Quote? selectedQuote; + private string selectedTab = "details"; + + [CascadingParameter] private Task? AuthenticationStateTask { get; set; } + + protected override async Task OnInitializedAsync() { + if (AuthenticationStateTask != null) { + ClaimsPrincipal user = (await AuthenticationStateTask).User; + if (user.Identity is { IsAuthenticated: true }) quotes = await GenericController.GetAllAsync(); + } + + await base.OnInitializedAsync(); + } + + private async Task OnSelectedQuoteChanged(Quote selectedQuote) { + this.selectedQuote = selectedQuote; + this.selectedQuote.Recipient = GenericController.Get(c => c.ContactId.Equals(this.selectedQuote.RecipientId)); + if (this.selectedQuote.Recipient != null && this.selectedQuote != null) { + this.selectedQuote = await GenericController.Get(c => c.QuoteId.Equals(selectedQuote.QuoteId), "Recipient", "LineItems"); + this.selectedQuote.Recipient.Account = GenericController.Get(a => a.AccountId.Equals(this.selectedQuote.Recipient.AccountId)); + } + + //selectedQuote.LineItems = await genericController.GetAllAsync(lI => lI.Quote.Equals(selectedQuote)); + } + + private void OnCreateNewQuote() => NavigationManager.NavigateTo("Quotes/QuoteAdd"); + + private Task OnSelectedTabChanged(string newSelectedTab) { + selectedTab = newSelectedTab; + return Task.CompletedTask; + } } \ No newline at end of file diff --git a/Gremlin_BlazorServer/Shared/BlazoriseNavMenu.razor b/Gremlin_BlazorServer/Shared/BlazoriseNavMenu.razor index e58206d..292c1c0 100644 --- a/Gremlin_BlazorServer/Shared/BlazoriseNavMenu.razor +++ b/Gremlin_BlazorServer/Shared/BlazoriseNavMenu.razor @@ -56,6 +56,12 @@ Add + + + + Create + + diff --git a/Gremlin_BlazorServer/Shared/NavMenu.razor b/Gremlin_BlazorServer/Shared/NavMenu.razor index 361da72..25c0c41 100644 --- a/Gremlin_BlazorServer/Shared/NavMenu.razor +++ b/Gremlin_BlazorServer/Shared/NavMenu.razor @@ -64,6 +64,11 @@ Add Quote +