Vehicle Recall integrated into Vehicle Service

This commit is contained in:
2020-09-30 21:44:38 -04:00
parent 6f031c5cb6
commit 4b44128d62
18 changed files with 236 additions and 126 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
</div>
@Html.Partial("VehicleSelect", new VehicleSelectViewModel())
@Html.Partial("EditorTemplates/VehicleSelect", new VehicleSelectViewModel())
<div class="center-content" style="text-align: center">
@Html.ActionLink("Import", "ImportUpload", new {}, new { @class = "btn"})
@@ -9,4 +9,8 @@
@Html.ActionLink(selected.Text, "Details", "VehicleRecall", new { id = selected.Value }, null)
}
}
else
{
<text>Not a recall</text>
}
}
@@ -1,5 +0,0 @@
@model MileageTraker.Web.ViewModels.SelectListViewModel
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
}
@Html.DropDownList("", new List<SelectListItem>(new List<SelectListItem>{new SelectListItem{Text = "Not a recall", Value = "None"}}))
+2 -2
View File
@@ -18,11 +18,11 @@
</div>
@if (!completed)
{
<div class="center-content">Completed? @Html.ActionLink("Add Service", "Create", "VehicleService", new { VehicleId = Model.VehicleId }, new { @class = "btn" })</div>
<div class="center-content">Completed? @Html.ActionLink("Add Service", "Create", "VehicleService", new { VehicleId = Model.VehicleId, VehicleRecallId = Model.VehicleRecallId}, new { @class = "btn" })</div>
}
<div class="center-content btn-toolbar">
@Html.ActionLink("Edit", "Edit", new { id = Model.VehicleRecallId }, new { @class = "btn" })
@Html.ActionLink("Delete", "Delete", new { id = Model.VehicleId }, new { @class = "btn" })
@Html.ActionLink("Delete", "Delete", new { id = Model.VehicleRecallId }, new { @class = "btn" })
@Html.ActionLink("Vehicle Details", "Details", "Vehicle", new { id = Model.VehicleId }, new{@class="btn"})
</div>
+19 -15
View File
@@ -1,8 +1,22 @@
@model IEnumerable<MileageTraker.Web.ViewModels.VehicleRecall.VehicleRecallViewModel>
@model MileageTraker.Web.ViewModels.VehicleRecall.VehicleRecallResultsViewModel
@{
ViewBag.Title = "Vehicle Recalls";
var grid = new WebGrid(Model, rowsPerPage: 45);
ViewBag.Title = string.Format("Vehicle Recalls ({0})", Model.Completed ? "Completed" : "Open");
var grid = new WebGrid(Model.Recalls, rowsPerPage: 45);
var columns = grid.Columns(
grid.Column("VehicleId", "Vehicle ID", item => Html.ActionLink((string) item.VehicleId, "DetailsPartial", "Vehicle", new {id = item.VehicleId}, new {@class = "qtip-modal"})),
grid.Column("Identifier", "Identifier", item => item.Identifier),
grid.Column("Description", "Description"),
grid.Column(format:
@<div class='btn-group'>
@Html.ActionLink("Details", "Details", new {id = item.VehicleRecallId}, new {@class = "btn btn-mini"})
@Html.ActionLink("Delete", "Delete", new {id = item.VehicleRecallId}, new {@class = "btn btn-mini"})
</div>)
).ToList();
if (Model.Completed)
{
columns.Insert(3, grid.Column("CompletedService_InvoiceDate", "Completed Date", item => ((DateTime)item.CompletedService_InvoiceDate).ToShortDateString()));
}
}
@Html.Partial("_StatusMessage")
@@ -11,20 +25,10 @@
<div class="btn-toolbar pull-left">
@Html.ActionLink("Add Recall", "Create", null, new { @class = "btn" })
<a class="qtip-show-next-div btn">Open Recalls @Model.Count()</a>
@Html.ActionLink(Model.Completed ? "Show Open" : "Show Completed", "Index", new { completed = !Model.Completed }, new { @class = "btn" })
</div>
@grid.GetHtml(columns:
grid.Columns(
grid.Column("VehicleId", "Vehicle ID", item => Html.ActionLink((string)item.VehicleId, "DetailsPartial", "Vehicle", new { id = item.VehicleId }, new { @class = "qtip-modal" })),
grid.Column("Identifier", "Identifier", item => item.Identifier),
grid.Column("Description", "Description"),
grid.Column(format:
@<div class='btn-group'>
@Html.ActionLink("Details", "Details", new { id = item.VehicleRecallId }, new { @class = "btn btn-mini" })
@Html.ActionLink("Delete", "Delete", new { id = item.VehicleRecallId }, new { @class = "btn btn-mini" })
</div>)
),
@grid.GetHtml(columns: columns,
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
numericLinksCount: 20
)
+9 -2
View File
@@ -1,5 +1,4 @@
@model MileageTraker.Web.ViewModels.VehicleService.VehicleServiceViewModel
@{
ViewBag.Title = "Record Vehicle Service";
}
@@ -12,9 +11,17 @@
@Html.Partial("_ValidationSummary")
<fieldset>
<legend></legend>
<div class="control-group">
<div class="control-label">
<label>Vehicle ID</label>
</div>
<div class="controls">
<b>@Model.VehicleId</b>
</div>
</div>
@Html.EditorForModel()
<div class="form-actions">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</fieldset>
}
}
+56 -36
View File
@@ -1,62 +1,82 @@
@model MileageTraker.Web.ViewModels.VehicleService.VehicleServiceResultsViewModel
@using MileageTraker.Web.ViewModels
@model MileageTraker.Web.ViewModels.VehicleService.VehicleServiceResultsViewModel
@{
ViewBag.Title = "Vehicle Service";
var grid = new WebGrid(Model.ServiceItems, rowsPerPage: 45);
var queryParams = new { Model.Year, Model.Month, Model.MonthRange, Model.VehicleId };
var serviceOverdueBadge = Model.UpcomingServiceReminders.Any(sr => sr.IsServiceOverdue) ? "badge-warning" : "";
ViewBag.Title = "Vehicle Service";
var grid = new WebGrid(Model.ServiceItems, rowsPerPage: 45);
var queryParams = new { Model.Year, Model.Month, Model.MonthRange, Model.VehicleId };
var serviceOverdueBadge = Model.UpcomingServiceReminders.Any(sr => sr.IsServiceOverdue) ? "badge-warning" : "";
}
@section Scripts {
<script type="text/javascript">
<script type="text/javascript">
var availableLogYearMonths = @Html.Raw(Json.Encode(Model.AvailableYearMonths));
@if (Model.Year != null)
{
<text>var selectedYear = "@Model.Year";</text>
<text>var selectedMonth = "@Model.Month";</text>
}
</script>
</script>
}
@Html.Partial("_StatusMessage")
<div class="btn-toolbar pull-right" style="width:600px">
@using (Html.BeginForm("Index", "VehicleService", FormMethod.Get, new { id = "filter", @class = "form" }))
{
@Html.EditorForModel()
}
@using (Html.BeginForm("Index", "VehicleService", FormMethod.Get, new { id = "filter", @class = "form" }))
{
@Html.EditorForModel()
}
</div>
<h2 id="vehicle-title"><i class="fa fa-wrench"></i> @ViewBag.Title</h2>
<div class="btn-toolbar pull-left">
@Html.ActionLink("Add Service", "Create", null, new { @class = "btn" })
@Html.ActionLink("Add Service", "SelectVehicle", null, new { @class = "btn" })
@Html.ActionLink("Export", "Export", queryParams, new { @class = "btn" })
<a class="qtip-show-next-div btn">Upcoming Services <span class="badge @serviceOverdueBadge">@Model.UpcomingServiceReminders.Count</span></a>
<div class="hidden">
@if (@Model.UpcomingServiceReminders.Count > 0)
{
@Html.Partial("UpcomingServiceReminders", Model.UpcomingServiceReminders)
}
else {
<h5>No upcoming services currently scheduled</h5>
}
</div>
<a class="qtip-show-next-div btn">Upcoming Services <span class="badge @serviceOverdueBadge">@Model.UpcomingServiceReminders.Count</span></a>
<div class="hidden">
@if (@Model.UpcomingServiceReminders.Count > 0)
{
@Html.Partial("UpcomingServiceReminders", Model.UpcomingServiceReminders)
}
else
{
<h5>No upcoming services currently scheduled</h5>
}
</div>
</div>
@grid.GetHtml(columns:
grid.Columns(
grid.Column("InvoiceDate", "Invoice Date", item => item.InvoiceDate.ToString("d")),
grid.Columns(
grid.Column("InvoiceDate", "Invoice Date", item => item.InvoiceDate.ToString("d")),
grid.Column("VehicleId", "Vehicle ID", item => Html.ActionLink((string)item.VehicleId, "DetailsPartial", "Vehicle", new { id = item.VehicleId }, new { @class = "qtip-modal" })),
grid.Column("ServiceCenterName", "Service Center Name"),
grid.Column("Price", "Price", @<text>@String.Format("{0:C}", item.Price)</text>),
grid.Column("Description", "Description"),
grid.Column(format:
@<div class='btn-group'>
@Html.ActionLink("Details", "Details", new { id = item.VehicleServiceId }, new { @class = "btn btn-mini" })
@Html.ActionLink("Delete", "Delete", new { id = item.VehicleServiceId }, new { @class = "btn btn-mini" })
</div>)
),
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
numericLinksCount: 20
)
grid.Column("ServiceCenterName", "Service Center Name"),
grid.Column("Price", "Price", @<text>@String.Format("{0:C}", item.Price)</text>),
grid.Column("Description", "Description"),
grid.Column("VehicleRecall", "Vehicle Recall", item => Recall(item.VehicleRecall)),
grid.Column(format:
@<div class='btn-group'>
@Html.ActionLink("Details", "Details", new { id = item.VehicleServiceId }, new { @class = "btn btn-mini" })
@Html.ActionLink("Delete", "Delete", new { id = item.VehicleServiceId }, new { @class = "btn btn-mini" })
</div> )
),
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" },
numericLinksCount: 20
)
@helper Recall(SelectListViewModel selectList)
{
if (selectList != null && selectList.Selected > 0)
{
var selected = selectList.Available.FirstOrDefault(i => i.Value == selectList.Selected.ToString());
if (selected != null)
{
@Html.ActionLink(selected.Text, "Details", "VehicleRecall", new { id = selected.Value }, null)
}
}
else
{
<span class="muted">(Not a recall)</span>
}
}
@@ -0,0 +1,11 @@
@using MileageTraker.Web.ViewModels.VehicleService
@model MileageTraker.Web.ViewModels.VehicleService.VehicleServiceViewModel
@{
ViewBag.Title = "Record Vehicle Service";
}
<h2 class="center-content"><i class="fa fa-wrench"></i> @ViewBag.Title</h2>
<h4 class="center-content">Track completed service for a vehicle</h4>
@Html.Partial("EditorTemplates/VehicleSelect", new VehicleSelectViewModel())
@@ -0,0 +1,2 @@
@model MileageTraker.Web.ViewModels.SelectListViewModel
@Html.EditorForModel()