From 9abf818c0b3b4b68aac361a19ead729eda9c89a8 Mon Sep 17 00:00:00 2001 From: Alex Mickelson Date: Wed, 13 Sep 2023 11:21:21 -0600 Subject: [PATCH] auto colapse past months --- Management.Web/Shared/Components/ConfirmationModal.razor | 1 - Management.Web/Shared/Semester/MonthDetail.razor | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Management.Web/Shared/Components/ConfirmationModal.razor b/Management.Web/Shared/Components/ConfirmationModal.razor index 7d67a92..dc2c07f 100644 --- a/Management.Web/Shared/Components/ConfirmationModal.razor +++ b/Management.Web/Shared/Components/ConfirmationModal.razor @@ -1,4 +1,3 @@ -@using Management.Web.Shared.Components @namespace Management.Web.Shared.Components @code { diff --git a/Management.Web/Shared/Semester/MonthDetail.razor b/Management.Web/Shared/Semester/MonthDetail.razor index 9679073..8389c99 100644 --- a/Management.Web/Shared/Semester/MonthDetail.razor +++ b/Management.Web/Shared/Semester/MonthDetail.razor @@ -12,6 +12,9 @@ public string MonthName { get => Month?.DaysByWeek.First().FirstOrDefault(d => d != null)?.ToString("MMMM") ?? ""; } 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"); }

@@ -19,14 +22,14 @@ role="button" data-bs-toggle="collapse" data-bs-target="@("#" + htmlLabel)" - aria-expanded="true" + aria-expanded="@( isInPast ? "false" : "true")" aria-controls="@htmlLabel" > @MonthName

-
+
@foreach (DayOfWeek day in WeekDaysList) {