elenco magazzini:
-creato componente separato -aggiunta datapager
This commit is contained in:
@@ -131,7 +131,7 @@ namespace MP.INVE.Components
|
||||
};
|
||||
|
||||
await MIDataservice.InsertNewSessione(newSess);
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
NavManager.NavigateTo("Session", true);
|
||||
await reloadData();
|
||||
}
|
||||
else
|
||||
@@ -150,7 +150,7 @@ namespace MP.INVE.Components
|
||||
if (alert)
|
||||
{
|
||||
await MIDataservice.deleteSessione(session);
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
NavManager.NavigateTo("Session", true);
|
||||
await reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
@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>
|
||||
<th scope="col">ID magazzino</th>
|
||||
<th scope="col">Codice magazzino</th>
|
||||
<th scope="col">Codice azienda</th>
|
||||
<th scope="col">Descrizione</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (elencoMagazzini != null)
|
||||
{
|
||||
@foreach (var item in elencoMagazzini)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.MagID
|
||||
</td>
|
||||
<td>
|
||||
@item.CodMag
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@item.CodCS
|
||||
</td>
|
||||
<td>
|
||||
@item.DescMag
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-sm" @onclick="()=>deleteMag(item)">
|
||||
<i class="fa-solid fa-trash-can"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
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 MP.INVE;
|
||||
using MP.INVE.Shared;
|
||||
using MP.INVE.Components;
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class MagList
|
||||
{
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private ISessionStorageService sessionStorage { get; set; } = null!;
|
||||
[Inject]
|
||||
private ILocalStorageService localStorage { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private MiDataService MIDataservice { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public SelectMagListParams currParams { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public bool isLoading { get; set; }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
private void closeNew()
|
||||
{
|
||||
reqNew = false;
|
||||
codMag = "";
|
||||
desc = "";
|
||||
}
|
||||
private List<AnagMagModel>? elencoMagazzini;
|
||||
private List<AnagMagModel>? SearchRecords;
|
||||
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 reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
elencoMagazzini = null;
|
||||
SearchRecords = null;
|
||||
SearchRecords = MIDataservice.ElencoMagazzini();
|
||||
totalCount = SearchRecords.Count;
|
||||
elencoMagazzini = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
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 bool reqNew
|
||||
{
|
||||
get => currParams.reqNew;
|
||||
set => currParams.reqNew = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => currParams.TotCount;
|
||||
set => currParams.TotCount = value;
|
||||
}
|
||||
private int numRecord
|
||||
{
|
||||
get => currParams.NumRec;
|
||||
set
|
||||
{
|
||||
currParams.NumRec = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
private int currPage
|
||||
{
|
||||
get => currParams.CurrPage;
|
||||
set
|
||||
{
|
||||
currParams.CurrPage = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
private bool inCorso
|
||||
{
|
||||
get => currParams.inCorso;
|
||||
set => currParams.inCorso = value;
|
||||
}
|
||||
private string codMag { get; set; } = "";
|
||||
private string desc { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using MP.Data;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectMagListParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectMagListParams()
|
||||
{ }
|
||||
|
||||
#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;
|
||||
public bool inCorso { get; set; } = true;
|
||||
public bool reqNew { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectInveSessionParams 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;
|
||||
|
||||
if (inCorso != item.inCorso)
|
||||
return false;
|
||||
|
||||
if (reqNew != item.reqNew)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.INVE</RootNamespace>
|
||||
<Version>6.16.2211.2108</Version>
|
||||
<Version>6.16.2211.2110</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -25,102 +25,12 @@
|
||||
}
|
||||
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>
|
||||
<th scope="col">ID magazzino</th>
|
||||
<th scope="col">Codice magazzino</th>
|
||||
<th scope="col">Codice azienda</th>
|
||||
<th scope="col">Descrizione</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (elencoMagazzini != null)
|
||||
{
|
||||
@foreach (var item in elencoMagazzini)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.MagID
|
||||
</td>
|
||||
<td>
|
||||
@item.CodMag
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@item.CodCS
|
||||
</td>
|
||||
<td>
|
||||
@item.DescMag
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-sm"@onclick="()=>deleteMag(item)">
|
||||
<i class="fa-solid fa-trash-can"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<MagList currParams="currParams" ></MagList>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager />
|
||||
<div class="card-footer py-1 mb-3">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -38,7 +38,52 @@ namespace MP.INVE.Pages
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
public SelectMagListParams currParams = new SelectMagListParams();
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => currParams.TotCount;
|
||||
set => currParams.TotCount = value;
|
||||
}
|
||||
private int numRecord
|
||||
{
|
||||
get => currParams.NumRec;
|
||||
set
|
||||
{
|
||||
if (currParams.NumRec != value)
|
||||
{
|
||||
currParams.NumRec = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private int currPage
|
||||
{
|
||||
get => currParams.CurrPage;
|
||||
set
|
||||
{
|
||||
if (currParams.CurrPage != value)
|
||||
{
|
||||
currParams.CurrPage = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool reqNew
|
||||
{
|
||||
get => currParams.reqNew;
|
||||
set => currParams.reqNew = value;
|
||||
}
|
||||
private bool inCorso
|
||||
{
|
||||
get => currParams.inCorso;
|
||||
set
|
||||
{
|
||||
if (currParams.inCorso != value)
|
||||
{
|
||||
currParams.inCorso = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<AnagMagModel>? elencoMagazzini;
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -101,57 +146,19 @@ namespace MP.INVE.Pages
|
||||
await reloadData();
|
||||
}
|
||||
}
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
|
||||
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrl"]}"; }
|
||||
|
||||
#if false
|
||||
protected async Task getId()
|
||||
{
|
||||
OperatoreDTO sess = new OperatoreDTO();
|
||||
OperatoreDTO local = new OperatoreDTO();
|
||||
sess = await sessionStorage.GetItemAsync<OperatoreDTO>("MatrOpr");
|
||||
local = await localStorage.GetItemAsync<OperatoreDTO>("MatrOpr");
|
||||
if ((local != null))
|
||||
{
|
||||
string auth = local.hashAuthKey;
|
||||
idOperatore = local.MatrOpr;
|
||||
authKey = auth;
|
||||
}
|
||||
else
|
||||
{
|
||||
NavManager.NavigateTo("OperatoreLogin");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if false
|
||||
protected string rawCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
answ = $"{BaseUrlTab}MatrOpr={idOperatore}&UserAuthKey={authKey}";
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOINVE </i>
|
||||
<h4>Versione: 6.16.2211.2108</h4>
|
||||
<h4>Versione: 6.16.2211.2110</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2211.2108
|
||||
6.16.2211.2110
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.2108</version>
|
||||
<version>6.16.2211.2110</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>
|
||||
|
||||
Reference in New Issue
Block a user