mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
auto colapse past months
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
@using Management.Web.Shared.Components
|
|
||||||
@namespace Management.Web.Shared.Components
|
@namespace Management.Web.Shared.Components
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
public string MonthName { get => Month?.DaysByWeek.First().FirstOrDefault(d => d != null)?.ToString("MMMM") ?? ""; }
|
public string MonthName { get => Month?.DaysByWeek.First().FirstOrDefault(d => d != null)?.ToString("MMMM") ?? ""; }
|
||||||
private string htmlLabel => "collapse"+MonthName;
|
private string htmlLabel => "collapse"+MonthName;
|
||||||
|
private bool isInPast =>
|
||||||
|
new DateTime(Month.Year, Month.Month, 1) < new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
||||||
|
private string collapseClass => " collapse " + (isInPast ? "hide" : "show");
|
||||||
}
|
}
|
||||||
|
|
||||||
<h3 class="text-center">
|
<h3 class="text-center">
|
||||||
@@ -19,14 +22,14 @@
|
|||||||
role="button"
|
role="button"
|
||||||
data-bs-toggle="collapse"
|
data-bs-toggle="collapse"
|
||||||
data-bs-target="@("#" + htmlLabel)"
|
data-bs-target="@("#" + htmlLabel)"
|
||||||
aria-expanded="true"
|
aria-expanded="@( isInPast ? "false" : "true")"
|
||||||
aria-controls="@htmlLabel"
|
aria-controls="@htmlLabel"
|
||||||
>
|
>
|
||||||
@MonthName
|
@MonthName
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="collapse show" id="@htmlLabel">
|
<div class="@collapseClass" id="@htmlLabel">
|
||||||
<div class="row text-center fw-bold">
|
<div class="row text-center fw-bold">
|
||||||
@foreach (DayOfWeek day in WeekDaysList)
|
@foreach (DayOfWeek day in WeekDaysList)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user