|
-
- @* *@
+
+
|
@item.OfferID |
+
+ @($"{item.Inserted:yyyy-MM-dd}")
+ @($"{item.ValidUntil:yyyy-MM-dd}")
+ |
+
+
+ |
@item.OfferCode
@item.Envir
diff --git a/Lux.UI/Components/Pages/Offers.razor.cs b/Lux.UI/Components/Pages/Offers.razor.cs
index e97009eb..d3437d2a 100644
--- a/Lux.UI/Components/Pages/Offers.razor.cs
+++ b/Lux.UI/Components/Pages/Offers.razor.cs
@@ -2,7 +2,9 @@ using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
+using Microsoft.JSInterop;
using NLog.LayoutRenderers;
+using static EgwCoreLib.Lux.Core.Enums;
namespace Lux.UI.Components.Pages
{
@@ -27,6 +29,23 @@ namespace Lux.UI.Components.Pages
#region Protected Properties
+ ///
+ /// Filtro offerte: ogni stato / sole aperte
+ ///
+ protected bool AllStates
+ {
+ get => allState;
+ set
+ {
+ if (allState != value)
+ {
+ allState = value;
+ DoFilter();
+ UpdateTable();
+ }
+ }
+ }
+
protected string DivMainCss
{
get => SelRecord != null ? "col-6" : "col-12";
@@ -35,6 +54,14 @@ namespace Lux.UI.Components.Pages
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
+ [Inject]
+ protected IJSRuntime JSRuntime { get; set; } = null!;
+
+ protected string txtState
+ {
+ get => allState ? "Tutte" : "Aperte";
+ }
+
#endregion Protected Properties
#region Protected Methods
@@ -59,6 +86,16 @@ namespace Lux.UI.Components.Pages
};
}
+ protected async Task DoClone(OfferModel rec2clone)
+ {
+ if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler duplicare interamente l'offerta selezionata?{Environment.NewLine}---------------------------{Environment.NewLine}Env: {rec2clone.Envir} | {rec2clone.OfferCode}{Environment.NewLine}{rec2clone.Description}{Environment.NewLine}Articoli: {rec2clone.NumItems}{Environment.NewLine}---------------------------{Environment.NewLine}Importo: {rec2clone.TotalPrice:C2}"))
+ return;
+ // clona intera offerta + tutte le righe...
+ await DLService.OfferClone(rec2clone);
+ await ReloadData();
+ UpdateTable();
+ }
+
protected void DoEdit(OfferModel curRec)
{
currStep = CompileStep.Header;
@@ -78,29 +115,62 @@ namespace Lux.UI.Components.Pages
protected override async Task OnInitializedAsync()
{
+ PeriodoSel = new EgwCoreLib.Utils.DtUtils.Periodo(EgwCoreLib.Utils.DtUtils.PeriodSet.ThisTrim);
SetupArrows();
await ReloadData();
UpdateTable();
}
+ ///
+ /// Imposta lo stato dell'offerta VERIFICANDO i vari casi di stato di artenza/arrivo...
+ ///
+ ///
+ ///
+ ///
+ protected async Task SetState(OfferModel currRec, OfferStates newStatus)
+ {
+ // in primis: se è già confermata chiede una autorizzazione di conferma speciale
+
+ // se va verso conferma ricorda che ora l'ordine passa in pianificazione
+
+ /* ---------------------------------
+ * se lo conferma: esegue step speciali come
+ * - generazione item prod con ID ed etichetta
+ * - generazione delle "buste di stima" x richiedere task stima preliminare
+ * - generazione del dizionario delle etichette + riga d'ordine da inviare
+ * - invio chiamata su channelRedis
+ *
+ * il puro invio dovrà poter essere fatto anche dalla tab ordini... e serve visualizzazione delle estim pending
+ * --------------------------------- */
+
+ currRec.OffertState = newStatus;
+ await DLService.OffertUpsert(currRec);
+ await ReloadData();
+ UpdateTable();
+ }
+
#endregion Protected Methods
#region Private Fields
private List AllRecords = new List();
-
+ private bool allState = false;
private int currPage = 1;
-
private CompileStep currStep = CompileStep.Draft;
-
private OfferModel? EditRecord = null;
-
+ private OfferModel? EditStateRec = null;
private bool isLoading = false;
-
+ private List ListFilt = new List();
private List ListRecords = new List();
private int numRecord = 10;
+ ///
+ /// Periodo selezionato attuale
+ ///
+ private EgwCoreLib.Utils.DtUtils.Periodo PeriodoSel = new EgwCoreLib.Utils.DtUtils.Periodo(EgwCoreLib.Utils.DtUtils.PeriodSet.ThisYear);
+
+ private string searchVal = "";
private OfferModel? SelRecord = null;
private int totalCount = 0;
@@ -145,6 +215,40 @@ namespace Lux.UI.Components.Pages
EditRecord = null;
}
+ private void DoFilter()
+ {
+ // verifico eventuali filtri
+ ListFilt = AllRecords
+ .Where(x => x.OffertState == OfferStates.Open || allState)
+ .ToList();
+ if (!string.IsNullOrEmpty(searchVal))
+ {
+ ListFilt = ListFilt
+ .Where(x => x.Description.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) || x.OfferCode.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase))
+ .ToList();
+ }
+ totalCount = ListFilt.Count();
+ }
+
+ ///
+ /// Salva record ed avanza compilazione
+ ///
+ ///
+ ///
+ private async Task DoSave(OfferModel updRec)
+ {
+ // salvo record
+ await DLService.OffertUpsert(updRec);
+ // cambio step
+ CompileStep nextStep = currStep < CompileStep.FinalCheck ? currStep + 1 : currStep;
+ AdvStep(nextStep);
+ }
+
+ private void EditState(OfferModel? curRec)
+ {
+ EditStateRec = curRec;
+ }
+
///
/// Rilegge tabella
///
@@ -165,8 +269,22 @@ namespace Lux.UI.Components.Pages
///
private async Task ReloadData()
{
- AllRecords = await DLService.OfferGetAll();
- totalCount = AllRecords.Count();
+ await DLService.OffersCheckExpired();
+ //AllRecords = await DLService.OfferGetAll();
+ AllRecords = await DLService.OfferGetFilt(PeriodoSel.Inizio, PeriodoSel.Fine);
+ DoFilter();
+ }
+
+ ///
+ /// Imposta periodo da filtro
+ ///
+ ///
+ ///
+ private async Task SetPeriodo(EgwCoreLib.Utils.DtUtils.Periodo newPeriod)
+ {
+ PeriodoSel = newPeriod;
+ await ReloadData();
+ UpdateTable();
}
private void SetupArrows()
@@ -184,7 +302,7 @@ namespace Lux.UI.Components.Pages
private void UpdateTable()
{
// fix paginazione
- ListRecords = AllRecords
+ ListRecords = ListFilt
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
@@ -216,18 +334,5 @@ namespace Lux.UI.Components.Pages
RefreshDisplay();
}
#endif
- ///
- /// Salva record ed avanza compilazione
- ///
- ///
- ///
- private async Task DoSave(OfferModel updRec)
- {
- // salvo record
- await DLService.OffertUpsert(updRec);
- // cambio step
- CompileStep nextStep = currStep < CompileStep.FinalCheck ? currStep + 1 : currStep;
- AdvStep(nextStep);
- }
}
}
\ No newline at end of file
diff --git a/Lux.UI/Components/Pages/Orders.razor b/Lux.UI/Components/Pages/Orders.razor
new file mode 100644
index 00000000..d767e1f6
--- /dev/null
+++ b/Lux.UI/Components/Pages/Orders.razor
@@ -0,0 +1,189 @@
+@page "/Orders"
+
+@if (EditRecord != null)
+{
+
+
+
+
+ @if (currStep == CompileStep.Header)
+ {
+
+ }
+ else if (currStep == CompileStep.General)
+ {
+
+ }
+ else if (currStep == CompileStep.Rows)
+ {
+
+ }
+ else if (currStep == CompileStep.Delivery)
+ {
+
+ }
+ else if (currStep == CompileStep.FinalCheck)
+ {
+
+ }
+
+
+}
+else
+{
+
+
+
+ @if (isLoading)
+ {
+
+ }
+ else if (totalCount == 0)
+ {
+ Nessun record trovato
+ }
+ else
+ {
+
+
+ @*
+
+
+ |
+
+ |
+ ID |
+ Codice |
+ Agente/Riv |
+ Cliente |
+ @if (SelRecord == null)
+ {
+ Descrizione |
+ }
+ # righe |
+ # articoli |
+ Importo |
+ Marg. |
+ Esito |
+
+
+
+ @foreach (var item in ListRecords)
+ {
+
+ |
+
+
+ |
+ @item.OfferID |
+
+ @item.OfferCode
+ @item.Envir
+ |
+
+ @if (item.DealerNav != null)
+ {
+ @item.DealerNav.FirstName @item.DealerNav.LastName
+ @item.DealerNav.VAT
+ }
+ |
+
+ @if (item.CustomerNav != null)
+ {
+ @item.CustomerNav.FirstName @item.CustomerNav.LastName
+ @item.CustomerNav.VAT
+ }
+ |
+ @if (SelRecord == null)
+ {
+ @item.Description |
+ }
+
+ @item.NumRows
+ |
+
+ @item.NumItems
+ |
+
+ @item.TotalPrice.ToString("C2")
+ (@item.TotalCost.ToString("C2"))
+ |
+
+ @item.MaxDiscount.ToString("P2")
+ |
+
+
+
+ |
+
+ }
+
+ *@
+ Work In Progress
+
+ @if (SelRecord != null)
+ {
+
+
+
+ }
+
+ }
+
+
+}
diff --git a/Lux.UI/Components/Pages/Orders.razor.cs b/Lux.UI/Components/Pages/Orders.razor.cs
new file mode 100644
index 00000000..bf04c45f
--- /dev/null
+++ b/Lux.UI/Components/Pages/Orders.razor.cs
@@ -0,0 +1,207 @@
+using EgwCoreLib.Lux.Data.DbModel.Sales;
+using EgwCoreLib.Lux.Data.Services;
+using Microsoft.AspNetCore.Components;
+
+namespace Lux.UI.Components.Pages
+{
+ public partial class Orders
+ {
+ #region Protected Enums
+
+ ///
+ /// Stato compilazione offerta
+ ///
+ protected enum CompileStep
+ {
+ Draft = 0,
+ Header = 1,
+ General,
+ Rows,
+ Delivery,
+ FinalCheck
+ }
+
+ #endregion Protected Enums
+
+ #region Protected Properties
+
+ protected string DivMainCss
+ {
+ get => SelRecord != null ? "col-6" : "col-12";
+ }
+
+ [Inject]
+ protected DataLayerServices DLService { get; set; } = null!;
+
+ #endregion Protected Properties
+
+ #region Protected Methods
+
+ protected string CheckSelect(OfferModel curRec)
+ {
+ string answ = "";
+ if (SelRecord != null)
+ {
+ answ = curRec.OfferID == SelRecord.OfferID ? "table-info" : "";
+ }
+ return answ;
+ }
+
+ protected void DoAdd()
+ {
+ EditRecord = new OfferModel()
+ {
+ RefYear = DateTime.Today.Year,
+ Description = $"Nuova Offerta {DateTime.Today:ddd yyyy.MM.dd}",
+ ValidUntil = DateTime.Today.AddMonths(1)
+ };
+ }
+
+ protected void DoEdit(OfferModel curRec)
+ {
+ currStep = CompileStep.Header;
+ EditRecord = curRec;
+ }
+
+ protected void DoReset()
+ {
+ EditRecord = null;
+ SelRecord = null;
+ }
+
+ protected void DoSelect(OfferModel curRec)
+ {
+ SelRecord = curRec;
+ }
+
+ protected override async Task OnInitializedAsync()
+ {
+ SetupArrows();
+ await ReloadData();
+ UpdateTable();
+ }
+
+ #endregion Protected Methods
+
+ #region Private Fields
+
+ private List AllRecords = new List();
+
+ private int currPage = 1;
+
+ private CompileStep currStep = CompileStep.Draft;
+
+ private OfferModel? EditRecord = null;
+
+ private bool isLoading = false;
+
+ private List ListRecords = new List();
+
+ private int numRecord = 10;
+
+ private OfferModel? SelRecord = null;
+
+ private int totalCount = 0;
+
+ private string txtStyle = "font-size: 1.2em; font-weight:bold; fill: white;";
+
+ #endregion Private Fields
+
+ #region Private Properties
+
+ private List listBord01 { get; set; } = new();
+
+ #endregion Private Properties
+
+ #region Private Methods
+
+ private void AdvStep(CompileStep newStep)
+ {
+ currStep = newStep;
+ }
+
+ private string ArrowBackCol(CompileStep arrowStep)
+ {
+ string answ = $"fill: #000000;";
+ if (arrowStep == currStep)
+ {
+ answ = $"fill: #123456;";
+ }
+ else if (arrowStep < currStep)
+ {
+ answ = $"fill: #456789;";
+ }
+ else
+ {
+ answ = $"fill: #89ABCD;";
+ }
+ return answ;
+ }
+
+ private void DoClose()
+ {
+ EditRecord = null;
+ }
+
+ ///
+ /// Salva record ed avanza compilazione
+ ///
+ ///
+ ///
+ private async Task DoSave(OfferModel updRec)
+ {
+ // salvo record
+ await DLService.OffertUpsert(updRec);
+ // cambio step
+ CompileStep nextStep = currStep < CompileStep.FinalCheck ? currStep + 1 : currStep;
+ AdvStep(nextStep);
+ }
+
+ ///
+ /// Rilegge tabella
+ ///
+ private async Task ForceReload()
+ {
+ isLoading = true;
+ await Task.Delay(50);
+ await ReloadData();
+ await Task.Delay(50);
+ UpdateTable();
+ await Task.Delay(50);
+ isLoading = false;
+ await Task.Delay(50);
+ }
+
+ ///
+ /// Legge i dati dei record completi
+ ///
+ private async Task ReloadData()
+ {
+ AllRecords = await DLService.OfferGetAll();
+ totalCount = AllRecords.Count();
+ }
+
+ private void SetupArrows()
+ {
+ listBord01 = new();
+ listBord01.Add("");
+ listBord01.Add("White");
+ listBord01.Add("");
+ listBord01.Add("");
+ }
+
+ ///
+ /// Filtro e paginazione
+ ///
+ private void UpdateTable()
+ {
+ // fix paginazione
+ ListRecords = AllRecords
+ .Skip(numRecord * (currPage - 1))
+ .Take(numRecord)
+ .ToList();
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj
index e17ff5a7..00007500 100644
--- a/Lux.UI/Lux.UI.csproj
+++ b/Lux.UI/Lux.UI.csproj
@@ -5,7 +5,7 @@
enable
enable
aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50
- 0.9.2511.1312
+ 0.9.2511.1416
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 304139ed..ff9714a7 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
LUX - Web Windows MES
- Versione: 0.9.2511.1312
+ Versione: 0.9.2511.1416
Note di rilascio:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 0ed33c1f..525c8a4c 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-0.9.2511.1312
+0.9.2511.1416
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 1f930d21..c72fa723 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 0.9.2511.1312
+ 0.9.2511.1416
http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip
http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html
false
|