initial data
parent
d1e7c6f3c3
commit
89e765bb69
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-ef": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-ef"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<Router AppAssembly="@typeof(App).Assembly">
|
||||||
|
<Found Context="routeData">
|
||||||
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||||
|
</Found>
|
||||||
|
<NotFound>
|
||||||
|
<PageTitle>Not found</PageTitle>
|
||||||
|
<LayoutView Layout="@typeof(MainLayout)">
|
||||||
|
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||||
|
</LayoutView>
|
||||||
|
</NotFound>
|
||||||
|
</Router>
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"ExtendedData": {
|
||||||
|
"inputs": [
|
||||||
|
"http://kwapp-srv/CommServices/BranchItemLedgerService.svc"
|
||||||
|
],
|
||||||
|
"collectionTypes": [
|
||||||
|
"System.Array",
|
||||||
|
"System.Collections.Generic.Dictionary`2"
|
||||||
|
],
|
||||||
|
"namespaceMappings": [
|
||||||
|
"*, BranchItemLedgerServices"
|
||||||
|
],
|
||||||
|
"targetFramework": "net7.0",
|
||||||
|
"typeReuseMode": "None"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"ExtendedData": {
|
||||||
|
"inputs": [
|
||||||
|
"http://kwapp-srv/CommServices/BranchService.svc"
|
||||||
|
],
|
||||||
|
"collectionTypes": [
|
||||||
|
"System.Array",
|
||||||
|
"System.Collections.Generic.Dictionary`2"
|
||||||
|
],
|
||||||
|
"namespaceMappings": [
|
||||||
|
"*, BranchServices"
|
||||||
|
],
|
||||||
|
"targetFramework": "net7.0",
|
||||||
|
"typeReuseMode": "None"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"ExtendedData": {
|
||||||
|
"inputs": [
|
||||||
|
"http://kwapp-srv/CommServices/ItemService.svc"
|
||||||
|
],
|
||||||
|
"collectionTypes": [
|
||||||
|
"System.Array",
|
||||||
|
"System.Collections.Generic.Dictionary`2"
|
||||||
|
],
|
||||||
|
"namespaceMappings": [
|
||||||
|
"*, ItemServices"
|
||||||
|
],
|
||||||
|
"targetFramework": "net7.0",
|
||||||
|
"typeReuseMode": "None"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"ExtendedData": {
|
||||||
|
"inputs": [
|
||||||
|
"http://kwapp-srv/CommServices/UserInfoService.svc"
|
||||||
|
],
|
||||||
|
"collectionTypes": [
|
||||||
|
"System.Array",
|
||||||
|
"System.Collections.Generic.Dictionary`2"
|
||||||
|
],
|
||||||
|
"namespaceMappings": [
|
||||||
|
"*, UserInfoServices"
|
||||||
|
],
|
||||||
|
"targetFramework": "net7.0",
|
||||||
|
"typeReuseMode": "None"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
namespace KWWebInvApp.Data
|
||||||
|
{
|
||||||
|
public class WeatherForecast
|
||||||
|
{
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public int TemperatureC { get; set; }
|
||||||
|
|
||||||
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||||
|
|
||||||
|
public string? Summary { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
namespace KWWebInvApp.Data
|
||||||
|
{
|
||||||
|
public class WeatherForecastService
|
||||||
|
{
|
||||||
|
private static readonly string[] Summaries = new[]
|
||||||
|
{
|
||||||
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||||
|
};
|
||||||
|
|
||||||
|
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
|
||||||
|
{
|
||||||
|
var rng = new Random();
|
||||||
|
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||||
|
{
|
||||||
|
Date = startDate.AddDays(index),
|
||||||
|
TemperatureC = rng.Next(-20, 55),
|
||||||
|
Summary = Summaries[rng.Next(Summaries.Length)]
|
||||||
|
}).ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MudBlazor" Version="6.0.13" />
|
||||||
|
<PackageReference Include="System.ServiceModel.Duplex" Version="4.10.*" />
|
||||||
|
<PackageReference Include="System.ServiceModel.Federation" Version="4.10.*" />
|
||||||
|
<PackageReference Include="System.ServiceModel.Http" Version="4.10.*" />
|
||||||
|
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.10.*" />
|
||||||
|
<PackageReference Include="System.ServiceModel.Security" Version="4.10.*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,22 @@
|
|||||||
|
<MudDialog>
|
||||||
|
<DialogContent>
|
||||||
|
<MudText>@ContentText</MudText>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton Color="@Color" Variant="Variant.Filled" OnClick="Submit">@ButtonText</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public string ContentText { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public string ButtonText { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public Color Color { get; set; }
|
||||||
|
|
||||||
|
void Submit() => MudDialog.Close(DialogResult.Ok(true));
|
||||||
|
void Cancel() => MudDialog.Cancel();
|
||||||
|
}
|
@ -0,0 +1,200 @@
|
|||||||
|
@page "/brmaintenance/invtycorrection"
|
||||||
|
@using KWWebInvApp.Data;
|
||||||
|
|
||||||
|
@inject IDialogService DialogService;
|
||||||
|
@inject UserServices userService;
|
||||||
|
|
||||||
|
<PageTitle>Branch Inventory Correction</PageTitle>
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">Branch Inventory Correction</MudText>
|
||||||
|
<MudText Typo="Typo.body1" GutterBottom="true">Select a specific branch and select the table to edit from the grid.</MudText>
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem sm="12">
|
||||||
|
<MudCard>
|
||||||
|
<MudCardContent>
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem xs="12" md="5">
|
||||||
|
<MudAutocomplete T="string" Label="Enter Branch Code" @bind-Value="selectedBranch" SearchFunc="@SearchBranch" CoerceValue=false />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" md="4">
|
||||||
|
<MudAutocomplete T="string" Label="Enter Model No." @bind-Value="selectedModelNo" SearchFunc="@SearchModelNo" CoerceValue=false />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" md="3">
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" ButtonType="ButtonType.Button" OnClick="GetRecord" FullWidth="true" Disabled=@disableStatusGetRecord>Get Record</MudButton>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
</MudCardContent>
|
||||||
|
</MudCard>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
|
||||||
|
@if (branchItemLedger != null && branchItemLedger.modelno != null)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body1" Class="my-5 mt-10">Inventory details of @selectedBranch branch</MudText>
|
||||||
|
<EditForm Model="@branchItemLedger" OnValidSubmit="SaveBranchItemLedger">
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem sm="12">
|
||||||
|
<MudCard>
|
||||||
|
<MudCardContent>
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem sm="4">
|
||||||
|
<MudField Label="@branchItemLedger.modelno" Variant="Variant.Outlined">@branchItemLedger.itemcode</MudField>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem sm="8">
|
||||||
|
<MudField Label="Remarks" Variant="Variant.Outlined">@branchItemLedger.remarks</MudField>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
<MudText Typo="Typo.body1" Class="my-3" Color="Color.Primary">Edit the details below</MudText>
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem sm="12" md="2">
|
||||||
|
<MudTextField T="int" Label="Beginning Qty" @bind-Value="branchItemLedger.beginningqty" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem sm="12" md="2">
|
||||||
|
<MudTextField T="int" Label="In Qty" @bind-Value="branchItemLedger.inqty" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem sm="12" md="2">
|
||||||
|
<MudTextField T="int" Label="Out Qty" @bind-Value="branchItemLedger.outqty" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem sm="12" md="2">
|
||||||
|
<MudTextField T="int" Label="Sales Qty" @bind-Value="branchItemLedger.sales" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem sm="12" md="2">
|
||||||
|
<MudTextField T="int" Label="Adjustment" @bind-Value="branchItemLedger.adjustment" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem sm="12" md="2">
|
||||||
|
<MudTextField T="int" Label="Ending Qty" @bind-Value="branchItemLedger.endingqty" />
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
</MudCardContent>
|
||||||
|
<MudCardActions>
|
||||||
|
<MudButton Class="ma-3" Variant="Variant.Filled" Color="Color.Primary" ButtonType="ButtonType.Submit" Disabled=@disableStatusSave>Update Record</MudButton>
|
||||||
|
<MudButton Class="ma-3" Variant="Variant.Filled" Color="Color.Secondary" OnClick="ResetUpdateBranchItemLedger">Reset</MudButton>
|
||||||
|
</MudCardActions>
|
||||||
|
</MudCard>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
</EditForm>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.caption">No Record to Show</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
BranchServices.branch[]? branchList;
|
||||||
|
string? selectedBranch, selectedModelNo;
|
||||||
|
BranchItemLedgerServices.branchitemledger? branchItemLedger = null;
|
||||||
|
bool disableStatusGetRecord = false, disableStatusSave = true;
|
||||||
|
|
||||||
|
|
||||||
|
BranchServices.BranchServiceClient branchServiceClient = new();
|
||||||
|
ItemServices.ItemServiceClient itemServiceClient = new();
|
||||||
|
BranchItemLedgerServices.BranchItemLedgerServiceClient branchItemLedgerServiceClient = new();
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
branchList = await branchServiceClient.GetDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task<IEnumerable<string>> SearchBranch(string value)
|
||||||
|
{
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
return branchList.Select(c=>c.brCode);
|
||||||
|
|
||||||
|
return branchList.Where(c => c.brCode.Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(c=>c.brCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task<IEnumerable<string>> SearchModelNo(string value)
|
||||||
|
{
|
||||||
|
ItemServices.items[] itemList;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(value) || value.Length < 2)
|
||||||
|
{
|
||||||
|
itemList = await itemServiceClient.GetTopDataAsync(10);
|
||||||
|
return itemList.Select(c => c.modelno);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemList = await itemServiceClient.GetItemListByModelnoStartsWithAsync(value);
|
||||||
|
return itemList.Select(c => c.modelno);
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task GetRecord()
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(selectedBranch))
|
||||||
|
{
|
||||||
|
var dialogParam = new DialogParameters();
|
||||||
|
dialogParam.Add("ContentText", "No branch. Please enter in the Branch field.");
|
||||||
|
dialogParam.Add("ButtonText", "OK");
|
||||||
|
dialogParam.Add("Color", Color.Error);
|
||||||
|
|
||||||
|
DialogService.Show<MessageDialogs.WarningDialog>("No Branch", dialogParam);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(selectedModelNo))
|
||||||
|
{
|
||||||
|
var dialogParam = new DialogParameters();
|
||||||
|
dialogParam.Add("ContentText", "No model number. Please enter in the Model Number field");
|
||||||
|
dialogParam.Add("ButtonText", "OK");
|
||||||
|
dialogParam.Add("Color", Color.Error);
|
||||||
|
|
||||||
|
DialogService.Show<MessageDialogs.WarningDialog>("No Mode Number", dialogParam);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
disableStatusGetRecord = true;
|
||||||
|
disableStatusSave = true;
|
||||||
|
|
||||||
|
branchItemLedger = await branchItemLedgerServiceClient.GetRemoteDataByBrCodeModelnoAsync(selectedBranch, selectedModelNo);
|
||||||
|
|
||||||
|
disableStatusGetRecord = false;
|
||||||
|
disableStatusSave = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task SaveBranchItemLedger()
|
||||||
|
{
|
||||||
|
if (branchItemLedger == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
disableStatusGetRecord = true;
|
||||||
|
disableStatusSave = true;
|
||||||
|
|
||||||
|
branchItemLedger.remarks = $"|Manually edit by {userService?.CurrentUser?.fullName}. {DateTime.Now:MM/dd/yyyy} [{branchItemLedger.beginningqty} {branchItemLedger.inqty} {branchItemLedger.outqty} {branchItemLedger.sales} {branchItemLedger.adjustment} {branchItemLedger.endingqty}]";
|
||||||
|
|
||||||
|
int result = await branchItemLedgerServiceClient.UpdateRemoteBranchItemLedgerAsync(branchItemLedger);
|
||||||
|
|
||||||
|
if(result > 0)
|
||||||
|
{
|
||||||
|
var dialogParam = new DialogParameters();
|
||||||
|
dialogParam.Add("ContentText", "Successfully updated the record");
|
||||||
|
dialogParam.Add("ButtonText", "OK");
|
||||||
|
dialogParam.Add("Color", Color.Info);
|
||||||
|
|
||||||
|
DialogService.Show<MessageDialogs.WarningDialog>("Success", dialogParam);
|
||||||
|
|
||||||
|
await ResetUpdateBranchItemLedger();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dialogParam = new DialogParameters();
|
||||||
|
dialogParam.Add("ContentText", "Failed to update the record");
|
||||||
|
dialogParam.Add("ButtonText", "OK");
|
||||||
|
dialogParam.Add("Color", Color.Error);
|
||||||
|
|
||||||
|
DialogService.Show<MessageDialogs.WarningDialog>("Failed", dialogParam);
|
||||||
|
|
||||||
|
disableStatusGetRecord = false;
|
||||||
|
disableStatusSave = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task ResetUpdateBranchItemLedger()
|
||||||
|
{
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
disableStatusGetRecord = false;
|
||||||
|
disableStatusSave = true;
|
||||||
|
branchItemLedger = null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
@page "/branches"
|
||||||
|
|
||||||
|
<h3>Branches</h3>
|
||||||
|
|
||||||
|
<PageTitle>Branches</PageTitle>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h3" GutterBottom="true">List of Branches</MudText>
|
||||||
|
|
||||||
|
@if (branchList == null)
|
||||||
|
{
|
||||||
|
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudTable Items="branchList" Hover="true" SortLabel="Sort By" Elevation="0" Dense>
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<BranchServices.branch, object>(x=>x.brCode)">Branch Code</MudTableSortLabel></MudTh>
|
||||||
|
<MudTh><MudTableSortLabel SortBy="new Func<BranchServices.branch, object>(x=>x.brDesc)">Description</MudTableSortLabel></MudTh>
|
||||||
|
<MudTh>Summary</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd DataLabel="Temp. (C)">@context.brCode</MudTd>
|
||||||
|
<MudTd DataLabel="Temp. (F)">@context.brDesc</MudTd>
|
||||||
|
<MudTd DataLabel="Summary">@context.address</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
<PagerContent>
|
||||||
|
<MudTablePager PageSizeOptions="new int[]{50, 100}" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudTable>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public BranchServices.branch[]? branchList;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
BranchServices.BranchServiceClient branchServiceClient = new();
|
||||||
|
branchList = await branchServiceClient.GetDataAsync();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
@page "/counter"
|
||||||
|
|
||||||
|
<PageTitle>Counter</PageTitle>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h3" GutterBottom="true">Counter</MudText>
|
||||||
|
<MudText Class="mb-4">Current count: @currentCount</MudText>
|
||||||
|
<MudButton Color="Color.Primary" Variant="Variant.Filled" @onclick="IncrementCount">Click me</MudButton>
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private int currentCount = 0;
|
||||||
|
|
||||||
|
private void IncrementCount()
|
||||||
|
{
|
||||||
|
currentCount++;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
@page
|
||||||
|
@model KWWebInvApp.Pages.ErrorModel
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
<title>Error</title>
|
||||||
|
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
<link href="~/css/app.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main">
|
||||||
|
<div class="content px-4">
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
@if (Model.ShowRequestId)
|
||||||
|
{
|
||||||
|
<p>
|
||||||
|
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||||
|
It can result in displaying sensitive information from exceptions to end users.
|
||||||
|
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||||
|
and restarting the app.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,42 @@
|
|||||||
|
@page "/fetchdata"
|
||||||
|
@using KWWebInvApp.Data
|
||||||
|
@inject WeatherForecastService ForecastService
|
||||||
|
|
||||||
|
<PageTitle>Weather forecast</PageTitle>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h3" GutterBottom="true">Weather forecast</MudText>
|
||||||
|
<MudText Class="mb-8">This component demonstrates fetching data from the server.</MudText>
|
||||||
|
@if (forecasts == null)
|
||||||
|
{
|
||||||
|
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudTable Items="forecasts" Hover="true" SortLabel="Sort By" Elevation="0">
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<WeatherForecast, object>(x=>x.Date)">Date</MudTableSortLabel></MudTh>
|
||||||
|
<MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.TemperatureC)">Temp. (C)</MudTableSortLabel></MudTh>
|
||||||
|
<MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.TemperatureF)">Temp. (F)</MudTableSortLabel></MudTh>
|
||||||
|
<MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.Summary!)">Summary</MudTableSortLabel></MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd DataLabel="Date">@context.Date</MudTd>
|
||||||
|
<MudTd DataLabel="Temp. (C)">@context.TemperatureC</MudTd>
|
||||||
|
<MudTd DataLabel="Temp. (F)">@context.TemperatureF</MudTd>
|
||||||
|
<MudTd DataLabel="Summary">@context.Summary</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
<PagerContent>
|
||||||
|
<MudTablePager PageSizeOptions="new int[]{50, 100}" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudTable>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private WeatherForecast[]? forecasts;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
@page "/"
|
||||||
|
@using KWWebInvApp.Data
|
||||||
|
@inject UserServices userServices
|
||||||
|
@inject NavigationManager navigationManager
|
||||||
|
|
||||||
|
|
||||||
|
<PageTitle>Index</PageTitle>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h3" GutterBottom="true">Karat World Inventory</MudText>
|
||||||
|
<MudText Class="mb-8">Welcome Karat World inventory system. A web based application.</MudText>
|
||||||
|
<MudAlert Severity="Severity.Normal">You can find documentation and examples on our website here: <MudLink Href="https://mudblazor.com" Typo="Typo.body2" Color="Color.Inherit"><b>www.mudblazor.com</b></MudLink></MudAlert>
|
||||||
|
|
||||||
|
@code
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
@page "/items/itemdetails"
|
||||||
|
|
||||||
|
<h3>Item Details</h3>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
@page "/items/tracesearch"
|
||||||
|
|
||||||
|
<h3>ItemSearch</h3>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
@page "/items/tracehistory"
|
||||||
|
|
||||||
|
<h3>TraceHistory</h3>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
@page "/"
|
||||||
|
@namespace KWWebInvApp.Pages
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
|
|
||||||
|
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
@ -0,0 +1,31 @@
|
|||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@namespace KWWebInvApp.Pages
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<base href="~/" />
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
|
||||||
|
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
|
||||||
|
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@RenderBody()
|
||||||
|
|
||||||
|
<div id="blazor-error-ui">
|
||||||
|
<environment include="Staging,Production">
|
||||||
|
An error has occurred. This application may no longer respond until reloaded.
|
||||||
|
</environment>
|
||||||
|
<environment include="Development">
|
||||||
|
An unhandled exception has occurred. See browser dev tools for details.
|
||||||
|
</environment>
|
||||||
|
<a href="" class="reload">Reload</a>
|
||||||
|
<a class="dismiss">🗙</a>
|
||||||
|
</div>
|
||||||
|
<script src="_framework/blazor.server.js"></script>
|
||||||
|
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,37 @@
|
|||||||
|
using KWWebInvApp.Data;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
|
using Microsoft.AspNetCore.Hosting.StaticWebAssets;
|
||||||
|
using MudBlazor.Services;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration);
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
builder.Services.AddRazorPages();
|
||||||
|
builder.Services.AddServerSideBlazor();
|
||||||
|
builder.Services.AddSingleton<WeatherForecastService>();
|
||||||
|
builder.Services.AddSingleton<UserServices>();
|
||||||
|
builder.Services.AddMudServices();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (!app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Error");
|
||||||
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
|
app.UseHsts();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.UseRouting();
|
||||||
|
|
||||||
|
app.MapBlazorHub();
|
||||||
|
app.MapFallbackToPage("/_Host");
|
||||||
|
|
||||||
|
app.Run();
|
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:61949",
|
||||||
|
"sslPort": 44393
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"KWWebInvApp": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
@using KWWebInvApp.Data
|
||||||
|
@inject UserServices userService
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject NavigationManager navigationManager
|
||||||
|
|
||||||
|
<EditForm Model="@userAttemtingToLogin" OnValidSubmit="SubmitLogin">
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem sm="12">
|
||||||
|
<MudCard>
|
||||||
|
<MudCardContent>
|
||||||
|
<MudText Typo="Typo.h4">Login</MudText>
|
||||||
|
<MudText Typo="Typo.subtitle1">Welcome to Merchandise and SAC System</MudText>
|
||||||
|
@if (error != null)
|
||||||
|
{
|
||||||
|
<MudAlert Severity="Severity.Error">@error</MudAlert>
|
||||||
|
}
|
||||||
|
<MudTextField T="string" Label="Username"
|
||||||
|
@bind-Value="userAttemtingToLogin.username" />
|
||||||
|
|
||||||
|
<MudTextField T="string" Label="Password"
|
||||||
|
InputType="InputType.Password"
|
||||||
|
@bind-Value="pass" />
|
||||||
|
<MudCardActions Class="mt-5">
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" ButtonType="ButtonType.Submit" Disabled="submitButtonDisabled">@submitButtonText</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="mx-2" ButtonType="ButtonType.Reset" Disabled="submitButtonDisabled">Reset</MudButton>
|
||||||
|
</MudCardActions>
|
||||||
|
</MudCardContent>
|
||||||
|
</MudCard>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
</EditForm>
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
bool submitButtonDisabled = false;
|
||||||
|
string? pass, error, submitButtonText = "Login";
|
||||||
|
UserInfoServices.userinfo userAttemtingToLogin = new();
|
||||||
|
|
||||||
|
//protected override async Task OnInitializedAsync()
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
async Task SubmitLogin()
|
||||||
|
{
|
||||||
|
error = null;
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(userAttemtingToLogin.username) || String.IsNullOrEmpty(pass))
|
||||||
|
{
|
||||||
|
error = "Username and Password is required";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfoServices.UserInfoServiceClient userInfoServiceClient = new();
|
||||||
|
|
||||||
|
waitingButton(true);
|
||||||
|
userAttemtingToLogin.pass = await userInfoServiceClient.md5EncodingAsync(pass);
|
||||||
|
userService.CurrentUser = await userInfoServiceClient.AuthenticateUserAsync(userAttemtingToLogin);
|
||||||
|
waitingButton();
|
||||||
|
|
||||||
|
if (userService.CurrentUser == null)
|
||||||
|
error = "Invalid Username or Password";
|
||||||
|
else
|
||||||
|
navigationManager.NavigateTo("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
void waitingButton(bool waiting = false)
|
||||||
|
{
|
||||||
|
if(waiting)
|
||||||
|
{
|
||||||
|
submitButtonDisabled = true;
|
||||||
|
submitButtonText = "Please Wait...";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
submitButtonDisabled = false;
|
||||||
|
submitButtonText = "Login";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
@inherits LayoutComponentBase
|
||||||
|
@using KWWebInvApp.Data
|
||||||
|
@inject UserServices userServices
|
||||||
|
@inject NavigationManager navigationManager
|
||||||
|
|
||||||
|
<MudThemeProvider />
|
||||||
|
<MudDialogProvider />
|
||||||
|
<MudSnackbarProvider />
|
||||||
|
|
||||||
|
<MudLayout>
|
||||||
|
<MudAppBar Elevation="0">
|
||||||
|
@if (userServices.IsAuthenticated())
|
||||||
|
{
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
|
||||||
|
<MudSpacer />
|
||||||
|
<MudIconButton Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Inherit" Link="https://mudblazor.com/" Target="_blank" />
|
||||||
|
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Color="Color.Inherit" Link="https://github.com/MudBlazor/MudBlazor/" Target="_blank" />
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Logout" Color="Color.Inherit" OnClick="Logout" />
|
||||||
|
}
|
||||||
|
</MudAppBar>
|
||||||
|
|
||||||
|
@if (userServices.IsAuthenticated())
|
||||||
|
{
|
||||||
|
<MudDrawer @bind-Open="_drawerOpen" Elevation="1">
|
||||||
|
<MudDrawerHeader>
|
||||||
|
<MudText Typo="Typo.h6">KW Web App</MudText>
|
||||||
|
</MudDrawerHeader>
|
||||||
|
<NavMenu />
|
||||||
|
</MudDrawer>
|
||||||
|
<MudMainContent>
|
||||||
|
<MudContainer MaxWidth="MaxWidth.Large" Class="my-16 pt-16">
|
||||||
|
@Body
|
||||||
|
</MudContainer>
|
||||||
|
</MudMainContent>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudMainContent>
|
||||||
|
<MudContainer MaxWidth="MaxWidth.Large" Class="my-16 pt-16">
|
||||||
|
<Login />
|
||||||
|
</MudContainer>
|
||||||
|
</MudMainContent>
|
||||||
|
}
|
||||||
|
</MudLayout>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
bool _drawerOpen = true;
|
||||||
|
|
||||||
|
void DrawerToggle()
|
||||||
|
{
|
||||||
|
_drawerOpen = !_drawerOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logout()
|
||||||
|
{
|
||||||
|
userServices.CurrentUser = null;
|
||||||
|
navigationManager.NavigateTo("/");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
<MudNavMenu>
|
||||||
|
<MudNavLink Href="" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
|
||||||
|
<MudNavGroup Title="Items">
|
||||||
|
<MudNavLink Href="items/itemdetails" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.List">Item Details</MudNavLink>
|
||||||
|
<MudNavLink Href="items/tracesearch" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.List">Item Search</MudNavLink>
|
||||||
|
<MudNavLink Href="items/tracehistory" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.List">Trace History</MudNavLink>
|
||||||
|
</MudNavGroup>
|
||||||
|
<MudNavGroup Title="Branch Maintenance">
|
||||||
|
<MudNavLink Href="brmaintenance/invtycorrection" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.List">Inventory Correction</MudNavLink>
|
||||||
|
</MudNavGroup>
|
||||||
|
<!-- <MudNavLink Href="counter" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Add">Counter</MudNavLink>
|
||||||
|
<MudNavLink Href="fetchdata" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.List">Fetch data</MudNavLink>
|
||||||
|
<MudNavLink Href="branches" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.List">View Branches</MudNavLink> -->
|
||||||
|
</MudNavMenu>
|
@ -0,0 +1,11 @@
|
|||||||
|
@using System.Net.Http
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||||
|
@using Microsoft.JSInterop
|
||||||
|
@using MudBlazor
|
||||||
|
@using KWWebInvApp
|
||||||
|
@using KWWebInvApp.Shared
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"DetailedErrors": true,
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue