Bozza gestione sel data in browser
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.0.2308.0916</Version>
|
||||
<Version>2.0.2308.0919</Version>
|
||||
<Copyright>Egalware 2021+</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2308.216" />
|
||||
<PackageReference Include="It.FattureInCloud.Sdk" Version="2.0.18" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Extensions" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.13" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.2.2" />
|
||||
|
||||
+12
-10
@@ -1,10 +1,12 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingAuthenticationState>
|
||||
|
||||
@@ -9,20 +9,27 @@
|
||||
|
||||
<div class="d-flex w-100 justify-content-between ">
|
||||
<div class="px-2">
|
||||
@if (isLoading)
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-primary" @onclick="() => flushCache()" title="Forza Refresh Dati correnti"><i class="fas fa-sync-alt"></i></button>
|
||||
<i class="fas fa-user-alt text-light"></i> <span class="fw-bold title-text">@userName</span>
|
||||
@if (hasRight)
|
||||
{
|
||||
<span class="px-2 text-success">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
</span>
|
||||
}
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<i class="fas fa-user-alt text-light"></i> <span class="fw-bold title-text">@userName</span>
|
||||
@if (hasRight)
|
||||
{
|
||||
<span class="px-2 text-success">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
</span>
|
||||
}
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<b>Auth missing!</b>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
}
|
||||
</div>
|
||||
<div class="pe-2">
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SHERPA.Data.DbModels;
|
||||
using System;
|
||||
|
||||
namespace SHERPA.BBM.UI.Components
|
||||
{
|
||||
@@ -45,10 +48,31 @@ namespace SHERPA.BBM.UI.Components
|
||||
protected SHERPA.AD.Data.SADDataService SDService { get; set; } = null!;
|
||||
|
||||
protected List<PermessiModel> UserRight { get; set; } = new List<PermessiModel>();
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// List<PermessiModel> answ = new List<PermessiModel>();
|
||||
// var pUpd = Task.Run(async () =>
|
||||
// {
|
||||
// var result = await ProtectedSessionStore.GetAsync<List<PermessiModel>>("UserRight");
|
||||
// answ = result.Success ? result.Value : new List<PermessiModel>();
|
||||
|
||||
// });
|
||||
// pUpd.Wait();
|
||||
// return answ;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// ProtectedSessionStore.SetAsync("UserRight", value);
|
||||
// }
|
||||
//}
|
||||
|
||||
[Inject]
|
||||
protected SHERPA.AD.Data.VocabService VocService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ProtectedSessionStorage ProtectedSessionStore { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
@@ -116,14 +140,6 @@ namespace SHERPA.BBM.UI.Components
|
||||
private async Task checkAuth()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// verifico pagina tra i permessi, se manca --> rimando a pagina unauth...
|
||||
#if false
|
||||
string pageName = NavManager.ToBaseRelativePath(NavManager.Uri).ToLower();
|
||||
if (pageName.Contains("?"))
|
||||
{
|
||||
pageName = pageName.Substring(0, pageName.IndexOf("?"));
|
||||
}
|
||||
#endif
|
||||
// controllo se ho diritti...
|
||||
if (UserRight == null || UserRight.Count == 0)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using Blazored.LocalStorage;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -9,6 +12,14 @@ namespace SHERPA.BBM.UI.Data
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
#if false
|
||||
public BBM_SelectData(ILocalStorageService locStorage)
|
||||
{
|
||||
this.localStorage = locStorage;
|
||||
}
|
||||
|
||||
private ILocalStorageService localStorage { get; set; } = null!;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Anno selezionato (0=tutti)
|
||||
@@ -39,11 +50,17 @@ namespace SHERPA.BBM.UI.Data
|
||||
/// Cliente selezionato
|
||||
/// </summary>
|
||||
public int CustomerId { get; set; } = 1;
|
||||
#if false
|
||||
{
|
||||
get => localStorage.GetItemAsync<int>("CompanyId").Result;
|
||||
set => localStorage.SetItemAsync("CompanyId", $"{value}");
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Doc selezionato
|
||||
/// </summary>
|
||||
public int DocId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Doc selezionato
|
||||
/// </summary>
|
||||
public int DocId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Negoziazione selezionata
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
||||
using Microsoft.JSInterop;
|
||||
using Newtonsoft.Json;
|
||||
using SHERPA.BBM.UI.Data;
|
||||
using static EgwCoreLib.Razor.Sorter;
|
||||
|
||||
@@ -67,6 +71,17 @@ namespace SHERPA.BBM.UI.Pages
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#if true
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
[Inject]
|
||||
protected ISessionStorageService sessStorage { get; set; } = null!;
|
||||
#endif
|
||||
[Inject]
|
||||
protected ProtectedSessionStorage ProtSessionStore { get; set; } = null!;
|
||||
[Inject]
|
||||
protected ProtectedLocalStorage ProtLocalStore { get; set; } = null!;
|
||||
|
||||
protected bool OpenNewTab { get; set; } = true;
|
||||
|
||||
protected string OpenNewTabMsg
|
||||
@@ -97,7 +112,6 @@ namespace SHERPA.BBM.UI.Pages
|
||||
protected string CheckActive(bool isActive)
|
||||
{
|
||||
return isActive ? "" : "text-secondary";
|
||||
//return isActive ? "" : "opacity-50";
|
||||
}
|
||||
|
||||
protected void CreateNew()
|
||||
@@ -359,7 +373,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private void saveSelections(CORE.DbModels.BasketsModel currRecord)
|
||||
private async Task saveSelections(CORE.DbModels.BasketsModel currRecord)
|
||||
{
|
||||
SelectData.CompanyId = currRecord.CompanyId;
|
||||
// salvo codice company...
|
||||
@@ -377,10 +391,25 @@ namespace SHERPA.BBM.UI.Pages
|
||||
if (!OpenNewTab)
|
||||
{
|
||||
// salvo i parametri x filtraggio successivo...
|
||||
MService.UsrParamSet("OrdersSelYear", $"{SelectData.YearSel}");
|
||||
MService.UsrParamSet("OrdersSelBaskId", $"{SelectData.BasketId}");
|
||||
MService.UsrParamSet("OrdersSelYear", $"{currRecord.Anno}");
|
||||
MService.UsrParamSet("OrdersSelBaskId", $"{currRecord.BasketId}");
|
||||
MService.UsrParamSet("OrdersSelCustId", $"{SelectData.CustomerId}");
|
||||
}
|
||||
// salvo in session storage
|
||||
string serData = JsonConvert.SerializeObject(SelectData);
|
||||
await localStorage.SetItemAsStringAsync("SelData", serData);
|
||||
await localStorage.SetItemAsStringAsync("NegotSelData", serData);
|
||||
//await sessStorage.SetItemAsStringAsync("SelData", serData);
|
||||
#if false
|
||||
await localStorage.SetItemAsStringAsync("Anno", $"{currRecord.Anno}");
|
||||
await localStorage.SetItemAsStringAsync("BasketId", $"{currRecord.BasketId}");
|
||||
await localStorage.SetItemAsStringAsync("CompanyId", $"{currRecord.CompanyId}");
|
||||
await localStorage.SetItemAsStringAsync("CustomerId", $"{SelectData.CustomerId}");
|
||||
#endif
|
||||
//await ProtSessionStore.SetAsync("Anno", currRecord.Anno);
|
||||
//await ProtSessionStore.SetAsync("BasketId", currRecord.BasketId);
|
||||
//await ProtSessionStore.SetAsync("CompanyId", currRecord.CompanyId);
|
||||
//await ProtSessionStore.SetAsync("CustomerId", SelectData.CustomerId);
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
|
||||
@@ -30,12 +30,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
if (currItem != null)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
answ = (currItem.ItemId == ItemId) ? "bg-primary" : Item2Merge.Contains(ItemId) ? "table-info" : "";
|
||||
//}
|
||||
//catch
|
||||
//{ }
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
@@ -184,9 +179,6 @@ namespace SHERPA.BBM.UI.Pages
|
||||
CodItem = newCode,
|
||||
ResType = currRecord.ResType,
|
||||
UM = currRecord.UM,
|
||||
#if false
|
||||
UnitCost = currRecord.UnitCost,
|
||||
#endif
|
||||
UnitPrice = currRecord.UnitPrice,
|
||||
Descript = "COPIA di " + currRecord.Descript
|
||||
};
|
||||
@@ -279,7 +271,6 @@ namespace SHERPA.BBM.UI.Pages
|
||||
set
|
||||
{
|
||||
_SelResType = value;
|
||||
//ReloadAllData().ConfigureAwait(false);
|
||||
var pUpd = Task.Run(async () => await ReloadAllData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using EgwCoreLib.Razor.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Org.BouncyCastle.Asn1.IsisMtt.X509;
|
||||
using SHERPA.BBM.UI.Data;
|
||||
using static EgwCoreLib.Razor.Sorter;
|
||||
|
||||
@@ -14,7 +19,11 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = (SelBasketId <= 1 || SelCustomerId <= 1 || SelCompanyId <= 1) ? true : false;
|
||||
bool answ = true;
|
||||
if (!isLoading)
|
||||
{
|
||||
answ = (SelBasketId <= 1 || SelCustomerId <= 1 || SelCompanyId <= 1) ? true : false;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
@@ -76,8 +85,37 @@ namespace SHERPA.BBM.UI.Pages
|
||||
get => OpenNewTab ? "Nuova Scheda" : "Scheda Corrente";
|
||||
}
|
||||
|
||||
protected BBM_SelectData SelectData { get; set; } = new BBM_SelectData();
|
||||
#if false
|
||||
{
|
||||
get
|
||||
{
|
||||
var rawData = sessStorage.GetItemAsync<BBM_SelectData>("NegotSelData").Result;
|
||||
if(rawData==null)
|
||||
{
|
||||
rawData = localStorage.GetItemAsync<BBM_SelectData>("NegotSelData").Result;
|
||||
string serData = JsonConvert.SerializeObject(rawData);
|
||||
sessStorage.SetItemAsStringAsync("NegotSelData", serData);
|
||||
}
|
||||
return rawData;
|
||||
}
|
||||
set
|
||||
{
|
||||
string serData = JsonConvert.SerializeObject(value);
|
||||
//localStorage.SetItemAsStringAsync("NegotSelData", serData);
|
||||
sessStorage.SetItemAsStringAsync("NegotSelData", serData);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if false
|
||||
[Inject]
|
||||
protected BBM_SelectData SelectData { get; set; } = null!;
|
||||
protected BBM_SelectData SelectData { get; set; } = null!;
|
||||
#endif
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
[Inject]
|
||||
protected ISessionStorageService sessStorage { get; set; } = null!;
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
@@ -176,6 +214,28 @@ namespace SHERPA.BBM.UI.Pages
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
// check fix selData..
|
||||
await fixSel();
|
||||
//return base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
|
||||
private const string storKey = "NegotSelData";
|
||||
|
||||
private async Task fixSel()
|
||||
{
|
||||
var rawData = await sessStorage.GetItemAsync<BBM_SelectData>(storKey);
|
||||
if (rawData == null)
|
||||
{
|
||||
rawData = await localStorage.GetItemAsync<BBM_SelectData>(storKey);
|
||||
string serData = JsonConvert.SerializeObject(rawData);
|
||||
await sessStorage.SetItemAsStringAsync(storKey, serData);
|
||||
await localStorage.RemoveItemAsync(storKey);
|
||||
}
|
||||
SelectData = rawData;
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<UserSecretsId>60fcdaab-6c1e-4bec-9d88-f7727ef1c12c</UserSecretsId>
|
||||
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
|
||||
<Version>2.0.2308.0916</Version>
|
||||
<Version>2.0.2308.0919</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Copyright>Egalware 2021+</Copyright>
|
||||
@@ -171,6 +171,8 @@
|
||||
<PackageReference Include="ElmahCore.Common" Version="2.1.2" />
|
||||
<PackageReference Include="ElmahCore.Sql" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Extensions" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.13" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.6.122" />
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@using SHERPA.BBM.UI
|
||||
@using SHERPA.BBM.UI.Shared
|
||||
@using SHERPA.BBM.UI.Data
|
||||
|
||||
Reference in New Issue
Block a user