4fda312aac
- altri metodi tracciati - modifica json x prod - aggiunta Async vari
117 lines
2.9 KiB
Plaintext
117 lines
2.9 KiB
Plaintext
@using GWMS.UI.Components
|
|
@using GWMS.Data.DatabaseModels
|
|
@using System.Security.Claims
|
|
@using Microsoft.AspNetCore.Components.Authorization
|
|
@using GWMS.UI.Data
|
|
@using Microsoft.Extensions.Configuration
|
|
@using Microsoft.JSInterop
|
|
|
|
@inject MessageService AppMService
|
|
@inject GWMSDataService DataService
|
|
@inject IConfiguration Configuration
|
|
@inject IJSRuntime JSRuntime
|
|
|
|
<div class="card">
|
|
<div class="card-body small p-1">
|
|
@if (_currItem != null)
|
|
{
|
|
<EditForm Model="@_currItem">
|
|
<DataAnnotationsValidator />
|
|
<div class="d-flex flex-column text-center">
|
|
<div class="p-1 flex-grow-1">
|
|
<div id="qrCodeImg"></div>
|
|
@_currItem.OrderCode
|
|
@*<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" />*@
|
|
</div>
|
|
<div class="p-1 flex-grow-1">
|
|
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
|
</div>
|
|
</div>
|
|
</EditForm>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
|
|
private List<TransporterModel> transpList;
|
|
|
|
protected OrderModel _currItem = new OrderModel();
|
|
protected int _supplierId { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public OrderModel currItem
|
|
{
|
|
get
|
|
{
|
|
return _currItem;
|
|
}
|
|
set
|
|
{
|
|
_currItem = value;
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataReset { get; set; }
|
|
[Parameter]
|
|
public EventCallback<int> DataUpdated { get; set; }
|
|
[Parameter]
|
|
public int SupplierId
|
|
{
|
|
get
|
|
{
|
|
return _supplierId;
|
|
}
|
|
set
|
|
{
|
|
_supplierId = value;
|
|
// condiziono visualizzazione...
|
|
var pUpd = Task.Run(async () => await ReloadAllData());
|
|
pUpd.Wait();
|
|
}
|
|
}
|
|
|
|
private async Task saveUpdate()
|
|
{
|
|
if (_currItem != null)
|
|
{
|
|
await DataService.OrderUpdateAsync(_currItem);
|
|
await DataUpdated.InvokeAsync(1);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Order null!");
|
|
}
|
|
}
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
protected string rawCode
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
if (_currItem != null)
|
|
{
|
|
answ = _currItem.OrderCode;
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadAllData();
|
|
await JSRuntime.InvokeVoidAsync("displayQr", "qrCodeImg", rawCode);
|
|
}
|
|
|
|
protected async Task ReloadAllData()
|
|
{
|
|
transpList = await DataService.TransportersGetAllAsync();
|
|
}
|
|
|
|
} |