improvements, fixes, etc...
This commit is contained in:
parent
8cae7bbd76
commit
df4715360e
|
|
@ -10,7 +10,10 @@ namespace FruitBank.Common.Server
|
|||
public class FruitBankConst : AcConst
|
||||
{
|
||||
public static string ProjectIdString = "aad53443-2ee2-4650-8a99-97e907265e4e";
|
||||
|
||||
public static string MeasuringRoleSystemName = "Measuring";
|
||||
public static string MeasuringRevisorRoleSystemName = "MeasuringRevisor";
|
||||
public static string IsMeasureableAttributeName = "IsMeasurable";
|
||||
|
||||
static FruitBankConst()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ public class Shipping : MgEntityBase, IShipping
|
|||
public string LicencePlate { get; set; }
|
||||
public bool IsAllMeasured { get; set; }
|
||||
|
||||
public DateTime? MeasuredDate { get; set; }
|
||||
|
||||
[Association(ThisKey = nameof(Id), OtherKey = nameof(ShippingDocument.ShippingId), CanBeNull = true)]
|
||||
public List<ShippingDocument>? ShippingDocuments { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using FruitBank.Common.Models;
|
||||
using Mango.Nop.Core.Dtos;
|
||||
using Mango.Nop.Core.Models;
|
||||
using Nop.Core.Domain.Customers;
|
||||
|
||||
namespace FruitBank.Common.Interfaces;
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ public interface IFruitBankDataControllerCommon
|
|||
|
||||
#region Customer
|
||||
public Task<List<CustomerDto>?> GetMeasuringUsers();
|
||||
public Task<List<CustomerRole>?> GetCustomerRolesByCustomerId(int customerId);
|
||||
#endregion Customer
|
||||
|
||||
#region Product
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
namespace FruitBank.Common.Interfaces;
|
||||
|
||||
public interface IMeasuringAttributeValues
|
||||
{
|
||||
double? NetWeight { get; set; }
|
||||
double? GrossWeight { get; set; }
|
||||
|
||||
bool? IsMeasurable { get; set; }
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ public interface IShipping : IEntityInt, ITimeStampInfo
|
|||
DateTime ShippingDate { get; set; }
|
||||
string LicencePlate { get; set; }
|
||||
bool IsAllMeasured { get; set; }
|
||||
DateTime? MeasuredDate { get; set; }
|
||||
|
||||
public List<ShippingDocument>? ShippingDocuments { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
namespace FruitBank.Common.Interfaces;
|
||||
|
||||
public class MeasuringAttributeValues : IMeasuringAttributeValues
|
||||
{
|
||||
public double? NetWeight { get; set; }
|
||||
public double? GrossWeight { get; set; }
|
||||
public bool? IsMeasurable { get; set; }
|
||||
|
||||
public MeasuringAttributeValues()
|
||||
{
|
||||
}
|
||||
|
||||
public MeasuringAttributeValues(double? netWeight, double? grossWeight, bool? isMeasurable)
|
||||
{
|
||||
Initialize(netWeight, grossWeight, isMeasurable);
|
||||
}
|
||||
|
||||
public void Initialize(double? netWeight, double? grossWeight, bool? isMeasurable)
|
||||
{
|
||||
NetWeight = netWeight;
|
||||
GrossWeight = grossWeight;
|
||||
IsMeasurable = isMeasurable;
|
||||
}
|
||||
|
||||
public bool HasValues()
|
||||
=> NetWeight != null && GrossWeight != null && IsMeasurable != null;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
using AyCode.Core;
|
||||
using Mango.Nop.Core.Dtos;
|
||||
using Mango.Nop.Core.Models;
|
||||
using Nop.Core.Domain.Customers;
|
||||
|
||||
namespace FruitBank.Common.Models;
|
||||
|
||||
public class LoggedInModel
|
||||
{
|
||||
public bool IsLoggedIn => CustomerDto != null;
|
||||
|
||||
public CustomerDto? CustomerDto { get; private set; }
|
||||
public List<CustomerRole> CustomerRoles { get; private set; } = [];
|
||||
|
||||
public LoggedInModel()
|
||||
{
|
||||
}
|
||||
|
||||
public LoggedInModel(CustomerDto? customerDto)
|
||||
{
|
||||
InitLoggedInCustomer(customerDto);
|
||||
}
|
||||
|
||||
public LoggedInModel(MgLoginModelResponse loginModelResponse) : this(loginModelResponse.CustomerDto)
|
||||
{
|
||||
}
|
||||
|
||||
public void InitLoggedInCustomer(CustomerDto? customerDto)
|
||||
{
|
||||
LogOut();
|
||||
|
||||
if (customerDto != null) CustomerDto = customerDto;
|
||||
}
|
||||
|
||||
public void InitCustomerRoles(List<CustomerRole> customerRoles)
|
||||
{
|
||||
CustomerRoles.Clear();
|
||||
CustomerRoles.AddRange(customerRoles);
|
||||
}
|
||||
|
||||
public void LogOut()
|
||||
{
|
||||
CustomerDto = null;
|
||||
CustomerRoles.Clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ public class SignalRTags : AcSignalRTags
|
|||
|
||||
public const int GetMeasuringUsers = 70;
|
||||
public const int GetCustomerDtoById = 71;
|
||||
public const int GetCustomerRolesByCustomerId = 72;
|
||||
|
||||
public const int GetProductDtos = 80;
|
||||
public const int GetProductDtoById = 81;
|
||||
|
|
|
|||
|
|
@ -6,12 +6,15 @@ using FruitBank.Common.Interfaces;
|
|||
using FruitBank.Common.Loggers;
|
||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices.JavaScript;
|
||||
using FruitBank.Common;
|
||||
|
||||
namespace FruitBankHybrid.Shared.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public sealed class FruitBankClientTests
|
||||
{
|
||||
private const int CustomerIdAasdDsserverCom = 6;//aasd@dsserver.com
|
||||
private const string Fixture = "_test.temp";
|
||||
|
||||
private FruitBankSignalRClient _signalRClient = null!;
|
||||
|
|
@ -88,7 +91,8 @@ namespace FruitBankHybrid.Shared.Tests
|
|||
var shippings = await _signalRClient.GetNotMeasuredShippings();
|
||||
|
||||
Assert.IsNotNull(shippings);
|
||||
Assert.IsTrue(shippings.All(s => !s.IsAllMeasured));
|
||||
var ShippingMeasuredDateAddDay = 1000; //dfd
|
||||
Assert.IsTrue(shippings.All(s => !s.IsAllMeasured || s.MeasuredDate != null || s.MeasuredDate < DateTime.Now.AddDays(ShippingMeasuredDateAddDay)));
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
|
|
@ -159,7 +163,9 @@ namespace FruitBankHybrid.Shared.Tests
|
|||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
//[DataRow(2)]
|
||||
[DataRow(2)]
|
||||
//[DataRow(3)]
|
||||
//[DataRow(4)]
|
||||
public async Task UpdateShippingItemTest(int shippingItemId)
|
||||
{
|
||||
var originalShippingItem = await GetShippingItemByIdTest(shippingItemId);
|
||||
|
|
@ -249,6 +255,17 @@ namespace FruitBankHybrid.Shared.Tests
|
|||
Assert.IsTrue(users.All(x => !x.Email.IsNullOrEmpty() && !x.Deleted));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow(CustomerIdAasdDsserverCom)]
|
||||
public async Task GetCustomerRolesByCustomerIdTest(int customerId)
|
||||
{
|
||||
var customerRoles = await _signalRClient.GetCustomerRolesByCustomerId(customerId);
|
||||
|
||||
Assert.IsNotNull(customerRoles);
|
||||
Assert.IsTrue(customerRoles.Count > 0);
|
||||
Assert.IsTrue(customerRoles.Any(cr => cr.SystemName == "Measuring"));
|
||||
}
|
||||
|
||||
#endregion Customer
|
||||
|
||||
#region Product
|
||||
|
|
@ -265,6 +282,7 @@ namespace FruitBankHybrid.Shared.Tests
|
|||
|
||||
#endregion Product
|
||||
|
||||
#region Login
|
||||
[TestMethod]
|
||||
[DataRow("aasd@dsserver.com", "Asdasd123456")]
|
||||
public async Task LoginMeasuringUserTest_TrueIfHasCustomerDto(string email, string password)
|
||||
|
|
@ -289,5 +307,6 @@ namespace FruitBankHybrid.Shared.Tests
|
|||
Assert.IsFalse(loginModelResponse.ErrorMessage.IsNullOrWhiteSpace());
|
||||
Console.WriteLine($"Succes: {loginModelResponse.ErrorMessage}");
|
||||
}
|
||||
#endregion Login
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DevExpress.Blazor" Version="25.1.*" />
|
||||
<PackageReference Include="DevExpress.Blazor" Version="25.1.3" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.9" />
|
||||
|
|
@ -46,19 +46,19 @@
|
|||
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.Resources.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.Resources.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.v25.1.Viewer">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.v25.1.Viewer.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Data.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Utils.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="Mango.Nop.Core">
|
||||
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,30 @@
|
|||
@inherits LayoutComponentBase
|
||||
@using FruitBank.Common.Models
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="page">
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<NavMenu @ref="_navMenu" />
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="top-row px-4">
|
||||
<a href="">Kijelentkezés</a>
|
||||
</div>
|
||||
<main>
|
||||
<div class="top-row px-4">
|
||||
@if (LoggedInModel.IsLoggedIn)
|
||||
{
|
||||
<DxButton Text="Kijelentkezés" Click="OnLogoutClick" />
|
||||
@* <a href="" on>Kijelentkezés</a> *@
|
||||
}
|
||||
</div>
|
||||
|
||||
<article class="content px-4">
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
<article class="content px-4">
|
||||
<CascadingValue Value="RefreshMainLayoutEventCallback">
|
||||
@Body
|
||||
</CascadingValue>
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui" data-nosnippet>
|
||||
An unhandled error has occurred.
|
||||
<a href="." class="reload">Reload</a>
|
||||
<span class="dismiss">🗙</span>
|
||||
An unhandled error has occurred.
|
||||
<a href="." class="reload">Reload</a>
|
||||
<span class="dismiss">🗙</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
using FruitBank.Common.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FruitBankHybrid.Shared.Layout;
|
||||
|
||||
public partial class MainLayout : LayoutComponentBase
|
||||
{
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
|
||||
private EventCallback RefreshMainLayoutEventCallback => EventCallback.Factory.Create(this, RefreshMainLayout);
|
||||
private NavMenu _navMenu = null!;
|
||||
|
||||
private void OnLogoutClick()
|
||||
{
|
||||
LoggedInModel.LogOut();
|
||||
|
||||
RefreshMainLayout();
|
||||
}
|
||||
|
||||
public void RefreshMainLayout()
|
||||
{
|
||||
_navMenu.RefreshNavMenu();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,8 @@
|
|||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
@using AyCode.Core
|
||||
@using FruitBank.Common.Models
|
||||
@inject LoggedInModel LoggedInModel
|
||||
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">FruitBank Measuring</a>
|
||||
</div>
|
||||
|
|
@ -8,21 +12,25 @@
|
|||
|
||||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="icon home-icon" aria-hidden="true"></span> Kezdőlap
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="MeasuringIn">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Bejövő mérés
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="MeasuringOut">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Kimenő mérés
|
||||
</NavLink>
|
||||
</div>
|
||||
@if (LoggedInModel.IsLoggedIn)// || AcDomain.IsDeveloperVersion)
|
||||
{
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="icon home-icon" aria-hidden="true"></span> Kezdőlap
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="MeasuringIn">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Bejövő mérés
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="MeasuringOut">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Kimenő mérés
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="Login">
|
||||
<span class="icon weather-icon" aria-hidden="true"></span> Bejelentkezés
|
||||
|
|
@ -32,3 +40,10 @@
|
|||
</nav>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
public void RefreshNavMenu()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">FruitBankHybrid</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
|
||||
|
||||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="icon home-icon" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="counter">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="weather">
|
||||
<span class="icon weather-icon" aria-hidden="true"></span> Weather
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using FruitBank.Common.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FruitBankHybrid.Shared.Pages;
|
||||
|
||||
public partial class Home : ComponentBase
|
||||
{
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
|
||||
private string Factor => FormFactor.GetFormFactor();
|
||||
private string Platform => FormFactor.GetPlatform();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,46 +3,50 @@
|
|||
|
||||
<h3>Bejelentkezés</h3>
|
||||
|
||||
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-500">
|
||||
<DxFormLayoutItem Caption="Válasszon felhasználót:" ColSpanMd="6">
|
||||
<DxComboBox Data="@Users"
|
||||
@bind-Value="@SelectedUser"
|
||||
Text="Select Employee"
|
||||
ValueFieldName="@nameof(CustomerDto.Id)"
|
||||
TextFieldName="@nameof(CustomerDto.FullName)"
|
||||
CssClass="cw-320"
|
||||
InputId="cbItemTemplate">
|
||||
<ItemDisplayTemplate Context="ctxCombo">
|
||||
<div class="combobox-item-template">
|
||||
<img src="@GetImageFileName(ctxCombo.DataItem)" alt="@ctxCombo.DataItem.Email" />
|
||||
<div class="combobox-item-template-text">
|
||||
<span>@ctxCombo.DataItem.FullName</span>
|
||||
<span class="combobox-item-template-employee-phone">@ctxCombo.DataItem.Email</span>
|
||||
|
||||
@if (!LoggedInModel.IsLoggedIn)
|
||||
{
|
||||
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-500">
|
||||
<DxFormLayoutItem Caption="Válasszon felhasználót:" ColSpanMd="6">
|
||||
<DxComboBox Data="@Users"
|
||||
@bind-Value="@SelectedUser"
|
||||
Text="Select Employee"
|
||||
ValueFieldName="@nameof(CustomerDto.Id)"
|
||||
TextFieldName="@nameof(CustomerDto.FullName)"
|
||||
CssClass="cw-320"
|
||||
InputId="cbItemTemplate">
|
||||
<ItemDisplayTemplate Context="ctxCombo">
|
||||
<div class="combobox-item-template">
|
||||
<img src="@GetImageFileName(ctxCombo.DataItem)" alt="@ctxCombo.DataItem.Email" />
|
||||
<div class="combobox-item-template-text">
|
||||
<span>@ctxCombo.DataItem.FullName</span>
|
||||
<span class="combobox-item-template-employee-phone">@ctxCombo.DataItem.Email</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ItemDisplayTemplate>
|
||||
</DxComboBox>
|
||||
</DxFormLayoutItem>
|
||||
</ItemDisplayTemplate>
|
||||
</DxComboBox>
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem Caption="Adja meg a jelszavát:" ColSpanMd="6">
|
||||
<DxTextBox @bind-Text="@PasswordValue"
|
||||
@onkeydown="OnPasswordKeyDown"
|
||||
Password="true"
|
||||
CssClass="cw-320"
|
||||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
|
||||
BindValueMode="BindValueMode.OnInput"
|
||||
NullText="Enter password"
|
||||
InputId="tbPassword" />
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Adja meg a jelszavát:" ColSpanMd="6">
|
||||
<DxTextBox @bind-Text="@PasswordValue"
|
||||
@onkeydown="OnPasswordKeyDown"
|
||||
Password="true"
|
||||
CssClass="cw-320"
|
||||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
|
||||
BindValueMode="BindValueMode.OnInput"
|
||||
NullText="Enter password"
|
||||
InputId="tbPassword" />
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
|
||||
<DxButton Text="Bejelentkezés" Click="OnLoginClick" CssClass="w-100" />
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
|
||||
<DxButton Text="Bejelentkezés" Click="OnLoginClick" CssClass="w-100" />
|
||||
</DxFormLayoutItem>
|
||||
|
||||
</DxFormLayout>
|
||||
</DxFormLayout>
|
||||
}
|
||||
|
||||
<div class="row w-100" style="margin-top: 30px;">
|
||||
<div class="col-md-12">
|
||||
<b>@(LoginModelResponse?.CustomerDto == null ? LoginModelResponse?.ErrorMessage : LoginModelResponse?.CustomerDto.FullName)</b>
|
||||
<b>@(LoggedInModel.CustomerDto == null ? LoginModelResponse?.ErrorMessage : LoggedInModel.CustomerDto.FullName + $" [{_rolesText}]")</b>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -3,6 +3,7 @@ using AyCode.Core.Loggers;
|
|||
using AyCode.Interfaces.Users;
|
||||
using AyCode.Utils.Extensions;
|
||||
using FruitBank.Common.Loggers;
|
||||
using FruitBank.Common.Models;
|
||||
using FruitBankHybrid.Shared.Services.Loggers;
|
||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||
using Mango.Nop.Core.Dtos;
|
||||
|
|
@ -17,6 +18,7 @@ public partial class Login : ComponentBase
|
|||
{
|
||||
[Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
|
||||
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
|
||||
private ILogger _logger = null!;
|
||||
private List<CustomerDto> Users { get; set; }
|
||||
|
|
@ -24,20 +26,31 @@ public partial class Login : ComponentBase
|
|||
private string PasswordValue { get; set; } = string.Empty;
|
||||
|
||||
private MgLoginModelResponse? LoginModelResponse { get; set; }
|
||||
|
||||
[CascadingParameter]
|
||||
public EventCallback UpdateStyle { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_logger = new LoggerClient<Login>(LogWriters.ToArray());
|
||||
_logger.Info("OnInitializedAsync");
|
||||
|
||||
Users = await FruitBankSignalRClient.GetMeasuringUsers() ?? [];
|
||||
SelectedUser = Users.FirstOrDefault();
|
||||
if (!LoggedInModel.IsLoggedIn)
|
||||
{
|
||||
Users = await FruitBankSignalRClient.GetMeasuringUsers() ?? [];
|
||||
SelectedUser = Users.FirstOrDefault();
|
||||
}
|
||||
else _rolesText = string.Join("; ", LoggedInModel.CustomerRoles.Select(x => x.Name));
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private string _rolesText = string.Empty;
|
||||
private async Task OnLoginClick()
|
||||
{
|
||||
if (LoggedInModel.IsLoggedIn) return;
|
||||
|
||||
_rolesText = string.Empty;
|
||||
if (SelectedUser == null || PasswordValue.IsNullOrWhiteSpace())
|
||||
{
|
||||
LoginModelResponse = new MgLoginModelResponse
|
||||
|
|
@ -49,11 +62,27 @@ public partial class Login : ComponentBase
|
|||
}
|
||||
|
||||
LoginModelResponse = await FruitBankSignalRClient.LoginMeasuringUser(SelectedUser.Email, PasswordValue);
|
||||
|
||||
if (LoginModelResponse is { IsSuccesLogin: true })
|
||||
{
|
||||
LoggedInModel.InitLoggedInCustomer(LoginModelResponse.CustomerDto);
|
||||
|
||||
var customerRoles = await FruitBankSignalRClient.GetCustomerRolesByCustomerId(LoginModelResponse.CustomerDto!.Id);
|
||||
if (customerRoles != null)
|
||||
{
|
||||
LoggedInModel.InitCustomerRoles(customerRoles);
|
||||
|
||||
_rolesText = string.Join("; ", LoggedInModel.CustomerRoles.Select(x => x.Name));
|
||||
}
|
||||
}
|
||||
|
||||
await UpdateStyle.InvokeAsync();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected async Task OnPasswordKeyDown(KeyboardEventArgs e)
|
||||
{
|
||||
if (e.Key == "Enter") await OnLoginClick();
|
||||
if (!LoggedInModel.IsLoggedIn && e.Key == "Enter") await OnLoginClick();
|
||||
}
|
||||
|
||||
private string GetImageFileName(CustomerDto employee)
|
||||
|
|
|
|||
|
|
@ -103,14 +103,14 @@
|
|||
@* <DataAnnotationsValidator /> *@
|
||||
<DxFormLayout Data="@SelectedShippingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100" ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value))">
|
||||
<DxFormLayoutItem CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")" Field="@nameof(ShippingItem.Name)" Caption="Item Name:" Enabled="false" ColSpanMd="6" />
|
||||
<DxFormLayoutItem CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")" Field="@nameof(ShippingItem.GrossWeight)" Caption="GrossWeight:" Enabled="false" ColSpanMd="3" />
|
||||
<DxFormLayoutItem CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")" Field="@nameof(ShippingItem.NetWeight)" Caption="NetWeight:" Enabled="false" ColSpanMd="3" />
|
||||
<DxFormLayoutItem Visible="false" CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")" Field="@nameof(ShippingItem.GrossWeight)" Caption="GrossWeight:" Enabled="false" ColSpanMd="3" />
|
||||
<DxFormLayoutItem Visible="false" CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")" Field="@nameof(ShippingItem.NetWeight)" Caption="NetWeight:" Enabled="false" ColSpanMd="3" />
|
||||
|
||||
<DxFormLayoutItem CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")"
|
||||
Field="@nameof(ShippingItem.MeasuredQuantity)"
|
||||
Caption="MeasuredQuantity:"
|
||||
ColSpanMd="2"
|
||||
BeginRow="true">
|
||||
BeginRow="false">
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")"
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
ColSpanMd="2">
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")"
|
||||
<DxFormLayoutItem Visible="false" CaptionCssClass="@(SelectedShippingItem.IsMeasured ? "text-success" : "")"
|
||||
Field="@nameof(ShippingItem.IsMeasured)"
|
||||
Enabled="false" Caption="Sikeres mérés:" ColSpanMd="6">
|
||||
</DxFormLayoutItem>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ namespace FruitBankHybrid.Shared.Pages
|
|||
{
|
||||
[Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
|
||||
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
|
||||
private ILogger _logger = null!;
|
||||
|
||||
|
|
@ -54,14 +55,11 @@ namespace FruitBankHybrid.Shared.Pages
|
|||
|
||||
private async Task RefreshShippingsFromDb(DateTime dateTime)
|
||||
{
|
||||
var shippings = await FruitBankSignalRClient.GetShippings() ?? [];
|
||||
var shippings = await FruitBankSignalRClient.GetNotMeasuredShippings() ?? [];
|
||||
|
||||
_shippingDates = shippings.Select(shipping => new ShippingDateModel(shipping.Id, shipping.ShippingDate.Date, shipping.IsAllMeasured)).ToList();
|
||||
NotMeasuredShippings = shippings.Where(shipping => DaysEqual(shipping.ShippingDate.Date, dateTime)).ToList();
|
||||
|
||||
//if (getAllShipping) NotMeasuredShippings = await FruitBankSignalRClient.GetShippings() ?? [];
|
||||
//else NotMeasuredShippings = await FruitBankSignalRClient.GetNotMeasuredShippings() ?? [];
|
||||
|
||||
SelectedShipping = NotMeasuredShippings.FirstOrDefault();
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +122,7 @@ namespace FruitBankHybrid.Shared.Pages
|
|||
SelectedShippingItem.MeasuredQuantity = shippingItemFromDb.MeasuredQuantity;
|
||||
SelectedShippingItem.MeasuredNetWeight = shippingItemFromDb.MeasuredNetWeight;
|
||||
SelectedShippingItem.MeasuredGrossWeight = shippingItemFromDb.MeasuredGrossWeight;
|
||||
//SelectedShippingItem.IsMeasurable = shippingItemFromDb.IsMeasurable;
|
||||
SelectedShippingItem.IsMeasured = shippingItemFromDb.IsMeasured;
|
||||
|
||||
if (SelectedShippingDocument != null)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using FruitBank.Common.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -9,5 +10,6 @@ namespace FruitBankHybrid.Shared.Pages
|
|||
{
|
||||
public partial class MeasuringOut : ComponentBase
|
||||
{
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using FruitBank.Common.SignalRs;
|
|||
using FruitBankHybrid.Shared.Services.Loggers;
|
||||
using Mango.Nop.Core.Dtos;
|
||||
using Mango.Nop.Core.Models;
|
||||
using Nop.Core.Domain.Customers;
|
||||
|
||||
namespace FruitBankHybrid.Shared.Services.SignalRs
|
||||
{
|
||||
|
|
@ -94,7 +95,9 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
|||
|
||||
public Task<List<CustomerDto>?> GetMeasuringUsers()
|
||||
=> GetAllAsync<List<CustomerDto>>(SignalRTags.GetMeasuringUsers);
|
||||
|
||||
|
||||
public Task<List<CustomerRole>?> GetCustomerRolesByCustomerId(int customerId)
|
||||
=> GetAllAsync<List<CustomerRole>>(SignalRTags.GetCustomerRolesByCustomerId, [customerId]);
|
||||
#endregion Customer
|
||||
|
||||
#region Product
|
||||
|
|
|
|||
|
|
@ -40,19 +40,19 @@
|
|||
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.Resources.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.Resources.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.v25.1.Viewer">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.v25.1.Viewer.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Data.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Utils.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using AyCode.Core.Loggers;
|
||||
using FruitBank.Common.Loggers;
|
||||
using FruitBank.Common.Models;
|
||||
using FruitBankHybrid.Shared.Services;
|
||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||
using FruitBankHybrid.Web.Client.Services;
|
||||
|
|
@ -14,6 +15,7 @@ builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = DevExpres
|
|||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
//builder.Services.AddScoped<ISignalRService, SignalRService>();
|
||||
|
||||
builder.Services.AddSingleton<LoggedInModel>();
|
||||
builder.Services.AddScoped<FruitBankSignalRClient>();
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<ProjectReference Include="..\FruitBankHybrid.Shared\FruitBankHybrid.Shared.csproj" />
|
||||
<ProjectReference Include="..\FruitBankHybrid.Web.Client\FruitBankHybrid.Web.Client.csproj" />
|
||||
|
||||
<PackageReference Include="DevExpress.Blazor" Version="25.1.*" />
|
||||
<PackageReference Include="DevExpress.Blazor" Version="25.1.3" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.9" />
|
||||
|
|
@ -57,19 +57,19 @@
|
|||
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.Resources.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.Resources.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Blazor.v25.1.Viewer">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Blazor.v25.1.Viewer.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Data.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v25.1">
|
||||
<HintPath>C:\Program Files\DevExpress 25.1\Components\Bin\NetCore\DevExpress.Utils.v25.1.dll</HintPath>
|
||||
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using AyCode.Core.Loggers;
|
||||
using FruitBank.Common;
|
||||
using FruitBank.Common.Models;
|
||||
using FruitBank.Common.Server.Services.Loggers;
|
||||
using FruitBank.Common.Server.Services.SignalRs;
|
||||
using FruitBankHybrid.Shared.Services;
|
||||
|
|
@ -14,8 +15,9 @@ builder.Services.AddMvc();
|
|||
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
|
||||
builder.Services.AddSingleton<LoggerToLoggerApiController>();
|
||||
builder.Services.AddSingleton<IAcLogWriterBase, ConsoleLogWriter>();
|
||||
builder.Services.AddScoped<LoggedInModel>();
|
||||
builder.Services.AddScoped<LoggerToLoggerApiController>();
|
||||
builder.Services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
|
||||
//builder.Services.AddSingleton<SessionService>();
|
||||
|
||||
//builder.Services.AddScoped<IFruitBankDataControllerServer, FruitBankDataController>();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
using FruitBankHybrid.Services;
|
||||
using AyCode.Core.Loggers;
|
||||
using FruitBank.Common.Loggers;
|
||||
using FruitBank.Common.Models;
|
||||
using FruitBankHybrid.Services;
|
||||
using FruitBankHybrid.Services.Loggers;
|
||||
using FruitBankHybrid.Shared.Services;
|
||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||
//using DevExpress.Maui;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||
using FruitBank.Common.Loggers;
|
||||
using AyCode.Core.Loggers;
|
||||
using FruitBankHybrid.Services.Loggers;
|
||||
|
||||
namespace FruitBankHybrid
|
||||
{
|
||||
|
|
@ -24,18 +25,20 @@ namespace FruitBankHybrid
|
|||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||
});
|
||||
|
||||
// Add device-specific services used by the FruitBankHybrid.Shared project
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
//builder.Services.AddScoped<ISignalRService, SignalRService>();
|
||||
builder.Services.AddScoped<FruitBankSignalRClient>();
|
||||
// Add device-specific services used by the FruitBankHybrid.Shared project
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
|
||||
builder.Services.AddSingleton<LoggedInModel>();
|
||||
//builder.Services.AddScoped<ISignalRService, SignalRService>();
|
||||
builder.Services.AddScoped<FruitBankSignalRClient>();
|
||||
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddSingleton<IAcLogWriterClientBase, BrowserConsoleLogWriter>();
|
||||
builder.Services.AddSingleton<IAcLogWriterClientBase, BrowserConsoleLogWriter>();
|
||||
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IAcLogWriterClientBase, SignaRClientLogItemWriter>();
|
||||
builder.Services.AddSingleton<IAcLogWriterClientBase, SignaRClientLogItemWriter>();
|
||||
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
|
|
|
|||
Loading…
Reference in New Issue