inizio fix duplicazione negoziazioni

This commit is contained in:
Samuele Locatelli
2021-11-12 16:46:47 +01:00
parent fc0636dabf
commit 5fe58f9c50
3 changed files with 68 additions and 20 deletions
@@ -13,32 +13,41 @@
<DataAnnotationsValidator />
<Blazorise.ValidationSummary />
<div class="row">
<div class="col-12 col-lg-6">
<div class="form-group">
<label for="codNeg">Codice:</label>
<InputText id="codNeg" @bind-Value="_negotiation.CodNegotiation" class="form-control form-control-sm" />
</div>
<div class="col-6 col-lg-3">
<label for="compSel">Azienda:</label>
<InputSelect @bind-Value="@SelectedCompanyId" id="compSel" class="form-control form-control-sm" title="Azienda">
@foreach (var item in companyList)
{
<option value="@item.CompanyId">@item.Descript</option>
}
</InputSelect>
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">Inserita:</label>
<DateEdit InputMode="DateInputMode.DateTime" @bind-Date="@_negotiation.DataIns" Class="form-control form-control-sm" />
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">Path:</label>
<InputText id="BasePath" @bind-Value="_negotiation.BasePath" class="form-control form-control-sm" />
</div>
<div class="col-12 col-lg-6">
<label for="descript">Descrizione:</label>
<InputTextArea id="descript" cla @bind-Value="_negotiation.Descript" class="form-control form-control-sm" />
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">Cliente:</label>
<label for="itemSel">Cliente:</label>
<InputSelect @bind-Value="@SelectedCustomerId" id="itemSel" class="form-control form-control-sm" title="Cliente">
@foreach (var item in itemsList)
{
<option value="@item.CustomerId">@item.RagSoc | @item.PI | @item.Descript</option>
}
</InputSelect>
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">Inserita:</label>
<DateEdit InputMode="DateInputMode.DateTime" @bind-Date="@_negotiation.DataIns" Class="form-control form-control-sm" />
</div>
<div class="col-6 col-lg-3">
<div class="form-group">
<label for="codNeg">Codice:</label>
<InputText id="codNeg" @bind-Value="_negotiation.CodNegotiation" class="form-control form-control-sm" />
</div>
</div>
<div class="col-12 col-lg-6">
<label for="descript">Descrizione:</label>
<InputTextArea id="descript" cla @bind-Value="_negotiation.Descript" class="form-control form-control-sm" />
</div>
<div class="col-6 col-lg-3">
<label for="dataIns">Path:</label>
<InputText id="BasePath" @bind-Value="_negotiation.BasePath" class="form-control form-control-sm" />
<input type="submit" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate" />
</div>
<div class="col-6 col-lg-3">
@@ -52,7 +61,8 @@
</div>
@code {
private List<DatabaseModels.CompanyModel> companyList;
private List<DatabaseModels.CustomersModel> itemsList;
protected int? SelectedCustomerId
{
@@ -70,6 +80,22 @@
_negotiation.CustomerId = value;
}
}
protected int SelectedCompanyId
{
get
{
int answ = 0;
if (_negotiation != null)
{
answ = _negotiation.CompanyId;
}
return answ;
}
set
{
_negotiation.CompanyId = value;
}
}
protected DatabaseModels.NegotiationsModel _negotiation = new NegotiationsModel();
@@ -116,6 +142,7 @@
protected async Task ReloadAllData()
{
companyList = await BBMService.CompanyGetAll();
itemsList = await BBMService.CustomersGetAll("");
}
}
+1 -1
View File
@@ -51,7 +51,7 @@
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.NegotiationId)">
<td class="text-nowrap"><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button>&nbsp;<button class="btn btn-sm btn-success" @onclick="() => ShowDocs(record)" title="Vai ai documenti"><span class="oi oi-document"></span></button></td>
<td class="text-nowrap"><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button>&nbsp;<button class="btn btn-sm btn-warning" @onclick="() => Duplicate(record)" title="Clona"><span class="oi oi-fork"></span></button>&nbsp;;<button class="btn btn-sm btn-success" @onclick="() => ShowDocs(record)" title="Vai ai documenti"><span class="oi oi-document"></span></button></td>
<td>
<div>
@record.CodNegotiation
+21
View File
@@ -108,6 +108,7 @@ namespace SHERPA.BBM.UI.Pages
{
CodNegotiation = newCode,
DataIns = DateTime.Now,
CompanyId = SelCompanyId,
CustomerId = 1,
Descript = "Nuova Negoziazione",
BasePath = "",
@@ -125,6 +126,26 @@ namespace SHERPA.BBM.UI.Pages
await UpdateData();
}
protected async Task Duplicate(DatabaseModels.NegotiationsModel currRecord)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler clonare la trattativa/licenza corrente?"))
return;
// recupero counter
string newCode = BBMService.CounterGetNext($"{SelectData.Company}.N.{DateTime.Today.Year}", 6);
DatabaseModels.NegotiationsModel newRecord = new DatabaseModels.NegotiationsModel()
{
CodNegotiation = newCode,
DataIns = DateTime.Now,
CompanyId = currRecord.CompanyId,
CustomerId = 1,
Descript = "COPIA di " + currRecord.Descript,
BasePath = currRecord.BasePath,
Refer = currRecord.Refer
};
currItem = newRecord;
}
protected void Edit(SHERPA.BBM.DatabaseModels.NegotiationsModel currRecord)
{
currItem = currRecord;