generated from Integry/Template_NetMauiBlazorHybrid
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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
@using salesbook.Shared.Core.Entity
|
||||
|
||||
<MudDialog OnBackdropClick="Cancel">
|
||||
<DialogContent>
|
||||
@if (!ActivityTypers.IsNullOrEmpty())
|
||||
{
|
||||
<MudList T="string" SelectedValueChanged="OnClickItem">
|
||||
@foreach (var item in ActivityTypers!)
|
||||
{
|
||||
<MudListItem Text="@item.ActivityTypeDescription" Value="item.ActivityTypeDescription"/>
|
||||
}
|
||||
</MudList>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="spinner-container">
|
||||
<MudIcon Size="Size.Large" Color="Color.Error" Icon="@Icons.Material.Rounded.Close"/>
|
||||
<MudText>Nessuna descrizione consigliata</MudText>
|
||||
</div>
|
||||
}
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
[Parameter] public List<StbActivityTyper>? ActivityTypers { get; set; }
|
||||
|
||||
private void Cancel() => MudDialog.Cancel();
|
||||
|
||||
private void OnClickItem(string? selectedValue) =>
|
||||
MudDialog.Close(DialogResult.Ok(selectedValue));
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using salesbook.Shared.Components.SingleElements.Modal;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Dto.Activity;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
|
||||
namespace salesbook.Shared.Core.Helpers;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class ModalHelpers
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif,
|
||||
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif,
|
||||
ContactDTO? contactModel = null, List<PersRifDTO>? persRifList = null)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<PersRifForm>(
|
||||
@@ -54,7 +55,7 @@ public class ModalHelpers
|
||||
new DialogParameters<PersRifForm>
|
||||
{
|
||||
{ x => x.OriginalModel, persRif },
|
||||
{ x => x.ContactModel, contactModel},
|
||||
{ x => x.ContactModel, contactModel },
|
||||
{ x => x.PersRifList, persRifList }
|
||||
},
|
||||
new DialogOptions
|
||||
@@ -74,7 +75,7 @@ public class ModalHelpers
|
||||
"Add attached",
|
||||
new DialogParameters<AddAttached>
|
||||
{
|
||||
{ x => x.CanAddPosition, canAddPosition}
|
||||
{ x => x.CanAddPosition, canAddPosition }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
@@ -87,4 +88,25 @@ public class ModalHelpers
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenSuggestActivityDescription(IDialogService dialog,
|
||||
List<StbActivityTyper>? activityTypers)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalSuggestDescription>(
|
||||
"Suggest activity description",
|
||||
new DialogParameters<ModalSuggestDescription>
|
||||
{
|
||||
{ x => x.ActivityTypers, activityTypers }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true,
|
||||
BackdropClick = false
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,8 @@ public interface IIntegryApiService
|
||||
Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName);
|
||||
|
||||
Task<CRMJobProgressResponseDTO> RetrieveJobProgress(string codJcom);
|
||||
|
||||
Task<List<StbActivityTyper>?> SuggestActivityDescription(string activityType);
|
||||
|
||||
//Position
|
||||
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Task<List<StbActivity>?> RetrieveActivity(CRMRetrieveActivityRequestDTO activityRequest) =>
|
||||
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/retrieveActivity", activityRequest);
|
||||
|
||||
@@ -42,10 +42,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
|
||||
}
|
||||
|
||||
public Task<UsersSyncResponseDTO> RetrieveAnagClie(CRMAnagRequestDTO request) =>
|
||||
public Task<UsersSyncResponseDTO> RetrieveAnagClie(CRMAnagRequestDTO request) =>
|
||||
integryApiRestClient.AuthorizedPost<UsersSyncResponseDTO>("crm/retrieveClienti", request)!;
|
||||
|
||||
public Task<UsersSyncResponseDTO> RetrieveProspect(CRMProspectRequestDTO request) =>
|
||||
public Task<UsersSyncResponseDTO> RetrieveProspect(CRMProspectRequestDTO request) =>
|
||||
integryApiRestClient.AuthorizedPost<UsersSyncResponseDTO>("crm/retrieveProspect", request)!;
|
||||
|
||||
public Task<SettingsResponseDTO> RetrieveSettings() =>
|
||||
@@ -74,7 +74,8 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
|
||||
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity)
|
||||
{
|
||||
if (activity.CodJcom is null && userSession.ProfileDb != null && userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
|
||||
if (activity.CodJcom is null && userSession.ProfileDb != null &&
|
||||
userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
activity.CodJcom = "0000";
|
||||
}
|
||||
@@ -188,4 +189,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
|
||||
return integryApiRestClient.Get<CRMJobProgressResponseDTO>("crm/retrieveJobProgress", queryParams)!;
|
||||
}
|
||||
|
||||
public Task<List<StbActivityTyper>?> SuggestActivityDescription(string activityType) =>
|
||||
integryApiRestClient.Get<List<StbActivityTyper>>(
|
||||
"activity/suggestActivityDescription",
|
||||
new Dictionary<string, object> { { "activityType", activityType } }
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user