Skip to content

Commit

Permalink
Fixed the layout and navigation of the ManagerView (#79)
Browse files Browse the repository at this point in the history
* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* Added Azure DevOps status badge

* Fixed Data acquisition #55 (#74)

* Feature schedule ui (#64)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Fix variable height with DayPicker component by adding an extra row to CSS Grid

* Now passing schedule information around:

* Now passing schedule state between components

* Completed initial UI for scheduleitems

* Now saving recurring schedules

* Started work on the RecurrenceDataEntry component

* Now doing initial calculations of CRON pattern

* Highlight the date clicked in the DayPicker component

* DayView appointments are positioned correctly and DayView appointments outside the time range are not displayed. Also, Add graphical representation for a schedule item that begins before or after the DayView.

* Refactoring DayView so that we can make a ManagerScheduleView

* Fixed schedule item display on the DayView

* Fixed some display issues, corrected expansion of the schedule

* Fixed small bug in top and bottom styles of items in DayView

* Updated DayView to properly show the week grid for Managers

* Fixed overflow issue with items in DayView

* Started work on calculating employee availability

* Now calculating availability

* Finished Resource Availability test

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* Issue #35 - Add support for fluent assertions (#39)

* Added FluentAssertions V5.7.0 NuGet package dependency

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Updated WhenExpandingScheduleAcrossMultipleDays tests to use FluentAssertions

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Issue #33 date time extensions, issue #30 (#38)

* Date time extensions issue #33

* xml comments + renames issue #33

* xml comment i missed issue #33

* removing extension methods for comparing Date with Time issue #33

* added authorization for pages where users must be logged in issue #30

* Completed grain calculations for ManagerView

* Updated to 3.0 preview 7

* Completed conversion to Preview 7 and now using sqlite

* Migrating to Client-side Blazor

* Migrating the components to the Client project

* Finishing merge

* Finished migrating components

* #56: Refactored code out of Availability page into AvailabilityViewModel

* #56 Pulled DayView attribute code out into ViewModel

* #56: Refactored code out of DayPicker into DayPickerViewModel

* #56: Pulled DisplayDayOfMonth rendering logic out into ViewModel

* #56 Added missing DI for DayPickerViewModel

* #56: Refactored code out of DayView into DayViewViewModel

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 Standardised naming for Base component overrides on view models

* #56 Resolved error in Blazor markup - CS1660 C# Cannot convert lambda expression to type 'object' because it is not a delegate type

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 - Refactored code out of NavMenu into NavMenuViewModel

* #56 Refactored ViewModel DI into IServiceCollection Extension method.

* WIP

* Marking the TODO unit test as debug only

* Added BlazorStrap and CSS for header and navbar

* Fixed component references so they now render

* Finished security connection

* Enhanced the formatting of the navbar and login components

* WIP - Fetching timeslot data from the server

* Started work on Timeslot data loading into the availability compo… (#66)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Added restoreDb command

* Refactored navbar and removed BlazorStrap (#67)

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* CSS updates and data entry fixes (#68)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* Feature: Adding Directory.Build.props (#70)

* Refactor: Restyle Availability Page & Accessibility Improvements (#71)

* refactor: re-styles the availability layout.

* fix: adds main tag to layout

* fix: fixes some a11y issues on availability page.

* refactor: fixes vertical alignment on availability

* Fixed data acquisition #55

* Revert "Fixed Data acquisition #55" (#75)

This reverts commit 337b80a.

* Updated to Preview 8

Fixed navigation and interactions with the ManagerView
  • Loading branch information
csharpfritz authored Aug 16, 2019
1 parent c3f6d3a commit 6e06c92
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 50 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

A resource management application originally designed for [Sebastian Riding Associates](http://sebastianriding.org/ "Sebastian Riding Associates")

[![Build Status](https://dev.azure.com/FritzAndFriends/Fritz.ResourceManagement/_apis/build/status/Fritz.ResourceManagement-ASP.NET%20Core-CI?branchName=master)](https://dev.azure.com/FritzAndFriends/Fritz.ResourceManagement/_build/latest?definitionId=11&branchName=master)

## Definitions

Expand Down
2 changes: 1 addition & 1 deletion src/Build/props/Project.BuildProperties.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AspNetCoreVersion>3.0.0-preview7.19365.7</AspNetCoreVersion>
<AspNetCoreVersion>3.0.0-preview8.19405.7</AspNetCoreVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview7.19362.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview7.19362.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview7.19362.6">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview8.19405.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0-preview7.19362.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview6-19319-03" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0-preview8.19405.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview8-19413-06" />
<!--<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.0-ci.20190725.6" />-->
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="$(AspNetCoreVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview8.19405.7" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
[CascadingParameter] Task<AuthenticationState> Context { get; set; }

// Cheer 500 electrichavoc 07/06/19
protected override async Task OnInitAsync()
protected override async Task OnInitializedAsync()
{
var state = await Context;
await Model.OnInitAsync(state.User);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
@page "/manager"
@page "/manager/{requesteddate}"
@inject ViewModels.ManagerScheduleViewViewModel Model
@using System.Globalization

<h3>Schedule View</h3>
<h1 class="h3">Schedule View</h1>

<div id="weekSelector">
@{
// TODO: Simon G - Do we really need the onclick="() => Model.ChangeDate(-7)" syntax ? Would this not work as onclick="Model.ChangeDate(-7)"?
@{
// TODO: Change the buttons to A tags with HREF that includes the begindate and enddate in the route
}
<a class="oi oi-media-skip-backward" href="/manager/@Model.MyScheduleState.DisplayBeginDate.AddDays(-7).ToString("yyyyMMdd", CultureInfo.InvariantCulture)" aria-label="Go back a week"></a>
<span>@Model.MyScheduleState.DisplayBeginDate.ToShortDateString() - @Model.MyScheduleState.DisplayEndDate.AddDays(-1).ToShortDateString()</span>
<a class="oi oi-media-skip-forward" href="/manager/@Model.MyScheduleState.DisplayBeginDate.AddDays(7).ToString("yyyyMMdd", CultureInfo.InvariantCulture)" aria-label="Go forward a week"></a>

@if (!(Model.MyScheduleState.DisplayBeginDate.Date <= DateTime.Today && Model.MyScheduleState.DisplayEndDate.Date >= DateTime.Today))
{
<a href="/manager" style="margin-left: 15px;">This Week's Schedule <span class="oi oi-calendar"></span></a>
}
<a href="" @onclick="() => Model.OnChangeDate(-7)">&lt;</a>
@Model.MyScheduleState.DisplayBeginDate.ToShortDateString() - @Model.MyScheduleState.DisplayEndDate.AddDays(-1).ToShortDateString()
<a href="" @onclick="() => Model.OnChangeDate(7)">&gt;</a>

</div>

Expand All @@ -19,11 +26,31 @@

@code {

// Cheer 642 cpayette 16/8/19
[Parameter]
public string RequestedDate
{
get { return SelectedDate.ToString("yyyyMMdd", CultureInfo.InvariantCulture); }
set
{
if (string.IsNullOrEmpty(value))
{
SelectedDate = DateTime.Today;
return;
}
SelectedDate = DateTime.ParseExact(value, "yyyyMMdd", CultureInfo.InvariantCulture);
}
}

[Parameter]
DateTime SelectedDate
public DateTime SelectedDate
{
get { return Model.SelectedDate; }
set { Model.SelectedDate = value; }
set {
Model.SelectedDate = value;
StateHasChanged();
}
}

protected override async Task OnParametersSetAsync() => await this.Model.OnParametersSetAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
// Cheer 500 cpayette 8/08/19
[Parameter]
RecurringSchedule Schedule
public RecurringSchedule Schedule
{
get { return Model.Schedule; }
set { Model.Schedule = value; }
}

[Parameter]
EventCallback OnSave
public EventCallback OnSave
{
get { return Model.OnSave; }
set { Model.OnSave = value; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
@code {

[Parameter(CaptureUnmatchedValues = true)]
Dictionary<string, object> Attributes { get; set; }
public Dictionary<string, object> Attributes { get; set; }

[Parameter]
DateTime Value { get; set; }
public DateTime Value { get; set; }

[Parameter]
EventCallback<UIChangeEventArgs> OnChange { get; set; }
public EventCallback<UIChangeEventArgs> OnChange { get; set; }

async Task ChangeHandler(UIChangeEventArgs args) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
}
}

@if (Model.MyScheduleState != null)
@if (Model.MyScheduleState != null && Model.MyScheduleState.TimeSlots != null)
{
foreach (var item in TimeSlots.Where(s => s.StartDateTime.Date == Model.SelectedDate.Date))
foreach (var item in Model.MyScheduleState.TimeSlots.Where(s => s.StartDateTime.Date == Model.SelectedDate.Date))
{
if (Model.DisplayItem(item.StartDateTime, item.EndDateTime))
{
Expand All @@ -47,31 +47,28 @@

@code {

// TODO: Simon G - Work out if it is possible to make the Model a property with a Parameter attribute and pass the whole thing in from the parent rather than using DI, there may be a timing DI vs Paramater state being set, which might be offset by component composition.
// TODO: Simon G - Work out if it is possible to make the Model a property with a Parameter attribute and pass the whole thing in from the parent rather than using DI, there may be a timing DI vs Paramater state being set, which might be offset by component composition.
// Cheer 701 themichaeljolley 09/07/19
// Cheer 600 cpayette 09/07/19
// Cheer 1500 clintonrocksmith 09/07/19
// Cheer 701 themichaeljolley 09/07/19
// Cheer 600 cpayette 09/07/19
// Cheer 1500 clintonrocksmith 09/07/19
[Parameter]
Data.ScheduleState MyScheduleState
public Data.ScheduleState MyScheduleState
{
get { return Model.MyScheduleState; }
set { Model.MyScheduleState = value; }
}

[CascadingParameter(Name = "Timeslots")] protected List<TimeSlot> TimeSlots { get; set; }


[Parameter]
DateTime DayViewStart
public DateTime DayViewStart
{
get { return Model.DayViewStart; }
set { Model.DayViewStart = value; }
}

[Parameter]
DateTime DayViewEnd
public DateTime DayViewEnd
{
get { return Model.DayViewEnd; }
set { Model.DayViewEnd = value; }
Expand All @@ -80,33 +77,29 @@
// Cheer 110 copperbeardy 14/07/19
[Parameter]
int DayCount
public int DayCount
{
get { return Model.DayCount; }
set { Model.DayCount = value; }
}

[Parameter]
bool DayDisplay
public bool DayDisplay
{
get { return Model.DayDisplay; }
set { Model.DayDisplay = value; }
}

protected override void OnInit()
{
if (Model.MyScheduleState != null)
{
Model.MyScheduleState.OnSelectedDateChanged += (o, args) => {
Console.WriteLine($"Timeslots: {Model.MyScheduleState.TimeSlots.Count} -- Parm: {TimeSlots.Count}");

};
}
base.OnInit();
}
// Cheer 142 cpayette 15/8/19
protected override void OnParametersSet()
{

MyScheduleState.OnSelectedDateChanged += (obj, args) =>
{
this.StateHasChanged();
};

this.StateHasChanged();
base.OnParametersSet();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace Fritz.ResourceManagement.WebClient.ViewModels
public class DayPickerViewModel : ComponentBase
{

protected override void OnInit()
protected override void OnInitialized()
{
Console.WriteLine($"MyScheduleState: {MyScheduleState.GetHashCode()}");
base.OnInit();
base.OnInitialized();
}

public DateTime SelectedDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ namespace Fritz.ResourceManagement.WebClient.ViewModels
{
public class DayViewViewModel
{

public DayViewViewModel(Data.ScheduleState scheduleState)
{
this.MyScheduleState = scheduleState;
}

public int HoursPerDay
{
get { return this.DayViewEnd.Subtract(this.DayViewStart).Hours; }
}

public DateTime SelectedDate
public DateTime SelectedDate
{
get { return this.MyScheduleState?.SelectedDate ?? DateTime.Today; }
}
Expand All @@ -21,8 +27,11 @@ public Schedule MySchedule
}

public Data.ScheduleState MyScheduleState { get; set; }

public DateTime DayViewStart { get; set; } = DateTime.Today.AddHours(8);

public DateTime DayViewEnd { get; set; } = DateTime.Today.AddHours(20);

public int DayCount { get; set; } = 1;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ public class ManagerScheduleViewViewModel
public DateTime SelectedDate
{
get { return this.MyScheduleState.SelectedDate; }
set { this.MyScheduleState.SelectDate(value); }
set {
this.MyScheduleState.DisplayBeginDate = this.SelectedDate.Subtract(TimeSpan.FromDays((int)value.DayOfWeek));
this.MyScheduleState.DisplayEndDate = this.MyScheduleState.DisplayBeginDate.AddDays(7);
this.MyScheduleState.SelectDate(value);
}
}

public ScheduleState MyScheduleState { get; private set; }
Expand Down
1 change: 0 additions & 1 deletion src/Fritz.ResourceManagement.WebClient/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Layouts
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.JSInterop
@using Fritz.ResourceManagement.WebClient
Expand Down
22 changes: 22 additions & 0 deletions src/Fritz.ResourceManagement.WebClient/wwwroot/css/Schedule.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,25 @@
.dayview .ends-after {
border-bottom: 0;
}

#weekSelector > span {
width: 12em;
display: inline-block;
text-align: center;
}

#weekSelector a.oi, #weekSelector a.oi:hover, #weekSelector a.oi:active {
text-decoration: none;
}

#weekSelector a.oi {
color: black;
}

#weekSelector a.oi:hover {
color: green;
}

#weekSelector a.oi:active {
color: purple;
}

0 comments on commit 6e06c92

Please sign in to comment.