9b65b068fc
- Aggiunta ricerca dettaglio KIT x ODL/PODL
156 lines
3.9 KiB
C#
156 lines
3.9 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.Data.DbModels;
|
|
using MP.Data.Services;
|
|
using System;
|
|
|
|
namespace MP_TAB3.Components
|
|
{
|
|
public partial class CurrOdlDetail
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public ODLExpModel CurrOdl { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public PODLExpModel CurrPodl { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_ToggleOdlDetail { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_TogglePOdl { get; set; }
|
|
|
|
[Parameter]
|
|
public bool ForceCloseOdl { get; set; }
|
|
|
|
[Parameter]
|
|
public int IdxPOdlSel { get; set; }
|
|
|
|
[Parameter]
|
|
public bool InAttr { get; set; }
|
|
|
|
[Parameter]
|
|
public bool ShowClose { get; set; } = true;
|
|
|
|
[Parameter]
|
|
public bool ShowOdlDetail { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MessageService MsgServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected SharedMemService SMServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected TabDataService TDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio
|
|
/// </summary>
|
|
/// <param name="CodArticolo"></param>
|
|
/// <returns></returns>
|
|
protected bool CheckIsKit(string CodArticolo)
|
|
{
|
|
bool answ = false;
|
|
if (ListArtKit != null && ListArtKit.Count > 0)
|
|
{
|
|
answ = ListArtKit.Count(x => x.CodArticolo == CodArticolo) > 0;
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
protected void KitToggleDetail(string? selCodArt, int idxPOdl)
|
|
{
|
|
if (!string.IsNullOrEmpty(selCodArt))
|
|
{
|
|
ListKitTemplate = TDService.TemplateKitFilt(selCodArt, "");
|
|
}
|
|
else
|
|
{
|
|
ListKitTemplate = null;
|
|
}
|
|
if (idxPOdl>0)
|
|
{
|
|
ListPOdlKit = TDService.POdlListByKitParent(idxPOdl);
|
|
}
|
|
else
|
|
{
|
|
ListPOdlKit = null;
|
|
}
|
|
showKitDetail = !showKitDetail;
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
// carico elenco KIT
|
|
ListArtKit = TDService.ArticoliGetByTipo("KIT", "*");
|
|
}
|
|
|
|
protected async Task ToggleOdlDetail()
|
|
{
|
|
await EC_ToggleOdlDetail.InvokeAsync(true);
|
|
}
|
|
|
|
protected string Traduci(string lemma)
|
|
{
|
|
return SMServ.Traduci($"{baseLang}_{lemma}".ToUpper());
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
|
|
/// <summary>
|
|
/// Elenco articoli tipo KIT
|
|
/// </summary>
|
|
private List<AnagArticoliModel>? ListArtKit;
|
|
|
|
private List<TemplateKitModel>? ListKitTemplate = null;
|
|
private List<PODLExpModel>? ListPOdlKit;
|
|
|
|
private bool showKitDetail = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private string baseLang
|
|
{
|
|
get => MsgServ.UserPrefGet("Lang");
|
|
}
|
|
|
|
private string cssDetailOdl
|
|
{
|
|
get => IdxPOdlSel > 0 ? "bg-info text-light" : "bg-warning";
|
|
}
|
|
|
|
private bool showPOdlData { get; set; } = true;
|
|
|
|
private string titleOdlDetail
|
|
{
|
|
get => IdxPOdlSel > 0 ? "Verifica parametri attrezzaggio NUOVO PODL" : InAttr ? "Parametri PODL in Attrezzaggio" : "Parametri PODL Corrente";
|
|
}
|
|
|
|
private string txtBtnOdlDetail
|
|
{
|
|
get => ShowOdlDetail ? "Nascondi Dettaglio PODL" : "MOSTRA Dettaglio ODL Corrente";
|
|
}
|
|
|
|
private string txtShowXDL
|
|
{
|
|
get => showPOdlData ? "PODL" : "ODL";
|
|
}
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |