diff --git a/ShopAdmin/Components/ConsoleDatePicker.razor b/ShopAdmin/Components/ConsoleDatePicker.razor new file mode 100644 index 0000000..bfba461 --- /dev/null +++ b/ShopAdmin/Components/ConsoleDatePicker.razor @@ -0,0 +1,100 @@ +
+ @Value.ToString("yyyy / MM / dd") + +
+ +@if (isCalendarOpen) +{ +
+
+ + @currentMonthDisplay.ToString("MMMM yyyy") + +
+ +
+
Su
Mo
Tu
We
Th
Fr
Sa
+
+ +
+ @foreach (var day in paddingDays) + { +
+ } + @foreach (var day in currentMonthDays) + { + var loopDay = day; + + } +
+
+} + +@code { + [Parameter] + public DateTime Value { get; set; } = DateTime.Today; + + [Parameter] + public EventCallback ValueChanged { get; set; } + + private bool isCalendarOpen = false; + private DateTime currentMonthDisplay; + private List paddingDays = new(); + private List currentMonthDays = new(); + + protected override void OnParametersSet() + { + if (currentMonthDisplay == DateTime.MinValue) + { + currentMonthDisplay = new DateTime(Value.Year, Value.Month, 1); + GenerateCalendarMatrix(); + } + } + + private void ToggleCalendar() => isCalendarOpen = !isCalendarOpen; + + private async Task SelectDate(DateTime date) + { + Value = date; + isCalendarOpen = false; + await ValueChanged.InvokeAsync(Value); + } + + private void NavigateMonthPrevious() + { + currentMonthDisplay = currentMonthDisplay.AddMonths(-1); + GenerateCalendarMatrix(); + } + + private void NavigateMonthNext() + { + currentMonthDisplay = currentMonthDisplay.AddMonths(1); + GenerateCalendarMatrix(); + } + + private void GenerateCalendarMatrix() + { + currentMonthDays.Clear(); + paddingDays.Clear(); + + int daysInMonth = DateTime.DaysInMonth(currentMonthDisplay.Year, currentMonthDisplay.Month); + DayOfWeek firstDayOfWeek = currentMonthDisplay.DayOfWeek; + + for (int i = 0; i < (int)firstDayOfWeek; i++) + { + paddingDays.Add(DateTime.MinValue); + } + + for (int day = 1; day <= daysInMonth; day++) + { + currentMonthDays.Add(new DateTime(currentMonthDisplay.Year, currentMonthDisplay.Month, day)); + } + } + + private bool IsToday(DateTime date) => date.Date == DateTime.Today; + private bool IsSelected(DateTime date) => date.Date == Value.Date; +} \ No newline at end of file diff --git a/ShopAdmin/Components/ConsoleDatePicker.razor.css b/ShopAdmin/Components/ConsoleDatePicker.razor.css new file mode 100644 index 0000000..676eed8 --- /dev/null +++ b/ShopAdmin/Components/ConsoleDatePicker.razor.css @@ -0,0 +1,124 @@ +/* Custom Date Trigger and Box Engines only */ +.custom-date-trigger-box { + width: 100%; + box-sizing: border-box; + background: #060b13 !important; + border: 1px solid #1e293b !important; + border-radius: 4px; + padding: 0.85rem 1rem; + color: #f8fafc !important; + font-size: 0.9rem; + outline: none; + transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); + display: flex; + justify-content: space-between; + align-items: center; + cursor: pointer; +} + + .custom-date-trigger-box.focused { + border-color: #00f2fe !important; + box-shadow: 0 0 0 1px rgba(0, 242, 254, 0.2), 0 0 12px rgba(0, 242, 254, 0.1) !important; + background: #02060d !important; + } + +.calendar-icon { + color: #64748b; + flex-shrink: 0; +} + +/* Floating Overlay Window Panel Layout */ +.brand-calendar-popup { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + width: 100% !important; + box-sizing: border-box; + padding: 1rem; + background-color: #0b0f19; + border: 1px solid #1e293b; + border-radius: 6px; + box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5); + margin-top: 0.5rem; +} + +.calendar-nav-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 0.75rem; +} + +.calendar-current-month { + font-size: 0.85rem; + font-weight: 600; + color: #f1f5f9; + font-family: monospace; +} + +.btn-cal-nav { + background: transparent; + border: none; + color: #94a3b8; + font-size: 0.9rem; + cursor: pointer; + padding: 0.2rem 0.5rem; + border-radius: 4px; + transition: background-color 0.1s; +} + + .btn-cal-nav:hover { + background-color: #1e293b; + color: #f8fafc; + } + +.calendar-days-grid-header { + display: grid; + grid-template-columns: repeat(7, 1fr); + text-align: center; + font-size: 0.7rem; + font-weight: 700; + color: #475569; + text-transform: uppercase; + margin-bottom: 0.5rem; +} + +.calendar-days-matrix { + display: grid; + grid-template-columns: repeat(7, 1fr); + gap: 2px; +} + +.calendar-day-blank { + padding: 0.4rem 0; +} + +.calendar-day-btn { + background: transparent; + border: none; + color: #cbd5e1; + font-size: 0.8rem; + padding: 0.4rem 0; + text-align: center; + cursor: pointer; + border-radius: 4px; + font-family: monospace; + transition: all 0.1s ease; +} + + .calendar-day-btn:hover { + background-color: #1e293b; + color: #ffffff; + } + + .calendar-day-btn.is-today { + color: #00f2fe; + font-weight: 700; + } + + .calendar-day-btn.is-selected { + background-color: #0284c7 !important; + color: #ffffff !important; + font-weight: 700; + } diff --git a/ShopAdmin/Components/CreateProduct.razor b/ShopAdmin/Components/CreateProduct.razor index a29a771..227a2f9 100644 --- a/ShopAdmin/Components/CreateProduct.razor +++ b/ShopAdmin/Components/CreateProduct.razor @@ -42,10 +42,37 @@ +
+
+ + + +
+ +
+ + + +
+
+ +
+
+ + + +
+ +
+ + +
+
+
- - - + + +
@@ -69,7 +96,6 @@ @if (string.IsNullOrEmpty(ProductModel.ImageUrl)) { - /* Clicking anywhere inside this label launches the file system picker */