bozza paging

This commit is contained in:
zaccaria.majid
2022-11-18 12:51:35 +01:00
parent 629489fa85
commit 446d376a9f
14 changed files with 224 additions and 29 deletions
+52
View File
@@ -0,0 +1,52 @@
using MP.Data;
namespace MP.INVE.Data
{
public class DataPagerParams
{
#region Public Constructors
public DataPagerParams()
{ }
#endregion Public Constructors
#region Public Properties
public int CurrPage { get; set; } = 1;
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
public int MaxRecord { get; set; } = 100;
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is DataPagerParams item))
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (TotCount != item.TotCount)
return false;
if (NumRec != item.NumRec)
if (CurrPage != item.CurrPage)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2211.1809</Version>
<Version>6.16.2211.1812</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -184,7 +184,7 @@
</div>
<div class="card-footer py-1">
<DataPager />
<DataPager @ref="pagerSession" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
</div>
</div>
+39 -6
View File
@@ -26,10 +26,15 @@ namespace MP.INVE.Pages
[Inject]
private MiDataService MIDataservice { get; set; } = null!;
DataPagerParams currParams = new DataPagerParams();
private List<InventorySessionModel>? elencoSessioni;
private List<InventorySessionModel>? SearchRecords;
private List<AnagOperatoriModel>? elencoOperatori;
private List<AnagMagModel>? elencoMagazzini;
private DataPager pagerSession = null!;
protected override async Task OnInitializedAsync()
{
//await FilterChanged.InvokeAsync(actFilter);
@@ -62,7 +67,6 @@ namespace MP.INVE.Pages
}
}
private bool reqNew { get; set; } = false;
private void openNew()
{
@@ -114,24 +118,44 @@ namespace MP.INVE.Pages
}
}
private bool reqNew { get; set; } = false;
private bool isLoading { get; set; } = false;
private int magazzino { get; set; } = 0;
private string matrOpr { get; set; } = "";
private int magazzino { get; set; } = 0;
private string desc { get; set; } = "";
private int totalCount
{
get => currParams.TotCount;
set=> currParams.TotCount = value;
}
private int numRecord
{
get => currParams.NumRec;
set => currParams.NumRec = value;
}
private int currPage
{
get => currParams.CurrPage;
set => currParams.CurrPage = value;
}
private async Task reloadData()
{
await Task.Delay(1);
{
elencoSessioni = null;
isLoading = true;
if (inCorso)
{
elencoSessioni = MIDataservice.InventSessCurrList();
SearchRecords = MIDataservice.InventSessCurrList();
}
else
{
elencoSessioni = MIDataservice.InventSessHistList(dtStart, dtEnd);
SearchRecords = MIDataservice.InventSessHistList(dtStart, dtEnd);
}
totalCount = SearchRecords.Count;
elencoSessioni = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
await Task.Delay(1);
isLoading = false;
}
protected async Task getCurrSess(int idSess)
@@ -150,6 +174,15 @@ namespace MP.INVE.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected async Task getId()
{
+55 -8
View File
@@ -12,23 +12,70 @@
</div>
<div class="col-5 d-flex flex-row-reverse">
<button class="btn btn-success">
<button class="btn btn-success" @onclick="()=>openNew()">
<i class="fa-regular fa-square-plus"></i> &nbsp; NUOVO
</button>
</div>
</div>
<div class="card-body">
@*@if (isLoading)
@if (isLoading)
{
<LoadingData></LoadingData>
}*@
@*else
}
else
{
@if (reqNew)
{
}*@
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Avvia una nuova sessione
</div>
<div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-4 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Codice magazzino</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind="@codMag">
</div>
</div>
<div class="col-4 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Descrizione</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind="@desc">
</div>
</div>
</div>
<div class="row pt-4" style="visibility:">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="closeNew">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
@if (codMag != "")
{
<div class="d-grid gap-2">
<button class="btn btn-success" @onclick="insertNewMag">Save <i class="bi bi-save"></i></button>
</div>
}
</div>
</div>
</div>
</div>
</div>
</div>
}
<table class="table">
<thead>
<tr>
@@ -59,7 +106,7 @@
@item.DescMag
</td>
<td>
<button class="btn btn-danger btn-sm">
<button class="btn btn-danger btn-sm"@onclick="()=>deleteMag(item)">
<i class="fa-solid fa-trash-can"></i>
</button>
</td>
@@ -69,7 +116,7 @@
}
</tbody>
</table>
@*}*@
}
</div>
<div class="card-footer py-1">
+68 -5
View File
@@ -35,15 +35,80 @@ namespace MP.INVE.Pages
[Inject]
private MiDataService MIDataservice { get; set; } = null!;
private int idOperatore { get; set; } = 0;
private string authKey { get; set; } = "";
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private List<AnagMagModel>? elencoMagazzini;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
elencoMagazzini = MIDataservice.ElencoMagazzini();
await reloadData();
//await getId();
}
private void openNew()
{
reqNew = true;
}
private void closeNew()
{
reqNew = false;
codMag = "";
desc = "";
}
private async Task reloadData()
{
await Task.Delay(1);
elencoMagazzini = null;
isLoading = true;
elencoMagazzini = MIDataservice.ElencoMagazzini();
isLoading = false;
}
private async Task insertNewMag()
{
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler creare un nuovo magazzino?");
if (alert)
{
AnagMagModel newMag = new AnagMagModel()
{
CodMag = codMag,
CodCS = "EC",
DescMag = desc,
Nascosto = false
};
await MIDataservice.InsertNewMag(newMag);
NavManager.NavigateTo("Elencomagazzini", true);
//await MIDataservice.FlushRedisCache();
await reloadData();
}
else
{
closeNew();
}
}
private async Task deleteMag(AnagMagModel mag)
{
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler eliminare il magazzino selezionato?");
if (alert)
{
await MIDataservice.DeleteMag(mag);
NavManager.NavigateTo("Elencomagazzini", true);
await reloadData();
}
}
private int idOperatore { get; set; } = 0;
private string authKey { get; set; } = "";
private bool reqNew { get; set; } = false;
private bool isLoading { get; set; } = false;
private string codMag { get; set; } = "";
private string desc { get; set; } = "";
#if false
protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -77,8 +142,6 @@ namespace MP.INVE.Pages
}
}
#endif
[Inject]
private NavigationManager NavManager { get; set; } = null!;
#if false
protected string rawCode
{
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2211.1809</h4>
<h4>Versione: 6.16.2211.1812</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.1809
6.16.2211.1812
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.1809</version>
<version>6.16.2211.1812</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -33,7 +33,7 @@
</NavLink>
</div>
<div class="nav-item px-2 col-12">
<NavLink class="nav-link px-2" href="ELencomagazzini">
<NavLink class="nav-link px-2" href="Elencomagazzini">
<div class="col-2">
<span class="px-2" aria-hidden="true"><i class="fa-solid fa-warehouse"></i></span>
</div>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.1514</Version>
<Version>6.16.2211.1812</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.1514</h4>
<h4>Versione: 6.16.2211.1812</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.1514
6.16.2211.1812
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.1514</version>
<version>6.16.2211.1812</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>