+@using TecniStamp.Model.Common
+
-
+
-
+
- @Text
+ @Model.Text
@code {
- [Parameter] public string Url { get; set; }
- [Parameter] public bool Blank { get; set; } = false;
- [Parameter] public string Icon { get; set; }
- [Parameter] public string Text { get; set; }
+ [Parameter] public TileViewModel Model { get; set; } = new();
}
\ No newline at end of file
diff --git a/TecniStamp/TecniStamp/Model/Common/BreadcrumbViewModel.cs b/TecniStamp/TecniStamp/Model/Common/BreadcrumbViewModel.cs
new file mode 100644
index 0000000..34c84e6
--- /dev/null
+++ b/TecniStamp/TecniStamp/Model/Common/BreadcrumbViewModel.cs
@@ -0,0 +1,8 @@
+namespace TecniStamp.Model.Common;
+
+public class BreadcrumbViewModel
+{
+ public string Text { get; set; }
+ public string? Url { get; set; }
+ public bool IsActive { get; set; }
+}
\ No newline at end of file
diff --git a/TecniStamp/TecniStamp/Model/Common/TileViewModel.cs b/TecniStamp/TecniStamp/Model/Common/TileViewModel.cs
new file mode 100644
index 0000000..14ea06b
--- /dev/null
+++ b/TecniStamp/TecniStamp/Model/Common/TileViewModel.cs
@@ -0,0 +1,27 @@
+using TecniStamp.Domain;
+
+namespace TecniStamp.Model.Common;
+
+public class TileViewModel
+{
+ public Guid Id { get; set; }
+ public string Url { get; set; }
+ public bool Blank { get; set; } = false;
+ public string Icon { get; set; }
+ public string Text { get; set; }
+ public int Ordinamento { get; set; }
+
+ public TileViewModel()
+ {
+
+ }
+
+ public TileViewModel(Sezione model)
+ {
+ Id = model.Id;
+ Url = model.Url;
+ Blank = model.Blank;
+ Icon = model.Icona;
+ Text = model.Nome;
+ }
+}
\ No newline at end of file
diff --git a/TecniStamp/TecniStamp/Utils/BreadcrumbUtils.cs b/TecniStamp/TecniStamp/Utils/BreadcrumbUtils.cs
new file mode 100644
index 0000000..64e5a79
--- /dev/null
+++ b/TecniStamp/TecniStamp/Utils/BreadcrumbUtils.cs
@@ -0,0 +1,45 @@
+using TecniStamp.Domain;
+using TecniStamp.Model.Common;
+
+namespace TecniStamp.Utils;
+
+public static class BreadcrumbUtils
+{
+ public static List
BuildBreadcrumb(Sezione sezione)
+ {
+ var stack = new Stack();
+ var current = sezione;
+
+ while (current != null)
+ {
+ stack.Push(current);
+ current = current.Parent;
+ }
+
+ var breadcrumb = new List
+ {
+ new()
+ {
+ Text = "Home",
+ Url = "/",
+ IsActive = false
+ }
+ };
+
+ while (stack.Any())
+ {
+ var s = stack.Pop();
+ breadcrumb.Add(new BreadcrumbViewModel
+ {
+ Text = s.Nome,
+ Url = s.Url,
+ IsActive = false
+ });
+ }
+
+ breadcrumb.Last().IsActive = true;
+ breadcrumb.Last().Url = null;
+
+ return breadcrumb;
+ }
+}
\ No newline at end of file