Quote Creation
parent
6d12195948
commit
a6f8e447b0
@ -0,0 +1,53 @@
|
|||||||
|
@page "/Quotes/QuoteCreate"
|
||||||
|
@using Gremlin_BlazorServer.Data.EntityClasses
|
||||||
|
|
||||||
|
<AuthorizeView>
|
||||||
|
<Authorized>
|
||||||
|
<Div Margin="Margin.Is3"
|
||||||
|
Border="Border.Dark.OnAll"
|
||||||
|
Padding="Padding.Is3"
|
||||||
|
style="box-shadow: 10px 10px #343A40">
|
||||||
|
|
||||||
|
<Heading Size="HeadingSize.Is4">Quote Creation</Heading>
|
||||||
|
<Paragraph>
|
||||||
|
<Fields>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>ProductNumber</FieldLabel>
|
||||||
|
<TextEdit Text="@productNumber" TextChanged="@OnSearchChanged"/>
|
||||||
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>OptionNumber</FieldLabel>
|
||||||
|
<TextEdit>
|
||||||
|
<TextEdit Text="@optionNumber" TextChanged="@OnSearchChanged"/>
|
||||||
|
</TextEdit>
|
||||||
|
</Field>
|
||||||
|
</Fields>
|
||||||
|
</Paragraph>
|
||||||
|
<Paragraph>
|
||||||
|
<DataGrid TItem="Product" Data="@foundProducts" SelectedRow="@selectedProduct" SelectedRowChanged="@OnSelectedProductChanged" Narrow FixedHeader ShowPager Bordered Hoverable Sortable Striped Responsive>
|
||||||
|
<DataGridColumns>
|
||||||
|
<DataGridColumn Field="@nameof(Product.ProductId)" Caption="ProductId" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.ProductNumber)" Caption="ProductNumber" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.OptionNumber)" Caption="OptionNumber" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.SapShortDescription)" Caption="SapShortDescription" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.SapLongDescription)" Caption="SapLongDescription" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.Weight)" Caption="Weight" DisplayFormat="{0:n2} kg" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.ListPrice)" Caption="ListPrice" DisplayFormat="{0:C}" Sortable/>
|
||||||
|
<DataGridColumn Field="@nameof(Product.ProductLineCode)" Caption="ProductLineCode" Sortable/>
|
||||||
|
</DataGridColumns>
|
||||||
|
</DataGrid>
|
||||||
|
</Paragraph>
|
||||||
|
</Div>
|
||||||
|
</Authorized>
|
||||||
|
|
||||||
|
<NotAuthorized>
|
||||||
|
<Div Margin="Margin.Is3"
|
||||||
|
Border="Border.Dark.OnAll"
|
||||||
|
Padding="Padding.Is3"
|
||||||
|
style="box-shadow: 10px 10px #343A40">
|
||||||
|
|
||||||
|
<Heading Size="HeadingSize.Is3">Authentication Failure!</Heading>
|
||||||
|
<Paragraph>You're not signed in. Please click on the upper right to either register or log in.</Paragraph>
|
||||||
|
</Div>
|
||||||
|
</NotAuthorized>
|
||||||
|
</AuthorizeView>
|
||||||
@ -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<Product>? foundProducts;
|
||||||
|
private IList<LineItem>? lineItems;
|
||||||
|
private string optionNumber = "";
|
||||||
|
private string productNumber = "";
|
||||||
|
private Product selectedProduct;
|
||||||
|
[CascadingParameter] private Task<AuthenticationState>? 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<Quote>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnSearchChanged() => foundProducts = await GenericController.GetAllAsync<Product>(p => p.ProductNumber.Contains(productNumber) && p.OptionNumber.Contains(optionNumber));
|
||||||
|
|
||||||
|
private void OnSelectedProductChanged(Product product) => selectedProduct = product;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue