|
|
|
@ -1,15 +1,8 @@
|
|
|
|
|
@using System.Globalization;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@if (loaded)
|
|
|
|
|
{
|
|
|
|
|
<div id="picker">
|
|
|
|
|
|
|
|
|
|
<!-- DatePicker input !can be edited manualy -->
|
|
|
|
|
@* <div class="inline-block"><input type="text" value="@SelectedDate.ToString(Format)" /><i class='bx bx-calendar' @onclick="(() => Shown = !Shown)"></i></div> *@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<input type="text" value="@SelectedDate.ToString(Format)" required="required" /><span class="highlight"></span><span class="bar"></span>
|
|
|
|
|
<label class="label-animated">Select date</label>
|
|
|
|
@ -17,7 +10,7 @@
|
|
|
|
|
<div class="input-error-text">At least 6 characters required</div>
|
|
|
|
|
<span class="input-glyph-wraper">
|
|
|
|
|
<span class="input-glyph">
|
|
|
|
|
<span class="input-glyph button" @onclick="(() => Shown = !Shown)">
|
|
|
|
|
<span class="input-glyph button" @onclick="TogglePicker">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.CalendarMonth" class="icon-root svg-icon" />
|
|
|
|
|
</span>
|
|
|
|
|
<span class="input-glyph error">
|
|
|
|
@ -29,149 +22,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@if (Shown)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
<!-- DatePicker header -->
|
|
|
|
|
<div class="picker-container">
|
|
|
|
|
<div id="picker-header">
|
|
|
|
|
@* <div class="text-medium">
|
|
|
|
|
@SelectedDate.Year.ToString()
|
|
|
|
|
</div> *@
|
|
|
|
|
<div class="picker-header-label">Select date</div>
|
|
|
|
|
<div class="picker-header-title">
|
|
|
|
|
@SelectedDate.ToString("ddd, " + Format)
|
|
|
|
|
<div id="picker-header">
|
|
|
|
|
|
|
|
|
|
<div class="picker-header-label">Select date</div>
|
|
|
|
|
<div class="picker-header-title">
|
|
|
|
|
@SelectedDate.ToString("ddd, " + Format)
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-divider"></div>
|
|
|
|
|
<!-- DatePicker body -->
|
|
|
|
|
<div id="picker-body">
|
|
|
|
|
@switch (Selecting)
|
|
|
|
|
{
|
|
|
|
|
case Selecting.Years:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
<div class="picker-menu">
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowLeft" class="icon-root svg-icon icon-size-md" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class="text-semibold" @onclick=@(()=>Selecting = Selecting.Months)>@SelectedDate.ToString("yyyy")</div>
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowRight" class="icon-root svg-icon icon-size-md" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-grid-col-3 gap-3">
|
|
|
|
|
@for (int i = SelectedDate.Year - 7; i < SelectedDate.Year + 8; i++)
|
|
|
|
|
{
|
|
|
|
|
int y = i;
|
|
|
|
|
@* <a href="#" @onclick="@(()=>SetYear(y))">
|
|
|
|
|
<div class="chip-group-content d-inline-flex bg-core py-1 m-1 b-1 b-r-3 text-dark" style="width:30%;">
|
|
|
|
|
<div class="chip-leading-icon"></div>
|
|
|
|
|
<div class="chip-label">@i.ToString()</div>
|
|
|
|
|
<div class="chip-cta-icon"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-divider"></div>
|
|
|
|
|
<!-- DatePicker body -->
|
|
|
|
|
<div id="picker-body">
|
|
|
|
|
@switch (Selecting)
|
|
|
|
|
{
|
|
|
|
|
case Selecting.Years:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
if (SelectedDate.Year - i % 3 == 0)
|
|
|
|
|
<div class="picker-menu">
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowLeft" class="icon-root svg-icon icon-size-md" Click="(()=>NavBarClick(false))" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class="text-semibold" @onclick=@(()=>Selecting = Selecting.Months)>@SelectedDate.ToString("yyyy")</div>
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowRight" class="icon-root svg-icon icon-size-md" Click="(()=>NavBarClick())" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-grid-col-3 gap-3">
|
|
|
|
|
@for (int i = SelectedDate.Year - 7; i < SelectedDate.Year + 8; i++)
|
|
|
|
|
{
|
|
|
|
|
<br />
|
|
|
|
|
} *@
|
|
|
|
|
<button @onclick="@(()=>SetYear(y))" type="button" class="item">@i.ToString()</button>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Selecting.Months:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="picker-menu">
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowLeft" class="icon-root svg-icon icon-size-md" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class="text-semibold" @onclick=@(()=>Selecting = Selecting.Years)>@SelectedDate.ToString("MMMM yyyy")</div>
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowRight" class="icon-root svg-icon icon-size-md" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-grid-col-3 gap-3">
|
|
|
|
|
@for (int i = 1; i <= @DateTimeFormatInfo.CurrentInfo.MonthNames.Length - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
int m = i;
|
|
|
|
|
@* <a href="#" @onclick="@(()=>SetMonth(m))">
|
|
|
|
|
|
|
|
|
|
<div class="chip-group-content d-inline-flex bg-core @MonthChipClass(m) py-1 m-1 b-1 b-r-3 text-dark" style="width:30%;">
|
|
|
|
|
<div class="chip-leading-icon"></div>
|
|
|
|
|
<div class="chip-label">@DateTimeFormatInfo.CurrentInfo.GetMonthName(i).Substring(0,3)</div>
|
|
|
|
|
<div class="chip-cta-icon"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i % 3 == 0)
|
|
|
|
|
int y = i;
|
|
|
|
|
<button @onclick="@(()=>SetYear(y))" type="button" class="item @YearChipClass(y)">@i.ToString()</button>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Selecting.Months:
|
|
|
|
|
{
|
|
|
|
|
<div class="picker-menu">
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowLeft" class="icon-root svg-icon icon-size-md" Click="(()=>NavBarClick(false))" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class="text-semibold" @onclick=@(()=>Selecting = Selecting.Years)>@SelectedDate.ToString("MMMM yyyy")</div>
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowRight" class="icon-root svg-icon icon-size-md" Click="(()=>NavBarClick())" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-grid-col-3 gap-3">
|
|
|
|
|
@for (int i = 1; i <= @DateTimeFormatInfo.CurrentInfo.MonthNames.Length - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
<br />
|
|
|
|
|
} *@
|
|
|
|
|
<button @onclick="@(()=>SetMonth(m))" type="button" class="item">@DateTimeFormatInfo.CurrentInfo.GetMonthName(i).Substring(0,3)</button>
|
|
|
|
|
int m = i;
|
|
|
|
|
<button @onclick="@(()=>SetMonth(m))" type="button" class="item @MonthChipClass(i)">@DateTimeFormatInfo.CurrentInfo.GetMonthName(i).Substring(0,3)</button>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case (Selecting.Days):
|
|
|
|
|
{
|
|
|
|
|
<div class="picker-menu">
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowLeft" class="icon-root svg-icon icon-size-md" Click="(()=>NavBarClick(false))" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class="text-semibold" @onclick=@(()=>Selecting = Selecting.Months)>@SelectedDate.ToString("MMMM yyyy")</div>
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowRight" class="icon-root svg-icon icon-size-md" Click="(()=>NavBarClick())" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-grid-col-7 gap-3">
|
|
|
|
|
@for (int i = 0; i < 7; i++)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case (Selecting.Days):
|
|
|
|
|
{
|
|
|
|
|
<div class="picker-menu">
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowLeft" class="icon-root svg-icon icon-size-md" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class="text-semibold" @onclick=@(()=>Selecting = Selecting.Months)>@SelectedDate.ToString("MMMM yyyy")</div>
|
|
|
|
|
<button class="btn btn-icon-alt ">
|
|
|
|
|
<Glyph SVG="@Icons.Material.Filled.KeyboardArrowRight" class="icon-root svg-icon icon-size-md" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="picker-grid-col-7 gap-3">
|
|
|
|
|
@for (int i = 0; i < 7; i++)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
@* <div class="@DayNamesRowClass">@CalendarStart.AddDays(i).ToString("ddd").Substring(0,1)</div> *@
|
|
|
|
|
<div class="days">@CalendarStart.AddDays(i).ToString("ddd").Substring(0,1)</div>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@foreach (var Date in ShowingDates)
|
|
|
|
|
{
|
|
|
|
|
<button class="item @DateChipStyle(Date)" @onclick="@(()=>SetDate(Date))">
|
|
|
|
|
@* <div class="chip-leading-icon d-inline-block p-1 m-1 @DateChipStyle(Date)" style="width:30px; height:30px; text-align:center">
|
|
|
|
|
@Date.Day.ToString()
|
|
|
|
|
</div> *@
|
|
|
|
|
{
|
|
|
|
|
<div class="days">@CalendarStart.AddDays(i).ToString("ddd").Substring(0,1)</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Date.Day.ToString()
|
|
|
|
|
|
|
|
|
|
</button>
|
|
|
|
|
@if (CalendarStart.DayOfWeek.Equals(DayOfWeek.Sunday))
|
|
|
|
|
@foreach (var Date in ShowingDates)
|
|
|
|
|
{
|
|
|
|
|
@* <br /> *@
|
|
|
|
|
<button class="item @DateChipClass(Date)" @onclick="@(()=>SetDate(Date))">
|
|
|
|
|
@Date.Day.ToString()
|
|
|
|
|
</button>
|
|
|
|
|
CalendarStart = CalendarStart.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
CalendarStart = CalendarStart.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<!-- Bottom bar -->
|
|
|
|
|
<div class="btn-content justify-flex-end my-0">
|
|
|
|
|
<button type="button" class="btn btn-sm btn-secondary">Cancel</button>
|
|
|
|
|
<button type="button" class="btn btn-sm btn-core">OK</button>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<!-- Bottom bar -->
|
|
|
|
|
<div class="btn-content justify-flex-end my-0">
|
|
|
|
|
<button type="button" class="btn btn-sm btn-secondary" @onclick="(()=>ClosePicker())">Cancel</button>
|
|
|
|
|
<button type="button" class="btn btn-sm btn-core" @onclick="(()=>ClosePicker(false))">OK</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|