146 lines
4.7 KiB
Plaintext
146 lines
4.7 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 AppMessages
|
|
@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 />
|
|
<Blazorise.ValidationSummary />
|
|
<div class="row">
|
|
<div class="col-12 col-lg-2">
|
|
<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" width="150" />
|
|
</div>
|
|
<div class="col-12 col-lg-10">
|
|
<div class="row">
|
|
<div class="col-3">
|
|
<label>Trasportatore:</label>
|
|
<InputSelect @bind-Value="@_currItem.TransporterId" class="form-control form-control-sm">
|
|
@foreach (var item in transpList)
|
|
{
|
|
<option value="@item.TransporterId">@item.TransporterCode | @item.TransporterDesc</option>
|
|
}
|
|
</InputSelect>
|
|
</div>
|
|
<div class="col-3">
|
|
<label for="DtEta">ETA (previsione consegna)</label>
|
|
<InputDate id="DtEta" @bind-Value="_currItem.DtETA" class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="form-group">
|
|
<label for="OrderDesc">Note:</label>
|
|
<InputText id="OrderDesc" @bind-Value="_currItem.OrderDesc" class="form-control form-control-sm" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-3"></div>
|
|
<div class="col-9">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<input type="submit" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate" />
|
|
</div>
|
|
<div class="col-6">
|
|
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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.TransportersGetFilt(SupplierId);
|
|
}
|
|
|
|
/// <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["matrixUrl"]}/HOME/QR_site/JSON?val=";
|
|
string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
|
|
string answ = $"{baseUrl}{payload}";
|
|
return answ;
|
|
}
|
|
|
|
} |