@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
@if (_currItem != null) {
@_currItem.OrderCode @**@
}
@code { private List 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 DataReset { get; set; } [Parameter] public EventCallback 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.OrderUpdate(_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.TransportersGetAll(); } }