Init commit

This commit is contained in:
Blake Ridgway 2025-06-17 13:22:51 -05:00
parent 9ab798fd0f
commit 1f50fedb80
87 changed files with 75678 additions and 0 deletions

105
Views/Home/Index.cshtml Normal file
View file

@ -0,0 +1,105 @@
@model turf_tasker.Models.DashboardViewModel
@{
ViewData["Title"] = "Dashboard";
}
<div class="text-center">
<h1 class="display-4">Lawn Care Dashboard</h1>
<p>Your lawn's status at a glance.</p>
</div>
<div class="row mt-4 text-center">
<!-- Last Mowed Card -->
<div class="col-md-3">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title">Last Mowed</h5>
<p class="card-text fs-4">
@if (Model.LastMowDate.HasValue)
{
@Model.LastMowDate.Value.ToString("D")
}
else
{
<span class="text-muted">Not yet logged</span>
}
</p>
</div>
<div class="card-footer">
Next Pattern: <strong>@Model.NextMowingPattern</strong>
</div>
</div>
</div>
<!-- Last Watered Card -->
<div class="col-md-3">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title">Last Watered</h5>
<p class="card-text fs-4">
@if (Model.LastWaterDate.HasValue)
{
@Model.LastWaterDate.Value.ToString("D")
}
else
{
<span class="text-muted">Not yet logged</span>
}
</p>
</div>
</div>
</div>
<!-- Last Fertilized Card -->
<div class="col-md-3">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title">Last Fertilized</h5>
<p class="card-text fs-4">
@if (Model.LastFertilizeDate.HasValue)
{
@Model.LastFertilizeDate.Value.ToString("D")
}
else
{
<span class="text-muted">Not yet logged</span>
}
</p>
</div>
</div>
</div>
<!-- Last aeration card -->
<div class="col-md-3">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title">Last Aeration</h5>
<p class="card-text fs-4">
@if (Model.LastAerationDate.HasValue)
{
@Model.LastAerationDate.Value.ToString("D")
}
else
{
<span class="text-muted">Not yet logged</span>
}
</p>
</div>
</div>
</div>
<!-- Add New Event Card -->
<div class="col-md-3">
<div class="card h-100 bg-light">
<div class="card-body d-flex flex-column justify-content-center">
<h5 class="card-title">Log a New Activity</h5>
<p class="card-text">Keep your dashboard up to date.</p>
<a asp-controller="LawnCareEvents" asp-action="Create" class="btn btn-primary mt-auto">
Add New Event
</a>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View file

@ -0,0 +1,71 @@
@model turf_tasker.Models.LawnCareEvent
@{
ViewData["Title"] = "Create";
}
<h1>Create</h1>
<h4>LawnCareEvent</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="EventType" class="control-label"></label>
<select asp-for="EventType" class="form-control" asp-items="Html.GetEnumSelectList<LawnCareEventType>()"></select>
<span asp-validation-for="EventType" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EventDate" class="control-label"></label>
<input asp-for="EventDate" class="form-control" />
<span asp-validation-for="EventDate" class="text-danger"></span>
</div>
<div id="mowingPatternGroup">
<div class="form-group">
<label asp-for="MowingPattern" class="control-label"></label>
<select asp-for="MowingPattern" class="form-control" asp-items="Html.GetEnumSelectList<MowingPattern>()"></select>
<span asp-validation-for="MowingPattern" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Notes" class="control-label"></label>
<textarea asp-for="Notes" class="form-control"></textarea>
<span asp-validation-for="Notes" class="text-danger"></span>
</div>
<div class="form-group mt-3">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script type="text/javascript">
$(document).ready(function () {
function toggleMowingPattern() {
var selectedEventType = $("#EventType").val();
if (selectedEventType == '0') { // '0' corresponds to Mowing
$("#mowingPatternGroup").show();
} else {
$("#mowingPatternGroup").hide();
}
}
toggleMowingPattern();
$("#EventType").on("change", function () {
toggleMowingPattern();
});
});
</script>
}

View file

@ -0,0 +1,45 @@
@model turf_tasker.Models.LawnCareEvent
@{
ViewData["Title"] = "Delete";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Lawn Care Event</h4>
<hr />
<dl class="row">
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.EventType)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.EventType)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.EventDate)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.EventDate)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.MowingPattern)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.MowingPattern)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Notes)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Notes)
</dd>
</dl>
<form asp-action="Delete">
<input type="hidden" asp-for="Id" />
<input type="submit" value="Delete" class="btn btn-danger" /> |
<a asp-action="Index">Back to List</a>
</form>
</div>

View file

