153 lines
4.4 KiB
C#
153 lines
4.4 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using WebDoorCreator.Data.DbModels;
|
|
using WebDoorCreator.Data.DTO;
|
|
using WebDoorCreator.Data.Services;
|
|
using WebDoorCreator.UI.Components.DoorMan;
|
|
using WebDoorCreator.UI.Data;
|
|
|
|
namespace WebDoorCreator.UI.Components.TemplateMan
|
|
{
|
|
public partial class TemplModal
|
|
{
|
|
|
|
|
|
[Parameter]
|
|
public int CurrDoorId { get; set; } = 0;
|
|
|
|
|
|
|
|
[Parameter]
|
|
public EventCallback<DoorModel> E_DoorClose { get; set; }
|
|
|
|
|
|
|
|
[Parameter]
|
|
public int OrderId { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public string userId { get; set; } = "";
|
|
|
|
[Inject]
|
|
protected IConfiguration config { get; set; } = null!;
|
|
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
protected QueueDataService QDataServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected WebDoorCreatorService WDService { get; set; } = null!;
|
|
[Inject]
|
|
protected WDCUserService WDUService { get; set; } = null!;
|
|
|
|
|
|
protected async Task closeModal()
|
|
{
|
|
await Task.Delay(1);
|
|
var fakeDoor = new DoorModel();
|
|
|
|
await E_DoorClose.InvokeAsync(fakeDoor);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Clona la porta selezionata con annesse door operations
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected async Task doClone()
|
|
{
|
|
//await WDService.DoorCloneToOrder();
|
|
}
|
|
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await Task.Delay(1);
|
|
await ReloadData();
|
|
}
|
|
|
|
protected string activeTemplCss(int OrdId)
|
|
{
|
|
string answ = "";
|
|
if(OrdId == currOrderId)
|
|
{
|
|
answ = "color: #2980B9; background-color: rgba(41, 128, 185, 0.2)";
|
|
}
|
|
else
|
|
{
|
|
answ = "color: #000; background-color: transparent";
|
|
}
|
|
return answ;
|
|
}
|
|
protected async Task setCurrTempl(int OrdId)
|
|
{
|
|
currOrderId = OrdId;
|
|
await ReloadData();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prepara il dictionary dei testi da riportare nell'oggetto ordine
|
|
/// </summary>
|
|
/// <param name="door"></param>
|
|
/// <returns></returns>
|
|
protected Dictionary<string, string> textDictSetup(DoorModel door)
|
|
{
|
|
Dictionary<string, string> answ = new Dictionary<string, string>();
|
|
answ.Add("Door ID:", $"{door.DoorId}");
|
|
answ.Add("Model #:", $"{door.TypeNav?.TypeId}");
|
|
answ.Add("Door Price:", $"{(door.Quantity * door.UnitCost):C2}");
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// Path del servizio di recupero SVG delle porte
|
|
/// </summary>
|
|
/// <param name="doorId"></param>
|
|
/// <returns></returns>
|
|
protected string DoorSvgUrl(int doorId)
|
|
{
|
|
return $"api/DoorImage/GetImage.svg?DoorId={doorId}";
|
|
}
|
|
[Parameter]
|
|
public int currOrderId { get; set; } = 0;
|
|
protected List<DoorModel>? DoorsList { get; set; } = null;
|
|
protected List<OrderStatusViewModel>? TemplateListGen { get; set; } = null;
|
|
protected List<OrderStatusViewModel>? TemplateListbyComp { get; set; } = null;
|
|
|
|
protected int currUserComp
|
|
{
|
|
get => WDUService.userCurrComp;
|
|
}
|
|
|
|
protected async Task ReloadData()
|
|
{
|
|
if (currOrderId != -1)
|
|
{
|
|
var SearchRecords = await WDService.DoorGetByOrderId(currOrderId);
|
|
TemplateListGen = await WDService.OrderStatusGetFilt(1, 10000, DateTime.Today.AddYears(-100), DateTime.Today.AddYears(100));
|
|
TemplateListbyComp = await WDService.OrderStatusGetFilt(currUserComp, 10000, DateTime.Today.AddYears(-100), DateTime.Today.AddYears(100));
|
|
if (SearchRecords != null)
|
|
{
|
|
|
|
DoorsList = SearchRecords
|
|
.ToList();
|
|
|
|
if (DoorsList != null)
|
|
{
|
|
var currOrder = DoorsList.FirstOrDefault();
|
|
if (currOrder?.OrderNav != null)
|
|
{
|
|
//orderStatus = currOrder.OrderNav.Status;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |