aggiunta pagina cancellazione

This commit is contained in:
zaccaria.majid
2022-12-15 12:15:58 +01:00
parent 7b70e21fbb
commit 280996e73b
2 changed files with 162 additions and 0 deletions
+89
View File
@@ -0,0 +1,89 @@
@page "/Cancellazione"
<div class="d-flex justify-content-between">
<h5 class="fw-bold py-1">MP.INVE</h5>
<div class="fs-5 py-0">
<span class="fw-bold badge bg-info py-1 text-dark">Cancellazione</span>
</div>
<div class="text-end">
<button class="btn btn-sm btn-primary mb-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight"><i class="fa-solid fa-bars"></i></button>
</div>
</div>
<div class="offcanvas offcanvas-end" data-bs-scroll="true" data-bs-backdrop="false" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel">
<div class="offcanvas-header">
<h5 id="offcanvasRightLabel">Menu</h5>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body text-center">
<button class="btn btn-sm btn-success text-end mb-2" @onclick="()=>goBack()">
MODALITÀ SCANSIONE
</button>
</div>
</div>
<CodeScan lastRawScan="saveScan"></CodeScan>
@if (currScan != null)
{
<div class="card">
<div class="card-header">
<span>
Dati ultima scansione
</span>
</div>
<div class="card-body">
<div class="text-center">
<div>
<div class="fs-5">
<span><b>Codice: </b></span>
</div>
<div class="fs-3">
@currScan.ScanValue
</div>
</div>
<div>
<div class="fs-5">
<span><b>Lotto: </b></span>
</div>
<div class="fs-3">
@currScan.Lotto
</div>
</div>
<div>
<div class="fs-5">
<span><b>Articolo: </b></span>
</div>
<div class="fs-3">
@currScan.CodArticolo
</div>
</div>
<div>
<div class="fs-5">
<span><b>Quantità: </b></span>
</div>
<div class="fs-3">
@Math.Round(currScan.Qty, 0)
</div>
</div>
</div>
<div class="col-12">
<button class="btn btn-sm btn-danger col-12" @onclick="()=>deleteScan(currScan)">
<i class="fa-solid fa-trash-can"></i>
</button>
</div>
</div>
</div>
}
else if (first)
{
<div class="alert bg-warning">Eseguire scansione</div>
}
else
{
<div class="alert bg-danger">Nessuna scansione trovata</div>
}
+73
View File
@@ -0,0 +1,73 @@
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 MP.Data.DatabaseModels;
using MP.INVE.Data;
using Microsoft.AspNetCore.WebUtilities;
namespace MP.INVE.Pages
{
public partial class Cancellazione
{
[Inject]
MiDataService MIService { get; set; } = null!;
[Inject]
IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
protected string rawScan { get; set; } = null!;
ScanDataModel? currScan;
protected bool first { get; set; } = false;
protected override async Task OnInitializedAsync()
{
first = true;
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOpr", out var _idOpr))
{
sessID = int.Parse(_inveSessionId);
idOPr = _idOpr;
}
}
int sessID { get; set; } = 0;
string idOPr { get; set; } = "";
protected void saveScan(string newScan)
{
first = false;
if (!string.IsNullOrEmpty(newScan))
{
rawScan = newScan;
currScan = MIService.ScanByValueSessionOpr(rawScan, sessID, idOPr);
}
}
protected async Task deleteScan(ScanDataModel scan)
{
await MIService.deleteScansione(scan);
NavManager.NavigateTo(NavManager.Uri, true);
}
protected async Task goBack()
{
await JSRuntime.InvokeVoidAsync("history.go", -1);
}
private string CodUDC { get; set; } = null!;
}
}