diff --git a/GPW.CORE.Comp/CalendarMonth.razor b/GPW.CORE.Comp/CalendarMonth.razor
index f9d8287..e0fb1df 100644
--- a/GPW.CORE.Comp/CalendarMonth.razor
+++ b/GPW.CORE.Comp/CalendarMonth.razor
@@ -1,12 +1,30 @@
-
-
+@if (WeekRow == null || WeekRow.Count == 0)
+{
+
+}
+else
+{
+
+
+
+ @for (int i = 0; i < 7; i++)
+ {
+ | @($"{DateList[i]:ddd}".Substring(0, 1).ToUpper()) |
+ }
+
+
+
+ @foreach (var settim in WeekRow)
+ {
+
+ @foreach (var giorno in settim)
+ {
+ | @($"{giorno:dd}") |
+ }
+
+ }
+
+
+}
diff --git a/GPW.CORE.Comp/CalendarMonth.razor.cs b/GPW.CORE.Comp/CalendarMonth.razor.cs
index c6ab347..26778ed 100644
--- a/GPW.CORE.Comp/CalendarMonth.razor.cs
+++ b/GPW.CORE.Comp/CalendarMonth.razor.cs
@@ -1,40 +1,150 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Web;
namespace GPW.CORE.Comp
{
public partial class CalendarMonth
{
+ #region Public Properties
+
///
- /// Css sfondo principale
- /// default: bg-dark
+ /// Css giorno mese corrente
+ /// default: text-danger
///
[Parameter]
- public string MainCss { get; set; } = "bg-dark";
+ public string CurrMonthCss { get; set; } = "text-light";
+
+ ///
+ /// Day di riferimento (tipicamente = oggi) per disegnare calendario alla data corrente
+ ///
[Parameter]
- public DateOnly DtStart { get; set; } = DateOnly.FromDateTime(DateTime.Today);
+ public DateTime DtRif { get; set; } = DateTime.Today;
+
+ ///
+ /// Css titolo
+ /// default: text-danger
+ ///
[Parameter]
- public DateOnly DtEnd { get; set; } = DateOnly.FromDateTime(DateTime.Today.AddMonths(1));
- private async Task CalcDate()
+ public string HeadCss { get; set; } = "text-danger";
+
+ ///
+ /// Css sfondo principale
+ /// default: table table-dark table-borderless table-striped
+ ///
+ [Parameter]
+ public string MainCss { get; set; } = "table table-dark table-borderless table-striped";
+
+ ///
+ /// Css giorno tipico
+ /// default: text-danger
+ ///
+ [Parameter]
+ public string OtherMonthCss { get; set; } = "text-secondary";
+
+ #endregion Public Properties
+
+ #region Protected Methods
+
+ protected override async Task OnParametersSetAsync()
{
- await Task.Delay(1);
- DateTime oggi = DateTime.Today;
- DtStart = new DateOnly(oggi.Year, oggi.Month, 1);
- DtEnd = DtStart.AddMonths(1).AddDays(-1);
- // calcolo elenco date (da disegnare)
+ await FixDate();
}
+ #endregion Protected Methods
+
+ #region Private Properties
+
///
/// Elenco date da mostrare
///
private List DateList { get; set; } = new List();
+
+ private DateTime MonthEnd { get; set; } = DateTime.Today.AddMonths(1);
+
+ private DateTime MonthStart { get; set; } = DateTime.Today;
+
///
/// Righe da disegnare nel calendario
///
- private List> RigheCalendario { get; set; } = new List>();
+ private List> WeekRow { get; set; } = new List>();
+
+ #endregion Private Properties
+
+ #region Private Methods
+
+ private string dayCss(DateTime currDay)
+ {
+ string answ = CurrMonthCss;
+ // se è fuori estremi mese --> grigio...
+ if (currDay < MonthStart || currDay > MonthEnd)
+ {
+ answ = OtherMonthCss;
+ }
+ return answ;
+ }
+
+ ///
+ /// Sistemazione date x disegnare controlli
+ ///
+ ///
+ private async Task FixDate()
+ {
+ await Task.Delay(1);
+ // disegno sempre 6 righe = 42 gg
+ int numDD = 42;
+ MonthStart = new DateTime(DtRif.Year, DtRif.Month, 1);
+ MonthEnd = MonthStart.AddMonths(1).AddDays(-1);
+ DateTime calStart = MonthStart;
+ // calcolo date calendario in base al giorno dell'inizio mese...
+ switch (MonthStart.DayOfWeek)
+ {
+ case DayOfWeek.Sunday:
+ calStart = MonthStart.AddDays(-6);
+ break;
+
+ case DayOfWeek.Monday:
+ calStart = MonthStart.AddDays(-7);
+ break;
+
+ case DayOfWeek.Tuesday:
+ calStart = MonthStart.AddDays(-1);
+ break;
+
+ case DayOfWeek.Wednesday:
+ calStart = MonthStart.AddDays(-2);
+ break;
+
+ case DayOfWeek.Thursday:
+ calStart = MonthStart.AddDays(-3);
+ break;
+
+ case DayOfWeek.Friday:
+ calStart = MonthStart.AddDays(-4);
+ break;
+
+ case DayOfWeek.Saturday:
+ calStart = MonthStart.AddDays(-5);
+ break;
+
+ default:
+ break;
+ }
+ // calcolo fine mese sapendo che sono cmq 7 x 6 week...
+ int numEnd = numDD - MonthEnd.Subtract(calStart).Days;
+ DateTime calEnd = MonthEnd.AddDays(numEnd);
+ // calcolo elenco date (da disegnare)
+ DateList = new List();
+ for (int i = 0; i < numDD; i++)
+ {
+ DateList.Add(calStart.AddDays(i));
+ }
+ // ora sistemo le righe da disegnare...
+ WeekRow = new List>();
+ for (int i = 0; i < 6; i++)
+ {
+ WeekRow.Add(DateList.GetRange(i * 7, 7));
+ }
+ }
+
+ #endregion Private Methods
}
}
\ No newline at end of file
diff --git a/GPW.CORE.Comp/LoadingData.razor b/GPW.CORE.Comp/LoadingData.razor
new file mode 100644
index 0000000..354d765
--- /dev/null
+++ b/GPW.CORE.Comp/LoadingData.razor
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/GPW.CORE.Comp/LoadingDataSmall.razor b/GPW.CORE.Comp/LoadingDataSmall.razor
new file mode 100644
index 0000000..8362fbb
--- /dev/null
+++ b/GPW.CORE.Comp/LoadingDataSmall.razor
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/GPW.CORE.Test/Pages/TestCal.razor b/GPW.CORE.Test/Pages/TestCal.razor
new file mode 100644
index 0000000..c82b44e
--- /dev/null
+++ b/GPW.CORE.Test/Pages/TestCal.razor
@@ -0,0 +1,13 @@
+@page "/TestCal"
+
+
+TestCal
+
+
+
+
+
+
+@code {
+
+}
diff --git a/GPW.CORE.Test/Shared/NavMenu.razor b/GPW.CORE.Test/Shared/NavMenu.razor
index 6ac7f07..8d07f42 100644
--- a/GPW.CORE.Test/Shared/NavMenu.razor
+++ b/GPW.CORE.Test/Shared/NavMenu.razor
@@ -14,6 +14,11 @@
Home
+
+
+ Test Calendario
+
+
Counter