151 lines
5.6 KiB
Plaintext
151 lines
5.6 KiB
Plaintext
@using SHERPA.BBM.UI.Data
|
|
@using SHERPA.BBM.UI.Components;
|
|
@using CORE.DbModels
|
|
@using Blazorise
|
|
|
|
@inject BBM_EFService BBMService
|
|
@inject BBM_SelectData SelectData
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-info text-light">
|
|
<b>Modifica</b>
|
|
</div>
|
|
<div class="card-body small">
|
|
<EditForm Model="@_currItem">
|
|
<DataAnnotationsValidator />
|
|
<Microsoft.AspNetCore.Components.Forms.ValidationSummary />
|
|
<div class="row">
|
|
<div class="col-6 col-lg-3">
|
|
<NaviNegot @bind-SelValue="_currItem.NegotiationId"></NaviNegot>
|
|
@*<InputSelect @bind-Value="@_currItem.NegotiationId" class="form-control form-control-sm">
|
|
@foreach (var item in negotiationList)
|
|
{
|
|
<option value="@item.NegotiationId">@item.CodNegotiation | @item.Descript</option>
|
|
}
|
|
</InputSelect>*@
|
|
</div>
|
|
<div class="col-6 col-lg-3">
|
|
<div class="form-group">
|
|
<label for="itemSel">Tipo:</label>
|
|
<InputSelect @bind-Value="_currItem.DocType" id="DocTypeSel" class="form-control form-control-sm" title="Tipo Documento">
|
|
@foreach (var value in Enum.GetValues(typeof(BbmDocType)))
|
|
{
|
|
<option>@value</option>
|
|
}
|
|
</InputSelect>
|
|
</div>
|
|
</div>
|
|
<div class="col-6 col-lg-3">
|
|
<div class="form-group">
|
|
<label for="codNeg">Codice:</label>
|
|
<InputText id="codNeg" @bind-Value="_currItem.CodDoc" class="form-control form-control-sm" />
|
|
</div>
|
|
</div>
|
|
<div class="col-6 col-lg-3">
|
|
<label for="descript">Descrizione:</label>
|
|
<InputTextArea id="descript" @bind-Value="_currItem.Descript" class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-6 col-lg-3">
|
|
<label for="Note">Note:</label>
|
|
<InputTextArea id="Note" @bind-Value="_currItem.Note" class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-6 col-lg-3">
|
|
<label>Inserita:</label>
|
|
<DateEdit InputMode="DateInputMode.DateTime" @bind-Date="@_currItem.DataIns" Class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-6 col-lg-2">
|
|
<label>Anno:</label>
|
|
<InputNumber id="Anno" @bind-Value="_currItem.Anno" class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-6 col-lg-2">
|
|
<label>NumDoc:</label>
|
|
<InputNumber id="NumDoc" @bind-Value="_currItem.NumDoc" class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-2 col-lg-1">
|
|
<label title="Indica se l'offerta sia da considerare Draft (non conteggiata economicamente)">Draft:</label>
|
|
<InputCheckbox id="IsDraft" @bind-Value="_currItem.IsDraft" class="form-control form-control-sm" />
|
|
</div>
|
|
<div class="col-6 col-lg-3 align-bottom">
|
|
<input type="submit" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate" />
|
|
</div>
|
|
<div class="col-6 col-lg-3 align-baseline">
|
|
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</EditForm>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
|
|
private List<CORE.DbModels.BasketsModel> basketList;
|
|
|
|
private List<CORE.DbModels.NegotiationsModel> negotiationList;
|
|
|
|
protected CORE.DbModels.DocsModel _currItem = new DocsModel();
|
|
|
|
[Parameter]
|
|
public CORE.DbModels.DocsModel currItem
|
|
{
|
|
get
|
|
{
|
|
return _currItem = null;
|
|
}
|
|
set
|
|
{
|
|
_currItem = value;
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataReset { get; set; }
|
|
[Parameter]
|
|
public EventCallback<int> DataUpdated { get; set; }
|
|
|
|
private async Task saveUpdate()
|
|
{
|
|
if (_currItem != null)
|
|
{
|
|
// se è licenza --> attivo!
|
|
if (_currItem.DocType >= BbmDocType.Licenza)
|
|
{
|
|
_currItem.IsActive = true;
|
|
}
|
|
BBMService.DocsUpdate(_currItem);
|
|
|
|
// SE non si tratta di licenza o altro "successivo"
|
|
if (_currItem.DocType < BbmDocType.Licenza)
|
|
{
|
|
// aggiorno active
|
|
BBMService.DocSetActive(_currItem);
|
|
}
|
|
|
|
// clono ANCHE le resources suo NUOVO elemento
|
|
BBMService.ResourceCloneByDoc(SelectData.DocIdSrc, _currItem.DocId);
|
|
// reset
|
|
SelectData.DocIdSrc = 0;
|
|
// evento
|
|
await DataUpdated.InvokeAsync(1);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Doc null!");
|
|
}
|
|
}
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadAllData();
|
|
}
|
|
|
|
protected async Task ReloadAllData()
|
|
{
|
|
basketList = await BBMService.BasketsGetAsync(1,"");
|
|
negotiationList = await BBMService.NegotiationsGetAllAsync();
|
|
}
|
|
} |