Aggiunto tasto per il suggerimento della descrizione attvità in base al tipo
This commit is contained in:
@@ -30,6 +30,17 @@
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings blue-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Description"
|
||||
Size="Size.Medium"
|
||||
OnClick="@SuggestActivityDescription"
|
||||
Variant="Variant.Outlined">
|
||||
Suggerisci descrizione
|
||||
</MudButton>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<MudAutocomplete ReadOnly="IsView" T="string?" Placeholder="Cliente"
|
||||
@@ -464,7 +475,7 @@
|
||||
private async Task LoadCommesse(string searchValue)
|
||||
{
|
||||
if (_lastLoadedCodAnag == ActivityModel.CodAnag && searchValue.IsNullOrEmpty()) return;
|
||||
|
||||
|
||||
if (ActivityModel.CodAnag == null)
|
||||
{
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x =>
|
||||
@@ -783,4 +794,29 @@
|
||||
private static string AdjustCoordinate(double coordinate) =>
|
||||
coordinate.ToString(CultureInfo.InvariantCulture).Replace(",", ".");
|
||||
|
||||
private async Task SuggestActivityDescription()
|
||||
{
|
||||
if (ActivityModel.ActivityTypeId == null)
|
||||
{
|
||||
Snackbar.Add("Indicare prima il tipo attività", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(ActivityModel.ActivityTypeId);
|
||||
|
||||
var modal = ModalHelpers.OpenSuggestActivityDescription(Dialog, activityDescriptions);
|
||||
|
||||
if (modal is { IsCanceled: false, Result: not null })
|
||||
ActivityModel.ActivityDescription = modal.Result.Data!.ToString();
|
||||
|
||||
VisibleOverlay = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user