@ -0,0 +1,83 @@
@model turf_tasker.Models.LawnCareEvent
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Lawn Care Event</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<!-- This hidden field is essential for the update to work -->
<input type="hidden" asp-for="Id" />
<div class="form-group mb-3">
<label asp-for="EventType" class="control-label"></label>
<select asp-for="EventType" class="form-control" asp-items="Html.GetEnumSelectList<LawnCareEventType>()"></select>
<span asp-validation-for="EventType" class="text-danger"></span>
</div>
<div class="form-group mb-3">
<label asp-for="EventDate" class="control-label"></label>
<input asp-for="EventDate" class="form-control" />
<span asp-validation-for="EventDate" class="text-danger"></span>
</div>
<!-- Wrapper div for our conditional JavaScript logic -->
<div id="mowingPatternGroup">
<div class="form-group mb-3">
<label asp-for="MowingPattern" class="control-label"></label>
<select asp-for="MowingPattern" class="form-control" asp-items="Html.GetEnumSelectList<MowingPattern>()"></select>
<span asp-validation-for="MowingPattern" class="text-danger"></span>
</div>
</div>
<div class="form-group mb-3">
<label asp-for="Notes" class="control-label"></label>
<textarea asp-for="Notes" class="form-control"></textarea>
<span asp-validation-for="Notes" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div class="mt-3">
<a asp-action="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script type="text/javascript">
// This script ensures the Mowing Pattern field only shows up
// when the "Mowing" activity type is selected.
$(document).ready(function () {
function toggleMowingPattern() {
// LawnCareEventType.Mowing has an integer value of 0
var selectedEventType = $("#EventType").val();
if (selectedEventType == '0') { // '0' corresponds to Mowing
$("#mowingPatternGroup").show();
} else {
$("#mowingPatternGroup").hide();
}
}
// Run the function once on page load to set the correct initial state
toggleMowingPattern();
// Re-run the function every time the dropdown value changes
$("#EventType").on("change", function () {
toggleMowingPattern();
});
});
</script>
}

View file

@ -0,0 +1,72 @@
@model turf_tasker.Models.LawnCareEvent
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>LawnCareEvent</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<div class="form-group">
<label asp-for="EventType" class="control-label"></label>
<select asp-for="EventType" class="form-control" asp-items="Html.GetEnumSelectList<LawnCareEventType>()"></select>
<span asp-validation-for="EventType" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EventDate" class="control-label"></label>
<input asp-for="EventDate" class="form-control" />
<span asp-validation-for="EventDate" class="text-danger"></span>
</div>
<div id="mowingPatternGroup">
<div class="form-group">
<label asp-for="MowingPattern" class="control-label"></label>
<select asp-for="MowingPattern" class="form-control" asp-items="Html.GetEnumSelectList<MowingPattern>()"></select>
<span asp-validation-for="MowingPattern" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Notes" class="control-label"></label>
<textarea asp-for="Notes" class="form-control"></textarea>
<span asp-validation-for="Notes" class="text-danger"></span>
</div>
<div class="form-group mt-3">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script type="text/javascript">
$(document).ready(function () {
function toggleMowingPattern() {
var selectedEventType = $("#EventType").val();
if (selectedEventType == '0') { // '0' corresponds to Mowing
$("#mowingPatternGroup").show();
} else {
$("#mowingPatternGroup").hide();
}
}
toggleMowingPattern();
$("#EventType").on("change", function () {
toggleMowingPattern();
});
});
</script>
}

View file

@ -0,0 +1,73 @@
@model IEnumerable<turf_tasker.Models.LawnCareEvent>
@{
ViewData["Title"] = "Lawn Care Log";
}
<h1>@ViewData["Title"]</h1>
<p>
<a asp-action="Create" class="btn btn-primary">Create New Event</a>
</p>
<!-- Add the search form -->
<form asp-action="Index" method="get">
<div class="form-actions no-color">
<p>
Find by type or note:
<input type="text" name="searchString" value="@ViewData["CurrentFilter"]" />
<input type="submit" value="Search" class="btn btn-secondary" /> |
<a asp-action="Index">Back to Full List</a>
</p>
</div>
</form>
<table class="table">
<thead>
<tr>
<th>
<!-- Make the header a clickable link for sorting -->
<a asp-action="Index" asp-route-sortOrder="@ViewData["TypeSortParm"]" asp-route-searchString="@ViewData["CurrentFilter"]">
@Html.DisplayNameFor(model => model.EventType)
</a>
</th>
<th>
<!-- Make the header a clickable link for sorting -->
<a asp-action="Index" asp-route-sortOrder="@ViewData["DateSortParm"]" asp-route-searchString="@ViewData["CurrentFilter"]">
@Html.DisplayNameFor(model => model.EventDate)
</a>
</th>
<th>
@Html.DisplayNameFor(model => model.MowingPattern)
</th>
<th>
@Html.DisplayNameFor(model => model.Notes)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.EventType)
</td>
<td>
@Html.DisplayFor(modelItem => item.EventDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.MowingPattern)
</td>
<td>
@Html.DisplayFor(modelItem => item.Notes)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
</tr>
}
</tbody>
</table>

25
Views/Shared/Error.cshtml Normal file
View file

@ -0,0 +1,25 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View file

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - MowLog</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/MowLog.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm border-bottom box-shadow mb-3 navbar-custom">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">MowLog</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="" asp-controller="LawnCareEvents" asp-action="Index">Mow Log</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2025 - MowLog - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View file

@ -0,0 +1,48 @@
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View file

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View file

@ -0,0 +1,3 @@
@using turf_tasker
@using turf_tasker.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

3
Views/_ViewStart.cshtml Normal file
View file

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}