146 lines
4.8 KiB
Plaintext
146 lines
4.8 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
|
|
|
|
@inject MessageService AppMService
|
|
@inject GWMSDataService DataService
|
|
@inject IConfiguration Configuration
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-info text-light">
|
|
<b>Modifica</b>
|
|
</div>
|
|
<div class="card-body small p-1">
|
|
<EditForm Model="@_currItem">
|
|
<DataAnnotationsValidator />
|
|
<div class="row">
|
|
<div class="col-12 col-lg-2">
|
|
<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" />
|
|
</div>
|
|
<div class="col-12 col-lg-8 align-items-center">
|
|
<div class="row small">
|
|
<div class="col-12">
|
|
<div class="input-group input-group-sm">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text" style="width: 3em;">
|
|
<span class="fas fa-calendar-alt" aria-hidden="true"></span>
|
|
</span>
|
|
</div>
|
|
<InputDate id="DtEta" @bind-Value="_currItem.DtETA" class="form-control" title="ETA (previsione consegna)" />
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="input-group input-group-sm">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text" style="width: 3em;">
|
|
<span class="fas fa-comment-alt" aria-hidden="true"></span>
|
|
</span>
|
|
</div>
|
|
<InputText id="OrderDesc" @bind-Value="_currItem.OrderDesc" class="form-control" title="Note Ordine (opzionali)" />
|
|
<div class="input-group-append">
|
|
<span class="input-group-text">
|
|
Note
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-lg-2">
|
|
<div>
|
|
<button type="button" class="btn btn-sm btn-outline-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
|
|
</div>
|
|
<div>
|
|
<button type="button" class="btn btn-sm btn-outline-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
|
</div>
|
|
</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 = null;
|
|
}
|
|
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)
|
|
{
|
|
DataService.OrderUpdate(_currItem);
|
|
await DataUpdated.InvokeAsync(1);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Order null!");
|
|
}
|
|
}
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadAllData();
|
|
}
|
|
|
|
protected async Task ReloadAllData()
|
|
{
|
|
transpList = await DataService.TransportersGetAll();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce URL immagine QRCode
|
|
/// </summary>
|
|
/// <param name="QrValue">Parametro da renderizzare con QRCode</param>
|
|
/// <returns></returns>
|
|
protected string getImgUrl(object QrValue)
|
|
{
|
|
string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
|
|
string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
|
|
string answ = $"{baseUrl}{payload}";
|
|
return answ;
|
|
}
|
|
|
|
} |